本文整理汇总了Python中PyQt5.QtCore.Qt.WindowModal方法的典型用法代码示例。如果您正苦于以下问题:Python Qt.WindowModal方法的具体用法?Python Qt.WindowModal怎么用?Python Qt.WindowModal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtCore.Qt
的用法示例。
在下文中一共展示了Qt.WindowModal方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: progress_dialog
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import WindowModal [as 别名]
def progress_dialog(message):
prgr_dialog = QProgressDialog()
prgr_dialog.setFixedSize(300, 50)
prgr_dialog.setAutoFillBackground(True)
prgr_dialog.setWindowModality(Qt.WindowModal)
prgr_dialog.setWindowTitle('Please wait')
prgr_dialog.setLabelText(message)
prgr_dialog.setSizeGripEnabled(False)
prgr_dialog.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
prgr_dialog.setWindowFlag(Qt.WindowContextHelpButtonHint, False)
prgr_dialog.setWindowFlag(Qt.WindowCloseButtonHint, False)
prgr_dialog.setModal(True)
prgr_dialog.setCancelButton(None)
prgr_dialog.setRange(0, 0)
prgr_dialog.setMinimumDuration(0)
prgr_dialog.setAutoClose(False)
return prgr_dialog
示例2: show_news_message
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import WindowModal [as 别名]
def show_news_message(self, gateway, title, message):
msgbox = QMessageBox(self)
msgbox.setWindowModality(Qt.WindowModal)
icon_filepath = os.path.join(gateway.nodedir, "icon")
if os.path.exists(icon_filepath):
msgbox.setIconPixmap(QIcon(icon_filepath).pixmap(64, 64))
elif os.path.exists(resource("tahoe-lafs.png")):
msgbox.setIconPixmap(
QIcon(resource("tahoe-lafs.png")).pixmap(64, 64)
)
else:
msgbox.setIcon(QMessageBox.Information)
if sys.platform == "darwin":
msgbox.setText(title)
msgbox.setInformativeText(message)
else:
msgbox.setWindowTitle(title)
msgbox.setText(message)
msgbox.show()
try:
self.gui.unread_messages.remove((gateway, title, message))
except ValueError:
return
self.gui.systray.update()
示例3: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import WindowModal [as 别名]
def __init__(self, parent):
super().__init__(None, Qt.WindowSystemMenuHint | Qt.WindowTitleHint)
self.parent = parent
self.setWindowModality(Qt.WindowModal)
self.groups = self.parent.channels.groups
self.index = {}
self.cycles = None
self.create_widgets()
示例4: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import WindowModal [as 别名]
def __init__(self, parent):
super().__init__(None, Qt.WindowSystemMenuHint | Qt.WindowTitleHint)
self.parent = parent
self.setWindowTitle('Export events')
self.setWindowModality(Qt.WindowModal)
self.filename = None
self.create_dialog()
示例5: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import WindowModal [as 别名]
def __init__(self, parent):
super().__init__(parent)
self.setMinimumSize(400, 500)
self.setWindowFlags(Qt.Window)
self.setWindowModality(Qt.WindowModal)
self.setAttribute(Qt.WA_DeleteOnClose, True)
logging.debug('ElementEditor::__init__() called')
示例6: edit
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import WindowModal [as 别名]
def edit(self):
logging.debug('edit() called ExecBranch')
self.branchEditLayout = QVBoxLayout()
self.branchEdit = QWidget(self)
self.branchEdit.setMinimumSize(500, 400)
self.branchEdit.setWindowFlags(Qt.Window)
self.branchEdit.setWindowModality(Qt.WindowModal)
self.branchEdit.setWindowTitle('Edit Branch')
self.selectCondition = QComboBox()
self.selectCondition.addItem('Greater than (>) ...', QVariant('>'))
self.selectCondition.addItem('Greater or equal than (>=) ...', QVariant('>='))
self.selectCondition.addItem('Less than (<) ...', QVariant('<'))
self.selectCondition.addItem('Less or equal than (<=) ...', QVariant('<='))
self.selectCondition.addItem('equal to (==) ...', QVariant('=='))
self.selectCondition.addItem('NOT equal to (!=) ...', QVariant('!='))
self.checkNegate = QCheckBox('Negate query (if NOT ... )')
self.checkNegate.stateChanged.connect(self.negate_changed)
self.if_text_1 = QLabel()
self.if_text_1.setText('if INPUT is ...')
self.branchEditLayout.addWidget(self.checkNegate)
self.branchEditLayout.addWidget(self.if_text_1)
self.branchEditLayout.addWidget(self.selectCondition)
self.branchEditLayout.addStretch(1)
self.branchEdit.setLayout(self.branchEditLayout)
self.branchEdit.show()
示例7: raiseWindow
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import WindowModal [as 别名]
def raiseWindow(self):
logging.debug('raiseWindow() called')
self.setMinimumSize(400, 300)
self.setWindowFlags(Qt.Window)
self.setWindowTitle(QC.translate('', 'Debug'))
self.setWindowModality(Qt.WindowModal)
self.confirm_button = QPushButton()
self.confirm_button.setText(QC.translate('', 'Ok'))
self.confirm_button.clicked.connect(self.close)
self.headline = QFont("Arial", 10, QFont.Bold)
self.info_string = QC.translate('', 'Debug info of element:')
self.elementInfo = QLabel()
self.elementInfo.setFont(self.headline)
self.elementInfo.setText(self.info_string + '{} {}'.format(self.source[0],
alphabet[self.source[1]]))
self.debugMessage = QTextEdit()
self.debugMessage.setReadOnly(True)
self.debugMessage.setText(self.message)
self.debugWindowLayout = QVBoxLayout()
self.debugWindowLayout.addWidget(self.elementInfo)
self.debugWindowLayout.addWidget(self.debugMessage)
self.debugWindowLayout.addStretch(1)
self.debugWindowLayout.addWidget(self.confirm_button)
self.setLayout(self.debugWindowLayout)
self.show()
示例8: _select
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import WindowModal [as 别名]
def _select(self, choices):
if not choices:
return []
dialog = QDialog(mw)
layout = QVBoxLayout()
listWidget = QListWidget()
listWidget.setSelectionMode(QAbstractItemView.ExtendedSelection)
for c in choices:
item = QListWidgetItem(c['text'])
item.setData(Qt.UserRole, c['data'])
listWidget.addItem(item)
buttonBox = QDialogButtonBox(
QDialogButtonBox.Close | QDialogButtonBox.Save
)
buttonBox.accepted.connect(dialog.accept)
buttonBox.rejected.connect(dialog.reject)
buttonBox.setOrientation(Qt.Horizontal)
layout.addWidget(listWidget)
layout.addWidget(buttonBox)
dialog.setLayout(layout)
dialog.setWindowModality(Qt.WindowModal)
dialog.resize(500, 500)
choice = dialog.exec_()
if choice == 1:
return [
listWidget.item(i).data(Qt.UserRole)
for i in range(listWidget.count())
if listWidget.item(i).isSelected()
]
return []
示例9: setPropertyForAllObjects
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import WindowModal [as 别名]
def setPropertyForAllObjects(self):
selectedPropertyIndices = self.selectedColumns() if self.model().isRowObjects else self.selectedRows()
if len(selectedPropertyIndices) != 1:
errorDialog = QErrorMessage(self)
rowOrColumn = "column" if self.model().isRowObjects else "row"
errorDialog.showMessage("Must select a single property " + rowOrColumn + ".")
errorDialog.exec_()
return
try:
propertyIndex = selectedPropertyIndices[0]
dtype = self.model().propertyType(propertyIndex)
if dtype is None:
return
obj = self.model().objects[0]
prop = self.model().properties[propertyIndex]
if "Write" not in prop.get('mode', "Read/Write"):
return
model = ObjListTableModel([obj], [prop], self.model().isRowObjects, False)
view = ObjListTable(model)
dialog = QDialog(self)
buttons = QDialogButtonBox(QDialogButtonBox.Ok)
buttons.accepted.connect(dialog.accept)
buttons.rejected.connect(dialog.reject)
vbox = QVBoxLayout(dialog)
vbox.addWidget(view)
vbox.addWidget(buttons)
dialog.setWindowModality(Qt.WindowModal)
dialog.exec_()
for objectIndex, obj in enumerate(self.model().objects):
row = objectIndex if self.model().isRowObjects else propertyIndex
col = propertyIndex if self.model().isRowObjects else objectIndex
index = self.model().index(row, col)
if objectIndex == 0:
value = self.model().data(index)
else:
if prop.get('action', '') == "fileDialog":
try:
getAttrRecursive(obj, prop['attr'])(value)
self.model().dataChanged.emit(index, index) # Tell model to update cell display.
except:
self.model().setData(index, value)
self.model().dataChanged.emit(index, index) # Tell model to update cell display.
else:
self.model().setData(index, value)
self.model().dataChanged.emit(index, index) # Tell model to update cell display.
except:
pass
示例10: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import WindowModal [as 别名]
def __init__(self, gui, show_open_action=True):
super(Menu, self).__init__()
self.gui = gui
self.about_msg = QMessageBox()
self.about_msg.setWindowTitle("{} - About".format(APP_NAME))
app_icon = QIcon(resource(settings["application"]["tray_icon"]))
self.about_msg.setIconPixmap(app_icon.pixmap(64, 64))
self.about_msg.setText("{} {}".format(APP_NAME, __version__))
self.about_msg.setWindowModality(Qt.WindowModal)
if show_open_action:
open_action = QAction(QIcon(""), "Open {}".format(APP_NAME), self)
open_action.triggered.connect(self.gui.show)
self.addAction(open_action)
self.addSeparator()
preferences_action = QAction(QIcon(""), "Preferences...", self)
preferences_action.triggered.connect(self.gui.show_preferences_window)
self.addAction(preferences_action)
help_menu = QMenu(self)
help_menu.setTitle("Help")
help_settings = settings.get("help")
if help_settings:
if help_settings.get("docs_url"):
docs_action = QAction(
QIcon(""), "Browse Documentation...", self
)
docs_action.triggered.connect(
lambda: webbrowser.open(settings["help"]["docs_url"])
)
help_menu.addAction(docs_action)
if help_settings.get("issues_url"):
issue_action = QAction(QIcon(""), "Report Issue...", self)
issue_action.triggered.connect(
lambda: webbrowser.open(settings["help"]["issues_url"])
)
help_menu.addAction(issue_action)
export_action = QAction(QIcon(""), "Export Debug Information...", self)
export_action.triggered.connect(self.gui.show_debug_exporter)
help_menu.addAction(export_action)
help_menu.addSeparator()
about_action = QAction(QIcon(""), "About {}...".format(APP_NAME), self)
about_action.triggered.connect(self.about_msg.exec_)
help_menu.addAction(about_action)
self.addMenu(help_menu)
self.addSeparator()
quit_action = QAction(QIcon(""), "&Quit {}".format(APP_NAME), self)
quit_action.triggered.connect(self.gui.main_window.confirm_quit)
self.addAction(quit_action)