当前位置: 首页>>代码示例>>Python>>正文


Python Timer.start方法代码示例

本文整理汇总了Python中RO.TkUtil.Timer.start方法的典型用法代码示例。如果您正苦于以下问题:Python Timer.start方法的具体用法?Python Timer.start怎么用?Python Timer.start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RO.TkUtil.Timer的用法示例。


在下文中一共展示了Timer.start方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: SkyWdg

# 需要导入模块: from RO.TkUtil import Timer [as 别名]
# 或者: from RO.TkUtil.Timer import start [as 别名]

#.........这里部分代码省略.........
                self.cnv.delete(catTag)
                return
    
            # if color has changed, update it
            color = catalog.getDispColor()
            oldColor = self.catColorDict.get(catName)
            if color != oldColor:
                self.cnv.itemconfigure(catTag, fill = color, outline = color)
                self.catColorDict[catName] = color
                
#           print "compute %s thread starting" % catName
            yield sr.waitThread(_UpdateCatalog, catalog.objList, self.center, self.azAltScale)
            pixPosObjList = sr.value
#           print "compute %s thread done" % catName

            catName = catalog.name
            catTag = "cat_%s" % (catName,)
    
            self.catPixPosObjDict[catName] = []
            self.cnv.delete(catTag)
    
            color = catalog.getDispColor()      
            rad = 2 # for now, eventually may wish to vary by magnitude or window size or...?
            for pixPos, obj in pixPosObjList:
                self.cnv.create_oval(
                    pixPos[0] - rad,     pixPos[1] - rad,
                    pixPos[0] + rad + 1, pixPos[1] + rad + 1,
                    tag = (SkyWdg.CATOBJECT, catTag),
                    fill = color,
                    outline = color,
                )
            self.catPixPosObjDict[catName] = pixPosObjList
            
            self.catRedrawTimerDict[catName].start(_CatRedrawDelay, self._drawCatalog, catalog)
        
        sr = RO.ScriptRunner.ScriptRunner(
            runFunc = updateCat,
            name = "updateCatalog",
        )
        
        self.catSRDict[catName] = sr
        catalog.addCallback(self._drawCatalog, callNow=True)

    def removeCatalogByName(self, catName):
        """Remove the specified catalog.
        """
#       print "removeCatalogByName %r" % (catName,)
        try:
            cat = self.catDict.pop(catName)
        except KeyError:
            raise RuntimeError("Catalog %r not found" % (catName,))
        
        cat.removeCallback(self._drawCatalog, doRaise=False)
        catTag = "cat_%s" % (catName,)
        self.cnv.delete(catTag)
        
        # cancel script runner and delete entry
        try:
            sr = self.catSRDict.pop(catName)
#           print "removeCatalogByName cancelling and deleting update script for %r" % catName
            sr.cancel()
        except KeyError:
            pass
        
        # cancel pending wakeup and delete entry
        try:
开发者ID:migueldvb,项目名称:TUI,代码行数:70,代码来源:SkyWindow.py

示例2: StripChartWdg

# 需要导入模块: from RO.TkUtil import Timer [as 别名]
# 或者: from RO.TkUtil.Timer import start [as 别名]

#.........这里部分代码省略.........
        if subplot.get_autoscaley_on():
            subplot.relim()
            subplot.autoscale_view(scalex=False, scaley=True)
        self.canvas.draw()

    def setDoAutoscale(self, doAutoscale, subplotInd=0):
        """Turn autoscaling on or off for the specified subplot
        
        You can also turn off autoscaling by calling setYLimits.
        """
        doAutoscale = bool(doAutoscale)
        subplot = self.subplotArr[subplotInd]
        subplot.set_ylim(auto=doAutoscale)
        if doAutoscale:
            subplot.relim()
            subplot.autoscale_view(scalex=False, scaley=True)
    
    def setYLimits(self, minY, maxY, subplotInd=0):
        """Set y limits for the specified subplot and disable autoscaling.
        
        Note: if you want to autoscale with a minimum range, use showY.
        """
        self.subplotArr[subplotInd].set_ylim(minY, maxY, auto=False)
    
    def showY(self, y0, y1=None, subplotInd=0):
        """Specify one or two values to always show in the y range.
        
        Inputs:
        - subplotInd: index of subplot
        - y0: first y value to show
        - y1: second y value to show; None to omit

        Warning: setYLimits overrides this method (but the values are remembered in case you turn
        autoscaling back on).
        """
        subplot = self.subplotArr[subplotInd]
        yMin, yMax = subplot.get_ylim()
        
        if y1 is not None:
            yList = [y0, y1]
        else:
            yList = [y0]
        doRescale = False
        for y in yList:
            subplot.axhline(y, linestyle=" ")
            if subplot.get_autoscaley_on() and numpy.isfinite(y) and not (yMin <= y <= yMax):
                doRescale = True
        if doRescale:
            subplot.relim()
            subplot.autoscale_view(scalex=False, scaley=True)

    def _handleDrawEvent(self, event=None):
        """Handle draw event
        """
#         print "handleDrawEvent"
        for subplot in self.subplotArr:
            subplot._scwBackground = self.canvas.copy_from_bbox(subplot.bbox)
            for line in subplot._scwLines:
                subplot.draw_artist(line.line2d)
            self.canvas.blit(subplot.bbox)
    
    def _handleMap(self, evt):
        """Handle map event (widget made visible)
        """
        self._isVisible = True
        self._handleDrawEvent()
        self._updateTimeAxis()
    
    def _handleUnmap(self, evt):
        """Handle unmap event (widget made not visible)
        """
        self._isVisible = False
    
    def _updateTimeAxis(self):
        """Update the time axis; calls itself
        """
        tMax = time.time() + self.updateInterval
        tMin = tMax - self._timeRange
        minMplDays = self._cnvTimeFunc(tMin)
        maxMplDays = self._cnvTimeFunc(tMax)
        
        self._purgeCounter = (self._purgeCounter + 1) % self._maxPurgeCounter
        doPurge = self._purgeCounter == 0

        if doPurge:
            for subplot in self.subplotArr:
                for line in subplot._scwLines:
                    line._purgeOldData(minMplDays)
        
        if self._isVisible or self._isFirst:
            for subplot in self.subplotArr:
                subplot.set_xlim(minMplDays, maxMplDays)
                if doPurge:
                    if subplot.get_autoscaley_on():
                        # since data is being purged the y limits may have changed
                        subplot.relim()
                        subplot.autoscale_view(scalex=False, scaley=True)
            self._isFirst = False
            self.canvas.draw()
        self._timeAxisTimer.start(self.updateInterval, self._updateTimeAxis)
