コード例 #1
0
ファイル: ui.py プロジェクト: 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()
コード例 #2
0
ファイル: ui.py プロジェクト: eepp/yobr
    def _build_ui(self):
        def create_mono_label(is_bold=False):
            lbl = qtwidgets.QLabel()
            lbl.setFont(_MONO_FONT_BOLD if is_bold else _MONO_FONT)
            return lbl

        # main layout is a vertical box
        vbox = qtwidgets.QVBoxLayout()

        # package's name
        self._name_lbl = create_mono_label(True)
        font = self._name_lbl.font()
        font.setPointSize(12)
        self._name_lbl.setFont(font)
        vbox.addWidget(self._name_lbl)
        vbox.addSpacing(12)

        def create_base_form(stage_lbl_attr, version_lbl_attr,
                             is_virtual_lbl_attr):
            form = qtwidgets.QFormLayout()
            form.setContentsMargins(0, 0, 0, 0)
            form.setVerticalSpacing(2)
            form.setHorizontalSpacing(16)
            lbl = create_mono_label(True)
            setattr(self, stage_lbl_attr, lbl)
            form.addRow('Build stage:', lbl)
            lbl = create_mono_label()
            setattr(self, version_lbl_attr, lbl)
            form.addRow('Version:', lbl)
            lbl = create_mono_label()
            setattr(self, is_virtual_lbl_attr, lbl)
            form.addRow('Virtual?', lbl)
            return form

        # textual information (target)
        form = create_base_form('_target_stage_lbl', '_target_version_lbl',
                                '_target_virtual_lbl')
        self._install_target_lbl = create_mono_label()
        form.addRow('Install (target)?', self._install_target_lbl)
        self._install_staging_lbl = create_mono_label()
        form.addRow('Install (staging)?', self._install_staging_lbl)
        self._install_images_lbl = create_mono_label()
        form.addRow('Install (images)?', self._install_images_lbl)
        self._target_info = qtwidgets.QWidget()
        self._target_info.setLayout(form)
        vbox.addWidget(self._target_info)

        # textual information (host)
        form = create_base_form('_host_stage_lbl', '_host_version_lbl',
                                '_host_virtual_lbl')
        self._host_info = qtwidgets.QWidget()
        self._host_info.setLayout(form)
        vbox.addWidget(self._host_info)

        # dependencies and dependants are within their own vertical box
        # (empty for the moment)
        self._dependencies_vbox = qtwidgets.QVBoxLayout()
        vbox.addLayout(self._dependencies_vbox)
        self._dependants_vbox = qtwidgets.QVBoxLayout()
        vbox.addLayout(self._dependants_vbox)

        vbox.addStretch()

        # set main vertical box as this widget's layout
        self.setLayout(vbox)