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


Python Gtk.StatusIcon方法代码示例

本文整理汇总了Python中gi.repository.Gtk.StatusIcon方法的典型用法代码示例。如果您正苦于以下问题:Python Gtk.StatusIcon方法的具体用法?Python Gtk.StatusIcon怎么用?Python Gtk.StatusIcon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gi.repository.Gtk的用法示例。


在下文中一共展示了Gtk.StatusIcon方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: activate

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import StatusIcon [as 别名]
def activate(self, leftbtn_callback, menu):
        """ Setup the icon / the indicator """

        self._menu = menu

        if self._indicator:
            # Show the icon even when runing dev version
            self._indicator.set_icon_theme_path(ICONS_DIR)

            self._indicator.set_icon("gtg-panel")
            self._indicator.set_attention_icon(self.ATTENTION_ICON)
            self._indicator.set_menu(menu)
            self._indicator.set_status(appindicator.STATUS_ACTIVE)
        else:
            self._icon = Gtk.StatusIcon()
            self._icon.set_from_icon_name(self.NORMAL_ICON)
            self._icon.set_tooltip_text("Getting Things GNOME!")
            self._icon.set_visible(True)
            self._icon.connect('activate', leftbtn_callback)
            self._icon.connect('popup-menu', self._on_icon_popup) 
开发者ID:getting-things-gnome,项目名称:gtg,代码行数:22,代码来源:notification_area.py

示例2: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import StatusIcon [as 别名]
def __init__(self, *args, **kwargs):
		StatusIcon.__init__(self, *args, **kwargs)
		
		try:
			import gi
			gi.require_version('AppIndicator3', '0.1')
			from gi.repository import AppIndicator3 as appindicator
			
			self._status_active  = appindicator.IndicatorStatus.ACTIVE
			self._status_passive = appindicator.IndicatorStatus.PASSIVE
		except (ImportError, ValueError):
			raise NotImplementedError
		
		category = appindicator.IndicatorCategory.APPLICATION_STATUS
		# Whatever icon is set here will be used as a tooltip icon during the entire time to icon is shown
		self._tray = appindicator.Indicator.new("syncthing-gtk", self._get_icon(), category)
		self._tray.set_menu(self._get_popupmenu())
		self._tray.set_title(self.TRAY_TITLE) 
开发者ID:kozec,项目名称:syncthing-gtk,代码行数:20,代码来源:statusicon.py

示例3: _load_fallback

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import StatusIcon [as 别名]
def _load_fallback(self):
		if IS_UNITY or IS_KDE:
			status_icon_backends = [StatusIconAppIndicator, StatusIconKDE4, StatusIconDummy]
		else:
			status_icon_backends = [StatusIconKDE4, StatusIconAppIndicator, StatusIconDummy]
		
		if not self._status_fb:
			for StatusIconBackend in status_icon_backends:
				try:
					self._status_fb = StatusIconBackend(*self._arguments[0], **self._arguments[1])
					self._status_fb.connect(b"clicked",        self._on_click)
					self._status_fb.connect(b"notify::active", self._on_notify_active_fb)
					self._on_notify_active_fb()
					
					log.warning("StatusIcon: Using backend %s (fallback)" % StatusIconBackend.__name__)
					break
				except NotImplementedError:
					continue
		
			# At least the dummy backend should have been loaded at this point...
			assert self._status_fb
		
		# Update fallback icon
		self.set(self._icon, self._text) 
开发者ID:kozec,项目名称:syncthing-gtk,代码行数:26,代码来源:statusicon.py

示例4: get_status_icon

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import StatusIcon [as 别名]
def get_status_icon(*args, **kwargs):
	# Try selecting backend based on environment variable
	if "SYNCTHING_STATUS_BACKEND" in os.environ:
		kwargs["force"] = True
		
		status_icon_backend_name = "StatusIcon%s" % (os.environ.get("SYNCTHING_STATUS_BACKEND"))
		if status_icon_backend_name in globals():
			try:
				status_icon = globals()[status_icon_backend_name](*args, **kwargs)
				log.info("StatusIcon: Using requested backend %s" % (status_icon_backend_name))
				return status_icon
			except NotImplementedError:
				log.error("StatusIcon: Requested backend %s is not supported" % (status_icon_backend_name))
		else:
			log.error("StatusIcon: Requested backend %s does not exist" % (status_icon_backend_name))
		
		return StatusIconDummy(*args, **kwargs)
	
	# Use proxy backend to determine the correct backend while the application is running
	return StatusIconProxy(*args, **kwargs) 
开发者ID:kozec,项目名称:syncthing-gtk,代码行数:22,代码来源:statusicon.py

示例5: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import StatusIcon [as 别名]
def __init__(self, rc = '~/.task'):
        self.tw = TaskWarrior(data_location=rc, create=True)
        self.status_icon = Gtk.StatusIcon()
        self.status_icon.set_from_file("images/iconStarted-0.png")
        self.status_icon.connect("popup-menu", self.right_click_event)
        self.status_icon.connect("activate", self.left_click_event)
        # systray daemon
        name = dbus.service.BusName(self.bus_name, bus=dbus.SessionBus(),do_not_queue=True, replace_existing=False, allow_replacement=False )
        dbus.service.Object.__init__(self, name, '/systray')
        # client for daemon
        bus = dbus.SessionBus(private = True)
        daemon_client = bus.get_object('org.liloman.pomodoro', "/daemon")
        self.interface = dbus.Interface(daemon_client, "org.liloman.pomodoroInterface") 
开发者ID:liloman,项目名称:pomodoroTasks2,代码行数:15,代码来源:systray.py

示例6: _on_icon_popup

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import StatusIcon [as 别名]
def _on_icon_popup(self, icon, button, timestamp):
        """ Show the menu on right click on the icon """
        if not self._indicator:
            self._menu.popup(None, None, Gtk.StatusIcon.position_menu,
                             icon, button, timestamp) 
开发者ID:getting-things-gnome,项目名称:gtg,代码行数:7,代码来源:notification_area.py

示例7: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import StatusIcon [as 别名]
def __init__(self):
        self.statusIcon = Gtk.StatusIcon()
        self.statusIcon.set_visible(True)
        self.statusIcon.connect("activate", self.leftclick)
        self.statusIcon.connect('popup-menu', self.icon_clicked) 
开发者ID:ghostbsd,项目名称:networkmgr,代码行数:7,代码来源:trayicon.py

示例8: leftclick

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import StatusIcon [as 别名]
def leftclick(self, status_icon):
        if not self.thr.is_alive():
            self.thr.start()
        button = 1
        time = Gtk.get_current_event_time()
        position = Gtk.StatusIcon.position_menu
        self.nm_menu().popup(None, None, position, status_icon, button, time) 
开发者ID:ghostbsd,项目名称:networkmgr,代码行数:9,代码来源:trayicon.py

示例9: icon_clicked

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import StatusIcon [as 别名]
def icon_clicked(self, status_icon, button, time):
        if not self.thr.is_alive():
            self.thr.start()
        position = Gtk.StatusIcon.position_menu
        self.nm_menu().popup(None, None, position, status_icon, button, time) 
开发者ID:ghostbsd,项目名称:networkmgr,代码行数:7,代码来源:trayicon.py

示例10: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import StatusIcon [as 别名]
def __init__(self, app):
        self._app = app
        self._volume = 0
        self._mute = False
        self._statusicon = Gtk.StatusIcon()
        self._menu = Gtk.Menu()
        self._setup_statusicon()
        self._setup_menu() 
开发者ID:buzz,项目名称:volctl,代码行数:10,代码来源:tray.py

示例11: set

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import StatusIcon [as 别名]
def set(self, icon=None, text=None):
		StatusIcon.set(self, icon, text)
		
		self._get_icon(icon)
		self._get_text(text) 
开发者ID:kozec,项目名称:syncthing-gtk,代码行数:7,代码来源:statusicon.py

示例12: _set_visible

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import StatusIcon [as 别名]
def _set_visible(self, active):
		StatusIcon._set_visible(self, active)
		
		self._tray.set_visible(active) 
开发者ID:kozec,项目名称:syncthing-gtk,代码行数:6,代码来源:statusicon.py

示例13: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import StatusIcon [as 别名]
def __init__(self):
        self.sun_icon = f'{icon_path}{__all__}.png'
        self.status_icon = Gtk.StatusIcon()
        self.status_icon.set_from_file(self.sun_icon)
        self.status_icon.connect('popup-menu', self.right_click_event)
        self.cmd = f'{bin_path}sun_daemon'
        self.init_daemon() 
开发者ID:dslackw,项目名称:sun,代码行数:9,代码来源:status_icon.py

示例14: do_popup_menu_notebooks

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import StatusIcon [as 别名]
def do_popup_menu_notebooks(self, list, button=1, activate_time=0):
		menu = Gtk.Menu()
		self.populate_menu_with_notebooks(menu, list)
		menu.show_all()
		menu.popup(None, None, Gtk.StatusIcon.position_menu, self, button, activate_time) 
开发者ID:zim-desktop-wiki,项目名称:zim-desktop-wiki,代码行数:7,代码来源:trayicon.py

示例15: do_popup_menu

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import StatusIcon [as 别名]
def do_popup_menu(self, button=3, activate_time=0):
		#~ print('>>', button, activate_time)
		menu = self.get_trayicon_menu()
		menu.show_all()
		menu.popup(None, None, Gtk.StatusIcon.position_menu, self, button, activate_time) 
开发者ID:zim-desktop-wiki,项目名称:zim-desktop-wiki,代码行数:7,代码来源:trayicon.py


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