コード例 #1
0
ファイル: volatile.py プロジェクト: gavinhungry/volatile
    def init_gtk(self):
        self.icon = gtk.StatusIcon()
        self.icon.connect('activate', self.toggle_window)
        self.icon.connect('popup-menu', self.toggle_mute)
        self.icon.connect('scroll-event', self.on_scroll)

        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.window.set_skip_taskbar_hint(True)
        self.window.set_skip_pager_hint(True)
        self.window.set_decorated(False)
        self.window.set_resizable(False)
        self.window.set_keep_above(True)
        self.window.set_wmclass('volatile', 'volatile')
        self.window.set_opacity(self.WINDOW_OPACITY)
        self.window.connect('focus-out-event', self.on_focus_out)

        self.slider = gtk.HScale()
        self.slider.set_can_focus(False)
        self.slider.set_size_request(self.VOLUME_WIDTH, self.VOLUME_HEIGHT)
        self.slider.set_range(0, 100)
        self.slider.set_increments(-self.SCROLL_BY, -self.SCROLL_BY * 2)
        self.slider.set_draw_value(0)
        self.slider.connect('value-changed', self.on_slide)

        self.frame = gtk.Frame()
        self.frame.set_shadow_type(gtk.SHADOW_OUT)
        self.frame.add(self.slider)

        self.window.add(self.frame)
コード例 #2
0
ファイル: dewdrop.py プロジェクト: avafloww/dewdrop
    def __init__(self, app):
        self._app = app
        self._app.dew = self

        icons = gtk.IconTheme()
        app_icon = "tray"
        try:
            assert icons.has_icon(app_icon)
        except AssertionError:
            app_icon = "/tmp/tray.png"
            icon = pkg_resources.resource_string(
                __name__, 'windows/resources/tray/white.png')
            f = open(app_icon, "w")
            f.write(icon)
            f.close()

        if not hasattr(self._app, 'statusIcon'):
            if USE_APP_INDICATOR:
                self._app.statusIcon = appindicator.Indicator(
                    'Dewdrop', app_icon,
                    appindicator.CATEGORY_APPLICATION_STATUS)
                self._app.statusIcon.set_status(appindicator.STATUS_ACTIVE)
            else:
                self._app.statusIcon = gtk.StatusIcon()
                self._app.statusIcon.set_from_file(app_icon)

        self.init_menu()

        self.dapi = DAPI()
        self.dapi.auth(self._app._cfg.get('email'),
                       self._app._cfg.get('passhash'))

        self.show_hide_drop()

        gtk.main()
コード例 #3
0
ファイル: aerobat.py プロジェクト: zommerfelds/aerobat
    def __init__(self):
        
        self.statusicon = gtk.StatusIcon()

        while not self.statusicon.is_embedded():
            gtk.main_iteration()

        self.bkgr_pixbuf = gen_pixbuf(border_color, width, height)
        tmp_pixbuf = gen_pixbuf(background_color, width-2*border, height-2*border)
        tmp_pixbuf.copy_area(src_x=0, src_y=0, width=width-2*border, height=height-2*border,
                               dest_pixbuf=self.bkgr_pixbuf, dest_x=border, dest_y=border)
                               
        self.normal_pixbuf   = gen_pixbuf(normal_color, width-2*border, height-2*border)
        self.low_pixbuf      = gen_pixbuf(low_color, width-2*border, height-2*border)
        self.critical_pixbuf = gen_pixbuf(critical_color, width-2*border, height-2*border)
        
        self.disabled_pixbuf = gen_pixbuf(border_color, width, height)
        tmp_pixbuf = gen_pixbuf(disabled_color, width-2*border, height-2*border)
        tmp_pixbuf.copy_area(src_x=0, src_y=0, width=width-2*border, height=height-2*border,
                               dest_pixbuf=self.disabled_pixbuf, dest_x=border, dest_y=border)
        
        self.update()

        gobject.timeout_add_seconds(sleep, self.update)

        self.statusicon.connect("popup-menu", self.right_click_event)
