Example #1
0
    def set_status_icon(self):
        if self.attention:
            if not self.icon:
                self.icon = gtk.status_icon_new_from_file(media_path + "attention.svg")
            else:
                self.icon.set_from_file(media_path + "attention.svg")
            self.icon.set_tooltip(self.attention)
            return

        if self.running:
            if self.away_from_desk:
                if not self.icon:
                    self.icon = gtk.status_icon_new_from_file(media_path + "away.svg")
                else:
                    self.icon.set_from_file(media_path + "away.svg")
                self.icon.set_tooltip("AWAY: Working on %s" % self.current_text)
            else:
                if not self.icon:
                    self.icon = gtk.status_icon_new_from_file(media_path + "working.svg")
                else:
                    self.icon.set_from_file(media_path + "working.svg")
                self.icon.set_tooltip("Working on %s" % self.current_text)
        else:
            if not self.icon:
                self.icon = gtk.status_icon_new_from_file(media_path + "idle.svg")
            else:
                self.icon.set_from_file(media_path + "idle.svg")
            self.icon.set_tooltip("Stopped")

        self.icon.set_visible(True)
Example #2
0
def getIcon():
    if os.path.exists('/usr/share/spotify/icons/spotify-linux-24.png'):
        return gtk.status_icon_new_from_file('/usr/share/spotify/icons/spotify-linux-24.png')
    else:
        import urllib
        f = open('/tmp/spot_tray_icon.png',"w")
        url = "https://raw.githubusercontent.com/osoroco/pySpotiTray/master/spotify-linux-24.png"
        f.write(urllib.urlopen(url).read())
        f.close()
        return gtk.status_icon_new_from_file('/tmp/spot_tray_icon.png')
Example #3
0
    def __init__(self):
        self.session_bus = dbus.SessionBus()
        self.reader_observer = GReaderObserver()
        self.card_observer = GCardObserver()
        
        
        self.tray_icon = gtk.status_icon_new_from_file(ICON_APPLET_PROBLEM)
        self.tray_icon.connect('popup-menu', self.on_right_click)
        self.tray_icon.connect('activate', self.on_left_click)

        self.menu = gtk.Menu()
        
        self.reader_observer.connect("cardreader_added", self.on_cardreader_added)
        self.reader_observer.connect("cardreader_removed", self.on_cardreader_removed)
        self.card_observer.connect("smartcard_inserted", self.on_smartcard_inserted)
        self.card_observer.connect("smartcard_switched", self.on_smartcard_switched)
        self.card_observer.connect("smartcard_removed", self.on_smartcard_removed)

            
        self.lock_screen = gtk.CheckMenuItem(_("Lock screen"))
        self.lock_screen.set_tooltip_text(_("Lock screen when card is removed"))
        
        close_item = gtk.MenuItem(_("Close"))

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

        close_item.connect_object("activate", gtk.main_quit, "Close App")
        self.menu.show_all()
Example #4
0
    def __init__(self, control):
        self.control = control

        self.menu_items = {}

        check_interval = 5 * 60 * 1000
        
        """Set-up Menu"""
        self.menu = gtk.Menu()
        self.menu.append(gtk.SeparatorMenuItem())
        self.about_item = gtk.ImageMenuItem(gtk.STOCK_ABOUT)
        self.menu.append(self.about_item)
        self.quit_item = gtk.ImageMenuItem(gtk.STOCK_QUIT)
        self.menu.append(self.quit_item)

        self.quit_item.connect('activate', gtk.main_quit)

        """Set-up Status Icon"""
        self.status_icon = gtk.status_icon_new_from_file('no_new.ico')
        self.status_icon.set_visible(True)
        
        self.status_icon.connect(   'popup-menu', 
                                    self.control.on_menu_popup,
                                    self.menu)

        self.status_icon.connect('activate', self.control.go_to_inbox)

        self.control.check_mail(self.menu, self.menu_items,
                                self.status_icon)
        
        gobject.timeout_add(check_interval, self.control.check_mail,
                            self.menu, self.menu_items,
                            self.status_icon)
Example #5
0
 def create_indicator(self):
     icon_file = get_icon_file_path('unknown')
     logger.debug(_('Creating StatusIcon from file (%s)') % icon_file)
     icon = gtk.status_icon_new_from_file(icon_file)
     if not icon.is_embedded():
         logging.error(_('Notification area not found for Status Icon version'))
     return icon
Example #6
0
    def __init__(self):
        gtk.Window.__init__(self)
        self.set_title("Prayer Times")
        self.connect("delete-event", self.delete_event)
        #create a virtical box to hold some widgets
        vbox = gtk.VBox(False)
        #create a label to say *something* and add to the vbox
        date         = prayertimes.get_date()
        prayer_times = '\n'.join(self.display_prayer_times())

        date_lbl   = gtk.Label(date)
        prayer_lbl = gtk.Label(prayer_times)

        vbox.pack_start(date_lbl)
        vbox.pack_start(prayer_lbl)
        
        #make a quit button
        quitbutton = gtk.Button("Quit")
        quitbutton.connect("clicked",self.quit)
        #add the quitbutton to the vbox
        vbox.pack_start(quitbutton)
  
        #add the vbox to the Window
        self.add(vbox)
        #show all of the stuff
        self.show_all()
        #make a status icon
        self.statusicon = gtk.status_icon_new_from_file("minbar.svg")
        self.statusicon.connect('activate', self.status_clicked )
        #self.statusicon.connect('activate', self.show_hide )
        self.statusicon.set_tooltip("minimize")
            
        #start the gtk main loop
        gtk.main()
