Exemplo n.º 1
0
Arquivo: ui.py Projeto: eepp/yobr
    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)
Exemplo n.º 2
0
Arquivo: ui.py Projeto: eepp/yobr
 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)
Exemplo n.º 3
0
Arquivo: ui.py Projeto: eepp/yobr
    def _reset_pkg_build_states(self, vbox, name, pkg_infos):
        # get vertical box layout's current items
        items = []

        for i in range(vbox.count()):
            items.append(vbox.itemAt(i))

        # remove items
        for item in items:
            vbox.removeItem(item)

            # we own `item` now: delete it later
            if item.layout() is not None:
                item.layout().deleteLater()

            if item.widget() is not None:
                item.widget().deleteLater()

        if len(pkg_infos) == 0:
            # nothing to show
            return

        # title
        vbox.addSpacing(12)
        text = '{} ({}):'.format(name, len(pkg_infos))
        vbox.addWidget(qtwidgets.QLabel(text))

        # create one package build state for each dependency (sorted by
        # name)
        for pkg_info in sorted(list(pkg_infos), key=lambda pi: pi.name):
            pkg_build = self._pkg_build_monitor.pkg_builds[pkg_info.name]
            pkg_build_state = _PkgBuildState(pkg_build,
                                             self._pkg_build_monitor)
            pkg_build_state.clicked.connect(self._pkg_build_state_clicked)
            vbox.addWidget(pkg_build_state)
Exemplo n.º 4
0
Arquivo: ui.py Projeto: eepp/yobr
 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)
Exemplo n.º 5
0
Arquivo: ui.py Projeto: eepp/yobr
 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)
Exemplo n.º 6
0
Arquivo: ui.py Projeto: eepp/yobr
 def create_mono_label(is_bold=False):
     lbl = qtwidgets.QLabel()
     lbl.setFont(_MONO_FONT_BOLD if is_bold else _MONO_FONT)
     return lbl