本文整理汇总了Python中PyQt5.QtWidgets.QStatusBar类的典型用法代码示例。如果您正苦于以下问题:Python QStatusBar类的具体用法?Python QStatusBar怎么用?Python QStatusBar使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QStatusBar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, parent=None):
QStatusBar.__init__(self, parent)
self.mLabelPos = QLabel("当前位置:(nan,nan)")
self.mLabelTestName = QLabel("当前测试:凸包")
self.addWidget(self.mLabelPos)
self.addWidget(self.mLabelTestName)
示例2: __init__
def __init__(self, parent=None):
QStatusBar.__init__(self, parent)
self.mLabelPhyPos = QLabel("物理坐标:(nan,nan)")
self.mLabelPaintPos = QLabel("绘制坐标:(nan,nan)")
self.addWidget(self.mLabelPhyPos)
self.addWidget(self.mLabelPaintPos)
示例3: initUI
def initUI(self):
QToolTip.setFont(QFont('SansSerif', 10))
self.setToolTip('This is a <b>QWidget</b> widget.')
#quitBtn = QPushButton('Quit', self)
#quitBtn.clicked.connect(self.quitBtnEvent())
#quitBtn.clicked.connect(QCoreApplication.instance().quit)
#quitBtn.setToolTip('This is a <b>QPushButton</b> widget.')
#quitBtn.resize(quitBtn.sizeHint())
exitAction = QAction(QIcon('application-exit-4.png'), '&Exit', self)
exitAction.setShortcut('Alt+F4')
exitAction.setStatusTip('Exit Application')
exitAction.triggered.connect(qApp.quit)
menuBar = QMenuBar()
fileMenu = menuBar.addMenu('&File')
fileMenu.addAction(exitAction)
fileMenu.resize(fileMenu.sizeHint())
toolBar = QToolBar(self)
toolBar.addAction(exitAction)
#toolBar.resize(toolBar.sizeHint())
toolBar.setFixedHeight(60)
hozLine = QFrame()
hozLine.setFrameStyle(QFrame.HLine)
#hozLine.setSizePolicy(QSizePolicy.Minimum,QSizePolicy.Expanding)
statusBar = QStatusBar(self)
statusBar.showMessage('Ready')
grid = QGridLayout()
lbl_1 = QLabel('1,1')
lbl_2 = QLabel('1,2')
lbl_3 = QLabel('2,1')
lbl_4 = QLabel('2,2')
grid.addWidget(lbl_1, 1, 1)
grid.addWidget(lbl_2, 1, 2)
grid.addWidget(lbl_3, 2, 1)
grid.addWidget(lbl_4, 2, 2)
vbox = QVBoxLayout()
vbox.addWidget(menuBar)
vbox.addWidget(hozLine)
vbox.addWidget(toolBar)
# vbox.addWidget(hozLine)
vbox.addLayout(grid)
vbox.addStretch(1)
vbox.addWidget(statusBar)
self.setLayout(vbox)
self.setGeometry(300, 300, 500, 500)
self.setWindowTitle('Photos')
self.setWindowIcon(QIcon('camera-photo-5.png'))
self.center()
self.show()
示例4: show
def show(self):
self.clearMessage()
QStatusBar.show(self)
editor = main_container.MainContainer().get_actual_editor()
if editor and editor.textCursor().hasSelection():
text = editor.textCursor().selectedText()
self._searchWidget._line.setText(text)
self._searchWidget.find_matches(editor, True)
if self._widgetStatus.isVisible():
self._searchWidget._line.setFocus()
self._searchWidget._line.selectAll()
示例5: __init__
def __init__(self, *args):
QStatusBar.__init__(self, *args)
self.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Expanding)
self.setSizeGripEnabled(False)
self.setStyleSheet("QStatusBar {border: 0} QStatusBar::item {border: 0}")
self._label = QLabel(self)
self._label.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
self._label.setStyleSheet("color: red")
self.addWidget(self._label)
self._timer = QTimer()
self._timer.setSingleShot(True)
self._timer.timeout.connect(self.clearMessage)
示例6: ControlPanelWindow
class ControlPanelWindow(QDialog):
def __init__(self, parent, cli_iface, iface_name):
super(ControlPanelWindow, self).__init__(parent)
self.setWindowTitle('SLCAN Adapter Control Panel')
self.setAttribute(Qt.WA_DeleteOnClose) # This is required to stop background timers!
self._cli_iface = cli_iface
self._iface_name = iface_name
self._state_widget = StateWidget(self, self._cli_iface)
self._config_widget = ConfigWidget(self, self._cli_iface)
self._cli_widget = CLIWidget(self, self._cli_iface)
self._tab_widget = QTabWidget(self)
self._tab_widget.addTab(self._state_widget, get_icon('dashboard'), 'Adapter State')
self._tab_widget.addTab(self._config_widget, get_icon('wrench'), 'Configuration')
self._tab_widget.addTab(self._cli_widget, get_icon('terminal'), 'Command Line')
self._status_bar = QStatusBar(self)
self._status_bar.setSizeGripEnabled(False)
iface_name_label = QLabel(iface_name.split('/')[-1], self)
iface_name_label.setFont(get_monospace_font())
layout = QVBoxLayout(self)
layout.addWidget(iface_name_label)
layout.addWidget(self._tab_widget)
layout.addWidget(self._status_bar)
left, top, right, bottom = layout.getContentsMargins()
bottom = 0
layout.setContentsMargins(left, top, right, bottom)
self.setLayout(layout)
self.resize(400, 400)
def closeEvent(self, close_event):
if self._config_widget.have_unsaved_changes:
if request_confirmation('Save changes?',
'You made changes to the adapter configuration that were not saved. '
'Do you want to go back and save them?',
parent=self):
close_event.ignore()
self._tab_widget.setCurrentWidget(self._config_widget)
return
super(ControlPanelWindow, self).closeEvent(close_event)
def show_message(self, text, *fmt, duration=0):
self._status_bar.showMessage(text % fmt, duration * 1000)
示例7: __init__
def __init__(
self, parent, node, target_node_id, file_server_widget, node_monitor, dynamic_node_id_allocator_widget
):
super(NodePropertiesWindow, self).__init__(parent)
self.setAttribute(Qt.WA_DeleteOnClose) # This is required to stop background timers!
self.setWindowTitle("Node Properties [%d]" % target_node_id)
self.setMinimumWidth(640)
self._target_node_id = target_node_id
self._node = node
self._file_server_widget = file_server_widget
self._info_box = InfoBox(self, target_node_id, node_monitor)
self._controls = Controls(self, node, target_node_id, file_server_widget, dynamic_node_id_allocator_widget)
self._config_params = ConfigParams(self, node, target_node_id)
self._status_bar = QStatusBar(self)
self._status_bar.setSizeGripEnabled(False)
layout = QVBoxLayout(self)
layout.addWidget(self._info_box)
layout.addWidget(self._controls)
layout.addWidget(self._config_params)
layout.addWidget(self._status_bar)
left, top, right, bottom = layout.getContentsMargins()
bottom = 0
layout.setContentsMargins(left, top, right, bottom)
self.setLayout(layout)
示例8: __init__
def __init__(self, parent, cli_iface, iface_name):
super(ControlPanelWindow, self).__init__(parent)
self.setWindowTitle('SLCAN Adapter Control Panel')
self.setAttribute(Qt.WA_DeleteOnClose) # This is required to stop background timers!
self._cli_iface = cli_iface
self._iface_name = iface_name
self._state_widget = StateWidget(self, self._cli_iface)
self._config_widget = ConfigWidget(self, self._cli_iface)
self._cli_widget = CLIWidget(self, self._cli_iface)
self._tab_widget = QTabWidget(self)
self._tab_widget.addTab(self._state_widget, get_icon('dashboard'), 'Adapter State')
self._tab_widget.addTab(self._config_widget, get_icon('wrench'), 'Configuration')
self._tab_widget.addTab(self._cli_widget, get_icon('terminal'), 'Command Line')
self._status_bar = QStatusBar(self)
self._status_bar.setSizeGripEnabled(False)
iface_name_label = QLabel(iface_name.split('/')[-1], self)
iface_name_label.setFont(get_monospace_font())
layout = QVBoxLayout(self)
layout.addWidget(iface_name_label)
layout.addWidget(self._tab_widget)
layout.addWidget(self._status_bar)
left, top, right, bottom = layout.getContentsMargins()
bottom = 0
layout.setContentsMargins(left, top, right, bottom)
self.setLayout(layout)
self.resize(400, 400)
示例9: setWidget
def setWidget(self):
if self.obj.configured==0:
self.setCentralWidget(configureWidget(self))
elif self.obj.configured==1:
self.setCentralWidget(setupWidget(self))
elif self.obj.configured==2:
self.setStyleSheet('''#Window1{background-color: light gray;}''')
self.setWindowTitle('Moodly 1.0 Beta')
self.setMenuBar()
self.tabWidget = tabWidget(self)
self.setCentralWidget(self.tabWidget)
self.tray.updateAction.setEnabled(True)
self.statusBar = QStatusBar()
self.setStatusBar(self.statusBar)
self.statusBar.hide()
self.statusLbl1 = QLabel()
self.statusLbl2 = QLabel()
self.statusLbl2.setAlignment(QtCore.Qt.AlignRight)
self.statusBar.addWidget(self.statusLbl1)
self.statusBar.addWidget(self.statusLbl2,QtCore.Qt.AlignRight)
self.updateTimer()
self.notifTimer()
self.i_thread = {}
self.nt=0
示例10: setup_ui
def setup_ui(self):
self.setObjectName("MainWindow")
self.resize(820, 760)
self.setMinimumSize(QSize(720, 560))
self.setWindowTitle("BW-StringsEdit")
self.centralwidget = QWidget(self)
self.centralwidget.setObjectName("centralwidget")
self.setCentralWidget(self.centralwidget)
self.horizontalLayout = QHBoxLayout(self.centralwidget)
self.horizontalLayout.setObjectName("horizontalLayout")
self.strings_list = QListWidget(self.centralwidget)
self.horizontalLayout.addWidget(self.strings_list)
self.vertLayoutWidget = QWidget(self.centralwidget)
self.verticalLayout = QVBoxLayout(self.vertLayoutWidget)
self.button_add_message = QPushButton(self.centralwidget)
self.button_remove_message = QPushButton(self.centralwidget)
self.button_set_message = QPushButton(self.centralwidget)
self.button_add_message.setText("Add Message")
self.button_remove_message.setText("Delete Last Message")
self.button_set_message.setText("Set Message Content")
self.lineedit_path = QLineEdit(self.centralwidget)
self.lineedit_audioname = QLineEdit(self.centralwidget)
self.lineedit_playtime = QLineEdit(self.centralwidget)
self.textedit_content = QTextEdit(self.centralwidget)
for widget in ( self.button_remove_message, self.button_add_message, self.button_set_message,
self.lineedit_path, self.lineedit_audioname, self.lineedit_playtime, self.textedit_content):
self.verticalLayout.addWidget(widget)
self.horizontalLayout.addWidget(self.vertLayoutWidget)
self.menubar = self.menuBar()#QMenuBar(self)
#self.menubar.setGeometry(QRect(0, 0, 820, 30))
#self.menubar.setObjectName("menubar")
self.file_menu = self.menubar.addMenu("File")#QMenu(self.menubar)
self.file_menu.setObjectName("menuLoad")
#self.menubar.addMenu(self.file_menu)
self.file_load_action = QAction("Load", self)
self.file_load_action.triggered.connect(self.button_load_strings)
self.file_menu.addAction(self.file_load_action)
self.file_save_action = QAction("Save", self)
self.file_save_action.triggered.connect(self.button_save_strings)
self.file_menu.addAction(self.file_save_action)
self.statusbar = QStatusBar(self)
self.statusbar.setObjectName("statusbar")
self.setStatusBar(self.statusbar)
#self.setMenuBar(self.menubar)
print("done")
示例11: __init__
def __init__(self):
super(Main_Window, self).__init__()
self.menubar = QMenuBar(self)
self.statusbar = QStatusBar(self)
self.centralwidget = QWidget(self)
self.image_view = Image_View(self.centralwidget)
self.horizontal_slider = QSlider(self.centralwidget)
self.setup_ui()
示例12: _setupUi
def _setupUi(self):
self.setWindowTitle(tr("{} Results").format(self.app.NAME))
self.resize(630, 514)
self.centralwidget = QWidget(self)
self.verticalLayout = QVBoxLayout(self.centralwidget)
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
self.verticalLayout.setSpacing(0)
self.actionsButton = QPushButton(tr("Actions"))
self.detailsButton = QPushButton(tr("Details"))
self.dupesOnlyCheckBox = QCheckBox(tr("Dupes Only"))
self.deltaValuesCheckBox = QCheckBox(tr("Delta Values"))
self.searchEdit = SearchEdit()
self.searchEdit.setMaximumWidth(300)
self.horizontalLayout = horizontalWrap([
self.actionsButton, self.detailsButton,
self.dupesOnlyCheckBox, self.deltaValuesCheckBox, None, self.searchEdit, 8
])
self.horizontalLayout.setSpacing(8)
self.verticalLayout.addLayout(self.horizontalLayout)
self.resultsView = ResultsView(self.centralwidget)
self.resultsView.setSelectionMode(QAbstractItemView.ExtendedSelection)
self.resultsView.setSelectionBehavior(QAbstractItemView.SelectRows)
self.resultsView.setSortingEnabled(True)
self.resultsView.verticalHeader().setVisible(False)
h = self.resultsView.horizontalHeader()
h.setHighlightSections(False)
h.setSectionsMovable(True)
h.setStretchLastSection(False)
h.setDefaultAlignment(Qt.AlignLeft)
self.verticalLayout.addWidget(self.resultsView)
self.setCentralWidget(self.centralwidget)
self._setupActions()
self._setupMenu()
self.statusbar = QStatusBar(self)
self.statusbar.setSizeGripEnabled(True)
self.setStatusBar(self.statusbar)
self.statusLabel = QLabel(self)
self.statusbar.addPermanentWidget(self.statusLabel, 1)
if self.app.prefs.resultWindowIsMaximized:
self.setWindowState(self.windowState() | Qt.WindowMaximized)
else:
if self.app.prefs.resultWindowRect is not None:
self.setGeometry(self.app.prefs.resultWindowRect)
# if not on any screen move to center of default screen
# moves to center of closest screen if partially off screen
frame = self.frameGeometry()
if QDesktopWidget().screenNumber(self) == -1:
moveToScreenCenter(self)
elif QDesktopWidget().availableGeometry(self).contains(frame) is False:
frame.moveCenter(QDesktopWidget().availableGeometry(self).center())
self.move(frame.topLeft())
else:
moveToScreenCenter(self)
示例13: __init__
def __init__(self, app):
QMainWindow.__init__(self, None)
self.l.debug('Initializing MainWindow ...')
self.setWindowTitle('MynPad')
app.setWindowIcon(QIcon(':/icons/mynpad.png'))
if os.name == 'nt':
# On Windows, make sure to use a unique Application User Model Id, otherwise
# Windows shows the default python icon in the taskbar
# see http://stackoverflow.com/questions/1551605/how-to-set-applications-taskbar-icon-in-windows-7
myappid = 'afester.mynpad'
import ctypes; ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid)
self.theApplication = app
app.aboutToQuit.connect(self.saveState)
# read the local configuration file
iniPath = 'mynpad.ini'
if not os.path.exists(iniPath):
iniPath = os.path.join(expanduser("~"), iniPath)
self.settings = Settings(iniPath)
self.settings.load()
# Set up the menu bar
menuBar = QMenuBar(self)
exitAction = QAction("Exit", self, triggered=self.theApplication.exit)
fileMenu = menuBar.addMenu("&File")
fileMenu.addAction(exitAction)
aboutAction = QAction("About ...", self, triggered = self.handleAbout)
helpMenu = menuBar.addMenu("&Help")
helpMenu.addAction(aboutAction)
self.setMenuBar(menuBar)
# Setup the status bar
self.statusBar = QStatusBar()
self.statusBar.showMessage("Ready.")
self.setStatusBar(self.statusBar)
self.mainWidget = CentralWidget(self, self.settings)
self.mainWidget.updateWindowTitle.connect(self.updateWindowTitle)
self.setCentralWidget(self.mainWidget)
# Reset main window size and position
pos = self.settings.getMainWindowPos()
self.move(pos.x(), pos.y())
size = self.settings.getMainWindowSize()
self.resize(size)
# initialize the browser tree (add the top nodes and expand the saved path)
self.mainWidget.browserWidget.initialize()
示例14: Main_Window
class Main_Window(QMainWindow):
def __init__(self):
super(Main_Window, self).__init__()
self.menubar = QMenuBar(self)
self.statusbar = QStatusBar(self)
self.centralwidget = QWidget(self)
self.image_view = Image_View(self.centralwidget)
self.horizontal_slider = QSlider(self.centralwidget)
self.setup_ui()
def setup_ui(self):
# 1. self info
self.setObjectName("Demo_1")
self.resize(800, 600)
# 2.1 sub widgets
self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 22))
self.menubar.setObjectName("menubar")
self.setMenuBar(self.menubar)
# 2.2
self.statusbar.setObjectName("statusbar")
self.setStatusBar(self.statusbar)
# 2.3
self.centralwidget.setObjectName("centralwidget")
self.setCentralWidget(self.centralwidget)
self.image_view.setGeometry(QtCore.QRect(144, 10, 512, 512))
self.image_view.setObjectName("image_view")
self.horizontal_slider.setGeometry(QtCore.QRect(144, 530, 512, 22))
self.horizontal_slider.setOrientation(QtCore.Qt.Horizontal)
self.horizontal_slider.setObjectName("horizontal_slider")
# 3 signals and slots
self.horizontal_slider.valueChanged['int'].connect(self.image_view.repaint)
示例15: Tab
class Tab(QWidget):
def __init__(self, parent, configuration):
QWidget.__init__(self, parent)
self._configuration = configuration
layout = QVBoxLayout()
layout.setContentsMargins(0, 0, 0, 0)
main_widget = QWidget(self)
self._layout_main = QVBoxLayout()
self._layout_main.setContentsMargins(0, 0, 0, 0)
self._layout_main.setSpacing(6)
main_widget.setLayout(self._layout_main)
layout.addWidget(main_widget)
self._status_bar = QStatusBar()
layout.addWidget(self._status_bar)
self.setLayout(layout)
def _add_widget(self, widget):
self._layout_main.addWidget(widget)
def set_error_message(self, msg):
self._status_bar.showMessage(msg)