Commit 93f2a592 authored by sumpfralle's avatar sumpfralle

use lazy updates for memory analyzer plugin


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@1238 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 9f414773
......@@ -22,7 +22,7 @@
<object class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<property name="spacing">4</property>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
......@@ -97,6 +97,20 @@
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="MemoryAnalyzerLoadingLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">Updating memory usage data ...</property>
<attributes>
<attribute name="style" value="italic"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
<child internal-child="action_area">
<object class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
......
......@@ -21,6 +21,7 @@ along with PyCAM. If not, see <http://www.gnu.org/licenses/>.
"""
import gobject
import guppy
import pycam.Plugins
......@@ -92,9 +93,16 @@ class MemoryAnalyzer(pycam.Plugins.PluginBase):
return True
def refresh_memory_analyzer(self, widget=None):
memory_state = guppy.hpy().heap()
self.model.clear()
self.gui.get_object("MemoryAnalyzerLoadingLabel").show()
self.gui.get_object("MemoryAnalyzerRefreshButton").set_sensitive(False)
gobject.idle_add(self._refresh_data_in_background)
def _refresh_data_in_background(self):
memory_state = guppy.hpy().heap()
for row in memory_state.stat.get_rows():
item = (row.name, row.count, row.size / 1024, row.size / row.count)
self.model.append(item)
self.gui.get_object("MemoryAnalyzerRefreshButton").set_sensitive(True)
self.gui.get_object("MemoryAnalyzerLoadingLabel").hide()
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