Commits

elbaschid committed fe79efa

added setup to indicator

  • Participants
  • Parent commits 8ee20dd

Comments (0)

Files changed (6)

data/icons/48x48/apps/revelation-indicator-locked.png

Added
New image

data/revelation-indicator-locked.png

Removed
Old image

revelation-indicator.py

-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-#
-
-import sys
-
-import gtk
-import appindicator
-
-import gettext
-_ = gettext.gettext
-
-from revelation import config, data, datahandler, dialog, entry, io, ui, util
-
-#from gi.repository import Gtk, GObject, Gio
-#from gi.repository import AppIndicator3
- 
-#try:
-#    from gi.repository import Notify
-#except:
-#    #print _("Please install")+" pynotify"
-#    print "Please install pynotify"
-
-class RevelationIndicator(object):
-
-    def __init__(self):
-        self.ind = appindicator.Indicator(
-            "revelation-indicator-locked",
-            "revelation-indicator",
-            appindicator.CATEGORY_APPLICATION_STATUS
-        )
-
-        self.ind.set_status(appindicator.STATUS_ACTIVE)
-
-        #self.ind.set_status(AppIndicator3.STATUS_ACTIVE)
-        #self.ind.set_attention_icon("new-messages-red")
-
-        import sys
-        sys.excepthook	= self.__cb_exception
-
-        gettext.bindtextdomain(config.PACKAGE, config.DIR_LOCALE)
-        gettext.bind_textdomain_codeset(config.PACKAGE, "UTF-8")
-        gettext.textdomain(config.PACKAGE)
-        
-        try:
-            #self.__init_config()
-            self.__init_facilities()
-            self.__init_ui()
-            #self.__init_states()
-
-        except config.ConfigError:
-            dialog.Error(
-                None, 
-                _('Missing configuration data'), 
-                _('The applet could not find its configuration data, please'
-                  'reinstall Revelation.')
-            ).run()
-            sys.exit(1)
-
-    def __init_facilities(self):
-        "Sets up facilities"
-
-        self.clipboard		= data.Clipboard()
-        self.datafile		= io.DataFile(datahandler.Revelation)
-        self.entrystore		= data.EntryStore()
-        self.entrysearch	= data.EntrySearch(self.entrystore)
-        #self.items		= ui.ItemFactory(self.applet)
-        #self.locktimer		= data.Timer()
-
-        #self.config.monitor("autolock_timeout", lambda k,v,d: self.locktimer.start(v * 60))
-        #self.config.monitor("file", self.__cb_config_file)
-
-        #self.datafile.connect("changed", self.__cb_file_changed)
-        #self.datafile.connect("content-changed", self.__cb_file_content_changed)
-        #self.locktimer.connect("ring", self.__cb_file_autolock)
-
-        #self.entrysearch.folders = False
-    
-    def __init_ui(self):
-        self.menu = gtk.Menu()
-
-        self.unlock_item = gtk.MenuItem(_('Unlock File'))
-        self.unlock_item.show()
-
-        self.lock_item = gtk.MenuItem(_('Lock File'))
-        self.lock_item.show()
-
-        self.reload_item = gtk.MenuItem(_('Reload File'))
-        self.reload_item.show()
-
-        self.start_revel_item = gtk.MenuItem(_('Start Revelation'))
-        self.start_revel_item.show()
-
-        self.prefs_item = gtk.MenuItem(_('Preferences'))
-        self.prefs_item.show()
-
-        self.about_item = gtk.MenuItem(_('About'))
-        self.about_item.show()
-        self.about_item.connect('activate', self.about)
-
-		#	( "about",		lambda w,d=None: self.about() ),
-		#	( "file-lock",		lambda w,d=None: self.file_close() ),
-		#	( "file-reload",	lambda w,d=None: self.file_reload() ),
-		#	( "file-unlock",	lambda w,d=None: self.file_open(self.config.get("file")) ),
-		#	( "prefs",		lambda w,d=None: self.prefs() ),
-		#	( "revelation",		lambda w,d=None: util.execute_child("@bindir@/revelation") ),
-
-        self.menu.append(self.lock_item)
-        self.menu.append(self.unlock_item)
-        self.menu.append(self.reload_item)
-        self.menu.append(self.start_revel_item)
-        self.menu.append(self.prefs_item)
-        self.menu.append(self.about_item)
-
-        self.ind.set_menu(self.menu)
-
-        gtk.about_dialog_set_url_hook(
-            lambda d,l: gtk.show_uri(None, l, gtk.get_current_event_time())
-        )
-
-	gtk.about_dialog_set_email_hook(
-            lambda d,l: gtk.show_uri(None, "mailto:" + l, gtk.get_current_event_time())
-        )
-
-#	# set up window icons
-#	pixbufs = [ self.items.get_pixbuf("revelation", size) for size in ( 48, 32, 24, 16) ]
-#	pixbufs = [ pixbuf for pixbuf in pixbufs if pixbuf != None ]
-#
-#	if len(pixbufs) > 0:
-#	    gtk.window_set_default_icon_list(*pixbufs)
-#
-        # set up popup menu
-        #self.applet.setup_menu("""
-		#	<popup name="button3">
-		#		<menuitem name="file-unlock"	verb="file-unlock"	label=\"""" + _('Unlock File') + """\"		pixtype="stock" pixname="revelation-unlock" />
-		#		<menuitem name="file-lock"	verb="file-lock"	label=\"""" + _('Lock File') + """\"		pixtype="stock" pixname="revelation-lock" />
-		#		<menuitem name="file-reload"	verb="file-reload"	label=\"""" + _('Reload File') + """\"		pixtype="stock" pixname="revelation-reload" />
-		#		<separator />
-		#		<menuitem name="revelation"	verb="revelation"	label=\"""" + _('Start Revelation') + """\"	pixtype="stock" pixname="revelation-revelation" />
-		#		<menuitem name="prefs"		verb="prefs"		label=\"""" + _('Preferences') + """\"		pixtype="stock"	pixname="gtk-properties" />
-		#		<menuitem name="about"		verb="about"		label=\"""" + _('About') + """\"		pixtype="stock"	pixname="gnome-stock-about" />
-		#	</popup>
-		#""", (
-		#	( "about",		lambda w,d=None: self.about() ),
-		#	( "file-lock",		lambda w,d=None: self.file_close() ),
-		#	( "file-reload",	lambda w,d=None: self.file_reload() ),
-		#	( "file-unlock",	lambda w,d=None: self.file_open(self.config.get("file")) ),
-		#	( "prefs",		lambda w,d=None: self.prefs() ),
-		#	( "revelation",		lambda w,d=None: util.execute_child("@bindir@/revelation") ),
-		#), None)
-
-		## set up ui items
-		#self.entry = ui.Entry()
-		#self.entry.set_width_chars(14)
-		#self.entry.connect("activate", self.__cb_entry_activate)
-		#self.entry.connect("button_press_event", self.__cb_entry_buttonpress)
-		#self.entry.connect("key_press_event", lambda w,d=None: self.locktimer.reset())
-
-		#self.icon = ui.Image()
-		#self.eventbox = ui.EventBox(self.icon)
-		#self.eventbox.connect("button_press_event", self.__cb_icon_buttonpress)
-
-		#self.hbox = ui.HBox(self.eventbox, self.entry)
-		#self.applet.add(self.hbox)
-		#
-		## handle Gnome Panel background
-		#self.applet.connect("change-background",self.panel_bg)
-
-		#self.applet.show_all()
-
-		## set up various ui element holders
-		#self.popup_entryview	= None
-		#self.popup_entrylist	= None
-
-		#self.entrymenu		= None
-
-    def main(self):
-        gtk.main()
-
-    def quit(self, widget):
-        sys.exit(0)
-
-    def about(self, item):
-        dialog = gtk.AboutDialog()
-        dialog.set_name(_('Revelation Indicator'))
-        dialog.set_comments(_('An indicator applet to browse a Revelation database'))
-        dialog.set_version("0.1")
-        dialog.set_copyright("(c) Sebastian Vetter")
-        dialog.run()
-        dialog.destroy()
-
-    def __cb_exception(self, type, value, trace):
-
-        if type == KeyboardInterrupt:
-            sys.exit(1)
-
-        traceback = util.trace_exception(type, value, trace)
-        sys.stderr.write(traceback)
-
-        if dialog.Exception(None, traceback).run() == True:
-            gtk.main()
-        else:
-            sys.exit(1)
-
-def main():
-    revelation_indicator = RevelationIndicator()
-    revelation_indicator.main()
-
-if __name__ == "__main__":
-    main()

