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


Python Notifier.notify方法代码示例

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


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

示例1: notify

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

示例2: __init__

# 需要导入模块: from notifier import Notifier [as 别名]
# 或者: from notifier.Notifier import notify [as 别名]
class NotifyFlow:
  NotifyFlows = [7000, 7500, 8000, 8300]
  def __init__(self):
    self.flowIter = iter(self.NotifyFlows)
    self.notifyFlows = next(self.flowIter)
    self.notifier = Notifier()
    self.needUpdate = True

  def checkAndNotify(self, flow):
    if datetime.now().hour == 0 and self.needUpdate:
      self.flowIter = iter(self.NotifyFlows)
      self.needUpdate = False
      self._nextFlow()
    else:
      self.needUpdate = True
    if flow > self.notifyFlows:
      self.notifier.notify("Notice: Now flow is {0}".format(flow))
      self._nextFlow()

  def _nextFlow(self):
    try:
      self.notifyFlows = next(self.flowIter)
    except StopIteration:
      pass
开发者ID:DanSnow,项目名称:DormFlows,代码行数:26,代码来源:dormflows.py

示例3: zcswebapp

# 需要导入模块: from notifier import Notifier [as 别名]
# 或者: from notifier.Notifier import notify [as 别名]

#.........这里部分代码省略.........
        else:
            webView = Wrapper(self)
            webView.page().networkAccessManager().setCookieJar(self.cookiesjar)
            webView.load(qUrl)
            webView.show()
            self.stackedWidget.addWidget(webView)
            self.stackedWidget.setCurrentWidget(webView)
        self.quicklist(self.current().listChannels())
        self.enableMenus(self.current().isConnected())
        # Save the last used team as default
        self.settings.setValue("Domain", 'https://'+qUrl.host())

    def eventFilter(self, obj, event):
        if event.type() == QtCore.QEvent.ActivationChange and self.isActiveWindow():
            self.focusInEvent(event)
        if event.type() == QtCore.QEvent.KeyPress:
            # Ctrl + <n>
            if QtGui.QApplication.keyboardModifiers() == QtCore.Qt.ControlModifier:
                if event.key() == QtCore.Qt.Key_1:   self.leftPane.click(0)
                elif event.key() == QtCore.Qt.Key_2: self.leftPane.click(1)
                elif event.key() == QtCore.Qt.Key_3: self.leftPane.click(2)
                elif event.key() == QtCore.Qt.Key_4: self.leftPane.click(3)
                elif event.key() == QtCore.Qt.Key_5: self.leftPane.click(4)
                elif event.key() == QtCore.Qt.Key_6: self.leftPane.click(5)
                elif event.key() == QtCore.Qt.Key_7: self.leftPane.click(6)
                elif event.key() == QtCore.Qt.Key_8: self.leftPane.click(7)
                elif event.key() == QtCore.Qt.Key_9: self.leftPane.click(8)
            # Ctrl + Shift + <key>
            if (QtGui.QApplication.keyboardModifiers() & QtCore.Qt.ShiftModifier) and (QtGui.QApplication.keyboardModifiers() & QtCore.Qt.ShiftModifier):
                if event.key() == QtCore.Qt.Key_V: self.current().createSnippet()
        return QtGui.QMainWindow.eventFilter(self, obj, event);

    def focusInEvent(self, event):
        self.launcher.set_property("urgent", False)
        self.tray.stopAlert()

    def titleChanged(self):
        self.setWindowTitle(self.current().title())

    def closeEvent(self, event):
        if not self.forceClose and self.settings.value("Systray") == "True":
            self.hide()
            event.ignore()
        else:
            self.cookiesjar.save()
            self.settings.setValue("geometry", self.saveGeometry())
            self.settings.setValue("windowState", self.saveState())

    def show(self):
        self.setWindowState(self.windowState() & ~QtCore.Qt.WindowMinimized | QtCore.Qt.WindowActive)
        self.activateWindow()
        self.setVisible(True)

    def exit(self):
        self.forceClose = True
        self.close()

    def quicklist(self, channels):
        if Dbusmenu is not None:
            ql = Dbusmenu.Menuitem.new()
            self.launcher.set_property("quicklist", ql)
            if channels is not None:
                for c in channels:
                    if c['is_member']:
                        item = Dbusmenu.Menuitem.new ()
                        item.property_set (Dbusmenu.MENUITEM_PROP_LABEL, "#"+c['name'])
                        item.property_set ("id", c['name'])
                        item.property_set_bool (Dbusmenu.MENUITEM_PROP_VISIBLE, True)
                        item.connect(Dbusmenu.MENUITEM_SIGNAL_ITEM_ACTIVATED, self.current().openChannel)
                        ql.child_append(item)
                self.launcher.set_property("quicklist", ql)

    def notify(self, title, message):
        self.notifier.notify(title, message)
        self.alert()

    def alert(self):
        if not self.isActiveWindow():
            self.launcher.set_property("urgent", True)
            self.tray.alert()

    def count(self):
        total = 0
        for i in range(0, self.stackedWidget.count()):
            widget = self.stackedWidget.widget(i)
            if widget.messages == 0:
                self.leftPane.stopAlert(widget.team())
            else:
                self.leftPane.alert(widget.team())
            total+=widget.messages
        if total > self.messages:
            self.alert()
        if 0 == total:
            self.launcher.set_property("count_visible", False)
            self.tray.setCounter(0)
        else:
            self.tray.setCounter(total)
            self.launcher.set_property("count", total)
            self.launcher.set_property("count_visible", True)
        self.messages = total
