Python源码示例:PyQt5.QtCore.Qt.WindowCloseButtonHint()

示例1
def __init__(self, parent):
        super(FlashDialog, self).__init__(parent, Qt.WindowCloseButtonHint)
        self.setupUi(self)
        self.setModal(True)

        self._connection_scanner = ConnectionScanner()
        self._port = None
        self._flash_output = None
        self._flash_output_mutex = Lock()
        self._flashing = False

        if Settings().python_flash_executable:
            self.pythonPathEdit.setText(Settings().python_flash_executable)

        self.pickPythonButton.clicked.connect(self._pick_python)
        self.pickFirmwareButton.clicked.connect(self._pick_firmware)
        self.refreshButton.clicked.connect(self._refresh_ports)
        self.wiringButton.clicked.connect(self._show_wiring)
        self.eraseButton.clicked.connect(lambda: self._start(False, True))
        self.flashButton.clicked.connect(lambda: self._start(True, False))

        self._flash_output_signal.connect(self._update_output)
        self._flash_finished_signal.connect(self._flash_finished)

        self._refresh_ports() 
示例2
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) 
示例3
def auto_extract_clipboard(self):
        if not self.watch_clipboard:
            return
        text = self.clipboard.text()
        pat = r"(https?://(\w[-\w]*\.)?lanzou[six].com/[bi]?[a-z0-9]+)[^0-9a-z]*([a-z0-9]+)?"
        for share_url, _, pwd in re.findall(pat, text):
            if share_url and not self.get_shared_info_thread.isRunning():
                self.line_share_url.setEnabled(False)
                self.btn_extract.setEnabled(False)
                txt = share_url + "提取码:" + pwd if pwd else share_url
                self.line_share_url.setText(txt)
                self.get_shared_info_thread.set_values(txt)
                self.tabWidget.setCurrentIndex(0)
                self.setWindowFlags(Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint)  # 窗口最前
                self.show()
                self.setWindowFlags(Qt.WindowCloseButtonHint | Qt.WindowMinMaxButtonsHint)  # 窗口恢复
                self.show()
                break 
示例4
def __init__(self, word):

        super(NoMatch, self).__init__()

        self.setWindowFlags(
            Qt.Widget
            | Qt.WindowCloseButtonHint
            | Qt.WindowStaysOnTopHint
            | Qt.FramelessWindowHint
        )

        self.layout = QHBoxLayout()

        self.word = word
        self.no_match = QLabel("No match found for word: {}".format(self.word))

        self.ok_button = QPushButton("OK")
        self.ok_button.setAutoDefault(True)
        self.ok_button.clicked.connect(self.ok_pressed)

        self.layout.addWidget(self.no_match)
        self.layout.addWidget(self.ok_button)
        self.setLayout(self.layout)

        self.show() 
示例5
def __init__(self, parent, movable=False):
        super().__init__()

        self.setWindowFlags(
            Qt.Widget
            | Qt.WindowCloseButtonHint
            | Qt.WindowStaysOnTopHint
            | Qt.FramelessWindowHint
        )
        self.movable = movable
        self.layout = QVBoxLayout()
        self.pressed = False
        self.process = QProcess()
        self.parent = parent
        self.clicked = False
        self.name = None

        self.process.readyReadStandardError.connect(self.onReadyReadStandardError)
        self.process.readyReadStandardOutput.connect(self.onReadyReadStandardOutput)
        self.setLayout(self.layout)
        self.setStyleSheet("QWidget {background-color:invisible;}")
        self.add()  # Add items to the layout
        # self.showMaximized() # comment this if you want to embed this widget 
