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


Python QProgressBar.resize方法代码示例

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


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

示例1: __init__

# 需要导入模块: from PyQt5.QtWidgets import QProgressBar [as 别名]
# 或者: from PyQt5.QtWidgets.QProgressBar import resize [as 别名]
class Qt4SysTrayIcon:
    def __init__(self):
        self.snapshots = snapshots.Snapshots()
        self.config = self.snapshots.config
        self.decode = None

        if len(sys.argv) > 1:
            if not self.config.setCurrentProfile(sys.argv[1]):
                logger.warning("Failed to change Profile_ID %s"
                               %sys.argv[1], self)

        self.qapp = qt4tools.createQApplication(self.config.APP_NAME)
        translator = qt4tools.translator()
        self.qapp.installTranslator(translator)
        self.qapp.setQuitOnLastWindowClosed(False)

        import icon
        self.icon = icon
        self.qapp.setWindowIcon(icon.BIT_LOGO)

        self.status_icon = QSystemTrayIcon(icon.BIT_LOGO)
        #self.status_icon.actionCollection().clear()
        self.contextMenu = QMenu()

        self.menuProfileName = self.contextMenu.addAction(_('Profile: "%s"') % self.config.profileName())
        qt4tools.setFontBold(self.menuProfileName)
        self.contextMenu.addSeparator()

        self.menuStatusMessage = self.contextMenu.addAction(_('Done'))
        self.menuProgress = self.contextMenu.addAction('')
        self.menuProgress.setVisible(False)
        self.contextMenu.addSeparator()

        self.btnPause = self.contextMenu.addAction(icon.PAUSE, _('Pause snapshot process'))
        action = lambda: os.kill(self.snapshots.pid(), signal.SIGSTOP)
        self.btnPause.triggered.connect(action)

        self.btnResume = self.contextMenu.addAction(icon.RESUME, _('Resume snapshot process'))
        action = lambda: os.kill(self.snapshots.pid(), signal.SIGCONT)
        self.btnResume.triggered.connect(action)
        self.btnResume.setVisible(False)

        self.btnStop = self.contextMenu.addAction(icon.STOP, _('Stop snapshot process'))
        self.btnStop.triggered.connect(self.onBtnStop)
        self.contextMenu.addSeparator()

        self.btnDecode = self.contextMenu.addAction(icon.VIEW_SNAPSHOT_LOG, _('decode paths'))
        self.btnDecode.setCheckable(True)
        self.btnDecode.setVisible(self.config.snapshotsMode() == 'ssh_encfs')
        self.btnDecode.toggled.connect(self.onBtnDecode)

        self.openLog = self.contextMenu.addAction(icon.VIEW_LAST_LOG, _('View Last Log'))
        self.openLog.triggered.connect(self.onOpenLog)
        self.startBIT = self.contextMenu.addAction(icon.BIT_LOGO, _('Start BackInTime'))
        self.startBIT.triggered.connect(self.onStartBIT)
        self.status_icon.setContextMenu(self.contextMenu)

        self.pixmap = icon.BIT_LOGO.pixmap(24)
        self.progressBar = QProgressBar()
        self.progressBar.setMinimum(0)
        self.progressBar.setMaximum(100)
        self.progressBar.setValue(0)
        self.progressBar.setTextVisible(False)
        self.progressBar.resize(24, 6)
        self.progressBar.render(self.pixmap, sourceRegion = QRegion(0, -14, 24, 6), flags = QWidget.RenderFlags(QWidget.DrawChildren))

        self.first_error = self.config.notify()
        self.popup = None
        self.last_message = None

        self.timer = QTimer()
        self.timer.timeout.connect(self.updateInfo)

        self.ppid = os.getppid()

    def prepairExit(self):
        self.timer.stop()

        if not self.status_icon is None:
            self.status_icon.hide()
            self.status_icon = None

        if not self.popup is None:
            self.popup.deleteLater()
            self.popup = None

        self.qapp.processEvents()

    def run(self):
        self.status_icon.show()
        self.timer.start(500)

        logger.info("[qt4systrayicon] begin loop", self)

        self.qapp.exec_()

        logger.info("[qt4systrayicon] end loop", self)

        self.prepairExit()

#.........这里部分代码省略.........
开发者ID:jeffsilverm,项目名称:backintime,代码行数:103,代码来源:qt4systrayicon.py

示例2: SensorsWidget

