Python PyQt5.QtWidgets.QWidget() Examples

The following are 30 code examples of PyQt5.QtWidgets.QWidget(). 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.QtWidgets , or try the search function .
Example #1
Source File: scorewidnow.py    From Python-GUI with MIT License 8 votes vote down vote up
def setupUi(self, ScoreWindow):
        ScoreWindow.setObjectName("ScoreWindow")
        ScoreWindow.resize(471, 386)
        self.centralwidget = QtWidgets.QWidget(ScoreWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.Score = QtWidgets.QLineEdit(self.centralwidget)
        self.Score.setGeometry(QtCore.QRect(180, 180, 113, 22))
        self.Score.setObjectName("Score")
        self.teamscore = QtWidgets.QLabel(self.centralwidget)
        self.teamscore.setGeometry(QtCore.QRect(180, 130, 151, 20))
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.teamscore.setFont(font)
        self.teamscore.setObjectName("teamscore")
        ScoreWindow.setCentralWidget(self.centralwidget)
        self.statusbar = QtWidgets.QStatusBar(ScoreWindow)
        self.statusbar.setObjectName("statusbar")
        ScoreWindow.setStatusBar(self.statusbar)

        self.retranslateUi(ScoreWindow)
        QtCore.QMetaObject.connectSlotsByName(ScoreWindow) 
Example #2
Source File: window.py    From visma with GNU General Public License v3.0 8 votes vote down vote up
def buttonsLayout(self):
        self.matrix = False
        vbox = QVBoxLayout()
        interactionModeLayout = QVBoxLayout()
        self.interactionModeButton = QtWidgets.QPushButton('visma')
        self.interactionModeButton.clicked.connect(self.interactionMode)
        interactionModeLayout.addWidget(self.interactionModeButton)
        interactionModeWidget = QWidget(self)
        interactionModeWidget.setLayout(interactionModeLayout)
        interactionModeWidget.setFixedSize(275, 50)
        topButtonSplitter = QSplitter(Qt.Horizontal)
        topButtonSplitter.addWidget(interactionModeWidget)
        permanentButtons = QWidget(self)
        topButtonSplitter.addWidget(permanentButtons)
        self.bottomButton = QFrame()
        self.buttonSplitter = QSplitter(Qt.Vertical)
        self.buttonSplitter.addWidget(topButtonSplitter)
        self.buttonSplitter.addWidget(self.bottomButton)
        vbox.addWidget(self.buttonSplitter)
        return vbox 
Example #3
Source File: first.py    From FIRST-plugin-ida with GNU General Public License v2.0 7 votes vote down vote up
def __init__(self, parent=None, frame=QtWidgets.QFrame.Box):
            super(FIRSTUI.ScrollWidget, self).__init__()

            #   Container Widget
            widget = QtWidgets.QWidget()
            #   Layout of Container Widget
            self.layout = QtWidgets.QVBoxLayout(self)
            self.layout.setContentsMargins(0, 0, 0, 0)
            widget.setLayout(self.layout)

            #   Scroll Area Properties
            scroll = QtWidgets.QScrollArea()
            scroll.setFrameShape(frame)
            scroll.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
            scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
            scroll.setWidgetResizable(True)
            scroll.setWidget(widget)

            #   Scroll Area Layer add
            scroll_layout = QtWidgets.QVBoxLayout(self)
            scroll_layout.addWidget(scroll)
            scroll_layout.setContentsMargins(0, 0, 0, 0)
            self.setLayout(scroll_layout) 
Example #4
Source File: app.py    From qutebrowser with GNU General Public License v3.0 6 votes vote down vote up
def on_focus_changed(_old, new):
    """Register currently focused main window in the object registry."""
    if new is None:
        return

    if not isinstance(new, QWidget):
        log.misc.debug("on_focus_changed called with non-QWidget {!r}".format(
            new))
        return

    window = new.window()
    if isinstance(window, mainwindow.MainWindow):
        objreg.register('last-focused-main-window', window, update=True)
        # A focused window must also be visible, and in this case we should
        # consider it as the most recently looked-at window
        objreg.register('last-visible-main-window', window, update=True) 
Example #5
Source File: generic_analysis.py    From idasec with GNU Lesser General Public License v2.1 6 votes vote down vote up
def __init__(self, parent):
        QtWidgets.QWidget.__init__(self)
        self.setupUi(self)
        self.parent = parent
        # self.result_area.setEnabled(False)
        if self.parent.results.get_formula:
            self.formula_label.setVisible(True)
            self.formula_area.setEnabled(True)
        else:
            self.formula_label.setVisible(False)
            self.formula_area.setVisible(False)
        self.action_selector.setEnabled(False)
        self.action_button.setEnabled(False)
        self.action_selector.addItem(self.parent.ANNOT_CODE)
        self.action_button.clicked.connect(self.action_clicked)
        self.action_selector.currentIndexChanged[str].connect(self.action_selector_changed) 
Example #6
Source File: first.py    From FIRST-plugin-ida with GNU General Public License v2.0 6 votes vote down vote up
def view_clicked(self, index):
        key = self.views_model.data(index)

        if key in self.views_ui:
            #   Get the new view
            widget = QtWidgets.QWidget()
            layout = self.views_ui[key]()
            if not layout:
                layout = QtWidgets.QVBoxLayout()
            widget.setLayout(layout)

            #   Remove the old view to the splitter
            old_widget = self.splitter.widget(1)
            if old_widget:
                old_widget.hide()
                old_widget.deleteLater()

            self.splitter.insertWidget(1, widget) 
Example #7
Source File: first.py    From FIRST-plugin-ida with GNU General Public License v2.0 6 votes vote down vote up
def populate_main_form(self):
        list_view = QtWidgets.QListView()
        list_view.setFixedWidth(115)
        list_view.setModel(self.views_model)

        select = QtCore.QItemSelectionModel.Select
        list_view.selectionModel().select(self.views_model.createIndex(0, 0), select)
        list_view.clicked.connect(self.view_clicked)

        current_view = QtWidgets.QWidget()
        view = self.view_about()
        if not view:
            view = QtWidgets.QBoxLayout()
        current_view.setLayout(view)

        self.splitter = QtWidgets.QSplitter(Qt.Horizontal)
        self.splitter.addWidget(list_view)

        self.splitter.addWidget(current_view)
        self.splitter.setChildrenCollapsible(False)
        self.splitter.show()

        outer_layout = QtWidgets.QHBoxLayout()
        outer_layout.addWidget(self.splitter)

        self.parent.setLayout(outer_layout) 
Example #8
Source File: stubs.py    From qutebrowser with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, url=QUrl(), title='', tab_id=0, *,
                 scroll_pos_perc=(0, 0),
                 load_status=usertypes.LoadStatus.success,
                 progress=0, can_go_back=None, can_go_forward=None):
        super().__init__(win_id=0, mode_manager=None, private=False)
        self._load_status = load_status
        self._title = title
        self._url = url
        self._progress = progress
        self.history = FakeWebTabHistory(self, can_go_back=can_go_back,
                                         can_go_forward=can_go_forward)
        self.scroller = FakeWebTabScroller(self, scroll_pos_perc)
        self.audio = FakeWebTabAudio(self)
        self.private_api = FakeWebTabPrivate(tab=self, mode_manager=None)
        wrapped = QWidget()
        self._layout.wrap(self, wrapped) 
Example #9
Source File: gui.py    From biometric-attendance-sync-tool with GNU General Public License v3.0 6 votes vote down vote up
def create_message_box(title, text, icon="information", width=150):
    msg = QMessageBox()
    msg.setWindowTitle(title)
    lineCnt = len(text.split('\n'))
    if lineCnt > 15:
        scroll = QtWidgets.QScrollArea()
        scroll.setWidgetResizable(1)
        content = QtWidgets.QWidget()
        scroll.setWidget(content)
        layout = QtWidgets.QVBoxLayout(content)
        tmpLabel = QtWidgets.QLabel(text)
        tmpLabel.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse)
        layout.addWidget(tmpLabel)
        msg.layout().addWidget(scroll, 12, 10, 1, msg.layout().columnCount())
        msg.setStyleSheet("QScrollArea{min-width:550 px; min-height: 400px}")
    else:
        msg.setText(text)
        if icon == "warning":
            msg.setIcon(QtWidgets.QMessageBox.Warning)
            msg.setStyleSheet("QMessageBox Warning{min-width: 50 px;}")
        else:
            msg.setIcon(QtWidgets.QMessageBox.Information)
            msg.setStyleSheet("QMessageBox Information{min-width: 50 px;}")
        msg.setStyleSheet("QmessageBox QLabel{min-width: "+str(width)+"px;}")
    msg.exec_() 
