Python PyQt5.QtCore.Qt.Dialog() Examples
The following are 16
code examples of PyQt5.QtCore.Qt.Dialog().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
PyQt5.QtCore.Qt
, or try the search function
.
Example #1
Source File: mediastream.py From vidcutter with GNU General Public License v3.0 | 7 votes |
def __init__(self, service: VideoService, parent=None, flags=Qt.Dialog | Qt.WindowCloseButtonHint): super(StreamSelector, self).__init__(parent, flags) self.service = service self.parent = parent self.streams = service.streams self.config = service.mappings self.setObjectName('streamselector') self.setWindowModality(Qt.ApplicationModal) self.setWindowTitle('Media streams - {}'.format(os.path.basename(self.parent.currentMedia))) buttons = QDialogButtonBox(QDialogButtonBox.Ok, self) buttons.accepted.connect(self.close) layout = QVBoxLayout() layout.setSpacing(15) if len(self.streams.video): layout.addWidget(self.video()) if len(self.streams.audio): layout.addWidget(self.audio()) if len(self.streams.subtitle): layout.addWidget(self.subtitles()) layout.addWidget(buttons) self.setLayout(layout)
Example #2
Source File: main.py From raspiblitz with MIT License | 6 votes |
def on_button_4_clicked(self): log.debug("clicked: B4: {}".format(self.winId())) dialog_b4 = QDialog(flags=(Qt.Dialog | Qt.FramelessWindowHint)) ui = Ui_DialogConfirmOff() ui.setupUi(dialog_b4) dialog_b4.move(0, 0) ui.buttonBox.button(QDialogButtonBox.Yes).setText("Shutdown") ui.buttonBox.button(QDialogButtonBox.Retry).setText("Restart") ui.buttonBox.button(QDialogButtonBox.Cancel).setText("Cancel") ui.buttonBox.button(QDialogButtonBox.Yes).clicked.connect(self.b4_shutdown) ui.buttonBox.button(QDialogButtonBox.Retry).clicked.connect(self.b4_restart) dialog_b4.show() rsp = dialog_b4.exec_() if rsp == QDialog.Accepted: log.info("B4: pressed is: Accepted - Shutdown or Restart") else: log.info("B4: pressed is: Cancel")
Example #3
Source File: player.py From MusicBox with MIT License | 6 votes |
def __init__(self, parent=None): super(DesktopLyric, self).__init__() self.lyric = QString('Lyric Show.') self.intervel = 0 self.maskRect = QRectF(0, 0, 0, 0) self.maskWidth = 0 self.widthBlock = 0 self.t = QTimer() self.screen = QApplication.desktop().availableGeometry() self.setObjectName(_fromUtf8("Dialog")) self.setWindowFlags(Qt.CustomizeWindowHint | Qt.FramelessWindowHint | Qt.Dialog | Qt.WindowStaysOnTopHint | Qt.Tool) self.setMinimumHeight(65) self.setAttribute(Qt.WA_TranslucentBackground) self.handle = lyric_handle(self) self.verticalLayout = QVBoxLayout(self) self.verticalLayout.setSpacing(0) self.verticalLayout.setContentsMargins(0, 0, 0, 0) self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) self.font = QFont(_fromUtf8('微软雅黑, verdana'), 50) self.font.setPixelSize(50) # QMetaObject.connectSlotsByName(self) self.handle.lyricmoved.connect(self.newPos) self.t.timeout.connect(self.changeMask)
Example #4
Source File: videoconsole.py From vidcutter with GNU General Public License v3.0 | 6 votes |
def __init__(self, parent=None, flags=Qt.Dialog | Qt.WindowCloseButtonHint): super(ConsoleWidget, self).__init__(parent, flags) 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.setWindowModality(Qt.NonModal)
Example #5
Source File: about.py From pkmeter with BSD 3-Clause "New" or "Revised" License | 5 votes |
def __init__(self, parent=None): with open(self.TEMPLATE) as tmpl: template = ElementTree.fromstring(tmpl.read()) PKWidget.__init__(self, template, self, parent) self.setWindowTitle('About PKMeter') self.setWindowFlags(Qt.Dialog) self.setWindowModality(Qt.ApplicationModal) self.setWindowIcon(QtGui.QIcon(QtGui.QPixmap('img:logo.png'))) self.layout().setContentsMargins(0,0,0,0) self.layout().setSpacing(0) self._init_stylesheet() self.manifest.version.setText('Version %s' % VERSION) self.manifest.qt.setText('QT v%s, PyQT v%s' % (QT_VERSION_STR, PYQT_VERSION_STR))
Example #6
Source File: pkconfig.py From pkmeter with BSD 3-Clause "New" or "Revised" License | 5 votes |
def __init__(self, pkmeter, parent=None): with open(self.TEMPLATE) as tmpl: template = ElementTree.fromstring(tmpl.read()) PKWidget.__init__(self, template, self, parent) self.pkmeter = pkmeter # Save reference to pkmeter self._init_window() # Init ui window elements self.values = self.load() # Active configuration values self.listitems = [] # List of items in the sidebar self.datatable = self._init_datatable() # Init reusable data table self.pconfigs = self._init_pconfigs() # Reference to each plugin config self.setWindowFlags(Qt.Dialog) self.setWindowModality(Qt.ApplicationModal)
Example #7
Source File: textinput.py From screenshot with GNU General Public License v3.0 | 5 votes |
def __init__(self, parent=None): super(TextInput, self).__init__(parent) self.setWindowFlags(Qt.Dialog | Qt.FramelessWindowHint) self.mainLayout = QVBoxLayout() self.textArea = QTextEdit(self) self.buttonArea = QWidget(self) self.buttonLayout = QHBoxLayout() self.cancelButton = QPushButton('Cancel', self) self.okButton = QPushButton('Ok', self) self.buttonLayout.addWidget(self.cancelButton) self.buttonLayout.addWidget(self.okButton) self.buttonArea.setLayout(self.buttonLayout) self.mainLayout.addWidget(self.textArea) self.mainLayout.addWidget(self.buttonArea) self.setLayout(self.mainLayout) self.textArea.textChanged.connect(self.textChanged_) self.okButton.clicked.connect(self.okButtonClicked) self.cancelButton.clicked.connect(self.cancelPressed)
Example #8
Source File: main_window.py From uPyLoader with MIT License | 5 votes |
def ask_for_password(self, title, label="Password"): if self._preset_password is not None: return self._preset_password input_dlg = QInputDialog(parent=self, flags=Qt.Dialog) input_dlg.setTextEchoMode(QLineEdit.Password) input_dlg.setWindowTitle(title) input_dlg.setLabelText(label) input_dlg.resize(500, 100) input_dlg.exec() return input_dlg.textValue()
Example #9
Source File: changelog.py From vidcutter with GNU General Public License v3.0 | 5 votes |
def __init__(self, parent=None): super(Changelog, self).__init__(parent, Qt.Dialog | Qt.WindowCloseButtonHint) self.parent = parent self.setWindowTitle('{} changelog'.format(qApp.applicationName())) changelog = QFile(':/CHANGELOG') changelog.open(QFile.ReadOnly | QFile.Text) content = QTextStream(changelog).readAll() label = QLabel(content, self) label.setWordWrap(True) label.setTextFormat(Qt.PlainText) buttons = QDialogButtonBox(QDialogButtonBox.Close, self) buttons.rejected.connect(self.close) scrollarea = QScrollArea(self) scrollarea.setStyleSheet('QScrollArea { background:transparent; }') scrollarea.setWidgetResizable(True) scrollarea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) scrollarea.setFrameShape(QScrollArea.NoFrame) scrollarea.setWidget(label) if sys.platform in {'win32', 'darwin'}: scrollarea.setStyle(QStyleFactory.create('Fusion')) # noinspection PyUnresolvedReferences if parent.parent.stylename == 'fusion' or sys.platform in {'win32', 'darwin'}: self.setStyleSheet(''' QScrollArea {{ background-color: transparent; margin-bottom: 10px; border: none; border-right: 1px solid {}; }}'''.format('#4D5355' if parent.theme == 'dark' else '#C0C2C3')) else: self.setStyleSheet(''' QScrollArea {{ background-color: transparent; margin-bottom: 10px; border: none; }}''') layout = QVBoxLayout() layout.addWidget(scrollarea) layout.addWidget(buttons) self.setLayout(layout) self.setMinimumSize(self.sizeHint())
Example #10
Source File: settings.py From vidcutter with GNU General Public License v3.0 | 5 votes |
def switchTheme(self) -> None: if self.darkRadio.isChecked(): newtheme = 'dark' else: newtheme = 'light' if newtheme != self.parent.theme: # noinspection PyArgumentList mbox = QMessageBox(icon=QMessageBox.NoIcon, windowTitle='Restart required', minimumWidth=500, textFormat=Qt.RichText, objectName='genericdialog') mbox.setWindowFlags(Qt.Dialog | Qt.WindowCloseButtonHint) mbox.setText(''' <style> h1 { color: %s; font-family: "Futura LT", sans-serif; font-weight: normal; } </style> <h1>Warning</h1> <p>The application needs to be restarted in order to switch themes. Attempts will be made to reopen media files and add back all clip times from your clip index.</p> <p>Would you like to restart and switch themes now?</p>''' % ('#C681D5' if self.parent.theme == 'dark' else '#642C68')) mbox.setStandardButtons(QMessageBox.Yes | QMessageBox.No) mbox.setDefaultButton(QMessageBox.Yes) response = mbox.exec_() if response == QMessageBox.Yes: self.parent.settings.setValue('theme', newtheme) self.parent.parent.theme = newtheme self.parent.parent.parent.reboot() else: self.darkRadio.setChecked(True) if newtheme == 'light' else self.lightRadio.setChecked(True)
Example #11
Source File: updater.py From vidcutter with GNU General Public License v3.0 | 5 votes |
def __init__(self, parent=None, flags=Qt.Dialog | Qt.WindowCloseButtonHint): super(Updater, self).__init__(parent, flags) self.parent = parent self.logger = logging.getLogger(__name__) self.api_github_latest = QUrl('https://api.github.com/repos/ozmartian/vidcutter/releases/latest') self.manager = QNetworkAccessManager(self) self.manager.finished.connect(self.done)
Example #12
Source File: updater.py From vidcutter with GNU General Public License v3.0 | 5 votes |
def __init__(self, parent=None, theme: str='light', flags=Qt.Dialog | Qt.WindowCloseButtonHint): super(UpdaterMsgBox, self).__init__(parent, flags) self.parent = parent self.theme = theme self.setWindowTitle('{} updates'.format(qApp.applicationName())) self.setWindowModality(Qt.ApplicationModal) self.setObjectName('updaterdialog') self.loading = VCProgressDialog(self.parent) self.loading.setText('contacting server') self.loading.setMinimumWidth(485) self.loading.show()
Example #13
Source File: main.py From raspiblitz with MIT License | 4 votes |
def on_button_3_clicked(self): log.debug("clicked: B3: {}".format(self.winId())) if not (self.status_lnd_pid_ok and self.status_lnd_listen_ok): log.warning("LND is not ready") self.ui.error_label.show() self.ui.error_label.setText("Err: LND is not ready!") self.ui.buttonBox_close.show() return if not self.status_lnd_unlocked: log.warning("LND is locked") self.ui.error_label.show() self.ui.error_label.setText("Err: LND is locked") self.ui.buttonBox_close.show() return if not self.status_lnd_channel_total_active: log.warning("not creating invoice: unable to receive - no open channels") self.ui.error_label.show() self.ui.error_label.setText("Err: No open channels!") self.ui.buttonBox_close.show() return if not self.status_lnd_channel_total_remote_balance: log.warning("not creating invoice: unable to receive - no remote capacity on any channel") self.ui.error_label.show() self.ui.error_label.setText("Err: No remote capacity!") self.ui.buttonBox_close.show() return dialog_b1 = QDialog(flags=(Qt.Dialog | Qt.FramelessWindowHint)) ui = Ui_DialogSelectInvoice() ui.setupUi(dialog_b1) dialog_b1.move(0, 0) ui.buttonBox.button(QDialogButtonBox.Yes).setText("{} SAT".format(self.rb_cfg.invoice_default_amount)) ui.buttonBox.button(QDialogButtonBox.Ok).setText("Donation") if self.rb_cfg.invoice_allow_donations: ui.buttonBox.button(QDialogButtonBox.Ok).setEnabled(True) else: ui.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) ui.buttonBox.button(QDialogButtonBox.Cancel).setText("Cancel") ui.buttonBox.button(QDialogButtonBox.Yes).clicked.connect(self.b3_invoice_set_amt) ui.buttonBox.button(QDialogButtonBox.Ok).clicked.connect(self.b3_invoice_custom_amt) dialog_b1.show() rsp = dialog_b1.exec_() if not rsp == QDialog.Accepted: log.info("B3: pressed is: Cancel")
Example #14
Source File: player.py From MusicBox with MIT License | 4 votes |
def __init__(self, parent=None): super(lyric_handle, self).__init__(parent) self.timer = QTimer() self.setObjectName(_fromUtf8("Dialog")) self.setWindowFlags(Qt.CustomizeWindowHint | Qt.FramelessWindowHint | Qt.Dialog | Qt.WindowStaysOnTopHint | Qt.Tool) self.setStyleSheet('QDialog { background: #2c7ec8; border: 0px solid black;}') self.horiLayout = QHBoxLayout(self) self.horiLayout.setSpacing(5) self.horiLayout.setContentsMargins(0, 0, 0, 0) self.horiLayout.setObjectName(_fromUtf8("horiLayout")) self.handler = QLabel(self) self.handler.setToolTip('Move Lyric') self.handler.setPixmap(QPixmap(':/icons/handler.png')) self.handler.setMouseTracking(True) self.lockBt = PushButton2(self) self.lockBt.setToolTip('Unlocked') self.lockBt.loadPixmap(QPixmap(':/icons/unlock.png')) self.hideBt = PushButton2(self) self.hideBt.setToolTip('Hide Lyric') self.hideBt.loadPixmap(QPixmap(':/icons/close.png').copy(48, 0, 16, 16)) self.lockBt.setCheckable(True) self.horiLayout.addWidget(self.handler) self.horiLayout.addWidget(self.lockBt) self.horiLayout.addWidget(self.hideBt) self.lockBt.clicked.connect(self.lockLyric) self.hideBt.clicked.connect(self.hideLyric) self.timer.timeout.connect(self.hide)
Example #15
Source File: input_dialog.py From execution-trace-viewer with MIT License | 4 votes |
def __init__(self, parent=None, title="Title", data=[], on_ok_clicked=None): QWidget.__init__(self, parent) self.setWindowFlags( Qt.Dialog | Qt.WindowTitleHint | Qt.CustomizeWindowHint | Qt.WindowCloseButtonHint ) self.data = data self.output_data = [] self.on_ok_clicked = on_ok_clicked mainLayout = QGridLayout() # create labels and input widgets for i, item in enumerate(self.data): label_widget = QLabel(item["label"] + ":") if isinstance(item["data"], bool): input_widget = QCheckBox() input_widget.setChecked(item["data"]) elif isinstance(item["data"], (int, str)): default = str(item.get("data", "")) input_widget = QLineEdit(default) elif isinstance(item["data"], list): input_widget = QComboBox() input_widget.addItems(item["data"]) else: print(f"Error. Unknown data type: {type(item['data'])}") return if "tooltip" in item: input_widget.setToolTip(str(item["tooltip"])) label_widget.setToolTip(str(item["tooltip"])) item["widget"] = input_widget mainLayout.addWidget(label_widget, i, 0) mainLayout.addWidget(input_widget, i, 1) ok_btn = QPushButton("Ok") ok_btn.clicked.connect(self.on_ok_btn_clicked) mainLayout.addWidget(ok_btn) cancel_btn = QPushButton("Cancel") cancel_btn.clicked.connect(self.on_cancel_btn_clicked) mainLayout.addWidget(cancel_btn) self.setLayout(mainLayout) self.setWindowTitle(title)
Example #16
Source File: bg_gui.py From BeaconGraph with GNU General Public License v3.0 | 4 votes |
def __init__(self, parent=None): super(Form,self).__init__(parent) self.LOGGEDIN = False self.setWindowIcon(QIcon("assets/logo.png")) self.setWindowTitle("BeaconGraph") #self.setWindowFlags(Qt.FramelessWindowHint | Qt.Dialog) self.logo = QPixmap('assets/logo300.png') self.picLabel = QLabel(self) self.picLabel.setPixmap(self.logo) self.picLabel.setAlignment(Qt.AlignCenter) self.uri = QLineEdit(self) self.uri.setText("bolt://localhost:7687") self.QUriLabel = QLabel("DB URI") self.username = QLineEdit(self) self.username.setPlaceholderText("Neo4j Username") self.QUserLabel = QLabel("USERNAME") self.password = QLineEdit(self) self.password.setPlaceholderText("Neo4j Password") self.password.setEchoMode(QLineEdit.Password) self.QPasswordLabel = QLabel("PASSWORD") self.btn_Submit = QPushButton("LOGIN") self.setStyleSheet(qss) self.resize(400, 500) logoLayout = QBoxLayout(QBoxLayout.TopToBottom) logoLayout.addWidget(self.picLabel) layout = QFormLayout() layout.addRow(self.QUriLabel,self.uri) layout.addRow(self.QUserLabel,self.username) layout.addRow(self.QPasswordLabel,self.password) layout.addRow(self.btn_Submit) logoLayout.addLayout(layout) self.setLayout(logoLayout) self.btn_Submit.clicked.connect(self.Submit_btn)