當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。