コード例 #1
0
 def showLayer_thread(self, menuitem, n):
     self.display.show_layer(self.device, n)  # show layer in canvas
     self.layerListRowChanged(n)
     # Update the contourmap.
     if config.dimension() == 2:
         self.contourmap_newlayers()
         subthread.execute(self.show_contourmap_info)
コード例 #2
0
ファイル: gfxwindowbase.py プロジェクト: anilkunwar/OOF2
 def showLayer_thread(self, menuitem, n):
     self.display.show_layer(self.device, n) # show layer in canvas
     self.layerListRowChanged(n)
     # Update the contourmap.
     if config.dimension() == 2:
         self.contourmap_newlayers()
         subthread.execute(self.show_contourmap_info)
コード例 #3
0
 def realizeCB(self, *args):
     if not self.realized:
         self.realized = 1
         # Asynchronously zoom.
         if not self.zoomed:
             subthread.execute(self.zoomFillWindow)
     return False
コード例 #4
0
ファイル: gfxwindowbase.py プロジェクト: anilkunwar/OOF2
 def realizeCB(self, *args):         
     if not self.realized:
         self.realized = 1
         # Asynchronously zoom.
         if not self.zoomed:
             subthread.execute(self.zoomFillWindow)
     return False
コード例 #5
0
 def activate(self):
     if not self.active:
         self.active = True
         self.canvaslayer.set_opacity(self._opacity())
         self.setVisibility(self._visibility())
         self.canvaslayer.setModified()
         subthread.execute(self.gfxwindow.draw)
コード例 #6
0
ファイル: worker.py プロジェクト: anilkunwar/OOF2
    def meanwhile(self):
        ## This function should only be called if in text mode and on
        ## the main thread.  It checks to see if the thread is
        ## finished and redraws the progress bars.  It sleeps a bit
        ## after each check so that it doesn't eat up cpu.  The sleep
        ## time is initially short, but grows (up to a point) on each
        ## iteration.
        naptime = 0.001                 # initial length of sleep time
        maxnap = 0.3                    # maximum length of sleep time
        napfactor = 2.0                 # amount to increase on each iteration
        prgrsbars = {}                  # progressbar representations
        try:
            while not self.worker.finished():
                subthread.execute(self._drawProgressBars, args=(prgrsbars,))
                
                time.sleep(naptime)
                naptime *= napfactor
                if naptime > maxnap:
                    naptime = maxnap
            # end while not worker.finished
        except KeyboardInterrupt:
            self.worker.threadstate.impedeProgress()

        # Wait for thread to finish before OOF-ing some more.  Text
        # mode doesn't support concurrent operations.
        self.join()
コード例 #7
0
ファイル: worker.py プロジェクト: pk-organics/OOF3D
    def meanwhile(self):
        ## This function should only be called if in text mode and on
        ## the main thread.  It checks to see if the thread is
        ## finished and redraws the progress bars.  It sleeps a bit
        ## after each check so that it doesn't eat up cpu.  The sleep
        ## time is initially short, but grows (up to a point) on each
        ## iteration.
        naptime = 0.001  # initial length of sleep time
        maxnap = 0.3  # maximum length of sleep time
        napfactor = 2.0  # amount to increase on each iteration
        prgrsbars = {}  # progressbar representations
        try:
            while not self.worker.finished():
                subthread.execute(self._drawProgressBars, args=(prgrsbars, ))

                time.sleep(naptime)
                naptime *= napfactor
                if naptime > maxnap:
                    naptime = maxnap
            # end while not worker.finished
        except KeyboardInterrupt:
            self.worker.threadstate.impedeProgress()

        # Wait for thread to finish before OOF-ing some more.  Text
        # mode doesn't support concurrent operations.
        self.join()
コード例 #8
0
 def up(self, x, y, buttons):
     debug.mainthreadTest()
     skelctxt = self.getSkeletonContext()
     if skelctxt:
         canvas = self.gfxwindow().oofcanvas
         view = canvas.get_view()
         pt = canvas.display2Physical(view, x, y)
         subthread.execute(self.up_subthread, (view, buttons, pt))