Example #10
Source File: dockwidgets.py    From Lector with GNU General Public License v3.0 6 votes vote down vote up
def populate(self):
        self.setFeatures(QtWidgets.QDockWidget.DockWidgetClosable)
        self.setTitleBarWidget(QtWidgets.QWidget(self))  # Removes titlebar
        self.sideDockTabWidget = QtWidgets.QTabWidget(self)
        self.setWidget(self.sideDockTabWidget)

        # This order is important
        self.bookmarkModel = QtGui.QStandardItemModel(self)
        self.bookmarkProxyModel = BookmarkProxyModel(self)
        self.bookmarks = Bookmarks(self)
        self.bookmarks.generate_bookmark_model()

        if not self.parent.are_we_doing_images_only:
            self.annotationModel = QtGui.QStandardItemModel(self)
            self.annotations = Annotations(self)
            self.annotations.generate_annotation_model()

            self.searchResultsModel = QtGui.QStandardItemModel(self)
            self.search = Search(self) 
Example #11
Source File: qsolver.py    From visma with GNU General Public License v3.0 6 votes vote down vote up
def qSolveFigure(workspace):
    """GUI layout for quick simplifier

    Arguments:
        workspace {QtWidgets.QWidget} -- main layout

    Returns:
        qSolLayout {QtWidgets.QVBoxLayout} -- quick simplifier layout
    """

    bg = workspace.palette().window().color()
    bgcolor = (bg.redF(), bg.greenF(), bg.blueF())
    workspace.qSolveFigure = Figure(edgecolor=bgcolor, facecolor=bgcolor)
    workspace.solcanvas = FigureCanvas(workspace.qSolveFigure)
    workspace.qSolveFigure.clear()
    qSolLayout = QtWidgets.QVBoxLayout()
    qSolLayout.addWidget(workspace.solcanvas)

    return qSolLayout 
Example #12
Source File: listcategory.py    From qutebrowser with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self,
                 name: str,
                 items: typing.Iterable[_ItemType],
                 sort: bool = True,
                 delete_func: util.DeleteFuncType = None,
                 parent: QWidget = None):
        super().__init__(parent)
        self.name = name
        self.srcmodel = QStandardItemModel(parent=self)
        self._pattern = ''
        # ListCategory filters all columns
        self.columns_to_filter = [0, 1, 2]
        self.setFilterKeyColumn(-1)
        for item in items:
            self.srcmodel.appendRow([QStandardItem(x) for x in item])
        self.setSourceModel(self.srcmodel)
        self.delete_func = delete_func
        self._sort = sort 
Example #13
Source File: ui_qhangupsconversations.py    From qhangups with GNU General Public License v3.0 6 votes vote down vote up
def setupUi(self, QHangupsConversations):
        QHangupsConversations.setObjectName("QHangupsConversations")
        QHangupsConversations.resize(500, 350)
        self.centralwidget = QtWidgets.QWidget(QHangupsConversations)
        self.centralwidget.setObjectName("centralwidget")
        self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
        self.gridLayout.setObjectName("gridLayout")
        self.conversationsTabWidget = QtWidgets.QTabWidget(self.centralwidget)
        self.conversationsTabWidget.setElideMode(QtCore.Qt.ElideRight)
        self.conversationsTabWidget.setTabsClosable(True)
        self.conversationsTabWidget.setMovable(True)
        self.conversationsTabWidget.setObjectName("conversationsTabWidget")
        self.gridLayout.addWidget(self.conversationsTabWidget, 0, 0, 1, 1)
        QHangupsConversations.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(QHangupsConversations)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 500, 27))
        self.menubar.setObjectName("menubar")
        QHangupsConversations.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(QHangupsConversations)
        self.statusbar.setObjectName("statusbar")
        QHangupsConversations.setStatusBar(self.statusbar)

        self.retranslateUi(QHangupsConversations)
        self.conversationsTabWidget.setCurrentIndex(-1)
        QtCore.QMetaObject.connectSlotsByName(QHangupsConversations) 