开发者ID:Subaru-PFS,项目名称:tron_actorcore,代码行数:104,代码来源:StripChartWdg.py

示例3: __init__

# 需要导入模块: from RO.TkUtil import Timer [as 别名]
# 或者: from RO.TkUtil.Timer import start [as 别名]
class _BalloonHelp:
    """Show balloon help for any widget that has a helpText attribute
    
    Help is shown delayMS after the mouse enters a widget or moves within a widget.
    If help was showing within 0.6 sec of moving to a new widget then the help
    for the new widget is shown immediately.
    
    Help is hidden if the user clicks or types. However, the help timer is started again
    if the mouse moves within the widget.
    """
    def __init__(self, delayMS = 600):
        """Construct a _BalloonHelp
        
        Inputs:
        - delayMS: delay time before help is shown
        """
        self._isShowing = False
        self._delayMS = delayMS
        self._showTimer = Timer()
        self._leaveTimer = Timer()
        self._msgWin = tkinter.Toplevel()
        self._msgWin.overrideredirect(True)
        self._msgWdg = tkinter.Message(self._msgWin, bg="light yellow")
        self._msgWdg.pack()
        self._msgWin.withdraw()
        self._msgWdg.bind_all('<Motion>', self._start)
        self._msgWdg.bind_all('<Leave>', self._leave)
        self._msgWdg.bind_all('<ButtonPress>', self._stop)
        self._msgWdg.bind_all('<KeyPress>', self._stop)
        self._msgWdg.bind_all('<Tab>', self._stop, add=True)
        self._msgWin.bind("<Configure>", self._configure)
    
    def _configure(self, evt=None):
        """Callback for window Configure event
        
        Using this flickers less than calling this from show (even using a short time delay).
        Note: using self._isShowing is paranoia; the <Configure> event is only triggered
        by show (which changes the message).
        """
        if self._isShowing:
            self._msgWin.tkraise()
            self._msgWin.deiconify()
    
    def _leave(self, evt=None):
        """Mouse has left a widget; start the leave timer if help is showing and stop showing help
        """
        if self._isShowing:
            self._leaveTimer.start(0.6, self._leaveDone)
        self._stop()
    
    def _leaveDone(self):
        """No-op for leave timer; can add a print statement for diagnostics
        """
        pass

    def _start(self, evt):
        """Start a timer to show the help in a bit.
        
        If the help window is already showing, redisplay it immediately
        """
        if self._isShowing:
            return
        self._isShowing = True

        try:
            if evt.widget.helpText and not self._showTimer.isActive:
                # widget has help and the show timer is not already running
                justLeft = self._leaveTimer.cancel()
                if justLeft:
                    # recently left another widget while showing help; show help for this widget right away
                    delay = 0.001
                else:
                    # not recently showing help; wait the usual time to show help
                    delay = self._delayMS / 1000.0
                self._showTimer.start(delay, self._show, evt)
        except AttributeError:
            pass
    
    def _show(self, evt):
        """Show help
        """
        self._isShowing = True
        x, y = evt.x_root, evt.y_root
        self._msgWin.geometry("+%d+%d" % (x+10, y+10))
        self._msgWdg["text"] = evt.widget.helpText
    
    def _stop(self, evt=None):
        """Stop the timer and hide the help
        """
        self._isShowing = False
        self._showTimer.cancel()
        self._msgWin.withdraw()
开发者ID:astromaddie,项目名称:RO-py3,代码行数:94,代码来源:BalloonHelp.py

示例4: ObjPosWdg

# 需要导入模块: from RO.TkUtil import Timer [as 别名]
# 或者: from RO.TkUtil.Timer import start [as 别名]

#.........这里部分代码省略.........
        self.tccModel.altLim.addCallback(self._altLimChanged)

        # initialize display
        self.restoreDefault()
        
        self.objNameWdg.focus_set()
    
    def _azLimChanged(self, azLim, isCurrent, **kargs):
#       print "_azLimitChanged(azLim=%r, isCurrent=%s)" % (azLim, isCurrent)
        coordSys = self.userModel.coordSysName.get()
        if coordSys != RO.CoordSys.Mount:
            return
        
        self.objPos1.dataWdg.setRange(*azLim[0:2])
    
    def _altLimChanged(self, altLim, isCurrent, **kargs):
#       print "_altLimitChanged(altLim=%r, isCurrent=%s)" % (altLim, isCurrent)
        coordSys = self.userModel.coordSysName.get()
        if coordSys != RO.CoordSys.Mount:
            return
        
        self.objPos2.dataWdg.setRange(*altLim[0:2])
    
    def _coordSysChanged (self, coordSys):
        """Update the display when the coordinate system is changed.
        """
#       print "ObjPosWdg._coordSysChanged(coordSys=%r)" % (coordSys,)
        pos1IsHours = 1
        csysObj = RO.CoordSys.getSysConst(coordSys)
        pos1IsHours = csysObj.eqInHours()
        posLabels = csysObj.posLabels()

        if coordSys in RO.CoordSys.AzAlt:
            if coordSys == RO.CoordSys.Mount:
                azLim, isCurrent = self.tccModel.azLim.get()
                pos1Range = azLim[0:2]
                altLim, isCurrent = self.tccModel.altLim.get()
                pos2Range = altLim[0:2]
            else:
                pos1Range = (0, 360)
                pos2Range = (0, 90)
        elif pos1IsHours:
            pos1Range = (0, 24)
            pos2Range = (-90, 90)
        else:
            # no such coordsys, so makes a good sanity check
            raise RuntimeError, "ObjPosWdg bug: cannot handle coordinate system %r" % (coordSys,)
        
        self.objPos1.labelWdg["text"] = posLabels[0]
        self.objPos2.labelWdg["text"] = posLabels[1]
        self.objPos1.dataWdg.setIsHours(pos1IsHours)
        self.objPos1.dataWdg.setRange(*pos1Range)
        self.objPos2.dataWdg.setRange(*pos2Range)
    
    def getSummary(self):
        """Returns (name, pos1, pos2, csys), all as the strings shown in the widgets
        (not the numeric values).
        It would be slightly nicer if the summary could be derived from the value dictionary
        but this is quite tricky to do right."""
        name = self.objNameWdg.get()
        pos1 = self.objPos1.dataWdg.getString()
        pos2 = self.objPos2.dataWdg.getString()
        csys = self.userModel.coordSysName.get()
        return (name, pos1, pos2, csys)
    
    def neatenDisplay(self):
        self.objPos1.dataWdg.neatenDisplay()
        self.objPos2.dataWdg.neatenDisplay()
    
    def setAzAltAirmass(self, *args, **kargs):