コード例 #4
0
    def __init__(self):
        self.caps = []
        self.rssfeeds = set()
        self.seen = set()
        self.windows = list()

        #        self.rssfeeds.add('http://www.usgs.gov/hazard_alert/alerts/landslides.rss')

        #        self.rssfeeds.add('http://alerts.weather.gov/cap/ca.php?x=0')
        self.rssfeeds.add('http://edis.oes.ca.gov/index.atom')
        #        self.rssfeeds.add('http://earthquake.usgs.gov/eqcenter/recenteqsww/catalogs/caprss7days5.xml')
        self.mycoords = LATLONG_COORDS

        self.statusIcon = gtk.StatusIcon()
        self.statusIcon.set_from_stock(gtk.STOCK_DIALOG_WARNING)
        self.statusIcon.set_visible(True)
        self.statusIcon.set_tooltip("Common Alerting Protocol Viewer")

        self.menu = gtk.Menu()
        self.menuItem = gtk.ImageMenuItem(gtk.STOCK_EXECUTE)
        self.menuItem.connect('activate', self.execute_cb, self.statusIcon)
        self.menu.append(self.menuItem)
        self.menuItem = gtk.ImageMenuItem(gtk.STOCK_QUIT)
        self.menuItem.connect('activate', self.quit_cb, self.statusIcon)
        self.menu.append(self.menuItem)
        self.menuItem = gtk.ImageMenuItem(gtk.STOCK_CONNECT)
        self.menuItem.connect('activate', self.rssTimer_cb, self.statusIcon)

        self.statusIcon.connect('popup-menu', self.popup_menu_cb, self.menu)
        self.statusIcon.set_visible(1)

        gobject.timeout_add_seconds(60 * 10, self.rssTimer_cb)
        gobject.timeout_add(100, self.startup_cb)

        self.execute_cb(None, None, None)
コード例 #5
0
 def __init__(self):
     self.statusicon = gtk.StatusIcon()
     self.statusicon.set_from_file(EMPTY)
     self.statusicon.connect("activate", self.left_click_event)
     self.statusicon.set_tooltip("StatusIcon Example")
     self.the_state = DPMS_ACTIVE
     self.statusicon.connect("popup-menu", self.right_click_event)
コード例 #6
0
def main():
    opt = ""
    if len(sys.argv) > 1:
        opt = sys.argv[1]

    if opt in ("--tray-gtk"):
        use_appindicator = False
    elif opt in ("", "--tray-appindicator"):
        use_appindicator = True
    else:
        print "Unknown argument " + opt
        use_appindicator = True

    pynotify.init(APPNAME)

    # Set the current language
    set_language()

    if use_appindicator:
        ind = appindicator.Indicator('Panbox', ICON,
                                     appindicator.CATEGORY_APPLICATION_STATUS)
        ind.set_status(appindicator.STATUS_ACTIVE)
        #ind.set_status(appindicator.STATUS_ATTENTION)
        ind.set_menu(generate_menu())
    else:
        status_icon = gtk.StatusIcon()
        status_icon.set_from_file(os.path.abspath(ICON))
        status_icon.set_tooltip('Panbox')
        status_icon.connect('popup-menu', popup_menu_cb)

    PanboxTrayInterface()
    gtk.main()
コード例 #7
0
    def __init__(self):
        # create the system tray icon
        self.status_icon = gtk.StatusIcon()
        self.status_icon.set_from_icon_name(ICON_NAME)
        self.status_icon.set_title(TRAY_TITLE)
        self.status_icon.set_tooltip(TRAY_TITLE)
        self.status_icon.set_visible(True)

        # Show the menu
        self.status_icon.connect('activate', self.activate)
        self.status_icon.connect('popup-menu', self.build_menu)

        # Init other things..
        # Number of seconds between one wallpaper and another
        try:
            filein = open(CONFIG_FILE_PATH, 'r')
            self.time = int(filein.readline())
            self.bg_folder = filein.readline()
            filein.close()
        except:
            self.time = DEFAULT_TIME
            self.bg_folder = DEFAULT_FOLDER
        self.window = None

        print 'Time set to ' + str(self.time)
        print 'BG folder set to ' + self.bg_folder

        # Wallpaper_Changer object
        self.wallpaper_changer = Wallpaper_Changer(self.time, self.bg_folder)
