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


Python Notifier.notify方法代码示例

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


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

示例1: search

# 需要导入模块: from pync import Notifier [as 别名]
# 或者: from pync.Notifier import notify [as 别名]
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,代码行数:30,代码来源:brain.py

示例2: main

# 需要导入模块: from pync import Notifier [as 别名]
# 或者: from pync.Notifier import notify [as 别名]
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,代码行数:31,代码来源:runner.py

示例3: notification

# 需要导入模块: from pync import Notifier [as 别名]
# 或者: from pync.Notifier import notify [as 别名]
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,代码行数:9,代码来源:value.py

示例4: notify

# 需要导入模块: from pync import Notifier [as 别名]
# 或者: from pync.Notifier import notify [as 别名]
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,代码行数:9,代码来源:notification_center.py

示例5: finalize

# 需要导入模块: from pync import Notifier [as 别名]
# 或者: from pync.Notifier import notify [as 别名]
    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,代码行数:27,代码来源:ncplugin.py

示例6: notify

# 需要导入模块: from pync import Notifier [as 别名]
# 或者: from pync.Notifier import notify [as 别名]
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 = '    ' + '🏁' + \
                    feed['userinfo']['ext_info']['special_description']
            title = feed['userinfo']['nickname'] + notice + description
            try:
                contentImage = feed['images'][0]
            except:
                contentImage = ''
            appicon = feed['userinfo']['ext_info']['avatar']
            feedurl = 'https://cms.changker.com/index.php?r=weibo/view&id=' + str(feed['id'])
            Notifier.notify(retext, title=title, sound='default',
                            appIcon=appicon, open=feedurl, contentImage=contentImage)
            time.sleep(6)
    except:
        Notifier.notify(
            '请重新启动新内容推送', title='注意!线上数据获取不成功!', sound='default', appIcon=appicon)
开发者ID:libukai,项目名称:OPscripts,代码行数:30,代码来源:notify.py

示例7: get_live_score

# 需要导入模块: from pync import Notifier [as 别名]
# 或者: from pync.Notifier import notify [as 别名]
 def get_live_score(self):
     """ show live notification score """
     while True:
         if self.score():
             score = self.score()
             Notifier.notify(score, title=self.match_title)
             time.sleep(self.delay)            
开发者ID:mushfiq,项目名称:cricket-notifier,代码行数:9,代码来源:c_live.py

示例8: makeTweet

# 需要导入模块: from pync import Notifier [as 别名]
# 或者: from pync.Notifier import notify [as 别名]
def makeTweet(author, url):
    code = requests.get(url)
    text = code.text
    soup = BeautifulSoup(text)

    title = soup.findAll(attrs={'name' : 'twitter:title'})[1].get('content')

    twitterHandle = ''
    twitterUser = ''
    twitterUrl = ''

    if soup.findAll(attrs={'name' : 'twitter:creator'}):
        twitterHandle = soup.findAll(attrs={'name' : 'twitter:creator'})[0].get('content')

        twitterUser = twitterHandle

        if 'http://twitter.com/' in twitterHandle:
            twitterUser = twitterHandle.replace("http://twitter.com/", "")
        elif 'https://twitter.com/' in twitterHandle:
            twitterUser = twitterHandle.replace("https://twitter.com/", "")
        elif 'http://www.twitter.com/' in twitterHandle:
            twitterUser = twitterHandle.replace("http://www.twitter.com/", "")
        elif 'https://www.twitter.com/' in twitterHandle:
            twitterUser = twitterHandle.replace("https://www.twitter.com/", "")

        twitterUser = twitterUser.replace("@", "")

        twitterUrl = ' - (http://twitter.com/' + twitterUser + ')'

    tweet = prepareTweet(title, author, twitterUser, url)

    print(time.strftime("%m/%d/%Y %I:%M %p") + '\n' + title + ' by ' + author + twitterUrl + '\nLD Entry Page: ' + url)
    Notifier.notify(title + ' by ' + author + twitterHandle, contentImage='img.jpg', appIcon='pp.png', title='@LDJAMBot', open='http://twitter.com/ldjambot')
    
    return tweet
开发者ID:AlfonzM,项目名称:ldjambot,代码行数:37,代码来源:test.py

示例9: compare_values

# 需要导入模块: from pync import Notifier [as 别名]
# 或者: from pync.Notifier import notify [as 别名]
	def compare_values(self,flag):
		current=datetime.datetime.now()
		count=0
		for row in c.execute('SELECT * FROM battery'):
			count=count+1
		if count==0:
			Notifier.notify("No values to compare")
			return
		direct_output = subprocess.check_output('pmset -g batt', shell=True)
		(b,d)=direct_output.split('%')
		(d,percentage)=b.split('InternalBattery-0\t')
		if flag==1:
			c.execute("INSERT INTO battery VALUES(?,? ,?)",(count+1,str(current),percentage))
			conn.commit()
		raw=c.execute("SELECT date,status FROM  battery WHERE  sl=?",(str(count)))
		for i in raw:
			print ''
		that_time=str(i[0])
		that_time=datetime.datetime.strptime(that_time, "%Y-%m-%d %H:%M:%S.%f")
		that_percentage=i[1]
		direct_output = subprocess.check_output('pmset -g batt', shell=True)
		(b,d)=direct_output.split('%')
		(d,percentage)=b.split('InternalBattery-0\t')
		difference_in_percentage=int(percentage)-int(that_percentage)
		difference_in_time=current-that_time
		difference_in_time=str(difference_in_time)
		Notifier.notify("Difference in battery percentage = {}\nDifference in time = {}".format(difference_in_percentage, difference_in_time))
开发者ID:varunvd,项目名称:iBatteryAnalyzer,代码行数:29,代码来源:battery.py

示例10: notify

# 需要导入模块: from pync import Notifier [as 别名]
# 或者: from pync.Notifier import notify [as 别名]
def notify(message):
    Notifier.notify(
        title="Irssi Notification",
        message=message,
        group=os.getpid(),
        activate='com.googlecode.iterm2'
    )
开发者ID:carlsverre,项目名称:rcfiles,代码行数:9,代码来源:irssi_remote_notifier.py

示例11: main

# 需要导入模块: from pync import Notifier [as 别名]
# 或者: from pync.Notifier import notify [as 别名]
def main():

    def sigterm_handler(_signo, _stack_frame):
        try:
            Notifier.notify('Unregistering fs watch', title='LittleHelp', subtitle=project_path)
        except:
            pass
        logging.info("Sigterm handler called")
        observer.unschedule(stream)
        observer.stop()
        observer.join()
        try:
            Notifier.notify('Unregistered fs watch', title='LittleHelp', subtitle=project_path)
        except:
            pass
        sys.exit(0)

    try:
        Notifier.notify('Registering watch', title='LittleHelp', subtitle=project_path)
        observer = Observer()
        stream = Stream(file_event_callback, project_path, file_events=True)
        observer.schedule(stream)
        observer.start()

        signal.signal(signal.SIGTERM, sigterm_handler)

        while True:
            sleep(0.1)
    except:
        logging.exception("Unhandled exception")
开发者ID:rasathus,项目名称:littlehelp,代码行数:32,代码来源:littlehelp.py

示例12: term_notifier

# 需要导入模块: from pync import Notifier [as 别名]
# 或者: from pync.Notifier import notify [as 别名]
def term_notifier(new_event):
    new_event = new_event
    filename = os.path.split(new_event)[1]
    
    # Notifier.notify('Hello World', title = 'New file received')
    Notifier.notify('New file from', title = filename, open="open, -R, "+str(new_event))
    print 'Did something'
开发者ID:hobesh,项目名称:sandwichvideo,代码行数:9,代码来源:link_receiver.py

示例13: main

# 需要导入模块: from pync import Notifier [as 别名]
# 或者: from pync.Notifier import notify [as 别名]
def main():
    
    
    if (Time < StartTime or EndTime < Time):
        return
    
    opacity = 1.0 if Time == StartTime else Opacity
    frame = Time.GetFrame(24) if IsRendering else -1
    
    osc.initOSCClient(port=1234)
    osc.sendOSCMsg("/update", [frame, Speed / 100, opacity, Threshold, Offset, Suffix])
    
    if IsRendering:
        if Time == StartTime:
            "Start Rendering~~~~~~~~~"
            
        print "Rendering %d" % frame
        
        if EndTime == Time:
            doc.SearchObject("====OSC===")[c4d.ID_USERDATA,8] = False
            print "END!!"
            Notifier.notify("END!!!")
    
    if osc.server == 0:
        print "init osc server"
        osc.initOSCServer(port=4321)
        osc.startOSCServer()
    
    osc.setOSCHandler(address="/save-frame", hd=onSaved)
    
开发者ID:baku89,项目名称:ATA,代码行数:31,代码来源:send-message.py

示例14: mac_notify

# 需要导入模块: from pync import Notifier [as 别名]
# 或者: from pync.Notifier import notify [as 别名]
    def mac_notify(self, title, message, config):
        config = self.prepare_config(config)
        try:
            from pync import Notifier
        except ImportError as e:
            log.debug('Error importing pync: %s', e)
            raise DependencyError(plugin_name, 'pync', 'pync module required. ImportError: %s' % e)

        icon_path = None
        try:
            import flexget.ui

            icon_path = os.path.join(flexget.ui.__path__[0], 'src', 'favicon.ico')
        except Exception as e:
            log.debug('Error trying to get flexget icon from webui folder: %s', e)

        try:
            Notifier.notify(
                message,
                subtitle=title,
                title='FlexGet Notification',
                appIcon=icon_path,
                timeout=config['timeout'],
                open=config.get('url'),
            )
        except Exception as e:
            raise PluginWarning('Cannot send a notification: %s' % e)
开发者ID:Flexget,项目名称:Flexget,代码行数:29,代码来源:toast.py

示例15: notify

# 需要导入模块: from pync import Notifier [as 别名]
# 或者: from pync.Notifier import notify [as 别名]
def notify(title, message):
	if hexchat.get_prefs('away_omit_alerts') and hexchat.get_info('away'):
		return

	if hexchat.get_prefs('gui_focus_omitalerts') and hexchat.get_info('win_status') == 'active':
		return
	
	Notifier.notify(hexchat.strip(message), title=hexchat.strip(title), sender='org.hexchat', sound='default')
开发者ID:BFCatalin,项目名称:plugins,代码行数:10,代码来源:notificationcenter.py


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