def __init__(self):
        BaseApplet.__init__(self)
        self.ind = appindicator.Indicator(
                "Webilder Indicator",
                os.path.abspath(
                    pkg_resources.resource_filename(__name__,
                                                    'ui/camera48.png')),
                appindicator.CATEGORY_APPLICATION_STATUS)
        self.ind.set_status(appindicator.STATUS_ACTIVE)
        propxml = """
    <popup name="button3">
        <menuitem name="Item 1" action="Browse"/>
        <menuitem name="Item 2" action="NextPhoto"/>
        <menuitem name="Item 3" action="Leech"/>
        <menuitem name="Item 6" action="DeleteCurrent"/>
        <menuitem name="Item 4" action="Pref"/>
        <menuitem name="Item 5" action="About"/>
        <menuitem name="Item 5" action="Quit"/>
        <menuitem name="Item 7" action="Current"/>
    </popup>
    """
        uimanager = gtk.UIManager()
        uimanager.add_ui_from_string(propxml)
        action_group = gtk.ActionGroup("WebilderActions")
        action_group.add_actions([
             ("Pref", "gtk-preferences",  _("_Preferences"), "<control>P", 
              _("Open the preferences dialog"), self.preferences ),
             ("About", "gtk-about", _("_About"),  "<control>A", 
              _("About Webilder"), self.about),
             ("Browse", "gtk-directory", _("_Browse Photos"), "<control>B", 
              _("Browse your photo colleciton"), self.browse),
             ("NextPhoto", "gtk-go-forward", _("_Next Photo"), "<control>N",
              _("Switch wallpaper to the next photo"), self.next_photo),
             ("Leech", None, _("_Download Photos"), "<control>D",
              _("Download new photos"), self.leech),
             ("DeleteCurrent", "gtk-delete", _("Delete Current"), None,
              _("Delete the current photo from your collection"),
               self.delete_current),
             ("Quit", "gtk-quit", _("Quit"), None,
              _("Quit Webilder Desktop Indicator"),
               self.quit),
             ("Current", "gtk-current", _("_Current"),  "<control>U", 
              _("Current"), self.current),
             ])
        leech_action = action_group.get_action("Leech")
        leech_action.set_gicon(gio.FileIcon(gio.File(
            pkg_resources.resource_filename(__name__,
                                            'ui/camera48.png'))))

        uimanager.insert_action_group(action_group, 0)

        menu = uimanager.get_widget('/button3')
        self.ind.set_menu(menu)

        gobject.timeout_add(60*1000, self.timer_event)
        self.photo_browser = None
        self.download_dlg = None