コード例 #8
0
ファイル: linux.py プロジェクト: zeek1/pyParrotZik
 def __init__(self, icon, menu):
     self.icon_directory = os.path.join('/usr', 'share', 'icons/')
     self.menu_shown = False
     statusicon = gtk.StatusIcon()
     statusicon.connect("popup-menu", self.gtk_right_click_event)
     statusicon.set_tooltip("Parrot Zik")
     super(LinuxIndicator, self).__init__(icon, menu, statusicon)
コード例 #9
0
    def __init__(self):
        MainWindow.__init__(self)
        EntryField.__init__(self)
        self.set_title("Umit QuickScan")
        self.add(self.main_hbox)
        self.set_position(gtk.WIN_POS_CENTER)

        status_icon = gtk.StatusIcon()
        menu = gtk.Menu()
        menu_item = gtk.MenuItem("Umit Network Scanner")
        menu_item.connect('activate', self.launch_umit, status_icon)
        menu.append(menu_item)

        menu_separator = gtk.SeparatorMenuItem()
        menu.append(menu_separator)

        menu_item2 = gtk.ImageMenuItem(gtk.STOCK_QUIT)
        menu_item2.connect('activate', self.quit_by_icon, status_icon)
        menu.append(menu_item2)

        status_icon.set_from_file(
            os.path.join(
                os.path.dirname(os.path.dirname(os.path.realpath(__file__))),
                "qs", "umit-menu.xpm"))
        status_icon.set_tooltip("Umit Quick Scan")
        status_icon.connect('popup-menu', self.icon_menu, menu)
        status_icon.connect('activate', self.minimize_to_tray)
        status_icon.set_visible(True)

        self.main_hbox.pack_start(self.vbox, True, True, 6)
        self.vbox.pack_start(self.entry, False, True, 6)
        #self.show_all()

        libkeybinder.bind(libkeybinder.Modifiers['alt'], 'q', unhide_callback,
                          self)
コード例 #10
0
    def __init__(self):
        self.trayIcon = gtk.StatusIcon()
        self.trayIcon.set_from_file(cSIcon)
        self.trayIcon.connect("popup-menu", self.click)

        xfwm4 = gtk.MenuItem("xfwm4")
        xfwm4.connect("activate", self.xfwm4)

        dcomp = gtk.MenuItem("dcompmgr")
        dcomp.connect("activate", self.dcomp)

        cairo = gtk.MenuItem("cairo-compmgr")
        cairo.connect("activate", self.cairo)

        allOff = gtk.MenuItem("Turn all off")
        allOff.connect("activate", self.allOff)

        close = gtk.MenuItem("Quit")
        close.connect("activate", gtk.main_quit)

        self.menu = gtk.Menu()
        self.menu.append(xfwm4)
        self.menu.append(dcomp)
        self.menu.append(cairo)
        self.menu.append(gtk.SeparatorMenuItem())
        self.menu.append(allOff)
        self.menu.append(gtk.SeparatorMenuItem())
        self.menu.append(close)
        self.menu.show_all()
