def initialize(self, gfxwindow, layerNumber=None): layereditor.LayerEditor.initialize(self, gfxwindow, layerNumber) gtklogger.checkpoint("layereditor layerset changed") self.setData("gfxwindow", gfxwindow) if gfxwindow is not None: mainthread.runBlock(self.destinationMenu.set_state, (gfxwindow.name,))
def updateAAInfo(self): # must be called on subthread debug.subthreadTest() ms = self.getCurrentMS() if ms is not None: activearea = ms.getObject().activearea activearea.begin_reading() try: aasize = activearea.size() mssize = ms.getObject().sizeInPixels() if config.dimension()==2: mpxls = mssize[0] * mssize[1] pixstring="pixels" elif config.dimension()==3: mpxls = mssize[0] * mssize[1] * mssize[2] pixstring="voxels" apxls = mpxls - aasize if ms.getObject().activearea.getOverride(): msg = "OVERRIDE: all %d %s are active" % (mpxls, pixstring) else: msg = "%d of %d %s are active" % (apxls, mpxls, pixstring) finally: activearea.end_reading() else: msg = "No Microstructure selected" mainthread.runBlock(self.aainfo.set_text, (msg,)) gtklogger.checkpoint("active area status updated")
def sensitize_thread(self): debug.mainthreadTest() self.clear.set_sensitive(self.clearable()) self.prev.set_sensitive(self.prev_able()) self.next.set_sensitive(self.next_able()) gtklogger.checkpoint(self.gfxwindow().name + " " + self._name + " sensitized")
def sensitize_subthread(self): def set_button_sensitivity(u, r, c): self.undobutton.set_sensitive(u) self.redobutton.set_sensitive(r) self.clearbutton.set_sensitive(c) def set_ok_sensitivity(selection): ok = selection is not None and \ self.selectionModFactory.isValid() self.okbutton.set_sensitive(ok) (ms, selection) = mainthread.runBlock(self.getSelectionContext) if selection is not None: selection.begin_reading() try: u = selection.undoable() r = selection.redoable() c = selection.clearable() finally: selection.end_reading() else: (u, r, c) = (0, 0, 0) mainthread.runBlock(set_button_sensitivity, (u, r, c)) mainthread.runBlock(set_ok_sensitivity, (selection, )) gtklogger.checkpoint("pixel page sensitized")
def initialize(self, gfxwindow, layerNumber=None): layereditor.LayerEditor.initialize(self, gfxwindow, layerNumber) gtklogger.checkpoint("layereditor layerset changed") self.setData("gfxwindow", gfxwindow) if gfxwindow is not None: mainthread.runBlock(self.destinationMenu.set_state, (gfxwindow.name, ))
def move(self, x, y, shift, ctrl): debug.mainthreadTest() if config.dimension() == 2: self.xtext.set_text("%-11.4g" % x) self.ytext.set_text("%-11.4g" % y) point = primitives.Point(x, y) elif config.dimension() == 3: point = self.gfxwindow().oofcanvas.screenCoordsTo3DCoords(x, y) if point is not None: self.xtext.set_text("%-11.4g" % point[0]) self.ytext.set_text("%-11.4g" % point[1]) self.ztext.set_text("%-11.4g" % point[2]) if self.skeleton_context and point is not None: skel = self.skeleton_context.getObject() node = skel.nearestNode(point) if node: pos = node.position() self.nodextext.set_text("%-11.4g" % pos.x) self.nodeytext.set_text("%-11.4g" % pos.y) if config.dimension() == 3: self.nodeztext.set_text("%-11.4g" % pos.z) self.set_pintext(node) else: self.nodextext.set_text('') self.nodeytext.set_text('') if config.dimension() == 3: self.nodeztext.set_text('') self.set_pintext(None) gtklogger.checkpoint("Pin Nodes toolbox move event")
def setInfo_subthread(self): debug.subthreadTest() source = self.getSource() if source is not None: source.begin_reading() try: selection = source.getSelectionContext( **self.toolbox.extrakwargs) ## Selection can be None because an Image must be created ## before a Microstructure, but the selection source for ## an Image is its Microstructure. if selection is not None: selection.begin_reading() try: sizetextdata = `selection.size()` finally: selection.end_reading() else: sizetextdata = '0' finally: source.end_reading() else: sizetextdata = self.toolbox.emptyMessage() mainthread.runBlock(self._write_text, (sizetextdata,)) gtklogger.checkpoint("selection info updated")
def sensitize_mainagain(self, ssize): debug.mainthreadTest() skelctxt = self.parent.getCurrentSkeleton() curskel = skelctxt is not None and not skelctxt.query_reservation() groupset = self.getGroupSet() self.new_button.set_sensitive(curskel) # The Auto button is sensitive if the microstructure has any # pixel groups. ms = self.parent.getCurrentMicrostructureContext() self.auto_button.set_sensitive( ms is not None and curskel and ms.getObject().nGroups() > 0 ## TODO 3.1: When autogrouping of faces is implemented, delete ## the next line. and self.parent.activemode.name() != "Face") # The Delete All button is sensitive if the Skeleton has any # Element/Node/Segment groups. self.deleteAll_button.set_sensitive(curskel and groupset is not None and groupset.nGroups() > 0) # The Clear All button is sensitive if at least one group is # non-empty. if groupset is not None: for group in groupset.allGroups(): if groupset.sizeOfGroup(group) > 0: self.clearAll_button.set_sensitive(True) break else: self.clearAll_button.set_sensitive(False) else: self.clearAll_button.set_sensitive(False) # Set the buttons in the groupbuttons list, if there is a group. groupstate = self.grouplist.get_value() is not None for b in self.groupbuttons: b.set_sensitive(groupstate) # Set the groupandselectionbuttons if there's a group selected, # and the skeletoncontext has a selection of the appropriate type # which is of nonzero size. g = self.grouplist.get_value() groupselectstate = g is not None and ssize > 0 for b in self.groupandselectionbuttons: b.set_sensitive(groupselectstate) groupset = self.getGroupSet() self.clear_button.set_sensitive(groupset is not None and g is not None and groupset.sizeOfGroup(g) > 0) matok = (g is not None and self.activemode().mode.materialsallowed is not None) ## TODO 3.1: Uncomment these lines when Assign_Material and ## Remove_Material have been restored to the elementgroupmenu. # self.addmaterial_button.set_sensitive(matok) # self.removematerial_button.set_sensitive(matok) gtklogger.checkpoint("skeleton selection page groups sensitized")
def move_info(self, point, homogtext, shapetext, labeltext): debug.mainthreadTest() self.showPosition(point) self.homogtext.set_text(homogtext) self.shapetext.set_text(shapetext) self.statusText.set_text(labeltext) gtklogger.checkpoint("Move Node toolbox info updated")
def newInterfaceUpdatePageCB(self, ms): # TODO 3.1: Check ms with skelwidget? If ms is not the # current microstructure, nothing has to be done. self.updateInterfaceList() self.updateInfo() self.sensitize() gtklogger.checkpoint("interface page updated")
def sensitize_subthread(self): def set_button_sensitivity(u, r, c): self.undobutton.set_sensitive(u) self.redobutton.set_sensitive(r) self.clearbutton.set_sensitive(c) def set_ok_sensitivity(selection): ok = selection is not None and \ self.selectionModFactory.isValid() self.okbutton.set_sensitive(ok) (ms, selection) = mainthread.runBlock(self.getSelectionContext) if selection is not None: selection.begin_reading() try: u = selection.undoable() r = selection.redoable() c = selection.clearable() finally: selection.end_reading() else: (u,r,c) = (0,0,0) mainthread.runBlock(set_button_sensitivity, (u,r,c)) mainthread.runBlock(set_ok_sensitivity, (selection,) ) gtklogger.checkpoint("pixel page sensitized")
def move_thread(self, skeleton, x, y, shift, ctrl): debug.subthreadTest() self.mouselock.acquire() try: if self.movingnode is not None: self.moving = 1 homogeneity = 0.0 shapeenergy = 0.0 point = self.getPoint(x,y) # It's generally forbidden to call node.moveTo instead of # skeleton.moveNodeTo, but since we're going to move the # node back (see up(), below), it's ok. if point is not None: self.movingnode.moveTo(point) if self.movingnode.illegal(): homogtext = "---" shapetext = "---" labeltext = "Illegal node position!" else: for element in self.nbrelements: # Evaluating homogeneity and shape energy is # safe, because the Skeleton's read lock was # acquired when the mouse went down. homogeneity += element.homogeneity(skeleton.MS) shapeenergy += element.energyShape() homogtext = "%-11.4g" % (homogeneity-self.homogeneity0) shapetext = "%-11.4g" % (shapeenergy-self.shapeenergy0) labeltext = "" mainthread.runBlock(self.move_info, (point, homogtext, shapetext, labeltext)) gtklogger.checkpoint("Move Node toolbox move event") finally: self.mouselock.release()
def move(self, x, y, shift, ctrl): debug.mainthreadTest() if config.dimension() == 2: self.xtext.set_text("%-11.4g" % x) self.ytext.set_text("%-11.4g" % y) point = primitives.Point(x,y) elif config.dimension() == 3: point = self.gfxwindow().oofcanvas.screenCoordsTo3DCoords(x,y) if point is not None: self.xtext.set_text("%-11.4g" % point[0]) self.ytext.set_text("%-11.4g" % point[1]) self.ztext.set_text("%-11.4g" % point[2]) if self.skeleton_context and point is not None: skel = self.skeleton_context.getObject() node = skel.nearestNode(point) if node: pos = node.position() self.nodextext.set_text("%-11.4g" % pos.x) self.nodeytext.set_text("%-11.4g" % pos.y) if config.dimension() == 3: self.nodeztext.set_text("%-11.4g" % pos.z) self.set_pintext(node) else: self.nodextext.set_text('') self.nodeytext.set_text('') if config.dimension() == 3: self.nodeztext.set_text('') self.set_pintext(None) gtklogger.checkpoint("Pin Nodes toolbox move event")
def move_thread(self, skeleton, x, y, shift, ctrl): debug.subthreadTest() self.mouselock.acquire() try: if self.movingnode is not None: self.moving = 1 homogeneity = 0.0 shapeenergy = 0.0 point = self.getPoint(x, y) # It's generally forbidden to call node.moveTo instead of # skeleton.moveNodeTo, but since we're going to move the # node back (see up(), below), it's ok. if point is not None: self.movingnode.moveTo(point) if self.movingnode.illegal(): homogtext = "---" shapetext = "---" labeltext = "Illegal node position!" else: for element in self.nbrelements: # Evaluating homogeneity and shape energy is # safe, because the Skeleton's read lock was # acquired when the mouse went down. homogeneity += element.homogeneity(skeleton.MS) shapeenergy += element.energyShape() homogtext = "%-11.4g" % (homogeneity - self.homogeneity0) shapetext = "%-11.4g" % (shapeenergy - self.shapeenergy0) labeltext = "" mainthread.runBlock(self.move_info, (point, homogtext, shapetext, labeltext)) gtklogger.checkpoint("Move Node toolbox move event") finally: self.mouselock.release()
def writeInfoBuffer(self, nNodes, nElements, nFaces, nSegments, illegalcount, suspectcount, shapecounts, homogIndex, x_periodicity, y_periodicity, z_periodicity): # Called by update() to actually fill in the data on the # main thread. debug.mainthreadTest() buffer = self.skelinfo.get_buffer() buffer.delete(buffer.get_start_iter(), buffer.get_end_iter()) if illegalcount > 0 : buffer.insert_with_tags(buffer.get_end_iter(), "WARNING: %d ILLEGAL ELEMENT%s.\n" % (illegalcount, "S"*(illegalcount!=1)), self.boldTag) buffer.insert(buffer.get_end_iter(), "Element data is unreliable.\n") buffer.insert(buffer.get_end_iter(), "Remove %s before proceeding.\n\n" % itORthem[illegalcount!=1]) if suspectcount > 0 : buffer.insert_with_tags(buffer.get_end_iter(), "WARNING: %d SUSPECT ELEMENT%s.\n" % (suspectcount, "S"*(suspectcount!=1)), self.boldTag) buffer.insert(buffer.get_end_iter(), "Refinement cannot be performed reliably.\n") buffer.insert(buffer.get_end_iter(), "Remove %s before proceeding.\n\n" % itORthem[suspectcount!=1]) buffer.insert(buffer.get_end_iter(), "No. of Elements: %d\n" % nElements) buffer.insert(buffer.get_end_iter(), "No. of Faces: %d\n" % nFaces) buffer.insert(buffer.get_end_iter(), "No. of Segments: %d\n" % nSegments) buffer.insert(buffer.get_end_iter(), "No. of Nodes: %d\n" % nNodes) #for name in skeletonelement.ElementShapeType.names: # buffer.insert(buffer.get_end_iter(), # "No. of %ss: %d\n" % (name, shapecounts[name])) # buffer.insert(buffer.get_end_iter(), # "Z Periodicity: %s\n" % x_periodicity) # buffer.insert(buffer.get_end_iter(), # "Y Periodicity: %s\n" % y_periodicity) # if config.dimension() == 3: # buffer.insert(buffer.get_end_iter(), # "Z Periodicity: %s\n" % z_periodicity) if homogIndex is not None: buffer.insert(buffer.get_end_iter(), "Homogeneity Index: %s\n" % homogIndex) else: buffer.insert(buffer.get_end_iter(), "Homogeneity Index: ????\n") gtklogger.checkpoint("skeleton page info updated")
def interfaceUnselectedCB(self, ms): # sb "interface unselected" if self.skelwidget.get_value(depth=1) == ms.name(): self.inhibitSignals() self.interfacelist.set_selection(None) self.uninhibitSignals() self.updateInfo() self.sensitize() gtklogger.checkpoint("interface page updated")
def bdyUnselectedCB(self, skelctxt): # sb "boundary unselected" if skelctxt is self.currentSkeletonContext(): self.inhibitSignals() self.boundarylist.set_selection(None) self.uninhibitSignals() self.updateInfo() self.sensitize() gtklogger.checkpoint("boundary page updated")
def set_writable(self, val): self.writable = val # This checkpoint is required because the state of # self.writable affects which mouse events are processed. # Those mouse events can trigger other checkpoints, so if the # writable flag is set wrongly, the other checkpoints might # not be reached. gtklogger.checkpoint("Move Node toolbox writable changed")
def interfaceSelectedCB(self, ms, interfacename): # sb "boundary selected" if self.skelwidget.get_value(depth=1)==ms.name(): self.inhibitSignals() #Dunno what this does self.interfacelist.set_selection(interfacename) self.uninhibitSignals() #Dunno what this does self.updateInfo() self.sensitize() gtklogger.checkpoint("interface page updated")
def interfaceUnselectedCB(self, ms): # sb "interface unselected" if self.skelwidget.get_value(depth=1)==ms.name(): self.inhibitSignals() self.interfacelist.set_selection(None) self.uninhibitSignals() self.updateInfo() self.sensitize() gtklogger.checkpoint("interface page updated")
def interfaceSelectedCB(self, ms, interfacename): # sb "boundary selected" if self.skelwidget.get_value(depth=1) == ms.name(): self.inhibitSignals() #Dunno what this does self.interfacelist.set_selection(interfacename) self.uninhibitSignals() #Dunno what this does self.updateInfo() self.sensitize() gtklogger.checkpoint("interface page updated")
def update(self): mesh = self.currentMeshContext() if mesh: bdynames = mesh.edgeBoundaryNames() self.bdylist.update(bdynames) else: self.bdylist.update([]) self.sensitize() gtklogger.checkpoint("mesh bdy page updated")
def _updateQuerySubthread(self): self.meshcontext.restoreCachedData(self.gfxwindow().displayTime) try: mainthread.runBlock(self.modeobj.updateSomething, (self.toolbox.querier,)) finally: self.meshcontext.releaseCachedData() gtklogger.checkpoint(self.gfxwindow().name + " " + self._name + " updated")
def sensitize_mainagain(self, ssize): debug.mainthreadTest() skelctxt = self.parent.getCurrentSkeleton() curskel = skelctxt is not None and not skelctxt.query_reservation() groupset = self.getGroupSet() self.new_button.set_sensitive(curskel) # The Auto button is sensitive if the microstructure has any # pixel groups. ms = self.parent.getCurrentMicrostructureContext() self.auto_button.set_sensitive( ms is not None and curskel and ms.getObject().nGroups() > 0) # The Delete All button is sensitive if the Skeleton has any # Element/Node/Segment groups. self.deleteAll_button.set_sensitive(curskel and groupset is not None and groupset.nGroups() > 0) # The Clear All button is sensitive if at least one group is # non-empty. if groupset is not None: for group in groupset.allGroups(): if groupset.sizeOfGroup(group) > 0: self.clearAll_button.set_sensitive(True) break else: self.clearAll_button.set_sensitive(False) else: self.clearAll_button.set_sensitive(False) # Set the buttons in the groupbuttons list, if there is a group. groupstate = self.grouplist.get_value() is not None for b in self.groupbuttons: b.set_sensitive(groupstate) # Set the groupandselectionbuttons if there's a group selected, # and the skeletoncontext has a selection of the appropriate type # which is of nonzero size. g = self.grouplist.get_value() groupselectstate = g is not None and ssize > 0 for b in self.groupandselectionbuttons: b.set_sensitive(groupselectstate) groupset = self.getGroupSet() self.clear_button.set_sensitive(groupset is not None and g is not None and groupset.sizeOfGroup(g) > 0) matok = (g is not None and self.activemode().mode.materialsallowed is not None) self.addmaterial_button.set_sensitive(matok) self.removematerial_button.set_sensitive(matok) gtklogger.checkpoint("skeleton selection page groups sensitized")
def retrieve_analysis(self, name): # sb "retrieve boundary analysis" analysis = namedanalysis.getNamedBdyAnalysis(name) self.suppressRetrievalLoop = True try: self.bdylist.set_selection(analysis.boundary) self.analysisWidget.set(analysis.analyzer, interactive=False) finally: self.suppressRetrievalLoop = False gtklogger.checkpoint("retrieved named boundary analysis") self.setNamedAnalysisChooser()
def sensitize(self): debug.mainthreadTest() subpctxt = self.currentSubProblemContext() subpok = subpctxt is not None and not subpctxt.query_reservation() meshctxt = self.currentMeshContext() meshok = meshctxt and not meshctxt.outOfSync() self.fieldtable.set_sensitive(subpok and meshok) self.eqntable.set_sensitive(subpok and meshok) self.copyfieldbutton.set_sensitive(subpok and meshok) self.copyeqnbutton.set_sensitive(subpok and meshok) gtklogger.checkpoint("Field page sensitized")
def move2(self, skelctxt, x, y): if skelctxt is not None: point = primitives.Point(x,y) self.showPosition(point) if point is not None: node = skelctxt.getObject().nearestNode(point) if node: self.showNodePosition(node.position(), node.pinned()) return self.showNodePosition() gtklogger.checkpoint(self.gfxwindow().name + " Pin Nodes move 2D")
def showPosition(self, point): debug.mainthreadTest() self.xtext.set_text("%-11.4g" % point[0]) self.ytext.set_text("%-11.4g" % point[1]) self.xposition = point[0] self.yposition = point[1] if config.dimension() == 3: self.ztext.set_text("%-11.4g" % point[2]) self.zposition = point[2] gtklogger.checkpoint(self.gfxwindow().name + " " + self._name + " showed position")
def update_subthread(self, skelcontext): # Get the selection from the skeleton context if skelcontext: n = self.selectionSize() # requires subthread status_text = " %d %s%s selected." % (n, self.activemode.name(), 's' * (n != 1)) else: status_text = "No Skeleton selected." mainthread.runBlock(self.status.set_text, (status_text, )) gtklogger.checkpoint("skeleton selection page updated")
def _set_buttons(self, c,u,i,r): skelctxt = self.parent.getCurrentSkeleton() skelok = (skelctxt is not None and not skelctxt.query_reservation() and not skelctxt.defunct()) self.clear_button.set_sensitive(c and skelok) self.undo_button.set_sensitive(u and skelok) self.invert_button.set_sensitive(i and skelok) self.redo_button.set_sensitive(r and skelok) self.activemode().historybox.sensitize() self.activemode().ok_sensitize() gtklogger.checkpoint("skeleton selection page selection sensitized")
def sensitize(self): self.xText.set_sensitive(not self.tEditMode) self.yText.set_sensitive(not self.tEditMode) self.tText.set_sensitive(self.tEditMode) self.meshWidget.set_sensitive(not self.tEditMode) self.databox.set_sensitive(not self.tEditMode) self.freezeTimeButton.set_sensitive(not self.tEditMode) self.freezeSpaceButton.set_sensitive(not self.tEditMode) self.gfxWindowChooser.gtk.set_sensitive(not self.tEditMode) self.meshText.set_sensitive(not self.tEditMode) self.outputwidget.gtk.set_sensitive(not self.tEditMode) gtklogger.checkpoint(self._name+" sensitized")
def retrieveCB(self, gtkobj, name): # retrieve named analysis if name: # can be empty analysis = namedanalysis.getNamedAnalysis(name) self.suppressRetrievalLoop = True try: self.op_obj.set(analysis.operation, interactive=False) self.output_obj.set_value(analysis.data) self.domain_obj.set(analysis.domain, interactive=False) self.sample_obj.set(analysis.sampling, interactive=False) finally: self.suppressRetrievalLoop = False gtklogger.checkpoint("retrieved named analysis")
def update_subthread(self, skelcontext): # Get the selection from the skeleton context if skelcontext: n = self.selectionSize() # requires subthread status_text = " %d %s%s selected." % (n, self.activemode.name(), 's'*(n!=1)) else: status_text = "No Skeleton selected." mainthread.runBlock(self.status.set_text, (status_text,)) gtklogger.checkpoint("skeleton selection page updated")
def boundarylistCB(self, bdyobj, interactive): # ChooserListWidget callback if self.built and interactive: skelctxt = self.currentSkeletonContext() if skelctxt: bdyname = self.boundarylist.get_value() if bdyname: skelctxt.selectBoundary(bdyname) else: skelctxt.unselectBoundary() self.sensitize() self.updateInfo() gtklogger.checkpoint("boundary page updated")
def deselect_property(self, name): debug.mainthreadTest() if self.current_property: # and self.propertytree: if self.current_property[0] == name: self.propertytree.blockSignals() self.propertytree.deselect() self.propertytree.unblockSignals() self.current_property = None self.sensitize() else: print "Inconsistent selection state." gtklogger.checkpoint("property deselected")
def deselect_property(self, name): debug.mainthreadTest() if self.current_property: # and self.propertytree: if self.current_property[0]==name: self.propertytree.blockSignals() self.propertytree.deselect() self.propertytree.unblockSignals() self.current_property = None self.sensitize() else: print "Inconsistent selection state." gtklogger.checkpoint("property deselected")
def sensitize(self): self.xText.set_sensitive(not self.tEditMode) self.yText.set_sensitive(not self.tEditMode) self.tText.set_sensitive(self.tEditMode) self.meshWidget.set_sensitive(not self.tEditMode) self.databox.set_sensitive(not self.tEditMode) self.freezeTimeButton.set_sensitive(not self.tEditMode) self.freezeSpaceButton.set_sensitive(not self.tEditMode) self.gfxWindowChooser.gtk.set_sensitive(not self.tEditMode) self.meshText.set_sensitive(not self.tEditMode) self.outputwidget.gtk.set_sensitive(not self.tEditMode) gtklogger.checkpoint(self._name + " sensitized")
def showPosition(self, mouse, mesh): debug.mainthreadTest() self.xtext.set_text("%-13.6g" % mesh[0]) self.ytext.set_text("%-13.6g" % mesh[1]) self.mouse_xposition = mouse[0] self.mouse_yposition = mouse[1] self.mesh_xposition = mesh[0] self.mesh_yposition = mesh[1] if config.dimension() == 3: self.ztext.set_text("%-13.6g" % mesh[2]) self.mesh_zposition = mesh[2] gtklogger.checkpoint(self.gfxwindow().name + " " + self._name + " showed position")
def clearPositionData(self): debug.mainthreadTest() self.xtext.set_text("") self.ytext.set_text("") self.mouse_xposition = None self.mouse_yposition = None self.mesh_xposition = None self.mesh_yposition = None if config.dimension() == 3: self.ztext.set_text("") self.mesh_zposition = None gtklogger.checkpoint(self.gfxwindow().name + " " + self._name + " cleared position")
def updateTime(self, time): if not self.freezeTimeFlag and not self.tEditMode: if time != self.time: self.time = time subthread.execute(self.updateData) if time is None: self.tText.set_text("") else: # Strip blanks to the right of the number so that they # don't get in the way when the user edits the # position. self.tText.set_text(("%-13.6g" % self.time).rstrip()) gtklogger.checkpoint(self._name + " time updated")
def updateTime(self, time): if not self.freezeTimeFlag and not self.tEditMode: if time != self.time: self.time = time subthread.execute(self.updateData) if time is None: self.tText.set_text("") else: # Strip blanks to the right of the number so that they # don't get in the way when the user edits the # position. self.tText.set_text(("%-13.6g" % self.time).rstrip()) gtklogger.checkpoint(self._name+" time updated")
def installPage(self, pagename): debug.mainthreadTest() # Actually install a page in the page frame. oldPage = None if self.currentPageName is not None: oldPage = allPages[self.currentPageName] self.pageframe.remove(oldPage.gtk) self.currentPageName = pagename self.pageframe.add(allPages[self.currentPageName].gtk) if oldPage is not None: oldPage.hidden() allPages[self.currentPageName].installed() self.sensitize() gtklogger.checkpoint("page installed " + self.currentPageName)
def select_property(self, name): debug.mainthreadTest() treenode = AllProperties.data[name] self.propertytree.blockSignals() if treenode.object is not None: self.propertytree.expandToPath(name) self.propertytree.selectObject(treenode.object) self.current_property = (name, treenode.object) else: self.propertytree.deselect() self.current_property = None self.propertytree.unblockSignals() self.sensitize() gtklogger.checkpoint("property selected")
def interfacelistCB(self, someobj, interactive): # ChooserListWidget callback if self.built and interactive: msname = self.skelwidget.get_value(depth=1) if msname: interfacename = self.interfacelist.get_value() msobj = ooflib.common.microstructure.microStructures[msname].getObject() interfacemsplugin=msobj.getPlugIn("Interfaces") if interfacename: interfacemsplugin.selectInterface(interfacename) else: interfacemsplugin.unselectInterface() self.sensitize() self.updateInfo() gtklogger.checkpoint("interface page updated")
def sensitizeSubProblems(self): debug.mainthreadTest() subpok = self.subpchooser.get_value() is not None defaultsubp = (self.subpchooser.get_value() == ooflib.engine.mesh.defaultSubProblemName) meshctxt = self.currentMeshContext() meshok = meshctxt is not None and not meshctxt.outOfSync() self.subprobNew.set_sensitive(meshok) self.subprobRename.set_sensitive(subpok and not defaultsubp) self.subprobCopy.set_sensitive(subpok) self.subprobDelete.set_sensitive(subpok and not defaultsubp) self.subprobEdit.set_sensitive(meshok and subpok and not defaultsubp) self.subprobInfo.set_sensitive(subpok) gtklogger.checkpoint("mesh page subproblems sensitized")