Example #2
0
    def __init__(self, applet, _iid):
        BaseApplet.__init__(self)
        gnome.init('WebilderApplet', __version__)
        self.applet = applet
        self.tooltips = gtk.Tooltips()
        self.tooltips.enable()
        self.evtbox = gtk.EventBox()
        self.icon = gtk.gdk.pixbuf_new_from_file(
            pkg_resources.resource_filename(__name__, 'ui/camera48.png'))
        self.icon_green = gtk.gdk.pixbuf_new_from_file(
            pkg_resources.resource_filename(__name__, 'ui/camera48_g.png'))

        self.applet_icon = gtk.Image()
        self.scaled_icon = self.icon.scale_simple(16, 16,
                gtk.gdk.INTERP_BILINEAR)
        self.scaled_icon_green = self.icon_green.scale_simple(16, 16,
                gtk.gdk.INTERP_BILINEAR)

        self.applet_icon.set_from_pixbuf(self.scaled_icon)
        self.evtbox.add(self.applet_icon)
        self.applet.add(self.evtbox)
        # ### Item 7 new in following list
        self.propxml = _("""
    <popup name="button3">
        <menuitem name="Item 1" verb="Browse" label="_Browse Collection" pixtype="stock"
pixname="gtk-directory"/>
        <menuitem name="Item 2" verb="NextPhoto" label="_Next Photo" pixtype="stock"
pixname="gtk-go-forward"/>
        <menuitem name="Item 3" verb="Leech" label="_Download Photos" pixtype="filename"
pixname="%s"/>
        <menuitem name="Item 7" verb="InfoCurrent" label="_Info on Current" pixtype="stock" pixname="gtk-dialog-info"/>
        <menuitem name="Item 6" verb="DeleteCurrent" label="_Delete Current" pixtype="stock" pixname="gtk-delete"/>
        <menuitem name="Item 4" verb="Pref" label="_Preferences" pixtype="stock"
pixname="gtk-preferences"/>
        <menuitem name="Item 5" verb="About" label="_About" pixtype="stock" pixname="gnome-stock-about"/>
        </popup>
    """) % pkg_resources.resource_filename(__name__, 'ui/camera16.png')

        self.applet.connect("change-size", self.on_resize_panel)
        self.applet.connect("button-press-event", self.on_button_press)

        self.verbs = [
            ( "Pref", self.preferences ),
            ( "About", self.about),
            ( "Browse", self.browse),
            ( "NextPhoto", self.next_photo),
            ( "Leech", self.leech),
            ( "DeleteCurrent", self.delete_current),
            ( "InfoCurrent", self.info_current)] # ### "InfoCurrent" is new
        self.applet.setup_menu(self.propxml, self.verbs, None)
        self.applet.show_all()
        gobject.timeout_add(60*1000, self.timer_event)
        self.photo_browser = None
        self.download_dlg = None
Example #3
0
    def __init__(self):
        BaseApplet.__init__(self)
        self.ind = appindicator.Indicator(
            "Webilder Indicator",
            os.path.abspath(
                pkg_resources.resource_filename(__name__, 'ui/camera48.png')),
            appindicator.CATEGORY_APPLICATION_STATUS)
        self.ind.set_status(appindicator.STATUS_ACTIVE)
        propxml = """
    <popup name="button3">
        <menuitem name="Item 1" action="Browse"/>
        <menuitem name="Item 2" action="NextPhoto"/>
        <menuitem name="Item 3" action="Leech"/>
        <menuitem name="Item 6" action="DeleteCurrent"/>
        <menuitem name="Item 4" action="Pref"/>
        <menuitem name="Item 5" action="About"/>
        <menuitem name="Item 5" action="Quit"/>
    </popup>
    """
        uimanager = gtk.UIManager()
        uimanager.add_ui_from_string(propxml)
        action_group = gtk.ActionGroup("WebilderActions")
        action_group.add_actions([
            ("Pref", "gtk-preferences", _("_Preferences"), "<control>P",
             _("Open the preferences dialog"), self.preferences),
            ("About", "gtk-about", _("_About"), "<control>A",
             _("About Webilder"), self.about),
            ("Browse", "gtk-directory", _("_Browse Photos"), "<control>B",
             _("Browse your photo colleciton"), self.browse),
            ("NextPhoto", "gtk-go-forward", _("_Next Photo"), "<control>N",
             _("Switch wallpaper to the next photo"), self.next_photo),
            ("Leech", None, _("_Download Photos"), "<control>D",
             _("Download new photos"), self.leech),
            ("DeleteCurrent", "gtk-delete", _("Delete Current"), None,
             _("Delete the current photo from your collection"),
             self.delete_current),
            ("Quit", "gtk-quit", _("Quit"), None,
             _("Quit Webilder Desktop Indicator"), self.quit),
        ])
        leech_action = action_group.get_action("Leech")
        leech_action.set_gicon(
            gio.FileIcon(
                gio.File(
                    pkg_resources.resource_filename(__name__,
                                                    'ui/camera48.png'))))

        uimanager.insert_action_group(action_group, 0)

        menu = uimanager.get_widget('/button3')
        self.ind.set_menu(menu)

        gobject.timeout_add(60 * 1000, self.timer_event)
        self.photo_browser = None
        self.download_dlg = None