question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GUI is not working...

See original GitHub issue

Using (testing) v1.1.5 Using on Ubuntu 20.04

From the GUI image

Still seeing this issue image

Debugging this with the command line given here it is working.

Maybe the issue is with the flag Open spreadsheet So, if I unmark this checkbox, the whole gui hangs.

A 3rd test gave this… BOM file: board.csv Reconigzed EDAs: CSV file Open spreadsheet unmarked

[3]    76634 segmentation fault (core dumped)  kicost

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
sliedescommented, Dec 28, 2020

Ok, I believe a few issues are conflated here (especially since #421 was marked as a duplicate). I think I have an idea what’s going on.

  1. The issue in https://github.com/xesscorp/KiCost/issues/421#issuecomment-691255711: wxPython has become more strict about accepting nonsensical combinations of sizer flags. From the release notes of wxPython 4.1.1:

This should have been mentioned in the notes for the last release, but alas, it wandered away and got lost. wxWidgets is now validating the flags passed when adding items to a sizer, to ensure that they are the correct flags for the type of the sizer. If the given flags do not make sense, for example using horizontal alignment flags in a horizontal box sizer, then a wxAssertionError error is raised.

… which is exactly what happens. The error messages even tell what the problem is (“wxEXPAND flag will be overridden by alignment flags”). The solution is to either remove the wx.EXPAND flag or the alignment flags, depending on what the intent here is. Getting the GUI to start required a modification in kicost_gui.py of lines 367, 384 and 449. I’m not sending a pull request since I don’t know what the GUI is supposed to look like and hence which of the conflicting flags should be removed.

  1. The xcb/XInitThreads error. What is happening here is that GUI code is being run from a thread different than the one that created the window. This is not supported in wxPython. Specifically, it seems that formKiCost.run() is run from a different thread (started in button_run()), and it contains GUI code such as self.m_gauge_process.SetValue(0) (and lots of other GUI manipulation). This causes breakage. See eg. this thread. Hacking button_run() to just call self.run() instead of starting a thread fixes this for me.
0reactions
set-softcommented, Mar 14, 2021

Hi @hildogjr !

If you incorporate the flake8 patch first (which I strongly recommend) the #451 becomes:

diff --git a/kicost/kicost_gui.py b/kicost/kicost_gui.py
index 231e11f..bb2dcb9 100644
--- a/kicost/kicost_gui.py
+++ b/kicost/kicost_gui.py
@@ -41,7 +41,7 @@ import webbrowser  # To update informations.
 import sys
 import os
 import subprocess  # To access OS commands and run in the shell.
-import threading
+from threading import Thread
 import time  # To elapse time.
 import tempfile  # To create the temporary log file.
 from datetime import datetime  # To create the log name, when asked to save.
@@ -96,6 +96,18 @@ PAGE_POWERED_BY = 'https://kitspace.org/'
 kicostPath = os.path.dirname(os.path.abspath(__file__))  # Application dir.
 
 
+# ======================================================================
+class ChildThread(Thread):
+    """ Helper class to safetly call the run action """
+    def __init__(self, myframe):
+        """Init Worker Thread Class."""
+        Thread.__init__(self)
+        self.myframe = myframe
+
+    def run(self):
+        wx.CallAfter(self.myframe.run)
+
+
 # ======================================================================
 def open_file(filepath):
     '''@brief Open a file with the default application in different OSs.
@@ -714,10 +726,9 @@ class formKiCost(wx.Frame):
     def button_run(self, event):
         ''' @brief Call to run KiCost.'''
         event.Skip()
-        # self.run()
-        # wx.CallLater(10, self.run) # Necessary to not '(core dumped)' with wxPython.
-        t = threading.Thread(target=self.run)  # , args=[self])
-        t.start()
+        self.child = ChildThread(myframe=self)
+        self.child.daemon = True
+        self.child.start()
 
     # ----------------------------------------------------------------------
     # @anythread
Read more comments on GitHub >

github_iconTop Results From Across the Web

Problem launching graphical user interface (GUI) applications
Resolving the problem · If the user is not authorized to use the X Window session: Log out of the system. Log on...
Read more >
GUI does not start - Ask Ubuntu
10 Answers 10 · Press Ctrl Alt F7 · Press Alt F2 · Log in via terminal · Go to /etc/X11 and delete...
Read more >
GUI not shows properly in Windows 10 Pro.
1. Open "File Explorer" · 2. Click on "This PC" · 3. Right click on "C:" · 4. Click on "Proprieties" · 5....
Read more >
K46055636: Device GUI is not loading / CLI working fine - AskF5
Support Solution. You may not be able to access the Configuration Utility (GUI) if you have recently updated the Device Certificate and Key. ......
Read more >
Fixing a Broken Ubuntu GUI. Lessons learned from bad driver…
If your driver Installation failed and GUI broke down. If your GUI hung up for some reason, or the process didn't finish successfully,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found