def destroyParameterTable(self): debug.mainthreadTest() if self.paramtable is not None: table = self.paramtable self.paramtable = None table.destroy() switchboard.removeCallback(self.sbcallback)
def deactivate(self): debug.mainthreadTest() if self.active: toolboxGUI.GfxToolbox.deactivate(self) # self.gfxwindow().removeMouseHandler() for s in self.sb_callbacks: switchboard.removeCallback(s) self.sb_callbacks = []
def deactivate(self): debug.mainthreadTest() ## TODO: Should this call GfxToolbox.deactivate(self)? self.gfxwindow().removeMouseHandler() self.gfxwindow().setRubberband(rubberband.NoRubberBand()) for s in self.sb_callbacks: switchboard.removeCallback(s) self.sb_callbacks = []
def destroy(self, destroy_canvaslayer=True): self.gfxwindow = None # TODO OPT: Is this necessary? if self.whoChangedSignal: switchboard.removeCallback(self.whoChangedSignal) switchboard.removeCallback(self.whoRenamedSignal) if destroy_canvaslayer and self.canvaslayer is not None: mainthread.runBlock(self.canvaslayer.destroy) self.canvaslayer = None
def destroyCB(self, *args, **kwargs): if self.gtk is not None: # recursion suppression selfgtk = self.gtk self.gtk = None map(switchboard.removeCallback, self.sbcallbacks) if self.whowidgetsignal: switchboard.removeCallback(self.whowidgetsignal) mainthread.runBlock(selfgtk.destroy) layereditor.LayerEditor.destroy(self)
def update(self, registry, obj=None, interactive=0): debug.mainthreadTest() self.registry = registry regs = [reg for reg in registry if self.includeRegistration(reg)] names = [reg.name() for reg in regs] helpdict = {} for reg in regs: if reg.tip: helpdict[reg.name()] = reg.tip self.options.update(names, helpdict) if self.paramWidget: switchboard.removeCallback(self.widgetcallback) self.paramWidget.destroy() if self.currentOption is not None: oldoption = self.currentOption.name() else: oldoption = None self.paramWidget = None self.widgetcallback = None self.currentOption = None self.show() # If obj is None, see if there's a new option with the same # name as the old one, and use it to initialize the chooser # state. if obj is None and oldoption in names and not self.useDefault: obj = oldoption # Set initial values. if obj is not None: # If obj is a string, look for a registration with that # name. if type(obj)==types.StringType: for reg in registry: if self.includeRegistration(reg) and reg.name()==obj: self.setByRegistration(reg, interactive) return else: # If obj is an instance of a legal subclass, set it. for reg in regs: if isinstance(obj, reg.subclass): self.set(obj, interactive) return # obj is None, or is not a valid setting. Use the first item # in the list instead. for registration in registry: if self.includeRegistration(registration): self.setByRegistration(registration, interactive) return
def makeWidget(self): debug.mainthreadTest() if self.sbcallback: switchboard.removeCallback(self.sbcallback) self._box.foreach(gtk.Object.destroy) try: self._widget = self.rclfactory. \ widgetdict[self.registration.subclass] \ (registration.params, scope=self.rclfactory, name=self.registration.name()) except KeyError: # no special widget defined self._widget = ParameterTable(self.registration.params, scope=self.rclfactory, name=self.registration.name()) self._box.pack_start(self._widget.gtk, expand=0, fill=0) self.widgetcallback = switchboard.requestCallbackMain(self._widget, self.widgetCB)
def findWhoWidget(self): # Set up the signals for the WhoWidget for the AnyWhoParameter # that underlies the 'object' argument to the # LayerSet.DisplayedObject command. This widget is replaced # each time the WhoClassParameterWidget changes state, so # communications have to be reestablished. debug.mainthreadTest() if self.whowidgetsignal is not None: block = self.whowidgetsignal.is_blocked() switchboard.removeCallback(self.whowidgetsignal) else: block = 0 self.whowidget = self.findWidget( lambda w: isinstance(w, whowidget.WhoWidget)) self.whowidgetsignal = switchboard.requestCallbackMain( self.whowidget, self.whoChangedCB) if block: self.whowidgetsignal.block()
def setWho(self, hoo): if hoo is self._who: return True self._who = hoo if self.whoChangedSignal: switchboard.removeCallback(self.whoChangedSignal) switchboard.removeCallback(self.whoRenamedSignal) self.whoChangedSignal = None if hoo is not None: # whoChanged should return True if it did *not* do # everything that setParams does. Some subclasses can't # separate the jobs of whoChanged and setParams. They # should define both functions and have them do the same # thing, but return False from whoChanged(). status = self.whoChanged() self.whoChangedSignal = switchboard.requestCallback( ("who changed", hoo.classname), self._whoChangedCB) self.whoRenamedSignal = switchboard.requestCallback( ("rename who", hoo.classname), self._whoRenamedCB) return status
def buildWidget(self): debug.mainthreadTest() if self.whopwidget: self.whopwidget.destroy() self.whoclassname = self.classwidget.get_value() whoclass = whoville.getClass(self.whoclassname) # Create a WhoWidget that doesn't exclude proxy who # objects. If it's necessary to create an # AnyWhoParameterWidget with a different exclusion policy, # then the AnyWhoParameter will need to have a 'condition' # attribute that can be passed in to the widget. self.whopwidget = WhoParameterWidget(whoclass, scope=self, sort=whoville.proxiesLast, condition=lambda x: 1) if self.whoSignal: switchboard.removeCallback(self.whoSignal) self.whoSignal = switchboard.requestCallbackMain( self.whopwidget, self.whoChangedCB) self.gtk.pack_start(self.whopwidget.gtk) self.gtk.show_all() self.widgetChanged(self.get_value() is not None, interactive=0)
def destroy(self, destroy_canvaslayer=True): if self.whoChangedSignal: switchboard.removeCallback(self.whoChangedSignal) switchboard.removeCallback(self.whoRenamedSignal) # If the graphics window is being closed, the layers are # destroyed *after* the gtk 'destroy' signal is sent to the # gtk objects. This is unavoidable, because the window's # destruction may have been triggered by the window manager's # close button, which sends the signal. In that case, the # window that the objects are using has already been # destroyed, and the OOFCanvasLayer calls that remove items # from the window will fail with an X11 BadDrawable error. So # if the window is being destroyed, 'destroy_canvaslayer' # should be set to False, and we don't bother removing objects # from the window. if destroy_canvaslayer and self.canvaslayer is not None: # This is called on a subthread when removing a single # layer, but on the main thread if the graphics window is # being closed, so mainthread.runBlock is required. mainthread.runBlock(self.canvaslayer.destroy) self.canvaslayer = None self.gfxwindow = None # Is this necessary? It's not harmful.
def __del__(self): switchboard.removeCallback(self.dw_valid_swcb) self.dw_valid_swcb = None
def close(self): for s in self.sb_callbacks: switchboard.removeCallback(s)
def cleanUp(self): switchboard.removeCallback(self.sbcallback) parameterwidgets.BooleanWidget.cleanUp(self)
def cleanUp(self): switchboard.removeCallback(self.agg_callback) parameterwidgets.EnumWidget.cleanUp(self)
def deactivate(self): if self.signal: switchboard.removeCallback(self.switchboardCB)
def cleanUp(self): switchboard.removeCallback(self.sbcallback) ParameterWidget.cleanUp(self)
def cleanUp(self): switchboard.removeCallback(self.sbcb) for widget in self.widgetset: widget.cleanUp() parameterwidgets.ParameterWidget.cleanUp(self)
def cleanUp(self): switchboard.removeCallback(self.sbcb) regclassfactory.RegisteredClassFactory.cleanUp(self)
def cleanUp(self): parameterwidgets.ParameterWidget.cleanUp(self) switchboard.removeCallback(self.classSignal) if self.whoSignal: switchboard.removeCallback(self.whoSignal)
def cleanUp(self): parameterwidgets.ParameterWidget.cleanUp(self) switchboard.removeCallback(self.sb)
def cleanUp(self): parameterwidgets.ParameterWidget.cleanUp(self) self.destroyScope() switchboard.removeCallback(self.wwcallback)
def close(self): debug.mainthreadTest() switchboard.removeCallback(self.sbcallback) self.dialog.destroy() self.destroyScope()
def close(self): switchboard.removeCallback(self.sbcb) pixelinfoplugin.PixelInfoPlugIn.close(self)
def destroyCB(self, *args): switchboard.removeCallback(self.sbcb)
def cleanUp(self): debug.mainthreadTest() switchboard.removeCallback(self.sbcallback) parameterwidgets.ParameterWidget.cleanUp(self) del self.classwidgets del self.tablelabels
def cleanUp(self): switchboard.removeCallback(self.sbcb)
def destroy(self): switchboard.removeCallback(self.sbcallback) microstructure.MicrostructurePlugIn.destroy(self)
def stop_callbacks(self): for s in self.sb_callbacks: switchboard.removeCallback(s) self.sb_callbacks = []
def cleanUp(self): if self.widgetcallback is not None: switchboard.removeCallback(self.widgetcallback) self.widgetcallback = None RCFBase.cleanUp(self)
def cleanUp(self): switchboard.removeCallback(self.widgetcallback)
def cleanUp(self): self.chooser.destroy() for s in self.sbcbs: switchboard.removeCallback(s) parameterwidgets.ParameterWidget.cleanUp(self)