Exemplo n.º 1
0
    def _pack_info(self, layout):
        vbox = cellpack.VBox()
        if self.data.state == 'pending':
            layout.set_text_color(self.PENDING_TASK_TEXT_COLOR)
        else:
            layout.set_text_color(self.ITEM_TITLE_COLOR)
        layout.set_font(1.1, bold=True)
        title = cellpack.ClippedTextLine(layout.textbox(self.data.item_name))
        vbox.pack(cellpack.pad(title, top=12))

        layout.set_font(0.8)
        if self.data.state == 'pending':
            layout.set_text_color(self.PENDING_TASK_TEXT_COLOR)
        else:
            layout.set_text_color(self.ITEM_DESC_COLOR)
        info_label = layout.textbox(
            _("Conversion to %(format)s",
              {"format": self.data.target}))
        vbox.pack(cellpack.pad(info_label, top=4))

        if self.data.state == 'failed':
            vbox.pack(self._pack_failure_info(layout), expand=True)
        elif self.data.state == 'running':
            vbox.pack(self._pack_progress(layout), expand=True)
        elif self.data.state == 'finished':
            vbox.pack(self._pack_finished_info(layout), expand=True)
        else:
            vbox.pack(self._pack_pending_controls(layout), expand=True)

        return cellpack.pad(vbox, left=10)
Exemplo n.º 2
0
 def _pack_progress(self, layout):
     vbox = cellpack.VBox()
     
     hbox = cellpack.HBox()
     hbox.pack(cellpack.align_middle(cellpack.align_center(self._progress_textbox(layout))), expand=True)
     hbox.pack(cellpack.pad(cellpack.align_right(cellpack.Hotspot('interrupt', self.INTERRUPT_BUTTON)), right=3))
     background = cellpack.Background(cellpack.align_middle(hbox), min_width=356, min_height=20)
     background.set_callback(style.ProgressBarDrawer(self.data.progress, ConversionProgressBarColorSet).draw)
     
     vbox.pack_end(cellpack.pad(background, bottom=12))
     
     return vbox
Exemplo n.º 3
0
    def _pack_pending_controls(self, layout):
        vbox = cellpack.VBox()
        
        cancel_button = layout.button(_("Cancel"), self.hotspot=='cancel', style='webby')
        vbox.pack_end(cellpack.pad(cellpack.align_right(cellpack.Hotspot('cancel',
            cancel_button)), bottom=12))

        return vbox
Exemplo n.º 4
0
    def _pack_finished_info(self, layout):
        vbox = cellpack.VBox()

        layout.set_font(0.8, bold=True)
        layout.set_text_color(self.FINISHED_TASK_TEXT_COLOR)
        label = layout.textbox(_("Completed"))
        vbox.pack(cellpack.pad(label, top=4))

        hbox = cellpack.HBox()
        reveal_button = layout.button(self.REVEAL_IN_TEXT,
                self.hotspot=='reveal', style='webby')
        hbox.pack(cellpack.Hotspot('reveal', reveal_button))

        clear_button = layout.button(_("Clear"), self.hotspot=='clear-finished', style='webby')
        hbox.pack(cellpack.pad(cellpack.Hotspot('clear-finished', clear_button), left=8))

        vbox.pack_end(cellpack.pad(cellpack.align_right(hbox), bottom=12))

        return vbox
Exemplo n.º 5
0
    def _pack_failure_info(self, layout):
        vbox = cellpack.VBox()

        layout.set_font(0.8, bold=True)
        layout.set_text_color(self.FAILED_TASK_TEXT_COLOR)
        info_label2 = layout.textbox(
            _("Failed: %(error)s", {"error": self.data.error}))
        vbox.pack(cellpack.pad(cellpack.TruncatedTextLine(info_label2), top=4))
        
        # this resets the font so that the buttons aren't bold
        layout.set_font(0.8)
        hbox = cellpack.HBox()
        troubleshoot_button = layout.button(_("Troubleshoot"), self.hotspot=='troubleshoot', style='webby')
        hbox.pack(cellpack.Hotspot('troubleshoot', troubleshoot_button))
        open_log_button = layout.button(_("Open log"), self.hotspot=='open-log', style='webby')
        hbox.pack(cellpack.pad(cellpack.Hotspot('open-log', open_log_button), left=8))
        clear_button = layout.button(_("Clear"), self.hotspot=='clear-failed', style='webby')
        hbox.pack(cellpack.pad(cellpack.Hotspot('clear-failed', clear_button), left=8))
        vbox.pack_end(cellpack.pad(cellpack.align_right(hbox), bottom=12))

        return vbox