Python PyQt5.QtCore.Qt.FramelessWindowHint() Examples

The following are 30 code examples of PyQt5.QtCore.Qt.FramelessWindowHint(). 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: lyric.py    From FeelUOwn with GNU General Public License v3.0 7 votes vote down vote up
def __init__(self):
        super().__init__(parent=None)
        self.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint)
        self.setAttribute(Qt.WA_TranslucentBackground)
        self.c = Container(self)
        self._layout = QVBoxLayout(self)
        self._layout.setContentsMargins(0, 0, 0, 0)
        self._layout.setSpacing(0)
        self._layout.addWidget(self.c)

        self._old_pos = None

        QShortcut(QKeySequence.ZoomIn, self).activated.connect(self.zoomin)
        QShortcut(QKeySequence.ZoomOut, self).activated.connect(self.zoomout)
        QShortcut(QKeySequence('Ctrl+='), self).activated.connect(self.zoomin)
        QShortcut(QKeySequence.Cancel, self).activated.connect(self.hide)

        self.setToolTip('''
* 右键可以弹出设置菜单
* Ctrl+= 或者 Ctrl++ 可以增大字体
* Ctrl+- 可以减小字体
* 鼠标前进后退键可以播放前一首/下一首
''') 
Example #2
Source File: WindowWithTitleBar.py    From QCandyUi with MIT License 7 votes vote down vote up
def initWidgetsAndPack(self, mainwidget, titlebar):
        """
        将主体Widget和titleBar拼装起来
        :param mainwidget:
        :param titlebar:
        :return:
        """
        self.mainwidget = mainwidget
        self.resize(mainwidget.width(), mainwidget.height() + Titlebar.TITLEBAR_HEIGHT)
        self.setWindowFlags(Qt.FramelessWindowHint | self.windowFlags())
        self.installEventFilter(titlebar)
        # 布局: titlbar在上主窗体在下
        pLayout = QVBoxLayout(self)
        pLayout.addWidget(titlebar)
        pLayout.addWidget(mainwidget)
        pLayout.setSpacing(0)  # 排列的几个widget为0间隔
        pLayout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(pLayout) 
Example #3
Source File: frameless.py    From FeelUOwn with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self,):
        super().__init__(parent=None)

        self._widget = None
        self._timer = QTimer(self)
        self._old_pos = None
        self._widget = None
        self._size_grip = QSizeGrip(self)
        self._timer.timeout.connect(self.__on_timeout)

        # setup window layout
        self.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint)
        self._size_grip.setFixedSize(20, 20)
        self._layout = QVBoxLayout(self)
        self._layout.setContentsMargins(0, 0, 0, 0)
        self._layout.setSpacing(0)
        self._layout.addWidget(self._size_grip)
        self._layout.setAlignment(self._size_grip, Qt.AlignBottom | Qt.AlignRight)

        self.setMouseTracking(True) 
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: FlipWidgetAnimation.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.resize(428, 329)
        self.setWindowFlags(self.windowFlags() | Qt.FramelessWindowHint)

        # 这个是动画窗口,先创建不显示
        self.flipWidget = FlipWidget()
        self.flipWidget.finished.connect(self.showWidget)

        # 登录窗口
        self.loginWidget = LoginWidget(self)
        self.loginWidget.windowClosed.connect(self.close)
        self.loginWidget.windowChanged.connect(self.jumpSettingWidget)
        self.addWidget(self.loginWidget)

        # 设置窗口
        self.settingWidget = SettingWidget(self)
        self.settingWidget.windowClosed.connect(self.close)
        self.settingWidget.windowChanged.connect(self.jumpLoginWidget)
        self.addWidget(self.settingWidget) 