示例6
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 
示例7
def __init__(self, *args, **kwargs):
        super(Window, self).__init__(*args, **kwargs)
        # 主屏幕的可用大小(去掉任务栏)
        self._rect = QApplication.instance().desktop().availableGeometry(self)
        self.resize(800, 600)
        self.setWindowFlags(Qt.Window
                            | Qt.FramelessWindowHint
                            | Qt.WindowSystemMenuHint
                            | Qt.WindowMinimizeButtonHint
                            | Qt.WindowMaximizeButtonHint
                            | Qt.WindowCloseButtonHint)
        # 增加薄边框
        style = win32gui.GetWindowLong(int(self.winId()), win32con.GWL_STYLE)
        win32gui.SetWindowLong(
            int(self.winId()), win32con.GWL_STYLE, style | win32con.WS_THICKFRAME)

        if QtWin.isCompositionEnabled():
            # 加上 Aero 边框阴影
            QtWin.extendFrameIntoClientArea(self, -1, -1, -1, -1)
        else:
            QtWin.resetExtendedFrame(self) 
示例8
def __init__(self, parent, connection, terminal):
        super(TerminalDialog, self).__init__(None, Qt.WindowCloseButtonHint)
        self.setupUi(self)

        self.setWindowFlags(Qt.Window)
        geometry = Settings().retrieve_geometry("terminal")
        if geometry:
            self.restoreGeometry(geometry)

        self.connection = connection
        self.terminal = terminal
        self._auto_scroll = True  # TODO: Settings?
        self.terminal_listener = Listener(self.emit_update_content)
        self._update_content_signal.connect(self.update_content)
        self.terminal.add_event.connect(self.terminal_listener)

        self.outputTextEdit.installEventFilter(self)
        self.outputTextEdit.verticalScrollBar().sliderPressed.connect(self._stop_scrolling)
        self.outputTextEdit.verticalScrollBar().sliderReleased.connect(self._scroll_released)
        self.outputTextEdit.verticalScrollBar().installEventFilter(self)
        self.inputTextBox.installEventFilter(self)
        self.clearButton.clicked.connect(self.clear_content)
        self.sendButton.clicked.connect(self.send_input)

        self.ctrlaButton.clicked.connect(lambda: self.send_control("a"))
        self.ctrlbButton.clicked.connect(lambda: self.send_control("b"))
        self.ctrlcButton.clicked.connect(lambda: self.send_control("c"))
        self.ctrldButton.clicked.connect(lambda: self.send_control("d"))
        self.ctrleButton.clicked.connect(lambda: self.send_control("e"))

        fixed_font = QFontDatabase.systemFont(QFontDatabase.FixedFont)
        self.outputTextEdit.setFont(fixed_font)
        self.inputTextBox.setFont(fixed_font)
        self.autoscrollCheckBox.setChecked(self._auto_scroll)
        self.autoscrollCheckBox.stateChanged.connect(self._auto_scroll_changed)

        self.terminal.read()
        self.outputTextEdit.setText(TerminalDialog.process_backspaces(self.terminal.history))
        self._input_history_index = 0 
示例9
def __init__(self, parent):
        super(AboutDialog, self).__init__(parent, Qt.WindowCloseButtonHint)
        self.setupUi(self)
        self.setModal(True)
        self.setSizeGripEnabled(False)
        self.versionLabel.setText(Versioning.get_version_string())
        self.buildDateLabel.setText(BuildInfo().build_date) 
示例10
def __init__(self):
        super(WiFiPresetDialog, self).__init__(None, Qt.WindowCloseButtonHint)
        self.setupUi(self)

        self.selected_ip = None
        self.selected_port = None
        self.selected_password = None

        self.presetsListView.doubleClicked.connect(self.select_preset)
        self.addButton.clicked.connect(self.add_preset)
        self.removeButton.clicked.connect(self.remove_preset)

        self.model = QStringListModel()
        self.presetsListView.setModel(self.model)
        self.update_preset_list() 
示例11
def _createConfigUI(self):
        if self._ui_view is None:
            Logger.log("d", "Creating ImageReader config UI")
            path = os.path.join(PluginRegistry.getInstance().getPluginPath("ImageReader"), "ConfigUI.qml")
            self._ui_view = Application.getInstance().createQmlComponent(path, {"manager": self})
            self._ui_view.setFlags(self._ui_view.flags() & ~Qt.WindowCloseButtonHint & ~Qt.WindowMinimizeButtonHint & ~Qt.WindowMaximizeButtonHint)
            self._disable_size_callbacks = False 