Example #7
0
    def _setup_gtk_app(self):
        self._menu = gtk.Menu()
        self._menu_items = {}

        for item in self._menu_item_list:
            if item is None:
                self._menu.add(gtk.SeparatorMenuItem())
                continue
            icon_id, title, desc, cb = item

            if icon_id == "exit":
                w = gtk.ImageMenuItem(stock_id = "gtk-quit")
            else:
                w = gtk.ImageMenuItem(title)
                image_path = self.get_menu_image(icon_id)
                img = gtk.Image()
                img.set_from_file(image_path)
                w.set_image(img)

            self._menu_items[icon_id] = w
            w.connect("activate", cb)
            w.show()
            self._menu.add(w)

        self._menu.show_all()

        icon_path = self._icon_to_path(self.icons.get("okay"))
        self._status_icon = gtk.status_icon_new_from_file(icon_path)

        self._status_icon.connect("popup-menu", self.applet_context_menu)
        self._status_icon.connect("activate", self.applet_doubleclick)
Example #8
0
    def start(self, reader):
        self.reader = reader

        self.icon = None
        self.wnd_pos = (0, 0)

        self.menu = gtk.Menu()
        self.menu.show()

        action = gtk.Action(None, '_Quit', 'Quit from UMIT', gtk.STOCK_QUIT)
        action.connect('activate', self.__on_quit)

        item = action.create_menu_item()
        item.show()

        self.menu.append(item)

        self.type = self.notifier = None

        # Force to use win32 module
        if WIN32_PRESENT:
            self.set_type(TrayPlugin.TYPE_WINDOWS)
        else:
            self.set_type(tray_prefs.parser['notifications']['type'].value)
            tray_prefs.parser['notifications']['type'].value = self.type

            logo = os.path.join(Path.icons_dir, 'umit_16.ico')
            log.debug('Creating status icon with %s as logo' % logo)

            self.icon = gtk.status_icon_new_from_file(logo)
            tray_prefs.change_cb = self.set_type

        self.icon.connect('popup-menu', self.__on_right_click)
        self.icon.connect('activate', self.__on_activate)
    def start(self, reader):
        self.reader = reader

        self.icon = None
        self.wnd_pos = (0, 0)

        self.menu = gtk.Menu()
        self.menu.show()

        action = gtk.Action(None, '_Quit', 'Quit from UMIT', gtk.STOCK_QUIT)
        action.connect('activate', self.__on_quit)

        item = action.create_menu_item()
        item.show()

        self.menu.append(item)

        self.type = self.notifier = None

        # Force to use win32 module
        if WIN32_PRESENT:
            self.set_type(TrayPlugin.TYPE_WINDOWS)
        else:
            self.set_type(tray_prefs.parser['notifications']['type'].value)
            tray_prefs.parser['notifications']['type'].value = self.type

            logo = os.path.join(Path.icons_dir, 'umit_16.ico')
            log.debug('Creating status icon with %s as logo' % logo)

            self.icon = gtk.status_icon_new_from_file(logo)
            tray_prefs.change_cb = self.set_type

        self.icon.connect('popup-menu', self.__on_right_click)
        self.icon.connect('activate', self.__on_activate)
 def __init__(self):
     self.builder = gtk.Builder()
     self.builder.add_from_file("watch-my-folder.ui")
     self.window = self.builder.get_object("main_window")
     self.window.set_title("Watch My Folder")
     self.window.connect("delete-event", self.delete_event)
     self.statuslabel = self.builder.get_object("statuslabel")
     self.statuslabel.set_text('Scan Running')
     self.quitbutton = self.builder.get_object("quitbutton")
     self.quitbutton.connect("clicked", self.quit)
     self.startbutton = self.builder.get_object("startbutton")
     self.startbutton.connect("clicked", self.start_scan)
     self.stopbutton = self.builder.get_object("stopbutton")
     self.stopbutton.connect("clicked", self.stop_scan)
     # Show all of the stuff
     self.window.show_all()
     # Make a status icon
     self.statusicon = gtk.status_icon_new_from_file('watch.png')
     self.statusicon.connect('activate', self.status_clicked )
     self.statusicon.set_tooltip("Watch My Folder")
     self.window.hide()
     # Start main function first
     self.worker = None
     if not self.worker:
         self.worker = WorkerThread(self)
     # Start the gtk main loop
     gtk.main()
Example #11
0
    def init_status_icon (self):
        self.status_icons = {}
        icon_ids = [str(i) for i in range (1, 9)]
        icon_ids.append ("p")
        for num in icon_ids:
            icon_file =  "%s/images/wallbox_%s.png" % (defs.WALLBOX_DATA_DIR, str (num))
            self.status_icons[str (num)] = gtk.status_icon_new_from_file (icon_file)
            self.status_icons[str (num)].set_visible (False)
            self.status_icons[str (num)].connect ("activate", self.show_notification, self.notification)
            self.status_icons[str (num)].connect ("popup-menu", self.on_right_click)

        icon_file = "%s/images/wallbox.png" % defs.WALLBOX_DATA_DIR
        self.status_icons["normal"] = gtk.status_icon_new_from_file (icon_file)
        self.status_icon = self.status_icons["normal"]
        self.status_icon.connect ("activate", self.show_notification, self.notification)
        self.status_icon.connect ("popup-menu", self.on_right_click)
Example #12
0
 def __init__(self):
     self.icon=gtk.status_icon_new_from_file(self.icon_directory()+"resources/mouse.png")
     self.icon.set_tooltip("Listening...")
     #self.state = "idle"
     #self.tick_interval=10 #number of seconds between each poll
     #self.icon.connect('activate',self.icon_click)
     self.icon.set_visible(True)
Example #13
0
	def __init__(self):
		icon = gtk.status_icon_new_from_file("icon.png")
		icon.connect('popup-menu', self.rightClick)
		icon.connect('activate', self.leftClick)
		self.window = NistWindow()
		self.checkfornew()
		#start timer to check the database again for new vulns every 10 min
		glib.timeout_add_seconds(600, self.checkfornew)
