本文整理汇总了Python中pynotify.get_server_caps函数的典型用法代码示例。如果您正苦于以下问题:Python get_server_caps函数的具体用法?Python get_server_caps怎么用?Python get_server_caps使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_server_caps函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __new__
def __new__(cls, *a, **k):
if cls is Indicator:
import pynotify
capabilities = set(pynotify.get_server_caps())
if set(REQUIRED_CAPABILITIES).issubset(capabilities):
cls = PyNotifyIndicator
else:
try:
import appindicator
except ImportError:
raise NoSuitableImplementation("the `appindicator` module was not found (try installing python-appindicator?)\n"
"And your notification server lacks the required capabilities for this program.\n"
"I need: %r\nbut you only have: %r" % (REQUIRED_CAPABILITIES, tuple(pynotify.get_server_caps())))
cls = AppIndicator
return super(Indicator, cls).__new__(cls)
开发者ID:pombredanne,项目名称:indicate-task,代码行数:15,代码来源:indicate.py
示例2: initCaps
def initCaps ():
caps = pynotify.get_server_caps ()
if caps is None:
print "Failed to receive server caps."
sys.exit()
for cap in caps:
capabilities[cap] = True
开发者ID:scythargon,项目名称:mad-skillz,代码行数:7,代码来源:u_notify1.py
示例3: __init__
def __init__(self):
self.conf_dlg = None
self.conf = {}
self.load_conf()
self.TIMER_ID=None
self.first_update=True
self.about_dlg = AboutDLG()
self.statusicon = gtk.StatusIcon()
self.statusicon.set_visible(False)
self.statusicon.connect('popup-menu',self.popup_cb)
self.statusicon.set_title(_("Liber DNS Update"))
#self.statusicon.set_tooltip(_("liberdns Update"))
#self.statusicon.set_from_file(os.path.join('/home/ehab/oj/liberdns','liberdns.svg'))
self.statusicon.set_from_icon_name('liberdns')
self.statusicon.set_visible(True)
pynotify.init('Liber DNS Update')
self.notifycaps = pynotify.get_server_caps ()
self.notify=pynotify.Notification(_("Liber DNS Update"))
self.notify.set_property('icon-name', 'liberdns')
self.notify.set_property('summary', _("Liber DNS Update....") )
self.notify.set_hint('resident', True)
self.notify.set_timeout(5000)
#notify.set_hint('transient', True)
self.init_menu()
self.start_timer_cb()
开发者ID:ehabsas,项目名称:LiberDNSApplet,代码行数:25,代码来源:liberdns.py
示例4: __init__
def __init__(self, specto, notifier):
global notifyInitialized
self.specto = specto
self.notifier = notifier
if not notifyInitialized:
pynotify.init(self._notifyRealm)
notifyInitialized = True
# Check the features available from the notification daemon
self.capabilities = {'actions': False,
'body': False,
'body-hyperlinks': False,
'body-images': False,
'body-markup': False,
'icon-multi': False,
'icon-static': False,
'sound': False,
'image/svg+xml': False,
'append': False}
caps = pynotify.get_server_caps()
if caps is None:
print "Failed to receive server caps."
sys.exit(1)
for cap in caps:
self.capabilities[cap] = True
开发者ID:Pi03k,项目名称:py3specto,代码行数:26,代码来源:balloons.py
示例5: initCaps
def initCaps():
caps = pynotify.get_server_caps()
if caps is None:
sys.exit(1)
for cap in caps:
capabilities[cap] = True
开发者ID:agaurav,项目名称:dotstuff,代码行数:7,代码来源:OSD-notifier.py
示例6: __init__
def __init__ (self, replace):
pynotify.init("ibus")
self.__bus = ibus.Bus()
self.__bus.connect("disconnected", gtk.main_quit)
self.__bus.connect("registry-changed", self.__registry_changed_cb)
match_rule = "type='signal',\
sender='org.freedesktop.IBus',\
path='/org/freedesktop/IBus'"
self.__bus.add_match(match_rule)
self.__panel = panel.Panel(self.__bus)
flag = ibus.BUS_NAME_FLAG_ALLOW_REPLACEMENT
if replace:
flag = flag | ibus.BUS_NAME_FLAG_REPLACE_EXISTING
self.__bus.request_name(ibus.IBUS_SERVICE_PANEL, flag)
self.__bus.get_dbusconn().add_signal_receiver(self.__name_acquired_cb,
signal_name="NameAcquired")
self.__bus.get_dbusconn().add_signal_receiver(self.__name_lost_cb,
signal_name="NameLost")
self.__notify = pynotify.Notification("IBus", \
_("Some input methods have been installed, removed or updated. " \
"Please restart ibus input platform."), \
"ibus")
self.__notify.set_timeout(10 * 1000)
if "actions" in pynotify.get_server_caps():
self.__notify.add_action("restart", _("Restart Now"), self.__restart_cb, None)
self.__notify.add_action("ignore", _("Later"), lambda *args: None, None)
开发者ID:thnguyn2,项目名称:ECE_527_MP,代码行数:28,代码来源:main.py
示例7: _init_pynotify
def _init_pynotify(self):
logging.info('Configuring pynotify')
try:
import pynotify
pynotify.init('Watson')
assert pynotify.get_server_caps() is not None
except ImportError:
logging.error('pynotify not found; notifications disabled')
开发者ID:B-Rich,项目名称:watson-ci,代码行数:8,代码来源:core.py
示例8: init_pynotify
def init_pynotify():
caps = pynotify.get_server_caps()
if not caps:
print "Failed to receive server caps."
sys.exit(True)
for cap in caps:
capabilities[cap] = True
开发者ID:jushadi,项目名称:RDM630-RFID-Reader,代码行数:8,代码来源:gnome-notification.py
示例9: initCaps
def initCaps ():
caps = pynotify.get_server_caps ()
if caps is None:
print "Failed to receive server caps."
return False
for cap in caps:
capabilities[cap] = True
return True
开发者ID:alrock,项目名称:ubuntu-quick-translator,代码行数:9,代码来源:translator.py
示例10: notify_str
def notify_str(self):
"""Calculate trigger date for contact.
:rtype: `str`
:return: Stylised name for use with notifications
"""
if "body-hyperlinks" in pynotify.get_server_caps():
name = "<a href='mailto:%s'>%s</a>" % (self.addresses[0], self.name)
else:
name = self.name
return name
开发者ID:JNRowe,项目名称:blanco,代码行数:11,代码来源:__init__.py
示例11: initCaps
def initCaps ():
caps = pynotify.get_server_caps ()
if caps and 'actions' in caps:
#Adds "Previous" and "Next" buttons in the notification if allowed.
notification.add_action("previous", "Previous", Prev)
notification.add_action("next", "Next", Next)
if caps is None:
print "Failed to receive server caps."
sys.exit (1)
for cap in caps:
capabilities[cap] = True
开发者ID:scythargon,项目名称:mad-skillz,代码行数:12,代码来源:u_notify4.py
示例12: __init__
def __init__ (self):
sushi.Plugin.__init__(self, "notify")
pynotify.init("tekka")
self.caps = pynotify.get_server_caps()
try:
self.pixbuf = gtk.icon_theme_get_default().load_icon("tekka",64,0)
except:
self.pixbuf = None
# FIXME
self.connect_signal("message", self.message_cb)
self.connect_signal("action", self.action_cb)
开发者ID:sushi-irc,项目名称:tekka,代码行数:15,代码来源:notify.py
示例13: __init__
def __init__(self):
gobject.set_prgname(CONFIGURATION.get("name"))
gobject.set_application_name("Internet Enabler")
pynotify.init(CONFIGURATION.get("name"))
self.notifications_show_actions = 'actions' in pynotify.get_server_caps()
self.online = False
self._create_gui()
self.nm = NetworkListener()
self.nm.connect("online", lambda x: self.authenticate("Enable"))
if self.nm.online:
delay_ms = int(CONFIGURATION.get("delay_ms"))
if delay_ms >= 0:
gobject.timeout_add(delay_ms,self.authenticate,"Enable")
开发者ID:nzjrs,项目名称:ienabler,代码行数:15,代码来源:ienabler-gui.py
示例14: printCaps
def printCaps ():
info = pynotify.get_server_info ()
print "Name: " + info["name"]
print "Vendor: " + info["vendor"]
print "Version: " + info["version"]
print "Spec. Version: " + info["spec-version"]
caps = pynotify.get_server_caps ()
if caps is None:
print "Failed to receive server caps."
sys.exit (1)
print "Supported capabilities/hints:"
if capabilities['actions']:
print "\tactions"
if capabilities['body']:
print "\tbody"
if capabilities['body-hyperlinks']:
print "\tbody-hyperlinks"
if capabilities['body-images']:
print "\tbody-images"
if capabilities['body-markup']:
print "\tbody-markup"
if capabilities['icon-multi']:
print "\ticon-multi"
if capabilities['icon-static']:
print "\ticon-static"
if capabilities['sound']:
print "\tsound"
if capabilities['image/svg+xml']:
print "\timage/svg+xml"
if capabilities['x-canonical-private-synchronous']:
print "\tx-canonical-private-synchronous"
if capabilities['x-canonical-append']:
print "\tx-canonical-append"
if capabilities['x-canonical-private-icon-only']:
print "\tx-canonical-private-icon-only"
if capabilities['x-canonical-truncation']:
print "\tx-canonical-truncation"
print "Notes:"
if info["name"] == "notify-osd":
print "\tx- and y-coordinates hints are ignored"
print "\texpire-timeout is ignored"
print "\tbody-markup is accepted but filtered"
else:
print "\tnone"
开发者ID:am0c,项目名称:notifyosd-lucid,代码行数:47,代码来源:update-notifications.py
示例15: show
def show(self):
"""Displays a notification for icecat.
Adds actions open and opendir if available
"""
caps = pynotify.get_server_caps()
if caps is None:
raise GalagoNotRunningException
body = BODY % {'title': self.title,
'location': self.location}
self.notif = pynotify.Notification(SUMMARY,
body,
get_icon(),
)
self.notif.connect('closed', self._cleanup)
self.notif.set_hint_string("category", "transfer.complete")
# Note: This won't work until we get the pynotify instance to be
# static through calls
self.notif.set_hint_string("x-canonical-append", "allowed")
if 'actions' in caps:
try:
call([OPEN_COMMAND, '--version'])
except OSError:
LOG.warn(_("xdg-open was not found"))
xdg_exists = False
else:
xdg_exists = True
self.notif.add_action("open",
_("Open"),
self.open_file)
self.notif.add_action("opendir",
_("Open Directory"),
self.open_directory)
else:
xdg_exists = False
LOG.info(_("Displaying notification"))
if not self.notif.show():
raise GalagoNotRunningException(_("Could not display notification"))
if xdg_exists:
gtk.main()
开发者ID:HackerWolf,项目名称:icecat-notify,代码行数:44,代码来源:download_complete_notify.py
示例16: initCaps
def initCaps ():
capabilities = {'actions': False,
'body': False,
'body-hyperlinks': False,
'body-images': False,
'body-markup': False,
'icon-multi': False,
'icon-static': False,
'sound': False,
'image/svg+xml': False,
'private-synchronous': False,
'append': False,
'private-icon-only': False}
caps = pynotify.get_server_caps ()
if caps is None:
print "Failed to receive server caps."
gtk.main_quit()
for cap in caps:
capabilities[cap] = True
开发者ID:danners,项目名称:Quick-radio,代码行数:19,代码来源:radio.py
示例17: __init__
def __init__(self):
self.lib_path = os.path.join(os.path.dirname(__file__)) ## get libfacebooknotify path
self.config = ConfigParser.SafeConfigParser()
self.config.optionxform = str ## dont save as lowercase !!!!
self.config.read(self.lib_path + '/config.cfg')
self.HISTORY_MAX = int(self.config.get('MY_CONFIG', 'HISTORY_MAX'))
self.SECONDS_UPDATE_FREQ = int(self.config.get('MY_CONFIG', 'SECONDS_UPDATE_FREQ'))
self.LOGIN_HIGHT = int(self.config.get('MY_CONFIG', 'LOGIN_HIGHT'))
self.LOGIN_WIDTH = int(self.config.get('MY_CONFIG', 'LOGIN_WIDTH'))
pynotify.init(APP_NAME)
self.indicator = indicate.Indicator()
self.indicator.set_property("subtype", "im")
self.indicator.connect("user-display", self.mmClicked)
self.indicator.set_property("draw-attention", "true")
self._create_gui()
self._fbcm = FacebookCommunicationManager()
self._fbcm.start()
self._sb = SimpleBrowser()
self._sb.connect("delete-event", self._login_window_closed)
self._uid = None
self._tried_permissions = False
self._friends = []
self._friend_index = {}
self._first_friends_query = True
self._notifications = {}
self._notifications_first_query = True
self._notifications_show_actions = 'actions' in pynotify.get_server_caps()
self._notificationslist = {}
self._notifications_lasttime = 0
self._album_index = {}
self._first_album_query = True
self._state = 0
gobject.timeout_add_seconds(2, self._login_start)
开发者ID:codex-corp,项目名称:facebook-notify,代码行数:42,代码来源:ui.py
示例18: __init__
def __init__(self):
pynotify.init(self.APP_NAME)
self._create_gui()
self._fbcm = FacebookCommunicationManager()
self._fbcm.start()
self._sb = SimpleBrowser()
self._sb.connect("delete-event", self._login_window_closed)
self._uid = None
self._friends = []
self._friend_index = {}
self._first_friends_query = True
self._notifications = {}
self._notifications_first_query = True
self._notifications_show_actions = 'actions' in pynotify.get_server_caps()
self._album_index = {}
self._first_album_query = True
self._state = 0
gobject.timeout_add_seconds(2, self._login_start)
开发者ID:NigelCunningham,项目名称:facebook-notify,代码行数:20,代码来源:facebook-notify.py
示例19: configure
def configure(self, parent):
""" Show the configuration window """
if self.cfgWin is None:
import pynotify
self.cfgWin = gui.window.Window('DesktopNotification.glade', 'vbox1', __name__, MOD_L10N, 355, 345)
self.cfgWin.getWidget('btn-ok').connect('clicked', self.onBtnOk)
self.cfgWin.getWidget('btn-help').connect('clicked', self.onBtnHelp)
self.cfgWin.getWidget('btn-cancel').connect('clicked', lambda btn: self.cfgWin.hide())
if 'actions' not in pynotify.get_server_caps():
self.cfgWin.getWidget('chk-skipTrack').set_sensitive(False)
if not self.cfgWin.isVisible():
self.cfgWin.getWidget('txt-title').set_text(prefs.get(__name__, 'title', PREFS_DEFAULT_TITLE))
self.cfgWin.getWidget('spn-duration').set_value(prefs.get(__name__, 'timeout', PREFS_DEFAULT_TIMEOUT))
self.cfgWin.getWidget('txt-body').get_buffer().set_text(prefs.get(__name__, 'body', PREFS_DEFAULT_BODY))
self.cfgWin.getWidget('chk-skipTrack').set_active(prefs.get(__name__, 'skip-track', PREFS_DEFAULT_SKIP_TRACK))
self.cfgWin.getWidget('btn-ok').grab_focus()
self.cfgWin.show()
开发者ID:gabrielmcf,项目名称:biel-audio-player,代码行数:21,代码来源:DesktopNotification.py
示例20: notify
def notify(title, text, icon = None, timeout = None, iconsize = 48):
if icon is None:
icon = resources.get_ui_asset("gwibber.svg")
caps = pynotify.get_server_caps()
notification = pynotify.Notification(title, text)
try:
pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(icon, iconsize, iconsize)
notification.set_icon_from_pixbuf(pixbuf)
except glib.GError as e:
log.logger.error("Avatar failure - %s - %s", icon, e.message)
resources.del_avatar(icon)
if timeout:
notification.set_timeout(timeout)
if "x-canonical-append" in caps:
notification.set_hint('x-canonical-append', 'allowed')
return notification.show()
开发者ID:SMIDEC,项目名称:gwibber-lc,代码行数:22,代码来源:__init__.py
注:本文中的pynotify.get_server_caps函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论