def __init__(self, ui, savedmap_data): TrayButton.__init__(self) self.ui = ui self.data = savedmap_data img = self.get_img() self.set_icon_widget(img) self.setup_rollover_options()
def __init__(self, buf, color, title, owner, hash, notes=None): TrayButton.__init__(self) self._fill, self._stroke = color.split(',') self.set_image(buf) self.hash = hash self.notes = notes info = title + '\n' + owner self.setup_rollover_options(info)
def __init__(self, buf, color, title, owner, hash): TrayButton.__init__(self) # Color read from the Journal may be Unicode, but Rsvg needs # it as single byte string: if isinstance(color, unicode): color = str(color) self.set_image(buf, color.split(',')[1], color.split(',')[0]) self.hash = hash info = title + '\n' + owner self.setup_rollover_options(info)
def __init__(self, buf, color, title, owner, page): TrayButton.__init__(self) # Color read from the Journal may be Unicode, but Rsvg needs # it as single byte string: if isinstance(color, unicode): color = str(color) if buf is not None: self.set_image(buf, color.split(',')[1], color.split(',')[0]) else: self.set_empty_image(page, color.split(',')[1], color.split(',')[0]) self.page = int(page) self.setup_rollover_options(title, owner)
def __init__(self, buf, color, title, owner, page, local): TrayButton.__init__(self) # Color read from the Journal may be Unicode, but Rsvg needs # it as single byte string: self._color = color if isinstance(color, unicode): self._color = str(color) self._have_preview = False if buf is not None: self.set_image(buf) else: self.set_empty_image(page) self.page = int(page) self.setup_rollover_options(title, owner, local)
def __init__(self, recd): TrayButton.__init__(self) self._recd = recd self.set_icon_widget(self.get_image()) self._copy_menu_item_handler = None palette = Palette(recd.title) self.set_palette(palette) self._box = PaletteMenuBox() palette.set_content(self._box) self._box.show() self._rem_menu_item = PaletteMenuItem( _('Erase'), icon_name='edit-delete') self._rem_menu_item_handler = self._rem_menu_item.connect( 'activate', self._remove_clicked) self._box.append_item(self._rem_menu_item) self._rem_menu_item.show() self._add_copy_menu_item()
def __init__(self, recd): TrayButton.__init__(self) self._recd = recd self.set_icon_widget(self.get_image()) self._copy_menu_item_handler = None palette = Palette(recd.title) self.set_palette(palette) self._box = PaletteMenuBox() palette.set_content(self._box) self._box.show() self._rem_menu_item = PaletteMenuItem(_('Erase'), icon_name='edit-delete') self._rem_menu_item_handler = self._rem_menu_item.connect( 'activate', self._remove_clicked) self._box.append_item(self._rem_menu_item) self._rem_menu_item.show() self._add_copy_menu_item()
from sugar3.graphics.tray import TrayButton, TrayIcon import common test = common.Test() vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) tray = HTray() vbox.pack_start(tray, False, False, 0) tray.show() theme_icons = Gtk.IconTheme.get_default().list_icons(context=None) for i in range(0, 100): button = TrayButton(icon_name=theme_icons[i]) tray.add_item(button) button.show() tray = HTray() vbox.pack_start(tray, False, False, 0) tray.show() for i in range(0, 10): icon = TrayIcon(icon_name=theme_icons[i]) tray.add_item(icon) icon.show() hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) tray = VTray()
box.pack_start(toolbar, False, False, 0) toolbar.show() for i in range(0, 5): button = ToolButton(icon_name=theme_icons[i]) button.set_tooltip('Icon %d' % i) toolbar.insert(button, -1) button.show() content = Gtk.Label() box.pack_start(content, True, True, 0) content.show() tray = HTray() box.pack_start(tray, False, False, 0) tray.show() for i in range(0, 30): button = TrayButton(icon_name=theme_icons[i]) button.set_tooltip('Icon %d' % i) tray.add_item(button) button.show() test.pack_start(box, True, True, 0) box.show() test.show() if __name__ == '__main__': common.main(test)
from sugar3.graphics.tray import TrayButton, TrayIcon import common test = common.Test() vbox = Gtk.VBox() tray = HTray() vbox.pack_start(tray, False, False, 0) tray.show() theme_icons = Gtk.IconTheme.get_default().list_icons(context=None) for i in range(0, 100): button = TrayButton(icon_name=theme_icons[i]) tray.add_item(button) button.show() tray = HTray() vbox.pack_start(tray, False, False, 0) tray.show() for i in range(0, 10): icon = TrayIcon(icon_name=theme_icons[i]) tray.add_item(icon) icon.show() hbox = Gtk.HBox() tray = VTray()