Example #14
0
    def __init__(self, console):
        try:
            gtk.Window.__init__(self)
        except gtk.GtkWarning:
            raise Warning
        self.set_title("Botounet")
        #self.set_modal(True)
        #self.resize(800, 55)
        self.set_size_request(800, 45)
        icon_file = 'tongue.png'
        self.set_icon_from_file(icon_file)
        self.set_resizable(False)
        self.connect("destroy", lambda *w: gtk.main_quit())

        hbox = gtk.HBox()
        hbox.set_border_width(8)
        self.add(hbox)
        hbox.show()

        entry = gtk.Entry()
        entry.connect('activate', self.enter_callback, entry)
        entry.connect('key-press-event', self.key_press_event_callback, entry)
        hbox.pack_start(entry, True, True)
        entry.show()

        button = gtk.Button('Send')
        button.connect('clicked', self.enter_callback, entry)
        hbox.pack_start(button, False, True)
        button.show()

        mini = gtk.Button('Iconify')
        mini.connect('clicked', self.toggle)
        hbox.pack_start(mini, False, True)
        mini.show()

        quit_item = gtk.MenuItem("Quitter")
        quit_item.connect("activate", self.quit)
        quit_item.show()
        sample_item = gtk.MenuItem("Sample 1")
        sample_item.show()
        sample_item_2 = gtk.MenuItem("Sample 2")
        sample_item_2.show()
        tray_popup = gtk.Menu()
        tray_popup.attach(quit_item, 0, 1, 0, 1)
        tray_popup.attach(sample_item, 0, 1, 1, 2)
        tray_popup.attach(sample_item_2, 0, 1, 2, 3)

        self.trayicon = gtk.status_icon_new_from_file(icon_file)
        self.trayicon.connect("activate", self.toggle)
        self.trayicon.set_tooltip('Botounet')
        self.trayicon.connect("popup-menu", self.trayicon_popup_callback,
                tray_popup)

        self.hidden = True

        self.history = [""]
        self.n_history = 0
        self.console = console
Example #15
0
 def create_status_icon(self):
     # Icon from http://www.iconarchive.com/show/artcore-4-icons-by-artcore-illustrations.html
     # License: CC Attribution-Noncommercial-No Derivate 3.0
     # Homepage: http://blog.artcore-illustrations.de/aicons/
     self.status_icon = gtk.status_icon_new_from_file("fraise-icon.png")
     self.status_icon.set_has_tooltip(True)
     self.status_icon.set_tooltip_text("PyModoro " + VERSION)
     self.status_icon.connect("popup-menu", self.popup, None)
     self.status_icon.set_visible(True)
Example #16
0
 def InitStatusIcon(self):
     if hasattr(gtk, 'status_icon_new_from_file'):
         # use gtk.status_icon
         self.statusIcon = gtk.status_icon_new_from_file(tcosmonitor.shared.IMG_DIR + "tcos-devices-32x32.png")
         self.statusIcon.set_tooltip( _("Tcos Devices") )
         self.statusIcon.connect('popup-menu', self.popup_menu)
     else:
         shared.error_msg( _("ERROR: No tray icon support") )
         sys.exit(1)
Example #17
0
 def __init__(s):
     s.icon = gtk.status_icon_new_from_file(s.resource("phase-0.png"))
     s.icon.set_tooltip("Idle")
     s.state = "idle"
     s.tick_interval = 5  # number of seconds between each poll
     s.icon.connect('activate', s.icon_click)
     s.icon.set_visible(True)
     s.work_started = 0
     gobject.timeout_add(200, s.ding)
     s.update()
Example #18
0
def create_icon(title, text=""):
    global icon
    pynotify.init("pymodoro")
    icon=gtk.status_icon_new_from_file(dir_img)
    icon.set_visible(False)
    icon.connect('activate', quit)
    icon.set_tooltip("%s\n(%s)" % (title,text))
    icon.set_visible(True)
    ui_idle()
    gobject.timeout_add (1,show_notification,(title,text,icon))
Example #19
0
 def update_icon(self):
     """ Initially set self.icon and then update with the
         icon for the current state
     """
     fn = "connected.png" if self.state==True else "disconnected.png" 
     path = os.path.join(self.location, fn)
     assert os.path.exists(path), 'File not found: %s' % path
     if hasattr(self, 'icon'):
         self.icon.set_from_file(path)
     else:
         self.icon = gtk.status_icon_new_from_file(path)
Example #20
0
 def __init__(self):
     self.dialog_title = ""
     self.daemon_STOCK = gtk.STOCK_YES
     self.sun_icon = "{0}{1}.png".format(icon_path, __all__)
     self.icon = gtk.status_icon_new_from_file(self.sun_icon)
     self.icon.connect("popup-menu", self.right_click)
     self.img = gtk.Image()
     self.img.set_from_file(self.sun_icon)
     self.icon.set_tooltip("Slackware Update Notifier")
     self.cmd = "/etc/rc.d/rc.sun"
     gtk.main()
    def __init__(self):

        # Set up icon 
        self.button = gtk.Button()
        self.button.set_relief(gtk.RELIEF_NONE)
        self.sicon = gtk.status_icon_new_from_file('/usr/share/hermes/img/logo_16.png')
        self.sicon.set_visible(True)
        self.sicon.connect("button-press-event", self.on_mouse_press)

        # Set up menu
        self.menu = HermesMenu()