开发者ID:zerlgi,项目名称:zcswebapp,代码行数:104,代码来源:scudcloud.py

示例4: ScudCloud

# 需要导入模块: from notifier import Notifier [as 别名]
# 或者: from notifier.Notifier import notify [as 别名]

#.........这里部分代码省略.........
        index = -1
        for i in range(0, self.stackedWidget.count()):
            if self.stackedWidget.widget(i).url().toString().startswith(url):
                index = i
                break
        if index != -1:
            self.stackedWidget.setCurrentIndex(index)
        else:
            webView = Wrapper(self)
            webView.page().networkAccessManager().setCookieJar(self.cookiesjar)
            webView.load(QtCore.QUrl(url))
            webView.show()
            self.stackedWidget.addWidget(webView)
            self.stackedWidget.setCurrentWidget(webView)
        self.quicklist(self.current().listChannels())
        self.enableMenus(self.current().isConnected())

    def eventFilter(self, obj, event):
        if event.type() == QtCore.QEvent.ActivationChange and self.isActiveWindow():
            self.focusInEvent(event)
        if event.type() == QtCore.QEvent.KeyPress and QtGui.QApplication.keyboardModifiers() == QtCore.Qt.ControlModifier:
            if event.key() == QtCore.Qt.Key_1:   self.leftPane.click(0)
            elif event.key() == QtCore.Qt.Key_2: self.leftPane.click(1)
            elif event.key() == QtCore.Qt.Key_3: self.leftPane.click(2)
            elif event.key() == QtCore.Qt.Key_4: self.leftPane.click(3)
            elif event.key() == QtCore.Qt.Key_5: self.leftPane.click(4)
            elif event.key() == QtCore.Qt.Key_6: self.leftPane.click(5)
            elif event.key() == QtCore.Qt.Key_7: self.leftPane.click(6)
            elif event.key() == QtCore.Qt.Key_8: self.leftPane.click(7)
            elif event.key() == QtCore.Qt.Key_9: self.leftPane.click(8)
        return QtGui.QMainWindow.eventFilter(self, obj, event);

    def focusInEvent(self, event):
        self.launcher.set_property("urgent", False)
        self.tray.stopAlert()

    def titleChanged(self):
        self.setWindowTitle(self.current().title())

    def closeEvent(self, event):
        if not self.forceClose and self.settings.value("Systray") == "True":
            self.hide()
            event.ignore()
        else:
            self.cookiesjar.save()
            self.settings.setValue("geometry", self.saveGeometry())
            self.settings.setValue("windowState", self.saveState())

    def show(self):
        self.setWindowState(self.windowState() & ~QtCore.Qt.WindowMinimized | QtCore.Qt.WindowActive)
        self.activateWindow()
        self.setVisible(True)

    def exit(self):
        self.forceClose = True
        self.close()

    def quicklist(self, channels):
        if Dbusmenu is not None:
            ql = Dbusmenu.Menuitem.new()
            self.launcher.set_property("quicklist", ql)
            if channels is not None:
                for c in channels:
                    if c['is_member']:
                        item = Dbusmenu.Menuitem.new ()
                        item.property_set (Dbusmenu.MENUITEM_PROP_LABEL, "#"+c['name'])
                        item.property_set ("id", c['name'])
                        item.property_set_bool (Dbusmenu.MENUITEM_PROP_VISIBLE, True)
                        item.connect(Dbusmenu.MENUITEM_SIGNAL_ITEM_ACTIVATED, self.current().openChannel)
                        ql.child_append(item)
                self.launcher.set_property("quicklist", ql)

    def notify(self, title, message):
        self.notifier.notify(title, message)
        self.alert()

    def alert(self):
        if not self.isActiveWindow():
            self.launcher.set_property("urgent", True)
            self.tray.alert()

    def count(self):
        total = 0
        for i in range(0, self.stackedWidget.count()):
            widget = self.stackedWidget.widget(i)
            if widget.messages == 0:
                self.leftPane.stopAlert(widget.team())
            else:
                self.leftPane.alert(widget.team())
            total+=widget.messages
        if total > self.messages:
            self.alert()
        if 0 == total:
            self.launcher.set_property("count_visible", False)
            self.tray.setCounter(0)
        else:
            self.tray.setCounter(total)
            self.launcher.set_property("count", total)
            self.launcher.set_property("count_visible", True)
        self.messages = total