revelation_indicator.py

             logger.debug('using provided file: %s', filename)
             
         self.ind = appindicator.Indicator(
-            "revelation-indicator-locked",
             "revelation-indicator",
+            "revelation-indicator-locked", #defines icon
             appindicator.CATEGORY_APPLICATION_STATUS
         )
 
 
         # make sure the launchers have been set up, otherwise
         # install the Revelation schema
-        def check_launchers():
-            try:
-                for entrytype in [ et() for et in entry.ENTRYLIST if et != entry.FolderEntry ]:
-                    self.config.get("/apps/revelation/launcher/%s" % entrytype.id)
+        #def check_launchers():
+        #    try:
+        #        for entrytype in [ et() for et in entry.ENTRYLIST if et != entry.FolderEntry ]:
+        #            self.config.get("/apps/revelation/launcher/%s" % entrytype.id)
 
-            except config.ConfigError:
-                return False
+        #    except config.ConfigError:
+        #        return False
 
-            else:
-                return True
+        #    else:
+        #        return True
 
 
-        if check_launchers() == False:
-            if config.install_schema("%s/revelation.schemas" % config.DIR_GCONFSCHEMAS) == False:
-                raise config.ConfigError
+        #if check_launchers() == False:
+        #    if config.install_schema("%s/revelation.schemas" % config.DIR_GCONFSCHEMAS) == False:
+        #        raise config.ConfigError
 
-            if check_launchers() == False:
-                raise config.ConfigError
+        #    if check_launchers() == False:
+        #        raise config.ConfigError
 
     def __init_facilities(self):
         "Sets up facilities"
+[build]
+icons = True
+help = False 
 # You should have received a copy of the GNU General Public License
 
 from distutils.core import setup
+from DistUtilsExtra.command import *
+
 
 import revelation_indicator
 
     description = '',
     #long_description = revelation_indicator.__doc__,
 
+    scripts = ['revelation_indicator.py'],
     packages = [],
 
     provides = [],
     license = 'GNU General Public License (GPL)',
 
+    data_files = [],
+
+    cmdclass = { 
+        "build" : build_extra.build_extra,
+        "build_i18n" :  build_i18n.build_i18n,
+        "build_help" :  build_help.build_help,
+        "build_icons" :  build_icons.build_icons
+    },
+
     classifiers = [
         'Development Status :: 4 - Beta',
         'License :: OSI Approved :: GNU General Public License (GPL)',