def __init__(self, type):
super(FileTransferDialog, self).__init__(None, Qt.WindowTitleHint)
self.setupUi(self)
self.setModal(True)
self._transfer = FileTransfer(lambda: self._update_signal.emit())
if type == FileTransferDialog.UPLOAD:
self.label.setText("Saving file.")
self.progressBar.setRange(0, 100)
elif type == FileTransferDialog.DOWNLOAD:
self.label.setText("Reading file.")
self.progressBar.setRange(0, 0)
self.progressBar.setValue(0)
self._update_signal.connect(self._update_progress)
self.cancelButton.clicked.connect(self._transfer.cancel)
python类WindowTitleHint()的实例源码
def progress_start(title: str = '', length: int = 100, label: str = ''):
MainUiProgress.progress = QProgressDialog()
MainUiProgress.progress.setWindowFlags(Qt.FramelessWindowHint)
MainUiProgress.progress.setWindowFlags(Qt.WindowTitleHint)
MainUiProgress.progress.setMinimumWidth(400)
from PyQt5.QtWidgets import QPushButton
# QString() seems to be deprecated in v5
# PyQt does not support setCancelButton(0) as it expects a QPushButton instance
# Get your shit together, Qt !
MainUiProgress.progress.findChild(QPushButton).hide()
MainUiProgress.progress.setMinimumDuration(1)
MainUiProgress.progress.setWindowModality(Qt.ApplicationModal)
MainUiProgress.progress.setCancelButtonText('')
MainUiProgress.progress.setWindowIcon(QIcon(':/ico/app.ico'))
MainUiProgress.progress.setWindowTitle(title)
MainUiProgress.progress.setLabelText(label)
MainUiProgress.progress.setMaximum(length)
MainUiProgress.progress.show()
def __init__(self, parent):
super().__init__(parent=parent)
self.setupUi(self)
if parent:
self.move(
parent.window().frameGeometry().topLeft() + parent.window().rect().center() - self.rect().center()
)
self.setWindowFlags(Qt.WindowTitleHint | Qt.Dialog)
self.version.setText("Version: " + __version__)
copyright_text = self.copyright.text()
new_year = "2016-" + str(datetime.now().year) if datetime.now().year != 2016 else "2016"
copyright_text = copyright_text.replace("2016", new_year)
self.copyright.setText(copyright_text)
self.button.clicked.connect(self.close)
def __init__(self):
super(Mainframe, self).__init__()
self.setupUi(self)
self.setWindowFlags(Qt.WindowSystemMenuHint | Qt.WindowTitleHint)
window_icon = QIcon()
window_icon.addPixmap(QPixmap(join(cur_folder, "resources/window_icon.png")), QIcon.Normal, QIcon.Off)
self.setWindowIcon(window_icon)
self.buttonBox.accepted.connect(self.accepted)
self.buttonBox.rejected.connect(self.rejected)
self.path_button.clicked.connect(self.path_button_clicked)
self.package_path = ""
self.checked_validate = False
self.checked_warnings = False
if isdir(join(expanduser("~"), ".fomod")):
config = ConfigParser()
config.read_dict(default_settings)
config.read(join(expanduser("~"), ".fomod", ".validator"))
self.path_text.setText(config["Path"]["lastused"])
self.check_updates()
def __init__(self):
# Fucking QMainWindow calls a general super().__init__ on every parent class, don't call them here !
flags = Qt.WindowTitleHint | Qt.WindowSystemMenuHint | Qt.WindowCloseButtonHint
flags = flags | Qt.WindowMinimizeButtonHint | Qt.WindowMaximizeButtonHint
self.helpers = {}
QMainWindow.__init__(
self,
flags=flags
)
self.resize(1024, 768)
self.tabs = TabWidget()
layout = VLayout(
[
self.tabs
]
)
layout.setContentsMargins(10, 10, 10, 10)
window = Widget()
window.setLayout(layout)
self.setCentralWidget(window)
self.setWindowIcon(QIcon(constant.DEFAULT_ICON))
self.exit_shortcut = Shortcut(QKeySequence(Qt.Key_Escape), self, self.exit)
self.setWindowTitle(
'{} v{} - {}'.format(constant.APP_SHORT_NAME,
__version__,
constant.APP_RELEASE_NAME))
def __init__(self, parent=None):
super().__init__()
self.setFixedSize(950, 580)
self.setWindowTitle(self.tr("Lime GNU/Linux System Installer"))
self.setWindowIcon(QIcon(":/images/lilii-logo.svg"))
self.setWindowFlags(Qt.WindowTitleHint|Qt.WindowMinimizeButtonHint) #Qt.WindowStaysOnTopHint
x, y = (QDesktopWidget().width()-self.width())/2, (QDesktopWidget().availableGeometry().height()-self.height())/2
self.move(x, y)
layout = QVBoxLayout()
self.setLayout(layout)
self.wizardWidget = QStackedWidget()
self.wizardWidget.addWidget(WelcomeWidget(self))
self.wizardWidget.addWidget(LocationWidget(self))
self.wizardWidget.addWidget(KeyboardWidget(self))
self.wizardWidget.addWidget(PartitionWidget(self))
self.wizardWidget.addWidget(UserWidget(self))
self.wizardWidget.addWidget(SummaryWidget(self))
self.wizardWidget.addWidget(InstallWidget(self))
self.wizardWidget.addWidget(FinishWidget(self))
self.titleWidget = TitleWidget(self.wizardWidget)
self.footerWidget = FooterWidget(self.wizardWidget)
layout.addWidget(self.titleWidget)
layout.addWidget(self.wizardWidget)
layout.addWidget(self.footerWidget)
self.footerWidget.cancelButton.clicked.connect(self.close)
self.wizardWidget.widget(4).applyPage.connect(self.footerWidget.continueButton.setEnabled)
self.wizardWidget.widget(3).applyPage.connect(self.footerWidget.continueButton.setEnabled)
self.wizardWidget.widget(6).applyPage.connect(self.footerWidget.continueButton.setEnabled)
testwindowflags.py 文件源码
项目:incubator-senssoft-userale-pyqt5
作者: apache
项目源码
文件源码
阅读 20
收藏 0
点赞 0
评论 0
def setWindowFlags(self, flags):
super(PreviewWindow, self).setWindowFlags(flags)
flag_type = (flags & Qt.WindowType_Mask)
if flag_type == Qt.Window:
text = "Qt.Window"
elif flag_type == Qt.Dialog:
text = "Qt.Dialog"
elif flag_type == Qt.Sheet:
text = "Qt.Sheet"
elif flag_type == Qt.Drawer:
text = "Qt.Drawer"
elif flag_type == Qt.Popup:
text = "Qt.Popup"
elif flag_type == Qt.Tool:
text = "Qt.Tool"
elif flag_type == Qt.ToolTip:
text = "Qt.ToolTip"
elif flag_type == Qt.SplashScreen:
text = "Qt.SplashScreen"
else:
text = ""
if flags & Qt.MSWindowsFixedSizeDialogHint:
text += "\n| Qt.MSWindowsFixedSizeDialogHint"
if flags & Qt.X11BypassWindowManagerHint:
text += "\n| Qt.X11BypassWindowManagerHint"
if flags & Qt.FramelessWindowHint:
text += "\n| Qt.FramelessWindowHint"
if flags & Qt.WindowTitleHint:
text += "\n| Qt.WindowTitleHint"
if flags & Qt.WindowSystemMenuHint:
text += "\n| Qt.WindowSystemMenuHint"
if flags & Qt.WindowMinimizeButtonHint:
text += "\n| Qt.WindowMinimizeButtonHint"
if flags & Qt.WindowMaximizeButtonHint:
text += "\n| Qt.WindowMaximizeButtonHint"
if flags & Qt.WindowCloseButtonHint:
text += "\n| Qt.WindowCloseButtonHint"
if flags & Qt.WindowContextHelpButtonHint:
text += "\n| Qt.WindowContextHelpButtonHint"
if flags & Qt.WindowShadeButtonHint:
text += "\n| Qt.WindowShadeButtonHint"
if flags & Qt.WindowStaysOnTopHint:
text += "\n| Qt.WindowStaysOnTopHint"
if flags & Qt.WindowStaysOnBottomHint:
text += "\n| Qt.WindowStaysOnBottomHint"
if flags & Qt.CustomizeWindowHint:
text += "\n| Qt.CustomizeWindowHint"
self.textEdit.setPlainText(text)
testwindowflags.py 文件源码
项目:incubator-senssoft-userale-pyqt5
作者: apache
项目源码
文件源码
阅读 17
收藏 0
点赞 0
评论 0
def updatePreview(self):
flags = Qt.WindowFlags()
if self.windowRadioButton.isChecked():
flags = Qt.Window
elif self.dialogRadioButton.isChecked():
flags = Qt.Dialog
elif self.sheetRadioButton.isChecked():
flags = Qt.Sheet
elif self.drawerRadioButton.isChecked():
flags = Qt.Drawer
elif self.popupRadioButton.isChecked():
flags = Qt.Popup
elif self.toolRadioButton.isChecked():
flags = Qt.Tool
elif self.toolTipRadioButton.isChecked():
flags = Qt.ToolTip
elif self.splashScreenRadioButton.isChecked():
flags = Qt.SplashScreen
if self.msWindowsFixedSizeDialogCheckBox.isChecked():
flags |= Qt.MSWindowsFixedSizeDialogHint
if self.x11BypassWindowManagerCheckBox.isChecked():
flags |= Qt.X11BypassWindowManagerHint
if self.framelessWindowCheckBox.isChecked():
flags |= Qt.FramelessWindowHint
if self.windowTitleCheckBox.isChecked():
flags |= Qt.WindowTitleHint
if self.windowSystemMenuCheckBox.isChecked():
flags |= Qt.WindowSystemMenuHint
if self.windowMinimizeButtonCheckBox.isChecked():
flags |= Qt.WindowMinimizeButtonHint
if self.windowMaximizeButtonCheckBox.isChecked():
flags |= Qt.WindowMaximizeButtonHint
if self.windowCloseButtonCheckBox.isChecked():
flags |= Qt.WindowCloseButtonHint
if self.windowContextHelpButtonCheckBox.isChecked():
flags |= Qt.WindowContextHelpButtonHint
if self.windowShadeButtonCheckBox.isChecked():
flags |= Qt.WindowShadeButtonHint
if self.windowStaysOnTopCheckBox.isChecked():
flags |= Qt.WindowStaysOnTopHint
if self.windowStaysOnBottomCheckBox.isChecked():
flags |= Qt.WindowStaysOnBottomHint
if self.customizeWindowHintCheckBox.isChecked():
flags |= Qt.CustomizeWindowHint
self.previewWindow.setWindowFlags(flags)
pos = self.previewWindow.pos()
if pos.x() < 0:
pos.setX(0)
if pos.y() < 0:
pos.setY(0)
self.previewWindow.move(pos)
self.previewWindow.show()
def setWindowFlags(self, flags):
super(PreviewWindow, self).setWindowFlags(flags)
flag_type = (flags & Qt.WindowType_Mask)
if flag_type == Qt.Window:
text = "Qt.Window"
elif flag_type == Qt.Dialog:
text = "Qt.Dialog"
elif flag_type == Qt.Sheet:
text = "Qt.Sheet"
elif flag_type == Qt.Drawer:
text = "Qt.Drawer"
elif flag_type == Qt.Popup:
text = "Qt.Popup"
elif flag_type == Qt.Tool:
text = "Qt.Tool"
elif flag_type == Qt.ToolTip:
text = "Qt.ToolTip"
elif flag_type == Qt.SplashScreen:
text = "Qt.SplashScreen"
else:
text = ""
if flags & Qt.MSWindowsFixedSizeDialogHint:
text += "\n| Qt.MSWindowsFixedSizeDialogHint"
if flags & Qt.X11BypassWindowManagerHint:
text += "\n| Qt.X11BypassWindowManagerHint"
if flags & Qt.FramelessWindowHint:
text += "\n| Qt.FramelessWindowHint"
if flags & Qt.WindowTitleHint:
text += "\n| Qt.WindowTitleHint"
if flags & Qt.WindowSystemMenuHint:
text += "\n| Qt.WindowSystemMenuHint"
if flags & Qt.WindowMinimizeButtonHint:
text += "\n| Qt.WindowMinimizeButtonHint"
if flags & Qt.WindowMaximizeButtonHint:
text += "\n| Qt.WindowMaximizeButtonHint"
if flags & Qt.WindowCloseButtonHint:
text += "\n| Qt.WindowCloseButtonHint"
if flags & Qt.WindowContextHelpButtonHint:
text += "\n| Qt.WindowContextHelpButtonHint"
if flags & Qt.WindowShadeButtonHint:
text += "\n| Qt.WindowShadeButtonHint"
if flags & Qt.WindowStaysOnTopHint:
text += "\n| Qt.WindowStaysOnTopHint"
if flags & Qt.WindowStaysOnBottomHint:
text += "\n| Qt.WindowStaysOnBottomHint"
if flags & Qt.CustomizeWindowHint:
text += "\n| Qt.CustomizeWindowHint"
self.textEdit.setPlainText(text)
def updatePreview(self):
flags = Qt.WindowFlags()
if self.windowRadioButton.isChecked():
flags = Qt.Window
elif self.dialogRadioButton.isChecked():
flags = Qt.Dialog
elif self.sheetRadioButton.isChecked():
flags = Qt.Sheet
elif self.drawerRadioButton.isChecked():
flags = Qt.Drawer
elif self.popupRadioButton.isChecked():
flags = Qt.Popup
elif self.toolRadioButton.isChecked():
flags = Qt.Tool
elif self.toolTipRadioButton.isChecked():
flags = Qt.ToolTip
elif self.splashScreenRadioButton.isChecked():
flags = Qt.SplashScreen
if self.msWindowsFixedSizeDialogCheckBox.isChecked():
flags |= Qt.MSWindowsFixedSizeDialogHint
if self.x11BypassWindowManagerCheckBox.isChecked():
flags |= Qt.X11BypassWindowManagerHint
if self.framelessWindowCheckBox.isChecked():
flags |= Qt.FramelessWindowHint
if self.windowTitleCheckBox.isChecked():
flags |= Qt.WindowTitleHint
if self.windowSystemMenuCheckBox.isChecked():
flags |= Qt.WindowSystemMenuHint
if self.windowMinimizeButtonCheckBox.isChecked():
flags |= Qt.WindowMinimizeButtonHint
if self.windowMaximizeButtonCheckBox.isChecked():
flags |= Qt.WindowMaximizeButtonHint
if self.windowCloseButtonCheckBox.isChecked():
flags |= Qt.WindowCloseButtonHint
if self.windowContextHelpButtonCheckBox.isChecked():
flags |= Qt.WindowContextHelpButtonHint
if self.windowShadeButtonCheckBox.isChecked():
flags |= Qt.WindowShadeButtonHint
if self.windowStaysOnTopCheckBox.isChecked():
flags |= Qt.WindowStaysOnTopHint
if self.windowStaysOnBottomCheckBox.isChecked():
flags |= Qt.WindowStaysOnBottomHint
if self.customizeWindowHintCheckBox.isChecked():
flags |= Qt.CustomizeWindowHint
self.previewWindow.setWindowFlags(flags)
pos = self.previewWindow.pos()
if pos.x() < 0:
pos.setX(0)
if pos.y() < 0:
pos.setY(0)
self.previewWindow.move(pos)
self.previewWindow.show()
def setWindowFlags(self, flags):
super(PreviewWindow, self).setWindowFlags(flags)
flag_type = (flags & Qt.WindowType_Mask)
if flag_type == Qt.Window:
text = "Qt.Window"
elif flag_type == Qt.Dialog:
text = "Qt.Dialog"
elif flag_type == Qt.Sheet:
text = "Qt.Sheet"
elif flag_type == Qt.Drawer:
text = "Qt.Drawer"
elif flag_type == Qt.Popup:
text = "Qt.Popup"
elif flag_type == Qt.Tool:
text = "Qt.Tool"
elif flag_type == Qt.ToolTip:
text = "Qt.ToolTip"
elif flag_type == Qt.SplashScreen:
text = "Qt.SplashScreen"
else:
text = ""
if flags & Qt.MSWindowsFixedSizeDialogHint:
text += "\n| Qt.MSWindowsFixedSizeDialogHint"
if flags & Qt.X11BypassWindowManagerHint:
text += "\n| Qt.X11BypassWindowManagerHint"
if flags & Qt.FramelessWindowHint:
text += "\n| Qt.FramelessWindowHint"
if flags & Qt.WindowTitleHint:
text += "\n| Qt.WindowTitleHint"
if flags & Qt.WindowSystemMenuHint:
text += "\n| Qt.WindowSystemMenuHint"
if flags & Qt.WindowMinimizeButtonHint:
text += "\n| Qt.WindowMinimizeButtonHint"
if flags & Qt.WindowMaximizeButtonHint:
text += "\n| Qt.WindowMaximizeButtonHint"
if flags & Qt.WindowCloseButtonHint:
text += "\n| Qt.WindowCloseButtonHint"
if flags & Qt.WindowContextHelpButtonHint:
text += "\n| Qt.WindowContextHelpButtonHint"
if flags & Qt.WindowShadeButtonHint:
text += "\n| Qt.WindowShadeButtonHint"
if flags & Qt.WindowStaysOnTopHint:
text += "\n| Qt.WindowStaysOnTopHint"
if flags & Qt.WindowStaysOnBottomHint:
text += "\n| Qt.WindowStaysOnBottomHint"
if flags & Qt.CustomizeWindowHint:
text += "\n| Qt.CustomizeWindowHint"
self.textEdit.setPlainText(text)
def updatePreview(self):
flags = Qt.WindowFlags()
if self.windowRadioButton.isChecked():
flags = Qt.Window
elif self.dialogRadioButton.isChecked():
flags = Qt.Dialog
elif self.sheetRadioButton.isChecked():
flags = Qt.Sheet
elif self.drawerRadioButton.isChecked():
flags = Qt.Drawer
elif self.popupRadioButton.isChecked():
flags = Qt.Popup
elif self.toolRadioButton.isChecked():
flags = Qt.Tool
elif self.toolTipRadioButton.isChecked():
flags = Qt.ToolTip
elif self.splashScreenRadioButton.isChecked():
flags = Qt.SplashScreen
if self.msWindowsFixedSizeDialogCheckBox.isChecked():
flags |= Qt.MSWindowsFixedSizeDialogHint
if self.x11BypassWindowManagerCheckBox.isChecked():
flags |= Qt.X11BypassWindowManagerHint
if self.framelessWindowCheckBox.isChecked():
flags |= Qt.FramelessWindowHint
if self.windowTitleCheckBox.isChecked():
flags |= Qt.WindowTitleHint
if self.windowSystemMenuCheckBox.isChecked():
flags |= Qt.WindowSystemMenuHint
if self.windowMinimizeButtonCheckBox.isChecked():
flags |= Qt.WindowMinimizeButtonHint
if self.windowMaximizeButtonCheckBox.isChecked():
flags |= Qt.WindowMaximizeButtonHint
if self.windowCloseButtonCheckBox.isChecked():
flags |= Qt.WindowCloseButtonHint
if self.windowContextHelpButtonCheckBox.isChecked():
flags |= Qt.WindowContextHelpButtonHint
if self.windowShadeButtonCheckBox.isChecked():
flags |= Qt.WindowShadeButtonHint
if self.windowStaysOnTopCheckBox.isChecked():
flags |= Qt.WindowStaysOnTopHint
if self.windowStaysOnBottomCheckBox.isChecked():
flags |= Qt.WindowStaysOnBottomHint
if self.customizeWindowHintCheckBox.isChecked():
flags |= Qt.CustomizeWindowHint
self.previewWindow.setWindowFlags(flags)
pos = self.previewWindow.pos()
if pos.x() < 0:
pos.setX(0)
if pos.y() < 0:
pos.setY(0)
self.previewWindow.move(pos)
self.previewWindow.show()
def setWindowFlags(self, flags):
super(PreviewWindow, self).setWindowFlags(flags)
flag_type = (flags & Qt.WindowType_Mask)
if flag_type == Qt.Window:
text = "Qt.Window"
elif flag_type == Qt.Dialog:
text = "Qt.Dialog"
elif flag_type == Qt.Sheet:
text = "Qt.Sheet"
elif flag_type == Qt.Drawer:
text = "Qt.Drawer"
elif flag_type == Qt.Popup:
text = "Qt.Popup"
elif flag_type == Qt.Tool:
text = "Qt.Tool"
elif flag_type == Qt.ToolTip:
text = "Qt.ToolTip"
elif flag_type == Qt.SplashScreen:
text = "Qt.SplashScreen"
else:
text = ""
if flags & Qt.MSWindowsFixedSizeDialogHint:
text += "\n| Qt.MSWindowsFixedSizeDialogHint"
if flags & Qt.X11BypassWindowManagerHint:
text += "\n| Qt.X11BypassWindowManagerHint"
if flags & Qt.FramelessWindowHint:
text += "\n| Qt.FramelessWindowHint"
if flags & Qt.WindowTitleHint:
text += "\n| Qt.WindowTitleHint"
if flags & Qt.WindowSystemMenuHint:
text += "\n| Qt.WindowSystemMenuHint"
if flags & Qt.WindowMinimizeButtonHint:
text += "\n| Qt.WindowMinimizeButtonHint"
if flags & Qt.WindowMaximizeButtonHint:
text += "\n| Qt.WindowMaximizeButtonHint"
if flags & Qt.WindowCloseButtonHint:
text += "\n| Qt.WindowCloseButtonHint"
if flags & Qt.WindowContextHelpButtonHint:
text += "\n| Qt.WindowContextHelpButtonHint"
if flags & Qt.WindowShadeButtonHint:
text += "\n| Qt.WindowShadeButtonHint"
if flags & Qt.WindowStaysOnTopHint:
text += "\n| Qt.WindowStaysOnTopHint"
if flags & Qt.WindowStaysOnBottomHint:
text += "\n| Qt.WindowStaysOnBottomHint"
if flags & Qt.CustomizeWindowHint:
text += "\n| Qt.CustomizeWindowHint"
self.textEdit.setPlainText(text)
def updatePreview(self):
flags = Qt.WindowFlags()
if self.windowRadioButton.isChecked():
flags = Qt.Window
elif self.dialogRadioButton.isChecked():
flags = Qt.Dialog
elif self.sheetRadioButton.isChecked():
flags = Qt.Sheet
elif self.drawerRadioButton.isChecked():
flags = Qt.Drawer
elif self.popupRadioButton.isChecked():
flags = Qt.Popup
elif self.toolRadioButton.isChecked():
flags = Qt.Tool
elif self.toolTipRadioButton.isChecked():
flags = Qt.ToolTip
elif self.splashScreenRadioButton.isChecked():
flags = Qt.SplashScreen
if self.msWindowsFixedSizeDialogCheckBox.isChecked():
flags |= Qt.MSWindowsFixedSizeDialogHint
if self.x11BypassWindowManagerCheckBox.isChecked():
flags |= Qt.X11BypassWindowManagerHint
if self.framelessWindowCheckBox.isChecked():
flags |= Qt.FramelessWindowHint
if self.windowTitleCheckBox.isChecked():
flags |= Qt.WindowTitleHint
if self.windowSystemMenuCheckBox.isChecked():
flags |= Qt.WindowSystemMenuHint
if self.windowMinimizeButtonCheckBox.isChecked():
flags |= Qt.WindowMinimizeButtonHint
if self.windowMaximizeButtonCheckBox.isChecked():
flags |= Qt.WindowMaximizeButtonHint
if self.windowCloseButtonCheckBox.isChecked():
flags |= Qt.WindowCloseButtonHint
if self.windowContextHelpButtonCheckBox.isChecked():
flags |= Qt.WindowContextHelpButtonHint
if self.windowShadeButtonCheckBox.isChecked():
flags |= Qt.WindowShadeButtonHint
if self.windowStaysOnTopCheckBox.isChecked():
flags |= Qt.WindowStaysOnTopHint
if self.windowStaysOnBottomCheckBox.isChecked():
flags |= Qt.WindowStaysOnBottomHint
if self.customizeWindowHintCheckBox.isChecked():
flags |= Qt.CustomizeWindowHint
self.previewWindow.setWindowFlags(flags)
pos = self.previewWindow.pos()
if pos.x() < 0:
pos.setX(0)
if pos.y() < 0:
pos.setY(0)
self.previewWindow.move(pos)
self.previewWindow.show()