Ejemplo n.º 1
0
    def __init__(self, icon):
        self.indicator = appindicator.Indicator(
            app.config.get(prefs.SHORT_APP_NAME), icon,
            appindicator.CATEGORY_APPLICATION_STATUS)
        self.indicator.set_status(appindicator.STATUS_PASSIVE)
        self.menu_items = []
        self.indicator.set_icon_theme_path(resources.share_path('icons'))
        self.calculate_popup_menu()

        #FIXME: this is a bit of a hack since the signal probably
        # wasn't meant to be used this way. However, it is emitted
        # every time app.menu_manager.update_menus() is called
        # and therefore it covers all situations where we want to
        # update the app indicator menu. The signal is also emitted
        # sometimes when no update to the app indicator menu is needed
        # (espcecially during downloads). Therefore we later only set
        # a new app indicator menu if there actually is a change in
        # the menu text. This avoids a flickering menu.
        app.menu_manager.connect('enabled-changed', self._on_menu_update)
Ejemplo n.º 2
0
    def start(self):
        """ Function used to show an icon in notification area."""

        if APPINDICATOR:
            self.indicator = appindicator.Indicator(
                "billreminder", "ApplicationStatus",
                appindicator.CATEGORY_APPLICATION_STATUS)
            self.indicator.set_status(appindicator.STATUS_ACTIVE)
            self.indicator.set_attention_icon(common.PANEL_ATTENTION_ICON)
            self.indicator.set_icon(common.PANEL_ICON)
            self.menu = self.show_menu(None, None, None)
            self.indicator.set_menu(self.menu)
            self.menu.show()
        else:
            self.tray = gtk.StatusIcon()
            self.tray.set_from_file(common.TRAY_ICON)
            self.tray.set_tooltip(_("BillReminder"))
            self.tray.connect("popup-menu", self.show_menu, None)
            self.tray.connect("activate", self.show_hide, None)
Ejemplo n.º 3
0
    def __init__(self):
        # Setup some callbacks to update the status of the buttons
        self.monitor.daemon_status_callback=self.serviceCheck;

        ind = appindicator.Indicator ("autorotate-client", "gsd-xrandr", appindicator.CATEGORY_APPLICATION_STATUS)
        ind.set_status (appindicator.STATUS_ACTIVE)
        ind.set_attention_icon ("indicator-messages-new")
        
        # create a menu
        menu = gtk.Menu()

        rotate_submenu = gtk.Menu();
        rotate_item=gtk.MenuItem("Rotate Screen")
        rotate_item.show()
        menu.append(rotate_item);

        # create some labels for the normal rotations
        directions=["Normal","Left","Inverted","Right"];
        for direction in directions:
            menu_item = gtk.MenuItem("  "+direction)
            menu.append(menu_item)
            menu_item.connect("activate",self.setRotation,direction)
            # show the items
            menu_item.show()
        
        # Add button to enable automatic rotation
        menu.append(self.auto_menu_item)
        self.auto_menu_item.connect("activate",self.setRotation,direction)
        self.auto_menu_item.show()

        # Autorotate configuration menu
        separator_item1=gtk.SeparatorMenuItem();
        separator_item1.show();
        menu.append(separator_item1);
            
        self.daemon_menu_item.connect("activate",self.startStopDaemon);
        menu.append(self.daemon_menu_item);
        self.daemon_menu_item.show();

        # Run the indicator!
        ind.set_menu(menu)

        gtk.main()
Ejemplo n.º 4
0
    def __init__(self, window, terminal):
        self.window = window
        self.window.set_size_request(652, 447)
        self.window.set_position(gtk.WIN_POS_CENTER)
        self.window.connect('delete-event', self.delete_event)
        self.terminal = terminal

        self.window.add(terminal)
        self.childpid = self.terminal.fork_command(self.command[0],
                                                   self.command, os.getcwd())
        if self.childpid > 0:
            self.childexited = self.terminal.connect('child-exited',
                                                     self.on_child_exited)
            self.window.connect('delete-event', lambda w, e: gtk.main_quit())
        else:
            self.childexited = None

        spawn_later(0.5, self.show_startup_notify)

        self.window.show_all()

        logo_filename = os.path.join(
            os.path.abspath(os.path.dirname(__file__)), 'goproxy-gtk.png')
        self.window.set_icon_from_file(logo_filename)

        if appindicator:
            self.trayicon = appindicator.Indicator(
                'GoProxy', 'indicator-messages',
                appindicator.CATEGORY_APPLICATION_STATUS)
            self.trayicon.set_status(appindicator.STATUS_ACTIVE)
            self.trayicon.set_attention_icon('indicator-messages-new')
            self.trayicon.set_icon(logo_filename)
            self.trayicon.set_menu(self.make_menu())
        else:
            self.trayicon = gtk.StatusIcon()
            self.trayicon.set_from_file(logo_filename)
            self.trayicon.connect(
                'popup-menu', lambda i, b, t: self.make_menu().popup(
                    None, None, gtk.status_icon_position_menu, b, t, self.
                    trayicon))
            self.trayicon.connect('activate', self.show_hide_toggle)
            self.trayicon.set_tooltip('GoProxy')
            self.trayicon.set_visible(True)
Ejemplo n.º 5
0
def main():
    ind = appi.Indicator("OneDIR", "Notify message", appi.CATEGORY_APPLICATION_STATUS)
    ind.set_status(appi.STATUS_ACTIVE)
    ind.set_icon("/home/justin/tiny_strip.png")
    ind.set_attention_icon("indicator-messages-new")
    menu = gtk.Menu()
    title = gtk.MenuItem("OneDir Notification: (click below)")
    notif = gtk.MenuItem("A friend invited you to share a folder")
    q = gtk.MenuItem("quit")
    notif.connect("activate", wp_launcher)
    q.connect("activate", quit)
    menu.append(title)
    menu.append(notif)
    menu.append(q)
    title.show()
    notif.show()
    q.show()
    ind.set_menu(menu)
    gtk.main()
Ejemplo n.º 6
0
    def init_systray(self):
        # Build the systray icon
        if self.systray_icon:
            return

        if self.systray_indicator:
            self.systray_icon = appindicator.Indicator(
                "virt-manager", "virt-manager-icon",
                appindicator.CATEGORY_OTHER)
            self.systray_icon.set_status(appindicator.STATUS_ACTIVE)
            self.systray_icon.set_menu(self.systray_menu)

        else:
            self.systray_icon = gtk.StatusIcon()
            self.systray_icon.set_visible(True)
            self.systray_icon.set_property("icon-name", "virt-manager")
            self.systray_icon.connect("activate", self.systray_activate)
            self.systray_icon.connect("popup-menu", self.systray_popup)
            self.systray_icon.set_tooltip(_("Virtual Machine Manager"))
Ejemplo n.º 7
0
    def __init__(self, indicator_hdl):
        if not isinstance(indicator_hdl, SBackupdIndicatorHandler):
            raise TypeError(
                "Parameter of type `SBackupdIndicatorHandler` expected.")

        SBackupdIndicatorBase.__init__(self, indicator_hdl)

        self.logger = LogFactory.getLogger()
        self._indicator = appindicator.Indicator(
            constants.INDICATORAPP_NAME, constants.INDICATOR_ACTIVE_ICON,
            appindicator.CATEGORY_APPLICATION_STATUS)

        PyNotifyMixin.__init__(self,
                               logger=self.logger,
                               iconfile=util.get_resource_file(
                                   constants.NOTIFICATION_ICON_FILENAME),
                               trayicon=None)

        self.__init_ctrls()
Ejemplo n.º 8
0
    def __init__(self, window, terminal):
        self.window = window
        self.window.set_size_request(652, 447)
        self.window.set_position(gtk.WIN_POS_CENTER)
        self.window.connect('delete-event',self.delete_event)
        self.terminal = terminal

        if os.system('which python3') == 0:
            self.command[1] = 'python3'

        self.window.add(terminal)
        self.childpid = self.terminal.fork_command(self.command[0], self.command, os.getcwd())
        if self.childpid > 0:
            self.childexited = self.terminal.connect('child-exited', self.on_child_exited)
            self.window.connect('delete-event', lambda w, e: gtk.main_quit())
        else:
            self.childexited = None

        spawn_later(0.5, self.show_startup_notify)

        if should_visible():
            self.window.show_all()

        logo_filename = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'goagent-logo.png')
        if not os.path.isfile(logo_filename):
            with open(logo_filename, 'wb') as fp:
                fp.write(base64.b64decode(GOAGENT_LOGO_DATA))
        self.window.set_icon_from_file(logo_filename)

        if appindicator:
            self.trayicon = appindicator.Indicator('GoAgent', 'indicator-messages', appindicator.CATEGORY_APPLICATION_STATUS)
            self.trayicon.set_status(appindicator.STATUS_ACTIVE)
            self.trayicon.set_attention_icon('indicator-messages-new')
            self.trayicon.set_icon(logo_filename)
            self.trayicon.set_menu(self.make_menu())
        else:
            self.trayicon = gtk.StatusIcon()
            self.trayicon.set_from_file(logo_filename)
            self.trayicon.connect('popup-menu', lambda i, b, t: self.make_menu().popup(None, None, gtk.status_icon_position_menu, b, t, self.trayicon))
            self.trayicon.connect('activate', self.show_hide_toggle)
            self.trayicon.set_tooltip('GoAgent')
            self.trayicon.set_visible(True)
Ejemplo n.º 9
0
    def __init__(self, dbus_client):

        self.ind = appindicator.Indicator(
            "curator", "curator-tray",
            appindicator.CATEGORY_APPLICATION_STATUS)
        self.ind.set_status(appindicator.STATUS_ACTIVE)

        self.dbus_client = dbus_client

        self.menu = gtk.Menu()

        next = gtk.MenuItem("Next wallpaper")
        self.menu.append(next)
        next.connect_object("activate",
                            lambda w: self.dbus_client.next_wallpaper(),
                            "Next Wallpaper")
        next.show()

        hide = gtk.MenuItem("Hide wallpaper")
        self.menu.append(hide)
        hide.connect_object("activate",
                            lambda w: self.dbus_client.hide_current(),
                            "Hide wallpaper")
        hide.show()

        pref = gtk.MenuItem("Preferences")
        self.menu.append(pref)
        pref.connect_object("activate", lambda w: self.preferences(),
                            "Preferences")
        pref.show()

        about = gtk.MenuItem("About")
        self.menu.append(about)
        about.connect_object("activate", lambda w: self.about(), "About")
        about.show()

        quit = gtk.MenuItem("Quit")
        self.menu.append(quit)
        quit.connect_object("activate", lambda w: self.quit(), "Quit")

        quit.show()
        self.ind.set_menu(self.menu)
Ejemplo n.º 10
0
    def __init__(self):
        """Setup notifications, and gtk"""

        # Initialize Ubuntu notifications
        self.notificationsAvailable = pynotify.init("ubuntu-timer")

        self.indicator = appindicator.Indicator(
            "example-simple-client", "",
            appindicator.CATEGORY_APPLICATION_STATUS)

        self.indicator.set_status(appindicator.STATUS_ACTIVE)
        self.indicator.set_attention_icon("indicator-messages-new")
        self.indicator.set_label("00:00")

        self.createMenu()

        self.notify("Hello toast")

        # Start gtk
        gtk.main()
	def __init__(self):
		self.folder=os.path.dirname(os.path.realpath(__file__))    #Get the aplication's folder.
		n=self.get_interfaces()                                    #Get the interfaces (that also fills the interfaces list
		
		#This is our indicator object! (name, icon,type)
		self.ind = appindicator.Indicator ("indicator-netspeed",
									"zero",
									appindicator.CATEGORY_SYSTEM_SERVICES)
		self.ind.set_icon_theme_path("%s/icons"%self.folder)    #Set the icon theme folder!
		self.ind.set_status (appindicator.STATUS_ACTIVE)
		self.ind.set_label("⇧ 0.0  B/s  ⇩ 0.0  B/s",'⬆8888 MB/s  ⬇8888 MB/s') #Initially set the label to ⇧ 0.0  B/s  ⇩ 0.0  B/s
		
		self.build_menu()    #Build the menu
		self.alive = threading.Event()  
		self.alive.set()
		self.fetch = NetspeedFetcher(self)
		self.fetch.start()   # Start fetcher thread
		self.nethogs_thread=threading.Thread(target=self._tail_forever, args=("",))   #set the bandwidth/process monitor thread
		if self.bandwidthPerProcess_active:    #If the functionality is active
			self.nethogs_thread.start()    #Start the thread!
