Commit 3dff29f3 authored by sumpfralle's avatar sumpfralle

adjust the update frequency during each run of the statistics' update


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@766 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 749d636c
...@@ -1471,7 +1471,7 @@ class ProjectGui: ...@@ -1471,7 +1471,7 @@ class ProjectGui:
interval = int(max(1, self.gui.get_object( interval = int(max(1, self.gui.get_object(
"ProcessPoolRefreshInterval").get_value())) "ProcessPoolRefreshInterval").get_value()))
gobject.timeout_add_seconds(interval, gobject.timeout_add_seconds(interval,
self.update_process_pool_statistics) self.update_process_pool_statistics, interval)
self.process_pool_window.show() self.process_pool_window.show()
else: else:
self.process_pool_window.hide() self.process_pool_window.hide()
...@@ -1479,7 +1479,7 @@ class ProjectGui: ...@@ -1479,7 +1479,7 @@ class ProjectGui:
# don't destroy the window with a "destroy" event # don't destroy the window with a "destroy" event
return True return True
def update_process_pool_statistics(self): def update_process_pool_statistics(self, original_interval):
stats = pycam.Utils.threading.get_pool_statistics() stats = pycam.Utils.threading.get_pool_statistics()
model = self.process_pool_model model = self.process_pool_model
model.clear() model.clear()
...@@ -1487,8 +1487,17 @@ class ProjectGui: ...@@ -1487,8 +1487,17 @@ class ProjectGui:
model.append(item) model.append(item)
self.gui.get_object("ProcessPoolConnectedWorkersValue").set_text( self.gui.get_object("ProcessPoolConnectedWorkersValue").set_text(
str(len(stats))) str(len(stats)))
# don't repeat, if the window is hidden current_interval = int(max(1, self.gui.get_object(
return self.gui.get_object("ToggleProcessPoolWindow").get_active() "ProcessPoolRefreshInterval").get_value()))
if original_interval != current_interval:
# initiate a new repetition
gobject.timeout_add_seconds(current_interval,
self.update_process_pool_statistics, current_interval)
# stop the current repetition
return False
else:
# don't repeat, if the window is hidden
return self.gui.get_object("ToggleProcessPoolWindow").get_active()
@gui_activity_guard @gui_activity_guard
def toggle_3d_view(self, widget=None, value=None): def toggle_3d_view(self, widget=None, value=None):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment