本文整理汇总了Python中pync.Notifier类的典型用法代码示例。如果您正苦于以下问题:Python Notifier类的具体用法?Python Notifier怎么用?Python Notifier使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Notifier类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: search
def search(num_colors, graph):
# Do a depth-first search over the configuration space, keeping a
# stack of assignments and variable domains.
init_cfg = Assignment(num_colors, graph)
stack = [(init_cfg, init_cfg.choose())]
while stack and not stack[-1][0].complete():
cur_var, cur_vals = stack[-1][1]
if not cur_vals:
stack.pop()
else:
# If we still have options with our current stack frame
new_val = cur_vals.pop(0)
new_cfg = stack[-1][0].set(cur_var, new_val)
if new_cfg.propagate():
stack.append((new_cfg, new_cfg.choose()))
if stack and stack[-1][0].complete():
Notifier.notify("Found a solution!",title="GraphColorizer")
return [v[0] for v in stack[-1][0].table]
else:
print "Failed @num_colors=%d" % num_colors
Notifier.notify("Failed @num_colors=%d. :(" % num_colors, title="GraphColorizer")
return search(num_colors+1, graph)
开发者ID:nathanwbrei,项目名称:coloring,代码行数:28,代码来源:brain.py
示例2: main
def main():
parser = optparse.OptionParser()
using_help = '''
the service that you want to use. For example: gist for Github's Gist,
pastebin for PasteBin.com
'''
parser.add_option('-u', '--using', dest='using',
help=using_help)
(options, args) = parser.parse_args()
using = options.using
if not using:
using = 'pastebin'
obj = SharePastesFactory.create(using)
try:
url = obj.api_call(xerox.paste())
xerox.copy(url)
except xerox.base.XclipNotFound:
print 'xclip not found. Install xclip for SharePastes to work.'
sys.exit(1)
try:
from pync import Notifier
Notifier.notify('URL added to your clipboard %s.' % url,
title='SharePastes')
except:
pass
开发者ID:vaidik,项目名称:sharepastes,代码行数:29,代码来源:runner.py
示例3: notification
def notification(num,soup):
tag = soup(id=num)[0]
price = tag.parent.parent(class_="gr")[0].text
rate = tag.parent.parent(class_="bg")[0].text
brand = tag.parent.parent.a.text.encode('utf-8')
value = '%s\t%s' % (price, rate)
Notifier.notify(value.encode('utf-8'),title=brand,group=num, remove=num, sound='Glass')
开发者ID:raymondyan,项目名称:jijin,代码行数:7,代码来源:value.py
示例4: notify
def notify(data, buffer, date, tags, displayed, highlight, prefix, message):
if weechat.config_get_plugin('show_highlights') == 'on' and highlight == '1':
channel = weechat.buffer_get_string(buffer, 'localvar_channel')
Notifier.notify(message, title='%s %s' % (prefix, channel))
elif weechat.config_get_plugin('show_private_message') == 'on' and 'notify_private' in tags:
Notifier.notify(message, title='%s [private]' % prefix)
return weechat.WEECHAT_RC_OK
开发者ID:frumiousbandersnatch,项目名称:weechat-scripts,代码行数:7,代码来源:notification_center.py
示例5: finalize
def finalize(self, result):
failures = len(result.failures)
errors = len(result.errors)
folder = result.config.workingDir.strip('/').split('/')[-1]
if result.wasSuccessful():
title = "Tests passed in: %s" % folder
msg = '%s All of your %s test(s) passed!' % (
self.success_msg,
result.testsRun,
)
else:
msg = '%s %s failures, %s errors from %s tests' % (
self.failure_msg,
failures,
errors,
result.testsRun,
)
title = "Tests failed in: %s" % folder
Notifier.notify(
msg,
title=title,
group='%s_%s_tests' % (folder, self.name),
)
开发者ID:dreynolds,项目名称:nose-notification-centre,代码行数:25,代码来源:ncplugin.py
示例6: notify
def notify(showfeed):
try:
for feed in showfeed:
content = feed['content']
retext = re.sub(ur'<.*?>', '', content, 0)
keyword = re.compile(ur'常客说|李凯|young|水洋|协议|转让', re.M)
if re.search(keyword, retext) == None:
notice = ''
else:
notice = ' ' + '⚠️' + '注意'
if feed['userinfo']['ext_info']['special_description'] == '':
description = ''
else:
description = ' ' + '
|
请发表评论