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
def pack_bubble(self, hbox, layout_manager, count, color, selected=False): radius = int(layout_manager.current_font.line_height() / 2.0) + 1 if selected: layout_manager.set_text_color(widgetutil.BLACK) layout_manager.set_text_shadow(None) color = widgetutil.WHITE else: layout_manager.set_text_color(widgetutil.WHITE) layout_manager.set_text_shadow( widgetutil.Shadow(self.SELECTED_FONT_SHADOW, 0.5, (0, 1), 0)) if PLATFORMNAME == 'windows': # XXX FIXME HACK For 17305, the bubble text needs to move # up 2px on Windows. I can't figure out what the # difference is between Linux and Windows; it's not # miro.plat.frontends.widgets.use_custom_tablist_font. # Either way, there are better things to be spending time # on right now. bottom_extra = 2 else: bottom_extra = 0 if PLATFORMNAME == 'osx': # XXX FIXME HACK 17305, text on OSX needs to move 1px to the left left_extra = 0.5 else: left_extra = 0 if self.is_tall(): margin = (0, radius + left_extra, 2 + bottom_extra, radius - left_extra) else: margin = (1, radius + left_extra, 1 + bottom_extra, radius - left_extra) background = cellpack.Background(layout_manager.textbox(str(count)), margin=margin) background.set_callback(self.draw_bubble, color) hbox.pack(cellpack.align_middle(background))
def pack_bubble(self, hbox, layout_manager, count, color, selected=False): radius = int(layout_manager.current_font.line_height() / 2.0 )+ 1 if selected: layout_manager.set_text_color(widgetutil.BLACK) layout_manager.set_text_shadow(None) color = widgetutil.WHITE else: layout_manager.set_text_color(widgetutil.WHITE) layout_manager.set_text_shadow(widgetutil.Shadow( self.SELECTED_FONT_SHADOW, 0.5, (0, 1), 0)) if PLATFORMNAME == 'windows': # XXX FIXME HACK For 17305, the bubble text needs to move # up 2px on Windows. I can't figure out what the # difference is between Linux and Windows; it's not # miro.plat.frontends.widgets.use_custom_tablist_font. # Either way, there are better things to be spending time # on right now. bottom_extra = 2 else: bottom_extra = 0 if PLATFORMNAME == 'osx': # XXX FIXME HACK 17305, text on OSX needs to move 1px to the left left_extra = 0.5 else: left_extra = 0 if self.is_tall(): margin = (0, radius + left_extra, 2 + bottom_extra, radius - left_extra) else: margin = (1, radius + left_extra, 1 + bottom_extra, radius - left_extra) background = cellpack.Background(layout_manager.textbox(str(count)), margin=margin) background.set_callback(self.draw_bubble, color) hbox.pack(cellpack.align_middle(background))
def _pack_thumbnail(self, layout): thumb = cellpack.DrawingArea(self.THUMB_WIDTH, self.THUMB_HEIGHT, self._draw_thumbnail) return cellpack.align_middle(cellpack.align_center(thumb))