def busycheck(self, data=None): gtk.gdk.threads_enter() if (worker.is_busy()): self.wTree.busyindicator.show() else: self.wTree.busyindicator.hide() gtk.gdk.threads_leave() return True
def on_bstartstop_clicked(self, widget, data=None): button = self.wTree.bstartstop if (worker.is_busy() and (button.get_label() == 'Stop')): __main__.STOP_FLAG = True button.set_sensitive(False) self.wTree.bpause.set_sensitive(False) # [01sep09 ichuang] disable pause button __main__.PAUSE_FLAG = False button.set_label('Start') elif (self.logic and not worker.is_busy() and (button.get_label() == 'Start')): __main__.STOP_FLAG = False self.wTree.binitialize.set_sensitive(False) self.wTree.breset.set_sensitive(False) self.wTree.bpause.set_sensitive(True) # [01sep09 ichuang] enable pause button __main__.PAUSE_FLAG = False button.set_label('Stop') self.logic.run() return
def on_iomenu_activate(self, current, data=None): if (worker.is_busy()): print "Worker busy, ignoring io request!" return if (current.get_active()): self.register_io(current.get_name()) else: self.unregister_io(current.get_name()) return True
def on_registerAllIOs_activate(self, data=None): if (worker.is_busy()): print "Worker busy, ignoring io request!" return io_modules = os.listdir(IO_MOD_DIR) io_modules.sort() for name in io_modules: if (not name.endswith(".py")): continue current = name[:-3] self.register_io(current) return True
def on_quit_activate(self, widget, data=None): if (worker.is_busy()): print "Worker busy, ignoring quit request!" return try: if (self.logic): self.unregister_logic() for iostream in self.io_streams.keys(): self.unregister_io(iostream) finally: gtk.main_quit() return
def unregister_logic(self): if (self.logic): try: self.wTree.progressbar.set_fraction(0.0) self.logic.unregister() self.logic = None if not worker.is_busy(): self.wTree.bstartstop.set_sensitive(False) self.wTree.binitialize.set_sensitive(False) self.wTree.breset.set_sensitive(False) self.status_message("Unregistered logic") except Exception, e: print "Exception occured", e traceback.print_exc()
if (self.logic): return try: module = __import__(circuit) self.logic = module.logic_circuit(self.wTree.logicframe) self.logic.register() except Exception, e: print "Exception occured", e traceback.print_exc() try: self.unregister_logic(); except: pass return None self.regenerate_hooks() if not worker.is_busy(): self.wTree.binitialize.set_sensitive(True) self.wTree.breset.set_sensitive(True) self.status_message("Registered logic %s"%(circuit)) return True #################################################################### # unregister_logic # # If there's a logic registered, call it's unregister method, and # zero out the self.logic variable. Changed the start, init, reset # buttons to disabled #################################################################### def unregister_logic(self): if (self.logic):