Example #6
Source File: Terminal.py    From Hydra with GNU General Public License v3.0 6 votes vote down vote up
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 
Example #7
Source File: Messagebox.py    From Hydra with GNU General Public License v3.0 6 votes vote down vote up
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() 
Example #8
Source File: CDrawer.py    From CustomWidgets with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, *args, stretch=1 / 3, direction=0, widget=None, **kwargs):
        super(CDrawer, self).__init__(*args, **kwargs)
        self.setWindowFlags(self.windowFlags(
        ) | Qt.FramelessWindowHint | Qt.Popup | Qt.NoDropShadowWindowHint)
        self.setAttribute(Qt.WA_StyledBackground, True)
        self.setAttribute(Qt.WA_TranslucentBackground, True)
        # 进入动画
        self.animIn = QPropertyAnimation(
            self, duration=500, easingCurve=QEasingCurve.OutCubic)
        self.animIn.setPropertyName(b'pos')
        # 离开动画
        self.animOut = QPropertyAnimation(
            self, duration=500, finished=self.onAnimOutEnd,
            easingCurve=QEasingCurve.OutCubic)
        self.animOut.setPropertyName(b'pos')
        self.animOut.setDuration(500)
        self.setStretch(stretch)        # 占比
        self.direction = direction      # 方向
        # 半透明背景
        self.alphaWidget = QWidget(
            self, objectName='CDrawer_alphaWidget',
            styleSheet='#CDrawer_alphaWidget{background:rgba(55,55,55,100);}')
        self.alphaWidget.setAttribute(Qt.WA_TransparentForMouseEvents, True)
        self.setWidget(widget)          # 子控件 
Example #9
Source File: gui.py    From lanzou-gui with MIT License 6 votes vote down vote up
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 
Example #10
Source File: main.py    From raspiblitz with MIT License 6 votes vote down vote up
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 #11
Source File: player.py    From MusicBox with MIT License 6 votes vote down vote up
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 #12
Source File: lrcwindow.py    From QMusic with GNU Lesser General Public License v2.1 5 votes vote down vote up
def __init__(self, parent=None):
        super(FMoveableWidget, self).__init__(parent)
        self.setAttribute(Qt.WA_TranslucentBackground, True)
        self.setAttribute(Qt.WA_Hover, True)
        self.setWindowFlags(Qt.SubWindow | Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint)

        self.installEventFilter(self)
        self.boderFlag = False

        self.isSideClicked = False
        self.isCusorLeftSide = False
        self.isCusorRightSide = False
        self.isCusorDownSide = False 
Example #13
Source File: FramelessWindow.py    From PyQt with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        super(FramelessWindow, self).__init__(*args, **kwargs)
        self._pressed = False
        self.Direction = None
        # 背景透明
        self.setAttribute(Qt.WA_TranslucentBackground, True)
        # 无边框
        self.setWindowFlags(self.windowFlags() | Qt.FramelessWindowHint)
        # 鼠标跟踪
        self.setMouseTracking(True)
        # 布局
        layout = QVBoxLayout(self, spacing=0)
        # 预留边界用于实现无边框窗口调整大小
        layout.setContentsMargins(
            self.Margins, self.Margins, self.Margins, self.Margins)
        # 标题栏
        self.titleBar = TitleBar(self)
        layout.addWidget(self.titleBar)
        # 信号槽
        self.titleBar.windowMinimumed.connect(self.showMinimized)
        self.titleBar.windowMaximumed.connect(self.showMaximized)
        self.titleBar.windowNormaled.connect(self.showNormal)
        self.titleBar.windowClosed.connect(self.close)
        self.titleBar.windowMoved.connect(self.move)
        self.windowTitleChanged.connect(self.titleBar.setTitle)
        self.windowIconChanged.connect(self.titleBar.setIcon) 
Example #14
Source File: WeltHideWindow.py    From PyQt with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        super(WeltHideWindow, self).__init__(*args, **kwargs)
        self.setWindowFlags(self.windowFlags() | Qt.FramelessWindowHint)
        self.resize(800, 600)
        self._width = QApplication.desktop().availableGeometry(self).width()
        layout = QVBoxLayout(self)
        layout.addWidget(QPushButton("关闭窗口", self, clicked=self.close)) 
