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

Python notify2.init函数代码示例

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

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



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

示例1: __init__

 def __init__(self, appname, icon, urgency=None, timeout=None):
     self._appname = appname
     self._icon = icon
     self._urgency = urgency if urgency else notify2.URGENCY_NORMAL
     self._timeout = timeout if timeout else 1000
     notify2.init(self._appname)
     self._nobj = notify2.Notification(appname, icon=ICON)
开发者ID:robertopauletto,项目名称:PyMOTW-it_3.0,代码行数:7,代码来源:notifier.py


示例2: display

def display(title, msg):
    logging.debug("NOTIFY DISPLAY")
    if sys.platform == "linux":
        import notify2
        import dbus
        if not notify2.is_initted():
            logging.debug("Initialising notify2")
            notify2.init("cutecoin")
        n = notify2.Notification(title,
                         msg)

# fixme: https://bugs.python.org/issue11587
        # # Not working... Empty icon at the moment.
        # icon = QPixmap(":/icons/cutecoin_logo/").toImage()
        # if icon.isNull():
        #     logging.debug("Error converting logo")
        # else:
        #     icon.convertToFormat(QImage.Format_ARGB32)
        #     icon_bytes = icon.bits().asstring(icon.byteCount())
        #     icon_struct = (
        #         icon.width(),
        #         icon.height(),
        #         icon.bytesPerLine(),
        #         icon.hasAlphaChannel(),
        #         32,
        #         4,
        #         dbus.ByteArray(icon_bytes)
        #         )
        #     n.set_hint('icon_data', icon_struct)
        #     n.set_timeout(5000)
        n.show()
    else:
        _Toast(title, msg)
开发者ID:sethkontny,项目名称:cutecoin,代码行数:33,代码来源:toast.py


示例3: display_song

    def display_song(self):
        """Display the song data using notify-send."""
        if self.get_data("status") == "playing":
            # Create our temporary file if it doesn't exist yet.
            open("/tmp/cmus_desktop_last_track", "a").write("4")

            # Check to see when we got our last track from cmus.
            last_notice = open("/tmp/cmus_desktop_last_track", "r").read()

            # Write time stamp for current track from cmus.
            last_notice_time = str(time.time())
            open("/tmp/cmus_desktop_last_track", "w").write(last_notice_time)

            # Calculate seconds between track changes.
            track_change_duration = round(time.time() - float(last_notice))

            # Display current track notification only if 5 seconds have
            # elapsed since last track was chosen.
            if track_change_duration > 5:
                # Execute notify2 to create the notification
                notify2.init("cmus-display")
                text_body = self.format_notification_body()
                # Check if we have a notify_body to avoid
                # putting a "by" at the end
                if text_body:
                    notification = notify2.Notification(
                                    "Cmustify - current song", text_body, "")
                    notification.set_urgency(notify2.URGENCY_LOW)
                    notification.show()
            return True
        else:
            return False
开发者ID:kimond,项目名称:pycmustify,代码行数:32,代码来源:cmustify.py


示例4: daemon

def daemon(args=None, daemon=None):
    """
    Execute udiskie as a daemon.
    """
    import gobject
    import udiskie.automount
    import udiskie.mount
    import udiskie.prompt

    parser = mount_program_options()
    parser.add_option('-s', '--suppress', action='store_true',
                      dest='suppress_notify', default=False,
                      help='suppress popup notifications')
    parser.add_option('-t', '--tray', action='store_true',
                      dest='tray', default=False,
                      help='show tray icon')
    options, posargs = parser.parse_args(args)
    logging.basicConfig(level=options.log_level, format='%(message)s')

    mainloop = gobject.MainLoop()

    # connect udisks
    if daemon is None:
        daemon = udisks_service(options.udisks_version).Daemon()

    # create a mounter
    prompt = udiskie.prompt.password(options.password_prompt)
    filter = load_filter(options.filters)
    mounter = udiskie.mount.Mounter(filter=filter, prompt=prompt, udisks=daemon)

    # notifications (optional):
    if not options.suppress_notify:
        import udiskie.notify
        try:
            import notify2 as notify_service
        except ImportError:
            import pynotify as notify_service
        notify_service.init('udiskie.mount')
        notify = udiskie.notify.Notify(notify_service)
        daemon.connect(notify)

    # tray icon (optional):
    if options.tray:
        import udiskie.tray
        create_menu = partial(udiskie.tray.create_menu,
                              udisks=daemon,
                              mounter=mounter,
                              actions={'quit': mainloop.quit})
        statusicon = udiskie.tray.create_statusicon()
        connection = udiskie.tray.connect_statusicon(statusicon, create_menu)

    # automounter
    automount = udiskie.automount.AutoMounter(mounter)
    daemon.connect(automount)

    mounter.mount_all()
    try:
        return mainloop.run()
    except KeyboardInterrupt:
        return 0
