Python PyQt5.QtCore.Qt.WindowMinimizeButtonHint() Examples

The following are 13 code examples of PyQt5.QtCore.Qt.WindowMinimizeButtonHint(). 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: misccommands.py    From qutebrowser with GNU General Public License v3.0 6 votes vote down vote up
def _print_preview(tab: apitypes.Tab) -> None:
    """Show a print preview."""
    def print_callback(ok: bool) -> None:
        if not ok:
            message.error("Printing failed!")

    tab.printing.check_preview_support()
    diag = QPrintPreviewDialog(tab)
    diag.setAttribute(Qt.WA_DeleteOnClose)
    diag.setWindowFlags(
        diag.windowFlags() |  # type: ignore[operator, arg-type]
        Qt.WindowMaximizeButtonHint |
        Qt.WindowMinimizeButtonHint)
    diag.paintRequested.connect(functools.partial(
        tab.printing.to_printer, callback=print_callback))
    diag.exec_() 
Example #2
Source File: DyMainWindow.py    From DevilYuan with MIT License 6 votes vote down vote up
def __init__(self, parent=None):
        """
        Constructor
        
        @param parent reference to the parent widget
        @type QWidget
        """
        super(DyMainWindow, self).__init__(parent)
        self.setupUi(self)

        self.setWindowFlags(Qt.WindowMinimizeButtonHint|Qt.WindowCloseButtonHint)
        self.setFixedSize(self.width(), self.height())

        # menu
        self._initMenu()

        # config
        self._config() 
Example #3
Source File: pyqt_gui.py    From examples-of-web-crawlers with MIT License 6 votes vote down vote up
def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.DomainCookies = {}

        self.setWindowTitle('微信读书助手') # 设置窗口标题
        self.resize(900, 600) # 设置窗口大小
        self.setWindowFlags(Qt.WindowMinimizeButtonHint) # 禁止最大化按钮
        self.setFixedSize(self.width(), self.height()) # 禁止调整窗口大小

        url = 'https://weread.qq.com/#login' # 目标地址
        self.browser = QWebEngineView() # 实例化浏览器对象

        self.profile = QWebEngineProfile.defaultProfile()
        self.profile.cookieStore().deleteAllCookies() # 初次运行软件时删除所有cookies
        self.profile.cookieStore().cookieAdded.connect(self.onCookieAdd) # cookies增加时触发self.onCookieAdd()函数

        self.browser.loadFinished.connect(self.onLoadFinished) # 网页加载完毕时触发self.onLoadFinished()函数

        self.browser.load(QUrl(url)) # 加载网页
        self.setCentralWidget(self.browser) # 设置中心窗口





    # 网页加载完毕事件 
Example #4
Source File: NativeEvent.py    From PyQt with GNU General Public License v3.0 6 votes vote down vote up
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) 
Example #5
Source File: DyMainWindow.py    From DevilYuan with MIT License 6 votes vote down vote up
def __init__(self, parent=None):
        """
        Constructor
        
        @param parent reference to the parent widget
        @type QWidget
        """
        super(DyMainWindow, self).__init__(parent)
        self.setupUi(self)

        self.setWindowFlags(Qt.WindowMinimizeButtonHint|Qt.WindowCloseButtonHint)
        self.setFixedSize(self.width(), self.height())

        # menu
        self._initMenu()

        # config
        self._config() 
Example #6
Source File: __main__.py    From Python-Application with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent=None):
        # 继承主窗口类
        super(Reader, self).__init__(parent)
        # 设置应用图标
        self.setWindowIcon(QIcon('source/book.png'))
        # 获取屏幕对象
        self.screen = QDesktopWidget().screenGeometry()
        self.setupUi(self)
        # 仅支持最小化以及关闭按钮
        self.setWindowFlags(Qt.WindowMinimizeButtonHint|Qt.WindowCloseButtonHint)
        # 去掉 toolbar 右键菜单
        self.setContextMenuPolicy(Qt.NoContextMenu)
        # 固定界面大小,不可修改
        self.setFixedSize(self.screen.width(), self.screen.height())
        # 获取 QTableWidget 实例 
        self.table = QTableWidget()  
        # 将 self.table 设置为中心 widget
        self.setCentralWidget(self.table)
        # 初始化
        self.initUi() 
Example #7
Source File: ImageReaderUI.py    From Cura with GNU Lesser General Public License v3.0 5 votes vote down vote up
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 
Example #8
Source File: CTitleBar.py    From CustomWidgets with GNU General Public License v3.0 5 votes vote down vote up
def isMinimizeable(self):
        """是否可以最小化
        """
        return self.testWindowFlags(Qt.WindowMinimizeButtonHint) 
Example #9
Source File: tableWidget.py    From PyQt5 with MIT License 5 votes vote down vote up
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() 
Example #10
Source File: tomarFoto.py    From PyQt5 with MIT License 5 votes vote down vote up
def __init__(self, parent = None):
        super(tomarFoto, self).__init__(parent)

        self.setWindowTitle("Tomar foto con PyQt5 por: ANDRES NIÑO")
        self.setWindowIcon(QIcon("Qt.png"))
        self.setWindowFlags(Qt.WindowMinimizeButtonHint | Qt.WindowCloseButtonHint |
                            Qt.MSWindowsFixedSizeDialogHint)
        self.setFixedSize(645, 420)

        self.initUI() 