开发者ID:luhad,项目名称:scudcloud,代码行数:104,代码来源:scudcloud.py

示例5: ScudCloud

# 需要导入模块: from notifier import Notifier [as 别名]
# 或者: from notifier.Notifier import notify [as 别名]

#.........这里部分代码省略.........
                    self.leftPane.click(2)
                elif event.key() == QtCore.Qt.Key_4:
                    self.leftPane.click(3)
                elif event.key() == QtCore.Qt.Key_5:
                    self.leftPane.click(4)
                elif event.key() == QtCore.Qt.Key_6:
                    self.leftPane.click(5)
                elif event.key() == QtCore.Qt.Key_7:
                    self.leftPane.click(6)
                elif event.key() == QtCore.Qt.Key_8:
                    self.leftPane.click(7)
                elif event.key() == QtCore.Qt.Key_9:
                    self.leftPane.click(8)
                # Ctrl + Tab
                elif event.key() == QtCore.Qt.Key_Tab:
                    self.leftPane.clickNext(1)
            # Ctrl + BackTab
            if (modifiers & QtCore.Qt.ControlModifier) and (modifiers & QtCore.Qt.ShiftModifier):
                if event.key() == QtCore.Qt.Key_Backtab:
                    self.leftPane.clickNext(-1)
            # Ctrl + Shift + <key>
            if (modifiers & QtCore.Qt.ShiftModifier) and (modifiers & QtCore.Qt.ShiftModifier):
                if event.key() == QtCore.Qt.Key_V:
                    self.current().createSnippet()
        return QtGui.QMainWindow.eventFilter(self, obj, event)

    def focusInEvent(self, event):
        self.launcher.set_property("urgent", False)
        self.tray.stopAlert()

    def titleChanged(self):
        self.setWindowTitle(self.current().title())

    def closeEvent(self, event):
        if not self.forceClose and self.settings.value("Systray") == "True":
            self.hide()
            event.ignore()
        else:
            self.cookiesjar.save()
            self.settings.setValue("geometry", self.saveGeometry())
            self.settings.setValue("windowState", self.saveState())
            # Let's save the first team registered as default
            qUrl = self.stackedWidget.widget(0).url()
            if self.identifier is None and Resources.MESSAGES_URL_RE.match(qUrl.toString()):
                self.settings.setValue("Domain", "https://" + qUrl.host())

    def show(self):
        self.setWindowState(self.windowState() & ~QtCore.Qt.WindowMinimized | QtCore.Qt.WindowActive)
        self.activateWindow()
        self.setVisible(True)

    def exit(self):
        self.forceClose = True
        self.close()

    def quicklist(self, channels):
        if Dbusmenu is not None:
            if channels is not None:
                ql = Dbusmenu.Menuitem.new()
                self.launcher.set_property("quicklist", ql)
                for c in channels:
                    if c["is_member"]:
                        item = Dbusmenu.Menuitem.new()
                        item.property_set(Dbusmenu.MENUITEM_PROP_LABEL, "#" + c["name"])
                        item.property_set("id", c["name"])
                        item.property_set_bool(Dbusmenu.MENUITEM_PROP_VISIBLE, True)
                        item.connect(Dbusmenu.MENUITEM_SIGNAL_ITEM_ACTIVATED, self.current().openChannel)
                        ql.child_append(item)
                self.launcher.set_property("quicklist", ql)

    def notify(self, title, message, icon=None):
        self.notifier.notify(title, message, icon)
        self.alert()

    def alert(self):
        if not self.isActiveWindow():
            self.launcher.set_property("urgent", True)
            self.tray.alert()

    def count(self):
        total = 0
        for i in range(0, self.stackedWidget.count()):
            widget = self.stackedWidget.widget(i)
            messages = widget.highlights
            if messages == 0:
                self.leftPane.stopAlert(widget.team())
            else:
                self.leftPane.alert(widget.team())
            if messages is not None:
                total += messages
        if total > self.messages:
            self.alert()
        if 0 == total:
            self.launcher.set_property("count_visible", False)
            self.tray.setCounter(0)
        else:
            self.tray.setCounter(total)
            self.launcher.set_property("count", total)
            self.launcher.set_property("count_visible", True)
        self.messages = total
