- fixed issue with trying to access GUI from different threads by adding a new signal for printing to shell messages
This commit is contained in:
parent
2c2db0efe2
commit
039500b43f
|
@ -10,6 +10,7 @@ CHANGELOG for FlatCAM beta
|
|||
7.06.2020
|
||||
|
||||
- refactoring in camlib.py. Made sure that some conditions are met, if some of the parameters are None then return failure. Modifications in generate_from_geometry_2 and generate_from_multitool_geometry methods
|
||||
- fixed issue with trying to access GUI from different threads by adding a new signal for printing to shell messages
|
||||
|
||||
6.06.2020
|
||||
|
||||
|
|
|
@ -137,9 +137,9 @@ class AppObject(QtCore.QObject):
|
|||
return "fail"
|
||||
|
||||
t2 = time.time()
|
||||
msg = "%f seconds executing initialize()." % (t2 - t1)
|
||||
msg = "New object with name: %s. %f seconds executing initialize()." % (name, (t2 - t1))
|
||||
log.debug(msg)
|
||||
self.app.shell_message(msg)
|
||||
self.app.inform_shell.emit(msg)
|
||||
|
||||
if return_value == 'fail':
|
||||
log.debug("Object (%s) parsing and/or geometry creation failed." % kind)
|
||||
|
|
|
@ -2083,14 +2083,14 @@ class ToolIsolation(AppTool, Gerber):
|
|||
self.app.inform.emit("[WARNING] %s" % _("Partial failure. The geometry was processed with all tools.\n"
|
||||
"But there are still not-isolated geometry elements. "
|
||||
"Try to include a tool with smaller diameter."))
|
||||
self.app.shell_message(msg=_("The following are coordinates for the copper features "
|
||||
"that could not be isolated:"))
|
||||
msg = _("The following are coordinates for the copper features that could not be isolated:")
|
||||
self.app.inform_shell.emit(msg)
|
||||
msg = ''
|
||||
for geo in work_geo:
|
||||
pt = geo.representative_point()
|
||||
coords = '(%s, %s), ' % (str(pt.x), str(pt.y))
|
||||
msg += coords
|
||||
self.app.shell_message(msg=msg)
|
||||
self.app.inform_shell.emit(msg=msg)
|
||||
|
||||
def combined_normal(self, iso_obj, iso2geo, tools_storage, lim_area, negative_dia=None, plot=True):
|
||||
"""
|
||||
|
|
11
app_Main.py
11
app_Main.py
|
@ -203,9 +203,10 @@ class App(QtCore.QObject):
|
|||
# ###############################################################################################################
|
||||
|
||||
# Inform the user
|
||||
# Handled by:
|
||||
# * App.info() --> Print on the status bar
|
||||
# Handled by: App.info() --> Print on the status bar
|
||||
inform = QtCore.pyqtSignal([str], [str, bool])
|
||||
# Handled by: App.info_shell() --> Print on the shell
|
||||
inform_shell = QtCore.pyqtSignal(str)
|
||||
|
||||
app_quit = QtCore.pyqtSignal()
|
||||
|
||||
|
@ -762,6 +763,9 @@ class App(QtCore.QObject):
|
|||
self.inform[str].connect(self.info)
|
||||
self.inform[str, bool].connect(self.info)
|
||||
|
||||
# signal for displaying messages in the shell
|
||||
self.inform_shell.connect(self.info_shell)
|
||||
|
||||
# signal to be called when the app is quiting
|
||||
self.app_quit.connect(self.quit_application, type=Qt.QueuedConnection)
|
||||
self.message.connect(lambda: message_dialog(parent=self.ui))
|
||||
|
@ -2428,6 +2432,9 @@ class App(QtCore.QObject):
|
|||
if msg != '' and shell_echo is True:
|
||||
self.shell_message(msg)
|
||||
|
||||
def info_shell(self, msg):
|
||||
self.shell_message(msg=msg)
|
||||
|
||||
def on_import_preferences(self):
|
||||
"""
|
||||
Loads the application default settings from a saved file into
|
||||
|
|
|
@ -100,4 +100,4 @@ class TclCommandSetOrigin(TclCommand):
|
|||
self.app.on_set_zero_click(event=None, location=loc, noplot=True, use_thread=False)
|
||||
msg = '[success] Tcl %s: %s' % (_('Origin set by offsetting all loaded objects with '),
|
||||
'{0:.4f}, {0:.4f}'.format(loc[0], loc[1]))
|
||||
self.app.shell_message(msg, success=True, show=False)
|
||||
self.app.inform_shell.emit(msg)
|
||||
|
|
|
@ -79,18 +79,16 @@ class TclCommandSetPath(TclCommand):
|
|||
"The provided path",
|
||||
str(path),
|
||||
"is a path to file and not a directory as expected.")
|
||||
self.app.shell_message(msg, success=True, show=False)
|
||||
self.app.inform_shell.emit(msg)
|
||||
return "Failed. The Tcl command set_path was used but it was not a directory."
|
||||
else:
|
||||
msg = '[ERROR] %s: %s, %s' % (
|
||||
"The provided path",
|
||||
str(path),
|
||||
"do not exist. Check for typos.")
|
||||
self.app.shell_message(msg, success=True, show=False)
|
||||
"The provided path", str(path), "do not exist. Check for typos.")
|
||||
self.app.inform_shell.emit(msg)
|
||||
return "Failed. The Tcl command set_path was used but it does not exist."
|
||||
|
||||
cd_command = 'cd %s' % path
|
||||
self.app.shell.exec_command(cd_command, no_echo=False)
|
||||
self.app.defaults["global_tcl_path"] = str(path)
|
||||
msg = '[success] %s: %s' % ("Relative path set to", str(path))
|
||||
self.app.shell_message(msg, success=True, show=False)
|
||||
self.app.inform_shell.emit(msg)
|
||||
|
|
Loading…
Reference in New Issue