Example #22
0
 def __init__(self):
     self.dialog_title = ""
     self.daemon_STOCK = gtk.STOCK_YES
     self.sun_icon = "{0}{1}.png".format(icon_path, __all__)
     self.icon = gtk.status_icon_new_from_file(self.sun_icon)
     self.icon.connect("popup-menu", self.right_click)
     self.img = gtk.Image()
     self.img.set_from_file(self.sun_icon)
     self.icon.set_tooltip("Slackware Update Notifier")
     self.cmd = "{0}sun_daemon".format(bin_path)
     self.daemon_start()
     gtk.main()
 def get_tray_icon(show_ide_cb, get_menu_func):
     icon = gtk.status_icon_new_from_file(IMG_PATH)
     icon.set_visible(True)
     def popup_menu_cb(widget, button, time, data = None):
         if button == 3:
             if data:
                 data.show_all()
                 data.popup(None, None, None, 3, time)
     
     icon.connect('activate', show_ide_cb)
     icon.connect('popup-menu', popup_menu_cb, get_menu_func())
     return TrayIcon(icon)
Example #24
0
 def __init__(self):
     self.config = get_global_config()
     self.icon = gtk.status_icon_new_from_file(inactive_icon)
     self.icon.set_tooltip("Idle")
     notify2.init("Nix Updater")
     self.icon.set_visible(True)
     self.update_running = False
     self.notifier = None
     self.watchdir = '/var/lib/apt'
     self.upgrades = 0
     self.icon.connect('activate', self.on_left_click)
     self.icon.connect('popup-menu', self.on_right_click)
Example #25
0
 def on_enable(self):
     self.visible = True
     self.delete_callback_handle = self.window.connect("delete-event", self.toggle_visible)
     self.state_callback_handle = self.window.connect("play-state-changed", self.play_state_changed)
     self.song_callback_handle = self.window.connect("song-changed", self.song_changed)
     
     if indicator_capable:
         self.ind.set_status(appindicator.STATUS_ACTIVE)      
     else:
         self.statusicon = gtk.status_icon_new_from_file(get_data_file('media', 'icon.png'))
         self.statusicon.connect('activate', self.toggle_visible)
     
     self.build_context_menu()
Example #26
0
	def __init__(self, icon_name="TestTrayIcon", icon_file=None, menu=None, activate=None):
		# thats so incredibly simple!
		if icon_file:
			self.status_icon=gtk.status_icon_new_from_file(icon_file)
		else:
			self.status_icon=gtk.status_icon_new_from_icon_name(icon_name)
		
		# connect the menu and the callback if given
		if menu:
			self.connect_popup_menu(menu)

		if activate:
			self.connect_activate(activate)
Example #27
0
	def trayIcon(self):
		def trayMenu(icon, event_button, event_time):
			menu = gtk.Menu()
			item = gtk.MenuItem(lang['trayMenuClose'])
			item.connect_object("activate", self.exit, menu)
			item.show()
			menu.append(item)
			menu.popup(None, None, gtk.status_icon_position_menu, event_button, event_time, icon)
		def trayShowHide(statusIcon):
			print "showhide"
		self.icon = gtk.status_icon_new_from_file(self._icon_path)
		self.icon.connect('popup-menu', trayMenu)
		self.icon.connect('activate', trayShowHide)
Example #28
0
	def __init__(self):
		self.conf = SlogConf()

		gladefile = os.path.join(DATA_DIR, "slog.glade")
		self.wtree = gtk.glade.XML(gladefile, domain="slog")
		self.wtree.signal_autoconnect(self)

		# Create tray icon 
		self.status_icon = gtk.status_icon_new_from_file(get_icon("slog.png"))
		self.status_icon.set_tooltip(APP_NAME)
		self.status_icon.connect("popup-menu", self.on_tray_popup)
		self.status_icon.connect("activate", self.on_tray_clicked)

		# Create main window
		self.window = self.wtree.get_widget("mainWindow")
		self.window.set_icon_from_file(get_icon("slog_logo.png"))
		self.window.set_title("%s %s" % (APP_NAME, VERSION))
		self.window.set_size_request(396, 256)

		# Restore window settings
		(width, height) = self.conf.get_size()
		(left, top) = self.conf.get_pos()
		if left != 0 or top != 0:
			self.window.move(left, top)
		self.window.set_default_size(width, height)

		self.wtree.get_widget("hPaned").set_position(self.conf.paned)
		self.sidebar = self.wtree.get_widget("sideBar")

		#Create Spy object
		self.spy = Spy()
		mb_menuitem_spy = self.wtree.get_widget("menuItemSpy1")
		tray_menuitem_spy = self.wtree.get_widget("menuItemSpy2")
		self.spy_action = gtk.ToggleAction("Spy", "_Spy", "Spy Service", None)
		self.spy_action.connect("activate", self.on_spy_clicked)
		self.spy_action.connect_proxy(tray_menuitem_spy)
		self.spy_action.connect_proxy(mb_menuitem_spy)

		if self.conf.tray_start == 0:
			self.window.show_all()

		if self.conf.spy_auto == 1:
			self.spy_action.activate()

		plugin_dir = os.path.join(DATA_DIR, "plugins")
		self.plugin_manager = PluginManager()
		self.plugin_manager.add_plugin_dir(plugin_dir)
		self.plugin_manager.scan_for_plugins()
		self.plugin_view = PluginView(self.wtree, self.plugin_manager)

		self.__load_plugins()
