- some fixes and prepared the activity monitor area to receive updated texts
This commit is contained in:
@@ -10,6 +10,13 @@ from flatcamGUI.FlatCAMGUI import FlatCAMActivityView
|
||||
from PyQt5 import QtCore
|
||||
import weakref
|
||||
|
||||
import gettext
|
||||
import FlatCAMTranslation as fcTranslate
|
||||
import builtins
|
||||
|
||||
fcTranslate.apply_language('strings')
|
||||
if '_' not in builtins.__dict__:
|
||||
_ = gettext.gettext
|
||||
|
||||
# import logging
|
||||
|
||||
@@ -131,6 +138,9 @@ class FCVisibleProcessContainer(QtCore.QObject, FCProcessContainer):
|
||||
|
||||
self.view = view
|
||||
|
||||
self.text_to_display_in_activity = ''
|
||||
self.new_text = ' '
|
||||
|
||||
self.something_changed.connect(self.update_view)
|
||||
|
||||
def on_done(self, proc):
|
||||
@@ -143,14 +153,23 @@ class FCVisibleProcessContainer(QtCore.QObject, FCProcessContainer):
|
||||
# self.app.log.debug("FCVisibleProcessContainer.on_change()")
|
||||
super(FCVisibleProcessContainer, self).on_change(proc)
|
||||
|
||||
# whenever there is a change update the message on activity
|
||||
self.text_to_display_in_activity = self.procs[0]().status_msg()
|
||||
|
||||
self.something_changed.emit()
|
||||
|
||||
def update_view(self):
|
||||
if len(self.procs) == 0:
|
||||
self.view.set_idle()
|
||||
self.new_text = ''
|
||||
|
||||
elif len(self.procs) == 1:
|
||||
self.view.set_busy(self.procs[0]().status_msg())
|
||||
|
||||
self.view.set_busy(self.text_to_display_in_activity + self.new_text)
|
||||
else:
|
||||
self.view.set_busy("%d processes running." % len(self.procs))
|
||||
self.view.set_busy("%d %s" % (len(self.procs), _("processes running.")))
|
||||
|
||||
def update_view_text(self, new_text):
|
||||
# this has to be called after the method 'new' inherited by this class is called with a string text as param
|
||||
self.new_text = new_text
|
||||
if len(self.procs) == 1:
|
||||
self.view.set_busy(self.text_to_display_in_activity + self.new_text)
|
||||
|
||||
Reference in New Issue
Block a user