Ejemplo n.º 12
0
    def build_menu(self, current_git_username):
        self.ind = appindicator.Indicator("git-indicator", "krb-valid-ticket",
                                          appindicator.CATEGORY_OTHER)
        self.ind.set_status(appindicator.STATUS_ACTIVE)
        self.ind.set_label(current_git_username)

        menu = gtk.Menu()

        for name in sorted(self.devs):
            self._add_name_item(menu, name)

        separator = SeparatorMenuItem()
        menu.append(separator)

        self._add_action_item(menu, 'Restart', self.restart)
        self._add_action_item(menu, 'Quit', self.quit)
        menu.show_all()

        self.ind.set_menu(menu)
        return menu
Ejemplo n.º 13
0
    def __init__(self):
        self.ind = appindicator.Indicator(
            "Ubuntu Mouse Gestures", "system-file-manager-panel",
            appindicator.CATEGORY_APPLICATION_STATUS)
        self.ind.set_status(appindicator.STATUS_ACTIVE)
        # self.ind.set_attention_icon ("indicator-messages-new")

        # create a menu
        self.menu = gtk.Menu()

        # create items for the menu - labels, checkboxes, radio buttons and images are supported:

        title = gtk.MenuItem("Linux Mouse Gestures")

        title.set_sensitive(False)
        self.menu.append(title)

        self.menu.append(gtk.SeparatorMenuItem())

        settings = gtk.ImageMenuItem(gtk.STOCK_PREFERENCES)

        settings.connect("activate", self.settings)
        self.menu.append(settings)

        about = gtk.ImageMenuItem(gtk.STOCK_ABOUT)
        about.connect("activate", self.about)

        self.menu.append(about)

        self.menu.append(gtk.SeparatorMenuItem())

        quit = gtk.ImageMenuItem(gtk.STOCK_QUIT)
        quit.connect("activate", self.quit)
        quit.show()
        self.menu.append(quit)

        self.ind.set_menu(self.menu)
        self.menu.show_all()

        self.bg = Thread(target=self.start_log)
        self.bg.start()
Ejemplo n.º 14
0
	def __init__(self, persist, icon, label):
		# parameters
		self.persist = persist #True
		self.icon = icon #'terminal'
		self.status = appindicator.STATUS_ATTENTION #ACTIVE
		self.label = label
		# indicator
		self.ind = appindicator.Indicator ("c-indicator", self.icon, appindicator.CATEGORY_OTHER)
		self.ind.set_label(self.label)
		self.ind.set_attention_icon (self.icon)
		self.ind.set_status(self.status)
		# menu
		self.menu = gtk.Menu()
		self.submenus = dict()
		for line in sys.stdin:
			line = line[0:len(line)-1] # removing last '\n'
			self.add_menu(self.menu, line, line)
		if self.persist:
			self.add_quit()
		self.menu.show()
		self.ind.set_menu(self.menu)
Ejemplo n.º 15
0
 def __init__(self):
     
     self.pings = []
     self.lastRate = [-1, -1, True]
     menu = gtk.Menu()
     quit = gtk.MenuItem("Quit")
     about = gtk.MenuItem("Packet Drop Indicator")
     ind = appindicator.Indicator(
             "pingmon-indicator", 
             "emblem-OK",
             appindicator.CATEGORY_OTHER,
           )
     ind.set_menu(menu)
     ind.set_attention_icon("emblem-ohno")
     self.updateIcon(ind)
     quit.connect("activate", self.destroy)
     about.connect("activate", self.about)
     menu.append(about)
     menu.append(quit)
     menu.show_all()
     gobject.timeout_add(PING_FREQUENCY, self.ping, ind)
Ejemplo n.º 16
0
    def __init__(self, application, mainWnd):
        import gtk
        import appindicator
        self._application = application
        self._mainWnd = mainWnd

        self._icon = os.path.abspath(
            os.path.join(getImagesDir(), "outwiker_64x64.png"))
        assert os.path.exists(self._icon)
        self._indicator = appindicator.Indicator(
            "OutWiker", self._icon, appindicator.CATEGORY_APPLICATION_STATUS)
        menu = gtk.Menu()
        self.restoreMenuItem = gtk.MenuItem(_('Restore'))
        self.restoreMenuItem.show()

        self.exitMenuItem = gtk.MenuItem(_('Exit'))
        self.exitMenuItem.show()

        menu.append(self.restoreMenuItem)
        menu.append(self.exitMenuItem)
        self._indicator.set_menu(menu)