#       print "ObjPosWdg.setAzAltAirmass"
        self._azAltRefreshTimer.cancel()

        target = self.userModel.potentialTarget.get()
        if target == None:
            self.azWdg.set(None)
            self.altWdg.set(None)
            self.airmassWdg.set(None)
            return
        
        azalt = target.getAzAlt()
        if azalt == None:
            self.azWdg.set(None)
            self.altWdg.set(None)
            self.airmassWdg.set(None)
            return

        az, alt = azalt
        airmass = RO.Astro.Sph.airmass(alt)
        altData, limCurrent = self.tccModel.altLim.get()
        altSeverity = RO.Constants.sevNormal
        minAlt = altData[0]
        if minAlt != None:
            if alt < minAlt:
                altSeverity = RO.Constants.sevError
        
        self.azWdg.set(az)
        self.altWdg.set(alt, severity = altSeverity)
        self.airmassWdg.set(airmass)
        self._azAltRefreshTimer.start(_AzAltRefreshDelay, self.setAzAltAirmass)
开发者ID:migueldvb,项目名称:TUI,代码行数:104,代码来源:ObjPosWdg.py

示例5: MiscWdg

# 需要导入模块: from RO.TkUtil import Timer [as 别名]
# 或者: from RO.TkUtil.Timer import start [as 别名]
class MiscWdg (Tkinter.Frame):
    InstNameDict = {0: "None"} # add a value for Eng Cam once known
    def __init__ (self, master=None, **kargs):
        """Displays miscellaneous information, such as current time and az/alt

        Inputs:
        - master        master Tk widget -- typically a frame or window
        """
        Tkinter.Frame.__init__(self, master=master, **kargs)
        self.tccModel = TUI.Models.getModel("tcc")
        self.guiderModel = TUI.Models.getModel("guider")
        self.mcpModel = TUI.Models.getModel("mcp")
        self.plateDBModel = TUI.Models.getModel("platedb")
        self._cartridgeInfo = [None]*3 # (cartID, plateID, pointing)
        self._clockTimer = Timer()
        
        gr = RO.Wdg.Gridder(self, sticky="e")

        self.haWdg = RO.Wdg.DMSLabel(
            master = self,
            precision = 0,
            nFields = 3,
            cvtDegToHrs = 1,
            width = 8,
            helpText = "Hour angle of the object",
            helpURL = _HelpURL,
        )
        gr.gridWdg("HA", self.haWdg, "hms")
        
        self.designHAWdg = RO.Wdg.DMSLabel(
            master = self,
            precision = 0,
            nFields = 3,
            cvtDegToHrs = 1,
            width = 8,
            helpText = "Hour angle the plate was designed for (from platedb)",
            helpURL = _HelpURL,
        )
        gr.gridWdg("Design HA", self.designHAWdg, "hms")
        
        self.deltaHAWdg = RO.Wdg.DMSLabel(
            master = self,
            precision = 0,
            nFields = 3,
            cvtDegToHrs = 1,
            width = 8,
            helpText = "Design - current hour angle",
            helpURL = _HelpURL,
        )
        gr.gridWdg("Des-Curr HA", self.deltaHAWdg, "hms")
        
        self.taiWdg = RO.Wdg.StrLabel(
            master = self,
            width=19,
            helpText = "International Atomic Time",
            helpURL = _HelpURL,
        )
        gr.gridWdg("TAI", self.taiWdg, colSpan=2)

        # secondary focus
        self.secFocusWdg = RO.Wdg.FloatLabel(
            master = self,
            precision = 0,
            width = 5,
            helpText = "Secondary mirror focus",
            helpURL = _HelpURL,
        )
        gr.gridWdg (
            label = "Focus",
            dataWdg = self.secFocusWdg,
            units = u"\N{MICRO SIGN}m",
        )
        self.tccModel.secFocus.addValueCallback(self.secFocusWdg.set)

        # start the second column of widgets
        gr.startNewCol(spacing=1)
        
        gr._nextCol -= 2 # allow overlap with widget to the right

        self.airmassWdg = RO.Wdg.FloatLabel(
            master = self,
            precision=3,
            width = 5,
            helpText = "Airmass",
            helpURL = _HelpURL,
        )
        gr.gridWdg("Airmass", self.airmassWdg)
        
        self.zdWdg = RO.Wdg.FloatLabel(
            master = self,
            precision = 1,
            helpText = "Zenith distance (90 - altitude)",
            helpURL = _HelpURL,
            width = 5,
        )
        gr.gridWdg("ZD", self.zdWdg, RO.StringUtil.DegStr)

        self.lmstWdg = RO.Wdg.DMSLabel(
            master = self,
            precision = 0,
#.........这里部分代码省略.........
开发者ID:CraigLoomis,项目名称:stui,代码行数:103,代码来源:MiscWdg.py

示例6: MiscWdg

# 需要导入模块: from RO.TkUtil import Timer [as 别名]
# 或者: from RO.TkUtil.Timer import start [as 别名]
class MiscWdg (Tkinter.Frame):
    def __init__ (self, master=None, **kargs):
        """Displays miscellaneous information, such as current time and az/alt

        Inputs:
        - master        master Tk widget -- typically a frame or window
        """
        Tkinter.Frame.__init__(self, master=master, **kargs)
        self.tccModel = TUI.TCC.TCCModel.getModel()
        self.gmechModel = TUI.Guide.GMechModel.getModel()
        
        self._clockTimer = Timer()
        
        gr = RO.Wdg.Gridder(self, sticky="e")

        # magic numbers
        AzAltRotPrec = 1    # number of digits past decimal point
        
        self.haWdg = RO.Wdg.DMSLabel(
            master = self,
            precision = 0,
            nFields = 3,
            cvtDegToHrs = 1,
            width = 8,
            helpText = "Hour angle of the object",
            helpURL = _HelpURL,
        )
        gr.gridWdg (
            label = "HA",
            dataWdg = self.haWdg,
            units = "hms",
        )
        
        self.lmstWdg = RO.Wdg.DMSLabel(
            master = self,
            precision = 0,
            nFields = 3,
            width = 8,
            justify="right",
            helpText = "Local mean sidereal time at APO",
            helpURL = _HelpURL,
        )
        gr.gridWdg (
            label = "LMST",
            dataWdg = self.lmstWdg,
            units = "hms",
        )
        
        self.utcWdg = RO.Wdg.StrLabel(
            master = self,
            width = 19,
            helpText = "Coordinated universal time",
            helpURL = _HelpURL,
        )
        gr.gridWdg (
            label = "UTC",
            dataWdg = self.utcWdg,
            colSpan = 2,
        )
        
        # start the second column of widgets
        gr.startNewCol(spacing=1)
        
        self.guideWdg = RO.Wdg.StrLabel(
            master = self,
            width = 13,
            anchor = "w",
            helpText = "State of guiding",
            helpURL = _HelpURL,
        )
        gr.gridWdg (
            label = "Guiding",
            dataWdg = self.guideWdg,
            colSpan = 4,
            units = False,
            sticky = "ew",
        )
        gr._nextCol -= 2 # allow overlap with widget to the right
        self.guideModelDict = {} # guide camera name: guide model
        for guideModel in TUI.Guide.GuideModel.modelIter():
            gcamName = guideModel.gcamName
            if gcamName.endswith("focus"):
                continue
            self.guideModelDict[guideModel.gcamName] = guideModel
            guideModel.locGuideStateSummary.addIndexedCallback(self._updGuideStateSummary, callNow=False)
        self._updGuideStateSummary()

        # airmass and zenith distance
        self.airmassWdg = RO.Wdg.FloatLabel(
            master = self,
            precision=3,
            width=5,
            helpURL = _HelpURL,
        )
        gr.gridWdg (
            label = "Airmass",
            dataWdg = self.airmassWdg,
            units = "",
        )
#       self.tccModel.axePos.addCallback(self.setAxePos)
#.........这里部分代码省略.........
开发者ID:r-owen,项目名称:TUI,代码行数:103,代码来源:MiscWdg.py

示例7: FTPLogWdg

# 需要导入模块: from RO.TkUtil import Timer [as 别名]
# 或者: from RO.TkUtil.Timer import start [as 别名]

#.........这里部分代码省略.........
        callFunc = None,
        dispStr = None,
        username = None,
        password = None,
    ):
        """Get a file
    
        Inputs:
        - host  IP address of ftp host
        - fromPath  full path of file on host to retrieve
        - toPath    full path of destination file
        - isBinary  file is binary? (if False, EOL translation is probably performed)
        - overwrite: if True, overwrites the destination file if it exists;
            otherwise raises ValueError
        - createDir: if True, creates any required directories;
            otherwise raises ValueError
        - callFunc: called whenever more data is read or the state changes;
            receives one argument: an RO.Comm.FTPGet.FTPGet object.
        - dispStr   a string to display while downloading the file;
                    if omitted, an ftp URL (with no username/password) is created
        - username  the usual; *NOT SECURE*
        - password  the usual; *NOT SECURE*
        """