示例12
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()) 
示例13
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) 
示例14
def __init__(self, service: VideoService, parent: QWidget, flags=Qt.WindowCloseButtonHint):
        super(SettingsDialog, self).__init__(parent.parentWidget(), flags)
        self.parent = parent
        self.service = service
        self.settings = self.parent.settings
        self.theme = self.parent.theme
        self.setObjectName('settingsdialog')
        if sys.platform in {'win32', 'darwin'}:
            self.setStyle(QStyleFactory.create('Fusion'))
        self.setWindowTitle('Settings')
        self.categories = QListWidget(self)
        self.categories.setResizeMode(QListView.Fixed)
        self.categories.setStyleSheet('QListView::item { text-decoration: none; }')
        self.categories.setAttribute(Qt.WA_MacShowFocusRect, False)
        self.categories.setObjectName('settingsmenu')
        self.categories.setUniformItemSizes(True)
        self.categories.setMouseTracking(True)
        self.categories.setViewMode(QListView.IconMode)
        self.categories.setIconSize(QSize(90, 60))
        self.categories.setMovement(QListView.Static)
        self.categories.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.pages = QStackedWidget(self)
        self.pages.addWidget(GeneralPage(self))
        self.pages.addWidget(VideoPage(self))
        self.pages.addWidget(ThemePage(self))
        self.pages.addWidget(ToolsPage(self))
        self.pages.addWidget(LogsPage(self))
        self.initCategories()
        horizontalLayout = QHBoxLayout()
        horizontalLayout.setSpacing(5)
        horizontalLayout.addWidget(self.categories)
        horizontalLayout.addWidget(self.pages, 1)
        buttons = QDialogButtonBox(QDialogButtonBox.Ok, self)
        buttons.accepted.connect(self.close)
        mainLayout = QVBoxLayout()
        mainLayout.addLayout(horizontalLayout)
        mainLayout.addWidget(buttons)
        self.setLayout(mainLayout) 
示例15
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) 
示例16
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() 
示例17
def __init__(self, parent=None):
        super(botonCircular, self).__init__(parent)

        self.setWindowTitle("Botón circular en PyQt5 por: ANDRES NIÑO")
        self.setWindowIcon(QIcon("Qt.png"))
        self.setWindowFlags(Qt.WindowCloseButtonHint | Qt.MSWindowsFixedSizeDialogHint)
        self.setFixedSize(400, 400)

        self.initUI() 
示例18
def __init__(self, parent=None):
        super(guardarImagen, self).__init__(parent)
        
        self.setWindowTitle("Guardar imagen por: ANDRES NIÑO")
        self.setWindowIcon(QIcon("icono.png"))
        self.setWindowFlags(Qt.WindowCloseButtonHint | Qt.MSWindowsFixedSizeDialogHint)
        self.setFixedSize(400, 511)

        self.initUI() 
示例19
def __init__(self, parent=None):
        super(ventanaPrincipal, self).__init__(parent)
        
        self.setWindowTitle("Incrustar imágenes en PyQt5 por: ANDRES NIÑO")
        self.setWindowIcon(QIcon(":imagenes/Qt.png"))
        self.setWindowFlags(Qt.WindowCloseButtonHint | Qt.MSWindowsFixedSizeDialogHint)
        self.setFixedSize(400, 400)

        self.initUI() 
示例20
def __init__(self, parent=None):
        super(tableWidget, self).__init__(parent)

        self.setWindowTitle("QTableWidget en PyQt5 por: ANDRES NIÑO")
        self.setWindowIcon(QIcon("Qt.png"))
        self.setWindowFlags(Qt.WindowMinimizeButtonHint | Qt.WindowCloseButtonHint |
                            Qt.MSWindowsFixedSizeDialogHint)
        self.setFixedSize(740, 348)

        self.initUI() 
示例21
def __init__(self, parent=None):
        super(ventanaPrincipal, self).__init__(parent)
        
        self.setWindowTitle("QLineEdit en PyQt5 por: ANDRES NIÑO")
        self.setWindowIcon(QIcon("icono.png"))
        self.setWindowFlags(Qt.WindowCloseButtonHint | Qt.MSWindowsFixedSizeDialogHint)
        self.setFixedSize(400, 400)

        self.initUI() 