Ejemplo n.º 17
0
    def __init__(self, btconf):
        """
        Initialise the indicator, load the config file,
        intialise some properties and set up the basic
        menu
        """

        self.ind = appindicator.Indicator(
            "btsync-indicator", "btsync",
            appindicator.CATEGORY_APPLICATION_STATUS, args.iconpath)
        self.ind.set_status(appindicator.STATUS_ACTIVE)
        self.ind.set_attention_icon("btsync-attention")

        self.config = btconf.config
        self.detect_btsync_user()

        if 'login' in self.config['webui']:
            login = self.config['webui']['login']
            password = self.config['webui']['password']
            self.webui = 'http://' + login + ':' + password + '@' + self.config[
                'webui'][
                    'listen'] if self.btsync_user else 'http://' + self.config[
                        'webui']['listen']
            self.auth = (login, password)
        else:
            self.webui = 'http://' + self.config['webui']['listen']
            self.auth = None

        self.urlroot = 'http://' + self.config['webui']['listen'] + '/gui/'
        self.folderitems = {}
        self.info = {}
        self.clipboard = gtk.Clipboard()
        self.animate = None
        self.error_item = None
        self.frame = 0
        self.status = None
        self.count = 0

        self.menu_setup()
        self.ind.set_menu(self.menu)
Ejemplo n.º 18
0
    def build_indicator(self):
        self.ind = appindicator.Indicator(
            "example-simple-client", "indicator-messages",
            appindicator.CATEGORY_APPLICATION_STATUS)
        self.ind.set_status(appindicator.STATUS_ACTIVE)
        self.ind.set_attention_icon("indicator-messages-new")
        self.ind.set_icon("distributor-logo")
        self.menu = gtk.Menu()
        self.ind.set_menu(self.menu)

        ask_now_menuitem = gtk.MenuItem("Ask now")
        ask_now_menuitem.connect(
            "activate", self.new_question_window,
            True)  #The callback data means it will launch in "perpetual mode"

        set_timer_menuitem = gtk.MenuItem("Set timer")
        timer_submenu = gtk.Menu()
        set_timer_menuitem.set_submenu(timer_submenu)

        self.current_timer_menu_item = None

        for minute in [5, 10, 15, 30, 45, 60]:
            timer_menuitem = gtk.CheckMenuItem("{0} minutes".format(minute))
            timer_menuitem.connect("toggled", self.on_timer_changed, minute)
            timer_submenu.append(timer_menuitem)

        edit_menu_item = gtk.MenuItem("Edit notecards")
        edit_menu_item.connect("activate", self.on_edit_clicked)

        # Why would anyone want to quit? Anyways,
        quit_menu_item = gtk.MenuItem("Exit")
        quit_menu_item.connect("activate", self.quit)

        for item in [
                ask_now_menuitem, set_timer_menuitem, edit_menu_item,
                quit_menu_item
        ]:
            self.menu.append(item)

        self.menu.show_all()
Ejemplo n.º 19
0
    def __init__(self, icon, menu):
        if sys.platform == "linux2":
            self.menu = menu.gtk_menu
            import appindicator
            self.icon_directory = os.path.sep + 'usr' + os.path.sep + 'share' + os.path.sep + 'icons' + os.path.sep + 'zik' + os.path.sep
            if not os.path.isdir(self.icon_directory):
                self.icon_directory = os.path.dirname(
                    sys.argv[0]
                ) + os.path.sep + 'share' + os.path.sep + 'icons' + os.path.sep + 'zik' + os.path.sep
            self.statusicon = appindicator.Indicator(
                "new-parrotzik-indicator", "indicator-messages",
                appindicator.CATEGORY_APPLICATION_STATUS)
            self.statusicon.set_status(appindicator.STATUS_ACTIVE)
            self.statusicon.set_icon_theme_path(self.icon_directory)
            self.statusicon.set_menu(self.menu)

        elif sys.platform == "win32":
            self.menu = menu.gtk_menu
            self.icon_directory = os.path.dirname(
                os.path.realpath(sys.argv[0])
            ) + os.path.sep + 'share' + os.path.sep + 'icons' + os.path.sep + 'zik' + os.path.sep
            self.statusicon = gtk.StatusIcon()
            self.statusicon.connect("popup-menu", self.gtk_right_click_event)
            self.statusicon.set_tooltip("Parrot Zik")
            self.menu_shown = False
            sys.stdout = open(
                tempfile.gettempdir() + os.path.sep + "zik_tray_stdout.log",
                "w")
            sys.stderr = open(
                tempfile.gettempdir() + os.path.sep + "zik_tray_stderr.log",
                "w")

        elif sys.platform == "darwin":
            self.icon_directory = os.path.dirname(
                os.path.realpath(sys.argv[0])
            ) + os.path.sep + 'share' + os.path.sep + 'icons' + os.path.sep + 'zik' + os.path.sep
            self.statusicon = StatusApp.sharedApplication()
            self.statusicon.initMenu(menu)

        self.setIcon(icon)