Example #29
0
	def __init__(self):
		self.conf = SlogConf()

		gladefile = os.path.join(DATA_DIR, "slog.glade")
		self.wtree = gtk.glade.XML(gladefile, domain="slog")
		self.wtree.signal_autoconnect(self)

		# Create tray icon 
		self.status_icon = gtk.status_icon_new_from_file(get_icon("slog.png"))
		self.status_icon.set_tooltip(APP_NAME)
		self.status_icon.connect("popup-menu", self.on_tray_popup)
		self.status_icon.connect("activate", self.on_tray_clicked)

		# Create main window
		self.window = self.wtree.get_widget("mainWindow")
		self.window.set_icon_from_file(get_icon("slog.png"))
		self.window.set_title("%s %s" % (APP_NAME, VERSION))
		self.window.set_size_request(396, 256)

		# Restore window settings
		(width, height) = self.conf.get_size()
		(left, top) = self.conf.get_pos()
		if left != 0 or top != 0:
			self.window.move(left, top)
		self.window.set_default_size(width, height)

		self.wtree.get_widget("hPaned").set_position(self.conf.paned)
		self.sidebar = self.wtree.get_widget("sideBar")

		#Create Spy object
		self.spy = Spy()
		mb_menuitem_spy = self.wtree.get_widget("menuItemSpy1")
		tray_menuitem_spy = self.wtree.get_widget("menuItemSpy2")
		self.spy_action = gtk.ToggleAction("Spy", "_Spy", "Spy Service", None)
		self.spy_action.connect("activate", self.on_spy_clicked)
		self.spy_action.connect_proxy(tray_menuitem_spy)
		self.spy_action.connect_proxy(mb_menuitem_spy)

		if self.conf.tray_start == 0:
			self.window.show_all()

		if self.conf.spy_auto == 1:
			self.spy_action.activate()

		plugin_dir = os.path.join(DATA_DIR, "plugins")
		self.plugin_manager = PluginManager()
		self.plugin_manager.add_plugin_dir(plugin_dir)
		self.plugin_manager.scan_for_plugins()
		self.plugin_view = PluginView(self.wtree, self.plugin_manager)

		self.__load_plugins()
Example #30
0
	def __init__(self, controller):
                self.controller = controller
		file = os.path.join('icons',StatusIcon.NONE_ICON)
		if not (os.access(file,os.F_OK)):
			print "Can't access icon %s" % StatusIcon.NONE_ICON
		self.status_icon = gtk.status_icon_new_from_file(file)
		self.status_icon.set_visible(True)
		self.status_icon.connect("activate", self.activate_cb)

                #Build Context Menu
		radio_submenu = gtk.Menu()

		self.radioRadioMenu = dict()

		normalRadioMenuItem = gtk.RadioMenuItem(None, "Normal (Prefer 3G)")
		normalRadioMenuItem.connect('toggled', self.normalRadio_menu_cb)
		self.radioRadioMenu[radio.STR_PREFER]=normalRadioMenuItem
		radio_submenu.append(normalRadioMenuItem)

		umtsRadioMenuItem = gtk.RadioMenuItem(normalRadioMenuItem, "UMTS/HSPA (3G Only)")
		self.radioRadioMenu[radio.STR_UMTS]=umtsRadioMenuItem
		umtsRadioMenuItem.connect('toggled', self.umtsRadio_menu_cb)
		radio_submenu.append(umtsRadioMenuItem)

		gprsRadioMenuItem = gtk.RadioMenuItem(umtsRadioMenuItem, "GPRS Only")
		self.radioRadioMenu[radio.STR_GPRS]=gprsRadioMenuItem
		gprsRadioMenuItem.connect('toggled', self.gprsRadio_menu_cb)
		radio_submenu.append(gprsRadioMenuItem)
		
		radio_submenu.append(gtk.SeparatorMenuItem())

		offRadioMenuItem = gtk.RadioMenuItem(gprsRadioMenuItem, "Off")
		offRadioMenuItem.connect('toggled', self.offRadio_menu_cb)
		self.radioRadioMenu[radio.STR_OFF]=offRadioMenuItem
		radio_submenu.append(offRadioMenuItem)

		menu = gtk.Menu()
		radioMenuItem = gtk.MenuItem("Radio State")
		radioMenuItem.set_submenu(radio_submenu)
		menu.append(radioMenuItem)
		menu.append(gtk.SeparatorMenuItem())
		aboutMenuItem = gtk.MenuItem("About")
                aboutMenuItem.connect('activate', self.about_menu_cb)
		menu.append(aboutMenuItem)
		menu.append(gtk.SeparatorMenuItem())
                exitMenuItem = gtk.MenuItem("Exit")
                exitMenuItem.connect('activate', self.close_menu_cb)
                menu.append(exitMenuItem)
                
		self.status_icon.connect('popup-menu', self.popup_menu_cb, menu)
Example #31
0
 def __init__(self):
     self.icon=gtk.status_icon_new_from_file(self.icon_directory()+"idle.png")
     self.icon.set_tooltip("Idle")
     self.state = "idle"
     self.tick_interval=10 #number of seconds between each poll
     self.icon.connect('activate',self.icon_click)
     self.icon.connect('popup-menu', self.right_click_event)
     self.icon.set_visible(True)
     self.start_working_time = 0
     self.min_work_time = MIN_WORK_TIME
     self.start_time = datetime(1900,1,1,8,0,0)
     self.end_time = datetime(1900,1,1,22,0,0)
     self.sound_file = self.icon_directory()+"warning.wav"
     self.dbg = True
