Anonymous avatar Anonymous committed 4158227

Fixed high CPU usage in

There is high cpu usage caused by by registering
_do_enable_widget and _do_disable_widget for execution from
the gobject event loop. This results in about 40000 calls for each
function. The same goal can be accomplished by setting the gtk.Dialog
gtk.DIALOG_MODAL flag, which freezes the rest of the application from
user input.

Comments (0)

Files changed (1)


     def show_services_help(self, widget=None):
         """ Display a dialog with a little guide for the services module"""
         dia = gtk.Dialog(parent=self._parent, title=_("System Services Help"))
+        dia.set_modal()
         dia.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_CANCEL)
         buffer = gtk.TextBuffer()
         helpfile = os.path.join(datapath, 'servicehelp.txt')
             # 4 = Runlevel 4 value
             # 5 = Runlevel 5 value
-        # Disable parent widgets to avoid double interaction
-        self.disable_widgets()
         errors = False # Errors flag
         # Start the thread to pulse the bar
         self.progressbar.set_text(_("All operations completed successfully."))
-        # turn the widgets back on
-        self.enable_widgets()
         # automatically close this thing.
-    def _do_disable_widget(self, w):
-        w.set_property('sensitive', False)
-        return True
-    def _do_enable_widget(self, w):
-        w.set_property('sensitive', True)
-        return True
-    def enable_widgets(self):
-        for wid in self.wlist:
-            #wid.set_property('sensitive', True)
-            gobject.idle_add(self._do_enable_widget, wid)
-        return
-    def disable_widgets(self):
-        for wid in self.wlist:
-            gobject.idle_add(self._do_disable_widget, wid)
-        return
     def do_pulse(self):
         return False
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.