我们从Python开源项目中,提取了以下27个代码示例,用于说明如何使用PyQt5.QtWidgets.QProgressBar()。
def __init__(self, parent, f=Qt.WindowCloseButtonHint): super(DirectDownload, self).__init__(parent, f) self.parent = parent self.setWindowTitle('Download Progress') self.setWindowModality(Qt.ApplicationModal) self.setMinimumWidth(485) self.setContentsMargins(20, 20, 20, 20) layout = QVBoxLayout() self.progress_label = QLabel(alignment=Qt.AlignCenter) self.progress = QProgressBar(self.parent) self.progress.setMinimum(0) self.progress.setMaximum(100) layout.addWidget(self.progress_label) layout.addWidget(self.progress) self.setLayout(layout)
def init_ui(self): # Creating a label self.progressLabel = QLabel('Progress Bar:', self) # Creating a progress bar and setting the value limits self.progressBar = QProgressBar(self) self.progressBar.setMaximum(100) self.progressBar.setMinimum(0) # Creating a Horizontal Layout to add all the widgets self.hboxLayout = QHBoxLayout(self) # Adding the widgets self.hboxLayout.addWidget(self.progressLabel) self.hboxLayout.addWidget(self.progressBar) # Setting the hBoxLayout as the main layout self.setLayout(self.hboxLayout) self.setWindowTitle('Dialog with Progressbar') self.show()
def __init__(self, parent=None): super().__init__() self.parent = parent self.setWindowTitle(self.tr("System Installation")) self.setLayout(QVBoxLayout()) self.slide_widget = SlideWidget() self.layout().addWidget(self.slide_widget) self.progress = QProgressBar() self.layout().addWidget(self.progress) self.desc_label = QLabel() self.desc_label.setAlignment(Qt.AlignCenter) self.layout().addWidget(self.desc_label) self.addSlides()
def initUI(self): """ Description: A progress bar, a status message will be shown and a timer() method will be invoked as part of the authentication process. Arguments: None Returns: Nothing """ self.pbar = QProgressBar(self) self.pbar.setGeometry(30, 40, 200, 25) self.status = QLabel(self) self.status.setGeometry(30, 75, 200, 20) self.timer = QBasicTimer() self.step = 0 self.setGeometry(300, 300, 255, 100) self.center() self.setWindowTitle(_('loading')) self.show() self.timer.start(100, self)
def __init__(self): QWidget.__init__(self, flags=Qt.Widget) self.pgsb = QProgressBar() self.pb = QPushButton("Pause") self.th = Thread() self.init_widget() self.th.start()
def setupUi(self, preprocessorRun): preprocessorRun.setObjectName("preprocessorRun") preprocessorRun.resize(414, 87) self.verticalLayout = QtWidgets.QVBoxLayout(preprocessorRun) self.verticalLayout.setObjectName("verticalLayout") self.runPreprocessor = QtWidgets.QPushButton(preprocessorRun) self.runPreprocessor.setObjectName("runPreprocessor") self.verticalLayout.addWidget(self.runPreprocessor) self.progressBar = QtWidgets.QProgressBar(preprocessorRun) self.progressBar.setEnabled(False) self.progressBar.setMaximum(0) self.progressBar.setProperty("value", -1) self.progressBar.setAlignment(QtCore.Qt.AlignCenter) self.progressBar.setInvertedAppearance(False) self.progressBar.setObjectName("progressBar") self.verticalLayout.addWidget(self.progressBar) self.retranslateUi(preprocessorRun) QtCore.QMetaObject.connectSlotsByName(preprocessorRun)
def setupUi(self, FileTransferDialog): FileTransferDialog.setObjectName("FileTransferDialog") FileTransferDialog.resize(400, 120) self.verticalLayout_2 = QtWidgets.QVBoxLayout(FileTransferDialog) self.verticalLayout_2.setObjectName("verticalLayout_2") self.label = QtWidgets.QLabel(FileTransferDialog) self.label.setObjectName("label") self.verticalLayout_2.addWidget(self.label) self.verticalLayout = QtWidgets.QVBoxLayout() self.verticalLayout.setObjectName("verticalLayout") self.progressBar = QtWidgets.QProgressBar(FileTransferDialog) self.progressBar.setProperty("value", 24) self.progressBar.setObjectName("progressBar") self.verticalLayout.addWidget(self.progressBar) self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem) self.cancelButton = QtWidgets.QPushButton(FileTransferDialog) self.cancelButton.setEnabled(False) self.cancelButton.setCheckable(False) self.cancelButton.setObjectName("cancelButton") self.horizontalLayout.addWidget(self.cancelButton) self.verticalLayout.addLayout(self.horizontalLayout) self.verticalLayout_2.addLayout(self.verticalLayout) self.retranslateUi(FileTransferDialog) QtCore.QMetaObject.connectSlotsByName(FileTransferDialog)
def main(): app = QtWidgets.QApplication( ['fred'] ) prog = QtWidgets.QProgressBar() prog.setMinimum( 0 ) prog.setMaximum( total ) prog.setTextVisible( False ) prog.setMinimumHeight( 50 ) prog.show() layout = QtWidgets.QHBoxLayout( prog ) label = QtWidgets.QLabel() layout.addWidget( label ) layout.setContentsMargins( 20, 0, 0, 0 ) def inc(): print( 'inc' ) global count if count == total: timer.stop() else: count += 1 prog.setValue( count ) def setProgresLabel( self ): label.setText( '%3d%%' % (100 * count / total) ) prog.valueChanged.connect( setProgresLabel ) timer = QtCore.QTimer() timer.setInterval( 250 ) timer.timeout.connect( inc ) timer.start() app.exec_()
def __init__(self): super().__init__() self.mySocket = socket.socket() self.params = {} self.responseThread = ResponseThread(self.mySocket) self.isPlaying = False self.setGeometry(300, 200, 280, 300) self.setWindowTitle('Kodi Remote Control') self.setWindowIcon(QIcon(ICON_PATH)) self.img = QLabel('img') self.img.setPixmap(QPixmap(IMG_PATH)) self.status = QLabel('OK') self.pbar = QProgressBar() self.progress = 0 self.timer = QBasicTimer() box = QVBoxLayout() box.addWidget(self.img) box.addWidget(self.status) box.addWidget(self.pbar) self.setLayout(box) self.show() self.setFixedSize(self.size()) self.responseThread.mySignal.connect(self.handleSignals) self.responseThread.start()
def setupUi(self, NLTKDatafiles): NLTKDatafiles.setObjectName("NLTKDatafiles") NLTKDatafiles.resize(640, 480) self.verticalLayout = QtWidgets.QVBoxLayout(NLTKDatafiles) self.verticalLayout.setObjectName("verticalLayout") self.label_2 = QtWidgets.QLabel(NLTKDatafiles) self.label_2.setObjectName("label_2") self.verticalLayout.addWidget(self.label_2) self.textBrowser = QtWidgets.QTextBrowser(NLTKDatafiles) self.textBrowser.setLineWrapMode(QtWidgets.QTextEdit.NoWrap) self.textBrowser.setObjectName("textBrowser") self.verticalLayout.addWidget(self.textBrowser) self.progressBar = QtWidgets.QProgressBar(NLTKDatafiles) self.progressBar.setProperty("value", 24) self.progressBar.setObjectName("progressBar") self.verticalLayout.addWidget(self.progressBar) self.label = QtWidgets.QLabel(NLTKDatafiles) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label.sizePolicy().hasHeightForWidth()) self.label.setSizePolicy(sizePolicy) self.label.setWordWrap(True) self.label.setObjectName("label") self.verticalLayout.addWidget(self.label) self.buttonBox = QtWidgets.QDialogButtonBox(NLTKDatafiles) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.No|QtWidgets.QDialogButtonBox.Open|QtWidgets.QDialogButtonBox.Yes) self.buttonBox.setObjectName("buttonBox") self.verticalLayout.addWidget(self.buttonBox) self.retranslateUi(NLTKDatafiles) self.buttonBox.accepted.connect(NLTKDatafiles.accept) self.buttonBox.rejected.connect(NLTKDatafiles.reject) QtCore.QMetaObject.connectSlotsByName(NLTKDatafiles)
def __init__(self, ebeveyn=None): super(Kurulum, self).__init__(ebeveyn) self.e = ebeveyn kutu = QVBoxLayout() kutu.setContentsMargins(0,0,0,0) self.setLayout(kutu) self.slayt_label = QLabel() self.slayt_label.setFixedSize(950,475) kutu.addWidget(self.slayt_label) self.bilgi_label = QLabel() kutu.addWidget(self.bilgi_label) self.surec_cubugu = QProgressBar() kutu.addWidget(self.surec_cubugu)
def set_progress_bar(self, value=100, progress=None): if progress is None: progress = QtWidgets.QProgressBar() progress.setValue(value) self.statusBar().addWidget(progress) else: progress.setValue(value) return progress
def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(400, 131) MainWindow.setLocale(QtCore.QLocale(QtCore.QLocale.German, QtCore.QLocale.Germany)) self.pb_progress = QtWidgets.QProgressBar(MainWindow) self.pb_progress.setGeometry(QtCore.QRect(10, 60, 381, 23)) self.pb_progress.setProperty("value", 0) self.pb_progress.setAlignment(QtCore.Qt.AlignCenter) self.pb_progress.setOrientation(QtCore.Qt.Horizontal) self.pb_progress.setObjectName("pb_progress") self.b_run = QtWidgets.QPushButton(MainWindow) self.b_run.setEnabled(False) self.b_run.setGeometry(QtCore.QRect(210, 90, 181, 30)) self.b_run.setCheckable(False) self.b_run.setChecked(False) self.b_run.setObjectName("b_run") self.label = QtWidgets.QLabel(MainWindow) self.label.setGeometry(QtCore.QRect(10, 10, 81, 16)) self.label.setObjectName("label") self.label_2 = QtWidgets.QLabel(MainWindow) self.label_2.setGeometry(QtCore.QRect(10, 30, 81, 16)) self.label_2.setObjectName("label_2") self.b_check = QtWidgets.QPushButton(MainWindow) self.b_check.setGeometry(QtCore.QRect(10, 90, 181, 30)) self.b_check.setObjectName("b_check") self.l_newVersion = QtWidgets.QLabel(MainWindow) self.l_newVersion.setGeometry(QtCore.QRect(100, 30, 81, 16)) self.l_newVersion.setText("") self.l_newVersion.setObjectName("l_newVersion") self.l_currentVersion = QtWidgets.QLabel(MainWindow) self.l_currentVersion.setGeometry(QtCore.QRect(100, 10, 81, 16)) self.l_currentVersion.setText("") self.l_currentVersion.setObjectName("l_currentVersion") self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow)
def make_progress_bar(self, parent): horizontalLayout_2 = QtWidgets.QHBoxLayout() horizontalLayout_2.setObjectName("horizontalLayout_2") self.loading_stat = QtWidgets.QLabel(parent) horizontalLayout_2.addWidget(self.loading_stat) self.progressbar_loading = QtWidgets.QProgressBar(parent) horizontalLayout_2.addWidget(self.progressbar_loading) self.stop_button = QtWidgets.QPushButton(parent) self.stop_button.setMaximumSize(QtCore.QSize(50, 30)) self.stop_button.setText("stop") horizontalLayout_2.addWidget(self.stop_button) self.stop_button.clicked.connect(self.stop_button_clicked) return horizontalLayout_2
def init_widget(self): self.setWindowTitle("Hello World") form_lbx = QBoxLayout(QBoxLayout.TopToBottom, parent=self) self.setLayout(form_lbx) pgsb = QProgressBar() vscrb = QScrollBar(orientation=Qt.Horizontal) vscrb.setRange(0, 100) vscrb.valueChanged.connect(pgsb.setValue) form_lbx.addWidget(pgsb) form_lbx.addWidget(vscrb)
def init_widget(self): self.setWindowTitle("QProgressBar with QThread") form_lbx = QBoxLayout(QBoxLayout.TopToBottom, parent=self) self.setLayout(form_lbx) # ??? ?? ?? self.pb.clicked.connect(self.slot_clicked_button) self.th.change_value.connect(self.pgsb.setValue) form_lbx.addWidget(self.pgsb) form_lbx.addWidget(self.pb)
def setupUi(self, Dialog): Dialog.setObjectName("Dialog") Dialog.resize(320, 136) self.btn = QtWidgets.QPushButton(Dialog) self.btn.setGeometry(QtCore.QRect(120, 100, 80, 23)) self.btn.setObjectName("btn") self.pro_bar = QtWidgets.QProgressBar(Dialog) self.pro_bar.setGeometry(QtCore.QRect(60, 20, 221, 23)) self.pro_bar.setProperty("value", 0) self.pro_bar.setObjectName("pro_bar") self.gridLayoutWidget = QtWidgets.QWidget(Dialog) self.gridLayoutWidget.setGeometry(QtCore.QRect(128, 50, 71, 41)) self.gridLayoutWidget.setObjectName("gridLayoutWidget") self.gridLayout = QtWidgets.QGridLayout(self.gridLayoutWidget) self.gridLayout.setContentsMargins(0, 0, 0, 0) self.gridLayout.setObjectName("gridLayout") self.label = QtWidgets.QLabel(self.gridLayoutWidget) self.label.setObjectName("label") self.gridLayout.addWidget(self.label, 0, 0, 1, 1) self.now = QtWidgets.QLabel(self.gridLayoutWidget) self.now.setText("") self.now.setObjectName("now") self.gridLayout.addWidget(self.now, 0, 1, 1, 1) self.all = QtWidgets.QLabel(self.gridLayoutWidget) self.all.setText("") self.all.setObjectName("all") self.gridLayout.addWidget(self.all, 1, 1, 1, 1) self.label_2 = QtWidgets.QLabel(self.gridLayoutWidget) self.label_2.setObjectName("label_2") self.gridLayout.addWidget(self.label_2, 1, 0, 1, 1) self.label_3 = QtWidgets.QLabel(self.gridLayoutWidget) self.label_3.setObjectName("label_3") self.gridLayout.addWidget(self.label_3, 0, 2, 1, 1) self.label_4 = QtWidgets.QLabel(self.gridLayoutWidget) self.label_4.setObjectName("label_4") self.gridLayout.addWidget(self.label_4, 1, 2, 1, 1) self.retranslateUi(Dialog) self.btn.clicked.connect(Dialog.cancel_update) QtCore.QMetaObject.connectSlotsByName(Dialog)
def __init__(self, parent=None, flags=None, message=None): self.message = message if (not flags): flags = Qt.FramelessWindowHint super(ProgressBar, self).__init__(parent=parent, flags=flags) vbox = QVBoxLayout() vbox.addStretch(1) lab = QLabel(message, self) vbox.addWidget(lab) pb = QProgressBar() pb.setRange(0, 0) vbox.addWidget(pb) self.setLayout(vbox)
def __init__(self, parent=None): super().__init__(parent) self.setFinalPage(True) self.wizard = self.parent() self.complete = False extraction_label = QtWidgets.QLabel('Extracting XML data from ecospold files:') self.extraction_progressbar = QtWidgets.QProgressBar() strategy_label = QtWidgets.QLabel('Applying brightway2 strategies:') self.strategy_progressbar = QtWidgets.QProgressBar() db_label = QtWidgets.QLabel('Writing datasets to SQLite database:') self.db_progressbar = QtWidgets.QProgressBar() finalizing_label = QtWidgets.QLabel('Finalizing:') self.finalizing_progressbar = QtWidgets.QProgressBar() self.finished_label = QtWidgets.QLabel('') layout = QtWidgets.QVBoxLayout() self.download_label = QtWidgets.QLabel('Downloading data from ecoinvent homepage:') self.download_label.setVisible(False) self.download_progressbar = QtWidgets.QProgressBar() self.download_progressbar.setMinimum(0) self.download_progressbar.setMaximum(0) self.download_progressbar.setVisible(False) self.unarchive_label = QtWidgets.QLabel('Decompressing the 7z archive:') self.unarchive_progressbar = QtWidgets.QProgressBar() self.unarchive_progressbar.setMinimum(0) self.unarchive_progressbar.setMaximum(0) layout.addWidget(self.download_label) layout.addWidget(self.download_progressbar) layout.addWidget(self.unarchive_label) layout.addWidget(self.unarchive_progressbar) layout.addWidget(extraction_label) layout.addWidget(self.extraction_progressbar) layout.addWidget(strategy_label) layout.addWidget(self.strategy_progressbar) layout.addWidget(db_label) layout.addWidget(self.db_progressbar) layout.addWidget(finalizing_label) layout.addWidget(self.finalizing_progressbar) layout.addStretch(1) layout.addWidget(self.finished_label) layout.addStretch(1) self.setLayout(layout) # progress signals import_signals.extraction_progress.connect(self.update_extraction_progress) import_signals.strategy_progress.connect(self.update_strategy_progress) import_signals.db_progress.connect(self.update_db_progress) import_signals.finalizing.connect(self.update_finalizing) import_signals.finished.connect(self.update_finished) import_signals.unarchive_finished.connect(self.update_unarchive) import_signals.download_complete.connect(self.update_download)
def console_ui(self, audio): self.clear_layout(self.rbox) self.clear_layout(self.hbox) self.hbox.addStretch() self.l1.setText("Installing requirements") self.process = QProcess() self.output = QTextEdit() self.percent = 0 self.rbox.insertSpacing(1, 10) l2 = QLabel('Press Next when the last line says "Successfully Installed--"') self.rbox.addWidget(l2, 0, Qt.AlignTop) # this can be uncommented whenever I actually figure out Progress Bars # self.pbar = QtWidgets.QProgressBar() # self.pbar.setGeometry(30, 40, 200, 25) # self.rbox.addWidget(self.pbar) b5 = QPushButton("Dialog", self) b5.setMaximumWidth(75) self.rbox.addWidget(b5) self.rbox.addWidget(self.output) self.process.readyRead.connect(self.console_data) self.output.hide() # data flow remove_reqs_readonly() interpreter = sys.executable if interpreter is None: QMessageBox.warning(self, "404", "Python interpreter not found.") self.close() txt = REQS_TXT if audio else REQS_NO_AUDIO_TXT args = ["-m", "pip", "install", "--upgrade", "--target", REQS_DIR, "-r", txt] if IS_MAC: # --target is a problem on Homebrew. See PR #552 args.remove("--target") args.remove(REQS_DIR) # do call self.process.start(interpreter, args) # buttons self.buttons_panel() # binds self.b1.setEnabled(True) # self.b2.setEnabled(False) self.b1.clicked.connect(self.req_ui) self.b1.clicked.connect(self.process.close) self.b2.clicked.connect(self.token_ui) self.b3.clicked.connect(self.close_prompt) b5.clicked.connect(self.console_hide)
def setupUi(self, Progress): Progress.setObjectName("Progress") Progress.resize(500, 317) Progress.setMinimumSize(QtCore.QSize(500, 317)) Progress.setMaximumSize(QtCore.QSize(500, 317)) self.gridLayout = QtWidgets.QGridLayout(Progress) self.gridLayout.setObjectName("gridLayout") self.verticalLayout = QtWidgets.QVBoxLayout() self.verticalLayout.setSpacing(30) self.verticalLayout.setObjectName("verticalLayout") self.verticalLayout_2 = QtWidgets.QVBoxLayout() self.verticalLayout_2.setObjectName("verticalLayout_2") self.label = QtWidgets.QLabel(Progress) font = QtGui.QFont() font.setPointSize(15) self.label.setFont(font) self.label.setObjectName("label") self.verticalLayout_2.addWidget(self.label) self.progress_now = QtWidgets.QProgressBar(Progress) self.progress_now.setMinimumSize(QtCore.QSize(0, 30)) self.progress_now.setProperty("value", 0) self.progress_now.setObjectName("progress_now") self.verticalLayout_2.addWidget(self.progress_now) self.verticalLayout.addLayout(self.verticalLayout_2) self.verticalLayout_3 = QtWidgets.QVBoxLayout() self.verticalLayout_3.setObjectName("verticalLayout_3") self.label_2 = QtWidgets.QLabel(Progress) font = QtGui.QFont() font.setPointSize(15) self.label_2.setFont(font) self.label_2.setObjectName("label_2") self.verticalLayout_3.addWidget(self.label_2) self.progress_all = QtWidgets.QProgressBar(Progress) self.progress_all.setMinimumSize(QtCore.QSize(0, 30)) self.progress_all.setProperty("value", 0) self.progress_all.setObjectName("progress_all") self.verticalLayout_3.addWidget(self.progress_all) self.verticalLayout.addLayout(self.verticalLayout_3) self.pushButton = QtWidgets.QPushButton(Progress) self.pushButton.setMinimumSize(QtCore.QSize(0, 50)) font = QtGui.QFont() font.setPointSize(15) self.pushButton.setFont(font) self.pushButton.setObjectName("pushButton") self.verticalLayout.addWidget(self.pushButton) self.gridLayout.addLayout(self.verticalLayout, 0, 0, 1, 1) self.retranslateUi(Progress) self.pushButton.clicked.connect(Progress.cancel) QtCore.QMetaObject.connectSlotsByName(Progress)
def setupUi(self, UniqueViewer): UniqueViewer.setObjectName("UniqueViewer") UniqueViewer.resize(407, 544) self.verticalLayout = QtWidgets.QVBoxLayout(UniqueViewer) self.verticalLayout.setContentsMargins(0, 0, 0, 0) self.verticalLayout.setObjectName("verticalLayout") self.verticalLayout_2 = QtWidgets.QVBoxLayout() self.verticalLayout_2.setSpacing(0) self.verticalLayout_2.setObjectName("verticalLayout_2") self.verticalLayout_3 = QtWidgets.QVBoxLayout() self.verticalLayout_3.setContentsMargins(4, -1, 4, -1) self.verticalLayout_3.setSpacing(1) self.verticalLayout_3.setObjectName("verticalLayout_3") self.label_inform = QtWidgets.QLabel(UniqueViewer) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_inform.sizePolicy().hasHeightForWidth()) self.label_inform.setSizePolicy(sizePolicy) self.label_inform.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) self.label_inform.setObjectName("label_inform") self.verticalLayout_3.addWidget(self.label_inform) self.progress_bar = QtWidgets.QProgressBar(UniqueViewer) self.progress_bar.setMaximum(0) self.progress_bar.setProperty("value", 0) self.progress_bar.setObjectName("progress_bar") self.verticalLayout_3.addWidget(self.progress_bar) self.verticalLayout_2.addLayout(self.verticalLayout_3) self.tableWidget = QtWidgets.QTableWidget(UniqueViewer) self.tableWidget.setAlternatingRowColors(True) self.tableWidget.setShowGrid(False) self.tableWidget.setCornerButtonEnabled(False) self.tableWidget.setObjectName("tableWidget") self.tableWidget.setColumnCount(0) self.tableWidget.setRowCount(0) self.tableWidget.horizontalHeader().setSortIndicatorShown(True) self.tableWidget.horizontalHeader().setStretchLastSection(True) self.verticalLayout_2.addWidget(self.tableWidget) spacerItem = QtWidgets.QSpacerItem(20, 0, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) self.verticalLayout_2.addItem(spacerItem) self.verticalLayout_2.setStretch(1, 1) self.verticalLayout.addLayout(self.verticalLayout_2) self.buttonBox = QtWidgets.QDialogButtonBox(UniqueViewer) self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Save) self.buttonBox.setObjectName("buttonBox") self.verticalLayout.addWidget(self.buttonBox) self.retranslateUi(UniqueViewer) QtCore.QMetaObject.connectSlotsByName(UniqueViewer)
def setupUi(self, Dialog): Dialog.setObjectName("Dialog") Dialog.resize(393, 217) Dialog.setMaximumSize(QtCore.QSize(393, 217)) Dialog.setStyleSheet("") self.frame = QtWidgets.QFrame(Dialog) self.frame.setGeometry(QtCore.QRect(0, 0, 393, 217)) self.frame.setMaximumSize(QtCore.QSize(393, 217)) self.frame.setStyleSheet( "QWidget#frame_2{background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0.0135747, y2:0, stop:0 rgba(255, 255, 255, 255), stop:1 rgba(255, 255, 255, 255));\n" "}\n" "QWidget#frame{\n" " background-color: qlineargradient(spread:pad, x1:1, y1:0, x2:1, y2:0, stop:0 rgba(253, 165, 82, 254), stop:1 rgba(255, 255, 255, 255));\n" "}\n" "QPushButton {\n" " background: #3D4C53;\n" " overflow: hidden;\n" " text-align : center;\n" " border-radius: 10px;\n" " box-shadow: 0px 1px 2px rgba(0,0,0,.2);\n" "color:white;\n" "}") self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel) self.frame.setFrameShadow(QtWidgets.QFrame.Raised) self.frame.setObjectName("frame") self.label = QtWidgets.QLabel(self.frame) self.label.setGeometry(QtCore.QRect(10, 20, 361, 31)) self.label.setObjectName("label") self.frame_2 = QtWidgets.QFrame(self.frame) self.frame_2.setGeometry(QtCore.QRect(20, 70, 351, 71)) self.frame_2.setFrameShape(QtWidgets.QFrame.StyledPanel) self.frame_2.setFrameShadow(QtWidgets.QFrame.Raised) self.frame_2.setObjectName("frame_2") self.verticalLayoutWidget = QtWidgets.QWidget(self.frame_2) self.verticalLayoutWidget.setGeometry(QtCore.QRect(30, 0, 291, 71)) self.verticalLayoutWidget.setObjectName("verticalLayoutWidget") self.verticalLayout = QtWidgets.QVBoxLayout(self.verticalLayoutWidget) self.verticalLayout.setObjectName("verticalLayout") self.progressBar = QtWidgets.QProgressBar(self.verticalLayoutWidget) self.progressBar.setProperty("value", 24) self.progressBar.setObjectName("progressBar") self.verticalLayout.addWidget(self.progressBar) self.horizontalLayoutWidget = QtWidgets.QWidget(self.frame) self.horizontalLayoutWidget.setGeometry(QtCore.QRect(140, 150, 230, 51)) self.horizontalLayoutWidget.setObjectName("horizontalLayoutWidget") self.horizontalLayout = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget) self.horizontalLayout.setObjectName("horizontalLayout") self.pushButton_2 = QtWidgets.QPushButton(self.horizontalLayoutWidget) self.pushButton_2.setMinimumSize(QtCore.QSize(105, 30)) self.pushButton_2.setObjectName("pushButton_2") self.horizontalLayout.addWidget(self.pushButton_2) self.pushButton = QtWidgets.QPushButton(self.horizontalLayoutWidget) self.pushButton.setMinimumSize(QtCore.QSize(105, 30)) self.pushButton.setObjectName("pushButton") self.horizontalLayout.addWidget(self.pushButton) self.retranslateUi(Dialog) QtCore.QMetaObject.connectSlotsByName(Dialog)
def setupUi(self, Dialog): Dialog.setObjectName("Dialog") Dialog.resize(393, 217) Dialog.setMaximumSize(QtCore.QSize(393, 217)) Dialog.setStyleSheet("") self.frame = QtWidgets.QFrame(Dialog) self.frame.setGeometry(QtCore.QRect(0, 0, 393, 217)) self.frame.setMaximumSize(QtCore.QSize(393, 217)) self.frame.setStyleSheet( "QWidget#frame_2{background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0.0135747, y2:0, stop:0 rgba(255, 255, 255, 255), stop:1 rgba(255, 255, 255, 255));\n" "}\n" "QWidget#frame{\n" " background-color: qlineargradient(spread:pad, x1:1, y1:0, x2:1, y2:0, stop:0 rgba(253, 165, 82, 254), stop:1 rgba(255, 255, 255, 255));\n" "}\n" "QPushButton {\n" " background: #3D4C53;\n" " text-align : center;\n" " border-radius: 10px;\n" "color:white;\n" "}") self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel) self.frame.setFrameShadow(QtWidgets.QFrame.Raised) self.frame.setObjectName("frame") self.label = QtWidgets.QLabel(self.frame) self.label.setGeometry(QtCore.QRect(10, 20, 361, 31)) self.label.setObjectName("label") self.frame_2 = QtWidgets.QFrame(self.frame) self.frame_2.setGeometry(QtCore.QRect(20, 70, 351, 71)) self.frame_2.setFrameShape(QtWidgets.QFrame.StyledPanel) self.frame_2.setFrameShadow(QtWidgets.QFrame.Raised) self.frame_2.setObjectName("frame_2") self.verticalLayoutWidget = QtWidgets.QWidget(self.frame_2) self.verticalLayoutWidget.setGeometry(QtCore.QRect(30, 0, 291, 71)) self.verticalLayoutWidget.setObjectName("verticalLayoutWidget") self.verticalLayout = QtWidgets.QVBoxLayout(self.verticalLayoutWidget) self.verticalLayout.setObjectName("verticalLayout") self.progressBar = QtWidgets.QProgressBar(self.verticalLayoutWidget) self.progressBar.setProperty("value", 24) self.progressBar.setObjectName("progressBar") self.verticalLayout.addWidget(self.progressBar) self.pushButton = QtWidgets.QPushButton(self.frame) self.pushButton.setGeometry(QtCore.QRect(270, 160, 99, 27)) self.pushButton.setObjectName("pushButton") self.retranslateUi(Dialog) QtCore.QMetaObject.connectSlotsByName(Dialog)
def __init__(self, *args): super().__init__(*args) self.ui = Ui_MainWindow() self.ui.setupUi(self) # Set up progress bar with cancel button self.progressbar = QtWidgets.QProgressBar() self.statusBar().showMessage("Ready") self.statusBar().addPermanentWidget(self.progressbar) self.progressbar.setGeometry(30, 40, 200, 20) self.progressbar.setValue(0) self.progressbar.hide() self.cancelBtn = QtWidgets.QPushButton("Cancel") self.cancelBtn.clicked.connect(self.cancel_pressed) self.statusBar().addPermanentWidget(self.cancelBtn) self.cancelBtn.hide() self.cancelling = False # Set up connections for IDW self.stations = {} self.files = [] self.ui.browseBtn.clicked.connect(self.idw_set_input_folder) self.ui.outBrowseBtn.clicked.connect(self.idw_set_output_folder) self.ui.resetBtn.clicked.connect(self.idw_reset_input) self.ui.runBtn.clicked.connect(self.idw_run) # Set up Connections for CFM self.ui.observedFileBrowse.clicked.connect(self.cfm_get_obs_file) self.ui.historicalFileBrowse.clicked.connect(self.cfm_get_his_file) self.ui.futureFileBrowse.clicked.connect(self.cfm_get_fut_file) self.ui.runButton.clicked.connect(self.cfm_run) self.ui.outBrowse.clicked.connect(self.cfm_get_out_path) self.ui.cfmResetBtn.clicked.connect(self.cfm_reset_input) # Set up Connections for KNN self.ui.knnBrowse.clicked.connect(self.knn_get_input_file) self.ui.knnAddFile.clicked.connect(self.knn_add_file) self.ui.knnRemoveFile.clicked.connect(self.knn_remove_file) self.ui.knnOutputBrowse.clicked.connect(self.knn_set_output_folder) self.ui.knnRun.clicked.connect(self.knn_run) self.ui.knnResetInput.clicked.connect(self.knn_reset_input) tableHHeader = self.ui.knnTableWidget.horizontalHeader() tableHHeader.setSectionResizeMode(1, QtWidgets.QHeaderView.Stretch) tableHHeader.setVisible(True)
def setupUi(self, Downloader): Downloader.setObjectName("Downloader") Downloader.resize(829, 480) Downloader.setStyleSheet("background-color:#301010;") self.centralwidget = QtWidgets.QWidget(Downloader) self.centralwidget.setObjectName("centralwidget") self.gridLayout_2 = QtWidgets.QGridLayout(self.centralwidget) self.gridLayout_2.setObjectName("gridLayout_2") self.verticalLayout = QtWidgets.QVBoxLayout() self.verticalLayout.setObjectName("verticalLayout") self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.tableWidget = QtWidgets.QTableWidget(self.centralwidget) self.tableWidget.setStyleSheet("background-color:#481616; color:grey") self.tableWidget.setObjectName("tableWidget") self.tableWidget.setColumnCount(6) self.tableWidget.setRowCount(0) item = QtWidgets.QTableWidgetItem() self.tableWidget.setHorizontalHeaderItem(0, item) item = QtWidgets.QTableWidgetItem() self.tableWidget.setHorizontalHeaderItem(1, item) item = QtWidgets.QTableWidgetItem() self.tableWidget.setHorizontalHeaderItem(2, item) item = QtWidgets.QTableWidgetItem() self.tableWidget.setHorizontalHeaderItem(3, item) item = QtWidgets.QTableWidgetItem() self.tableWidget.setHorizontalHeaderItem(4, item) item = QtWidgets.QTableWidgetItem() self.tableWidget.setHorizontalHeaderItem(5, item) self.horizontalLayout.addWidget(self.tableWidget) self.verticalLayout.addLayout(self.horizontalLayout) self.pbar = QtWidgets.QProgressBar(self.centralwidget) self.pbar.setProperty("value", 0) self.pbar.setObjectName("pbar") self.verticalLayout.addWidget(self.pbar) self.gridLayout_2.addLayout(self.verticalLayout, 0, 0, 1, 1) Downloader.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(Downloader) self.menubar.setGeometry(QtCore.QRect(0, 0, 829, 22)) self.menubar.setObjectName("menubar") Downloader.setMenuBar(self.menubar) self.statusbar = QtWidgets.QStatusBar(Downloader) self.statusbar.setObjectName("statusbar") Downloader.setStatusBar(self.statusbar) self.retranslateUi(Downloader) QtCore.QMetaObject.connectSlotsByName(Downloader)
def __init__(self, taskName): """Constructor for QProgressTaskDialog Arguments: string taskName -- Title of the window and label before progress bar Example: W = QProgressTaskDialog("Clearing Forest") for i in range(100): if not W.isCancelled(): W.setProgress(i + 1) else: W.close() """ super().__init__() self.setGeometry(800, 400, 600, 70) self.setWindowTitle(taskName) self.__taskLabel = QtWidgets.QLabel(self) self.__taskLabel.setText(taskName) self.__subTaskLabel = QtWidgets.QLabel(self) self.__subTaskLabel.setText("Working...") self.__progressBar = QtWidgets.QProgressBar(self) self.__cancelButton = QtWidgets.QPushButton(self) self.__cancelButton.clicked.connect(self.__cancelTask) self.__cancelButton.setText("Cancel") __hLayout = QtWidgets.QHBoxLayout() __hLayout.addWidget(self.__taskLabel) __hLayout.addWidget(self.__progressBar) __hLayout.addWidget(self.__cancelButton) __vLayout = QtWidgets.QVBoxLayout(self) __vLayout.addLayout(__hLayout) __vLayout.addWidget(self.__subTaskLabel) __vLayout.addStretch() self.setLayout(__vLayout) self.__cancelled = False self.__progress = 0 self.__maxProgress = 100