コード例 #11
0
    def __init__(self, window):
        self.window = window

        spawn_later(0.5, self.show_startup_notify)

        spawn_later(3600 * 2, self.auto_update)

        logo_filename = os.path.join(
            os.path.abspath(os.path.dirname(__file__)), message['图片'])

        if appindicator:
            self.trayicon = appindicator.Indicator(
                'WeathRepor', '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.set_visible(True)
コード例 #12
0
    def __init__(self):

        self._dir = os.path.dirname(module_path())
        file = os.path.join(self._dir, 'SAMView.glade')

        self.glade = gtk.glade.XML(file)

        self.window = self.glade.get_widget('main-window')
        self.window.connect('delete-event', self._on_window_delete_event)

        self._register_iconsets()

        self.connection = ConnectionController(self)
        self.visual = VisualisationController(self)
        self.logger = LoggingController(self)

        menu = gtk.Menu()
        menu_item = gtk.ImageMenuItem(gtk.STOCK_QUIT)
        menu_item.connect('activate', self._on_quit_menu_item_activate)
        menu.append(menu_item)

        self.status_icon = gtk.StatusIcon()
        self.status_icon.set_from_stock('com-vollast')
        self.status_icon.set_visible(True)
        self.status_icon.connect('activate', self._status_icon_activated)
        self.status_icon.connect('popup-menu', self._popup_menu_cb, menu)
コード例 #13
0
    def __init__(self, options):
        self.options = options
        self.debuglevel = 1 if options.debug else 0
        self.is_manual_auth = False
        self.server = self.password = self.username = None
        DBusGMainLoop(set_as_default=True)
        self.bus = dbus.SystemBus()
        self.dbus_get_network_manager().connect_to_signal(
            "StateChanged", self.onNetworkStateChanged)
        self.dbus_get_network_manager_settings().connect_to_signal(
            "NewConnection", self.onNewConnection)
        self.tray = gtk.StatusIcon()
        self.set_icon('gsni_auth_regular.png')
        self.tray.set_tooltip(_('Not authenticated'))
        self.tray.connect('popup-menu', self.on_right_click, 'test')
        self.doing_login = False
        self.settings_dialog = False
        config_dir = options.config_dir or join(xdg_config_home,
                                                'gsni-authenticator')
        if options.is_spain:
            resources.UI_DIR_NAME = 'ui_es'
        else:
            resources.UI_DIR_NAME = 'ui_pt'
        if options.set_icon_flag:
            resources.UI_DIR_NAME = 'ui_' + options.set_icon_flag
        print config_dir
        if not exists(config_dir):
            os.makedirs(config_dir)

        self.settings_fname = join(config_dir, 'auth.conf')

        self.agnclient_watcher = AGNClientConnectWatcher(
            self.on_agnclient_connect)
        self.agnclient_watcher.start()
コード例 #14
0
 def __init__(self, parent):
     self.parent = parent
     #self.parent.values=values
     if USE_EGG == 1:
         self.event_box = gtk.EventBox()
         self.trayIcon = gtk.Image()
         self.trayIcon.set_from_stock(gtk.STOCK_MEDIA_RECORD,
                                      gtk.ICON_SIZE_SMALL_TOOLBAR)
         self.event_box.add(self.trayIcon)
         self.tray_container = egg.trayicon.TrayIcon("recordMyDesktop")
         self.tray_container.add(self.event_box)
         self.tray_popup = iTP.TrayPopupMenu(self.parent,
                                             self.parent.values,
                                             self.optionsOpen)
         self.event_box.connect("button-press-event",
                                self.__buttonPressEGG__)
         self.tray_container.show_all()
     else:
         self.trayIcon = gtk.StatusIcon()
         self.trayIcon.set_from_stock(gtk.STOCK_MEDIA_RECORD)
         self.tray_popup = iTP.TrayPopupMenu(self.parent,
                                             self.parent.values,
                                             self.optionsOpen)
         self.trayIcon.connect("activate",
                               self.__buttonPressNoEGG_Activate__)
         self.trayIcon.connect("popup-menu",
                               self.__buttonPressNoEGG_Popup__)
コード例 #15
0
ファイル: app.py プロジェクト: TonicArtos/keysocket
    def __init__(self):
        # set up the glib main loop.
        dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
        bus = dbus.Bus(dbus.Bus.TYPE_SESSION)
        bus_object = bus.get_object('org.gnome.SettingsDaemon',
                                    '/org/gnome/SettingsDaemon/MediaKeys')

        # this is what gives us the multi media keys.
        dbus_interface = 'org.gnome.SettingsDaemon.MediaKeys'
        bus_object.GrabMediaPlayerKeys("MediaKeySocketServer",
                                       0,
                                       dbus_interface=dbus_interface)

        # connect_to_signal registers our callback function.
        bus_object.connect_to_signal('MediaPlayerKeyPressed', self.on_mediakey)

        self.statusicon = gtk.StatusIcon()
        self.statusicon.set_from_file('icon48.png')
        self.statusicon.connect('popup-menu', self.right_click_event)
        self.statusicon.set_tooltip('KeySockets')

        self.factory = KeySocketServerFactory('ws://localhost:{}'.format(PORT),
                                              debug=True)

        listenWS(self.factory)
        reactor.run()
コード例 #16
0
 def setup_icon(self):
     self.icon = gtk.StatusIcon()
     self.icon.set_from_icon_name("taskui")
     self.icon.connect("activate",
                       lambda *args: self.on_toggle())
     self.icon.connect("popup-menu", self.on_menu)
     self.icon.set_tooltip("TaskWarrior")
コード例 #17
0
ファイル: sroboapplet.py プロジェクト: srobo-legacy/kit-gui
    def __init__(self):
        self.statusIcon = gtk.StatusIcon()
        self.statusIcon.set_from_file(os.path.join("res", "srlogo.png"))
        self.statusIcon.set_visible(True)
        self.statusIcon.set_tooltip("srobo menu")

        i = 0
        self.menu = gtk.Menu()

        #use reversed to execute in top down order, as this is how humans
        #read things
        for title, command in reversed(self._apps):
            subprocess.Popen(command,
                             stderr=subprocess.PIPE,
                             stdout=subprocess.PIPE,
                             stdin=subprocess.PIPE)
            sleep(self._sleepTime)
            self.menuItem = gtk.MenuItem(title)
            self.menuItem.connect('activate', self.flip, self.statusIcon, i)
            self.menu.append(self.menuItem)

            if (i == len(self._apps) - 1):
                label = self.menuItem.get_children()[0]
                title = label.get_text()
                label.set_markup("<b>" + title + "</b>")
                self._currentIndex = i
                self._currentLabel = label

            i += 1

        self.statusIcon.connect('popup-menu', self.popup_menu_cb, self.menu)
        self.statusIcon.set_visible(1)

        gtk.main()
コード例 #18
0
    def __init__(self, dock, conn_manager, conn_zone):
        # Call parent constructor
        SystrayBase.__init__(self, dock, conn_manager, conn_zone)

        ### Instantiate a gtk.StatusIcon ###
        # gnome-shell checks XClassHint.res_class with ShellTrayIcon.
        # gtk_status_icon_set_name() can set XClassHint.res_class .
        # However gtk_status_icon_new() also calls gtk_window_realize() so
        # gtk_status_icon_set_visible() needs to be called to set WM_CLASS
        # so that gtk_window_realize() is called later again.
        # set_title is for gnome-shell notificationDaemon in bottom right.
        self.__sicon = gtk.StatusIcon()
        self.__sicon.set_visible(False)
        self.__sicon.set_title(self._config.get_app_name())
        self.__sicon.set_visible(True)
        self.__set_status_trayicon(is_connected=False, is_sms_pending=False)
        self.open.set_label(_('Open %s') % self._config.get_app_name())

        # Prepare the tooltip
        self.__update_tooltip()

        # Connect various signals
        self._connect_signals()

        self.__timeout = None
        if self._is_connected():
            self._on_connected()
        else:
            self._on_disconnected()
コード例 #19
0
ファイル: mounty.py プロジェクト: onlyyoufor/AUR
    def __init__(self):
        # Begin XFCEpatch
        #        self.ind = appindicator.Indicator ("mounty", "mounty", appindicator.CATEGORY_APPLICATION_STATUS)
        #        self.ind.set_status (appindicator.STATUS_ACTIVE)
        self.statusIcon = gtk.StatusIcon()
        self.statusIcon.set_from_stock(gtk.STOCK_CDROM)
        self.statusIcon.set_visible(True)
        self.statusIcon.set_tooltip("Mounty")
        self.statusIcon.connect("popup-menu", self.on_right_click)
        # End XFCEpatch

        self.isos = {}

        client = gconf.client_get_default()
        if client.get_bool('/apps/mounty/remember-mounts'):
            mounts = client.get_list('/apps/mounty/mounts', gconf.VALUE_STRING)
            for iso_name in mounts:
                try:
                    DiskImage(iso_name).mount()
                except:
                    pass
        if len(sys.argv) > 1:
            for i in sys.argv[1:]:
                DiskImage(sys.argv[i]).mount()
        self.update_menu()
コード例 #20
0
 def __init__(self):
     self.statusicon = gtk.StatusIcon()
     self.counter = 0
     self.statusicon.connect("activate", self.quit_cb)
     self.statusicon.connect("popup-menu", self.quit_cb)
     self.statusicon.set_tooltip("StatusIcon Example")
     #generate tray image:
     s = 64
     w, h = s * 2, s * 2
     pixmap = gdk.Pixmap(gdk.get_default_root_window(), w, h)
     cr = pixmap.cairo_create()
     cr.set_operator(cairo.OPERATOR_CLEAR)
     cr.fill()
     cr.set_operator(cairo.OPERATOR_SOURCE)
     for i, color in enumerate([(1, 0, 0, 1), (0, 1, 0, 1), (0, 0, 1, 1)]):
         cr.set_source_rgba(*color)
         cr.new_path()
         x = (i % 2) * s
         y = (i / 2) * s
         cr.move_to(x, y)
         cr.line_to(x + s, y)
         cr.line_to(x + s, y + s)
         cr.line_to(x, y + s)
         cr.close_path()
         cr.fill()
     pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, True, 8, w, h)
     pixbuf.get_from_drawable(pixmap, pixmap.get_colormap(), 0, 0, 0, 0, w,
                              h)
     self.statusicon.set_from_pixbuf(pixbuf)