开发者ID:Stebalien,项目名称:udiskie,代码行数:60,代码来源:cli.py


示例5: process

    def process(self, message: Message):
        """Displays desktop notification about specified message.

        :param message: E-Mail message object.
        """

        print("  - {}: {}.process()".format(self.name, self.__class__.__name__))

        notify2.init("Sendmail")

        title = self.title_template.format(
            subject=message.get("Subject"),
            from_email=message.get("From"),
            appname="Sendmail",
            name=self.name
        )
        text = self.text_template.format(
            subject=message.get("Subject"),
            from_email=message.get("From"),
            text=message.as_string(),
            appname="Sendmail",
            name=self.name
        )

        n = notify2.Notification(title,
            text,
            self.icon_name
        )

        n.show()
开发者ID:chupikov,项目名称:sendmail.py,代码行数:30,代码来源:NotifyProcessor.py


示例6: display_notification

def display_notification(title, message):
    notify2.init("Init")
    notice = notify2.Notification(title, message)
    notice.show()
    sleep(4)
    notice.close()
    return
开发者ID:codebhendi,项目名称:so-desktop-notification,代码行数:7,代码来源:script.py


示例7: main

def main():
    notify2.init('git-watcher')
    n = notify2.Notification("Git watcher started", os.getcwd(), "notification-message-im")
    n.show()
    while True:
        run_check()
        time.sleep(600)
开发者ID:robblue2x,项目名称:git-watcher,代码行数:7,代码来源:GitWatcher.py


示例8: view_notify

def view_notify(data):
    """ Notify for Informer service. """
    n = notify2.Notification("Incoming call", data)
    n.set_hint("x", 200)
    n.set_hint("y", 400)
    notify2.init("informer")
    n.show()
开发者ID:maxsocl,项目名称:informer,代码行数:7,代码来源:notify.py


示例9: notify

def notify():

    icon_path = "/home/dushyant/Desktop/Github/Weather-Notifier/weathernotifier/Weather-icon.png"

    place = get_location()
    resp = get_weather(place)

    print resp

    result = ''
    result += "Place : " + str(resp[0]["Place"])
    result += "\nStatus : " + str(resp[6])
    result += "\nCurrent Temperature (Celcius) : " + str(resp[1]["temp"])
    result += "\nMax Temperature (Celcius) : " + str(resp[1]["temp_max"])
    result += "\nMin Temperature (Celcius) : " + str(resp[1]["temp_min"])
    result += "\nWind Speed (m/s) : " + str(resp[2]["speed"])
    result += "\nHumidity (%) : " + str(resp[3])
    result += "\nPressure (hpa) : " + str(resp[4]["press"])
    result += "\nCloud Cover (%) : " + str(resp[5])

    # print result

    # Notification Tool

    notify2.init("Weather Notifier")
    n = notify2.Notification("Weather Details", icon=icon_path)
    n.update("Weather Details", result)
    n.show()
开发者ID:dushyantRathore,项目名称:Weather-Notifier,代码行数:28,代码来源:notifier.py


示例10: main

def main():
    notify2.init ('kremote')
    signal.signal(signal.SIGINT,terminate)
    
    parser = argparse.ArgumentParser(description='kremote daemon.')
    parser.add_argument('-D','--daemon', dest='cmdline', required=True,
                   help='Command line to start the remote daemon')
    parser.add_argument('-v','--version', action='version', version='kremote daemon 1')
    args = parser.parse_args()
    
    print args.cmdline
    
    fd = launch_daemon(args.cmdline.split(' '))
    
    shift = False
    
    while True:
        buf = read(fd,1)
        if len(buf)==0:
            break
        if buf == 's':
            shift = not shift
        print '->', buf
        action(buf, shift)
    notify('Device listener failure',1)
    exit(2)