Example #14
Source File: ui_qhangupsconversationslist.py    From qhangups with GNU General Public License v3.0 6 votes vote down vote up
def setupUi(self, QHangupsConversationsList):
        QHangupsConversationsList.setObjectName("QHangupsConversationsList")
        QHangupsConversationsList.resize(250, 500)
        self.centralwidget = QtWidgets.QWidget(QHangupsConversationsList)
        self.centralwidget.setObjectName("centralwidget")
        self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget)
        self.verticalLayout.setObjectName("verticalLayout")
        self.conversationsListWidget = QtWidgets.QListWidget(self.centralwidget)
        self.conversationsListWidget.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
        self.conversationsListWidget.setObjectName("conversationsListWidget")
        self.verticalLayout.addWidget(self.conversationsListWidget)
        QHangupsConversationsList.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(QHangupsConversationsList)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 250, 27))
        self.menubar.setObjectName("menubar")
        QHangupsConversationsList.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(QHangupsConversationsList)
        self.statusbar.setObjectName("statusbar")
        QHangupsConversationsList.setStatusBar(self.statusbar)

        self.retranslateUi(QHangupsConversationsList)
        QtCore.QMetaObject.connectSlotsByName(QHangupsConversationsList) 
Example #15
Source File: browsertab.py    From qutebrowser with GNU General Public License v3.0 6 votes vote down vote up
def create(win_id: int,
           private: bool,
           parent: QWidget = None) -> 'AbstractTab':
    """Get a QtWebKit/QtWebEngine tab object.

    Args:
        win_id: The window ID where the tab will be shown.
        private: Whether the tab is a private/off the record tab.
        parent: The Qt parent to set.
    """
    # Importing modules here so we don't depend on QtWebEngine without the
    # argument and to avoid circular imports.
    mode_manager = modeman.instance(win_id)
    if objects.backend == usertypes.Backend.QtWebEngine:
        from qutebrowser.browser.webengine import webenginetab
        tab_class = webenginetab.WebEngineTab  # type: typing.Type[AbstractTab]
    else:
        from qutebrowser.browser.webkit import webkittab
        tab_class = webkittab.WebKitTab
    return tab_class(win_id=win_id, mode_manager=mode_manager, private=private,
                     parent=parent) 
Example #16
Source File: mainwindow.py    From qutebrowser with GNU General Public License v3.0 6 votes vote down vote up
def _add_widgets(self):
        """Add or readd all widgets to the VBox."""
        self._vbox.removeWidget(self.tabbed_browser.widget)
        self._vbox.removeWidget(self._downloadview)
        self._vbox.removeWidget(self.status)
        widgets = [self.tabbed_browser.widget]  # type: typing.List[QWidget]

        downloads_position = config.val.downloads.position
        if downloads_position == 'top':
            widgets.insert(0, self._downloadview)
        elif downloads_position == 'bottom':
            widgets.append(self._downloadview)
        else:
            raise ValueError("Invalid position {}!".format(downloads_position))

        status_position = config.val.statusbar.position
        if status_position == 'top':
            widgets.insert(0, self.status)
        elif status_position == 'bottom':
            widgets.append(self.status)
        else:
            raise ValueError("Invalid position {}!".format(status_position))

        for widget in widgets:
            self._vbox.addWidget(widget) 
Example #17
Source File: browsertab.py    From qutebrowser with GNU General Public License v3.0 6 votes vote down vote up
def _set_widget(self, widget: QWidget) -> None:
        # pylint: disable=protected-access
        self._widget = widget
        self.data.splitter = miscwidgets.InspectorSplitter(widget)
        self._layout.wrap(self, self.data.splitter)
        self.history._history = widget.history()
        self.history.private_api._history = widget.history()
        self.scroller._init_widget(widget)
        self.caret._widget = widget
        self.zoom._widget = widget
        self.search._widget = widget
        self.printing._widget = widget
        self.action._widget = widget
        self.elements._widget = widget
        self.audio._widget = widget
        self.private_api._widget = widget
        self.settings._settings = widget.settings()

        self._install_event_filter()
        self.zoom.apply_default() 
Example #18
Source File: command.py    From qutebrowser with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, *, win_id: int,
                 private: bool,
                 parent: QWidget = None) -> None:
        misc.CommandLineEdit.__init__(self, parent=parent)
        misc.MinimalLineEditMixin.__init__(self)
        self._win_id = win_id
        if not private:
            command_history = objreg.get('command-history')
            self.history.history = command_history.data
            self.history.changed.connect(command_history.changed)
        self.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Ignored)

        self.cursorPositionChanged.connect(
            self.update_completion)  # type: ignore[arg-type]
        self.textChanged.connect(
            self.update_completion)  # type: ignore[arg-type]
        self.textChanged.connect(self.updateGeometry)
        self.textChanged.connect(self._incremental_search) 
Example #19
Source File: video_finder_progress_ui.py    From persepolis with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, persepolis_setting):
        super().__init__(persepolis_setting)

        # status_tab
        self.status_tab = QWidget()
        status_tab_verticalLayout = QVBoxLayout(self.status_tab)

        # video_status_label
        self.video_status_label = QLabel(self.status_tab)
        status_tab_verticalLayout.addWidget(self.video_status_label)

        # audio_status_label
        self.audio_status_label = QLabel(self.status_tab)
        status_tab_verticalLayout.addWidget(self.audio_status_label)

        # muxing_status_label
        self.muxing_status_label = QLabel(self.status_tab)
        status_tab_verticalLayout.addWidget(self.muxing_status_label)

        self.progress_tabWidget.addTab(self.status_tab, "")

        # set status_tab as default tab
        self.progress_tabWidget.setCurrentIndex(2)

        # labels

        self.video_status_label.setText(QCoreApplication.translate(
            "video_finder_progress_ui_tr", "<b>Video file status: </b>"))
        self.audio_status_label.setText(QCoreApplication.translate(
            "video_finder_progress_ui_tr", "<b>Audio file status: </b>"))
        self.muxing_status_label.setText(QCoreApplication.translate(
            "video_finder_progress_ui_tr", "<b>Muxing status: </b>"))

        self.progress_tabWidget.setTabText(self.progress_tabWidget.indexOf(
            self.status_tab),  QCoreApplication.translate("setting_ui_tr", "Status")) 
Example #20
Source File: tabbedbrowser.py    From qutebrowser with GNU General Public License v3.0 5 votes vote down vote up
def last(self, cur_tab: QWidget) -> QWidget:
        """Get the last tab.

        Throws IndexError on failure.
        """
        try:
            return self.next(cur_tab, keep_overflow=False)
        except IndexError:
            return self.prev(cur_tab) 
Example #21
Source File: tabbedbrowser.py    From qutebrowser with GNU General Public License v3.0 5 votes vote down vote up
def next(self, cur_tab: QWidget, *, keep_overflow: bool = True) -> QWidget:
        """Get the 'next' tab in the stack.

        Throws IndexError on failure.
        """
        tab = None  # type: typing.Optional[QWidget]
        while tab is None or tab.pending_removal or tab is cur_tab:
            tab = self._stack_deleted.pop()()
        # On next tab-switch, current tab will be added to stack as normal.
        # However, we shouldn't wipe the overflow stack as normal.
        if keep_overflow:
            self._keep_deleted_next = True
        return tab 
Example #22
Source File: tabbedbrowser.py    From qutebrowser with GNU General Public License v3.0 5 votes vote down vote up
def prev(self, cur_tab: QWidget) -> QWidget:
        """Get the 'previous' tab in the stack.

        Throws IndexError on failure.
        """
        tab = None  # type: typing.Optional[QWidget]
        while tab is None or tab.pending_removal or tab is cur_tab:
            tab = self._stack.pop()()
        self._stack_deleted.append(weakref.ref(cur_tab))
        self._ignore_next = True
        return tab 
Example #23
Source File: tabbedbrowser.py    From qutebrowser with GNU General Public License v3.0 5 votes vote down vote up
def on_switch(self, old_tab: QWidget) -> None:
        """Record tab switch events."""
        if self._ignore_next:
            self._ignore_next = False
            self._keep_deleted_next = False
            return
        tab = weakref.ref(old_tab)
        if self._stack_deleted and not self._keep_deleted_next:
            self._stack_deleted = []
        self._keep_deleted_next = False
        self._stack.append(tab) 
Example #24
Source File: bar.py    From qutebrowser with GNU General Public License v3.0 5 votes vote down vote up
def moveEvent(self, e):
        """Extend moveEvent of QWidget to emit a moved signal afterwards.

        Args:
            e: The QMoveEvent.
        """
        super().moveEvent(e)
        self.moved.emit(e.pos()) 
Example #25
Source File: bar.py    From qutebrowser with GNU General Public License v3.0 5 votes vote down vote up
def resizeEvent(self, e):
        """Extend resizeEvent of QWidget to emit a resized signal afterwards.

        Args:
            e: The QResizeEvent.
        """
        super().resizeEvent(e)
        self.resized.emit(self.geometry()) 
Example #26
Source File: bar.py    From qutebrowser with GNU General Public License v3.0 5 votes vote down vote up
def _draw_widgets(self):
        """Draw statusbar widgets."""
        # Start with widgets hidden and show them when needed
        for widget in [self.url, self.percentage,
                       self.backforward, self.tabindex,
                       self.keystring, self.prog]:
            assert isinstance(widget, QWidget)
            widget.hide()
            self._hbox.removeWidget(widget)

        tab = self._current_tab()

        # Read the list and set widgets accordingly
        for segment in config.val.statusbar.widgets:
            if segment == 'url':
                self._hbox.addWidget(self.url)
                self.url.show()
            elif segment == 'scroll':
                self._hbox.addWidget(self.percentage)
                self.percentage.show()
            elif segment == 'scroll_raw':
                self._hbox.addWidget(self.percentage)
                self.percentage.set_raw()
                self.percentage.show()
            elif segment == 'history':
                self._hbox.addWidget(self.backforward)
                self.backforward.enabled = True
                if tab:
                    self.backforward.on_tab_changed(tab)
            elif segment == 'tabs':
                self._hbox.addWidget(self.tabindex)
                self.tabindex.show()
            elif segment == 'keypress':
                self._hbox.addWidget(self.keystring)
                self.keystring.show()
            elif segment == 'progress':
                self._hbox.addWidget(self.prog)
                self.prog.enabled = True
                if tab:
                    self.prog.on_tab_changed(tab) 
Example #27
Source File: SidebarWindow.py    From pyleecan with Apache License 2.0 5 votes vote down vote up
def __init__(self):
        # === App-Init ===
        super(SidebarWindow, self).__init__()
        self._title = "Pyleecan"
        self.setWindowTitle(self._title)
        self._main = QtWidgets.QWidget()
        self.setCentralWidget(self._main)

        # === Main Widgets ===
        # Navigation Panel with Button Group
        self.nav_panel = QtWidgets.QFrame()

        self.nav_btn_grp = QtWidgets.QButtonGroup()
        self.nav_btn_grp.setExclusive(True)
        self.nav_btn_grp.buttonClicked[int].connect(self.switch_stack)
        self.btn_grp_fct = []

        self.nav_layout = QtWidgets.QVBoxLayout(self.nav_panel)
        self.nav_layout.setContentsMargins(2, 2, 2, 2)
        self.nav_layout.addStretch(1)  # add stretch first

        # Sub Window Stack
        self.io_stack = QtWidgets.QStackedWidget(self)

        # Seperator Line
        line = QtWidgets.QFrame()
        line.setStyleSheet("QFrame { background-color: rgb(200, 200, 200) }")
        line.setFixedWidth(2)

        # === Main Layout ===
        main_layout = QtWidgets.QHBoxLayout()
        main_layout.addWidget(self.nav_panel)
        main_layout.addWidget(line)
        main_layout.addWidget(self.io_stack)

        self._main.setLayout(main_layout)

        self.show()
        self.centerOnScreen() 