Example #32
0
	def __init__(self):
		self.set_window('main', self.get_glade_xml("window_main"))
		self.windows['main'].signal_autoconnect(self)
		self.lbl_firmware_version = self._('label_firmware_version')
		self.lbl_hardware_version = self._('label_hardware_version')
		self.adjust_backlight = gtk.Adjustment(upper=110, step_incr=1, page_incr=9, page_size=10)
		self.adjust_contrast = gtk.Adjustment(upper=265, step_incr=1, page_incr=9, page_size=10)

		self._('hscale_lcd_contrast').set_adjustment(self.adjust_contrast)
		self._('hscale_lcd_brightness').set_adjustment(self.adjust_backlight)
		
		self.menu_popup = self.get_glade_xml( 'menu_popup')
		self.menu_popup.signal_autoconnect(self)
		self.menu_popup = self.menu_popup.get_widget("menu_popup")
		self.icon = gtk.status_icon_new_from_file("icon.png")
		self.icon.connect('popup-menu', self.icon_popup_menu)
		self._('treeview_displays').set_headers_visible(False)
		self._('treeview_widgets').set_headers_visible(False)
		self._('treeview_layouts').set_headers_visible(False)

		#Modules
		self.displays_tree_store = gtk.TreeStore(str)
		self._('treeview_displays').set_model(self.displays_tree_store)
		column =  gtk.TreeViewColumn('')
		self._('treeview_displays').append_column(column)
		cell = gtk.CellRendererText()
		column.pack_start(cell, True)
		column.add_attribute(cell, 'text', 0)
		self._('treeview_displays').connect('cursor-changed', self.displays_cursor_changed)

		#Books
		self.widgets_tree_store = gtk.TreeStore(str)
		self._('treeview_widgets').set_model(self.widgets_tree_store)
		column = gtk.TreeViewColumn()
		self._('treeview_widgets').append_column(column)
		cell = gtk.CellRendererText()
		column.pack_start(cell, True)
		column.add_attribute(cell, 'text', 0)
		self._('treeview_widgets').connect('cursor-changed', self.widgets_cursor_changed)

		#Pages
		self.layouts_tree_store = gtk.TreeStore(str)
		self._('treeview_layouts').set_model(self.layouts_tree_store)
		column = gtk.TreeViewColumn()
		self._('treeview_layouts').append_column(column)
		cell = gtk.CellRendererText()
		column.pack_start(cell, True)
		column.add_attribute(cell, 'text', 0)
		self._('treeview_layouts').connect('cursor-changed', self.layouts_cursor_changed)
Example #33
0
    def __init__(self, parent, title = "Pyjama", text = "Python Jamendo Audiocenter"):
        self.parent = parent
        self.menu = TrayMenu(parent)
        if NOTIFICATIONS:
            pynotify.init("pynotify")
        self.notify = None
#        self.icon=gtk.status_icon_new_from_icon_name("warning")
        self.icon = gtk.status_icon_new_from_file(os.path.join(functions.install_dir(), "images", "pyjama.png"))
        self.icon.set_visible(False)
#        self.icon.connect('activate', self.parent.switch_window_state)
        self.icon.connect('activate', self.parent.window.show_window)
        self.icon.connect('popup-menu', self.cb_popup_menu, self.menu)
        self.icon.connect('scroll-event', self.cb_scroll)
        self.icon.set_tooltip("%s\n%s" % (title, text))
        self.icon.set_visible(True)
Example #34
0
File: wwan.py Project: f3l/wwan
	def __init__(self, controller):
		self.controller = controller
		file = os.path.join('icons', StatusIcon.NONE_ICON)
		if not os.access(file, os.F_OK):
			print "Can't access icon %s" % StatusIcon.NONE_ICON
		self.status_icon = gtk.status_icon_new_from_file(file)
		self.status_icon.set_visible(True)
		# prevent running callbacks, when changing button values from program
		self.allowcallbacks = True

		# Build Context Menu
		menu = gtk.Menu()

		self.radioRadioMenu = dict()

		normalRadioMenuItem = gtk.RadioMenuItem(None, 'Normal (Prefer 3G)')
		normalRadioMenuItem.connect('toggled', self.normalRadio_menu_cb)
		self.radioRadioMenu[radio.PREFER] = normalRadioMenuItem
		menu.append(normalRadioMenuItem)

		umtsRadioMenuItem = gtk.RadioMenuItem(normalRadioMenuItem, 'UMTS/HSPA (3G Only)')
		self.radioRadioMenu[radio.UMTS] = umtsRadioMenuItem
		umtsRadioMenuItem.connect('toggled', self.umtsRadio_menu_cb)
		menu.append(umtsRadioMenuItem)

		gprsRadioMenuItem = gtk.RadioMenuItem(umtsRadioMenuItem, 'GPRS Only')
		self.radioRadioMenu[radio.GPRS] = gprsRadioMenuItem
		gprsRadioMenuItem.connect('toggled', self.gprsRadio_menu_cb)
		menu.append(gprsRadioMenuItem)

		menu.append(gtk.SeparatorMenuItem())

		self.enabledMenuItem = gtk.CheckMenuItem('Enabled')
		self.enabledMenuItem.connect('toggled', self.enable_menu_cb)
		menu.append(self.enabledMenuItem)

		menu.append(gtk.SeparatorMenuItem())

		aboutMenuItem = gtk.MenuItem("About")
		aboutMenuItem.connect('activate', self.show_about_dialog_cb)
		menu.append(aboutMenuItem)

#		exitMenuItem = gtk.MenuItem('Exit')
#		exitMenuItem.connect('activate', self.close_menu_cb)
#		menu.append(exitMenuItem)

#		self.status_icon.connect('activate', self.activate_cb)
		self.status_icon.connect('popup-menu', self.popup_menu_cb, menu)
Example #35
0
    def on_enable(self):
        self.visible = True
        self.delete_callback_handle = self.window.connect(
            "delete-event", self.toggle_visible)
        self.state_callback_handle = self.window.connect(
            "play-state-changed", self.play_state_changed)
        self.song_callback_handle = self.window.connect(
            "song-changed", self.song_changed)

        if indicator_capable:
            self.ind.set_status(appindicator.STATUS_ACTIVE)
        else:
            self.statusicon = gtk.status_icon_new_from_file(
                get_data_file('media', 'icon.png'))
            self.statusicon.connect('activate', self.toggle_visible)

        self.build_context_menu()