コード例 #21
0
    def __init__(self):

        # Icon trial
        self.info = gtk.StatusIcon()
        self.info.set_from_icon_name("Our App")
        #self.info.set_from_gicon("msg.jpg")

        # Create a new window
        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.window.set_title("Message App")
        self.window.connect("delete_event", self.delete_event)
        self.window.set_border_width(10)
        self.window.set_size_request(200, 100)
        self.window.set_position(gtk.WIN_POS_CENTER)

        # Vertical box to pack widgets
        self.box1 = gtk.VBox(False, 5)
        self.window.add(self.box1)

        # Compose button to create a new message.
        self.button1 = gtk.Button("Create New")
        self.button1.connect("clicked", self.compse_msg, "button 1")
        self.box1.pack_start(self.button1, True, True, 0)

        # Unread button to send message i.e. write to file.
        self.button2 = gtk.Button("You have an unread message")
        self.button2.connect("clicked", self.unread, "button 2")
        self.box1.pack_start(self.button2, True, True, 0)

        # Show Widgets
        self.button1.show()
        self.button2.show()
        self.box1.show()
        self.window.show()
コード例 #22
0
	def __init__(self):
		self.statusIcon = gtk.StatusIcon()
    		self.statusIcon.set_from_stock(gtk.STOCK_GOTO_BOTTOM)
		self.statusIcon.set_visible(True)
		self.statusIcon.set_tooltip("Watching %s"%config.get('FOLDER','watch'))

		self.menu = gtk.Menu()
		
		self.menuItem = gtk.ImageMenuItem(gtk.STOCK_REFRESH)
    		self.menuItem.connect('activate', self.refresh_cb, self.statusIcon)
    		self.menu.append(self.menuItem)
    		
		self.menuItem = gtk.ImageMenuItem(gtk.STOCK_QUIT)
    		self.menuItem.connect('activate', self.quit_cb, self.statusIcon)
    		self.menu.append(self.menuItem)

    		self.statusIcon.connect('popup-menu', self.popup_menu_cb, self.menu)
    		self.statusIcon.set_visible(1)

		self.wm = pyinotify.WatchManager()
		self.notifier = pyinotify.ThreadedNotifier(self.wm, Identity())
		
		self.wm.add_watch(config.get('FOLDER','watch'),
					pyinotify.IN_CLOSE_WRITE,
					rec=True,auto_add=True)		

		self.notifier.start()
		gtk.gdk.threads_enter()
    		gtk.main()
		gtk.gdk.threads_leave()
