当前位置: 首页>>代码示例>>Python>>正文


Python repository.AppIndicator3方法代码示例

本文整理汇总了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() 
开发者ID:autokey,项目名称:autokey,代码行数:19,代码来源:notifier.py

示例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 = [] 
开发者ID:rubyAce71697,项目名称:cricket-score-applet,代码行数:27,代码来源:cric_indicator.py

示例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 
开发者ID:zim-desktop-wiki,项目名称:zim-desktop-wiki,代码行数:18,代码来源:trayicon.py

示例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) 
开发者ID:atareao,项目名称:lplayer,代码行数:14,代码来源:indicator.py

示例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() 
开发者ID:maateen,项目名称:battery-monitor,代码行数:14,代码来源:AppIndicator.py

示例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) 
开发者ID:autokey,项目名称:autokey,代码行数:7,代码来源:notifier.py

示例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) 
开发者ID:autokey,项目名称:autokey,代码行数:4,代码来源:notifier.py

示例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) 
开发者ID:autokey,项目名称:autokey,代码行数:9,代码来源:notifier.py

示例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 
开发者ID:autokey,项目名称:autokey,代码行数:5,代码来源:notifier.py

示例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 
开发者ID:bluppfisk,项目名称:coinprice-indicator,代码行数:16,代码来源:indicator.py

示例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 
开发者ID:slytomcat,项目名称:yandex-disk-indicator,代码行数:31,代码来源:indicator.py

示例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),
		]) 
开发者ID:zim-desktop-wiki,项目名称:zim-desktop-wiki,代码行数:6,代码来源:trayicon.py

示例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() 
开发者ID:zim-desktop-wiki,项目名称:zim-desktop-wiki,代码行数:17,代码来源:trayicon.py

示例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') 
开发者ID:zim-desktop-wiki,项目名称:zim-desktop-wiki,代码行数:5,代码来源:trayicon.py

示例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 
开发者ID:XuShaohua,项目名称:bcloud,代码行数:63,代码来源:App.py


注:本文中的gi.repository.AppIndicator3方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。