Python notify2.init() Examples
The following are 15
code examples of notify2.init().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
notify2
, or try the search function
.
Example #1
Source File: ui.py From pantalaimon with Apache License 2.0 | 6 votes |
def run(self): self.loop = GLib.MainLoop() if self.config.notifications: try: notify2.init("pantalaimon", mainloop=self.loop) self.notifications = True except dbus.DBusException: logger.error( "Notifications are enabled but no notification " "server could be found, disabling notifications." ) self.notifications = False GLib.timeout_add(100, self.message_callback) if not self.loop: return self.loop.run()
Example #2
Source File: Main.py From Crypto-Notifier with MIT License | 6 votes |
def notify(): icon_path = "/home/dushyant/Desktop/Github/Crypto-Notifier/logo.jpg" cryptocurrencies = ["BTC", "ETH", "LTC", "XMR", "XRP",] result = "\n" for coin in cryptocurrencies: rate = fetch_coin(coin, "USD") result += "{} - {}\n".format(coin, "$"+str(rate)) # print result notify2.init("Cryptocurrency rates notifier") n = notify2.Notification("Crypto Notifier", icon=icon_path) n.set_urgency(notify2.URGENCY_NORMAL) n.set_timeout(1000) n.update("Current Cryptocurrency Rates", result) n.show()
Example #3
Source File: Main.py From Crypto-Notifier with MIT License | 6 votes |
def notify(): icon_path = "/home/dushyant/Desktop/Github/Crypto-Notifier/logo.jpg" cryptocurrencies = ["BTC", "ETH", "LTC", "XMR", "XRP",] result = "\n" for coin in cryptocurrencies: rate = fetch_coin(coin, "USD") result += "{} - {}\n".format(coin, "$"+str(rate)) # print result notify2.init("Cryptocurrency rates notifier") n = notify2.Notification("Crypto Notifier", icon=icon_path) n.set_urgency(notify2.URGENCY_NORMAL) n.set_timeout(1000) n.update("Current Cryptocurrency Rates", result) n.show()
Example #4
Source File: windowManager.py From Tickeys-linux with MIT License | 6 votes |
def show_GUI(): def show_notify(): try: import notify2 notify2.init('Tickeys') title = 'Tickeys' body = '程序“xdotool”尚未安装, 无法隐藏窗口。' iconfile = os.getcwd() + '/tickeys.png' notify = notify2.Notification(title, body, iconfile) notify.show() except Exception: return try: GUIID = read_GUI_window_id() if not GUIID or GUIID == "0": Thread(target=show_notify).start() return else: # read window ids command = "xdotool windowmap --sync %s && xdotool windowactivate --sync %s" % (GUIID, GUIID) stat, output = commands.getstatusoutput(command) return str(stat) except Exception, e: logger.error(str(e)) return '256'
Example #5
Source File: coin.py From coinprice-indicator with MIT License | 6 votes |
def update_assets(self): self.discoveries += 1 if self.discoveries < len([ex for ex in self.EXCHANGES if ex.active and ex.discovery]): return # wait until all active exchanges with discovery finish discovery self.discoveries = 0 self._load_assets() if notify2.init(self.config.get('app').get('name')): n = notify2.Notification( self.config.get('app').get('name'), "Finished discovering new assets", self.icon) n.set_urgency(1) n.timeout = 2000 n.show() self.main_item.set_icon_full(self.icon, "App icon") # Handle system resume by refreshing all tickers
Example #6
Source File: alarm.py From coinprice-indicator with MIT License | 6 votes |
def __notify(self, price, direction, threshold): exchange_name = self.parent.exchange.get_name() asset_name = self.parent.exchange.asset_pair.get('base') title = asset_name + ' price alert: ' + self.parent.symbol + str(price) message = 'Price on ' + exchange_name + ' ' + direction + ' ' + self.parent.symbol + str(threshold) if notify2.init(self.app_name): if pygame.init(): pygame.mixer.music.load(self.parent.coin.config.get('project_root') + '/resources/ca-ching.wav') pygame.mixer.music.play() logo = GdkPixbuf.Pixbuf.new_from_file( self.parent.coin.config.get('project_root') + '/resources/icon_32px.png') n = notify2.Notification(title, message) n.set_icon_from_pixbuf(logo) n.set_urgency(2) # highest n.show()
Example #7
Source File: battery_notifier.py From openrazer with GNU General Public License v2.0 | 6 votes |
def __init__(self, parent, device_id, device_name): super(BatteryNotifier, self).__init__() self._logger = logging.getLogger('razer.device{0}.batterynotifier'.format(device_id)) self._notify2 = notify2 is not None self.event = threading.Event() if self._notify2: try: notify2.init('openrazer_daemon') except Exception as err: self._logger.warning("Failed to init notification daemon, err: {0}".format(err)) self._notify2 = False self._shutdown = False self._device_name = device_name # Could save reference to parent but only need battery level function self._get_battery_func = parent.getBattery if self._notify2: self._notification = notify2.Notification(summary="{0}") self._notification.set_timeout(NOTIFY_TIMEOUT) self._last_notify_time = datetime.datetime(1970, 1, 1)
Example #8
Source File: handlers.py From pyrdp with GNU General Public License v3.0 | 5 votes |
def __init__(self): notify2.init("pyrdp-player") super(NotifyHandler, self).__init__()
Example #9
Source File: Widgets.py From launcher with GNU General Public License v2.0 | 5 votes |
def _pluginInstallPlugin(self,plugin): notify2.init("duck-launcher") n=notify2.Notification("The plugin '{}' is installing".format(plugin), "", "dialog-information") n.show() self.parent.close_it() t = installPlugin(parent=self.parent) t.plugin=plugin t.start() self.parent.close_it()
Example #10
Source File: Widgets.py From launcher with GNU General Public License v2.0 | 5 votes |
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()
Example #11
Source File: Plugins.py From launcher with GNU General Public License v2.0 | 5 votes |
def __init__(self): self.plugins=[] notify2.init("duck launcher")
Example #12
Source File: daemon.py From sun with GNU General Public License v3.0 | 5 votes |
def __init__(self): notify2.uninit() notify2.init('sun') self.pkg_count = len(fetch()) self.summary = f"{' ' * 10}Software Updates" self.message = f"{' ' * 3}{self.pkg_count} Software updates are available\n" self.icon = f'{icon_path}{__all__}.png' self.n = notify2.Notification(self.summary, self.message, self.icon) self.n.set_timeout(60000 * int(config()['STANDBY']))
Example #13
Source File: by_desktop.py From UoM-WAM-Spam with MIT License | 5 votes |
def __init__(self) -> None: print("Configuring Desktop Notifier...") notify2.init("UoM-WAM-Spam") self.notification = notify2.Notification self.timeout = notify2.EXPIRES_NEVER
Example #14
Source File: main.py From smd with MIT License | 5 votes |
def sound(error=False): mixer.init() mixer.music.load(notify.sound_warn if error else notify.sound_info) mixer.music.play()
Example #15
Source File: GUI.py From Tickeys-linux with MIT License | 4 votes |
def show_notify(notify_content=""): try: notify2.init('Tickeys') title = 'Tickeys' icon_file_path = os.getcwd() + '/tickeys.png' notify = notify2.Notification(title, notify_content, icon_file_path) notify.show() except Exception, e: logger.exception(e) logger.error("show notify fail")