开发者ID:ltworf,项目名称:kremote,代码行数:26,代码来源:kremote.py


示例11: __init__

 def __init__(self, parent=None):
     super(ScudCloud, self).__init__(parent)
     self.setWindowTitle('ScudCloud')
     notify2.init(self.APP_NAME)
     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:lseelenbinder,项目名称:scudcloud,代码行数:34,代码来源:scudcloud.py


示例12: __init__

            def __init__(self, appName, timeout, guiApp):
                super(MessengerLinux, self).__init__(timeout)

                notify2.init(appName, guiApp.eventLoop)
                self.notification = None

                if guiApp.iconPath:
                    self.icon = guiApp.getNotificationIcon()
开发者ID:amitahire,项目名称:bitfighter,代码行数:8,代码来源:bitfighter_notifier.py


示例13: initialize

    def initialize(self, context):
        if sys.platform != 'linux2':
            raise ResultProcessorError('Notifications are only supported in linux')

        if not notify2:
            raise ResultProcessorError('notify2 not installed.  Please install the notify2 package')

        notify2.init("Workload Automation")
开发者ID:bjackman,项目名称:workload-automation,代码行数:8,代码来源:notify.py


示例14: notify

 def notify(self):
     ''' Displays a notification via libnotify '''
     import notify2
     notify2.init (self.title)
     noti = notify2.Notification (self.title,
                                   self.message,
                                   "dialog-information")
     noti.show ()
开发者ID:mscansian,项目名称:SigmaWebPlus,代码行数:8,代码来源:notification.py


示例15: show

def show(content):
    try:
        import notify2
        notify2.init('Slx7hS3ns3on')
        notify = notify2.Notification('Slx7hS3ns3on', content, "dialog-information")
        notify.show()
    except:
        print("**** Requires notify. sudo pip install notify2.")
开发者ID:18z,项目名称:Slx7hS3ns3onLinux,代码行数:8,代码来源:notify.py


示例16: notify

def notify(summary, message):
    if not notify2_available:
        return
    try:
        notify2.init('commit-gate-cli')
        notify2.Notification(summary, message, os.path.join(os.path.dirname(__file__), 'jenkins.png')).show()
    except BaseException as e:
        print "Could not display notification %s" % e.message
开发者ID:storecast,项目名称:commit-gate-cli,代码行数:8,代码来源:jenkins_cli.py


示例17: stretch

def stretch():
    notify2.init('Stretch')
    n = notify2.Notification('Get Up !', 'Time to stretch a bit ')
    n.show()
    subprocess.call(['espeak', '-g', '5', 'Get Up. Time to Stretch' ])
    time.sleep(600)
    n = notify2.Notification('Enough Rest', 'Get back to work ')
    n.show();
    subprocess.call(['espeak', '-g', '5', 'Get back to work' ])
开发者ID:g33kyaditya,项目名称:stretch-notify,代码行数:9,代码来源:stretch.py


示例18: send_notify

def send_notify(title, message, speed=300, min_delay=10):
    notify2.init("yatr")
    notification = notify2.Notification(title, message)
    notification.show()
    time.sleep(max(
        len(title.split() + message.split()) * 60 / speed,
        min_delay
    ))
    notification.close()
开发者ID:komendantyan,项目名称:yatr,代码行数:9,代码来源:cli.py


示例19: _pluginRemovePlugin

	def _pluginRemovePlugin(self,plugin):
		notify2.init("duck-launcher")
		n=notify2.Notification("The plugin '{}' is uninstalling".format(plugin),
			"",
			"dialog-information")
		n.show()
		self.parent.close_it()
		t = removePlugin(parent=self.parent)
		t.plugin=plugin
		t.start()
开发者ID:descentos,项目名称:launcher,代码行数:10,代码来源:Widgets.py


示例20: send_notification

def send_notification(unread_count):
    if not int(unread_count):
        return
    image = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'gmail.jpg')
    notify2.init(__file__)
    n = notify2.Notification('Gmail未读邮件',
                         '共{num}封未读'.format(num=unread_count),
                         image
    )
    n.show()
开发者ID:cute-jumper,项目名称:KISS,代码行数:10,代码来源:gmail_unread.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python notmuch.Database类代码示例发布时间:2022-05-27
下一篇:
Python signal.Signal类代码示例发布时间: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