Example #11
Source File: dialogs.py    From artisan with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent=None, aw = None):
        super(ArtisanDialog,self).__init__(parent)
        self.aw = aw # the Artisan application window
        
        # IMPORTANT NOTE: if dialog items have to be access after it has been closed, this Qt.WA_DeleteOnClose attribute 
        # has to be set to False explicitly in its initializer (like in comportDlg) to avoid the early GC and one might
        # want to use a dialog.deleteLater() call to explicitly have the dialog and its widgets GCe
        # or rather use sip.delete(dialog) if the GC via .deleteLater() is prevented by a link to a parent object (parent not None)
        self.setAttribute(Qt.WA_DeleteOnClose, True)

#        if platf == 'Windows':
# setting those Windows flags could be the reason for some instabilities on Windows
#            windowFlags = self.windowFlags()
#        #windowFlags &= ~Qt.WindowContextHelpButtonHint # remove help button
#        #windowFlags &= ~Qt.WindowMaximizeButtonHint # remove maximise button
#        #windowFlags &= ~Qt.WindowMinMaxButtonsHint  # remove min/max combo
#        #windowFlags |= Qt.WindowMinimizeButtonHint  # Add minimize  button
#        windowFlags |= Qt.WindowSystemMenuHint  # Adds a window system menu, and possibly a close button
#            windowFlags |= Qt.WindowMinMaxButtonsHint  # add min/max combo
#            self.setWindowFlags(windowFlags)

        # configure standard dialog buttons
        self.dialogbuttons = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel,Qt.Horizontal)
        self.dialogbuttons.button(QDialogButtonBox.Ok).setDefault(True)
        self.dialogbuttons.button(QDialogButtonBox.Ok).setAutoDefault(True)
        self.dialogbuttons.button(QDialogButtonBox.Cancel).setDefault(False)
        self.dialogbuttons.button(QDialogButtonBox.Cancel).setAutoDefault(False)
        self.dialogbuttons.button(QDialogButtonBox.Ok).setFocusPolicy(Qt.StrongFocus) # to add to tab focus switch
        if self.aw.locale not in self.aw.qtbase_locales:
            self.dialogbuttons.button(QDialogButtonBox.Ok).setText(QApplication.translate("Button","OK", None))
            self.dialogbuttons.button(QDialogButtonBox.Cancel).setText(QApplication.translate("Button","Cancel",None))
        # add additional CMD-. shortcut to close the dialog
        self.dialogbuttons.button(QDialogButtonBox.Cancel).setShortcut(QKeySequence("Ctrl+."))
        # add additional CMD-W shortcut to close this dialog (ESC on Mac OS X)
        cancelAction = QAction(self, triggered=lambda _:self.dialogbuttons.rejected.emit())
        try:
            cancelAction.setShortcut(QKeySequence.Cancel)
        except:
            pass
        self.dialogbuttons.button(QDialogButtonBox.Cancel).addActions([cancelAction]) 
Example #12
Source File: __main__.py    From Python-Application with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent=None):
        # 继承主窗口类
        super(Reader, self).__init__(parent)
        # 设置应用图标
        self.setWindowIcon(QIcon('source/book.png'))
        # 获取屏幕对象
        self.screen = QDesktopWidget().screenGeometry()
        self.setupUi(self)
        # 仅支持最小化以及关闭按钮
        self.setWindowFlags(Qt.WindowMinimizeButtonHint | Qt.WindowCloseButtonHint)
        # 去掉 toolbar 右键菜单
        self.setContextMenuPolicy(Qt.NoContextMenu)
        # 固定界面大小,不可修改
        self.setFixedSize(self.screen.width(), self.screen.height() - 75)
        # 获取 QTableWidget 实例
        self.table = QTableWidget()
        # 将 self.table 设置为中心 widget
        # self.setCentralWidget(self.table)
        # 初始化选项卡
        self.tabwidget = QTabWidget()
        # 添加书库选项卡
        self.tabwidget.addTab(self.table, '书库')
        self.setCentralWidget(self.tabwidget)
        # 设置选项卡可以关闭
        self.tabwidget.setTabsClosable(True)
        # 点击选项卡叉号时,执行 removeTabab 操作
        self.tabwidget.tabCloseRequested[int].connect(self.remove_tab)
        self.initUi() 
Example #13
Source File: start.py    From Python-Application with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent=None):
        # 继承主窗口类
        super(Starter, self).__init__(parent)
        # 不支持全屏
        self.setWindowFlags(Qt.WindowMinimizeButtonHint | Qt.WindowCloseButtonHint)
        # 图标
        self.setWindowIcon(QIcon('source/1.ico'))
        self.setupUi(self)
        self.initUi()