Example #36
0
    def __init__(self,
                 icon_name="TestTrayIcon",
                 icon_file=None,
                 menu=None,
                 activate=None):
        # thats so incredibly simple!
        if icon_file:
            self.status_icon = gtk.status_icon_new_from_file(icon_file)
        else:
            self.status_icon = gtk.status_icon_new_from_icon_name(icon_name)

        # connect the menu and the callback if given
        if menu:
            self.connect_popup_menu(menu)

        if activate:
            self.connect_activate(activate)
Example #37
0
    def __init__(self, tvmaxe):
        self.tvmaxe = tvmaxe
        self.gui = tvmaxe.gui

        if use_appind:
            self.trayIcon = appindicator.Indicator("tv-maxe",
                                                   "distributor-logo",
                                                   appindicator.CATEGORY_OTHER)
            self.trayIcon.set_status(appindicator.STATUS_PASSIVE)
            self.trayIcon.set_label('TV-Maxe')
            self.trayIcon.set_property('title', 'TV-Maxe')
            self.trayIcon.set_property('icon-desc', 'TV-Maxe')
            self.trayIcon.set_icon("{0}/tvmaxe.png".format(os.getcwd()))
            self.trayIcon.set_menu(self.gui.get_object('menu9'))
        else:
            self.trayIcon = gtk.status_icon_new_from_file("tvmaxe.png")
            self.trayIcon.connect('button-press-event', self.pop_up_menu)
        self.trayIcon.connect('scroll-event', self.scroll)
Example #38
0
        def update_icon(self, status="unknown", addr="0.0.0.0"):

            if status == "unknown":
                self.state = self.UNKNOWN
            elif status == "connected":
                self.state = self.CONNECTED
            else:
                self.state = self.DISCONNECTED

            #gobject.timeout_add(30000, self.update_icon)

            fn = self.icon_filename[self.state]
            path = os.path.join(self.location, fn)
            assert os.path.exists(path), 'File not found: %s' % path
            if hasattr(self, 'icon'):
                self.icon.set_from_file(path)
            else:
                self.icon = gtk.status_icon_new_from_file(path)
Example #39
0
    def __init__(self):
        '''Constructor para inicializar las variables.'''
        try:
            # Leemos el archivo de configuración
            self.wallpapers, self.tiempo, self.aleatorio, self.estilo, self.accion = confhandler.leer_configuracion(
            )
        except confhandler.ConfigError:
            # Creamos un nuevo archivo de configuración
            self.wallpapers, self.tiempo, self.aleatorio, self.estilo, self.accion = confhandler.crear_configuracion(
            )

        # Cargamos del archivo glade el menú
        self.glade = gtk.glade.XML(os.path.join(PATH, "pywallchanger.glade"),
                                   root="menu")
        # Conectamos todas las señales
        self.glade.signal_autoconnect(self)
        # Creamos un statusicon a partir de una imagen
        self.tray = gtk.status_icon_new_from_file(
            os.path.join(PIX_PATH, "pywallchanger.svg"))
        # Conectamos sus señales
        self.tray.connect("popup-menu", self.on_tray_popup_event)
        self.tray.connect("activate", self.on_tray_activate_event)
        self.tray.set_tooltip("pyWallChanger")
        # Y la hacemos visible
        self.tray.set_visible(True)
        # Indicamos que elprograma ha comenzado a funcionar
        if pynotify.init("pyWallChanger"):
            n = pynotify.Notification(
                "pyWallChanger",
                "pyWallChanger se está ejecutando en la barra de tareas.",
                "file://" + os.path.join(PIX_PATH, "pywallchanger.svg"))
            n.show()
        # Y iniciamos la hebra que cambia los wallpapers
        self.changer = Changer(self.wallpapers, self.tiempo, self.aleatorio,
                               self.estilo)
        self.changer.start()
Example #40
0
about_dialog = builder.get_object("about_dialog")
about_dialog.set_license(open(license_file).read())
about_dialog.connect("delete-event", hide_window)
about_dialog.connect("response", hide_window)

# popup_menu
popup_menu = builder.get_object("popup_menu")

popup_menu_item_show_hide = builder.get_object("popup_menu_item_show_hide")
popup_menu_item_start = builder.get_object("popup_menu_item_start")
popup_menu_item_stop = builder.get_object("popup_menu_item_stop")
popup_menu_item_info = builder.get_object("popup_menu_item_info")
popup_menu_item_quit = builder.get_object("popup_menu_item_quit")

# status_icon
status_icon = gtk.status_icon_new_from_file(icon_file)
status_icon.connect("activate", toggle_window, edit_whitelist, model)
status_icon.connect("popup-menu", show_popup_menu, popup_menu)

# popup_menu
popup_menu_item_show_hide.connect("activate", toggle_window, edit_whitelist,
                                  model)
popup_menu_item_start.connect("activate", start_daemon, popup_menu_item_start,
                              status_icon)
popup_menu_item_stop.connect("activate", stop_daemon, popup_menu_item_stop,
                             status_icon)
popup_menu_item_info.connect("activate", show_window, about_dialog)
popup_menu_item_quit.connect("activate", quit_program, popup_menu_item_quit,
                             status_icon)

# edit_whitelist
Example #41
0
                                    "performance")
    balanced_item.connect_object("activate", select_power_profile, "balanced")
    battery_item.connect_object("activate", select_power_profile, "battery")

    intel_item.connect_object("activate", select_graphics_card, "intel")
    nvidia_item.connect_object("activate", select_graphics_card, "nvidia")

    firmware_item.connect_object("activate", update_firmware, "Firmware")

    exit_item.connect_object("activate", exit_app, "Exit")

    #Show the menu items
    menu.show_all()

    #Popup the menu
    menu.popup(None, None, None, event_button, event_time)


