Esempio n. 1
0
class Sidebar(Gtk.EventBox):
    def __init__(self):
        Gtk.EventBox.__init__(self)
        self.set_size_request(20, -1)
        # Take care of the background first
        white = Gdk.color_parse("white")
        self.modify_bg(Gtk.StateType.NORMAL, white)

        self.box = Gtk.VButtonBox()
        self.box.set_layout(Gtk.ButtonBoxStyle.CENTER)
        self.add(self.box)

        self.box.show()
        self.show()

        self.bookmark_icon = Icon(icon_name = 'emblem-favorite', \
            pixel_size = 18)
        tooltip_text = _('Bookmark')
        self.bookmark_icon.set_tooltip_text(tooltip_text)
        self.box.pack_start(self.bookmark_icon, False, False, 0)

    def show_bookmark_icon(self, state):
        if state:
            self.bookmark_icon.show_all()
        else:
            self.bookmark_icon.hide()
Esempio n. 2
0
class Sidebar(Gtk.EventBox):
    def __init__(self):
        Gtk.EventBox.__init__(self)
        self.set_size_request(20, -1)
        # Take care of the background first
        white = Gdk.color_parse("white")
        self.modify_bg(Gtk.StateType.NORMAL, white)

        self.box = Gtk.VButtonBox()
        self.box.set_layout(Gtk.ButtonBoxStyle.CENTER)
        self.add(self.box)

        self.box.show()
        self.show()

        self.bookmark_icon = Icon(icon_name = 'emblem-favorite', \
            pixel_size = 18)
        tooltip_text = _('Bookmark') 
        self.bookmark_icon.set_tooltip_text(tooltip_text)
        self.box.pack_start(self.bookmark_icon, False, False, 0)

    def show_bookmark_icon(self, state):
        if state:
            self.bookmark_icon.show_all()
        else:
            self.bookmark_icon.hide()
Esempio n. 3
0
    def fill_list(self, icons):

        client = GConf.Client.get_default()
        path = '/desktop/sugar/user/color'
        color = client.get_string(path)
        global xocolor
        xocolor = XoColor(color)
        current = get_current_icon()
        if not self.is_default:
            icons.append("computer-xo-default")

        for icon_name in icons:
            icon = Icon(icon_name=icon_name,
                        xo_color=xocolor,
                        pixel_size=style.MEDIUM_ICON_SIZE)

            icon_box = Gtk.EventBox()
            icon_box.add(icon)
            icon_box.connect('button-press-event', self.update)
            size = style.MEDIUM_ICON_SIZE + 20
            icon_box.set_size_request(size, size)

            icon_fixed = Icon(icon_name=icon_name,
                              xo_color=xocolor,
                              pixel_size=style.XLARGE_ICON_SIZE)
            icon_fixed.set_tooltip_text(icon_name)
            icon_fixed.set_property('has-tooltip', False)

            icon_box.set_tooltip_text(icon_name)
            icon_box.set_property('has-tooltip', False)

            self.pack_start(icon_box, False, False, 0)
            self.pack_start(Gtk.VSeparator(), False, False, 3)

            if icon_name == current:
                self.icon = icon_fixed
                self.icon_real = icon_box
                icon_box.set_sensitive(False)
            self.icons[icon_box] = icon_fixed
Esempio n. 4
0
    def fill_list(self, icons):

        client = GConf.Client.get_default()
        path = '/desktop/sugar/user/color'
        color = client.get_string(path)
        global xocolor
        xocolor = XoColor(color)
        current = get_current_icon()
        if not self.is_default:
                    icons.append("computer-xo-default")

        for icon_name in icons:
            icon = Icon(icon_name=icon_name, xo_color=xocolor,
                        pixel_size=style.MEDIUM_ICON_SIZE)

            icon_box = Gtk.EventBox()
            icon_box.add(icon)
            icon_box.connect('button-press-event', self.update)
            size = style.MEDIUM_ICON_SIZE + 20
            icon_box.set_size_request(size, size)

            icon_fixed = Icon(icon_name=icon_name, xo_color=xocolor,
                              pixel_size=style.XLARGE_ICON_SIZE)
            icon_fixed.set_tooltip_text(icon_name)
            icon_fixed.set_property('has-tooltip', False)

            icon_box.set_tooltip_text(icon_name)
            icon_box.set_property('has-tooltip', False)

            self.pack_start(icon_box, False, False, 0)
            self.pack_start(Gtk.VSeparator(), False, False, 3)

            if icon_name == current:
                self.icon = icon_fixed
                self.icon_real = icon_box
                icon_box.set_sensitive(False)
            self.icons[icon_box] = icon_fixed