Example #15
Source File: FramelessDialog.py    From PyQt with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        super(Dialog, self).__init__(*args, **kwargs)
        self.setObjectName('Custom_Dialog')
        self.setWindowFlags(self.windowFlags() | Qt.FramelessWindowHint)
        self.setAttribute(Qt.WA_TranslucentBackground, True)
        self.setStyleSheet(Stylesheet)
        self.initUi()
        # 添加阴影
        effect = QGraphicsDropShadowEffect(self)
        effect.setBlurRadius(12)
        effect.setOffset(0, 0)
        effect.setColor(Qt.gray)
        self.setGraphicsEffect(effect) 
Example #16
Source File: Notification.py    From PyQt with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        super(NotificationWindow, self).__init__(*args, **kwargs)
        self.setSpacing(20)
        self.setMinimumWidth(412)
        self.setMaximumWidth(412)
        QApplication.instance().setQuitOnLastWindowClosed(True)
        # 隐藏任务栏,无边框,置顶等
        self.setWindowFlags(self.windowFlags() | Qt.Tool |
                            Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint)
        # 去掉窗口边框
        self.setFrameShape(self.NoFrame)
        # 背景透明
        self.viewport().setAutoFillBackground(False)
        self.setAttribute(Qt.WA_TranslucentBackground, True)
        # 不显示滚动条
        self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        # 获取屏幕高宽
        rect = QApplication.instance().desktop().availableGeometry(self)
        self.setMinimumHeight(rect.height())
        self.setMaximumHeight(rect.height())
        self.move(rect.width() - self.minimumWidth() - 18, 0) 
Example #17
Source File: textinput.py    From screenshot with GNU General Public License v3.0 5 votes vote down vote up
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 #18
Source File: filteringdialog.py    From dunya-desktop with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent=None):
        QDialog.__init__(self, parent)
        self.attribute = None
        self.setFixedSize(200, 300)

        self.setWindowFlags(Qt.FramelessWindowHint | Qt.Popup)

        v_layout = QVBoxLayout(self)
        self.filtering_edit = QLineEdit()
        self.table_attribute = TableView()

        self.button_box = QDialogButtonBox(self)
        self.button_box.addButton('OK', QDialogButtonBox.AcceptRole)
        self.button_box.addButton('Cancel', QDialogButtonBox.RejectRole)

        v_layout.addWidget(self.filtering_edit)
        v_layout.addWidget(self.table_attribute)
        v_layout.addWidget(self.button_box)

        self.setLayout(v_layout)

        self.filtering_model = FilteringModel(self)

        self.proxy_model = SortFilterProxyModel(self)
        self.proxy_model.setSourceModel(self.filtering_model)
        self.proxy_model.setFilterKeyColumn(-1)

        self.table_attribute.horizontalHeader().hide()
        self.table_attribute.setModel(self.proxy_model)
        self.table_attribute.setColumnWidth(0, 28)

        self.filtering_edit.setPlaceholderText('Type here to filter...')
        self.selection = -1

        self.filtering_edit.textChanged.connect(
            lambda: self.proxy_model.filter_table(self.filtering_edit.text()))

        self.button_box.rejected.connect(self.clicked_cancel)
        self.table_attribute.doubleClicked.connect(
            self.get_selected_item_index)
        self.button_box.accepted.connect(self.get_selected_item_index) 
Example #19
Source File: TestCTitleBar.py    From CustomWidgets with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        super(TestCTitleBarBase, self).__init__(*args, **kwargs)
        self.resize(500, 400)
        # 设置背景透明
        self.setAttribute(Qt.WA_TranslucentBackground, True)
        # 设置无边框
        self.setWindowFlags(self.windowFlags() | Qt.FramelessWindowHint)
        layout = QVBoxLayout(self)
        layout.setSpacing(0)
        # 添加自定义标题栏
        layout.addWidget(CTitleBar(self, title='CTitleBar'))
        # 底部空白占位
        layout.addWidget(QWidget(self, objectName='bottomWidget')) 