#       print "getFile(%r, %r, %r)" % (host, fromPath, toPath)
        stateLabel = RO.Wdg.StrLabel(self, anchor="w", width=FTPGet.StateStrMaxLen)
        
        ftpGet = FTPGet(
            host = host,
            fromPath = fromPath,
            toPath = toPath,
            isBinary = isBinary,
            overwrite = overwrite,
            createDir = createDir,
            startNow = False,
            dispStr = dispStr,
            username = username,
            password = password,
        )
        self._trackMem(ftpGet, "ftpGet(%s)" % (fromPath,))

        # display item and append to list
        # (in that order so we can test for an empty list before displaying)
        if self.dispList:
            # at least one item is shown
            self.text.insert("end", "\n")
            doAutoSelect = self.selFTPGet in (self.dispList[-1], None)
        else:
            doAutoSelect = True
        self.text.window_create("end", window=stateLabel)
        self.text.insert("end", ftpGet.dispStr)
        self.dispList.append(ftpGet)
        
        self._timer.cancel()

        # append ftpGet to the queue
        ftpCallback = FTPCallback(ftpGet, callFunc)
        self.getQueue.append((ftpGet, stateLabel, ftpCallback))
        
        # purge old display items if necessary
        ind = 0
        selInd = None
        while max(self.maxLines, ind) < len(self.dispList):
            #print "FTPLogWdg.getFile: maxLines=%s, ind=%s, nEntries=%s" % (self.maxLines, ind, len(self.dispList),)

            # only erase entries for files that are finished
            if not self.dispList[ind].isDone:
开发者ID:r-owen,项目名称:RO,代码行数:70,代码来源:FTPLogWdg.py

示例8: WaitForTCPServer

# 需要导入模块: from RO.TkUtil import Timer [as 别名]
# 或者: from RO.TkUtil.Timer import start [as 别名]
class WaitForTCPServer(object):
    """Wait for a TCP server to accept a connection
    """
    def __init__(self, host, port, callFunc, timeLim=5, pollInterval=0.2):
        """Start waiting for a TCP server to accept a connection
        
        @param[in] host  host address of server
        @param[in] port  port number of server
        @param[in] callFunc  function to call when server ready or wait times out;
            receives one parameter: this object
        @param[in] timeLim  approximate maximum wait time (sec);
            the actual wait time may be up to pollInterval longer
        @param[in] pollInterval  interval at which to poll (sec)
        
        Useful attributes:
        - isDone: the wait is over
        - didFail: the wait failed
        """
        self.host = host
        self.port = port
        self.isDone = False
        self.didFail = False
        self._callFunc = callFunc
        self._pollInterval = float(pollInterval)
        self._timeLim = float(timeLim)
        self._pollTimer = Timer()
        self._startTime = time.time()
        self._tryConnection()
        self._timeoutTimer = Timer(timeLim, self._finish)
    
    def _tryConnection(self):
        """Attempt a connection
        """
        self._sock = TCPSocket(host=self.host, port=self.port, stateCallback=self._sockStateCallback)
    
    def _sockStateCallback(self, sock):
        """Socket state callback
        """
        if sock.isReady:
            # success
            self._finish()
        elif sock.isDone:
            # connection failed; try again
            self._pollTimer.start(self._pollInterval, self._tryConnection)
        
    def _finish(self):
        """Set _isReady and call the callback function
        """
        self._pollTimer.cancel()
        self._timeoutTimer.cancel()
        self.didFail = not self._sock.isReady
        self.isDone = True
        if not self._sock.isDone:
            self._sock.setStateCallback()
            self._sock.close()
            self._sock = None
        if self._callFunc:
            callFunc = self._callFunc
            self._callFunc = None
            safeCall2("%s._finish" % (self,), callFunc, self)

    def __repr__(self):
        return "%s(host=%s, port=%s)" % (type(self).__name__, self.host, self.port)