コード例 #23
0
    def __init__(self):
        self.tray = gtk.StatusIcon()
        self.tray.connect('activate', self.refresh)

        # Create menu
        self.menu = gtk.Menu()

        i = gtk.MenuItem("Settings")
        self.settings_item = i
        i.show()
        i.connect("activate", self.ConfigurePiJuice)
        self.menu.append(i)

        i = gtk.MenuItem("About...")
        i.show()
        i.connect("activate", self.show_about)
        self.menu.append(i)

        self.tray.connect('popup-menu', self.show_menu)

        self.pijuice = PiJuice(1, 0x14)

        # Initalise and start battery display
        self.refresh(None)
        self.tray.set_visible(True)

        gobject.timeout_add(REFRESH_INTERVAL, self.refresh, self.tray)
        gobject.timeout_add(CHECK_SIGNAL_INTERVAL, self.check_signum)
コード例 #24
0
ファイル: status_icon.py プロジェクト: Engcomm/SmallProgram
 def __init__(self, core, gui):
     self.gui = gui
     self.core = core
     self.tray = gtk.StatusIcon()
     self.tray.set_from_stock(gtk.STOCK_ABOUT)
     self.tray.connect('popup-menu', self.on_right_click)
     self.tray.set_tooltip(('Decision Support System Logger V 1.0'))