Example #20
Source File: CFramelessWidget.py    From CustomWidgets with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        super(CFramelessBase, self).__init__(*args, **kwargs)
        self.dragParams = {'type': 0, 'x': 0,
                           'y': 0, 'margin': 0, 'draging': False}
        self.originalCusor = None
        self.setMouseTracking(True)
        # 设置背景透明
        self.setAttribute(Qt.WA_TranslucentBackground, True)
        # 设置无边框
        self.setWindowFlags(self.windowFlags() | Qt.FramelessWindowHint) 
Example #21
Source File: CColorPicker.py    From CustomWidgets with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        super(CColorPicker, self).__init__(*args, **kwargs)
        self.setObjectName('Custom_Color_Dialog')
        self.setWindowFlags(self.windowFlags() | Qt.FramelessWindowHint)
        self.setAttribute(Qt.WA_TranslucentBackground, True)
        self.setStyleSheet(Stylesheet)
        self.mPos = None
        self.initUi()
        self.initSignals()
        # 添加阴影
        effect = QGraphicsDropShadowEffect(self)
        effect.setBlurRadius(10)
        effect.setOffset(0, 0)
        effect.setColor(Qt.gray)
        self.setGraphicsEffect(effect) 
Example #22
Source File: DreamTree.py    From PyQt with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        super(Window, self).__init__(*args, **kwargs)

        self.setAttribute(Qt.WA_TranslucentBackground, True)  # 设置父控件Widget背景透明
        self.setWindowFlags(Qt.FramelessWindowHint)  # 去掉边框
        palette = self.palette()
        palette.setBrush(QPalette.Base, Qt.transparent)  # 父控件背景透明
        self.setPalette(palette)

        layout = QVBoxLayout(self)
        layout.setContentsMargins(0, 0, 0, 0)

        #         QWebSettings.globalSettings().setAttribute(
        #             QWebSettings.DeveloperExtrasEnabled, True)# web开发者工具

        self.webView = QWebView(self)  # 网页控件
        layout.addWidget(self.webView)
        self.webView.setContextMenuPolicy(Qt.NoContextMenu)  # 去掉右键菜单
        self.mainFrame = self.webView.page().mainFrame()

        self.mainFrame.setScrollBarPolicy(
            Qt.Vertical, Qt.ScrollBarAlwaysOff)  # 去掉滑动条
        self.mainFrame.setScrollBarPolicy(Qt.Horizontal, Qt.ScrollBarAlwaysOff)

        # 最大化
        rect = app.desktop().availableGeometry()
        self.resize(rect.size())
        self.webView.resize(rect.size()) 
Example #23
Source File: message_area.py    From CHATIMUSMAXIMUS with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent=None):
        super(MessageArea, self).__init__(parent)
        self.setReadOnly(True)
        self.sender_format = _StandardTextFormat(Qt.gray, self.fontWeight())
        self.time_format = _StandardTextFormat(Qt.gray, self.fontWeight())
        self.text_format = _StandardTextFormat()

        # styling
        self.setWindowFlags(Qt.FramelessWindowHint)
        self.setAttribute(Qt.WA_TranslucentBackground)
        self.viewport().setAutoFillBackground(False)
        self.name_formats = {}

        self.listeners = []
        sound_filepath = path.join(path.dirname(__file__),
                                   'resources',
                                   'click.wav')

        # sound_filepath = path.abspath(sound_filepath)
        sound_filepath = QtCore.QUrl.fromLocalFile(sound_filepath)

        self.sound = QtMultimedia.QSoundEffect()
        self.sound.setSource(sound_filepath)
        self.sound.setVolume(0.5)
        self.sound.setLoopCount(1) 
Example #24
Source File: custom_dialogs.py    From parsec-cloud with GNU Affero General Public License v3.0 5 votes vote down vote up
def __init__(self, center_widget, title, parent, hide_close=False):
        super().__init__(None)
        self.setupUi(self)
        self.setModal(True)
        self.setObjectName("GreyedDialog")
        self.setWindowModality(Qt.ApplicationModal)
        self.button_close.apply_style()
        if platform.system() == "Windows":
            # SplashScreen on Windows freezes the Window
            self.setWindowFlags(Qt.FramelessWindowHint)
        else:
            # FramelessWindowHint on Linux (at least xfce) is less pretty
            self.setWindowFlags(Qt.SplashScreen)
        self.setAttribute(Qt.WA_TranslucentBackground)
        self.center_widget = center_widget
        self.main_layout.addWidget(center_widget)
        if not title and hide_close:
            self.widget_title.hide()
        if title:
            self.label_title.setText(title)
        if hide_close:
            self.button_close.hide()
        main_win = ParsecApp.get_main_window()
        if main_win:
            if main_win.isVisible():
                self.setParent(main_win)
                self.resize(main_win.size())
            else:
                self.showMaximized()
            self.move(0, 0)
        else:
            logger.error("GreyedDialog did not find the main window, this is probably a bug")
        self.setFocus()
        self.accepted.connect(self.on_finished)
        self.rejected.connect(self.on_finished) 
Example #25
Source File: notifications.py    From vidcutter with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, icon: str, parent=None):
        super(Notification, self).__init__(parent)
        self.parent = parent
        self.theme = self.parent.theme
        self.setObjectName('notification')
        self.setContentsMargins(10, 10, 10, 10)
        self.setModal(True)
        self.setWindowFlags(Qt.Window | Qt.Dialog | Qt.FramelessWindowHint)
        self.setMinimumWidth(550)
        self.shown.connect(lambda: QTimer.singleShot(self.duration * 1000, self.close))
        self._title, self._message = '', ''
        self.buttons = []
        self.msgLabel = QLabel(self._message, self)
        self.msgLabel.setWordWrap(True)
        logo_label = QLabel('<img src="{}" width="82" />'.format(icon), self)
        logo_label.setFixedSize(82, 82)
        self.left_layout = QVBoxLayout()
        self.left_layout.addWidget(logo_label)
        layout = QHBoxLayout()
        layout.addStretch(1)
        layout.addLayout(self.left_layout)
        layout.addSpacing(10)
        layout.addWidget(self.msgLabel, Qt.AlignVCenter)
        layout.addStretch(1)
        self.setLayout(layout) 
Example #26
Source File: landBattleResultView.py    From imperialism-remake with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, conf, defeat):
        self.config = conf
        super().__init__()
        self.setWindowTitle(conf.get_text('victory'))
        self.setFixedSize(QSize(640, 480))
        self.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.WindowTitleHint | Qt.FramelessWindowHint)
        button = QPushButton(conf.get_text('close'), self)
        button.setCheckable(True)
        button.setFixedSize(QSize(640, 30))
        button.move(0, 450)
        # noinspection PyUnresolvedReferences
        button.clicked.connect(self.close)
        result_output = QTextEdit(self)
        result_output.setReadOnly(True)
        result_output.setFixedSize(QSize(640, 200))
        result_output.move(0, 250)
        result_output.setLineWrapMode(QTextEdit.NoWrap)
        result_output.insertHtml(self.generate_result_text())
        gview = QGraphicsView(self)
        scene = QGraphicsScene()
        if defeat:
            img = conf.theme_selected.get_defeat_pixmap()
            text = conf.get_text('defeat')
        else:
            img = conf.theme_selected.get_victory_pixmap()
            text = conf.get_text('victory')
        scene.addPixmap(img.scaled(QSize(640, 220)))
        gview.move(0, 30)
        gview.setScene(scene)
        label_title = QLabel(self)
        label_title.setText(text)
        label_title.setFixedSize(QSize(640, 30))
        label_title.setAlignment(Qt.AlignCenter)
        label_title.setFont(self.get_font_title()) 