开发者ID:Subaru-PFS,项目名称:tron_actorcore,代码行数:65,代码来源:Generic.py

示例9: UsersWdg

# 需要导入模块: from RO.TkUtil import Timer [as 别名]
# 或者: from RO.TkUtil.Timer import start [as 别名]
class UsersWdg(Tkinter.Frame):
    """Display the current users and those recently logged out.
    
    Inputs:
    - master    parent widget
    - retainSec time to retain information about logged out users (sec)
    - height    default height of text widget
    - width default width of text widget
    - other keyword arguments are used for the frame
    """
    def __init__ (self,
        master=None,
        retainSec=300,
        height = 10,
        width = 50,
    **kargs):
        Tkinter.Frame.__init__(self, master, **kargs)
        
        hubModel = TUI.Models.HubModel.getModel()
        self.tuiModel = TUI.TUIModel.getModel()
        
        # entries are commanders (prog.user)
        self._cmdrList = []
        # entries are (cmdr, time deleted); time is from time.time()
        self._delCmdrTimeList = []
        # time to show deleted users
        self._retainSec = retainSec
        
        # dictionary of user name: User object
        self.userDict = dict()
        
        self._updateTimer = Timer()
                
        self.yscroll = Tkinter.Scrollbar (
            master = self,
            orient = "vertical",
        )
        self.text = Tkinter.Text (
            master = self,
            yscrollcommand = self.yscroll.set,
            wrap = "none",
            tabs = "1.6c 5.0c 6.7c 8.5c",
            height = height,
            width = width,
        )
        self.yscroll.configure(command=self.text.yview)
        self.text.grid(row=0, column=0, sticky="nsew")
        self.yscroll.grid(row=0, column=1, sticky="ns")
        RO.Wdg.Bindings.makeReadOnly(self.text)
        RO.Wdg.addCtxMenu(
            wdg = self.text,
            helpURL = _HelpPage,
        )
        
        self.rowconfigure(0, weight=1)
        self.columnconfigure(0, weight=1)
        
        self.text.tag_configure("del", overstrike=True)
        self.text.tag_configure("me", underline=True)

        hubModel.user.addCallback(self.updUser, callNow=False)
        hubModel.users.addCallback(self.updUsers)

    def scheduleUpdate(self, afterSec=1.0):
        """Schedule a new update
        """
        self._updateTimer.start(afterSec, self.updDisplay)

    def updDisplay(self):
        """Display current data.
        """
        self._updateTimer.cancel()
        
        myCmdr = self.tuiModel.getCmdr()
        maxDisplayTime = time.time() - self._retainSec

        self.text.delete("1.0", "end")
        doScheduleUpdate = False
        deleteCmdrList = []
        for cmdr in sorted(self.userDict.keys()):
            userObj = self.userDict[cmdr]
            if userObj.clientName == "monitor":
                continue
            if userObj.isConnected:
                tagList = ["curr"]
            elif userObj.disconnTime < maxDisplayTime:
                deleteCmdrList.append(cmdr)
                continue
            else:
                tagList = ["del"]
                doScheduleUpdate = True
            if cmdr == myCmdr:
                tagList.append("me")
            displayStr = "%s\t%s\t%s\t%s\t%s\n" % \
                (userObj.prog, userObj.user, userObj.clientName, userObj.clientVersion, userObj.systemInfo)
            self.text.insert("end", displayStr, " ".join(tagList))

        for cmdr in deleteCmdrList:
            del(self.userDict[cmdr])
        
#.........这里部分代码省略.........
开发者ID:migueldvb,项目名称:TUI,代码行数:103,代码来源:UsersWindow.py

示例10: TestGuiderWdg

# 需要导入模块: from RO.TkUtil import Timer [as 别名]
# 或者: from RO.TkUtil.Timer import start [as 别名]

#.........这里部分代码省略.........
        if self.isInstAgileWdg.getBool():
            tccData = "inst=Agile"
        else:
            tccData = "inst=SPICam"
        self.testDispatcher.dispatch(tccData, actor="tcc")
        
    def dispatchFileData(self, wdg=None):
        keyArgs = self.getDispatchKeyArgs("agileExpose", cmdID=0)
        fileName = "image%d" % (self.fileNum,)
        self.fileNum += 1
        filesKeyword = makeFilesKeyword(cmdr=keyArgs["cmdr"], fileName=fileName)
        self.testDispatcher.dispatch(filesKeyword, msgCode=":", **keyArgs)

    def dispatchFindData(self, wdg=None):
        keyArgs = self.getDispatchKeyArgs("afocus")

        numToFind = self.numToFindWdg.getNum()

        if numToFind < 1:
            self.testDispatcher.dispatch("text='No stars found'", msgCode="f", **keyArgs)
            return

        mainXYPos = [wdg.getNum() for wdg in self.starPosWdgSet]
        centroidRad = self.centroidRadWdg.getNum()
        findData = makeFindData(numFound=numToFind, mainXYPos=mainXYPos, centroidRad=centroidRad)
        self.testDispatcher.dispatch(findData, msgCode="i", **keyArgs)
        self.testDispatcher.dispatch("", msgCode=":", **keyArgs)

    def dispatchCentroidData(self, wdg=None):
        keyArgs = self.getDispatchKeyArgs("afocus")

        if not self.centroidOKWdg.getBool():
            self.testDispatcher.dispatch("text='No stars found'", msgCode="f", **keyArgs)
            return
        
        xyPos = [wdg.getNum() for wdg in self.starPosWdgSet]
        centroidRad = self.centroidRadWdg.getNum()
        centroidData = makeStarKeyword(isFind=False, xyPos=xyPos, randRange=10, centroidRad=centroidRad)
        self.testDispatcher.dispatch(centroidData, msgCode=":", **keyArgs)

    def getDispatchKeyArgs(self, actor, cmdID=None):
        """Get keyword arguments for the test dispatcher's dispatch command
        """
        if self.useWrongCmdrWdg.getBool():
            cmdr = "APO.other"
        else:
            cmdr = self.tuiModel.getCmdr()

        if cmdID is None:
            if self.guideWdg.pendingCmd:
                cmdID = self.guideWdg.pendingCmd.cmdID or 0
            else:
                cmdID = 0

        if self.useWrongCmdIDWdg.getBool():
            cmdID += 1000
        
        if self.useWrongActorWdg.getBool():
            actor = "other"
        else:
            actor = actor

        return dict(cmdr=cmdr, cmdID=cmdID, actor=actor)

    def pollPendingCmd(self):
        """Poll to see if there's a new pending command and respond accordingly
        """
        self.pollTimer.cancel()

        if self.guideWdg.pendingCmd != self.oldPendingCmd:
            self.oldPendingCmd = self.guideWdg.pendingCmd
            if not self.oldPendingCmd.isDone():
                self.replyToCommand()

        self.pollTimer.start(1.0, self.pollPendingCmd)

    def replyToCommand(self):
        """Issue the appropriate replly to a pending command
        """
#         print "replyToCommand", self.oldPendingCmd
        actor = self.oldPendingCmd.actor.lower()
        cmdStr = self.oldPendingCmd.cmdStr
        cmdID = self.oldPendingCmd.cmdID

        keyArgs = self.getDispatchKeyArgs(actor)
        
        if actor == "tcc":
            if self.offsetOKWdg.getBool():
                self.testDispatcher.dispatch("", msgCode=":", **keyArgs)
            else:
                self.testDispatcher.dispatch("text='Offset failed'", msgCode="f", **keyArgs)
        elif actor == "afocus":
            if cmdStr.startswith("centroid"):
                self.dispatchCentroidData()
            elif cmdStr.startswith("find"):
                self.dispatchFindData()
            else:
                print "Unknown afocus command:", cmdStr
        else:
            print "Unknown actor:", actor
开发者ID:r-owen,项目名称:TUI,代码行数:104,代码来源:AgileGuideTest.py

示例11: PrefEditor

# 需要导入模块: from RO.TkUtil import Timer [as 别名]
# 或者: from RO.TkUtil.Timer import start [as 别名]

#.........这里部分代码省略.........

    def updateChanged(self):
        """Updates the "value changed" indicator.
        """
        self.timer.cancel()
        editValue = self.getEditValue()
#       print "updateChanged called"
#       print "editValue = %r" % editValue
#       print "currentValue = %r" % self.getCurrentValue()
#       print "initialValue = %r" % self.getInitialValue()
#       print "defaultValue = %r" % self.getDefValue()
        if editValue == self.getCurrentValue():
            self.changedVar.set("")
        else:
            self.changedVar.set("!")

    def _addCtxMenu(self, wdg):
        """Convenience function; adds the usual contextual menu to a widget"""
        RO.Wdg.addCtxMenu (
            wdg = wdg,
            helpURL = self.prefVar.helpURL,
            configFunc = self._configCtxMenu,
        )
        wdg.helpText = self.prefVar.helpText
    
    def _editCallback(self, *args):
        """Called whenever the edited value changes.
        Uses after to avoid the problem of the user entering
        an invalid character that is immediately rejected;
        that rejection doesn't show up in editVar.get
        and so the changed indicator falsely turns on.
        """
#       print "_editCallback; afterID=", self.afterID
        self.timer.start(0.001, self.updateChanged)
        
    def _setupCallbacks(self):
        """Set up a callback to call self.updateChanged
        whenever the edit value changes.
        """
        self.editVar.trace_variable("w", self._editCallback)

    def _getEditWdg(self):
        if self.prefVar.validValues:
            # use a pop-up list of values
            # first generate a list of strings representing the values
            valueList = [self.prefVar.asStr(val) for val in self.prefVar.validValues]
            # now return a menu containing those values
            wdg = RO.Wdg.OptionMenu(
                master = self.master,
                var= self.editVar,
                items = valueList,
                helpText = self.prefVar.helpText,
                helpURL = self.prefVar.helpURL,
            )
            wdg.ctxSetConfigFunc(self._configCtxMenu)
            wdg.set(self.getInitialValue())
        else:
            wdg = self.prefVar.getEditWdg(self.master, self.editVar, self._configCtxMenu)
        return wdg

    def _getRangeWdg(self):
        return tkinter.Label(self.master, text = self.prefVar.getRangeStr())
    
    def _getShowMenu(self):
        mbut = tkinter.Menubutton(self.master,
            indicatoron=1,
开发者ID:Subaru-PFS,项目名称:tron_actorcore,代码行数:70,代码来源:PrefEditor.py

示例12: StatusConfigInputWdg

# 需要导入模块: from RO.TkUtil import Timer [as 别名]
# 或者: from RO.TkUtil.Timer import start [as 别名]

#.........这里部分代码省略.........
            nameSep = " move=",
        )

        # set up the input container set
        self.inputCont = RO.InputCont.ContList (
            conts = [
                RO.InputCont.WdgCont (
                    name = "calmirror",
                    wdgs = self.calMirror.userWdg,
                    formatFunc = RO.InputCont.BasicFmt(nameSep=" "),
                ),
                RO.InputCont.WdgCont (
                    name = "collimator",
                    wdgs = self.collimator.userWdg,
                    formatFunc = moveFmtFunc,
                ),
                RO.InputCont.WdgCont (
                    name = "disperser",
                    wdgs = self.disperser.userWdg,
                    formatFunc = moveFmtFunc,
                ),
                RO.InputCont.WdgCont (
                    name = "filter",
                    wdgs = self.filter.userWdg,
                    formatFunc = moveFmtFunc,
                ),
                RO.InputCont.WdgCont (
                    name = "lenslets",
                    wdgs = self.lenslets.userWdg,
                    formatFunc = moveFmtFunc,
                ),
                RO.InputCont.WdgCont (
                    name = "magnifier",
                    wdgs = self.magnifier.userWdg,
                    formatFunc = moveFmtFunc,
                ),
            ],
        )

        self._inputContNameKeyVarDict = dict(
            calmirror = self.model.calMirrorPresets,
            collimator = self.model.collimatorPresets,
            disperser = self.model.disperserPresets,
            filter = self.model.filterPresets,
            lenslets = self.model.lensletPresets,
            magnifier = self.model.magnifierPresets,
        )
        
        self.presetsWdg = RO.Wdg.InputContPresetsWdg(
            master = self,
            sysName = "%sConfig" % (self.InstName,),
            userPresetsDict = self.tuiModel.userPresetsDict,
            inputCont = self.inputCont,
            helpText = "use and manage named presets",
            helpURL = self.HelpPrefix + "Presets",
        )
        self.gridder.gridWdg(
            "Presets",
            cfgWdg = self.presetsWdg,
        )

        self.gridder.allGridded()

        # for presets data use a timer to increase the chance that all keywords have been seen
        # before the method is called
        def callUpdPresets(*args, **kwargs):
            self.updateStdPresetsTimer.start(0.1, self.updateStdPresets)
        for keyVar in self._inputContNameKeyVarDict.itervalues():
            keyVar.addCallback(callUpdPresets)
        
        def repaint(evt):
            self.restoreDefault()
        self.bind("<Map>", repaint)

    def updateStdPresets(self):
        """Update standard presets, if the data is available
        """
        self.updateStdPresetsTimer.cancel()
        nameList = self.model.namePresets.get()[0]
        if None in nameList:
            return
        numPresets = len(nameList)
        dataDict = dict()
        for inputContName, keyVar in self._inputContNameKeyVarDict.iteritems():
            valList = keyVar.get()[0]
            if len(valList) != numPresets or None in valList:
                return
            dataDict[inputContName] = valList

        # stdPresets is a dict of name: dict of input container name: value
        stdPresets = dict()
        for i, name in enumerate(nameList):
            contDict = dict()
            for inputContName, valList in dataDict.iteritems():
                if not valList[i]:
                    continue
                contDict[inputContName] = valList[i]
            if contDict:
                stdPresets[name] = contDict
        self.presetsWdg.setStdPresets(stdPresets)
开发者ID:migueldvb,项目名称:TUI,代码行数:104,代码来源:StatusConfigInputWdg.py

示例13: AxisStatusWdg

# 需要导入模块: from RO.TkUtil import Timer [as 别名]
# 或者: from RO.TkUtil.Timer import start [as 别名]

#.........这里部分代码省略.........
            )
        
        # widen rotator commanded state widget
        # so there's room to display "NotAvailable"
        # (note that the error code widget will be hidden when this occurs
        # so the text will not overlap anything).
        rotCmdWdg = self.axisCmdStateWdgSet[2]
        rotCmdWdg.grid_configure(columnspan=2)
        rotCmdWdg["width"] = 12

        # allow the last column to grow to fill the available space
        self.columnconfigure(gr.getMaxNextCol(), weight=1)
    
    def setAxisCmdState(self, axisCmdState, isCurrent, keyVar):
        if not isCurrent:
            for wdg in self.axisCmdStateWdgSet:
                wdg.setIsCurrent(False)
            return

        # set axis commanded state widgets
        for axis in self.axisInd:
            cmdState = axisCmdState[axis]
            severity = _CmdStateDict.get(cmdState.lower(), RO.Constants.sevError)
            self.axisCmdStateWdgSet[axis].set(cmdState, severity=severity)

        # play sounds, if appropriate
        indSoundsToPlay = set() # add new sounds to play to a set to avoid duplicates
        for axis in self.axisInd:
            soundInd, soundFunc = _StateIndSoundDict.get(axisCmdState[axis].lower(), (0, None))
            if soundFunc and (soundFunc != self.prevSounds[axis]) and keyVar.isGenuine():
                indSoundsToPlay.add((soundInd, soundFunc))
            self.prevSounds[axis] = soundFunc
        
        if indSoundsToPlay:
            indSoundsToPlay = list(indSoundsToPlay)
            indSoundsToPlay.sort()
            soundsToPlay = list(zip(*indSoundsToPlay)[1])
            soundsToPlay.reverse() # since played from back to front
            self.playSounds(soundsToPlay)
        
    def setCtrlStatus(self, axis, statusWord, isCurrent=True, keyVar=None, *args):
        # print "setCtrlStatus called with axis, statusWord, isCurrent=", axis, statusWord, isCurrent
        if axis == 2 and not self.tccModel.rotExists[0]:
            # rotator does not exist; this is handled by setRotExists
            return
            
        statusOK = True

        ctrlStatusWdg = self.ctrlStatusWdgSet[axis]

        if statusWord is not None:
            infoList = RO.BitDescr.getDescr(_BitInfo, statusWord)
            
            # for now simply show the first status;
            # eventually provide a pop-up list showing all status bits
            if infoList:
                info, severity = infoList[0]
                ctrlStatusWdg.set(info, isCurrent, severity=severity)
                if severity == RO.Constants.sevError:
                    statusOK = False
            else:
                ctrlStatusWdg.set("", isCurrent, severity=RO.Constants.sevNormal)
        elif isCurrent:
            ctrlStatusWdg.set("Not responding", isCurrent, severity=RO.Constants.sevError)
            statusOK = False
        else:
            ctrlStatusWdg.setNotCurrent()
        
        statusNewlyBad = (self.prevCtrlStatusOK[axis] and not statusOK)
        self.prevCtrlStatusOK[axis] = statusOK
        
        if statusNewlyBad and keyVar and keyVar.isGenuine() \
            and (time.time() - self.ctrlBadTime > _CtrllrWaitSec):
            TUI.PlaySound.axisHalt()
            self.ctrlBadTime = time.time()
    
    def setRotExists(self, rotExists, isCurrent=True, **kargs):
        if not isCurrent:
            return
        if rotExists:
            self.rotUnitsLabel1.grid()
            self.rotUnitsLabel2.grid()
            self.axisErrCodeWdgSet[2].grid()
            self.ctrlStatusWdgSet[2].grid()
            self.ctrlStatusWdgSet[2].set("", severity=RO.Constants.sevNormal)
        else:
            self.rotUnitsLabel1.grid_remove()
            self.rotUnitsLabel2.grid_remove()
            self.axisErrCodeWdgSet[2].grid_remove()
            self.ctrlStatusWdgSet[2].grid_remove()
    
    def playSounds(self, sounds):
        """Play one or more of a set of sounds; played in order from last to first.
        """
        if not sounds:
            return
        soundFunc = sounds.pop(-1)
        soundFunc()
        if sounds:
            self._soundTimer.start(_SoundInterval, self.playSounds, sounds)
开发者ID:r-owen,项目名称:TUI,代码行数:104,代码来源:AxisStatus.py

示例14: CameraWdg

# 需要导入模块: from RO.TkUtil import Timer [as 别名]
# 或者: from RO.TkUtil.Timer import start [as 别名]
class CameraWdg(Tkinter.Frame):
    def __init__(self, master):
        Tkinter.Frame.__init__(self, master)
        self.expNum = 1
        self.statusTimer = Timer()
        self.camera = arctic.Camera()

        row = 0

        exposeFrame = Tkinter.Frame(self)
        self.expTimeWdg = RO.Wdg.FloatEntry(
            master = exposeFrame,
            defValue = 1,
            minValue = 0,
            helpText = "exposure time (sec)",
        )
        self.expTimeWdg.pack(side="left")
        self.expTypeWdg = RO.Wdg.OptionMenu(
            master = exposeFrame,
            items = ExpTypeDict.keys(),
            defValue = "Object",
            helpText = "exposure type",
        )
        self.expTypeWdg.pack(side="left")
        self.expButton = RO.Wdg.Button(
            master = exposeFrame,
            text = "Expose",
            command = self.doExpose,
            helpText = "start exposure",
        )
        self.expButton.pack(side="left")
        exposeFrame.grid(row=row, column=0)
        row += 1

        binFrame = Tkinter.Frame(self)
        self.binFacColWdg = RO.Wdg.IntEntry(
            master = binFrame,
            defValue = 2,
            autoIsCurrent = True,
            helpText = "x bin factor",
        )
        self.binFacColWdg.pack(side="left")
        self.binFacRowWdg = RO.Wdg.IntEntry(
            master = binFrame,
            defValue = 2,
            autoIsCurrent = True,
            helpText = "y bin factor",
        )
        self.binFacRowWdg.pack(side="left")
        binFrame.grid(row=row, column=0)
        row += 1

        windowFrame = Tkinter.Frame(self)
        self.winStartColWdg = RO.Wdg.IntEntry(
            master = windowFrame,
            defValue = 0,
            autoIsCurrent = True,
            helpText = "window starting column",
        )
        self.winStartColWdg.pack(side="left")
        self.winStartRowWdg = RO.Wdg.IntEntry(
            master = windowFrame,
            defValue = 0,
            autoIsCurrent = True,
            helpText = "window starting row",
        )
        self.winStartRowWdg.pack(side="left")
        self.winWidthWdg = RO.Wdg.IntEntry(
            master = windowFrame,
            defValue = 0,
            autoIsCurrent = True,
            helpText = "window width (unbinned pixels)",
        )
        self.winWidthWdg.pack(side="left")
        self.winHeightWdg = RO.Wdg.IntEntry(
            master = windowFrame,
            defValue = 0,
            autoIsCurrent = True,
            helpText = "window height (unbinned pixels)",
        )
        self.winHeightWdg.pack(side="left")
        windowFrame.grid(row=row, column=0)
        row += 1

        self.fullWindowBtn = RO.Wdg.Button(
            master = self,
            command = self.doSetFullWindow,
            text = "Set Full Window",
            helpText = "set full window",
        )
        self.fullWindowBtn.grid(row=row, column=0)
        row += 1

        self.readoutRateWdg = RO.Wdg.OptionMenu(
            master = self,
            items = ReadoutRateNameEnumDict.keys(),
            defValue = "Medium",
            autoIsCurrent = True,
            helpText = "set readout rate",
        )
#.........这里部分代码省略.........
开发者ID:ApachePointObservatory,项目名称:arcticICC,代码行数:103,代码来源:runCamera.py

示例15: TimeBar

# 需要导入模块: from RO.TkUtil import Timer [as 别名]
# 或者: from RO.TkUtil.Timer import start [as 别名]
class TimeBar(ProgressBar):
    """Progress bar to display elapsed or remaining time in seconds.
    Inputs:
    - countUp: if True, counts up, else counts down
    - autoStop: automatically stop when the limit is reached
    - updateInterval: how often to update the display (sec)
    **kargs: other arguments for ProgressBar, including:
      - value: initial time;
        typically 0 for a count up timer, maxValue for a countdown timer
        if omitted then 0 is shown and the bar does not progress until you call start.
      - minvalue: minimum time; typically 0
      - maxValue: maximum time
    """
    def __init__ (self,
        master,
        countUp = False,
        valueFormat = ("%3.0f sec", "??? sec"),
        autoStop = False,
        updateInterval = 0.1,
    **kargs):
        ProgressBar.__init__(self,
            master = master,
            valueFormat = valueFormat,
            **kargs
        )
        self._autoStop = bool(autoStop)
        self._countUp = bool(countUp)

        self._updateInterval = updateInterval
        self._updateTimer = Timer()
        self._startTime = None

        if "value" in kargs:
            self.start(kargs["value"])
    
    def clear(self):
        """Set the bar length to zero, clear the numeric time display and stop the timer.
        """
        self._updateTimer.cancel()
        ProgressBar.clear(self)
        self._startTime = None
    
    def pause(self, value = None):
        """Pause the timer.
        
        Inputs:
        - value: the value at which to pause; if omitted then the current value is used
        
        Error conditions: does nothing if not running.
        """
        if self._updateTimer.cancel():
            # update timer was running
            if value:
                self.setValue(value)
            else:
                self._updateTime(reschedule = False)
    
    def resume(self):
        """Resume the timer from the current value.

        Does nothing if not paused or running.
        """
        if self._startTime is None:
            return
        self._startUpdate()
    
    def start(self, value = None, newMin = None, newMax = None, countUp = None):
        """Start the timer.

        Inputs:
        - value: starting value; if None, set to 0 if counting up, max if counting down
        - newMin: minimum value; if None then the existing value is used
        - newMax: maximum value: if None then the existing value is used
        - countUp: if True/False then count up/down; if None then the existing value is used
        
        Typically you will only specify newMax or nothing.
        """
        if newMin is not None:
            self.minValue = float(newMin)
        if newMax is not None:
            self.maxValue = float(newMax)
        if countUp is not None:
            self._countUp = bool(countUp)

        if value is not None:
            value = float(value)
        elif self._countUp:
            value = 0.0
        else:
            value = self.maxValue
        self.setValue(value)
        
        self._startUpdate()
    
    def _startUpdate(self):
        """Starts updating from the current value.
        """
        if self._countUp:
            self._startTime = time.time() - self.value
        else:
#.........这里部分代码省略.........
开发者ID:r-owen,项目名称:RO,代码行数:103,代码来源:ProgressBar.py


注:本文中的RO.TkUtil.Timer.start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。