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): hbox = qtwidgets.QHBoxLayout() hbox.addWidget(qtwidgets.QLabel('Find package build:')) self._edit = qtwidgets.QLineEdit() self._edit.setFont(_MONO_FONT_BOLD) self._edit.setPlaceholderText('Globbing pattern') self._edit.setFixedWidth(300) self._edit.returnPressed.connect(self.accept) hbox.addWidget(self._edit) self.setLayout(hbox)
def _build_ui(self): # whole widget's tooltip: name and version (if any) tooltip = self._pkg_build.info.name if self._pkg_build.info.version is not None: tooltip += ' {}'.format(self._pkg_build.info.version) self.setToolTip(tooltip) # background label (no text; just for the colour); assigning # this as its parent makes the label float under the other # widgets managed by this widget's layout self._bg_lbl = qtwidgets.QLabel('', self) self._bg_lbl.setSizePolicy(qtwidgets.QSizePolicy.Fixed, qtwidgets.QSizePolicy.Fixed) # horizontal box for name label and progress bar hbox = qtwidgets.QHBoxLayout() hbox.setSpacing(0) hbox.setContentsMargins(0, 0, 0, 0) # left padding hbox.addSpacing(5) # name label self._name_lbl = qtwidgets.QLabel(self._pkg_build.info.name) self._name_lbl.setFont(_MONO_FONT_BOLD) hbox.addWidget(self._name_lbl) hbox.addStretch() # progress bar self._pbar = _MinimalistProgressBar() self._pbar.setFixedSize(24, 8) # `+ 1` because we count this package build as its own # dependency so that, when all a package build's dependencies # are built, its state's progress bar is not complete self._pbar.setRange(0, len(self._pkg_build.info.dependencies) + 1) self._pbar.setValue(0) self._pbar.setTextVisible(False) hbox.addWidget(self._pbar) # right padding hbox.addSpacing(5) # set horizontal box as this widget's layout self.setLayout(hbox) # horizontal size policy is to ignore so that this widget takes # as much horizontal space as possible self.setSizePolicy(qtwidgets.QSizePolicy.Ignored, qtwidgets.QSizePolicy.Fixed) self.setFixedHeight(24)
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()