コード例 #9
0
 def deactivate(self):
     # gfxwindow may already be None if window is closing.
     if self.active and self.gfxwindow is not None:
         self.active = False
         self.canvaslayer.set_opacity(self._opacity())
         self.setVisibility(self._visibility())
         self.canvaslayer.setModified()
         subthread.execute(self.gfxwindow.draw)
コード例 #10
0
 def installed(self):
     # If redisplay_all is called by show() rather than by shown()
     # it can be called by gui start up code, which may be running
     # concurrently with other start up operations, including
     # gtklogging initialization.  If that happens, the recording
     # of checkpoints reached by redisplay_all will depend on race
     # conditions.  So redisplay_all must be called by shown(),
     # which is guaranteed (less likely?) to be called before gui
     # initialization is complete.
     subthread.execute(self.redisplay_all)
コード例 #11
0
 def moveCB(self, button):
     debug.mainthreadTest()
     x = utils.OOFeval(self.xtext.get_text())
     y = utils.OOFeval(self.ytext.get_text())
     if config.dimension() == 2:
         point = primitives.Point(x, y)
     elif config.dimension() == 3:
         z = utils.OOFeval(self.ztext.get_text())
         point = primitives.Point(x, y, z)
     skelctxt = self.getSkeletonContext()
     subthread.execute(self.kbmove_subthread, (skelctxt, point))
コード例 #12
0
ファイル: movenodeGUI.py プロジェクト: anilkunwar/OOF2
 def moveCB(self, button):
     debug.mainthreadTest()
     x = utils.OOFeval(self.xtext.get_text())
     y = utils.OOFeval(self.ytext.get_text())
     if config.dimension() == 2:
         point = primitives.Point(x,y)
     elif config.dimension() == 3:
         z = utils.OOFeval(self.ztext.get_text())
         point = primitives.Point(x,y,z)
     skelctxt = self.getSkeletonContext()
     subthread.execute(self.kbmove_subthread, (skelctxt, point))
コード例 #13
0
ファイル: movenodeGUI.py プロジェクト: pk-organics/OOF3D
 def up(self, x, y, buttons):
     # "Downed" must be cleared at the earliest opportunity,
     # otherwise spurious "move" events can be processed,
     # unilaterally changing the node position.
     self.downed = 0
     if self.mode == "Keyboard":
         canvas = self.toolbox.gfxwindow().oofcanvas
         view = canvas.get_view()
         pt = canvas.display2Physical(view, x, y)
         self.toolbox.menu.SelectNode(position=pt, view=view)
     else:  # self.mode == "Mouse"
         subthread.execute(self.up_subthread_mouse, (x, y, buttons))
コード例 #14
0
 def updateQuery(self):
     if not self.toolbox.querier:
         return
     # See if there's anything to update
     if self.toolbox.querier.object:
         # Change mode if needed.
         self.handleMode(self.toolbox.querier.targetname)
         self.showPosition(self.toolbox.querier.mouse_position,
                           self.toolbox.querier.mesh_position)
         subthread.execute(self._updateQuerySubthread)
     else:
         self.modeobj.updateNothing()
     self.sensitize()
コード例 #15
0
ファイル: meshinfoGUI.py プロジェクト: anilkunwar/OOF2
 def updateQuery(self):
     if not self.toolbox.querier:
         return
     # See if there's anything to update
     if self.toolbox.querier.object:
         # Change mode if needed.
         self.handleMode(self.toolbox.querier.targetname)
         self.showPosition(self.toolbox.querier.mouse_position,
                           self.toolbox.querier.mesh_position)
         subthread.execute(self._updateQuerySubthread)
     else:
         self.modeobj.updateNothing()
     self.sensitize()
コード例 #16
0
ファイル: meshdataGUI.py プロジェクト: anilkunwar/OOF2
 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")
コード例 #17
0
ファイル: meshdataGUI.py プロジェクト: song2001/OOF2
 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")
