• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python notifier.Notifier类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: run

def run (repository):
    n = Notifier( title=NOTIFIER_TITLE )
    n.message( message=( "committer::run( '%s' )" % repository ) )

    # - create a lock file
    file_lock = open( Config.PATH_TETHERBALL_COMMIT, 'w' )
    file_lock.write( str( os.getpid() ) )
    file_lock.close()

    # timeout
    time.sleep( SEC_SLEEP )
    try:
        str_last = subprocess.check_output( COMMAND, shell=True )
        ms_now = int( time.time() * 1000 )

        if str_last != '':
            ms_last = int( str_last.strip() )
        else:
            ms_last = ms_now - int(SEC_SLEEP * 1000) - 1

        if (ms_now - ms_last) > (SEC_SLEEP * 1000):
            _run_main(repository)
        else:
            run(repository)
    except Exception, e:
        l = Logger(Config)
        l.debug( 'Failed on committer.py: %s' % e)
开发者ID:beatak,项目名称:tetherball,代码行数:27,代码来源:committer.py


示例2: notify

def notify(jobid, ntypes):
    log.debug("ntypes in notify is {}".format(ntypes))
    for ntype in ntypes:
        log.info("Putting result into notifier queue:{} \
                with addr:{}".format(ntype["ntype"], ntype["naddr"]))

        notifier = Notifier(config.redisserver, ntype["ntype"])
        notifier.notify(jobid, ntype["naddr"])
开发者ID:Pripman,项目名称:Python_Bachelor_Example,代码行数:8,代码来源:verifyjob.py


示例3: main

def main():
    config_json = json.load(codecs.open("config_release.json", "r", encoding="UTF-8"))
    db_config = config_json["database"]
    smtp_config = config_json["smtp"]
    santa_config = config_json["santa"]

    postgres = PostgresInjection(db_config)

    with Shuffler(postgres, santa_config) as shuffler:
        shuffler.work()

    notifier = Notifier(postgres, smtp_config, santa_config)
    notifier.notify_unawared()
开发者ID:debalid,项目名称:staysanta-shuffler,代码行数:13,代码来源:boot.py


示例4: update_view

	def update_view(manufacturers):
		list_store = gtk.ListStore(gtk.gdk.Pixbuf, str, str)
		list_store.set_sort_column_id(1, gtk.SORT_ASCENDING)
		game_count = 0

		for manufacturer in manufacturers:
			for device in manufacturer.get_devices():
				for folder in device.get_folders():
					for game in folder.get_games():
						list_store.append([CoverLoader.load(util.ApplicationManager.get_path(), manufacturer, device, game, 184, 256), game.get_name(), folder.get_path()])
						game_count += 1

		CoverViewManager._icon_view.set_model(list_store)
		Notifier.create_info_notification("Search Result", "{0} media{1} found".format(game_count, "" if game_count == 1 else "s"))
开发者ID:fwannmacher,项目名称:game-cataloger,代码行数:14,代码来源:cover_view_manager.py


示例5: __init__

 def __init__(self, mic, profile, logger):
     self.persona = profile['persona']
     self.mic = mic
     self.profile = profile
     self.brain = Brain(mic, profile, logger)
     self.notifier = Notifier(profile, logger)
     self.logger = logger
开发者ID:HubertReX,项目名称:jasper-client,代码行数:7,代码来源:conversation.py


示例6: __init__

 def __init__(self, parent = None, settings_path = ""):
     super(zcswebapp, self).__init__(parent)
     self.setWindowTitle('zcswebapp')
     self.settings_path = settings_path
     self.notifier = Notifier(Resources.APP_NAME, Resources.get_path('zcswebapp.png'))
     self.settings = QSettings(self.settings_path + '/zcswebapp.cfg', QSettings.IniFormat)
     self.identifier = self.settings.value("Domain")
     if Unity is not None:
         self.launcher = Unity.LauncherEntry.get_for_desktop_id("zcswebapp.desktop")
     else:
         self.launcher = DummyLauncher(self)
     self.webSettings()
     self.leftPane = LeftPane(self)
     webView = Wrapper(self)
     webView.page().networkAccessManager().setCookieJar(self.cookiesjar)
     self.stackedWidget = QtGui.QStackedWidget()
     self.stackedWidget.addWidget(webView)
     centralWidget = QtGui.QWidget(self)
     layout = QtGui.QHBoxLayout()
     layout.setContentsMargins(0, 0, 0, 0)
     layout.setSpacing(0)
     layout.addWidget(self.leftPane)
     layout.addWidget(self.stackedWidget)
     centralWidget.setLayout(layout)
     self.setCentralWidget(centralWidget)
     self.addMenu()
     self.tray = Systray(self)
     self.systray(zcswebapp.minimized)
     self.installEventFilter(self)
     if self.identifier is None:
         webView.load(QtCore.QUrl(Resources.SIGNIN_URL))
     else:
         webView.load(QtCore.QUrl(self.domain()))
     webView.show()
