本文整理匯總了Python中gi.repository.AppIndicator3方法的典型用法代碼示例。如果您正苦於以下問題:Python repository.AppIndicator3方法的具體用法?Python repository.AppIndicator3怎麽用?Python repository.AppIndicator3使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類gi.repository
的用法示例。
在下文中一共展示了repository.AppIndicator3方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from gi import repository [as 別名]
# 或者: from gi.repository import AppIndicator3 [as 別名]
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()
示例2: __init__
# 需要導入模塊: from gi import repository [as 別名]
# 或者: from gi.repository import AppIndicator3 [as 別名]
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 = []
示例3: set_global_trayicon
# 需要導入模塊: from gi import repository [as 別名]
# 或者: from gi.repository import AppIndicator3 [as 別名]
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
示例4: __init__
# 需要導入模塊: from gi import repository [as 別名]
# 或者: from gi.repository import AppIndicator3 [as 別名]
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)
示例5: __init__
# 需要導入模塊: from gi import repository [as 別名]
# 或者: from gi.repository import AppIndicator3 [as 別名]
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()
示例6: update_visible_status
# 需要導入模塊: from gi import repository [as 別名]
# 或者: from gi.repository import AppIndicator3 [as 別名]
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)
示例7: hide_icon
# 需要導入模塊: from gi import repository [as 別名]
# 或者: from gi.repository import AppIndicator3 [as 別名]
def hide_icon(self):
self.indicator.set_status(AppIndicator3.IndicatorStatus.PASSIVE)
示例8: notify_error
# 需要導入模塊: from gi import repository [as 別名]
# 或者: from gi.repository import AppIndicator3 [as 別名]
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)
示例9: on_remove_icon
# 需要導入模塊: from gi import repository [as 別名]
# 或者: from gi.repository import AppIndicator3 [as 別名]
def on_remove_icon(self, widget, data=None):
self.indicator.set_status(AppIndicator3.IndicatorStatus.PASSIVE)
cm.ConfigManager.SETTINGS[cm.SHOW_TRAY_ICON] = False
示例10: start
# 需要導入模塊: from gi import repository [as 別名]
# 或者: from gi.repository import AppIndicator3 [as 別名]
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
示例11: __init__
# 需要導入模塊: from gi import repository [as 別名]
# 或者: from gi.repository import AppIndicator3 [as 別名]
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
示例12: check_dependencies
# 需要導入模塊: from gi import repository [as 別名]
# 或者: from gi.repository import AppIndicator3 [as 別名]
def check_dependencies(klass):
return (True, [
('Unity appindicator', bool(AppIndicator), False),
])
示例13: __init__
# 需要導入模塊: from gi import repository [as 別名]
# 或者: from gi.repository import AppIndicator3 [as 別名]
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()
示例14: destroy
# 需要導入模塊: from gi import repository [as 別名]
# 或者: from gi.repository import AppIndicator3 [as 別名]
def destroy(self):
self.appindicator.set_status(AppIndicator.IndicatorStatus.PASSIVE)
self.emit('destroy')
示例15: init_status_icon
# 需要導入模塊: from gi import repository [as 別名]
# 或者: from gi.repository import AppIndicator3 [as 別名]
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