本文整理汇总了Python中PyQt5.QtWidgets.QStatusBar.showMessage方法的典型用法代码示例。如果您正苦于以下问题:Python QStatusBar.showMessage方法的具体用法?Python QStatusBar.showMessage怎么用?Python QStatusBar.showMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QStatusBar
的用法示例。
在下文中一共展示了QStatusBar.showMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: initUI
# 需要导入模块: from PyQt5.QtWidgets import QStatusBar [as 别名]
# 或者: from PyQt5.QtWidgets.QStatusBar import showMessage [as 别名]
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()
示例2: ControlPanelWindow
# 需要导入模块: from PyQt5.QtWidgets import QStatusBar [as 别名]
# 或者: from PyQt5.QtWidgets.QStatusBar import showMessage [as 别名]
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)
示例3: Tab
# 需要导入模块: from PyQt5.QtWidgets import QStatusBar [as 别名]
# 或者: from PyQt5.QtWidgets.QStatusBar import showMessage [as 别名]
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)
示例4: NodePropertiesWindow
# 需要导入模块: from PyQt5.QtWidgets import QStatusBar [as 别名]
# 或者: from PyQt5.QtWidgets.QStatusBar import showMessage [as 别名]
class NodePropertiesWindow(QDialog):
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)
def show_message(self, text, *fmt, duration=0):
self._status_bar.showMessage(text % fmt, duration * 1000)
@property
def target_node_id(self):
return self._target_node_id
示例5: ShowPoints
# 需要导入模块: from PyQt5.QtWidgets import QStatusBar [as 别名]
# 或者: from PyQt5.QtWidgets.QStatusBar import showMessage [as 别名]
class ShowPoints(QWidget):
def __init__(self):
super().__init__()
self.webView = QtWebEngineWidgets.QWebEngineView()
self.sourceType = QComboBox()
self.sourceType.addItems(['国测局坐标GCJ02(MX数据库/高德)','GPS坐标(wgs84/NMEA0183)'])
self.inputText = QTextEdit()
self.inputText.setFixedWidth(280)
self.runButton = QPushButton('确定')
self.runButton.setFixedWidth(100)
self.clrButton = QPushButton('清除')
self.clrButton.setFixedWidth(100)
self.statusBar = QStatusBar()
self.statusBar.showMessage(STATUS_TIP+"Ready")
self.init_ui()
def init_ui(self):
path = os.getcwd()
url = path + HTM_FILE
self.webView.setUrl(QtCore.QUrl(url))
self.webView.page().loadFinished.connect(self.load_finished) # for test
self.inputText.setEnabled(False)
self.inputText.setAcceptRichText(False)
self.inputText.setToolTip("每行一组经纬度,纬度lat在前\n" + "以空格、逗号或制表符分隔")
self.runButton.clicked.connect(self.add_points) # show all points in input text window
self.clrButton.clicked.connect(self.clr_points)
buttonBox = QHBoxLayout() # button box
buttonBox.addStretch()
buttonBox.addWidget(self.runButton)
buttonBox.addWidget(self.clrButton)
rightBox = QVBoxLayout() # right box
rightBox.addWidget(self.sourceType)
rightBox.addWidget(self.inputText)
rightBox.addLayout(buttonBox)
rightBox.addWidget(self.statusBar)
layout = QHBoxLayout() # main box
layout.addWidget(self.webView)
layout.addLayout(rightBox)
self.setLayout(layout)
self.setWindowTitle('经纬度地图显示')
self.show()
def load_finished(self):
self.inputText.setEnabled(True)
def add_marker(self):
"""
添加标记,ok
:return:
"""
a = self.webView.page()
# a.runJavaScript("addMarker(114.39387,30.505299,true,1);")
# a.runJavaScript("var point = new BMap.Point(114,30);var marker = new BMap.Marker(point);map.addOverlay(marker);")
a.runJavaScript("testfunc(1);") # ok
a.runJavaScript("addMarker(114,30.01,true,2);")
def run_script(self, script):
a = self.webView.page()
a.runJavaScript(script)
def add_points(self):
self.statusBar.showMessage(STATUS_TIP+"Running...")
points_text = self.inputText.toPlainText() # 获取输入
source_type = self.sourceType.currentIndex()
if_mars = 'true' if (source_type == 0) else 'false'
if points_text == "": # 使用示例输入
points_text = SAMPLE_DATA
self.inputText.setPlainText(points_text)
points = Point.points_parser(points_text) # 解析输入
lats = [p.lat for p in points]
lons = [p.lon for p in points]
N = len(lats) # 共N组经纬度
G = math.ceil((N - 1) / 9) # 每10个一组,首尾相接,共G组
if N == 1:
G = 1
for g in range(G): # 0,1,...,G-1
index_s = 9 * g
index_e = 9 * g + 10
index_e = N if (index_e > N) else index_e
latsStr = "[" + ",".join(lats[index_s:index_e]) + "]"
lonsStr = "[" + ",".join(lons[index_s:index_e]) + "]"
script = "addSimpleMarker(%s,%s,%s);" % (latsStr, lonsStr, if_mars)
self.run_script(script)
time.sleep(0.1) # seconds,延时0.1秒,避免回调函数的执行顺序被打乱
self.statusBar.showMessage(STATUS_TIP+"Done")
def clr_points(self):
self.run_script("clearMarkers();")
#.........这里部分代码省略.........
示例6: ConfigParamEditWindow
# 需要导入模块: from PyQt5.QtWidgets import QStatusBar [as 别名]
# 或者: from PyQt5.QtWidgets.QStatusBar import showMessage [as 别名]
class ConfigParamEditWindow(QDialog):
def __init__(self, parent, node, target_node_id, param_struct, update_callback):
super(ConfigParamEditWindow, self).__init__(parent)
self.setWindowTitle("Edit configuration parameter")
self.setModal(True)
self._node = node
self._target_node_id = target_node_id
self._param_struct = param_struct
self._update_callback = update_callback
min_val = get_union_value(param_struct.min_value)
if "uavcan.protocol.param.Empty" in str(min_val):
min_val = None
max_val = get_union_value(param_struct.max_value)
if "uavcan.protocol.param.Empty" in str(max_val):
max_val = None
value = get_union_value(param_struct.value)
self._value_widget = None
value_type = uavcan.get_active_union_field(param_struct.value)
if value_type == "integer_value":
min_val = min_val if min_val is not None else -0x8000000000000000
max_val = max_val if max_val is not None else 0x7FFFFFFFFFFFFFFF
if min_val >= -0x80000000 and max_val <= +0x7FFFFFFF:
self._value_widget = QSpinBox(self)
self._value_widget.setMaximum(max_val)
self._value_widget.setMinimum(min_val)
self._value_widget.setValue(value)
if value_type == "real_value":
min_val = round_float(min_val) if min_val is not None else -3.4028235e38
max_val = round_float(max_val) if max_val is not None else 3.4028235e38
value = round_float(value)
if value_type == "boolean_value":
self._value_widget = QCheckBox(self)
self._value_widget.setChecked(bool(value))
if self._value_widget is None:
self._value_widget = QLineEdit(self)
self._value_widget.setText(str(value))
self._value_widget.setFont(get_monospace_font())
layout = QGridLayout(self)
def add_const_field(label, *values):
row = layout.rowCount()
layout.addWidget(QLabel(label, self), row, 0)
if len(values) == 1:
layout.addWidget(FieldValueWidget(self, values[0]), row, 1)
else:
sub_layout = QHBoxLayout(self)
for idx, v in enumerate(values):
sub_layout.addWidget(FieldValueWidget(self, v))
layout.addLayout(sub_layout, row, 1)
add_const_field("Name", param_struct.name)
add_const_field("Type", uavcan.get_active_union_field(param_struct.value).replace("_value", ""))
add_const_field("Min/Max", min_val, max_val)
add_const_field("Default", render_union(param_struct.default_value))
layout.addWidget(QLabel("Value", self), layout.rowCount(), 0)
layout.addWidget(self._value_widget, layout.rowCount() - 1, 1)
fetch_button = make_icon_button(
"refresh", "Read parameter from the node", self, text="Fetch", on_clicked=self._do_fetch
)
set_default_button = make_icon_button(
"fire-extinguisher", "Restore default value", self, text="Restore", on_clicked=self._restore_default
)
send_button = make_icon_button(
"flash", "Send parameter to the node", self, text="Send", on_clicked=self._do_send
)
cancel_button = make_icon_button(
"remove", "Close this window; unsent changes will be lost", self, text="Cancel", on_clicked=self.close
)
controls_layout = QGridLayout(self)
controls_layout.addWidget(fetch_button, 0, 0)
controls_layout.addWidget(send_button, 0, 1)
controls_layout.addWidget(set_default_button, 1, 0)
controls_layout.addWidget(cancel_button, 1, 1)
layout.addLayout(controls_layout, layout.rowCount(), 0, 1, 2)
self._status_bar = QStatusBar(self)
self._status_bar.setSizeGripEnabled(False)
layout.addWidget(self._status_bar, layout.rowCount(), 0, 1, 2)
left, top, right, bottom = layout.getContentsMargins()
bottom = 0
layout.setContentsMargins(left, top, right, bottom)
self.setLayout(layout)
def show_message(self, text, *fmt):
self._status_bar.showMessage(text % fmt)
def _assign(self, value_union):
value = get_union_value(value_union)
#.........这里部分代码省略.........
示例7: Dimili
# 需要导入模块: from PyQt5.QtWidgets import QStatusBar [as 别名]
# 或者: from PyQt5.QtWidgets.QStatusBar import showMessage [as 别名]
class Dimili(QMainWindow):
def baslat(self, anaPencere):
anaPencere.resize(600, 400)
anaPencere.setWindowTitle("Dimili-Türkçe Sözlük")
anaPencere.setFixedSize(600,400)
icon =QIcon()
icon.addPixmap(QPixmap("Dictionary.png"),QIcon.Normal,QIcon.Off)
anaPencere.setWindowIcon(icon)
zemin=QWidget(anaPencere)
zemin.setGeometry(QRect(0,30,600,390))
zemin.setStyleSheet("background-color:rgb(167, 196, 233);")
self.araKutu = QLineEdit(anaPencere)
self.araKutu.setGeometry(QRect(10, 80, 200, 20))
self.araKutu.textChanged.connect(self.benzerKelimeler)
self.kelimeGir = QLabel("Kelimeler:",anaPencere)
self.kelimeGir.setGeometry(QRect(10, 110, 141, 21))
self.kelimeGor = QLabel("Kelime Ara",anaPencere)
self.kelimeGor.setGeometry(QRect(10, 30, 91, 16))
self.harfGrup=QButtonGroup(anaPencere)
aharf=QPushButton("â",anaPencere)
aharf.setGeometry(QRect(10,50,25,25))
eharf=QPushButton("é",anaPencere)
eharf.setGeometry(QRect(30,50,25,25))
self.DilGrup=QButtonGroup(anaPencere)
self.Dil1 = QPushButton("Zazaca-Türkçe",anaPencere)
self.Dil1.setGeometry(QRect(230, 80, 91, 23))
self.Dil1.setCheckable(True)
self.Dil1.setAutoExclusive(True)
self.Dil1.setChecked(True)
self.Dil1.setStyleSheet("background-color: rgb(102, 255, 0);")
self.Dil2 = QPushButton("Türkçe-Zazaca",anaPencere)
self.Dil2.setGeometry(QRect(330, 80, 91, 23))
self.Dil2.setCheckable(True)
self.Dil2.setAutoExclusive(True)
self.Dil2.setStyleSheet("background-color: rgb(255, 94, 105);")
self.DilGrup.addButton(self.Dil1,1)
self.DilGrup.addButton(self.Dil2,2)
self.DilGrup.buttonClicked[int].connect(self.dilSecme)
self.kelimeListesi=QListWidget(anaPencere)
self.kelimeListesi.setGeometry(QRect(10, 130, 191, 231))
self.kelimeListesi.itemClicked.connect(self.kelimeAcikla)
self.kelimeAnlam = QLabel("Kelimenin Anlamı:",anaPencere)
self.kelimeAnlam.setGeometry(QRect(230, 110, 131, 21))
self.cumleList1 = QListWidget(anaPencere)
self.cumleList1.setGeometry(QRect(230, 130, 351, 51))
self.ornekCumle1 = QLabel("Örnek Zazaca Cümle:",anaPencere)
self.ornekCumle1.setGeometry(QRect(230, 200, 101, 21))
self.cumleList2 = QListWidget(anaPencere)
self.cumleList2.setGeometry(QRect(230, 220, 351, 51))
self.ornekCumle2 = QLabel("Örnek Türkçe Cümle:",anaPencere)
self.ornekCumle2.setGeometry(QRect(230, 290, 111, 16))
self.cumleList3 = QListWidget(anaPencere)
self.cumleList3.setGeometry(QRect(230, 310, 351, 51))
self.anaMenu = QMenuBar(anaPencere)
self.anaMenu.setGeometry(QRect(0, 0, 600, 21))
self.menuDosya = QMenu("Dosya",self.anaMenu)
self.menuDuzenle = QMenu("Düzenle",self.anaMenu)
self.menuYardim = QMenu("Yardım",self.anaMenu)
anaPencere.setMenuBar(self.anaMenu)
self.durum = QStatusBar(zemin)
anaPencere.setStatusBar(self.durum)
self.durum.setStyleSheet("background-color:white")
self.durum.showMessage("Hazır")
self.cikis= QAction(QIcon("Exit.ico"),"&Çıkış",anaPencere)
self.cikis.setShortcut("Ctrl+X")
self.cikis.triggered.connect(anaPencere.close)
self.actionHakkinda = QAction("Hakkında",anaPencere)
self.actionHakkinda.triggered.connect(self.hakkinda)
self.actionSecenekler = QAction("Seçenekler",anaPencere)
self.menuDosya.addAction(self.cikis)
self.menuDuzenle.addAction(self.actionSecenekler)
self.menuYardim.addAction(self.actionHakkinda)
#.........这里部分代码省略.........
示例8: MainWindow_Ui
# 需要导入模块: from PyQt5.QtWidgets import QStatusBar [as 别名]
# 或者: from PyQt5.QtWidgets.QStatusBar import showMessage [as 别名]
#.........这里部分代码省略.........
QCoreApplication.translate("mainwindow_ui_tr", 'Transfer rate'), QCoreApplication.translate("mainwindow_ui_tr",'Estimated time left'), 'Gid', QCoreApplication.translate("mainwindow_ui_tr",'Link'), QCoreApplication.translate("mainwindow_ui_tr", 'First try date'), QCoreApplication.translate("mainwindow_ui_tr", 'Last try date'), QCoreApplication.translate("mainwindow_ui_tr",'Category')]
self.download_table.setHorizontalHeaderLabels(download_table_header)
# fixing the size of download_table when window is Maximized!
self.download_table.horizontalHeader().setSectionResizeMode(0)
self.download_table.horizontalHeader().setStretchLastSection(True)
tabels_splitter.setStretchFactor(0, 3) # category_tree width
tabels_splitter.setStretchFactor(1, 10) # ratio of tables's width
download_table_horizontalLayout.addWidget(tabels_splitter)
self.frame.setLayout(download_table_horizontalLayout)
self.verticalLayout.addWidget(self.frame)
self.setCentralWidget(self.centralwidget)
# menubar
self.menubar = QMenuBar(self)
self.menubar.setGeometry(QRect(0, 0, 600, 24))
self.setMenuBar(self.menubar)
fileMenu = self.menubar.addMenu(QCoreApplication.translate("mainwindow_ui_tr", '&File'))
editMenu = self.menubar.addMenu(QCoreApplication.translate("mainwindow_ui_tr", '&Edit'))
viewMenu = self.menubar.addMenu(QCoreApplication.translate("mainwindow_ui_tr", '&View'))
downloadMenu = self.menubar.addMenu(QCoreApplication.translate("mainwindow_ui_tr", '&Download'))
queueMenu = self.menubar.addMenu(QCoreApplication.translate("mainwindow_ui_tr", '&Queue'))
videoFinderMenu = self.menubar.addMenu(QCoreApplication.translate("mainwindow_ui_tr", 'V&ideo Finder'))
helpMenu = self.menubar.addMenu(QCoreApplication.translate("mainwindow_ui_tr", '&Help'))
# viewMenu submenus
sortMenu = viewMenu.addMenu(QCoreApplication.translate("mainwindow_ui_tr", 'Sort by'))
# statusbar
self.statusbar = QStatusBar(self)
self.setStatusBar(self.statusbar)
self.statusbar.showMessage(QCoreApplication.translate("mainwindow_ui_tr", "Persepolis Download Manager"))
# toolBar
self.toolBar2 = QToolBar(self)
self.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar2)
self.toolBar2.setWindowTitle(QCoreApplication.translate("mainwindow_ui_tr", 'Menu'))
self.toolBar2.setFloatable(False)
self.toolBar2.setMovable(False)
self.toolBar = QToolBar(self)
self.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar)
self.toolBar.setWindowTitle(QCoreApplication.translate("mainwindow_ui_tr", 'Toolbar'))
self.toolBar.setFloatable(False)
self.toolBar.setMovable(False)
#toolBar and menubar and actions
self.videoFinderAddLinkAction = QAction(QIcon(icons + 'video_finder'), QCoreApplication.translate("mainwindow_ui_tr", 'Find Video Links'), self, statusTip=QCoreApplication.translate("mainwindow_ui_tr", 'Download video or audio from Youtube, Vimeo, etc...'),
triggered=self.showVideoFinderAddLinkWindow)
QShortcut(QKeySequence('Ctrl+I'), self, self.showVideoFinderAddLinkWindow)
videoFinderMenu.addAction(self.videoFinderAddLinkAction)
self.stopAllAction = QAction(QIcon(icons + 'stop_all'), QCoreApplication.translate("mainwindow_ui_tr", 'Stop all active downloads'),
self, statusTip='Stop all active downloads', triggered=self.stopAllDownloads)
downloadMenu.addAction(self.stopAllAction)
self.sort_file_name_Action = QAction(
QCoreApplication.translate("mainwindow_ui_tr", 'File name'), self, triggered=self.sortByName)
sortMenu.addAction(self.sort_file_name_Action)
self.sort_file_size_Action = QAction(
QCoreApplication.translate("mainwindow_ui_tr", 'File size'), self, triggered=self.sortBySize)
示例9: GPSWindow
# 需要导入模块: from PyQt5.QtWidgets import QStatusBar [as 别名]
# 或者: from PyQt5.QtWidgets.QStatusBar import showMessage [as 别名]
class GPSWindow(QDialog):
satellites = 0 # Satellites in view
hdop = 40 # Horizontal dilution of position
def __init__(self, parent=None):
super(GPSWindow, self).__init__(parent)
self.setupUi()
def setupUi(self):
self.setObjectName("GPSWindow")
self.setModal(True)
top = QHBoxLayout(self)
ll = QVBoxLayout()
self.web = QWebView()
ll.addWidget(self.web)
self.statusBar = QStatusBar(self)
ll.addWidget(self.statusBar)
top.addLayout(ll)
self.resize(640, 480)
self.statusBar.showMessage("No fix")
self.web.setHtml('''<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Circles</title>
<style>
html, body, #map-canvas {
height: 100%;
margin: 0;
padding: 0;
}
</style>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&signed_in=true"></script>
<script>
var map;
var quadcircle;
function updatePosition(lat, lng, err){
quadCircle.setMap(map);
quadCircle.setCenter(new google.maps.LatLng(lat, lng));
quadCircle.setRadius(err);
}
function hidePosition(){
quadCircle.setMap(null);
}
function moveToLocation(lat, lng){
var center = new google.maps.LatLng(lat, lng);
map.panTo(center);
}
function initialize() {
// Create the map.
map = new google.maps.Map(document.getElementById('map-canvas'), {
zoom: 4,
center: new google.maps.LatLng(0, 0),
mapTypeId: google.maps.MapTypeId.TERRAIN
});
// Representation of the quadricopter on map
quadCircle = new google.maps.Circle({
strokeColor: '#FF0000',
strokeOpacity: 0.8,
strokeWeight: 2,
fillColor: '#FF0000',
fillOpacity: 0.35,
map: null
});
hidePosition();
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="map-canvas"></div>
</body>
</html>''')
def parseNMEA(self, nmeaMessage):
fields = nmeaMessage.split(',')
# Recommended Minimum
if fields[0] == '$GPRMC':
if fields[3] != '' and fields[5] != '':
lat = float(fields[3]) * (1.0 if fields[4] == 'N' else -1.0)
lon = float(fields[5]) * (1.0 if fields[4] == 'E' else -1.0)
lat = int(lat/100) + (lat - (int(lat/100) * 100)) / 60
lon = int(lon/100) + (lon - (int(lon/100) * 100)) / 60
#.........这里部分代码省略.........
示例10: MyWidget
# 需要导入模块: from PyQt5.QtWidgets import QStatusBar [as 别名]
# 或者: from PyQt5.QtWidgets.QStatusBar import showMessage [as 别名]
class MyWidget(QWidget):
def __init__(self, fig, ax, df, title, parent=None):
super(MyWidget, self).__init__(parent)
#super().__init__()
self.legend = []
self.ax = ax
self.df = df
# Graph
ctrl_sys = ControlSys(fig, ax)
self.cg = CGraph(fig, ax, ctrl_sys, df, title)
self.setWindowTitle(title)
self.setGeometry(5,30,400,680)
# Vbox
self.topLayout = QVBoxLayout(self)
# grid
# message -> QLayout: Attempting to add QLayout "" to MyWidget "", which already has a layout
self.grid=QGridLayout()
# Line
#self.grid.addWidget(self.Line,0,0)
#combo box
self.combo_L = QComboBox(self)
self.combo_R = QComboBox(self)
self.combo_I = QComboBox(self)
for hd in df.columns.values:
header = hd #str(unicode(hd)) #unicode(hd, 'cp949') # Korean character
self.combo_L.addItem(header)
self.combo_R.addItem(header)
self.combo_I.addItem(header)
# Check Box
self.grid.addWidget(self.combo_L,0,0)
self.cb_L = QCheckBox("L cursor", self)
self.grid.addWidget(self.cb_L, 0, 1)
self.grid.addWidget(self.combo_R,1,0)
self.cb_R = QCheckBox("R cursor", self)
self.grid.addWidget(self.cb_R, 1, 1)
self.grid.addWidget(self.combo_I,2,0)
self.cb_I = QCheckBox("Select X-axis", self)
self.grid.addWidget(self.cb_I, 2, 1)
# Push Button
self.all_Visible=QPushButton('Show All', self)
self.all_Visible.clicked.connect(self.AllVisible)
self.all_Hide=QPushButton('Hide All', self)
self.all_Hide.clicked.connect(self.AllHide)
self.grid.addWidget(self.all_Visible,4,0)
self.grid.addWidget(self.all_Hide,5,0)
# Check Box
self.cb_TS = QCheckBox("X-axis is TimeStamp", self)
self.grid.addWidget(self.cb_TS, 4, 1)
self.cb_scale = QCheckBox("Auto Fit Height", self)
self.cb_scale.setCheckState(2)
self.grid.addWidget(self.cb_scale, 5, 1)
self.b_autoscale = True
self.topLayout.addLayout(self.grid)
# Scrollable Check Box
self.scrollArea = QScrollArea(self)
self.scrollArea.setWidgetResizable(True)
self.scrollAreaWidgetContents = QWidget(self.scrollArea)
self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(5,30,400,680))
self.scrollArea.setWidget(self.scrollAreaWidgetContents)
self.topLayout.addWidget(self.scrollArea)
self.gridScroll = QGridLayout(self.scrollAreaWidgetContents)
self.cb = []
i = 0 # layout index
for header in [column for column in df]:
c = QCheckBox(header, self)
c.stateChanged.connect(self.ToggleVisibility)
col_number = 2 # how many columns
j = (i-2) // col_number + 2
k = (i-2) % col_number
self.gridScroll.addWidget(c, j, k)
i += 1
self.cb.append(c)
# Status bar
self.StatusBar = QStatusBar(self)
self.topLayout.addWidget(self.StatusBar)
self.StatusBar.showMessage("Happy Day ")
self.setLayout(self.topLayout)
#self.Line,QtCore.SLOT('setText(QString)'))
self.combo_L.activated.connect(lambda: self.select_cursor_data(1))
self.combo_R.activated.connect(lambda: self.select_cursor_data(2))
self.combo_I.activated.connect(self.select_index)
self.cb_L.stateChanged.connect(self.cursor_on)
#.........这里部分代码省略.........
示例11: showMessage
# 需要导入模块: from PyQt5.QtWidgets import QStatusBar [as 别名]
# 或者: from PyQt5.QtWidgets.QStatusBar import showMessage [as 别名]
def showMessage(self, message, timeout):
if settings.SHOW_STATUS_NOTIFICATIONS:
self._widgetStatus.hide()
self._replaceWidget.setVisible(False)
self.show()
QStatusBar.showMessage(self, message, timeout)
示例12: MainWindow
# 需要导入模块: from PyQt5.QtWidgets import QStatusBar [as 别名]
# 或者: from PyQt5.QtWidgets.QStatusBar import showMessage [as 别名]
#.........这里部分代码省略.........
self.tableContents[rowIndex].set_rules(i)
else:
item = self.tableWidget.item(rowIndex, n)
item.setText(i)
def addRowSlot(self):
"""添加行"""
rowIndex = self.tableWidget.rowCount()
self.tableWidget.setRowCount(rowIndex + 1)
self.tableContents.append(Checker())
self.updateTableSlot(0) # 更新列表控件
log.debug(self.tableContents)
def delRowSlot(self):
"""删除行"""
# 焦点默认在第一行,要设置setFocusPolicy(Qt.NoFocus)
rowIndex = self.tableWidget.currentRow()
if rowIndex != -1:
self.tableWidget.removeRow(rowIndex)
self.tableContents.remove(self.tableContents[rowIndex])
log.debug(self.tableContents)
else:
QMessageBox.warning(self, self.tr("Warning"), self.tr("Please select a row."))
def loadData(self, data):
"""载入数据"""
self.tableContents = [] # list.clear() Python 3
for i in data:
self.tableContents.append(Checker(i))
def checkUpdateSlot(self):
"""执行更新检查"""
self.wtime[0] = int(time.time()) # 计时
self.statusbar.showMessage(self.tr("checking..."))
self.progressBar.setValue(0)
self.progressBar.show()
self.progressVal = 0
self.taskVal = 0
for t in range(self.workerCount):
t = WorkThread(self.q) # 耗时任务需要用线程执行,再刷新进度条
t.triggered.connect(self.updateTableSlot)
self.workers.append(t)
t.start() # 执行工作线程
# 填充队列
for item in self.tableContents:
self.q.put(item)
def updateTableSlot(self, val):
"""线程通过该槽,刷新进度条,表格内容"""
if val:
self.taskVal += val
self.progressVal = self.taskVal / len(self.tableContents) * 100
self.progressBar.setValue(self.progressVal)
self.label.setText("%s/%s" % (self.taskVal, len(self.tableContents)))
self.tableWidget.setRowCount(len(self.tableContents)) # 行数
for n, i in enumerate(self.tableContents):
items = i.dump()
for j in range(self.tableWidget.columnCount()):
item = QTableWidgetItem(items[j])
if j in [0, 1]:
item.setToolTip(item.text())
self.tableWidget.setItem(n, j, item)
self.setStatusColor(n)
示例13: MainWindow_Ui
# 需要导入模块: from PyQt5.QtWidgets import QStatusBar [as 别名]
# 或者: from PyQt5.QtWidgets.QStatusBar import showMessage [as 别名]
class MainWindow_Ui(QMainWindow):
def __init__(self):
super().__init__()
#MainWindow
self.resize(600, 400)
self.setMinimumSize(QSize(600, 400))
self.setMaximumSize(QSize(16777215, 16777215))
self.setWindowTitle("Persepolis Download Manager")
self.setWindowIcon(QIcon('icon'))
self.centralwidget = QWidget(self)
self.verticalLayout = QVBoxLayout(self.centralwidget)
#enable drag and drop
self.setAcceptDrops(True)
#frame
self.frame = QFrame(self.centralwidget)
self.frame.setGeometry(QRect(10, 10, 581, 251))
self.frame.setFrameShape(QFrame.StyledPanel)
self.frame.setFrameShadow(QFrame.Raised)
self.gridLayout = QGridLayout(self.frame)
#tablewidget
self.download_table = QTableWidget(self.frame)
self.download_table.setGeometry(QRect(10, 10, 560, 231))
self.download_table.setSizeIncrement(QSize(0, 0))
self.download_table.setColumnCount(10)
self.download_table.setSelectionBehavior(QAbstractItemView.SelectRows)
self.download_table.setEditTriggers(QAbstractItemView.NoEditTriggers)
self.download_table.verticalHeader().hide()
self.download_table.setColumnHidden(8 , True)
self.download_table.setColumnHidden(9 , True)
self.gridLayout.addWidget(self.download_table, 0, 0, 1, 1)
self.verticalLayout.addWidget(self.frame)
self.setCentralWidget(self.centralwidget)
download_table_header = ['File Name' , 'Status' , 'Size' , 'Downloaded' , 'Percentage' , 'Connections' , 'Transfer rate' , 'Estimate time left' , 'Gid' , 'Info']
self.download_table.setHorizontalHeaderLabels(download_table_header)
#fixing the size of download_table when window is Maximized!
self.download_table.horizontalHeader().setSectionResizeMode(0)
self.download_table.horizontalHeader().setStretchLastSection(True)
#finding number od row that user selected!
self.download_table.itemSelectionChanged.connect(self.selectedRow)
#menubar
self.menubar = QMenuBar(self)
self.menubar.setGeometry(QRect(0, 0, 600, 24))
self.setMenuBar(self.menubar)
fileMenu = self.menubar.addMenu('File')
editMenu = self.menubar.addMenu('Edit')
viewMenu = self.menubar.addMenu('View')
downloadMenu = self.menubar.addMenu('Download')
helpMenu = self.menubar.addMenu('Help')
#statusbar
self.statusbar = QStatusBar(self)
self.setStatusBar(self.statusbar)
self.statusbar.showMessage("Persepolis Download Manager")
#toolBar
self.toolBar = QToolBar(self)
self.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar)
self.toolBar.setWindowTitle("toolBar")
self.toolBar.setIconSize(QSize(38 , 38))
self.toolBar.setFloatable(False)
self.toolBar.setMovable(False)
#toolBar and menubar and actions
self.stopAllAction = QAction(QIcon(icons + 'stop_all') , 'Stop all active downloads' , self , statusTip = 'Stop all active downloads', triggered = self.stopAllDownloads )
downloadMenu.addAction(self.stopAllAction)
self.pauseAllAction = QAction(QIcon(icons + 'pause_all') , 'Pause all active downloads' , self , statusTip = 'Pause all active downloads', triggered = self.pauseAllDownloads )
downloadMenu.addAction(self.pauseAllAction)
self.minimizeAction = QAction(QIcon(icons + 'minimize') , 'Minimize to system tray' , self , shortcut = "Ctrl+W" , statusTip = "Minimize to system tray" , triggered = self.minMaxTray)
viewMenu.addAction(self.minimizeAction)
self.addlinkAction = QAction(QIcon(icons + 'add') , 'Add New Download Link' , self , shortcut = "Ctrl+N" , statusTip = "Add New Download Link" , triggered = self.addLinkButtonPressed)
fileMenu.addAction(self.addlinkAction)
self.resumeAction = QAction(QIcon(icons + 'play') , 'Resume Download' , self , shortcut = "Ctrl+R" , statusTip = "Resume Download" , triggered = self.resumeButtonPressed)
downloadMenu.addAction(self.resumeAction)
self.pauseAction = QAction(QIcon(icons + 'pause') , 'Pause Download' , self , shortcut = "Ctrl+C" , statusTip = "Pause Download" , triggered = self.pauseButtonPressed)
downloadMenu.addAction(self.pauseAction)
self.stopAction = QAction(QIcon(icons + 'stop') , 'Stop Download' , self , shortcut = "Ctrl+S" , statusTip = "Stop/Cancel Download" , triggered = self.stopButtonPressed)
downloadMenu.addAction(self.stopAction)
#.........这里部分代码省略.........
示例14: MainWindow
# 需要导入模块: from PyQt5.QtWidgets import QStatusBar [as 别名]
# 或者: from PyQt5.QtWidgets.QStatusBar import showMessage [as 别名]
#.........这里部分代码省略.........
def register_cue_menu_action(self, name, function, category='', shortcut=''):
"""Register a new-cue choice for the edit-menu
param name: The name for the MenuAction
param function: The function that add the new cue(s)
param category: The optional menu where insert the MenuAction
param shortcut: An optional shortcut for the MenuAction
"""
action = QAction(self)
action.setText(name)
action.triggered.connect(function)
if shortcut != '':
action.setShortcut(shortcut)
if category != '':
if category not in self._cue_add_menu:
menu = QMenu(category, self)
self._cue_add_menu[category] = menu
self.menuEdit.insertMenu(self.cueSeparator, menu)
self._cue_add_menu[category].addAction(action)
else:
self.menuEdit.insertAction(self.cueSeparator, action)
def update_window_title(self):
saved = MainActionsHandler().is_saved()
if not saved and not self.windowTitle()[0] == '*':
self.setWindowTitle('*' + self.windowTitle())
elif saved and self.windowTitle()[0] == '*':
self.setWindowTitle(self.windowTitle()[1:])
def _action_done(self, action):
self.statusBar.showMessage(action.log())
self.update_window_title()
def _action_undone(self, action):
self.statusBar.showMessage('Undone: ' + action.log())
self.update_window_title()
def _action_redone(self, action):
self.statusBar.showMessage('Redone: ' + action.log())
self.update_window_title()
def _save(self):
if self.filename == '':
self._save_with_name()
else:
self.save_session.emit(self.filename)
def _save_with_name(self):
filename, _ = QFileDialog.getSaveFileName(parent=self,
filter='*.lsp',
directory=os.getenv('HOME'))
if filename != '':
if not filename.endswith('.lsp'):
filename += '.lsp'
self.filename = filename
self._save()
def _show_preferences(self):
prefUi = AppSettings(configuration.config_to_dict(), parent=self)
prefUi.exec_()
if prefUi.result() == QDialog.Accepted:
configuration.update_config_from_dict(prefUi.get_configuraton())
示例15: MainWindow
# 需要导入模块: from PyQt5.QtWidgets import QStatusBar [as 别名]
# 或者: from PyQt5.QtWidgets.QStatusBar import showMessage [as 别名]
class MainWindow(QMainWindow):
l = logging.getLogger('MainWindow')
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()
def updateWindowTitle(self, title):
self.setWindowTitle('{} - MynPad'.format(title))
def saveState(self):
# Make sure that the current notepad page is saved
self.mainWidget.editorWidget.save()
# Note: there is no way to have eclipse shutdown the application faithfully,
# see also http://stackoverflow.com/questions/677531/is-it-possible-for-eclipse-to-terminate-gently-instead-of-using-sigkill
path = self.mainWidget.browserWidget.getCurrentPath()
self.settings.setBrowserPath(path)
self.settings.setMainWindowPos(self.pos())
self.settings.setMainWindowSize(self.size())
self.settings.save()
# Close all notepads - TODO (HACK)
for x in range (0, self.mainWidget.browserWidget.browserView.topLevelItemCount()):
notepad = self.mainWidget.browserWidget.browserView.topLevelItem(x).getNotepad()
notepad.close()
def handleAbout(self):
appVersion = "Development version"
pythonVersion = "%s.%s.%s (%s)" % (sys.version_info[0], sys.version_info[1], sys.version_info[2], sys.version_info[3])
pyQtVersion = PYQT_VERSION_STR
pyQtQtVersion = QT_VERSION_STR
qtRuntimeVersion = qVersion()
platformSystem = platform.system()
platformRelease = platform.release()
QMessageBox.about(self, "About MynPad",
"Copyright \u00a9 2015 by Andreas Fester<br/>"+
"<table>"+
"<tr><th align=\"right\">Application version:</th><td>{}</td></tr>".format(appVersion) +
"<tr><th align=\"right\">Python version:</th><td>{}</td></tr>".format(pythonVersion) +
"<tr><th align=\"right\">PyQt version:</th><td>{} for Qt {}</td></tr>".format(pyQtVersion, pyQtQtVersion) +
"<tr><th align=\"right\">Qt runtime version:</th><td>{}</td></tr>".format(qtRuntimeVersion)+
"<tr><th align=\"right\">Operating System:</th><td>{} {}</td></tr>".format(platformSystem, platformRelease)+
"<tr><th align=\"right\">sqlite version:</th><td>{}</td></tr>".format(sqlite3.version) +
#.........这里部分代码省略.........