def _build_ui(self): hbox = qtwidgets.QHBoxLayout() pixmap = qtgui.QPixmap(_ICON_PATH).scaled( 128, 128, qtcore.Qt.IgnoreAspectRatio, qtcore.Qt.SmoothTransformation) lbl = qtwidgets.QLabel() lbl.setPixmap(pixmap) hbox.addWidget(lbl) self.setLayout(hbox) vbox = qtwidgets.QVBoxLayout() lbl = qtwidgets.QLabel('YO Buildroot!') font = lbl.font() font.setPointSize(14) font.setItalic(True) font.setBold(True) lbl.setFont(font) vbox.addWidget(lbl) lbl = qtwidgets.QLabel('v{}'.format(yobr.__version__)) lbl.setStyleSheet('color: rgba(0, 0, 0, .6); font-style: italic;') vbox.addWidget(lbl) vbox.addWidget(qtwidgets.QLabel()) lbl = qtwidgets.QLabel( '<b>Author</b>: <a href="https://eepp.ca/">Philippe Proulx</a>') vbox.addWidget(lbl) lbl = qtwidgets.QLabel( '<b>Icon</b>: <i>srip</i> from <a href="https://www.flaticon.com/">www.flaticon.com</a>' ) vbox.addWidget(lbl) lbl = qtwidgets.QLabel( '<b>Website</b>: <a href="https://github.com/eepp/yobr">github.com/eepp/yobr</a>' ) vbox.addWidget(lbl) vbox.addStretch() hbox.addSpacing(10) hbox.addLayout(vbox)
def _build_ui(self): def add_label(stage): lbl = qtwidgets.QLabel() font = qtgui.QFont(_MONO_FONT_BOLD) font.setPointSize(16) lbl.setFont(font) _set_build_stage_label(lbl, stage, _BUILD_STAGE_COLORS_BG) vbox.addWidget(lbl) vbox = qtwidgets.QVBoxLayout() add_label(yobr.br.PkgBuildStage.UNKNOWN) add_label(yobr.br.PkgBuildStage.DOWNLOADED) add_label(yobr.br.PkgBuildStage.EXTRACTED) add_label(yobr.br.PkgBuildStage.PATCHED) add_label(yobr.br.PkgBuildStage.CONFIGURED) add_label(yobr.br.PkgBuildStage.BUILT) add_label(yobr.br.PkgBuildStage.INSTALLED) self.setLayout(vbox)
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()
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)