我们从Python开源项目中,提取了以下40个代码示例,用于说明如何使用PyQt5.QtCore.Qt.Window()。
def __init__(self, dirname, morph, configurations, parent): super().__init__() uic.loadUi('sources/DialogClassificationLib.ui', self) flags = Qt.Window | Qt.WindowSystemMenuHint | Qt.WindowMinimizeButtonHint | Qt.WindowMaximizeButtonHint | Qt.WindowCloseButtonHint self.setWindowFlags(flags) self.morph = morph self.configurations = configurations self.parent = parent self.input_dir = dirname self.lineEditInputDir.setText(dirname) self.profiler = Profiler() self.setAttribute(QtCore.Qt.WA_DeleteOnClose) self.buttonClassify.clicked.connect(self.makeClassification) output_dir = self.configurations.get("output_files_directory", "output_files") self.calculator = ClassificationLibCalculator(self.input_dir, output_dir, morph, self.configurations) self.calculator.signals.Finished.connect(self.onCalculationFinish) self.calculator.signals.UpdateProgressBar.connect(self.onUpdateProgressBar) self.calculator.signals.PrintInfo.connect(self.onTextLogAdd) self.output_dir = configurations.get("output_files_directory", "output_files/classification") + "/"
def __init__(self): super(ControllerWindow, self).__init__() self.previewWindow = PreviewWindow(self) self.createTypeGroupBox() self.createHintsGroupBox() quitButton = QPushButton("&Quit") quitButton.clicked.connect(self.close) bottomLayout = QHBoxLayout() bottomLayout.addStretch() bottomLayout.addWidget(quitButton) mainLayout = QVBoxLayout() mainLayout.addWidget(self.typeGroupBox) mainLayout.addWidget(self.hintsGroupBox) mainLayout.addLayout(bottomLayout) self.setLayout(mainLayout) self.setWindowTitle("Window Flags") self.updatePreview()
def createTypeGroupBox(self): self.typeGroupBox = QGroupBox("Type") self.windowRadioButton = self.createRadioButton("Window") self.dialogRadioButton = self.createRadioButton("Dialog") self.sheetRadioButton = self.createRadioButton("Sheet") self.drawerRadioButton = self.createRadioButton("Drawer") self.popupRadioButton = self.createRadioButton("Popup") self.toolRadioButton = self.createRadioButton("Tool") self.toolTipRadioButton = self.createRadioButton("Tooltip") self.splashScreenRadioButton = self.createRadioButton("Splash screen") self.windowRadioButton.setChecked(True) layout = QGridLayout() layout.addWidget(self.windowRadioButton, 0, 0) layout.addWidget(self.dialogRadioButton, 1, 0) layout.addWidget(self.sheetRadioButton, 2, 0) layout.addWidget(self.drawerRadioButton, 3, 0) layout.addWidget(self.popupRadioButton, 0, 1) layout.addWidget(self.toolRadioButton, 1, 1) layout.addWidget(self.toolTipRadioButton, 2, 1) layout.addWidget(self.splashScreenRadioButton, 3, 1) self.typeGroupBox.setLayout(layout)
def __init__(self, parent=None): super(ConsoleWidget, self).__init__(parent) self.parent = parent self.edit = VideoConsole(self) buttons = QDialogButtonBox() buttons.setCenterButtons(True) clearButton = buttons.addButton('Clear', QDialogButtonBox.ResetRole) clearButton.clicked.connect(self.edit.clear) closeButton = buttons.addButton(QDialogButtonBox.Close) closeButton.clicked.connect(self.close) closeButton.setDefault(True) layout = QVBoxLayout() layout.addWidget(self.edit) layout.addWidget(buttons) self.setLayout(layout) self.setWindowTitle('{0} Console'.format(qApp.applicationName())) self.setWindowFlags(Qt.Window | Qt.WindowCloseButtonHint) self.setWindowModality(Qt.NonModal)
def __init__(self, filenames, morph, configurations, parent): super().__init__() uic.loadUi('sources/DialogDecomposeAndRuleApply.ui', self) flags = Qt.Window | Qt.WindowSystemMenuHint | Qt.WindowMinimizeButtonHint | Qt.WindowCloseButtonHint; self.setWindowFlags(flags) self.filenames = filenames self.morph = morph self.configurations = configurations self.parent = parent self.profiler = Profiler() self.nu = [] self.ns = [] self.nv = [] self.all_idf_word_keys = [] self.texts = [] self.setAttribute(QtCore.Qt.WA_DeleteOnClose) self.buttonProcess.clicked.connect(self.process) self.textEdit.setText("")
def __init__(self, parent=None): QDialog.__init__(self, parent) self.setupUi(self) self.setWindowFlags(Qt.Window) if (prefs['yy'] == '1'): self.getUsername.hide() self.getPassword.hide() self.label_2.hide() self.logout_button.clicked.connect(self.logout) self.label.setText("Now Session : " + prefs['username']) if (prefs['yy'] == '0'): self.logout_button.hide() self.getUsername.show() self.getPassword.show() self.label_2.show() self.getUsername.setText(prefs['username']) self.getPassword.setEchoMode(QLineEdit.Password) self.getPassword.setText(prefs['password']) self.downloadButton.clicked.connect(self.download) self.uploadButton.clicked.connect(self.upload) self.pushButton.clicked.connect(self.push) self.pullButton.clicked.connect(self.pull)
def __init__(self, parent = None): QDialog.__init__(self, parent) self.setupUi(self) self.setWindowFlags(Qt.Window) if (prefs['dd'] == '1'): self.getUsername.hide() self.getPassword.hide() self.label_2.hide() self.logout_button.clicked.connect(self.logout) if (prefs['dd'] == '0'): self.logout_button.hide() self.getUsername.show() self.getPassword.show() self.label_2.show() self.getUsername.setText(prefs['d_username']) self.getPassword.setEchoMode(QLineEdit.Password) self.getPassword.setText(prefs['d_password']) self.downloadButton.clicked.connect(self.download) self.uploadButton.clicked.connect(self.upload) self.pushButton.clicked.connect(self.push) self.pullButton.clicked.connect(self.pull)
def createHintsGroupBox(self): self.hintsGroupBox = QGroupBox("Hints") self.msWindowsFixedSizeDialogCheckBox = self.createCheckBox("MS Windows fixed size dialog") self.x11BypassWindowManagerCheckBox = self.createCheckBox("X11 bypass window manager") self.framelessWindowCheckBox = self.createCheckBox("Frameless window") self.windowTitleCheckBox = self.createCheckBox("Window title") self.windowSystemMenuCheckBox = self.createCheckBox("Window system menu") self.windowMinimizeButtonCheckBox = self.createCheckBox("Window minimize button") self.windowMaximizeButtonCheckBox = self.createCheckBox("Window maximize button") self.windowCloseButtonCheckBox = self.createCheckBox("Window close button") self.windowContextHelpButtonCheckBox = self.createCheckBox("Window context help button") self.windowShadeButtonCheckBox = self.createCheckBox("Window shade button") self.windowStaysOnTopCheckBox = self.createCheckBox("Window stays on top") self.windowStaysOnBottomCheckBox = self.createCheckBox("Window stays on bottom") self.customizeWindowHintCheckBox = self.createCheckBox("Customize window") layout = QGridLayout() layout.addWidget(self.msWindowsFixedSizeDialogCheckBox, 0, 0) layout.addWidget(self.x11BypassWindowManagerCheckBox, 1, 0) layout.addWidget(self.framelessWindowCheckBox, 2, 0) layout.addWidget(self.windowTitleCheckBox, 3, 0) layout.addWidget(self.windowSystemMenuCheckBox, 4, 0) layout.addWidget(self.windowMinimizeButtonCheckBox, 0, 1) layout.addWidget(self.windowMaximizeButtonCheckBox, 1, 1) layout.addWidget(self.windowCloseButtonCheckBox, 2, 1) layout.addWidget(self.windowContextHelpButtonCheckBox, 3, 1) layout.addWidget(self.windowShadeButtonCheckBox, 4, 1) layout.addWidget(self.windowStaysOnTopCheckBox, 5, 1) layout.addWidget(self.windowStaysOnBottomCheckBox, 6, 1) layout.addWidget(self.customizeWindowHintCheckBox, 5, 0) self.hintsGroupBox.setLayout(layout)
def __init__(self, parent=None, flags=Qt.Window): super(BaseMainWindow, self).__init__(parent, flags) self.setAttribute(Qt.WA_DeleteOnClose) _bootstrapGCCache(self)
def __init__(self, parent=None, flags=Qt.Window): super(BaseWindow, self).__init__(parent, flags) self.setAttribute(Qt.WA_DeleteOnClose) _bootstrapGCCache(self)
def __init__(self, filename, morph, configurations, parent): super().__init__() uic.loadUi('sources/XiSquare.ui', self) self.configurations = configurations flags = Qt.Window | Qt.WindowSystemMenuHint | Qt.WindowMinimizeButtonHint | Qt.WindowCloseButtonHint; self.setWindowFlags(flags) self.parent = parent self.all_idf_word_keys = [] self.input_path = '' self.setAttribute(QtCore.Qt.WA_DeleteOnClose) self.buttonProcess.clicked.connect(self.processIt) self.textEdit.setText("") self.profiler = Profiler() self.configurations["minimal_word_size"] = 4 self.configurations["cut_ADJ"] = False output_dir = self.configurations.get("output_files_directory", "output_files") self.progressBar.setValue(0) self.checkBoxNeedApriori.toggled.connect(self.onActivateApriori) self.groupBoxApriori.setVisible(False) self.calculator = XiCalculator(filename, output_dir, morph, self.configurations) self.calculator.signals.Finished.connect(self.onCalculationFinish) self.calculator.signals.UpdateProgressBar.connect(self.onUpdateProgressBar) self.calculator.signals.PrintInfo.connect(self.onTextLogAdd)
def __init__(self): super().__init__() self.setupUi(self) flags = Qt.Window | Qt.WindowSystemMenuHint | Qt.WindowMinMaxButtonsHint | Qt.WindowCloseButtonHint; self.setWindowFlags(flags) fig = Figure() self.addmpl(fig)
def __init__(self, filenames, morph, configurations, parent): super().__init__() uic.loadUi('sources/DialogConfigLSA.ui', self) self.morph = morph self.configurations = configurations self.parent = parent self.xs = [] self.ys = [] self.short_filenames = [] self.similarity = None self.profiler = Profiler() flags = Qt.Window | Qt.WindowSystemMenuHint | Qt.WindowMinimizeButtonHint | Qt.WindowCloseButtonHint; self.setWindowFlags(flags) self.setAttribute(QtCore.Qt.WA_DeleteOnClose) self.buttonMakeLSA.clicked.connect(self.makeLSA) self.button2DView.clicked.connect(self.make2DView) self.buttonRelationTable.clicked.connect(self.showRelationTable) self.radio_preprocessing_full.toggled.connect(self.onChangePreprocMethod) self.radio_preprocessing_stopwords.toggled.connect(self.onChangePreprocMethod) output_dir = self.configurations.get("output_files_directory", "output_files") self.calculator = LsaCalculator(filenames, self.configurations, output_dir, morph, self.textEdit) self.calculator.signals.Finished.connect(self.onCalculationFinish) self.calculator.signals.UpdateProgressBar.connect(self.onUpdateProgressBar) self.calculator.signals.PrintInfo.connect(self.onTextLogAdd) self.textEdit.setText("")
def __init__(self, dirname, morph, configurations, parent): super().__init__() uic.loadUi('sources/DialogConfigClassification.ui', self) flags = Qt.Window | Qt.WindowSystemMenuHint | Qt.WindowMinimizeButtonHint | Qt.WindowCloseButtonHint self.setWindowFlags(flags) self.morph = morph self.configurations = configurations self.parent = parent self.input_dir = dirname self.lineEditInputDir.setText(dirname) self.profiler = Profiler() self.setAttribute(QtCore.Qt.WA_DeleteOnClose) self.buttonClassify.clicked.connect(self.makeClassification) self.textEdit.setText("") self.groupBox_KNN.setVisible(False) self.radioButtonNaiveBayes.toggled.connect(self.onChangeMethod) self.radioButtonRocchio.toggled.connect(self.onChangeMethod) self.radioButtonKNN.toggled.connect(self.onChangeMethod) self.radioButtonLLSF.toggled.connect(self.onChangeMethod) self.radioButtonID3.toggled.connect(self.onChangeMethod) output_dir = self.configurations.get("output_files_directory", "output_files") self.calculator = ClassificationCalculator(self.input_dir, output_dir, morph, self.configurations) self.calculator.signals.Finished.connect(self.onCalculationFinish) self.calculator.signals.UpdateProgressBar.connect(self.onUpdateProgressBar) self.calculator.signals.PrintInfo.connect(self.onTextLogAdd) self.output_dir = configurations.get("output_files_directory", "output_files/classification") + "/"
def __init__(self, filenames, morph, configurations, parent): super().__init__() uic.loadUi('sources/DialogConfigClasterization.ui', self) flags = Qt.Window | Qt.WindowSystemMenuHint | Qt.WindowMinimizeButtonHint | Qt.WindowCloseButtonHint self.setWindowFlags(flags) self.filenames = filenames self.morph = morph self.configurations = configurations self.parent = parent self.somMap = [] self.somDLocations = [] self.setAttribute(QtCore.Qt.WA_DeleteOnClose) self.startMethod.clicked.connect(self.OnStartMethod) self.textEdit.setText("") self.parameters.setVisible(False) self.parameters_DBSCAN.setVisible(False) self.parameters_SOM.setVisible(False) output_dir = self.configurations.get("output_files_directory", "output_files") self.progressBar.setValue(0) self.profiler = Profiler() self.calculator = ClasterizationCalculator(filenames, output_dir, morph, self.configurations, self.textEdit) self.calculator.setMethod('1') self.calculator.signals.Finished.connect(self.onCalculationFinish) self.calculator.signals.UpdateProgressBar.connect(self.onUpdateProgressBar) self.calculator.signals.PrintInfo.connect(self.onTextLogAdd) self.radioButton_Hierarhy.toggled.connect(self.onChangeMethod) self.radioButton_KMiddle.toggled.connect(self.onChangeMethod) self.radioButton_SMiddle.toggled.connect(self.onChangeMethod) self.radioButton_DBSCAN.toggled.connect(self.onChangeMethod) self.radioButton_C3M.toggled.connect(self.onChangeMethod) self.radioButton_SOM.toggled.connect(self.onChangeMethod) self.drawSOMDiagram.clicked.connect(self.onDrawSOMDiagram)
def __init__(self, filenames, morph, configurations, parent): super().__init__() uic.loadUi('sources/DialogClastering.ui', self) flags = Qt.Window | Qt.WindowSystemMenuHint | Qt.WindowMinimizeButtonHint | Qt.WindowMaximizeButtonHint | Qt.WindowCloseButtonHint self.setWindowFlags(flags) fig = Figure() self.addmpl(fig) self.filenames = filenames self.morph = morph self.configurations = configurations self.parent = parent output_dir = self.configurations.get("output_files_directory", "output_files") self.setAttribute(QtCore.Qt.WA_DeleteOnClose) self.startMethod.clicked.connect(self.OnStartMethod) self.textEdit.setText("") self.progressBar.setValue(0) self.profiler = Profiler() self.calculator = ClasteringCalculator(filenames, output_dir, morph, self.configurations, self.textEdit) self.calculator.signals.Finished.connect(self.onCalculationFinish) self.calculator.signals.UpdateProgressBar.connect(self.onUpdateProgressBar) self.calculator.signals.PrintInfo.connect(self.onTextLogAdd)
def __init__(self, parent=None): QDialog.__init__(self, parent) self.setupUi(self) self.setWindowFlags(Qt.Window) self.googleDeauthButton.clicked.connect(self.googleDeAuth) self.uploadButton.clicked.connect(self.doGoogleUpload) self.downloadButton.clicked.connect(self.doGoogleDownload) username = getpass.getuser() if_exits = os.path.exists('/home/%s/.credentials/drive-calibre.json'%(username)) if (if_exits == False): self.googleAuthButton.clicked.connect(self.googleAuth) else: self.googleAuthButton.hide() self.googleDeauthButton.setGeometry(30, 20, 99, 71) self.googleDeauthButton.resize(240,70)
def __init__(self, parent=None): QDialog.__init__(self, parent) self.setupUi(self) self.setWindowFlags(Qt.Window) self.label_appname.setText("Cloud Sync") self.label_version.setText(__version__) self.label_expl.setText(_("Local or server files are synchronized with this plugin.")) self.label_copy.setText('Copyright © 2017 – Kerim Ölçer\n' 'Copyright © 2017 – Ali Güven Odaba??o?lu') self.label_cs.setText("This program comes with absolutely no warranty.\n" "See the GNU General Public License, version 3 or " "later for details.") #MainWindow
def __init__(self, parent=None): QWidget.__init__(self, parent) self.setupUi(self) self.setWindowFlags(Qt.Window) self.move(QDesktopWidget().availableGeometry().center() - self.frameGeometry().center()) self.label_version.setText(__version__) self.yandex_button.clicked.connect(self.yandex_dialog) self.google_button.clicked.connect(self.google_dialog) self.dropbox_button.clicked.connect(self.dropbox_dialog) self.question_button.clicked.connect(self.about) self.license_button.clicked.connect(self.openUrl)
def __init__(self): QMainWindow.__init__(self, flags=Qt.Window) self.filename = "????" self.init_window()
def __init__(self): QMainWindow.__init__(self, flags=Qt.Window) self.menu = MenuBarWidget() self.status_bar = StatusBar() self.editor = TextEditor() self.translator = QTranslator() # I18N ?? self.filename = str() self.change_locale("translate\\" + QLocale.system().name() + ".qm") # ??? ??? ?? self.document_prt = QPrinter() self.init_window() self.init_setting()
def __init__(self): QWidget.__init__(self, flags=Qt.Window) self.setMinimumWidth(330) self.lb = QLabel() self.qb = QComboBox() self.qb.addItems([n[0] for n in self.I18N]) # ?? ??? ???? ?? ?? self.init_widget()
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 __init__(self, preselected_index, message: Message, viewtype: int, parent=None): super().__init__(parent) self.ui = Ui_DialogLabels() self.ui.setupUi(self) field_types = FieldType.load_from_xml() self.model = PLabelTableModel(message, field_types) self.preselected_index = preselected_index self.ui.tblViewProtoLabels.setItemDelegateForColumn(0, ComboBoxDelegate([ft.caption for ft in field_types], is_editable=True, return_index=False, parent=self)) self.ui.tblViewProtoLabels.setItemDelegateForColumn(1, SpinBoxDelegate(1, len(message), self)) self.ui.tblViewProtoLabels.setItemDelegateForColumn(2, SpinBoxDelegate(1, len(message), self)) self.ui.tblViewProtoLabels.setItemDelegateForColumn(3, ComboBoxDelegate([""] * len(constants.LABEL_COLORS), colors=constants.LABEL_COLORS, parent=self)) self.ui.tblViewProtoLabels.setItemDelegateForColumn(4, CheckBoxDelegate(self)) self.ui.tblViewProtoLabels.setModel(self.model) self.ui.tblViewProtoLabels.selectRow(preselected_index) self.ui.tblViewProtoLabels.setEditTriggers(QAbstractItemView.AllEditTriggers) self.ui.tblViewProtoLabels.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch) self.ui.tblViewProtoLabels.resizeColumnsToContents() self.setWindowFlags(Qt.Window) self.setWindowTitle(self.tr("Edit Protocol Labels from message type %s") % message.message_type.name) self.configure_special_config_tabs() self.ui.splitter.setSizes([self.height() / 2, self.height() / 2]) self.create_connects() self.ui.cbProtoView.setCurrentIndex(viewtype) self.setAttribute(Qt.WA_DeleteOnClose) try: self.restoreGeometry(constants.SETTINGS.value("{}/geometry".format(self.__class__.__name__))) except TypeError: pass for i in range(self.model.rowCount()): self.open_editors(i)