开发者ID:timesofbadri,项目名称:scudcloud,代码行数:104,代码来源:scudcloud.py

示例6: Notifier

# 需要导入模块: from notifier import Notifier [as 别名]
# 或者: from notifier.Notifier import notify [as 别名]
from notifier import Notifier

notifier = Notifier()

classes = [(8, 9, 'Afr'), (9, 11, 'Chemistry'), (10, 11, 'Eng'), (12, 13, 'Lunch')]

print(classes)


while True:
    for time_slot in range(24):
        print(time_slot)
        for time_slot_start, time_slot_end, class_name in classes:
            if time_slot_start == time_slot:
                #print('\t{} - Your {} class started lazy wtf'.format(time_slot_start, class_name))
                notifier.notify('Do somthing')
            
            if time_slot_end == time_slot:
                #print('\t{} - Your {} class is finished'.format(time_slot_end, class_name))
                notifier.notify('Do something else')
        
        time.sleep(1)
import time
classes = [ (8,9, 'Physics Class'),(9,10, 'Chem Class'),(10,11,'English Class'),(12,13, 'Lunch')]

while True:
    for time_slot in range(24):
        for time_start, time_end, class_name in classes:
            if time_start == time_slot:
                print('\t{} - tring {} start' .format(time_start, class_name))
            if time_end == time_slot:
开发者ID:EbubeTheSage,项目名称:Computer_Science_Academy,代码行数:33,代码来源:school_bell.py

示例7: do_notify

# 需要导入模块: from notifier import Notifier [as 别名]
# 或者: from notifier.Notifier import notify [as 别名]
def do_notify(work=45, rest=5):
    Notifier.notify("You've been working " + str(work) + " minutes! Now take a " + str(rest) + " minutes rest.", "Take a rest!")
    print("Rest: " + get_current_time())
    time.sleep(rest * 60)
    Notifier.notify("Rest is over. Time to work!")
    print("Back: " + get_current_time())
开发者ID:skyline75489,项目名称:Take-A-Rest,代码行数:8,代码来源:take-a-rest.py


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