コード例 #18
0
 def installed(self):
     ## Obsolete comment that may still be relevant... The old
     ## "shown" routine is now called "installed".  The default
     ## "show" method just calls self.gtk.show_all().
     # If redisplay_all is called by show() rather than by shown()
     # it can be called by gui start up code, which may be running
     # concurrently with other start up operations, including
     # gtklogging initialization.  If that happens, the recording
     # of checkpoints reached by redisplay_all will depend on race
     # conditions.  So redisplay_all must be called by shown(),
     # which is guaranteed (more likely?) to be called after gui
     # initialization is complete.
     subthread.execute(self.redisplay_all)
コード例 #19
0
 def move(self, x, y, buttons):
     # The toolbox is updated when the mouse *moves*, even before a
     # click, because it's displaying node information which helps
     # the user decide which node to click on.
     debug.mainthreadTest()
     ## TODO OPT: During a move, the skeleton context and view can't
     ## change, so it's inefficient to retrieve them here.  They
     ## should be cached whenever they change.  A previous attempt
     ## to do that missed some changes, so the caching was removed.
     skelctxt = self.getSkeletonContext()
     view = self.toolbox.gfxwindow().oofcanvas.get_view()
     canvas = self.toolbox.gfxwindow().oofcanvas
     pt = canvas.display2Physical(view, x, y)
     subthread.execute(self.move3, (skelctxt, view, pt))
コード例 #20
0
ファイル: genericinfoGUI.py プロジェクト: santiama/OOF3D
 def changeModeCB(self, button, modename):  # radio button callback
     if button.get_active():
         if self.currentMode != modename:
             if self.clickIDs[modename] is not None:
                 self.issueQueryCmd(self.modeobjdict[modename],
                                    self.clickIDs[modename])
             else:
                 # The new mode has no pre-clicked selection.  No
                 # menu command is issued, because there's no
                 # selection being made, so we need to do some
                 # extra housekeeping here.
                 mode = self.modeobjdict[modename]
                 subthread.execute(mode.update, (None, ))
                 self.replaceInfoGUI(mode)
                 self.toolbox.clearQuery()
                 # Update the gfx layer
                 switchboard.notify((self.gfxwindow(),
                                     "query " + self.toolbox.whoClassName))
                 # Redraw
                 subthread.execute(self.gfxwindow().draw)
             self.sensitize()
コード例 #21
0
ファイル: meshdataGUI.py プロジェクト: song2001/OOF2
 def posChangedCB(self, gtkobj):  # text edited in x & y gtk.Entries
     debug.mainthreadTest()
     try:
         if config.dimension() == 2:
             self.position = primitives.Point(_getval(self.xText),
                                              _getval(self.yText))
         elif config.dimension() == 3:
             self.position = primitives.Point(_getval(self.xText),
                                              _getval(self.yText),
                                              _getval(self.zText))
     except:
         # The user has typed something that can't be evaluated,
         # but maybe there's more typing to come. Ignore the error.
         if self.datawidget:
             self.datawidget.gtk.set_sensitive(0)
     else:
         subthread.execute(self.updateData)
         # Since the user has typed a new position, assume that
         # s/he really wants it, and don't overwrite it when the
         # mouse is clicked on the Mesh.
         self.freezeSpaceFlag = True
         self.freezeSpaceButton.set_active(True)
コード例 #22
0
ファイル: meshdataGUI.py プロジェクト: anilkunwar/OOF2
 def updateMesh(self):
     debug.mainthreadTest()
     window = self.currentGfxWindow()
     newmesh = None
     if window:
         newmesh = window.topwho('Mesh')
         if newmesh:
             self.meshText.set_text(newmesh.path())
         else:
             self.meshText.set_text('<No Mesh in window!>')
     else:
         self.meshText.set_text('---')
     if not self.freezeTimeFlag:
         self.updateTime(window.displayTime)
     if newmesh is not self.currentMesh:
         self.currentMesh = newmesh
         subthread.execute(self.updateData)
     if newmesh is not None:
         self.meshWidget.set_value(newmesh.path())
     else:
         self.meshWidget.set_value(None)
     gtklogger.checkpoint(self._name+" mesh updated")