Ejemplo n.º 20
0
 def __init__(self):
     """Init creation of the gtk.Menu and binding to the appindicator"""
     self.colormap = {
         "White": "FFFFFF",
         "Yellow": "FFFF00",
         "Purple": "FF00FF",
         "Cyan": "00FFFF",
         "Red": "FF0000",
         "Green": "00FF00",
         "Blue": "0000FF"
     }
     self.ind = appindicator.Indicator(
         "pyAlienFX",
         "/home/xqua/Documents/Work/Coding/Python/pyalienfx/images/indicator_off.png",
         appindicator.CATEGORY_APPLICATION_STATUS)
     self.ind.set_status(appindicator.STATUS_ACTIVE)
     self.ind.set_attention_icon(
         "/home/xqua/Documents/Work/Coding/Python/pyalienfx/images/indicator_on.png"
     )
     self.gui = pyAlienFX.pyAlienFX_GUI()
     self.menu_setup()
     self.ind.set_menu(self.menu)
Ejemplo n.º 21
0
    def __init__(self):
        # create systray interface
        self.systray = appindicator.Indicator(
            "testname", iconpath, appindicator.CATEGORY_APPLICATION_STATUS)
        self.systray.set_status(appindicator.STATUS_ACTIVE)

        # construct menu
        menu = gtk.Menu()
        mitem = gtk.MenuItem("configure")
        menu.append(mitem)
        mitem.connect("activate", self.createConfigWindow)
        mitem.show()
        mitem = gtk.MenuItem("exit")
        menu.append(mitem)
        mitem.connect("activate", self.exit_program)
        mitem.show()

        # attach menu to out system tray
        self.systray.set_menu(menu)

        # instantiate confcontroller
        self.myConf = ConfController()
Ejemplo n.º 22
0
    def buildMenu(self):

        try:
            import appindicator
            self.app_indicator = appindicator.Indicator(
                APPNAME, APP_INDICATOR_ICON_OFF,
                appindicator.CATEGORY_APPLICATION_STATUS)
            self.app_indicator.set_status(appindicator.STATUS_ACTIVE)
        except Exception as e:
            self.log.debug(e)
            self.log.warn("Failed to create an Application Indicator!")
            self.app_indicator = None

        self.app_indicator.set_icon_theme_path(IMAGE_PATH)
        self.turnOnOff = None
        self.metadata_menu_item = None
        self.perferences_submenu = None
        self.preferences_menu = None
        self.radioMenu = Gtk.Menu()
        self.build_app_indicator_menu(self.radioMenu)
        self.app_indicator.set_menu(self.radioMenu)
        self.handler.updateTooltip()
Ejemplo n.º 23
0
    def _create_tray(self):

        self.tray_menu_logged_in = gtk.Menu()
        self.tray_menu_logged_out = gtk.Menu()

        if appindicator is not None:
            g_logger.info("APP INDICATOR!")
            # This means we're running on unity and we need a different tray
            self.tray_indicator = appindicator.Indicator(
                "open-monitor",  # APP ID
                "internet-feed-reader",  # ICON NAME
                appindicator.CATEGORY_APPLICATION_STATUS)  # APP CATEGORY
            self.tray_indicator.set_status(appindicator.STATUS_ACTIVE)
            self.tray_indicator.set_attention_icon("indicator-messages-new")
            self.tray_indicator.set_menu(self.tray_menu_logged_out)

        else:
            self.tray_icon = gtk.StatusIcon()
            self.tray_icon.connect('popup-menu', self.show_menu)
            self.tray_icon.set_tooltip("Open Monitor")
            self.tray_icon.set_from_file(
                os.path.join(ICONS_DIR, "tray_icon_gray_32.ico"))