def on_right_click(data, event_button, event_time):
    make_menu(event_button, event_time)


if __name__ == "__main__":
    if check_if_currently_running():
        print("Currently running... exiting...")
    else:
        write_pid_file()
        icon = gtk.status_icon_new_from_file(icon_path("system76.png"))
        icon.connect("popup-menu", on_right_click)
        gtk.main()
Example #42
0
 def create_gui(self):
     self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
     self.window.set_border_width(15)
     self.window.set_default_size(380, 130)
     self.window.set_position(gtk.WIN_POS_CENTER)
     self.window.set_title('pyIpclient by:xspyhack@guetsec')
     self.window.set_keep_above(True)
     self.window.set_resizable(False)
     self.window.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color('#CCCCCC'))
     self.window.connect('delete_event', self.delete_event_callback,
                         self.window)
     self.window.connect('destroy', self.destroy_callback)
     vbox = gtk.VBox(False, 10)
     self.window.add(vbox)
     hbox_msg = gtk.HBox(False, 0)
     hbox_usage = gtk.HBox(False, 0)
     hbox_input = gtk.HBox(False, 0)
     hbox_btns = gtk.HBox(False, 0)
     separator = gtk.HSeparator()
     vbox.pack_start(hbox_msg, False, False, 0)
     vbox.pack_start(hbox_usage, False, False, 0)
     vbox.pack_start(hbox_input, False, False, 0)
     vbox.pack_start(separator, False, False, 0)
     vbox.pack_start(hbox_btns, False, False, 0)
     self.label_msg = gtk.Label(u'新闻')
     self.label_ip = gtk.Label('255.255.255.255')
     self.label_flow = gtk.Label(u' 流量: 0.00KB')
     self.label_money = gtk.Label(u' 剩余金额: 0.00元')
     self.label_guetsec = gtk.Label('GUET Sec')
     label_user = gtk.Label(u' 用户:')
     label_pswd = gtk.Label(u' 密码:')
     self.entry_user = gtk.Entry(max=15)
     self.entry_pswd = gtk.Entry(max=20)
     self.entry_pswd.set_visibility(False)
     self.btn_remember = gtk.CheckButton(u'记住用户', False)
     self.btn_autologin = gtk.CheckButton(u'自动登录', False)
     self.btn_remember.connect('clicked', self.btn_togg_clicked)
     self.btn_autologin.connect('clicked', self.btn_togg_clicked)
     btn_open = gtk.Button(u' 开放 ')
     btn_stop = gtk.Button(u' 停止 ')
     btn_hide = gtk.Button(u' 隐藏 ')
     btn_exit = gtk.Button(u' 退出 ')
     btn_open.connect('clicked', self.btn_open_clicked)
     btn_stop.connect('clicked', self.btn_stop_clicked)
     btn_hide.connect('clicked', self.btn_hide_clicked)
     btn_exit.connect('clicked', self.btn_exit_clicked)
     hbox_msg.pack_start(self.label_msg, True, True, 10)
     hbox_msg.pack_start(self.label_ip, True, True, 10)
     hbox_usage.pack_start(self.label_flow, True, True, 10)
     hbox_usage.pack_start(self.label_guetsec, False, False, 0)
     hbox_usage.pack_start(self.label_money, True, True, 0)
     hbox_input.pack_start(label_user, False, False, 0)
     hbox_input.pack_start(self.entry_user, False, False, 10)
     hbox_input.pack_start(label_pswd, False, False, 10)
     hbox_input.pack_start(self.entry_pswd, False, False, 5)
     hbox_btns.pack_end(btn_exit, False, False, 5)
     hbox_btns.pack_end(btn_hide, False, False, 5)
     hbox_btns.pack_end(btn_stop, False, False, 5)
     hbox_btns.pack_end(btn_open, False, False, 5)
     hbox_btns.pack_end(self.btn_remember, False, False, 5)
     hbox_btns.pack_end(self.btn_autologin, False, False, 5)
     icon_path = CONF['SOFTWARE DIR'] + CONF['ICON NAME']
     try:
         # self.create_icon_file()
         self.window.set_icon_from_file(icon_path)
         self.statusicon = gtk.status_icon_new_from_file(icon_path)
     except glib.GError:
         self.statusicon = gtk.status_icon_new_from_stock(
             gtk.STOCK_GO_FORWARD)
     finally:
         self.statusicon.connect('activate', self.trayicon_activate)
         self.statusicon.set_tooltip(COPYRIGHT['SOFTWARE'])
Example #43
0
 def update_icon(self, kind):
     path = '{}.png'.format(kind)
     if self.icon is not None:
         self.icon.set_from_file(path)
     else:
         self.icon = gtk.status_icon_new_from_file(path)
Example #44
0
def xmix (item): os.system ('ossxmix &')
def tail (item): exit ()

def lineon (item):
	setline (100)
	item.set_label ("Отключить микшер")
	item.connect ('activate', lineoff)

def lineoff (item):
	setline (0)
	item.set_label ("Включить микшер")
	item.connect ('activate', lineon)

volume = gtk.VScale ()
volume.set_draw_value (False)
volume.connect ("value-changed", setmxr)
volume.set_range (0, 25); volume.set_size_request (15, 150)
volume.show ()

icon = gtk.status_icon_new_from_file (os.path.dirname (__file__) + "/icon.svg")
icon.connect ('popup-menu', menu)
icon.connect ('activate', hide)

window = gtk.Window (gtk.WINDOW_POPUP)
window.set_default_size (25, 160)
window.connect ('show', move, icon)
window.add (volume)

getmxr ()
gtk.main ()