开发者ID:zerlgi,项目名称:zcswebapp,代码行数:34,代码来源:scudcloud.py


示例7: __init__

 def __init__(self, persona, mic, profile):
     self._logger = logging.getLogger(__name__)
     self.persona = persona
     self.mic = mic
     self.profile = profile
     self.brain = Brain(mic, profile)
     self.notifier = Notifier(profile)
开发者ID:JeremieSamson,项目名称:jasper,代码行数:7,代码来源:conversation.py


示例8: __init__

	def __init__(self,conn):
		
		WADebug.attach(self);
		self.conn = conn;
		super(WAEventHandler,self).__init__();
		
		self.notifier = Notifier();
		self.connMonitor = ConnMonitor();
		
		self.connMonitor.connected.connect(self.networkAvailable);
		self.connMonitor.disconnected.connect(self.networkDisconnected);
		
		

		
		#self.connMonitor.sleeping.connect(self.networkUnavailable);
		#self.connMonitor.checked.connect(self.checkConnection);
		
		self.mediaHandlers = []
		self.sendTyping.connect(self.conn.sendTyping);
		self.sendPaused.connect(self.conn.sendPaused);
		self.getLastOnline.connect(self.conn.getLastOnline);
		
		self.connected.connect(self.conn.resendUnsent);
		
		self.pingTimer = QTimer();
		self.pingTimer.timeout.connect(self.sendPing)
		self.pingTimer.start(180000);
开发者ID:airlanggacahya,项目名称:wazapp,代码行数:28,代码来源:waxmpp.py


示例9: Conversation

class Conversation(object):

    def __init__(self, persona, speaker, profile):
        self.persona = persona
        self.speaker = speaker
        self.profile = profile
        self.notifier = Notifier(profile)
        self.brain = Brain(speaker, profile)

    def handleForever(self):

        while True:

            notifications = self.notifier.getAllNotifications()
            for notif in notifications:
                self.speaker.say(notif)

            threshold, transcribed = self.speaker.passiveListen(self.persona)
            if not threshold or not transcribed:
                continue

            input = self.speaker.activeListenToAllOptions(threshold)

            if input:
                self.brain.query(self.profile, transcribed)
开发者ID:saarthaks,项目名称:just-another-AI,代码行数:25,代码来源:conversation.py


示例10: test_notify

def test_notify():
    ntype1 = str(uuid.uuid1())
    ntype2 = str(uuid.uuid1())

    ntypes = [{"ntype": ntype1, "naddr": "127.0.0.1"}, {"ntype": ntype2, "naddr": "[email protected]"}]

    notifier1 = Notifier(config.redisserver, ntype1)
    notifier2 = Notifier(config.redisserver, ntype2)

    notify("test-id", ntypes)

    jid, data = notifier1.get()
    assert data == "127.0.0.1"

    jid, data = notifier2.get()
    assert data == "[email protected]"
开发者ID:Pripman,项目名称:Python_Bachelor_Example,代码行数:16,代码来源:test_notify.py


示例11: __init__

 def __init__(self, parent = None, settings_path = ""):
     super(ScudCloud, self).__init__(parent)
     self.setWindowTitle('ScudCloud')
     self.settings_path = settings_path
     self.notifier = Notifier(Resources.APP_NAME, Resources.get_path('scudcloud.png'))
     self.settings = QSettings(self.settings_path + '/scudcloud.cfg', QSettings.IniFormat)
     self.identifier = self.settings.value("Domain")
     if Unity is not None:
         self.launcher = Unity.LauncherEntry.get_for_desktop_id("scudcloud.desktop")
     else:
         self.launcher = DummyLauncher(self)
     self.webSettings()
     self.leftPane = LeftPane(self)
     self.stackedWidget = QtGui.QStackedWidget()
     centralWidget = QtGui.QWidget(self)
     layout = QtGui.QHBoxLayout()
     layout.setContentsMargins(0, 0, 0, 0)
     layout.setSpacing(0)
     layout.addWidget(self.leftPane)
     layout.addWidget(self.stackedWidget)
     centralWidget.setLayout(layout)
     self.setCentralWidget(centralWidget)
     self.startURL = Resources.SIGNIN_URL
     if self.identifier is not None:
         self.startURL = self.domain()
     self.addWrapper(self.startURL)
     self.addMenu()
     self.tray = Systray(self)
     self.systray(ScudCloud.minimized)
     self.installEventFilter(self)
     self.statusBar().showMessage('Loading Slack...')
开发者ID:mynameisfiber,项目名称:scudcloud,代码行数:31,代码来源:scudcloud.py