示例22
def __init__(self, parent=None):
        super(mostrarImagen, self).__init__(parent)
        
        self.setWindowTitle("Mostrar imagen por: ANDRES NIÑO")
        self.setWindowIcon(QIcon("icono.png"))
        self.setWindowFlags(Qt.WindowCloseButtonHint | Qt.MSWindowsFixedSizeDialogHint)
        self.setFixedSize(400, 511)

        self.initUI() 
示例23
def __init__(self, parent=None):
        super(ventanaLogin, self).__init__(parent)
        
        self.setWindowTitle("Login con PyQt5 por: ANDRES NIÑO")
        self.setWindowIcon(QIcon("icono.png"))
        self.setWindowFlags(Qt.WindowCloseButtonHint | Qt.MSWindowsFixedSizeDialogHint)
        self.setFixedSize(400, 380)

        paleta = QPalette()
        paleta.setColor(QPalette.Background, QColor(243, 243, 243))
        self.setPalette(paleta)

        self.initUI() 
示例24
def __init__(self, parent=None):
        super(interruptorPalanca, self).__init__(parent)

        self.setWindowIcon(QIcon("Qt.png"))
        self.setWindowTitle("Toggle Switch (Interruptor de palanca) en PyQt5")
        self.setWindowFlags(Qt.WindowCloseButtonHint | Qt.MSWindowsFixedSizeDialogHint)
        self.setFixedSize(400, 240)

        self.initUI() 
示例25
def __init__(self, parent=None):
        super(guardarImagen, self).__init__(parent)
        
        self.setWindowTitle("Guardar imagen en una carpeta por: ANDRES NIÑO")
        self.setWindowIcon(QIcon("icono.png"))
        self.setWindowFlags(Qt.WindowCloseButtonHint | Qt.MSWindowsFixedSizeDialogHint)
        self.setFixedSize(400, 511)

        self.initUI() 
示例26
def __init__(self, parent=None):
        super(recuperarImagen, self).__init__(parent)
        
        self.setWindowTitle("Recuperar imagen por: ANDRES NIÑO")
        self.setWindowIcon(QIcon("icono.png"))
        self.setWindowFlags(Qt.WindowCloseButtonHint | Qt.MSWindowsFixedSizeDialogHint)
        self.setFixedSize(400, 511)

        self.initUI() 
示例27
def __init__(self, parent=None):
        super(stackedWidget, self).__init__(parent)
        
        self.setWindowTitle("Pila de widgets (QStackedWidget) por : ANDRES NIÑO")
        self.setWindowIcon(QIcon("icono.png"))
        self.setWindowFlags(Qt.WindowCloseButtonHint | Qt.MSWindowsFixedSizeDialogHint)
        self.setFixedSize(400, 400)

        self.initUI() 
示例28
def __init__(self, parent=None):
        super(botonRedondo, self).__init__(parent)
        
        self.setWindowTitle("Botón redondo por: ANDRES NIÑO")
        self.setWindowIcon(QIcon("icono.png"))
        self.setWindowFlags(Qt.WindowCloseButtonHint | Qt.MSWindowsFixedSizeDialogHint)
        self.setFixedSize(400, 511)

        self.initUI() 
示例29
def __init__(self, parent=None):
        super(animarBotones, self).__init__(parent)
        
        self.setWindowTitle("Animar botones en PyQt5 por: ANDRES NIÑO")
        self.setWindowIcon(QIcon("Qt.png"))
        self.setWindowFlags(Qt.WindowCloseButtonHint | Qt.MSWindowsFixedSizeDialogHint)
        self.setFixedSize(400, 400)

        self.initUI() 
示例30
def __init__(self, texto, parent=None):
        super(ventanaHija, self).__init__()

        self.parent = parent
        self.texto = texto
        
        self.setWindowTitle("Ventana hija por: ANDRES NIÑO")
        self.setWindowIcon(QIcon("icono.png"))
        self.setWindowFlags(Qt.WindowCloseButtonHint | Qt.MSWindowsFixedSizeDialogHint)
        self.setFixedSize(400, 400)

        self.initUI()