Example #28
Source File: bar.py    From qutebrowser with GNU General Public License v3.0 5 votes vote down vote up
def _generate_stylesheet():
    flags = [
        ('private', 'statusbar.private'),
        ('caret', 'statusbar.caret'),
        ('caret-selection', 'statusbar.caret.selection'),
        ('prompt', 'prompts'),
        ('insert', 'statusbar.insert'),
        ('command', 'statusbar.command'),
        ('passthrough', 'statusbar.passthrough'),
        ('private-command', 'statusbar.command.private'),
    ]
    qss = """
        QWidget#StatusBar,
        QWidget#StatusBar QLabel,
        QWidget#StatusBar QLineEdit {
            font: {{ conf.fonts.statusbar }};
            color: {{ conf.colors.statusbar.normal.fg }};
        }

        QWidget#StatusBar {
            background-color: {{ conf.colors.statusbar.normal.bg }};
        }
    """
    for flag, option in flags:
        qss += """
            QWidget#StatusBar[color_flags~="%s"],
            QWidget#StatusBar[color_flags~="%s"] QLabel,
            QWidget#StatusBar[color_flags~="%s"] QLineEdit {
                color: {{ conf.colors.%s }};
            }

            QWidget#StatusBar[color_flags~="%s"] {
                background-color: {{ conf.colors.%s }};
            }
        """ % (flag, flag, flag,  # noqa: S001
               option + '.fg', flag, option + '.bg')
    return qss 
Example #29
Source File: Ui_WVent.py    From pyleecan with Apache License 2.0 5 votes vote down vote up
def setupUi(self, WVent):
        WVent.setObjectName("WVent")
        WVent.resize(630, 470)
        WVent.setMinimumSize(QtCore.QSize(630, 470))
        self.main_layout = QtWidgets.QVBoxLayout(WVent)
        self.main_layout.setObjectName("main_layout")
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.in_vent_type = QtWidgets.QLabel(WVent)
        self.in_vent_type.setObjectName("in_vent_type")
        self.horizontalLayout.addWidget(self.in_vent_type)
        self.c_vent_type = QtWidgets.QComboBox(WVent)
        self.c_vent_type.setObjectName("c_vent_type")
        self.c_vent_type.addItem("")
        self.c_vent_type.addItem("")
        self.c_vent_type.addItem("")
        self.horizontalLayout.addWidget(self.c_vent_type)
        spacerItem = QtWidgets.QSpacerItem(
            40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum
        )
        self.horizontalLayout.addItem(spacerItem)
        self.main_layout.addLayout(self.horizontalLayout)
        self.w_vent = QtWidgets.QWidget(WVent)
        self.w_vent.setMinimumSize(QtCore.QSize(640, 480))
        self.w_vent.setObjectName("w_vent")
        self.main_layout.addWidget(self.w_vent)

        self.retranslateUi(WVent)
        QtCore.QMetaObject.connectSlotsByName(WVent) 
Example #30
Source File: first.py    From FIRST-plugin-ida with GNU General Public License v2.0 5 votes vote down vote up
def init_top_layout(self):
            title = QtWidgets.QLabel('Check Function')
            title.setStyleSheet('font: 16pt;')

            description = QtWidgets.QLabel((
                'Query FIRST\'s server for function metadata.\n'
                'If a function within this IDB matches a signature found in '
                'FIRST then it and its metadata will be available for you to '
                'select below to apply to your IDB. Click to select a '
                'function\'s metadata and click again to deselect it.'))
            description.setWordWrap(True)
            description.setStyleSheet('text-size: 90%')

            vbox_text = QtWidgets.QVBoxLayout()
            vbox_text.addWidget(title)
            vbox_text.addWidget(description)

            widget = QtWidgets.QWidget()
            widget.setFixedWidth(100)
            vbox_legend = QtWidgets.QVBoxLayout(widget)
            grid_legend = QtWidgets.QGridLayout()
            style = 'background-color: #{0:06x}; border: 1px solid #c0c0c0;'
            colors = [FIRST.color_applied, FIRST.color_selected]
            text = ['Applied', 'Selected']
            for i in xrange(len(colors)):
                box = QtWidgets.QLabel()
                box.setFixedHeight(10)
                box.setFixedWidth(10)
                box.setStyleSheet(style.format(colors[i].color().rgb() & 0xFFFFFF))
                grid_legend.addWidget(box, i, 0)
                grid_legend.addWidget(QtWidgets.QLabel(text[i]), i, 1)

            vbox_legend.addLayout(grid_legend)
            vbox_legend.setAlignment(Qt.AlignRight | Qt.AlignBottom)
            vbox_legend.setContentsMargins(20, 0, 0, 0)


            self.top_layout.addLayout(vbox_text)
            self.top_layout.addWidget(widget)