示例12: __init__

 def __init__(self, parent=None):
     super(ScudCloud, self).__init__(parent)
     self.setWindowTitle('ScudCloud')
     self.notifier = Notifier(self.APP_NAME, get_resource_path('scudcloud.png'))
     self.settings = QSettings(expanduser("~")+"/.scudcloud", QSettings.IniFormat)
     self.identifier = self.settings.value("Domain")
     if Unity is not None:
         self.launcher = Unity.LauncherEntry.get_for_desktop_id("scudcloud.desktop")
     else:
         self.launcher = DummyLauncher(self)
     self.leftPane = LeftPane(self)
     self.cookiesjar = PersistentCookieJar(self)
     webView = Wrapper(self)
     webView.page().networkAccessManager().setCookieJar(self.cookiesjar)
     self.stackedWidget = QtGui.QStackedWidget()
     self.stackedWidget.addWidget(webView)
     centralWidget = QtGui.QWidget(self)
     layout = QtGui.QHBoxLayout()
     layout.setContentsMargins(0, 0, 0, 0)
     layout.setSpacing(0)
     layout.addWidget(self.leftPane)
     layout.addWidget(self.stackedWidget)
     centralWidget.setLayout(layout)
     self.setCentralWidget(centralWidget)
     self.addMenu()
     self.tray = Systray(self)
     self.systray()
     self.installEventFilter(self)
     self.zoom()
     if self.identifier is None:
         webView.load(QtCore.QUrl(self.SIGNIN_URL))
     else:
         webView.load(QtCore.QUrl(self.domain()))
     webView.show()
开发者ID:ehues,项目名称:scudcloud,代码行数:34,代码来源:scudcloud.py


示例13: __init__

 def __init__(self, persona, mic, profile, house):
     self.persona = persona
     self.mic = mic
     self.profile = profile
     self.brain = Brain(mic, profile, house)
     self.notifier = Notifier(profile, house)
     self.house = house
开发者ID:pyroesque,项目名称:jasper_home_automation,代码行数:7,代码来源:conversation.py


示例14: run

def run (path, repository):
    #imports
    import daemon

    # daemonize
    pid = daemon.createDaemon()

    # spit pid
    try:
        file_pid = open( os.path.join( Config.PATH_TETHERBALL_PROC, repository ), 'w' )
        file_pid.write( str(pid) )
        file_pid.close()
    except Exception, e:
        # l = Logger(Config)
        # l.debug( "Failed to write pid into file: %s" )
        n = Notifier( title=NOTIFIER_TITLE )
        n.message( message=("Failed to write pid into file: %s" % e) )
开发者ID:beatak,项目名称:tetherball,代码行数:17,代码来源:watcher.py


示例15: __init__

 def __init__(self, persona, mic, profile):
     self._logger = logging.getLogger(__name__)
     self.queue = Queue.Queue()
     self.persona = persona
     self.mic = mic
     self.profile = profile
     self.brain = Brain(mic, profile)
     self.notifier = Notifier(profile)
     self.mic.queue = self.queue
     self.listener = Listener(mic, profile, self.queue)
开发者ID:joekinley,项目名称:jasper-client,代码行数:10,代码来源:conversation.py


示例16: __init__

    def __init__(self, name, graph_type):
        """Create a Graph instance

        :type name: str
        :type graph_type: str
        :rtype: Graph
        """
        self.name = name
        self.graph_type = graph_type
        self.root_id = None
        self.notifier = Notifier()
开发者ID:Idandos,项目名称:vitrage,代码行数:11,代码来源:graph.py


示例17: Conversation

class Conversation(object):

    def __init__(self, persona, mic, profile, isPassiveEnabled):
        self._logger = logging.getLogger(__name__)
        self.persona = persona
        self.mic = mic
        self.profile = profile
        self.brain = Brain(mic, profile)
        self.notifier = Notifier(profile)
        self.isPassiveEnabled = isPassiveEnabled

    def handleForever(self):
        """
        Delegates user input to the handling function when activated.
        """
        self._logger.info("Starting to handle conversation with keyword '%s'.",
                          self.persona)
        while True:
            # Print notifications until empty
            notifications = self.notifier.getAllNotifications()
            for notif in notifications:
                self._logger.info("Received notification: '%s'", str(notif))

            self._logger.debug("Started listening for keyword '%s'",
                               self.persona)
            threshold, transcribed, passivePhrases = \
                self.mic.passiveListen(self.persona)
            self._logger.debug("Stopped listening for keyword '%s'",
                               self.persona)

            if not transcribed or not threshold:
                self._logger.info("Nothing has been said or transcribed.")
                continue

            self._logger.info("Keyword '%s' has been said!", self.persona)

            if self.isPassiveEnabled is True and len(passivePhrases) != 0:

                input = passivePhrases
                self._logger.debug("Checking for passive phrase '%s' with " +
                                   "threshold: %r", input, threshold)

            else:

                self._logger.debug("Started to listen actively with " +
                                   "threshold: %r", threshold)
                input = self.mic.activeListenToAllOptions(threshold)
                self._logger.debug("Stopped to listen actively with " +
                                   "threshold: %r", threshold)

            if input:
                self.brain.query(input)
            else:
                self.mic.say("Pardon?")
