Exemplo n.º 1
0
Arquivo: ui.py Projeto: eepp/yobr
    def _build_ui(self):
        # set window's title from application name
        self.setWindowTitle(self._app.applicationName())

        # set icon
        self._set_icon()

        # main layout is a vertical box
        main_layout = qtwidgets.QVBoxLayout()
        w = qtwidgets.QWidget()
        w.setLayout(main_layout)
        self.setCentralWidget(w)

        # build menu bar, progress (top), and package build state grid
        self._build_ui_menu_bar()
        self._build_ui_progress_bars()
        main_layout.addWidget(self._built_pbar)
        main_layout.addWidget(self._installed_pbar)
        self._build_ui_pkg_build_state_grid()

        # wrap the grid within a scroll area
        scroll_area = qtwidgets.QScrollArea()
        scroll_area.setWidgetResizable(True)
        scroll_area.setWidget(self._pkg_build_state_grid)
        scroll_area.setMinimumWidth(300)

        # center of the window is the grid on the left and, possibly,
        # the details on the right
        hbox = qtwidgets.QHBoxLayout()
        hbox.addWidget(scroll_area)

        # build the details pane and add to center horizontal box
        self._build_ui_details()
        hbox.addWidget(self._details_scroll_area)
        main_layout.addLayout(hbox)

        # build status bar
        self._build_ui_status_bar()
Exemplo n.º 2
0
Arquivo: ui.py Projeto: eepp/yobr
    def _build_ui_details(self):
        def pkg_build_state_details_clicked(pkg_build_state):
            # change globally selected package build state
            self._pkg_build_state_grid.selected_pkg_build = pkg_build_state.pkg_build

        self._details = _PkgBuildStateDetails(self._pkg_build_monitor)
        self._details.pkg_build_state_clicked.connect(
            pkg_build_state_details_clicked)

        # wrap into a scroll area
        self._details_scroll_area = qtwidgets.QScrollArea()
        self._details_scroll_area.setWidgetResizable(True)
        self._details_scroll_area.setWidget(self._details)

        # no horizontal scrollbar: too ugly
        self._details_scroll_area.setHorizontalScrollBarPolicy(
            qtcore.Qt.ScrollBarAlwaysOff)

        # this seems to be enough
        self._details_scroll_area.setFixedWidth(300)

        # initially invisible
        self._details_scroll_area.setVisible(False)