コード例 #23
0
ファイル: meshdataGUI.py プロジェクト: anilkunwar/OOF2
 def posChangedCB(self, gtkobj): # text edited in x & y gtk.Entries
     debug.mainthreadTest()
     try:
         if config.dimension() == 2:
             self.position = primitives.Point(_getval(self.xText),
                                              _getval(self.yText))
         elif config.dimension() == 3:
             self.position = primitives.Point(_getval(self.xText),
                                              _getval(self.yText),
                                              _getval(self.zText))
     except:
         # The user has typed something that can't be evaluated,
         # but maybe there's more typing to come. Ignore the error.
         if self.datawidget:
             self.datawidget.gtk.set_sensitive(0)
     else:
         subthread.execute(self.updateData)
         # Since the user has typed a new position, assume that
         # s/he really wants it, and don't overwrite it when the
         # mouse is clicked on the Mesh.
         self.freezeSpaceFlag = True
         self.freezeSpaceButton.set_active(True)
コード例 #24
0
ファイル: meshdataGUI.py プロジェクト: song2001/OOF2
 def updateMesh(self):
     debug.mainthreadTest()
     window = self.currentGfxWindow()
     newmesh = None
     if window:
         newmesh = window.topwho('Mesh')
         if newmesh:
             self.meshText.set_text(newmesh.path())
         else:
             self.meshText.set_text('<No Mesh in window!>')
     else:
         self.meshText.set_text('---')
     if not self.freezeTimeFlag:
         self.updateTime(window.displayTime)
     if newmesh is not self.currentMesh:
         self.currentMesh = newmesh
         subthread.execute(self.updateData)
     if newmesh is not None:
         self.meshWidget.set_value(newmesh.path())
     else:
         self.meshWidget.set_value(None)
     gtklogger.checkpoint(self._name + " mesh updated")
コード例 #25
0
ファイル: meshdataGUI.py プロジェクト: anilkunwar/OOF2
 def updatePosition(self, position):
     # Switchboard callback for (gfxwindow, "meshinfo click").
     # Also called when freezeSpaceFlag is unset, and during window
     # construction.
     debug.mainthreadTest()
     if not self.freezeSpaceFlag:
         if position != self.position:
             self.position = position
             subthread.execute(self.updateData)
         self.xsignal.block()
         self.ysignal.block()
         if config.dimension() == 3:
             self.zsignal.block()
         try:
             if position is not None:
                 # Strip blanks to the right of the number so that they
                 # don't get in the way when the user edits the
                 # position.
                 self.xText.set_text(("%-13.6g" % position.x).rstrip())
                 self.yText.set_text(("%-13.6g" % position.y).rstrip())
                 if config.dimension() == 3:
                     self.zText.set_text(("%-13.6g" % position.z).rstrip())
             else:
                 # Probably not required -- position is initially None,
                 # and having once been set, probably can't become
                 # None.
                 self.xText.set_text("")
                 self.yText.set_text("")
                 if config.dimension() == 3:
                     self.zText.set_text("")
         finally:
             self.xsignal.unblock()
             self.ysignal.unblock()
             if config.dimension() == 3:
                 self.zsignal.unblock()
         gtklogger.checkpoint(self._name+" position updated")
コード例 #26
0
ファイル: meshdataGUI.py プロジェクト: anilkunwar/OOF2
 def tEditCB(self, button):
     if not self.tEditMode:
         # Switch to time editing mode
         self.tEditMode = True
         self.tEditButton.set_label("Done")
         self.tText.set_editable(True)
     else:
         # Switch out of time editing mode
         self.tEditMode = False
         self.tText.set_editable(False)
         self.tEditButton.set_label("Edit")
         try:
             t = utils.OOFeval(self.tText.get_text().lstrip())
         except:
             pass
         else:
             self.time = t
             subthread.execute(self.updateData)
             # Since the user has entered a new time, don't
             # overwrite it when the graphics window's display time
             # changes.
             self.freezeTimeFlag = True
             self.freezeTimeButton.set_active(True)
     self.sensitize()
コード例 #27
0
ファイル: meshdataGUI.py プロジェクト: song2001/OOF2
 def updatePosition(self, position):
     # Switchboard callback for (gfxwindow, "meshinfo click").
     # Also called when freezeSpaceFlag is unset, and during window
     # construction.
     debug.mainthreadTest()
     if not self.freezeSpaceFlag:
         if position != self.position:
             self.position = position
             subthread.execute(self.updateData)
         self.xsignal.block()
         self.ysignal.block()
         if config.dimension() == 3:
             self.zsignal.block()
         try:
             if position is not None:
                 # Strip blanks to the right of the number so that they
                 # don't get in the way when the user edits the
                 # position.
                 self.xText.set_text(("%-13.6g" % position.x).rstrip())
                 self.yText.set_text(("%-13.6g" % position.y).rstrip())
                 if config.dimension() == 3:
                     self.zText.set_text(("%-13.6g" % position.z).rstrip())
             else:
                 # Probably not required -- position is initially None,
                 # and having once been set, probably can't become
                 # None.
                 self.xText.set_text("")
                 self.yText.set_text("")
                 if config.dimension() == 3:
                     self.zText.set_text("")
         finally:
             self.xsignal.unblock()
             self.ysignal.unblock()
             if config.dimension() == 3:
                 self.zsignal.unblock()
         gtklogger.checkpoint(self._name + " position updated")
コード例 #28
0
ファイル: meshdataGUI.py プロジェクト: song2001/OOF2
 def tEditCB(self, button):
     if not self.tEditMode:
         # Switch to time editing mode
         self.tEditMode = True
         self.tEditButton.set_label("Done")
         self.tText.set_editable(True)
     else:
         # Switch out of time editing mode
         self.tEditMode = False
         self.tText.set_editable(False)
         self.tEditButton.set_label("Edit")
         try:
             t = utils.OOFeval(self.tText.get_text().lstrip())
         except:
             pass
         else:
             self.time = t
             subthread.execute(self.updateData)
             # Since the user has entered a new time, don't
             # overwrite it when the graphics window's display time
             # changes.
             self.freezeTimeFlag = True
             self.freezeTimeButton.set_active(True)
     self.sensitize()
コード例 #29
0
 def updatePSInfo(self):
     debug.mainthreadTest()
     subthread.execute(self.updatePSInfo_subthread)
コード例 #30
0
ファイル: meshdataGUI.py プロジェクト: anilkunwar/OOF2
 def meshDataChanged(self, meshctxt): # sb "mesh data changed"
     debug.mainthreadTest()
     if (meshctxt is self.currentMesh and
         (not self.freezeTimeFlag or
          self.time == self.currentMesh.getCurrentTime())):
         subthread.execute(self.updateData)
コード例 #31
0
ファイル: meshdataGUI.py プロジェクト: song2001/OOF2
 def meshDataChanged(self, meshctxt):  # sb "mesh data changed"
     debug.mainthreadTest()
     if (meshctxt is self.currentMesh
             and (not self.freezeTimeFlag
                  or self.time == self.currentMesh.getCurrentTime())):
         subthread.execute(self.updateData)
コード例 #32
0
ファイル: pixelPage.py プロジェクト: anilkunwar/OOF2
 def updatePSInfo(self):
     debug.mainthreadTest()
     subthread.execute(self.updatePSInfo_subthread)
コード例 #33
0
ファイル: meshdataGUI.py プロジェクト: anilkunwar/OOF2
 def freezeSpaceButtonCB(self, button):
     debug.mainthreadTest()
     self.freezeSpaceFlag = button.get_active()
     if not self.freezeSpaceFlag:
         self.updatePosition(self.position)
         subthread.execute(self.updateData)
コード例 #34
0
ファイル: meshdataGUI.py プロジェクト: song2001/OOF2
 def freezeSpaceButtonCB(self, button):
     debug.mainthreadTest()
     self.freezeSpaceFlag = button.get_active()
     if not self.freezeSpaceFlag:
         self.updatePosition(self.position)
         subthread.execute(self.updateData)
コード例 #35
0
ファイル: genericselectGUI.py プロジェクト: anilkunwar/OOF2
 def setInfo(self):
     debug.mainthreadTest()
     subthread.execute(self.setInfo_subthread)
コード例 #36
0
ファイル: pixelinfoplugin.py プロジェクト: pk-organics/OOF3D
 def update(self, where):
     subthread.execute(self.update_thread, (where, ))
コード例 #37
0
 def sensitize(self):
     subthread.execute(self.sensitize_subthread)
コード例 #38
0
ファイル: pixelinfoplugin.py プロジェクト: anilkunwar/OOF2
 def update(self, where):
     subthread.execute(self.update_thread, (where,))
コード例 #39
0
ファイル: movenodeGUI.py プロジェクト: anilkunwar/OOF2
 def move(self, x, y, shift, ctrl):
     skeleton = self.getSkeleton()
     subthread.execute(self.move_thread, (skeleton, x, y, shift, ctrl))
コード例 #40
0
ファイル: skeletonPage.py プロジェクト: anilkunwar/OOF2
 def installed(self):       # called by oofGUI when switching pages
     subthread.execute(self.installed_subth)
コード例 #41
0
ファイル: microstructurePage.py プロジェクト: anilkunwar/OOF2
 def msCB(self, *args):              # whowidget callback
     subthread.execute(self.redisplay_all)
コード例 #42
0
ファイル: movenodeGUI.py プロジェクト: anilkunwar/OOF2
 def down(self, x, y, shift, ctrl):
     subthread.execute(self.down_subthread, (x,y,shift,ctrl))
コード例 #43
0
 def sensitize(self):
     debug.mainthreadTest()
     subthread.execute(self.sensitize_subthread)
コード例 #44
0
ファイル: movenodeGUI.py プロジェクト: anilkunwar/OOF2
 def up(self, x, y, shift, ctrl):
     # "Downed" must be cleared at the earliest opportunity,
     # otherwise spurious "move" events can be processed,
     # unilaterally changing the node position.
     self.downed = 0 
     subthread.execute(self.up_subthread, (x,y,shift,ctrl))
コード例 #45
0
 def installed(self):
     self.sensitize()
     self.sensitizeHistory()
     subthread.execute(self.displayImageInfo)
コード例 #46
0
 def update(self):
     skelctxt = self.getCurrentSkeleton()
     subthread.execute(self.update_subthread, (skelctxt,))
コード例 #47
0
 def iWidgetChanged(self, interactive):
     self.sensitize()
     subthread.execute(self.displayImageInfo)
コード例 #48
0
 def sensitize(self):
     current_selection = self.currentSelection()
     skelcontext = self.parent.getCurrentSkeleton()
     subthread.execute(self.sensitize_subthread, (skelcontext, 
                                                  current_selection) )
コード例 #49
0
 def installed(self):       # called by oofGUI when switching pages
     subthread.execute(self.installed_subth)
コード例 #50
0
ファイル: skeletonPage.py プロジェクト: anilkunwar/OOF2
 def skelmodCB(self, reg):
     subthread.execute(self.skelmodCB_subthread, (reg,))
コード例 #51
0
 def skelmodCB(self, reg):
     subthread.execute(self.skelmodCB_subthread, (reg,))
コード例 #52
0
ファイル: microstructurePage.py プロジェクト: anilkunwar/OOF2
 def listItemChosen(self, name, interactive): # Chooser callback
     if self.built:
         subthread.execute(self.listItemChosen_thread, (name,))
コード例 #53
0
ファイル: pixelPage.py プロジェクト: anilkunwar/OOF2
 def sensitize(self):
     debug.mainthreadTest()
     subthread.execute(self.sensitize_subthread)