- remade visibility threaded
- reimplemented the thread listening for new FlatCAM process starting with args so it is no longer subclassed but using the moveToThread function
This commit is contained in:
@@ -216,9 +216,15 @@ class App(QtCore.QObject):
|
|||||||
# #########################################################################
|
# #########################################################################
|
||||||
# Setup the listening thread for another instance launching with args #####
|
# Setup the listening thread for another instance launching with args #####
|
||||||
# #########################################################################
|
# #########################################################################
|
||||||
|
|
||||||
|
# make sure the thread is stored by using a self. otherwise it's garbage collected
|
||||||
|
self.th = QtCore.QThread()
|
||||||
|
self.th.start(priority=QtCore.QThread.LowestPriority)
|
||||||
|
|
||||||
self.new_launch = ArgsThread()
|
self.new_launch = ArgsThread()
|
||||||
self.new_launch.start(priority=QtCore.QThread.IdlePriority)
|
|
||||||
self.new_launch.open_signal[list].connect(self.on_startup_args)
|
self.new_launch.open_signal[list].connect(self.on_startup_args)
|
||||||
|
self.new_launch.moveToThread(self.th)
|
||||||
|
self.new_launch.start.emit()
|
||||||
|
|
||||||
from win32com.shell import shell, shellcon
|
from win32com.shell import shell, shellcon
|
||||||
if platform.architecture()[0] == '32bit':
|
if platform.architecture()[0] == '32bit':
|
||||||
@@ -2029,8 +2035,8 @@ class App(QtCore.QObject):
|
|||||||
self.shell.setWindowIcon(self.ui.app_icon)
|
self.shell.setWindowIcon(self.ui.app_icon)
|
||||||
self.shell.setWindowTitle("FlatCAM Shell")
|
self.shell.setWindowTitle("FlatCAM Shell")
|
||||||
self.shell.resize(*self.defaults["global_shell_shape"])
|
self.shell.resize(*self.defaults["global_shell_shape"])
|
||||||
self.shell.append_output("FlatCAM %s (c)2014-2019 Juan Pablo Caram " % self.version)
|
self.shell.append_output("FlatCAM %s - " % self.version)
|
||||||
self.shell.append_output(_("(Type help to get started)\n\n"))
|
self.shell.append_output(_("Type help to get started\n\n"))
|
||||||
|
|
||||||
self.init_tcl()
|
self.init_tcl()
|
||||||
|
|
||||||
@@ -9639,14 +9645,19 @@ The normal flow when working in FlatCAM is the following:</span></p>
|
|||||||
obj.to_form() # Update UI
|
obj.to_form() # Update UI
|
||||||
|
|
||||||
|
|
||||||
class ArgsThread(QtCore.QThread):
|
class ArgsThread(QtCore.QObject):
|
||||||
open_signal = pyqtSignal(list)
|
open_signal = pyqtSignal(list)
|
||||||
|
start = pyqtSignal()
|
||||||
|
|
||||||
if sys.platform == 'win32':
|
if sys.platform == 'win32':
|
||||||
address = (r'\\.\pipe\NPtest', 'AF_PIPE')
|
address = (r'\\.\pipe\NPtest', 'AF_PIPE')
|
||||||
else:
|
else:
|
||||||
address = ('/tmp/testipc', 'AF_UNIX')
|
address = ('/tmp/testipc', 'AF_UNIX')
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
super(ArgsThread, self).__init__()
|
||||||
|
self.start.connect(self.run)
|
||||||
|
|
||||||
def my_loop(self, address):
|
def my_loop(self, address):
|
||||||
try:
|
try:
|
||||||
listener = Listener(*address)
|
listener = Listener(*address)
|
||||||
@@ -9669,6 +9680,9 @@ class ArgsThread(QtCore.QThread):
|
|||||||
self.open_signal.emit(msg)
|
self.open_signal.emit(msg)
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
|
# the decorator is a must; without it this technique will not work unless the start signal is connected
|
||||||
|
# in the main thread (where this class is instantiated) after the instance is moved o the new thread
|
||||||
|
@pyqtSlot()
|
||||||
def run(self):
|
def run(self):
|
||||||
self.my_loop(self.address)
|
self.my_loop(self.address)
|
||||||
|
|
||||||
|
|||||||
@@ -344,7 +344,7 @@ class FlatCAMObj(QtCore.QObject):
|
|||||||
return self.shapes.visible
|
return self.shapes.visible
|
||||||
|
|
||||||
@visible.setter
|
@visible.setter
|
||||||
def visible(self, value, threaded=False):
|
def visible(self, value, threaded=True):
|
||||||
log.debug("FlatCAMObj.visible()")
|
log.debug("FlatCAMObj.visible()")
|
||||||
|
|
||||||
def worker_task(app_obj):
|
def worker_task(app_obj):
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class WorkerStack(QtCore.QObject):
|
|||||||
thread.started.connect(worker.run)
|
thread.started.connect(worker.run)
|
||||||
worker.task_completed.connect(self.on_task_completed)
|
worker.task_completed.connect(self.on_task_completed)
|
||||||
|
|
||||||
thread.start(QtCore.QThread.NormalPriority)
|
thread.start(QtCore.QThread.HighPriority)
|
||||||
|
|
||||||
self.workers.append(worker)
|
self.workers.append(worker)
|
||||||
self.threads.append(thread)
|
self.threads.append(thread)
|
||||||
|
|||||||
@@ -9,6 +9,11 @@ CAD program, and create G-Code for Isolation routing.
|
|||||||
|
|
||||||
=================================================
|
=================================================
|
||||||
|
|
||||||
|
6.09.2019
|
||||||
|
|
||||||
|
- remade visibility threaded
|
||||||
|
- reimplemented the thread listening for new FlatCAM process starting with args so it is no longer subclassed but using the moveToThread function
|
||||||
|
|
||||||
5.09.2019
|
5.09.2019
|
||||||
|
|
||||||
- fixed issue with loading files at start-up
|
- fixed issue with loading files at start-up
|
||||||
|
|||||||
@@ -1743,7 +1743,7 @@ class _BrowserTextEdit(QTextEdit):
|
|||||||
|
|
||||||
def clear(self):
|
def clear(self):
|
||||||
QTextEdit.clear(self)
|
QTextEdit.clear(self)
|
||||||
text = "FlatCAM %s (c)2014-2019 Juan Pablo Caram (Type help to get started)\n\n" % self.version
|
text = "FlatCAM %s - Type help to get started\n\n" % self.version
|
||||||
text = html.escape(text)
|
text = html.escape(text)
|
||||||
text = text.replace('\n', '<br/>')
|
text = text.replace('\n', '<br/>')
|
||||||
self.moveCursor(QTextCursor.End)
|
self.moveCursor(QTextCursor.End)
|
||||||
|
|||||||
Reference in New Issue
Block a user