Ejemplo n.º 24
0
    def __init__(self):
        self.indicator = appindicator.Indicator(
            "Lookit", "lookit-panel", appindicator.CATEGORY_APPLICATION_STATUS)
        self.indicator.set_status(appindicator.STATUS_ACTIVE)

        self.menu = gtk.Menu()
        self.add_menu_item('Capture Area', cmd.CAPTURE_AREA)
        self.add_menu_item('Capture Entire Screen', cmd.CAPTURE_SCREEN)
        self.add_menu_item('Capture Active Window', cmd.CAPTURE_ACTIVE_WINDOW)

        self.add_menu_separator()

        delaymenu = gtk.Menu()
        self.add_menu_item('0 seconds', cmd.DELAY_0, delaymenu)
        self.add_menu_item('3 seconds', cmd.DELAY_3, delaymenu)
        self.add_menu_item('5 seconds', cmd.DELAY_5, delaymenu)
        self.add_menu_item('10 seconds', cmd.DELAY_10, delaymenu)
        sub = gtk.MenuItem('Set Delay:')
        sub.set_submenu(delaymenu)
        self.menu.append(sub)

        config = lookitconfig.LookitConfig()
        enableupload = config.getboolean('Upload', 'enableupload')
        self.add_check_menu_item('Upload to server',
                                 cmd.TOGGLE_UPLOAD,
                                 value=enableupload)

        self.add_menu_separator()
        self.add_menu_item('Preferences', cmd.SHOW_PREFERENCES)
        self.add_menu_item('About', cmd.SHOW_ABOUT)

        self.image_position = len(self.menu)
        self.image_list = []

        self.add_menu_separator()
        self.add_menu_item('Exit', cmd.EXIT)

        self.menu.show_all()
        self.indicator.set_menu(self.menu)
Ejemplo n.º 25
0
    def __init__(self, args):
        # create an indicator applet
        self.ind = appindicator.Indicator(
            "PHreak", "phreak", appindicator.CATEGORY_APPLICATION_STATUS)
        self.ind.set_status(appindicator.STATUS_ACTIVE)
        self.ind.set_icon(PHreak.icon_filename)
        self.db = set()

        # create a menu
        self.menu = gtk.Menu()

        # create items for the menu - refresh, quit and a separator
        menuSeparator = gtk.SeparatorMenuItem()
        menuSeparator.show()
        self.menu.append(menuSeparator)

        btnAbout = gtk.MenuItem("About")
        btnAbout.show()
        btnAbout.connect("activate", self.showAbout)
        self.menu.append(btnAbout)

        btnRefresh = gtk.MenuItem("Refresh")
        btnRefresh.show()
        #the last parameter is for not running the timer
        btnRefresh.connect("activate", self.refresh, True)
        self.menu.append(btnRefresh)

        btnQuit = gtk.MenuItem("Quit")
        btnQuit.show()
        btnQuit.connect("activate", self.quit)
        self.menu.append(btnQuit)

        self.menu.show()

        if pynotify:
            pynotify.init("phreak")

        self.refresh()
        self.ind.set_menu(self.menu)
Ejemplo n.º 26
0
def init_tray_icon():
    global resdir, indicator, status_icon

    # Default image
    image = resdir + "/tray/tray.png"

    # Display manager detection
    display_manager = get_display_manager()
    use_indicator = display_manager == "unity" or display_manager == "gnome2"

    do_print("Detected display manager '{0}'.".format(display_manager))

    # Try loading "appindicator" package; if not existant,
    # fall back to status icons
    if use_indicator:
        try:
            import appindicator
        except:
            do_print(
                "Couldn't load 'appindicator' package. Using status icons.")
            use_indicator = 0

    # Go!
    if use_indicator:
        do_print("Initializing indicator...")

        indicator = appindicator.Indicator(
            "Stacksync", image, appindicator.CATEGORY_APPLICATION_STATUS)
        indicator.set_status(appindicator.STATUS_ACTIVE)
        indicator.set_attention_icon("indicator-messages-new")

    else:
        do_print("Initializing status icon...")

        status_icon = gtk.StatusIcon()
        status_icon.set_from_file(image)
        status_icon.connect('popup-menu', status_icon_popup_menu_cb)
        status_icon.set_visible(True)
        status_icon.set_tooltip("Stacksync")
