Merged marius_stanciu/flatcam_beta/Beta 8.992 into Beta
This commit is contained in:
commit
ef6b5bcfe5
|
@ -7,6 +7,10 @@ CHANGELOG for FlatCAM beta
|
||||||
|
|
||||||
=================================================
|
=================================================
|
||||||
|
|
||||||
|
29.04.2020
|
||||||
|
|
||||||
|
- added a try-except clause in the FlatCAMTranslation.restart_program() when closing the Listener and the thread that runs it to adjust to MacOS usage
|
||||||
|
|
||||||
28.04.2020
|
28.04.2020
|
||||||
|
|
||||||
- handled a possible situation in App.load_defaults() method
|
- handled a possible situation in App.load_defaults() method
|
||||||
|
|
|
@ -1428,10 +1428,10 @@ class App(QtCore.QObject):
|
||||||
self.ui.general_defaults_form.general_app_group.version_check_cb.get_value() is True:
|
self.ui.general_defaults_form.general_app_group.version_check_cb.get_value() is True:
|
||||||
App.log.info("Checking for updates in backgroud (this is version %s)." % str(self.version))
|
App.log.info("Checking for updates in backgroud (this is version %s)." % str(self.version))
|
||||||
|
|
||||||
self.thr2 = QtCore.QThread()
|
# self.thr2 = QtCore.QThread()
|
||||||
self.worker_task.emit({'fcn': self.version_check,
|
self.worker_task.emit({'fcn': self.version_check,
|
||||||
'params': []})
|
'params': []})
|
||||||
self.thr2.start(QtCore.QThread.LowPriority)
|
# self.thr2.start(QtCore.QThread.LowPriority)
|
||||||
|
|
||||||
# ###########################################################################################################
|
# ###########################################################################################################
|
||||||
# ##################################### Register files with FlatCAM; #######################################
|
# ##################################### Register files with FlatCAM; #######################################
|
||||||
|
@ -3526,6 +3526,7 @@ class App(QtCore.QObject):
|
||||||
|
|
||||||
:return: None
|
:return: None
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if self.save_in_progress:
|
if self.save_in_progress:
|
||||||
self.inform.emit('[WARNING_NOTCL] %s' % _("Application is saving the project. Please wait ..."))
|
self.inform.emit('[WARNING_NOTCL] %s' % _("Application is saving the project. Please wait ..."))
|
||||||
return
|
return
|
||||||
|
@ -3607,25 +3608,30 @@ class App(QtCore.QObject):
|
||||||
|
|
||||||
log.debug("App.quit_application() --> App UI state saved.")
|
log.debug("App.quit_application() --> App UI state saved.")
|
||||||
|
|
||||||
# try to quit the QThread that run ArgsThread class
|
|
||||||
try:
|
|
||||||
self.th.quit()
|
|
||||||
except Exception as e:
|
|
||||||
log.debug("App.quit_application() --> %s" % str(e))
|
|
||||||
|
|
||||||
# try to quit the Socket opened by ArgsThread class
|
# try to quit the Socket opened by ArgsThread class
|
||||||
try:
|
try:
|
||||||
|
self.new_launch.thread_exit = True
|
||||||
self.new_launch.listener.close()
|
self.new_launch.listener.close()
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
log.debug("App.quit_application() --> %s" % str(err))
|
log.debug("App.quit_application() --> %s" % str(err))
|
||||||
|
|
||||||
|
# try to quit the QThread that run ArgsThread class
|
||||||
|
try:
|
||||||
|
self.th.terminate()
|
||||||
|
except Exception as e:
|
||||||
|
log.debug("App.quit_application() --> %s" % str(e))
|
||||||
|
|
||||||
|
# terminate workers
|
||||||
|
self.workers.__del__()
|
||||||
|
|
||||||
# quit app by signalling for self.kill_app() method
|
# quit app by signalling for self.kill_app() method
|
||||||
# self.close_app_signal.emit()
|
# self.close_app_signal.emit()
|
||||||
|
|
||||||
QtWidgets.qApp.quit()
|
QtWidgets.qApp.quit()
|
||||||
|
|
||||||
# When the main event loop is not started yet in which case the qApp.quit() will do nothing
|
# When the main event loop is not started yet in which case the qApp.quit() will do nothing
|
||||||
# we use the following command
|
# we use the following command
|
||||||
# sys.exit(0)
|
# sys.exit(0)
|
||||||
|
|
||||||
os._exit(0) # fix to work with Python 3.8
|
os._exit(0) # fix to work with Python 3.8
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -10850,13 +10856,14 @@ class ArgsThread(QtCore.QObject):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(ArgsThread, self).__init__()
|
super(ArgsThread, self).__init__()
|
||||||
self.listener = None
|
self.listener = None
|
||||||
|
self.thread_exit = False
|
||||||
|
|
||||||
self.start.connect(self.run)
|
self.start.connect(self.run)
|
||||||
|
|
||||||
def my_loop(self, address):
|
def my_loop(self, address):
|
||||||
try:
|
try:
|
||||||
self.listener = Listener(*address)
|
self.listener = Listener(*address)
|
||||||
while True:
|
while self.thread_exit is False:
|
||||||
conn = self.listener.accept()
|
conn = self.listener.accept()
|
||||||
self.serve(conn)
|
self.serve(conn)
|
||||||
except socket.error:
|
except socket.error:
|
||||||
|
@ -10882,7 +10889,7 @@ class ArgsThread(QtCore.QObject):
|
||||||
self.serve(conn)
|
self.serve(conn)
|
||||||
|
|
||||||
def serve(self, conn):
|
def serve(self, conn):
|
||||||
while True:
|
while self.thread_exit is False:
|
||||||
msg = conn.recv()
|
msg = conn.recv()
|
||||||
if msg == 'close':
|
if msg == 'close':
|
||||||
break
|
break
|
||||||
|
|
|
@ -184,11 +184,18 @@ def restart_program(app, ask=None):
|
||||||
else:
|
else:
|
||||||
resource_loc = 'assets/resources'
|
resource_loc = 'assets/resources'
|
||||||
|
|
||||||
# close the Socket in ArgsThread class
|
# try to quit the Socket opened by ArgsThread class
|
||||||
|
try:
|
||||||
|
app.new_launch.thread_exit = True
|
||||||
app.new_launch.listener.close()
|
app.new_launch.listener.close()
|
||||||
|
except Exception as err:
|
||||||
|
log.debug("FlatCAMTranslation.restart_program() --> %s" % str(err))
|
||||||
|
|
||||||
# close the QThread that runs ArgsThread class
|
# try to quit the QThread that run ArgsThread class
|
||||||
|
try:
|
||||||
app.th.quit()
|
app.th.quit()
|
||||||
|
except Exception as err:
|
||||||
|
log.debug("FlatCAMTranslation.restart_program() --> %s" % str(err))
|
||||||
|
|
||||||
if app.should_we_save and app.collection.get_list() or ask is True:
|
if app.should_we_save and app.collection.get_list() or ask is True:
|
||||||
msgbox = QtWidgets.QMessageBox()
|
msgbox = QtWidgets.QMessageBox()
|
||||||
|
|
Loading…
Reference in New Issue