Example #27
Source File: bg_gui.py    From BeaconGraph with GNU General Public License v3.0 4 votes vote down vote up
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) 
Example #28
Source File: view.py    From equant with GNU General Public License v2.0 4 votes vote down vote up
def __init__(self, exchange, commodity, contract, parent=None):
        super().__init__(parent)
        main_layout = QVBoxLayout()

        h_spacerItem = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)

        layout1 = QHBoxLayout()
        self.contract_tree = QTreeWidget()
        self.contract_child_tree = QTreeWidget()
        self.choice_tree = QTreeWidget()
        layout1.addWidget(self.contract_tree)
        layout1.addWidget(self.contract_child_tree)
        layout1.addWidget(self.choice_tree)
        layout1.setSpacing(1)

        layout2 = QHBoxLayout()
        self.confirm = QPushButton('确定')
        self.confirm.setMinimumWidth(60)
        self.cancel = QPushButton('取消')
        self.cancel.setMinimumWidth(60)
        layout2.setSpacing(0)
        layout2.setContentsMargins(0, 10, 20, 0)
        layout2.addItem(h_spacerItem)
        layout2.addWidget(self.confirm)
        layout2.addWidget(self.cancel)

        main_layout.addLayout(layout1)
        main_layout.addLayout(layout2)
        main_layout.setContentsMargins(0, 0, 0, 10)

        self.setLayout(main_layout)
        self.contract_tree.setColumnCount(2)
        self.contract_tree.setHeaderHidden(True)
        self.contract_tree.hideColumn(1)
        self.contract_tree.setSelectionMode(QAbstractItemView.ExtendedSelection)
        self.contract_child_tree.setColumnCount(1)
        self.contract_child_tree.setHeaderHidden(True)
        self.choice_tree.setColumnCount(1)
        self.choice_tree.setHeaderHidden(True)
        self.contract_tree.clicked.connect(self.load_child_contract)  # 加载分类下的合约
        self.choice_tree.doubleClicked.connect(self.clear_choice)  # 双击选择的合约
        self.contract_child_tree.doubleClicked.connect(self.load_choice)

        self._exchange = pd.DataFrame(exchange).drop_duplicates()
        self._commodity = pd.DataFrame(commodity, columns=["CommodityNo", "CommodityName"]).drop_duplicates()
        self._contract = pd.DataFrame(contract, columns=["ContractNo"]).drop_duplicates()
        self.load_contract()

        # 设置无边框
        self.setWindowFlags(Qt.FramelessWindowHint) 
Example #29
Source File: pkwidgets.py    From pkmeter with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
def __init__(self, etree, style, pkmeter, parent=None):
        PKWidget.__init__(self, etree, pkmeter, parent)
        self.pkmeter = pkmeter
        self.setStyleSheet(style)
        self.setAttribute(Qt.WA_TranslucentBackground)
        self.setWindowFlags(
            Qt.Tool |
            Qt.FramelessWindowHint |
            Qt.WindowStaysOnBottomHint |
            Qt.NoDropShadowWindowHint |
            Qt.CustomizeWindowHint)
        self.layout().setContentsMargins(0,0,0,0)
        self.layout().setSpacing(0)
        self._init_menu()
        pkmixins.DraggableMixin.__init__(self) 
Example #30
Source File: ProbeWindow.py    From PyQt with GNU General Public License v3.0 4 votes vote down vote up
def __init__(self, *args, **kwargs):
        super(FrameWidget, self).__init__(*args, **kwargs)
        self.setWindowFlags(Qt.Tool | Qt.FramelessWindowHint |
                            Qt.WindowStaysOnTopHint)
        self.setAttribute(Qt.WA_TranslucentBackground, True)
        self.showFullScreen()  # 全屏
        self._rect = QRect()  # 被探测的窗口的矩形位置