本文整理汇总了Python中PyQt5.QtWidgets.QProgressBar.hide方法的典型用法代码示例。如果您正苦于以下问题:Python QProgressBar.hide方法的具体用法?Python QProgressBar.hide怎么用?Python QProgressBar.hide使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QProgressBar
的用法示例。
在下文中一共展示了QProgressBar.hide方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ErgebnissVorlage
# 需要导入模块: from PyQt5.QtWidgets import QProgressBar [as 别名]
# 或者: from PyQt5.QtWidgets.QProgressBar import hide [as 别名]
class ErgebnissVorlage(QWidget):
def __init__(self, parent=None):
super(ErgebnissVorlage, self).__init__(parent)
self.auswahlAlter = QComboBox()
self.auswahlAlter.addItem("Bitte auswählen")
for i in range(3, 18):
self.auswahlAlter.addItem("{} Jahre / Jahrgang {}".format(i, date.today().year - i))
self.auswahlGeschlecht = QComboBox()
self.auswahlGeschlecht.addItem("Bitte auswählen")
self.auswahlGeschlecht.addItem("Männlich")
self.auswahlGeschlecht.addItem("Weiblich")
self.printerProgress = QProgressBar()
self.printerProgress.hide()
self.mainLayout = QFormLayout()
self.mainLayout.addRow(QLabel("Alter:"),self.auswahlAlter)
self.mainLayout.addRow(QLabel("Geschlecht:"),self.auswahlGeschlecht)
self.mainLayout.addRow(self.printerProgress)
self._drucken = QPushButton("Drucken")
self._drucken.clicked.connect(self.drucken)
self.mainLayout.addRow(self._drucken)
self.setLayout(self.mainLayout)
def queryUsers(self,Alter:int, Geschlecht:bool)->list:
return QueryTool().fetchAllByWhere("LG_NGD",WieAlt=Alter,Geschlecht=Geschlecht)
def drucken(self):
self.printerProgress.show()
if (self.auswahlAlter.currentIndex() is 0) and (self.auswahlGeschlecht.currentIndex() is 0):
Alter = range(3,18)
Geschlecht = range(0,2)
else:
Alter = self.auswahlAlter.currentIndex()+2
Alter = range(Alter,Alter+1)
Geschlecht = self.auswahlGeschlecht.currentIndex()-1
Geschlecht = range(Geschlecht,Geschlecht+1)
self.printerProgress.setMaximum(len(Alter)*len(Geschlecht)*10)
self.printerProgress.setValue(0)
prog = 0
for a in Alter:
for g in Geschlecht:
for d in range(10):
ErgebnissVorlagenDrucker(a,g,d)
self.printerProgress.setValue(prog)
prog +=1
self.printerProgress.hide()
示例2: CpSplashScreen
# 需要导入模块: from PyQt5.QtWidgets import QProgressBar [as 别名]
# 或者: from PyQt5.QtWidgets.QProgressBar import hide [as 别名]
class CpSplashScreen(QSplashScreen):
def __init__(self, parent = None, pixmap = None, maxSteps = 1):
super().__init__(parent, pixmap)
self.maxSteps = maxSteps
self.progress = QProgressBar(self)
#self.progress.setGeometry(15, 15, 100, 10)
self.progress.setTextVisible(False)
self.progress.setMinimum(0)
self.progress.setMaximum(self.maxSteps)
self.progress.setValue(0)
self.progress.hide()
def show(self):
super().show()
geo = self.geometry()
self.progress.setGeometry(5, geo.height() - 20, 100, 10)
self.progress.show()
def showMessage(self, msg, step = None, color = None):
if step is not None:
self.progress.setValue(step)
self.progress.update()
super().showMessage(msg, color=color)
示例3: CueWidget
# 需要导入模块: from PyQt5.QtWidgets import QProgressBar [as 别名]
# 或者: from PyQt5.QtWidgets.QProgressBar import hide [as 别名]
#.........这里部分代码省略.........
def set_countdown_mode(self, mode):
self._countdown_mode = mode
self._update_time(self.cue.current_time())
def set_accurate_timing(self, enable):
self._accurate_timing = enable
if self.cue.state == CueState.Pause:
self._update_time(self.cue.current_time(), True)
elif self.cue.state != CueState.Running:
self._update_duration(self.cue.duration)
def show_seek_slider(self, visible):
self.seekSlider.setVisible(visible)
self.update()
def show_dbmeters(self, visible):
if isinstance(self.cue, MediaCue):
self._show_dbmeter = visible
if self._dbmeter_element is not None:
self._dbmeter_element.level_ready.disconnect(self.dbMeter.plot)
self._dbmeter_element = None
if visible:
self._dbmeter_element = self.cue.media.element('DbMeter')
if self._dbmeter_element is not None:
self._dbmeter_element.level_ready.connect(self.dbMeter.plot)
self.layout().addWidget(self.dbMeter, 0, 1)
self.layout().setColumnStretch(1, 1)
self.dbMeter.show()
else:
self.dbMeter.hide()
self.layout().setColumnStretch(1, 0)
self.update()
def _set_cue(self, cue):
self.cue = cue
self.cue.changed('name').connect(self._update_name, Connection.QtQueued)
self.cue.changed('stylesheet').connect(self._update_style, Connection.QtQueued)
self.cue.changed('duration').connect(self._update_duration, Connection.QtQueued)
self.cue.changed('description').connect(self._update_description, Connection.QtQueued)
if isinstance(cue, MediaCue):
self.cue.media.changed('pipe').connect(self._media_updated)
self.cue.paused.connect(self.dbMeter.reset, Connection.QtQueued)
self.cue.stopped.connect(self.dbMeter.reset, Connection.QtQueued)
self.cue.end.connect(self.dbMeter.reset, Connection.QtQueued)
self.cue.error.connect(self.dbMeter.reset, Connection.QtQueued)
self.seekSlider.sliderMoved.connect(self.cue.media.seek)
self.seekSlider.sliderJumped.connect(self.cue.media.seek)
# Cue status changed
self.cue.started.connect(self._status_playing, Connection.QtQueued)
self.cue.stopped.connect(self._status_stopped, Connection.QtQueued)
self.cue.paused.connect(self._status_paused, Connection.QtQueued)
self.cue.error.connect(self._status_error, Connection.QtQueued)
self.cue.end.connect(self._status_stopped, Connection.QtQueued)
self._cue_time = CueTime(self.cue)
self._cue_time.notify.connect(self._update_time)
示例4: LabelAssistDialog
# 需要导入模块: from PyQt5.QtWidgets import QProgressBar [as 别名]
# 或者: from PyQt5.QtWidgets.QProgressBar import hide [as 别名]
class LabelAssistDialog(QDialog):
"""
A simple UI for showing bookmarks and navigating to them.
FIXME: For now, this window is tied to a particular lane.
If your project has more than one lane, then each one
will have it's own bookmark window, which is kinda dumb.
"""
def __init__(self, parent, topLevelOperatorView):
super(LabelAssistDialog, self).__init__(parent)
# Create thread router to populate table on main thread
self.threadRouter = ThreadRouter(self)
# Set object classification operator view
self.topLevelOperatorView = topLevelOperatorView
self.setWindowTitle("Label Assist")
self.setMinimumWidth(500)
self.setMinimumHeight(700)
layout = QGridLayout()
layout.setContentsMargins(10, 10, 10, 10)
# Show variable importance table
rows = 0
columns = 4
self.table = QTableWidget(rows, columns)
self.table.setHorizontalHeaderLabels(['Frame', 'Max Area', 'Min Area', 'Labels'])
self.table.verticalHeader().setVisible(False)
# Select full row on-click and call capture double click
self.table.setSelectionBehavior(QTableView.SelectRows);
self.table.doubleClicked.connect(self._captureDoubleClick)
layout.addWidget(self.table, 1, 0, 3, 2)
# Create progress bar
self.progressBar = QProgressBar()
self.progressBar.setMinimum(0)
self.progressBar.setMaximum(0)
self.progressBar.hide()
layout.addWidget(self.progressBar, 4, 0, 1, 2)
# Create button to populate table
self.computeButton = QPushButton('Compute object info')
self.computeButton.clicked.connect(self._triggerTableUpdate)
layout.addWidget(self.computeButton, 5, 0)
# Create close button
closeButton = QPushButton('Close')
closeButton.clicked.connect(self.close)
layout.addWidget(closeButton, 5, 1)
# Set dialog layout
self.setLayout(layout)
def _triggerTableUpdate(self):
# Check that object area is included in selected features
featureNames = self.topLevelOperatorView.SelectedFeatures.value
if 'Standard Object Features' not in featureNames or 'Count' not in featureNames['Standard Object Features']:
box = QMessageBox(QMessageBox.Warning,
'Warning',
'Object area is not a selected feature. Please select this feature on: \"Standard Object Features > Shape > Size in pixels\"',
QMessageBox.NoButton,
self)
box.show()
return
# Clear table
self.table.clearContents()
self.table.setRowCount(0)
self.table.setSortingEnabled(False)
self.progressBar.show()
self.computeButton.setEnabled(False)
def compute_features_for_frame(tIndex, t, features):
# Compute features and labels (called in parallel from request pool)
roi = [slice(None) for i in range(len(self.topLevelOperatorView.LabelImages.meta.shape))]
roi[tIndex] = slice(t, t+1)
roi = tuple(roi)
frame = self.topLevelOperatorView.SegmentationImages(roi).wait()
frame = frame.squeeze().astype(numpy.uint32, copy=False)
# Dirty trick: We don't care what we're passing here for the 'image' parameter,
# but vigra insists that we pass *something*, so we'll cast the label image as float32.
features[t] = vigra.analysis.extractRegionFeatures(frame.view(numpy.float32),
frame,
['Count'],
ignoreLabel=0)
tIndex = self.topLevelOperatorView.SegmentationImages.meta.axistags.index('t')
tMax = self.topLevelOperatorView.SegmentationImages.meta.shape[tIndex]
features = {}
labels = {}
#.........这里部分代码省略.........
示例5: XNCStatusBar
# 需要导入模块: from PyQt5.QtWidgets import QProgressBar [as 别名]
# 或者: from PyQt5.QtWidgets.QProgressBar import hide [as 别名]
class XNCStatusBar(QStatusBar):
def __init__(self, parent=None):
super(XNCStatusBar, self).__init__(parent)
# state vars
self.world = XNovaWorld_instance()
# initialization
self.setSizeGripEnabled(True)
# sub-widgets
# progressbar
self._progressbar = QProgressBar(self)
self._progressbar.hide()
self._progressbar.setValue(0)
self._progressbar.setRange(0, 99)
# online players counter
self._lbl_online = QLabel(self.tr('Online') + ': 0', self)
# label with loading.gif
self._loading_gif = QMovie(':/i/loading.gif')
self._lbl_loading = QLabel(self)
self._lbl_loading.setMovie(self._loading_gif)
self._lbl_loading.hide()
# testing only
self._btn_runscript = QPushButton('Run script', self)
self._btn_runscript.clicked.connect(self.on_run_script)
self.addPermanentWidget(self._btn_runscript)
#
self.addPermanentWidget(self._lbl_loading)
self.addPermanentWidget(self._lbl_online) # should be las right widget
self.show()
def set_status(self, msg: str, timeout: int=0):
self.showMessage(msg, timeout)
def set_loading_status(self, loading: bool):
if loading:
self._lbl_loading.show()
self._loading_gif.start()
else:
self._loading_gif.stop()
self._lbl_loading.hide()
def set_world_load_progress(self, comment: str, progress: int):
"""
Display world load progress in status bar
:param comment: string comment of what is currently loading
:param progress: percent progress, or -1 to disable
"""
if progress != -1:
if not self._progressbar.isVisible():
self.insertPermanentWidget(0, self._progressbar)
self._progressbar.show()
msg = self.tr('Loading world') + ' ({0}%) {1}...'.format(progress, comment)
logger.debug(msg)
self._progressbar.setValue(progress)
self.set_status(msg)
else:
self.removeWidget(self._progressbar)
self._progressbar.hide()
self._progressbar.reset()
self.clearMessage()
def update_online_players_count(self):
op = self.world.get_online_players()
self._lbl_online.setText(self.tr('Online') + ': {0}'.format(op))
# some functions may be useful, documentation:
# void QStatusBar::clearMessage()
# void QStatusBar::addPermanentWidget(QWidget * widget, int stretch = 0)
# void QStatusBar::addWidget(QWidget * widget, int stretch = 0)
# void QStatusBar::removeWidget(QWidget * widget)
@pyqtSlot()
def on_run_script(self):
files = os.listdir('scripts')
files.sort()
script_files = [fn for fn in files if fn[0] != '.' and fn.endswith('.py')]
# print(script_files)
menu = QMenu(self)
for script_filename in script_files:
act = QAction(menu)
act.setText('Run "scripts/' + script_filename + '"...')
act.setData('scripts/' + script_filename)
menu.addAction(act)
act_ret = menu.exec(QCursor.pos())
if act_ret is None:
return
script_filename = str(act_ret.data())
s = ''
try:
with open(script_filename, 'rt', encoding='utf-8') as f:
s = f.read()
except IOError:
pass
if s != '':
exec(s)
示例6: MainWindow
# 需要导入模块: from PyQt5.QtWidgets import QProgressBar [as 别名]
# 或者: from PyQt5.QtWidgets.QProgressBar import hide [as 别名]
class MainWindow(QMainWindow, Ui_MainWindow):
'''
classdocs
'''
def __init__(self, app):
"""
Init
:param cutecoin.core.app.Application app: application
:type: cutecoin.core.app.Application
"""
# Set up the user interface from Designer.
super().__init__()
self.setupUi(self)
QApplication.setWindowIcon(QIcon(":/icons/cutecoin_logo"))
self.app = app
logging.debug(app.thread())
logging.debug(self.thread())
self.password_asker = None
self.initialized = False
self.busybar = QProgressBar(self.statusbar)
self.busybar.setMinimum(0)
self.busybar.setMaximum(0)
self.busybar.setValue(-1)
self.statusbar.addWidget(self.busybar)
self.busybar.hide()
self.app.version_requested.connect(self.latest_version_requested)
self.app.get_last_version()
self.combo_referential = QComboBox(self)
self.combo_referential.setEnabled(False)
self.combo_referential.currentIndexChanged.connect(self.referential_changed)
self.status_label = QLabel("", self)
self.status_label.setTextFormat(Qt.RichText)
self.label_time = QLabel("", self)
self.statusbar.addPermanentWidget(self.status_label, 1)
self.statusbar.addPermanentWidget(self.label_time)
self.statusbar.addPermanentWidget(self.combo_referential)
self.update_time()
self.loader = Loader(self.app)
self.loader.loaded.connect(self.loader_finished)
self.loader.connection_error.connect(self.display_error)
self.homescreen = HomeScreenWidget(self.app)
self.centralWidget().layout().addWidget(self.homescreen)
self.homescreen.button_new.clicked.connect(self.open_add_account_dialog)
self.homescreen.button_import.clicked.connect(self.import_account)
self.open_ucoin_info = lambda: QDesktopServices.openUrl(QUrl("http://ucoin.io/theoretical/"))
self.homescreen.button_info.clicked.connect(self.open_ucoin_info)
self.import_dialog = None
self.export_dialog = None
# TODO: There are too much refresh() calls on startup
self.refresh()
def open_add_account_dialog(self):
dialog = ProcessConfigureAccount(self.app, None)
result = dialog.exec_()
if result == QDialog.Accepted:
self.action_change_account(self.app.current_account.name)
@pyqtSlot(str)
def display_error(self, error):
QMessageBox.critical(self, ":(",
error,
QMessageBox.Ok)
@pyqtSlot(str)
def referential_changed(self, index):
if self.app.current_account:
self.app.current_account.set_display_referential(index)
if self.currencies_tabwidget.currentWidget():
self.currencies_tabwidget.currentWidget().referential_changed()
@pyqtSlot()
def update_time(self):
date = QDate.currentDate()
self.label_time.setText("{0}".format(date.toString("dd/MM/yyyy")))
next_day = date.addDays(1)
current_time = QDateTime().currentDateTime().toMSecsSinceEpoch()
next_time = QDateTime(next_day).toMSecsSinceEpoch()
timer = QTimer()
timer.timeout.connect(self.update_time)
timer.start(next_time - current_time)
@pyqtSlot()
def delete_contact(self):
contact = self.sender().data()
self.app.current_account.contacts.remove(contact)
self.refresh_contacts()
@pyqtSlot()
def edit_contact(self):
index = self.sender().data()
#.........这里部分代码省略.........
示例7: UpdateCheck
# 需要导入模块: from PyQt5.QtWidgets import QProgressBar [as 别名]
# 或者: from PyQt5.QtWidgets.QProgressBar import hide [as 别名]
class UpdateCheck(QWidget, PrintError):
url = "https://electrum-ltc.org/version"
download_url = "https://electrum-ltc.org/#download"
VERSION_ANNOUNCEMENT_SIGNING_KEYS = (
"LWZzbv5SbiRRjBDL6dUYRdBX9Dp89RDZgG",
)
def __init__(self, main_window, latest_version=None):
self.main_window = main_window
QWidget.__init__(self)
self.setWindowTitle('Electrum-LTC - ' + _('Update Check'))
self.content = QVBoxLayout()
self.content.setContentsMargins(*[10]*4)
self.heading_label = QLabel()
self.content.addWidget(self.heading_label)
self.detail_label = QLabel()
self.detail_label.setTextInteractionFlags(Qt.LinksAccessibleByMouse)
self.detail_label.setOpenExternalLinks(True)
self.content.addWidget(self.detail_label)
self.pb = QProgressBar()
self.pb.setMaximum(0)
self.pb.setMinimum(0)
self.content.addWidget(self.pb)
versions = QHBoxLayout()
versions.addWidget(QLabel(_("Current version: {}".format(version.ELECTRUM_VERSION))))
self.latest_version_label = QLabel(_("Latest version: {}".format(" ")))
versions.addWidget(self.latest_version_label)
self.content.addLayout(versions)
self.update_view(latest_version)
self.update_check_thread = UpdateCheckThread(self.main_window)
self.update_check_thread.checked.connect(self.on_version_retrieved)
self.update_check_thread.failed.connect(self.on_retrieval_failed)
self.update_check_thread.start()
close_button = QPushButton(_("Close"))
close_button.clicked.connect(self.close)
self.content.addWidget(close_button)
self.setLayout(self.content)
self.show()
def on_version_retrieved(self, version):
self.update_view(version)
def on_retrieval_failed(self):
self.heading_label.setText('<h2>' + _("Update check failed") + '</h2>')
self.detail_label.setText(_("Sorry, but we were unable to check for updates. Please try again later."))
self.pb.hide()
@staticmethod
def is_newer(latest_version):
return latest_version > LooseVersion(version.ELECTRUM_VERSION)
def update_view(self, latest_version=None):
if latest_version:
self.pb.hide()
self.latest_version_label.setText(_("Latest version: {}".format(latest_version)))
if self.is_newer(latest_version):
self.heading_label.setText('<h2>' + _("There is a new update available") + '</h2>')
url = "<a href='{u}'>{u}</a>".format(u=UpdateCheck.download_url)
self.detail_label.setText(_("You can download the new version from {}.").format(url))
else:
self.heading_label.setText('<h2>' + _("Already up to date") + '</h2>')
self.detail_label.setText(_("You are already on the latest version of Electrum."))
else:
self.heading_label.setText('<h2>' + _("Checking for updates...") + '</h2>')
self.detail_label.setText(_("Please wait while Electrum checks for available updates."))
示例8: RechgEvalWidget
# 需要导入模块: from PyQt5.QtWidgets import QProgressBar [as 别名]
# 或者: from PyQt5.QtWidgets.QProgressBar import hide [as 别名]
class RechgEvalWidget(QFrameLayout):
sig_new_gluedf = QSignal(GLUEDataFrameBase)
def __init__(self, parent):
super(RechgEvalWidget, self).__init__(parent)
self.setWindowTitle('Recharge Calibration Setup')
self.setWindowFlags(Qt.Window)
self.wxdset = None
self.wldset = None
self.figstack = FigureStackManager(parent=self)
self.progressbar = QProgressBar()
self.progressbar.setValue(0)
self.progressbar.hide()
self.__initUI__()
# Set the worker and thread mechanics
self.rechg_worker = RechgEvalWorker()
self.rechg_worker.sig_glue_finished.connect(self.receive_glue_calcul)
self.rechg_worker.sig_glue_progress.connect(self.progressbar.setValue)
self.rechg_thread = QThread()
self.rechg_worker.moveToThread(self.rechg_thread)
self.rechg_thread.started.connect(self.rechg_worker.eval_recharge)
def __initUI__(self):
class QRowLayout(QWidget):
def __init__(self, items, parent=None):
super(QRowLayout, self).__init__(parent)
layout = QGridLayout()
for col, item in enumerate(items):
layout.addWidget(item, 0, col)
layout.setContentsMargins(0, 0, 0, 0)
layout.setColumnStretch(0, 100)
self.setLayout(layout)
# ---- Parameters
# Specific yield (Sy) :
self.QSy_min = QDoubleSpinBox(0.05, 3)
self.QSy_min.setRange(0.001, 1)
self.QSy_max = QDoubleSpinBox(0.2, 3)
self.QSy_max.setRange(0.001, 1)
# Maximum readily available water (RASmax) :
# units=' mm'
self.QRAS_min = QDoubleSpinBox(5)
self.QRAS_min.setRange(0, 999)
self.QRAS_max = QDoubleSpinBox(40)
self.QRAS_max.setRange(0, 999)
# Runoff coefficient (Cro) :
self.CRO_min = QDoubleSpinBox(0.1, 3)
self.CRO_min.setRange(0, 1)
self.CRO_max = QDoubleSpinBox(0.3, 3)
self.CRO_max.setRange(0, 1)
# Snowmelt parameters :
# units=' °C'
self._Tmelt = QDoubleSpinBox(0, 1)
self._Tmelt.setRange(-25, 25)
# units=' mm/°C'
self._CM = QDoubleSpinBox(4, 1, 0.1, )
self._CM.setRange(0.1, 100)
# units=' days'
self._deltaT = QDoubleSpinBox(0, 0, )
self._deltaT.setRange(0, 999)
class QLabelCentered(QLabel):
def __init__(self, text):
super(QLabelCentered, self).__init__(text)
self.setAlignment(Qt.AlignCenter)
# ---- Parameters
params_group = QFrameLayout()
params_group.setContentsMargins(10, 5, 10, 0) # (L, T, R, B)
params_group.setObjectName("viewport")
params_group.setStyleSheet("#viewport {background-color:transparent;}")
row = 0
params_group.addWidget(QLabel('Sy :'), row, 0)
#.........这里部分代码省略.........
示例9: Splash
# 需要导入模块: from PyQt5.QtWidgets import QProgressBar [as 别名]
# 或者: from PyQt5.QtWidgets.QProgressBar import hide [as 别名]
class Splash(QObject, LogMixin, EventMixin):
"""Splash screen class"""
def __init__(self, parent, msg = ""):
"""
Constructor of Splash screen
:param parent: ui parent
:param msg: initial message text
"""
super().__init__()
self._parent = parent
self.isHidden = True
self._progress = 0
self._progressBar = None
self.msg = msg
pixmap = QtGui.QPixmap(380, 100)
pixmap.fill(QtGui.QColor("darkgreen"))
self._splash = QSplashScreen(pixmap)
self._splash.setParent(self._parent)
self.add_progressbar()
def add_progressbar(self):
"""Add separate progress bar to splash screen"""
self._progressBar = QProgressBar(self._splash)
self._progressBar.setGeometry(self._splash.width() / 10, 8 * self._splash.height() / 10,
8 * self._splash.width() / 10, self._splash.height() / 10)
self._progressBar.hide()
def setProgress(self, val):
"""
Set progress bar to ``val``
If splash has no progressbar, it will be added dynamically.
Remove progressbar with ``val`` as None.
:param val: absolut percent value
:return:
"""
if val is not None:
self._progressBar.show()
self._progressBar.setTextVisible(True)
self.progress = val
try:
self._progressBar.setValue(self.progress)
except:
pass
else:
self._progressBar.setTextVisible(False)
self._progressBar.hide()
self._progressBar.reset()
if self.isHidden is True:
self.isHidden = False
self.show_()
def incProgress(self, val):
"""
Increase progressbar value by ``val``
If splash has no progressbar, it will be added dynamically.
Remove progressbar with ``val`` as None.
:param val: value to increase by
:return:
"""
if val is not None:
self._progressBar.show()
self._progressBar.setTextVisible(True)
self.progress = self.progress + val
try:
self._progressBar.setValue(self.progress)
qApp.processEvents()
except:
pass
else:
self._progressBar.setTextVisible(False)
self._progressBar.hide()
self._progressBar.reset()
if self.isHidden is True:
self.isHidden = False
self.show_()
def setParent(self, parent):
"""Set splash's parent"""
self._parent = parent
self._splash.setParent(parent)
@pyqtSlot()
@pyqtSlot(bool)
def close(self, dummy = True):
self.logger.debug("Hide splash")
self.isHidden = True
#.........这里部分代码省略.........
示例10: MainWindow
# 需要导入模块: from PyQt5.QtWidgets import QProgressBar [as 别名]
# 或者: from PyQt5.QtWidgets.QProgressBar import hide [as 别名]
class MainWindow(QMainWindow, Ui_MainWindow):
# Maintain the list of browser windows so that they do not get garbage
# collected.
_window_list = []
def __init__(self):
super(MainWindow, self).__init__()
MainWindow._window_list.append(self)
self.setupUi(self)
# Qt Designer (at least to v4.2.1) can't handle arbitrary widgets in a
# QToolBar - even though uic can, and they are in the original .ui
# file. Therefore we manually add the problematic widgets.
self.lblAddress = QLabel("Address", self.tbAddress)
self.tbAddress.insertWidget(self.actionGo, self.lblAddress)
self.addressEdit = QLineEdit(self.tbAddress)
self.tbAddress.insertWidget(self.actionGo, self.addressEdit)
self.addressEdit.returnPressed.connect(self.actionGo.trigger)
self.actionBack.triggered.connect(self.WebBrowser.GoBack)
self.actionForward.triggered.connect(self.WebBrowser.GoForward)
self.actionStop.triggered.connect(self.WebBrowser.Stop)
self.actionRefresh.triggered.connect(self.WebBrowser.Refresh)
self.actionHome.triggered.connect(self.WebBrowser.GoHome)
self.actionSearch.triggered.connect(self.WebBrowser.GoSearch)
self.pb = QProgressBar(self.statusBar())
self.pb.setTextVisible(False)
self.pb.hide()
self.statusBar().addPermanentWidget(self.pb)
self.WebBrowser.dynamicCall('GoHome()')
def closeEvent(self, e):
MainWindow._window_list.remove(self)
e.accept()
def on_WebBrowser_TitleChange(self, title):
self.setWindowTitle("Qt WebBrowser - " + title)
def on_WebBrowser_ProgressChange(self, a, b):
if a <= 0 or b <= 0:
self.pb.hide()
return
self.pb.show()
self.pb.setRange(0, b)
self.pb.setValue(a)
def on_WebBrowser_CommandStateChange(self, cmd, on):
if cmd == 1:
self.actionForward.setEnabled(on)
elif cmd == 2:
self.actionBack.setEnabled(on)
def on_WebBrowser_BeforeNavigate(self):
self.actionStop.setEnabled(True)
def on_WebBrowser_NavigateComplete(self, _):
self.actionStop.setEnabled(False)
@pyqtSlot()
def on_actionGo_triggered(self):
self.WebBrowser.dynamicCall('Navigate(const QString&)',
self.addressEdit.text())
@pyqtSlot()
def on_actionNewWindow_triggered(self):
window = MainWindow()
window.show()
if self.addressEdit.text().isEmpty():
return;
window.addressEdit.setText(self.addressEdit.text())
window.actionStop.setEnabled(True)
window.on_actionGo_triggered()
@pyqtSlot()
def on_actionAbout_triggered(self):
QMessageBox.about(self, "About WebBrowser",
"This Example has been created using the ActiveQt integration into Qt Designer.\n"
"It demonstrates the use of QAxWidget to embed the Internet Explorer ActiveX\n"
"control into a Qt application.")
@pyqtSlot()
def on_actionAboutQt_triggered(self):
QMessageBox.aboutQt(self, "About Qt")
示例11: MainWindow
# 需要导入模块: from PyQt5.QtWidgets import QProgressBar [as 别名]
# 或者: from PyQt5.QtWidgets.QProgressBar import hide [as 别名]
#.........这里部分代码省略.........
lambda: open_new_tab('https://www.python.org'))
help_menu.addAction("About " + __doc__,
lambda: QMessageBox.about(self, __doc__, HELPMSG))
help_menu.addSeparator()
help_menu.addAction("Keyboard Shortcuts", lambda:
QMessageBox.information(self, __doc__, SHORTCUTS))
help_menu.addAction("View GitHub Repo", lambda: open_new_tab(__url__))
if not sys.platform.startswith("win"):
help_menu.addAction("Show Source Code", lambda: self.view_source())
help_menu.addSeparator()
help_menu.addAction("Check Updates", lambda: self.check_for_updates())
def init_systray(self):
"""init system tray icon"""
# self.tray = QSystemTrayIcon(QIcon(self.pixmap_syncthingui), self)
self.tray = AnimatedSysTrayIcon(QIcon(self.pixmap_syncthingui), self)
self.tray.add_ani_icon(QIcon(self.pixmap_syncthingui0))
self.tray.add_ani_icon(QIcon(self.pixmap_syncthingui1))
self.tray.add_ani_icon(QIcon(self.pixmap_syncthingui2))
self.tray.add_ani_icon(QIcon(self.pixmap_syncthingui3))
self.tray.setToolTip(__doc__.strip().capitalize())
traymenu = QMenu(self)
traymenu.addAction(__doc__).setDisabled(True)
traymenu.addSeparator()
# to test animate
# traymenu.addAction("start", lambda: self.tray.animate_start())
# traymenu.addAction("stop", lambda: self.tray.animate_stop())
# traymenu.addSeparator()
traymenu.addAction("Stop Sync", lambda: self.syncthing_stop())
traymenu.addAction("Restart Sync", lambda: self.run())
traymenu.addSeparator()
traymenu.addAction("Show", lambda: self.show_gui())
traymenu.addAction("Hide", lambda: self.hide())
traymenu.addSeparator()
# traymenu.addAction("Open Web", lambda: open_new_tab(URL))
# traymenu.addAction("Quit All", lambda: self.close())
traymenu.addAction("Quit All", lambda: self.app_exit())
self.tray.setContextMenu(traymenu)
self.tray.show()
def show_gui(self):
"""
Helper method to show UI, this should not be needed, but I discovered.
"""
self.showNormal()
# webview require 70Mb to show webpage
self.view.load(QUrl(URL))
def syncthing_start(self):
"""syncthing start"""
self.run()
def syncthing_stop(self):
"""syncthing stop"""
print("try to stop syncthing")
self.process.kill()
# check there is no other syncthing is running!
for proc in psutil.process_iter():
# check whether the process name matches
# print("procress: %s " % proc.name())
if proc.name() == SYNCTHING:
proc.kill()
def run(self):
"""Run bitch run!."""
示例12: MainWindow
# 需要导入模块: from PyQt5.QtWidgets import QProgressBar [as 别名]
# 或者: from PyQt5.QtWidgets.QProgressBar import hide [as 别名]
class MainWindow(QMainWindow):
tableContents = []
tableColumnCount = 8
tableRowCount = 10
workerCount = config['worker_num'] # 线程数
workers = [] # 保存线程对象
q = Queue()
wtime = [0, 0]
bgColor = QColor(180, 200, 230, 40)
progressVal = 0
taskVal = 0
def __init__(self):
super(MainWindow, self).__init__()
self.description = self.tr("""<b>Checker</b><br /><br />
Version: %s<br />
%s<br /><br />
Project: <a href=\"%s\">1dot75cm/repo-checker</a><br />
License: %s<br />
Author: <a href=\"mailto:%s\">%s</a>""") % (__version__,
__descript__, __url__, __license__, __email__, __author__)
self.tableHeaders = [self.tr("Name"), self.tr("URL"), self.tr("Branch"),
self.tr("RPM date [commit]"), self.tr("Release date [commit]"),
self.tr("Latest date [commit]"), self.tr("Status"), self.tr("Comment")]
self.setupUi(self)
def setupUi(self, MainWindow):
"""初始化主窗口"""
MainWindow.setObjectName("MainWindow")
MainWindow.setMinimumSize(QSize(910, 450))
MainWindow.setWindowTitle(self.tr("Checker"))
MainWindow.setAnimated(True)
self.centralwidget = QWidget(MainWindow)
sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
self.centralwidget.setSizePolicy(sizePolicy)
self.verticalLayout = QVBoxLayout(self.centralwidget)
self.verticalLayout.setContentsMargins(5, 5, 5, 5)
self.tableWidget = QTableWidget(self.centralwidget)
self.setupTable()
self.verticalLayout.addWidget(self.tableWidget)
self.horizontalLayout = QHBoxLayout()
self.horizontalLayout.setContentsMargins(5, 5, 5, 5)
self.addButton = QPushButton(self.centralwidget)
self.addButton.setFixedSize(QSize(25, 25))
self.addButton.setText("+")
self.horizontalLayout.addWidget(self.addButton)
self.delButton = QPushButton(self.centralwidget)
self.delButton.setFixedSize(QSize(25, 25))
self.delButton.setText("-")
self.horizontalLayout.addWidget(self.delButton)
self.upButton = QPushButton(self.centralwidget)
self.upButton.setFixedSize(QSize(25, 25))
self.upButton.setText("↑")
self.upButton.setObjectName("up")
self.horizontalLayout.addWidget(self.upButton)
self.downButton = QPushButton(self.centralwidget)
self.downButton.setFixedSize(QSize(25, 25))
self.downButton.setText("↓")
self.horizontalLayout.addWidget(self.downButton)
spacerItem = QSpacerItem(40, 20, QSizePolicy.MinimumExpanding, QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem)
self.progressBar = QProgressBar(self.centralwidget)
self.progressBar.hide()
self.horizontalLayout.addWidget(self.progressBar)
self.label = QLabel(self.centralwidget)
self.horizontalLayout.addWidget(self.label)
spacerItem = QSpacerItem(40, 20, QSizePolicy.Minimum, QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem)
self.checkButton = QPushButton(self.centralwidget)
self.checkButton.setText(self.tr("Check"))
self.horizontalLayout.addWidget(self.checkButton)
self.updateButton = QPushButton(self.centralwidget)
self.updateButton.setText(self.tr("Update item"))
self.horizontalLayout.addWidget(self.updateButton)
self.editRuleButton = QPushButton(self.centralwidget)
self.editRuleButton.setText(self.tr("Edit rule"))
self.horizontalLayout.addWidget(self.editRuleButton)
self.verticalLayout.addLayout(self.horizontalLayout)
MainWindow.setCentralWidget(self.centralwidget)
# 菜单
self.menubar = QMenuBar(MainWindow)
self.menubar.setGeometry(QRect(0, 0, 780, 34))
MainWindow.setMenuBar(self.menubar)
#.........这里部分代码省略.........
示例13: WindowSR
# 需要导入模块: from PyQt5.QtWidgets import QProgressBar [as 别名]
# 或者: from PyQt5.QtWidgets.QProgressBar import hide [as 别名]
#.........这里部分代码省略.........
column_info.addWidget(self.album)
column_info.addWidget(label_genre)
column_info.addWidget(self.genre)
# --
row_split.addLayout(column_image)
row_split.addLayout(column_info)
# Row of separation 2
row_sep2 = QHBoxLayout()
line_sep2 = QFrame()
line_sep2.setFrameShape(QFrame.HLine)
row_sep2.addWidget(line_sep2)
# Add the file location selection row
row_file = QHBoxLayout()
self.but_file = QPushButton("Save location", self)
self.but_file.clicked.connect(self.open_f)
self.text_file = QLineEdit(self.default_path(), self)
row_file.addWidget(self.but_file)
row_file.addWidget(self.text_file)
# Row of separation 3
row_sep3 = QHBoxLayout()
line_sep3 = QFrame()
line_sep3.setFrameShape(QFrame.HLine)
row_sep3.addWidget(line_sep3)
# Download button row
row_dl = QHBoxLayout()
self.bar_dl = QProgressBar(self)
self.bar_dl.setFixedSize(600, 30)
self.bar_dl.setMaximum(100)
self.bar_dl.setMinimum(0)
self.bar_dl.hide()
self.label_dl = QLabel(self)
self.label_dl.hide()
self.but_dl = QPushButton("Download", self)
self.but_dl.clicked.connect(self.manage_download)
self.but_dl.setDisabled(True)
row_dl.addWidget(self.bar_dl)
row_dl.addWidget(self.label_dl)
row_dl.addStretch(1)
row_dl.addWidget(self.but_dl)
# Add every row to the vertical grid
self.vertical_grid.addLayout(row_url)
self.vertical_grid.addLayout(row_sep1)
self.vertical_grid.addLayout(row_split)
self.vertical_grid.addLayout(row_sep2)
self.vertical_grid.addLayout(row_file)
self.vertical_grid.addLayout(row_sep3)
self.vertical_grid.addLayout(row_dl)
# Set layout of the vertical grid to the central widget
self.central_widget.setLayout(self.vertical_grid)
self.show()
def init_client_id(self):
"""Ask for client id if it as never been entered, else load it from
register with QSettings"""
self.client_id = None
self.setting = QSettings(QSettings.UserScope, "BoBibelo",
"SoundRain", self)
if not self.setting.value("SR_bool"): # Setting never set