# 需要导入模块: from PyQt5.QtWidgets import QProgressBar [as 别名]
# 或者: from PyQt5.QtWidgets.QProgressBar import resize [as 别名]

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

        self.velLinX = qfi_SI.qfi_SI(self)
        self.velLinX.setFixedSize(QtCore.QSize(150, 150))
        # self.velLinX.move(60,270)
        self.velXLabel = QLabel('Linear X (m/s)', self)
        # self.velXLabel.move(95,420)


        self.velLinY = qfi_SI.qfi_SI(self)
        self.velLinY.setFixedSize(QtCore.QSize(150, 150))
        # self.velLinY.move(240,270)
        self.velYLabel = QLabel('Linear Y (m/s)', self)
        # self.velYLabel.move(275,420)

        self.velLinZ = qfi_SI.qfi_SI(self)
        self.velLinZ.setFixedSize(QtCore.QSize(150, 150))
        # self.velLinZ.setLabel("8 m/s")
        # self.velLinZ.move(420,270)
        self.velZLabel = QLabel('Linear Z (m/s)', self)
        # self.velZLabel.move(455,420)

        self.indLayout.addLayout(self.horizonLayout, 0, 0, Qt.AlignCenter)
        self.indLayout.addLayout(self.compassLayout, 0, 1, Qt.AlignCenter)
        self.indLayout.addLayout(self.altLayout, 0, 2, Qt.AlignCenter)
        self.indLayout.addWidget(self.velLinX, 1, 0, Qt.AlignCenter)
        self.indLayout.addWidget(self.velLinY, 1, 1, Qt.AlignCenter)
        self.indLayout.addWidget(self.velLinZ, 1, 2, Qt.AlignCenter)
        self.indLayout.addWidget(self.velXLabel, 2, 0, Qt.AlignCenter)
        self.indLayout.addWidget(self.velYLabel, 2, 1, Qt.AlignCenter)
        self.indLayout.addWidget(self.velZLabel, 2, 2, Qt.AlignCenter)

        self.battery=QProgressBar(self)
        self.battery.setValue(0)
        self.battery.resize(56,241)
        self.battery.setOrientation(Qt.Vertical)
        self.battery.setTextVisible(False)

        self.batteryLabel=QLabel('Battery (%)',self)
        self.batteryValueLabel = QLabel('0', self)
        self.batteryValueLabel.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter)

        self.batteryData.addItem(hSpacer, 0, 0, 1, 1, Qt.AlignLeft)
        self.batteryData.addWidget(self.batteryLabel, 0, 1, Qt.AlignCenter)
        self.batteryData.addWidget(self.batteryValueLabel, 0, 2, Qt.AlignCenter)
        self.batteryData.addItem(hSpacer, 0, 4, 1, 1, Qt.AlignLeft)

        self.batteryLayout.addWidget(self.battery, 0,  Qt.AlignHCenter)
        self.batteryLayout.addLayout(self.batteryData)

        self.mainLayout.addLayout(self.indLayout)
        self.mainLayout.addLayout(self.batteryLayout)
        self.setLayout(self.mainLayout);

    def updateSensors(self):
        pose = self.winParent.getPose3D().getPose3d()

        if pose != None:
            qw = pose.q[0]
            qx = pose.q[1]
            qy = pose.q[2]
            qz = pose.q[3]
            self.drawAltd(pose.z)
            self.drawYawValues(self.quatToYaw(qw, qx, qy, qz) * 180 / math.pi)
            self.drawPitchRollValues(self.quatToPitch(qw, qx, qy, qz) * 180 / math.pi,
                                     self.quatToRoll(qw, qx, qy, qz) * 180 / math.pi)
开发者ID:lr-morales,项目名称:JdeRobot,代码行数:69,代码来源:sensorsWidget.py

示例3: Example

# 需要导入模块: from PyQt5.QtWidgets import QProgressBar [as 别名]
# 或者: from PyQt5.QtWidgets.QProgressBar import resize [as 别名]
class Example(QWidget):

    def __init__(self):
        super().__init__()
        self.initUI()

    def initUI(self):
        self.instr = QLabel("Choose an extension and the link to download from", self)
        self.instr.move(20, 15)

        self.ext_label = QLabel("Extension: ", self)
        self.ext_label.move(20, 50)


        self.ext_input = QLineEdit(self)
        self.ext_input.move(115, 45)
        self.ext_input.returnPressed.connect(self.download)

        self.dom_label = QLabel("Link: ", self)
        self.dom_label.move(20, 90)

        self.dom_input = QLineEdit(self)
        self.dom_input.move(115, 85)
        self.dom_input.returnPressed.connect(self.download)

        self.dwl_but = QPushButton("Download", self)
        self.dwl_but.move(280,45)
        self.dwl_but.resize(100, 75)
        self.dwl_but.clicked.connect(self.download)

        self.dwl_bar = QProgressBar(self)
        self.dwl_bar.move(20, 125)
        self.dwl_bar.resize(360, 25)

        self.results = QTextEdit(self)
        self.results.move(20, 150)
        self.results.resize(360, 100)
        self.results.setReadOnly(True)



        self.setGeometry(300, 300, 400, 300)
        self.setFixedSize(400, 300)
        self.setWindowTitle("File Crawler")
        self.show()

    def download(self):
        self.results.setText("")
        file = str(QFileDialog.getExistingDirectory(self, "Onde salvar?"))
        if (file != ""):
            domain = self.dom_input.text()
            extension = self.ext_input.text()
            try:
                web_text = urlopen(domain, timeout=1.5).read().decode('utf-8', 'ignore')
            except ValueError:
                try:
                    domain = "http://"+domain
                    web_text = urlopen(domain, timeout=1.5).read().decode('utf-8', 'ignore')
                except Exception as e:
                    self.results.append(str(e))
                    web_text = None
            except Exception as e:
                self.results.append(str(e))
                web_text = None

            if web_text != None:
                double_b_file_pattern = re.compile("=\"([^(\'|\")]*\."+extension+")")
                simple_b_file_pattern = re.compile("=\'([^(\'|\")]*\."+extension+")")
                matches = double_b_file_pattern.findall(web_text)
                matches.extend(simple_b_file_pattern.findall(web_text))
            else:
                matches = []
            if len(matches) > 0:
                self.dwl_bar.setValue(0)
                self.results.append("Saving to " + file)
                self.results.append("%d files were found." % len(matches))
                for index, item in enumerate(matches, 1):
                    self.dwl_bar.setValue(int(100 * index / len(matches)))
                    try:
                        download(urljoin(domain, item), file + "/" + split(item)[-1])
                    except Exception as e:
                        # Document links may be broken, in this case, nothing to do.
                        self.results.append("Could not download {}, {}".format(split(item)[-1], e))
                self.results.append("Finished downloading.")
            else:
                self.results.append("Could not find any file.")
开发者ID:aaneto,项目名称:fileCrawler,代码行数:88,代码来源:__init__.py


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