Ejemplo n.º 27
0
def main():
    DBusGMainLoop(set_as_default=True)

    global HAS_INDICATOR
    gtk.gdk.threads_init()
    config.loads();
    try:
        import ctypes
        libc = ctypes.CDLL('libc.so.6')
        libc.prctl(15, 'hotot', 0, 0, 0)
    except:
        import dl
        libc = dl.open('/lib/libc.so.6')
        libc.call('prctl', 15, 'hotot', 0, 0, 0)

    agent.init_notify()
    app = Hotot()
    agent.app = app
    if HAS_INDICATOR:
        indicator = appindicator.Indicator('hotot',
                                            'hotot',
                                            appindicator.CATEGORY_COMMUNICATIONS,
                                            utils.get_ui_object('image'))
        indicator.set_status(appindicator.STATUS_ACTIVE)
        indicator.set_icon('ic24_hotot_mono_light')
        indicator.set_attention_icon('ic24_hotot_mono_light_blink')
        indicator.set_menu(app.menu_tray)
        app.indicator = indicator

    # Set display functions (MeMenu)
    if HAS_MEMENU:
        global ind_server, indicator_unread
        ind_server.connect("server-display", app.on_mitem_resume_activate)
        indicator_unread.connect("user-display", app.on_mitem_resume_activate) 

    gtk.gdk.threads_enter()
    gtk.main()
    gtk.gdk.threads_leave()
Ejemplo n.º 28
0
    def __init__(self):
        if version_at_least_2_6_27:
            #from Janitha
            #contents are just "(123,456)" for x,y position.
            self._hdaps_position = "/sys/devices/platform/hdaps/position"
        else:
            #I have no idea if this works.
            self._hdaps_position = "/sys/devices/platform/hdaps/position"

        self.ind = appindicator.Indicator("hdaps-theft-alarm-indicator",
                                          "purse-thief",
                                          appindicator.CATEGORY_HARDWARE)
        self.ind.set_status(appindicator.STATUS_ACTIVE)
        self.ind.set_icon("purse-thief")

        #TODO: persist this.
        self.__quiet_mode = False

        self.menu_setup()
        self.ind.set_menu(self.menu)
        #######

        self.ind.set_status(appindicator.STATUS_ACTIVE)
Ejemplo n.º 29
0
    def __init__(self, settings):
        self.__log.debug('Initializing %s', self.__class__)
        dummy_icon = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                                  'images', 'icon.png')
        self.__log.debug('Loading dummy icon from %s', dummy_icon)
        self.ind = appindicator.Indicator(
            "ip-indicator", dummy_icon,
            appindicator.CATEGORY_APPLICATION_STATUS)
        self.ind.set_status(appindicator.STATUS_ACTIVE)

        self.settings = settings
        self.__log.debug('Settings: %s', vars(settings))
        self.settings.sanitize_url()
        self.selected_interface = None
        self.refresh()
        if self.interfaces.has_interface(self.settings.interface):
            self.__log.debug('Using interface %s from settings',
                             self.settings.interface)
            self._menu_items[self.settings.interface].select()
        else:
            self.__log.debug('Cannot use interface %s from settings',
                             self.settings.interface)
        self._connect_dbus()
Ejemplo n.º 30
0
 def __init__(self):
     # create an indicator applet
     self.ind = appindicator.Indicator(
         'JVPN Tray', 'jvpn-status',
         appindicator.CATEGORY_APPLICATION_STATUS)
     self.ind.set_status(appindicator.STATUS_ACTIVE)
     self.ind.set_attention_icon(jvpn_icon)
     self.ind.set_icon(jvpn_icon_bw)
     self.keyring = Keyring()
     self.invalid_cred = False
     # create a menu
     self.menu = gtk.Menu()
     # create items for the menu
     self.status = gtk.MenuItem('Not connected')
     self.status.show()
     self.menu.append(self.status)
     # A separator
     separator = gtk.SeparatorMenuItem()
     separator.show()
     self.menu.append(separator)
     # jvpn connect menu
     self.btnconnect = gtk.MenuItem("Connect")
     self.btnconnect.connect("activate", self.connect)
     self.btnconnect.show()
     # jvpn disconnect menu
     self.btndisconnect = gtk.MenuItem("Disconnect")
     self.btndisconnect.connect("activate", self.disconect)
     # quit menu
     btnquit = gtk.ImageMenuItem(gtk.STOCK_QUIT)
     btnquit.connect("activate", self.quit)
     btnquit.show()
     self.menu.append(self.btnconnect)
     self.menu.append(self.btndisconnect)
     self.menu.append(btnquit)
     self.menu.show()
     self.ind.set_menu(self.menu)
     self.t_jvpn = JVPN(None, None)