本文整理匯總了Python中pydbus.SessionBus.get方法的典型用法代碼示例。如果您正苦於以下問題:Python SessionBus.get方法的具體用法?Python SessionBus.get怎麽用?Python SessionBus.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pydbus.SessionBus
的用法示例。
在下文中一共展示了SessionBus.get方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: post_config_hook
# 需要導入模塊: from pydbus import SessionBus [as 別名]
# 或者: from pydbus.SessionBus import get [as 別名]
def post_config_hook(self):
if self.user:
bus = SessionBus()
else:
bus = SystemBus()
systemd = bus.get("org.freedesktop.systemd1")
self.systemd_unit = bus.get(".systemd1", systemd.LoadUnit(self.unit))
示例2: info
# 需要導入模塊: from pydbus import SessionBus [as 別名]
# 或者: from pydbus.SessionBus import get [as 別名]
def info(self):
tod_time = time.strftime("%a, %d %b %Y %H:%M:%S",
time.localtime(start_time))
message_string = ("Wheel circumference: {} meters\n"
"Start time: {}\n"
"GPIO Channel Number: {}"
.format(wheel_circumference, tod_time, channel))
bus_1 = SessionBus()
notifications = bus_1.get('.Notifications')
notifications.Notify('test', 0,
'dialog-information',
"Pydbus Server Information",
message_string,
[], {}, 5000)
示例3: _init_dbus
# 需要導入模塊: from pydbus import SessionBus [as 別名]
# 或者: from pydbus.SessionBus import get [as 別名]
def _init_dbus(self):
"""
Get the device id
"""
_bus = SessionBus()
if self.device_id is None:
self.device_id = self._get_device_id(_bus)
if self.device_id is None:
return False
try:
self._dev = _bus.get(SERVICE_BUS, DEVICE_PATH + "/%s" % self.device_id)
except Exception:
return False
return True
示例4: sleep
# 需要導入模塊: from pydbus import SessionBus [as 別名]
# 或者: from pydbus.SessionBus import get [as 別名]
from __future__ import print_function
from pydbus import SessionBus
from gi.repository import GLib
import subprocess
from time import sleep
loop = GLib.MainLoop()
subprocess.Popen("gnome-music")
sleep(5)
print("Waiting for GNOME Music to start...")
b = SessionBus()
m = b.get("org.mpris.MediaPlayer2.GnomeMusic", "/org/mpris/MediaPlayer2")
m.PropertiesChanged.connect(print)
m.ActivatePlaylist(m.GetPlaylists(0, 5, "Alphabetical", 0)[0][0])
m.Play()
sleep(1)
assert(m.PlaybackStatus == "Playing")
m.Pause()
assert(m.PlaybackStatus == "Paused")
m.Play()
assert(m.PlaybackStatus == "Playing")
t = m.Metadata["xesam:title"]
示例5: Flask
# 需要導入模塊: from pydbus import SessionBus [as 別名]
# 或者: from pydbus.SessionBus import get [as 別名]
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask import Flask
from flask import request
app = Flask(__name__)
from pydbus import SessionBus
bus = SessionBus()
try:
player = bus.get("github.zhangn1985.dbplay")
except:
from playthread import Mpvplayer
player = Mpvplayer()
player.start()
import json
import types
from ykdl.common import url_to_module
@app.route('/play', methods=['POST', 'GET'])
def play():
if request.method == 'POST':
url = request.form['url']
try:
islist = request.form['list']
islist = islist == "True"
except:
islist = False
m,u = url_to_module(url)
示例6: __init__
# 需要導入模塊: from pydbus import SessionBus [as 別名]
# 或者: from pydbus.SessionBus import get [as 別名]
def __init__(self):
Gtk.Window.__init__(self, title=TITLE)
#self.set_default_size(150, 100)
grid_main = Gtk.Grid()
self.add(grid_main)
# Modify the overall font name and size, for use with video projection.
if PROJECTOR:
pangoFont = Pango.FontDescription(PROJECTOR_FONT)
self.modify_font(pangoFont)
# Get the session dbus
bus = SessionBus()
# Get the object
try:
self.server_1_object = bus.get(BUS)
except GLib.Error as e:
print("GLib.Error: {}.\nIs the server running?".format(BUS))
#print(e)
sys.exit("Exiting...")
except GDBus.Error as e:
# Doesn't seem to have GDBus.Error as an error.
# TODO: Remove is never detected
print("Error 2")
print(e)
# TODO: Check if it can hang here. If bus not registered / available?
# Create Frames to group different data in.
frame_1 = Gtk.Frame(label=FRAME_1, margin=10)
grid_main.attach(frame_1, 0, 0, 1, 1)
frame_2 = Gtk.Frame(label=FRAME_2, margin=10)
grid_main.attach(frame_2, 1, 0, 1, 1)
frame_3 = Gtk.Frame(label=FRAME_3, margin=10)
grid_main.attach(frame_3, 0, 1, 1, 2)
frame_4 = Gtk.Frame(label=FRAME_4, margin=10)
grid_main.attach(frame_4, 1, 1, 1, 1)
frame_5 = Gtk.Frame(label=FRAME_4, margin=10)
grid_main.attach(frame_5, 1, 2, 1, 1)
# Frame_1 Grid for widgets
grid_frame_1 = Gtk.Grid()
frame_1.add(grid_frame_1)
# Frame_1 Static labels. xalign float from 0 = left to 1 = right
f1_label_1 = Gtk.Label(F1_LABEL_1, margin=10, xalign=1)
f1_label_2 = Gtk.Label(F1_LABEL_2, margin=10, xalign=1)
f1_label_3 = Gtk.Label(F1_LABEL_3, margin=10, xalign=1)
f1_label_4 = Gtk.Label(F1_LABEL_4, margin=10, xalign=1)
f1_label_5 = Gtk.Label(F1_LABEL_5, margin=10, xalign=1)
# Frame_1 Attach to grid
grid_frame_1.attach(f1_label_1, 0, 0, 1, 1,)
grid_frame_1.attach(f1_label_2, 0, 1, 1, 1,)
grid_frame_1.attach(f1_label_3, 0, 2, 1, 1,)
grid_frame_1.attach(f1_label_4, 0, 3, 1, 1,)
grid_frame_1.attach(f1_label_5, 0, 4, 1, 1,)
# Frame_1 Dynamic labels. Provide self.
# So they can be updated by any method.
self.f1_label_1a = Gtk.Label("0", margin=10, xalign=1)
self.f1_label_2a = Gtk.Label("0", margin=10, xalign=1)
self.f1_label_3a = Gtk.Label("0", margin=10, xalign=1)
self.f1_label_4a = Gtk.Label("0", margin=10, xalign=1)
self.f1_label_5a = Gtk.Label("0", margin=10, xalign=1)
# Frame_1 Attach to grid
grid_frame_1.attach(self.f1_label_1a, 1, 0, 1, 1,)
grid_frame_1.attach(self.f1_label_2a, 1, 1, 1, 1,)
grid_frame_1.attach(self.f1_label_3a, 1, 2, 1, 1,)
grid_frame_1.attach(self.f1_label_4a, 1, 3, 1, 1,)
grid_frame_1.attach(self.f1_label_5a, 1, 4, 1, 1,)
# Frame_1 Progress bar
self.f1_progressbar_1 = Gtk.ProgressBar()
grid_frame_1.attach(self.f1_progressbar_1, 2, 0, 1, 1,)
self.f1_progressbar_1.set_fraction(0)
# Frame_2 Grid for widgets
grid_frame_2 = Gtk.Grid()
frame_2.add(grid_frame_2)
# Frame_2 Static labels.
f2_label_1 = Gtk.Label(F2_LABEL_1, margin=10, xalign=1)
f2_label_2 = Gtk.Label(F2_LABEL_2, margin=10, xalign=1)
f2_label_3 = Gtk.Label(F2_LABEL_3, margin=10, xalign=1)
f2_label_4 = Gtk.Label(F2_LABEL_4, margin=10, xalign=1)
f2_label_5 = Gtk.Label(F2_LABEL_5, margin=10, xalign=1)
f2_label_6 = Gtk.Label(F2_LABEL_6, margin=10, xalign=1)
# Frame_2 Attach to grid
grid_frame_2.attach(f2_label_1, 0, 0, 1, 1,)
grid_frame_2.attach(f2_label_2, 0, 1, 1, 1,)
grid_frame_2.attach(f2_label_3, 0, 2, 1, 1,)
grid_frame_2.attach(f2_label_4, 0, 3, 1, 1,)
grid_frame_2.attach(f2_label_5, 0, 4, 1, 1,)
grid_frame_2.attach(f2_label_6, 0, 5, 1, 1,)
# Frame_2 Dynamic labels.
self.f2_label_1a = Gtk.Label("0", margin=10, xalign=1)
self.f2_label_2a = Gtk.Label("0", margin=10, xalign=1)
self.f2_label_3a = Gtk.Label("0", margin=10, xalign=1)
self.f2_label_4a = Gtk.Label("0", margin=10, xalign=1)
self.f2_label_5a = Gtk.Label("0", margin=10, xalign=1)
self.f2_label_6a = Gtk.Label("0", margin=10, xalign=1)
# Frame_2 Attach to grid
grid_frame_2.attach(self.f2_label_1a, 1, 0, 1, 1,)
grid_frame_2.attach(self.f2_label_2a, 1, 1, 1, 1,)
#.........這裏部分代碼省略.........
示例7: __init__
# 需要導入模塊: from pydbus import SessionBus [as 別名]
# 或者: from pydbus.SessionBus import get [as 別名]
def __init__(self, *args):
_IdleObject.__init__(self)
context = GObject.MainContext.default()
self.bucket = bucket = Queue.Queue() # NOQA
self.hello = None
# with SessionBus() as bus:
bus = SessionBus()
ss = bus.get("org.scarlett", object_path='/org/scarlett/Listener') # NOQA
time.sleep(1)
ss_failed_signal = bus.subscribe(sender=None,
iface="org.scarlett.Listener",
signal="SttFailedSignal",
object="/org/scarlett/Listener",
arg0=None,
flags=0,
signal_fired=player_cb)
ss_rdy_signal = bus.subscribe(sender=None,
iface="org.scarlett.Listener",
signal="ListenerReadySignal",
object="/org/scarlett/Listener",
arg0=None,
flags=0,
signal_fired=player_cb)
ss_kw_rec_signal = bus.subscribe(sender=None,
iface="org.scarlett.Listener",
signal="KeywordRecognizedSignal",
object="/org/scarlett/Listener",
arg0=None,
flags=0,
signal_fired=player_cb)
ss_cmd_rec_signal = bus.subscribe(sender=None,
iface="org.scarlett.Listener",
signal="CommandRecognizedSignal",
object="/org/scarlett/Listener",
arg0=None,
flags=0,
signal_fired=command_cb)
ss_cancel_signal = bus.subscribe(sender=None,
iface="org.scarlett.Listener",
signal="ListenerCancelSignal",
object="/org/scarlett/Listener",
arg0=None,
flags=0,
signal_fired=player_cb)
pp.pprint((ss_failed_signal,
ss_rdy_signal,
ss_kw_rec_signal,
ss_cmd_rec_signal,
ss_cancel_signal))
logger.debug("ss_failed_signal: {}".format(ss_failed_signal))
logger.debug("ss_rdy_signal: {}".format(ss_rdy_signal))
logger.debug("ss_kw_rec_signal: {}".format(ss_kw_rec_signal))
logger.debug("ss_cmd_rec_signal: {}".format(ss_cmd_rec_signal))
logger.debug("ss_cancel_signal: {}".format(ss_cancel_signal))
ss.emitConnectedToListener('ScarlettTasker')
loop.run()
# THE ACTUAL THREAD BIT
# self.manager = FooThreadManager(3)
try:
print("ScarlettTasker Thread Started")
except Exception:
ss_failed_signal.disconnect()
ss_rdy_signal.disconnect()
ss_kw_rec_signal.disconnect()
ss_cmd_rec_signal.disconnect()
ss_cancel_signal.disconnect()
loop.quit()
self.bucket.put(sys.exc_info())
raise
示例8: __init__
# 需要導入模塊: from pydbus import SessionBus [as 別名]
# 或者: from pydbus.SessionBus import get [as 別名]
def __init__(self, *args):
_IdleObject.__init__(self)
self.bucket = bucket = Queue.Queue() # NOQA
self.loop = GLib.MainLoop()
self.hello = None
# with SessionBus() as bus:
bus = SessionBus()
ss = bus.get("org.scarlett", object_path='/org/scarlett/Listener') # NOQA
# # SttFailedSignal / player_cb
# ss_failed_signal = bus.con.signal_subscribe(None, # NOQA
# "org.scarlett.Listener",
# "SttFailedSignal",
# '/org/scarlett/Listener',
# None,
# 0,
# player_cb)
ss_failed_signal = ss.SttFailedSignal.connect(player_cb)
# # ListenerReadySignal / player_cb
# ss_rdy_signal = bus.con.signal_subscribe(None, # NOQA
# "org.scarlett.Listener",
# "ListenerReadySignal",
# '/org/scarlett/Listener',
# None,
# 0,
# player_cb)
ss_rdy_signal = ss.ListenerReadySignal.connect(player_cb)
# # KeywordRecognizedSignal / player_cb
# ss_kw_rec_signal = bus.con.signal_subscribe(None, # NOQA
# "org.scarlett.Listener",
# "KeywordRecognizedSignal",
# '/org/scarlett/Listener',
# None,
# 0,
# player_cb)
ss_kw_rec_signal = ss.KeywordRecognizedSignal.connect(player_cb)
# # CommandRecognizedSignal /command_cb
# ss_cmd_rec_signal = bus.con.signal_subscribe(None, # NOQA
# "org.scarlett.Listener",
# "CommandRecognizedSignal",
# '/org/scarlett/Listener',
# None,
# 0,
# command_cb)
ss_cmd_rec_signal = ss.CommandRecognizedSignal.connect(command_cb)
# # ListenerCancelSignal / player_cb
# # signal_subscribe (sender, interface_name, member, object_path, arg0, flags, callback, *user_data)
# ss_cancel_signal = bus.con.signal_subscribe(None, # NOQA
# "org.scarlett.Listener",
# "ListenerCancelSignal",
# '/org/scarlett/Listener',
# None,
# 0,
# player_cb)
ss_cancel_signal = ss.ListenerCancelSignal.connect(player_cb)
ss.emitConnectedToListener('ScarlettTasker')
# THE ACTUAL THREAD BIT
self.manager = FooThreadManager(3)
try:
print "ScarlettTasker Thread Started", self
self.loop.run()
except Exception:
ss_failed_signal.disconnect()
ss_rdy_signal.disconnect()
ss_kw_rec_signal.disconnect()
ss_cmd_rec_signal.disconnect()
ss_cancel_signal.disconnect()
self.bucket.put(sys.exc_info())
raise
示例9: SessionBus
# 需要導入模塊: from pydbus import SessionBus [as 別名]
# 或者: from pydbus.SessionBus import get [as 別名]
#!/usr/bin/python3
import os
import sys
import datetime
import json
import subprocess
from time import sleep
from pydbus import SessionBus
from glob import glob
BUS = SessionBus()
LAYOUT = BUS.get(bus_name='org.way-cooler', object_path='/org/way_cooler/Layout')
def main():
while True:
layout = json.loads(LAYOUT.Debug())
workspaces = get_workspaces(layout)
workspaces.sort()
active_workspace = ""
try:
active_workspace = LAYOUT.ActiveWorkspace()
except Exception:
pass
workspaces = " ".join(workspaces)
workspaces = format_workspaces(layout, workspaces, active_workspace)
funcs = [workspaces + "%{c}",
lambda: get_time() + "%{r}",
my_get_temp,
示例10: SessionBus
# 需要導入模塊: from pydbus import SessionBus [as 別名]
# 或者: from pydbus.SessionBus import get [as 別名]
#!/usr/bin/env python
# Based on http://stackoverflow.com/questions/22390064/use-dbus-to-just-send-a-message-in-python
# Python script to call the methods of the DBUS Test Server
from pydbus import SessionBus
#get the session bus
bus = SessionBus()
#get the object
the_object = bus.get("net.lew21.pydbus.ClientServerExample")
#call the methods and print the results
reply = the_object.Hello()
print(reply)
reply = the_object.EchoString("test 123")
print(reply)
the_object.Quit()
示例11: ScarlettListenerI
# 需要導入模塊: from pydbus import SessionBus [as 別名]
# 或者: from pydbus.SessionBus import get [as 別名]
class ScarlettListenerI(threading.Thread, _IdleObject):
"""
Attempt to take out all Gstreamer logic and put it in a class ouside the dbus server.
Cancellable thread which uses gobject signals to return information
to the GUI.
"""
__gsignals__ = SCARLETT_LISTENER_I_SIGNALS
device = PS_DEVICE
hmm = HMM_PATH
lm = LM_PATH
dic = DICT_PATH
# SCARLETT_LISTENER_I_SIGNALS = {
# "completed": (
# GObject.SignalFlags.RUN_LAST, None, []),
# "progress": (
# GObject.SignalFlags.RUN_LAST, None, [
# GObject.TYPE_FLOAT]), # percent complete
# "eos": (GObject.SignalFlags.RUN_LAST, None, ()),
# "error": (GObject.SignalFlags.RUN_LAST, None, (GObject.TYPE_STRING, GObject.TYPE_STRING)),
# "died": (GObject.SignalFlags.RUN_LAST, None, ()),
# "async-done": (GObject.SignalFlags.RUN_LAST, None, ()),
# "state-change": (GObject.SignalFlags.RUN_LAST, None, (GObject.TYPE_INT, GObject.TYPE_INT)),
# # FIXME: AUDIT THE RETURN TYPES
# "keyword-recgonized": (GObject.SignalFlags.RUN_LAST, None, (GObject.TYPE_STRING, GObject.TYPE_STRING)),
# "command-recgonized": (GObject.SignalFlags.RUN_LAST, None, (GObject.TYPE_STRING, GObject.TYPE_STRING)),
# "stt-failed": (GObject.SignalFlags.RUN_LAST, None, (GObject.TYPE_STRING, GObject.TYPE_STRING)),
# "listener-cancel": (GObject.SignalFlags.RUN_LAST, None, (GObject.TYPE_STRING, GObject.TYPE_STRING)),
# "listener-ready": (GObject.SignalFlags.RUN_LAST, None, (GObject.TYPE_STRING, GObject.TYPE_STRING)),
# "connected-to-server": (GObject.SignalFlags.RUN_LAST, None, (GObject.TYPE_STRING, GObject.TYPE_STRING)),
# "listener-message": (GObject.SignalFlags.RUN_LAST, None, (GObject.TYPE_STRING, GObject.TYPE_STRING)),
# 'finished': (GObject.SignalFlags.RUN_LAST, None, (GObject.TYPE_PYOBJECT,)),
# 'aborted': (GObject.SignalFlags.RUN_LAST, None, (GObject.TYPE_PYOBJECT,))
# }
def __init__(self, *args):
threading.Thread.__init__(self)
_IdleObject.__init__(self)
# Gst.init(None)
self.running = False
self.finished = False
self.ready_sem = threading.Semaphore(0)
self.queue = queue.Queue(QUEUE_SIZE)
# This wil get filled with an exception if opening fails.
self.read_exc = None
self.dot_exc = None
self.cancelled = False
self.name = args[0]
self.setName("%s" % self.name)
self.pipelines_stack = []
self.elements_stack = []
self.gst_bus_stack = []
self._message = 'This is the ScarlettListenerI'
self.config = scarlett_config.Config()
self.override_parse = ''
self.failed = 0
self.kw_found = 0
self.debug = False
self.create_dot = True
self.terminate = False
self.capsfilter_queue_overrun_handler = None
# source: https://github.com/ljmljz/xpra/blob/b32f748e0c29cdbfab836b3901c1e318ea142b33/src/xpra/sound/sound_pipeline.py # NOQA
self.bus = None
self.bus_message_element_handler_id = None
self.bus_message_error_handler_id = None
self.bus_message_eos_handler_id = None
self.bus_message_state_changed_handler_id = None
self.pipeline = None
self.start_time = 0
self.state = "stopped"
self.buffer_count = 0
self.byte_count = 0
# # Thread manager, maximum of 1 since it'll be long running
# self.manager = FooThreadManager(1)
self._status_ready = " ScarlettListener is ready"
self._status_kw_match = " ScarlettListener caught a keyword match"
self._status_cmd_match = " ScarlettListener caught a command match"
self._status_stt_failed = " ScarlettListener hit Max STT failures"
self._status_cmd_start = " ScarlettListener emitting start command"
self._status_cmd_fin = " ScarlettListener Emitting Command run finish"
self._status_cmd_cancel = " ScarlettListener cancel speech Recognition"
if self.debug:
# NOTE: For testing puposes, mainly when in public
# so you dont have to keep yelling scarlett in front of strangers
self.kw_to_find = ['yo', 'hello', 'man', 'children']
else:
self.kw_to_find = self.config.get('scarlett', 'keywords')
#.........這裏部分代碼省略.........
示例12: SessionBus
# 需要導入模塊: from pydbus import SessionBus [as 別名]
# 或者: from pydbus.SessionBus import get [as 別名]
#!/usr/bin/python
from pydbus import SessionBus
session_bus = SessionBus()
bkd_obj = session_bus.get('org.geekpur.vishal.BKD',
'/org/geekpur/vishal/BKD')
print bkd_obj.GetBackspaceCount()
示例13: init_debugger
# 需要導入模塊: from pydbus import SessionBus [as 別名]
# 或者: from pydbus.SessionBus import get [as 別名]
from scarlett_os.internal.debugger import init_debugger
from scarlett_os.internal.debugger import set_gst_grapviz_tracing
init_debugger()
set_gst_grapviz_tracing()
# Example of how to use it
loop = GLib.MainLoop()
recieved_signals = []
from pydbus import SessionBus
bus = SessionBus()
ss = bus.get("org.scarlett", object_path="/org/scarlett/Listener")
time.sleep(0.5)
# taken from tasker
ss_failed_signal = bus.subscribe(
sender=None,
iface="org.scarlett.Listener",
signal="SttFailedSignal",
object="/org/scarlett/Listener",
arg0=None,
flags=0,
signal_fired=catchall_handler,
)
ss_rdy_signal = bus.subscribe(
sender=None,
示例14: SessionBus
# 需要導入模塊: from pydbus import SessionBus [as 別名]
# 或者: from pydbus.SessionBus import get [as 別名]
"""https://github.com/LEW21/pydbus"""
import sys
sys.path += ['pydbus/']
from pydbus import SessionBus
bus = SessionBus()
notifications = bus.get('.Notifications')
notifications.Notify('test', 0, 'dialog-information', "Hello World!", "pydbus works :)", [], {}, 5000)
示例15: KDEConnectNotify
# 需要導入模塊: from pydbus import SessionBus [as 別名]
# 或者: from pydbus.SessionBus import get [as 別名]
class KDEConnectNotify():
"""
"""
# available configuration parameters
device_id = None
debug = None
terminal = None
libnotify = None
ignore = None
_bus = None
_dev = None
def __init__(self, use_terminal = True,
use_libnotify = True,
debug = False,
device_id = None,
device_name = None,
ignore = None):
"""
Get the device id
"""
self.terminal = use_terminal
self.libnotify = use_libnotify
self.debug = debug
if ignore:
self.ignore = [app.lower() for app in ignore]
if not self.terminal:
self._debug('hide terminal messages')
if not self.libnotify:
self._debug('hide notifications')
if use_libnotify:
Notify.init('KDEConnect Notify')
if ignore:
apps = ignore[0]
for app in ignore[1:]:
apps += ', ' + app
self._debug('ignore ' + apps)
self._bus = SessionBus()
if device_id is None:
self.device_id = self._get_device_id(device_id, device_name)
if self.device_id is None:
self._debug('No device id found')
return
else:
self.device_id = device_id
self._debug('Device id is %s' % self.device_id)
try:
self._dev = self._bus.get(SERVICE_BUS,
DEVICE_PATH + '/%s' % self.device_id)
except Exception:
self.device_id = None
return
def _get_device_id(self, device_id, device_name):
"""
Find the device id
"""
_dbus = self._bus.get(SERVICE_BUS, PATH)
devices = _dbus.devices()
if device_name is None and device_id is None and len(devices) == 1:
return devices[0]
self._debug('Search device name \'%s\'' % device_name)
for id in devices:
self._dev = self._bus.get(SERVICE_BUS, DEVICE_PATH + '/%s' % id)
if device_name == self._dev.name:
return id
return None
def _debug(self, text):
if self.debug:
print(text)
def _print(self, text):
if self.terminal:
print(text)
def _merge(self, notifies):
merged = []
for notif in notifies:
found = None
sep = notif['text'].find('‐')
title = notif['app_name']
body = {
'text': notif['text'][:sep-1],
'desc': '<i>' + notif['text'][sep+2:] + '</i>'
}
#.........這裏部分代碼省略.........