コード例 #25
0
 def __init__(self):
     try:
         self.icon = gtk.StatusIcon()
         self.update_icon()
         glib.timeout_add(1100, self.update_icon)
     except:
         glib.timeout_add(1100, self.update_icon)
コード例 #26
0
 def main(self):
     '''Main.'''
     # Send statistics information.
     AnonymityThread(sendStatistics).start()
     
     # Just show tray icon when have updatable packages.
     self.updateNum = self.calculateUpdateNumber()
     if self.updateNum > 0:
         print "Show tray icon."
         
         gtk.gdk.threads_init()        
         
         self.trayIcon = gtk.StatusIcon()
         self.trayIcon.set_from_file("../icon/icon.png")
         self.trayIcon.set_has_tooltip(True)
         self.trayIcon.set_visible(True)
         self.trayIcon.connect("activate", lambda w: self.showSoftwareCenter())
         self.trayIcon.connect("query-tooltip", self.hoverIcon)
         self.trayIcon.connect("popup-menu", self.handleRightClick)
         
         # Show tooltips.
         # Add timeout to make tooltip display at correct coordinate.
         glib.timeout_add_seconds(1, self.hoverIcon)
         
         gtk.main()
     else:
         print "No updatable packages, exit."
コード例 #27
0
 def __init__(self):
     self.tray = gtk.StatusIcon()
     self.tray.connect("activate", self.Showm)
     self.tray.connect("popup-menu", self.showm)
     self.menu = gtk.Menu()
     img = gtk.Image()
     img.set_from_file(sys_inf.ICON_PATH + 'upm.png')
     upmimg = gtk.ImageMenuItem(_("Show Upim"))
     upmimg.set_image(img)
     upmimg.connect("activate", self.Upshow)
     self.menu.append(upmimg)
     img4 = gtk.Image()
     img4.set_from_file(sys_inf.ICON_PATH + 'upw.png')
     upimw = gtk.ImageMenuItem(_("Show Writer"))
     upimw.set_image(img4)
     upimw.connect("activate", self.Upwshow)
     self.menu.append(upimw)
     img2 = gtk.Image()
     img2.set_from_file(sys_inf.ICON_PATH + 'nas2.png')
     nas = gtk.ImageMenuItem(_("Settings"))
     nas.set_image(img2)
     nas.connect("activate", self.Wrshow)
     self.menu.append(nas)
     img3 = gtk.Image()
     img3.set_from_file(sys_inf.ICON_PATH + 'cut3.png')
     vux = gtk.ImageMenuItem(_("Exit"))
     vux.set_image(img3)
     vux.connect("activate", gtk.main_quit)
     self.menu.append(vux)
     self.tray.set_tooltip(_("Calendar"))
     fil = sys_inf.ICON_PATH + 'clen.png'
     pixbuf = gtk.gdk.pixbuf_new_from_file(fil)
     self.tray.set_from_pixbuf(pixbuf)
     gtk.main()
コード例 #28
0
 def __init__(self):
     self.status_icon = gtk.StatusIcon()
     self.status_icon.set_from_icon_name("glipper")
     self.status_icon.set_visible(True)
     self.status_icon.connect('popup-menu', self.on_status_icon_popup_menu)
     self.status_icon.connect('button-press-event',
                              self.on_status_icon_button_press)
コード例 #29
0
    def __init__(self):
        self.trayIcon = gtk.StatusIcon()
        self.updateIcon()

        #set callback on right click to on_right_click
        self.trayIcon.connect('popup-menu', self.on_right_click)
        gobject.timeout_add(1000, self.checkStatus)
コード例 #30
0
def initialise_notify():
    s = gtk.StatusIcon()
    s.set_from_stock(gtk.STOCK_INFO)
    s.set_tooltip("No polling done yet ..")
    s.set_visible(True)

    return s