Python gi.repository.AppIndicator3() Examples
The following are 15
code examples of gi.repository.AppIndicator3().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
gi.repository
, or try the search function
.
Example #1
Source File: notifier.py From autokey with GNU General Public License v3.0 | 6 votes |
def __init__(self, autokeyApp): Notify.init("AutoKey") # Used to rate-limit error notifications to 1 per second. Without this, two notifications per second cause the # following exception, which in turn completely locks up the GUI: # gi.repository.GLib.GError: g-io-error-quark: # GDBus.Error:org.freedesktop.Notifications.Error.ExcessNotificationGeneration: # Created too many similar notifications in quick succession (36) self.last_notification_timestamp = datetime.datetime.now() self.app = autokeyApp self.configManager = autokeyApp.service.configManager self.indicator = AppIndicator3.Indicator.new("AutoKey", cm.ConfigManager.SETTINGS[cm.NOTIFICATION_ICON], AppIndicator3.IndicatorCategory.APPLICATION_STATUS) self.indicator.set_attention_icon(common.ICON_FILE_NOTIFICATION_ERROR) self.update_visible_status() self.rebuild_menu()
Example #2
Source File: cric_indicator.py From cricket-score-applet with GNU General Public License v3.0 | 6 votes |
def __init__(self): Notify.init("cricket score indicator") self.notification = Notify.Notification.new("") self.notification.set_app_name("Cricket Score") """ Initialize appindicator and other menus """ self.indicator = appindicator.Indicator.new("cricket-indicator", ICON_PREFIX + DEFAULT_ICON+ ICON_SUFFIX , appindicator.IndicatorCategory.APPLICATION_STATUS) # if DEBUG: # self.indicator.set_icon_theme_path(DARK_ICONS) self.indicator.set_status(appindicator.IndicatorStatus.ACTIVE) self.indicator.set_label("Loading", "") self.indicator.connect("scroll-event", self.scroll_event_cb) self.menu_setup() # the 'id' of match selected for display as indicator label self.label_match_id = None self.open_scorecard = set() self.intl_menu = [] self.dom_menu = []
Example #3
Source File: trayicon.py From zim-desktop-wiki with GNU General Public License v2.0 | 6 votes |
def set_global_trayicon(classic=False): global GLOBAL_TRAYICON if AppIndicator and not classic: cls = AppIndicatorTrayIcon else: cls = StatusIconTrayIcon if GLOBAL_TRAYICON and isinstance(GLOBAL_TRAYICON, cls): pass else: new = cls() ZIM_APPLICATION.add_window(new) if GLOBAL_TRAYICON: GLOBAL_TRAYICON.destroy() GLOBAL_TRAYICON = new
Example #4
Source File: indicator.py From lplayer with MIT License | 5 votes |
def __init__(self, main_window): GObject.GObject.__init__(self) self.main_window = main_window self.indicator = AppIndicator3.Indicator.new( 'lplayer', 'lplayer', AppIndicator3.IndicatorCategory.APPLICATION_STATUS) self.indicator.set_status(AppIndicator3.IndicatorStatus.ACTIVE) self.indicator.set_menu(self.create_menu()) self.indicator.set_icon_full(PLAY, _('Play')) self.indicator.set_label('', '') self.indicator.connect('scroll-event', self.play_or_pause)
Example #5
Source File: AppIndicator.py From battery-monitor with GNU General Public License v3.0 | 5 votes |
def __init__(self, TEST_MODE: bool = False): self.indicator = AppIndicator3.Indicator.new(APPINDICATOR_ID, ICONS['app'], AppIndicator3.IndicatorCategory.SYSTEM_SERVICES) self.indicator.set_title('Battery Monitor') self.indicator.set_status(AppIndicator3.IndicatorStatus.ACTIVE) # create menu self.indicator.set_menu(self.__create_menu()) # run the daemon self.daemon = Thread(target=self.__run_daemon, args=(TEST_MODE,)) self.daemon.setDaemon(True) self.daemon.start()
Example #6
Source File: notifier.py From autokey with GNU General Public License v3.0 | 5 votes |
def update_visible_status(self): if cm.ConfigManager.SETTINGS[cm.SHOW_TRAY_ICON]: self.indicator.set_status(AppIndicator3.IndicatorStatus.ACTIVE) else: self.indicator.set_status(AppIndicator3.IndicatorStatus.PASSIVE)
Example #7
Source File: notifier.py From autokey with GNU General Public License v3.0 | 5 votes |
def hide_icon(self): self.indicator.set_status(AppIndicator3.IndicatorStatus.PASSIVE)
Example #8
Source File: notifier.py From autokey with GNU General Public License v3.0 | 5 votes |
def notify_error(self, message): now = datetime.datetime.now() if self.last_notification_timestamp + datetime.timedelta(seconds=1) < now: self.show_notify(message, Gtk.STOCK_DIALOG_ERROR) self.last_notification_timestamp = now self.errorItem.show() self.indicator.set_status(AppIndicator3.IndicatorStatus.ATTENTION)
Example #9
Source File: notifier.py From autokey with GNU General Public License v3.0 | 5 votes |
def on_remove_icon(self, widget, data=None): self.indicator.set_status(AppIndicator3.IndicatorStatus.PASSIVE) cm.ConfigManager.SETTINGS[cm.SHOW_TRAY_ICON] = False
Example #10
Source File: indicator.py From coinprice-indicator with MIT License | 5 votes |
def start(self): icon = self.exchange.get_icon() self.indicator_widget = AppIndicator.Indicator.new( "CoinPriceIndicator_" + str(self.unique_id), icon, AppIndicator.IndicatorCategory.APPLICATION_STATUS) self.indicator_widget.set_status(AppIndicator.IndicatorStatus.ACTIVE) self.indicator_widget.set_ordering_index(0) self.indicator_widget.set_menu(self._menu()) if self.exchange.active: self._start_exchange() else: self._stop_exchange() # updates GUI menus with data stored in the object
Example #11
Source File: indicator.py From yandex-disk-indicator with GNU General Public License v3.0 | 5 votes |
def __init__(self, path, ID): # Create indicator notification engine self.notify = Notification(_('Yandex.Disk ') + ID) # Setup icons theme self.setIconTheme(APPCONF['theme']) # Create staff for icon animation support (don't start it here) self._seqNum = 2 # Number current busy icon def iconAnimation(): # Changes busy icon by loop (triggered by self.timer) # As it called from timer (main GUI thread) there is no need to use idle_add here # Set next animation icon self.ind.set_icon_full(pathJoin(self.themePath, 'yd-busy' + str(self._seqNum) + '.png'), '') # Calculate next icon number self._seqNum = self._seqNum % 5 + 1 # 5 icon numbers in loop (1-2-3-4-5-1-2-3...) return True # True required to continue triggering by timer self.iconTimer = self.Timer(777, iconAnimation, start=False) # Create App Indicator self.ind = appIndicator.Indicator.new( "yandex-disk-%s" % ID[1: -1], self.icon['paused'], appIndicator.IndicatorCategory.APPLICATION_STATUS) self.ind.set_status(appIndicator.IndicatorStatus.ACTIVE) self.menu = self.Menu(self, ID) # Create menu for daemon self.ind.set_menu(self.menu) # Attach menu to indicator # Initialize Yandex.Disk daemon connection object super().__init__(path, ID) self.currentStatus = None # Current daemon status
Example #12
Source File: trayicon.py From zim-desktop-wiki with GNU General Public License v2.0 | 5 votes |
def check_dependencies(klass): return (True, [ ('Unity appindicator', bool(AppIndicator), False), ])
Example #13
Source File: trayicon.py From zim-desktop-wiki with GNU General Public License v2.0 | 5 votes |
def __init__(self): # Note that even though we specify the icon "zim", the # ubuntu appindicator framework will first check for an icon # "zim-panel". This way it finds the mono color icons. global _GLOBAL_INDICATOR if not _GLOBAL_INDICATOR: _GLOBAL_INDICATOR = AppIndicator.Indicator.new( 'zim-desktop-wiki', 'zim', AppIndicator.IndicatorCategory.APPLICATION_STATUS ) self.appindicator = _GLOBAL_INDICATOR self.appindicator.set_status(AppIndicator.IndicatorStatus.ACTIVE) self.on_notebook_list_changed()
Example #14
Source File: trayicon.py From zim-desktop-wiki with GNU General Public License v2.0 | 5 votes |
def destroy(self): self.appindicator.set_status(AppIndicator.IndicatorStatus.PASSIVE) self.emit('destroy')
Example #15
Source File: App.py From bcloud with GNU General Public License v3.0 | 4 votes |
def init_status_icon(self): def on_status_icon_popup_menu(status_icon, event_button, event_time): menu.popup(None, None, lambda a,b: Gtk.StatusIcon.position_menu(menu, status_icon), None, event_button, event_time) def on_status_icon_activate(status_icon): if self.window.props.visible: self.window.hide() else: self.window.present() if not self.profile or not self.profile['use-status-icon']: self.status_icon = None return menu = Gtk.Menu() show_item = Gtk.MenuItem.new_with_label(_('Show App')) show_item.connect('activate', lambda item: self.window.present()) menu.append(show_item) sep_item = Gtk.SeparatorMenuItem() menu.append(sep_item) pause_upload_item = Gtk.MenuItem.new_with_label( _('Pause Upload Tasks')) pause_upload_item.connect('activate', lambda item: self.upload_page.pause_tasks()) menu.append(pause_upload_item) pause_download_item = Gtk.MenuItem.new_with_label( _('Pause Download Tasks')) pause_download_item.connect('activate', lambda item: self.download_page.pause_tasks()) menu.append(pause_download_item) sep_item = Gtk.SeparatorMenuItem() menu.append(sep_item) quit_item = Gtk.MenuItem.new_with_label(_('Quit')) quit_item.connect('activate', lambda item: self.quit()) menu.append(quit_item) menu.show_all() self.status_menu = menu if 'AppIndicator' in globals(): self.status_icon = AppIndicator.Indicator.new(Config.NAME, Config.NAME, AppIndicator.IndicatorCategory.APPLICATION_STATUS) self.status_icon.set_menu(menu) self.status_icon.set_status(AppIndicator.IndicatorStatus.ACTIVE) else: self.status_icon = Gtk.StatusIcon() self.status_icon.set_from_icon_name(Config.NAME) # left click self.status_icon.connect('activate', on_status_icon_activate) # right click self.status_icon.connect('popup_menu', on_status_icon_popup_menu) # Open API