开发者ID:PLockhart,项目名称:jasper-client,代码行数:54,代码来源:conversation.py


示例18: Conversation

class Conversation(object):

    def __init__(self, persona, mic, profile, house):
        self.persona = persona
        self.mic = mic
        self.profile = profile
        self.brain = Brain(mic, profile, house)
        self.notifier = Notifier(profile, house)
        self.house = house

    def delegateInput(self, text):
        """A wrapper for querying brain."""

        # check if input is meant to start the music module
        if any(x in text.upper() for x in ["SPOTIFY", "MUSIC"]):
            # check if mpd client is running
            try:
                client = MPDClient()
                client.timeout = None
                client.idletimeout = None
                client.connect("localhost", 6600)
            except:
                self.mic.say(
                    "I'm sorry. It seems that Spotify is not enabled. Please read the documentation to learn how to configure Spotify.")
                return

            self.mic.say("Please give me a moment, I'm loading your Spotify playlists.")
            music_mode = MusicMode(self.persona, self.mic)
            music_mode.handleForever()
            return

        self.brain.query(text)

    def handleForever(self):
        """Delegates user input to the handling function when activated."""
        while True:

            # Print notifications until empty
            notifications = self.notifier.getAllNotifications()
            for notif in notifications:
                print notif
                self.mic.say(notif)
            try:
                threshold, transcribed = self.mic.passiveListen(self.persona)
            except:
                continue

            if threshold:
                input = self.mic.activeListen(threshold)
                if input:
                    self.delegateInput(input)
                else:
                    self.mic.say("Pardon?")
开发者ID:pyroesque,项目名称:jasper_home_automation,代码行数:53,代码来源:conversation.py


示例19: main

def main():
  logging.basicConfig(
    filename = 'info.log',
    level    = logging.DEBUG,
    format   = '%(asctime)s - %(levelname)s - %(message)s'
  )

  logging.info('Start')

  # JSON API
  # client     = JsonApi(config.app_id)
  # latest_czk = client.get_latest_usd_to_czk_rate()

  # cnb.cz text file
  client     = CnbTextFile()
  latest_czk = client.get_latest_usd_to_czk_rate()
  # latest_czk = 19.82228 # Debug

  notifier = Notifier(config.email_settings)
  notifier.send(latest_czk)

  logging.info('Finish')
开发者ID:ollie,项目名称:usd-rate-notifier-python,代码行数:22,代码来源:app.py


示例20: Conversation

class Conversation(object):

    def __init__(self, persona, mic, profile):
        self._logger = logging.getLogger(__name__)
        self.persona = persona
        self.mic = mic
        self.profile = profile
        self.brain = Brain(mic, profile)
        self.notifier = Notifier(profile)

    def handleForever(self):
        """
        Delegates user input to the handling function when activated.
        """
        self._logger.info("Starting to handle conversation with keyword '%s'.",
                          self.persona)
        while True:
            # Print notifications until empty
            notifications = self.notifier.getAllNotifications()
            for notif in notifications:
                self._logger.info("Received notification: '%s'", str(notif))

            # Word we listen for to self terminate
            TERMINATE = 'GOODBYE'

            self._logger.debug("Started listening for keyword '%s' or '%s'",
                               self.persona, TERMINATE)
            threshold, transcribed = self.mic.passiveListen(self.persona, TERMINATE)
            self._logger.debug("Stopped listening for keyword '%s' or '%s'",
                               self.persona, TERMINATE)

            if not transcribed or not threshold:
                self._logger.info("Nothing has been said or transcribed.")
                continue
            self._logger.info("Keyword '%s' has been said!", self.persona)

            # Terminate on goodbye
            if transcribed == TERMINATE:
                friendly.goodbye(self.mic, self.profile)
                sys.exit(0)

            self._logger.debug("Started to listen actively with threshold: %r",
                               threshold)
            input = self.mic.activeListenToAllOptions(threshold)
            self._logger.debug("Stopped to listen actively with threshold: %r",
                               threshold)

            if input:
                self.brain.query(input)
            else:
                self.mic.say("Pardon?")
开发者ID:shaggy8871,项目名称:jasper,代码行数:51,代码来源:conversation.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python signal.Signal类代码示例发布时间:2022-05-27
下一篇:
Python models.User类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap