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


Python QTimer.startTimer方法代码示例

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


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

示例1: RunnerWidget

# 需要导入模块: from qt import QTimer [as 别名]
# 或者: from qt.QTimer import startTimer [as 别名]
class RunnerWidget(QWidget):
    def __init__(self, parent, umlmachines, name='RunnerWidget'):
        QWidget.__init__(self, parent, name)
        self.app = get_application_pointer()
        self.umlmachines = umlmachines
        self.proc = self.umlmachines.run_machine()
        self._mainbox = QVBoxLayout(self, 5, 7)
        # add label
        self.mainlabel = QLabel(self)
        self.mainlabel.setText('Running Umlmachine %s' % self.umlmachines.current)
        self._mainbox.addWidget(self.mainlabel)
        # add stdout viewer
        logfile = self.umlmachines.stdout_logfile.name
        self.logbrowser = LogBrowser(self, logfile)
        self._mainbox.addWidget(self.logbrowser)
        self.timer = QTimer(self)
        self.connect(self.timer, SIGNAL('timeout()'), self.update_progress)
        self.timer.startTimer(1000)
        
    def update_progress(self):
        #retval = self.proc.poll()
        #print retval
        retval = None
        if retval is not None:
            print retval
            self.close()
开发者ID:joelsefus,项目名称:paella,代码行数:28,代码来源:runner.py

示例2: BootStrapperWidget

# 需要导入模块: from qt import QTimer [as 别名]
# 或者: from qt.QTimer import startTimer [as 别名]
class BootStrapperWidget(QWidget):
    def __init__(self, parent, suite, name="RunnerWidget"):
        QWidget.__init__(self, parent, name)
        self.app = get_application_pointer()
        cfg = self.app.umlcfg
        basefile = make_base_filesystem(suite, "%s.base" % suite, cfg=cfg, size=300, mkfs="mke2fs")
        self.bootstrapper = UmlBootstrapper(suite, basefile, cfg=self.cfg)
        self._mainbox = QVBoxLayout(self, 5, 7)
        # add label
        self.mainlabel = QLabel(self)
        self.mainlabel.setText("Bootstrapping suite %s" % suite)
        self._mainbox.addWidget(self.mainlabel)
        # add stdout viewer
        logfile = self.umlmachines.stdout_logfile.name
        self.logbrowser = LogBrowser(self, logfile)
        self._mainbox.addWidget(self.logbrowser)
        self.timer = QTimer(self)
        self.connect(self.timer, SIGNAL("timeout()"), self.update_progress)
        self.timer.startTimer(1000)

    def update_progress(self):
        # retval = self.proc.poll()
        # print retval
        retval = None
        if retval is not None:
            print retval
            self.close()
开发者ID:joelsefus,项目名称:paella,代码行数:29,代码来源:bootstrapper.py

示例3: InstallerWidget

# 需要导入模块: from qt import QTimer [as 别名]
# 或者: from qt.QTimer import startTimer [as 别名]
class InstallerWidget(QWidget):
    def __init__(self, parent, umlmachines, name="InstallerWidget"):
        QWidget.__init__(self, parent, name)
        self.resize(600, 600)
        self.app = get_application_pointer()
        self.conn = self.app.conn
        self.umlmachines = umlmachines
        self.machine = self.umlmachines.current
        self.current_machine_process = "start"
        self.current_profile = None
        self.current_trait = None
        self.traitlist = []
        self.curenv = CurrentEnvironment(self.conn, self.machine)
        self.curenv["current_profile"] = "None"
        self.curenv["current_trait"] = "None"
        self.curenv["current_machine_process"] = self.current_machine_process
        self.timer = QTimer(self)
        self.connect(self.timer, SIGNAL("timeout()"), self.update_progress)
        self.timer.startTimer(1000)
        self.grid = QGridLayout(self, 4, 1, 5, 7)
        self.main_label = QLabel(self)
        self.main_label.setText(self._msg())
        self.grid.addWidget(self.main_label, 0, 0)
        self.profile_progress_lbl = QLabel(self)
        self.grid.addWidget(self.profile_progress_lbl, 1, 0)
        self.profile_progress = KProgress(self)
        self.grid.addWidget(self.profile_progress, 2, 0)
        self.logview = LogBrowser(self, "/tmp/uml-installer.log")
        self.grid.addWidget(self.logview, 3, 0)
        # self.console_view = StdOutBrowser(self)
        # self.console_view = KTextBrowser(self)
        # self.grid.addWidget(self.console_view, 4, 0)
        self.console_text = ""

    def _msg(self):
        return "Installing uml machine %s - %s" % (self.machine, self.current_machine_process)

    def update_console_text(self):
        if self.umlmachines.run_process is not None:
            stdout = self.umlmachines.run_process.stdout
            stdoutfd = stdout.fileno()
            ready = select.select([stdoutfd], [], [])
            while stdoutfd in ready[0]:
                line = stdout.readline()
                if line:
                    self.console_text += line
                ready = select.select([stdoutfd], [], [])
            stdout = self.umlmachines.run_process.stdout
            line = stdout.readline()
            if line:
                self.console_text += line
            self.console_view.setText(self.console_text)

    def update_progress(self):
        # self.update_console_text()
        process = self.curenv["current_machine_process"]
        # print 'update_progress', process
        if process != self.current_machine_process:
            self.current_machine_process = process
            self.main_label.setText(self._msg())
        if self.current_profile is None:
            profile = self.curenv["current_profile"]
            if profile != "None":
                self.current_profile = profile
                print "profile set to", profile
                traitlist = self.curenv["traitlist"]
                tl = [t.strip() for t in traitlist.split(",")]
                self.traitlist = tl
                self.profile_progress.setTotalSteps(len(self.traitlist))
        else:
            trait = self.curenv["current_trait"]
            if trait != "None":
                trait_process = self.curenv["current_trait_process"]
                profile = self.current_profile
                msg = "Installing profile %s, trait %s, process %s" % (profile, trait, trait_process)
                self.profile_progress_lbl.setText(msg)
                self.profile_progress.setProgress(self.traitlist.index(trait) + 1)
                self.app.processEvents()
开发者ID:joelsefus,项目名称:paella,代码行数:80,代码来源:installer.py


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