Merge pull request 'simple-repo' (#1) from simple-repo into master
Reviewed-on: #1
This commit is contained in:
commit
8f3e40f190
1 changed files with 140 additions and 126 deletions
|
@ -32,7 +32,12 @@ except:
|
|||
|
||||
import dbus
|
||||
import dbus.service
|
||||
import dbus.glib
|
||||
# deprecated
|
||||
#import dbus.glib
|
||||
# replaces by this 2 lines
|
||||
from dbus.mainloop.glib import DBusGMainLoop
|
||||
DBusGMainLoop(set_as_default=True)
|
||||
|
||||
from mkbackup.system_notification_emitter import Emitter
|
||||
from mkbackup.mkbackup_emitter import Emitter as EM
|
||||
|
||||
|
@ -43,6 +48,10 @@ from mkbackup.mkbackup_btrfs_config import __version__ as confversion
|
|||
__author__ = "Jakobus Schürz <jakob@schuerz.at>"
|
||||
__version__ = "1.01.0"
|
||||
|
||||
class EmDBUSDesktop(EM):
|
||||
def __init__(self):
|
||||
super().__init__(conn=dbus.SystemBus(), object_path='/at/xundeenergie/notifications/advanced')
|
||||
|
||||
class Notification(Emitter):
|
||||
def __init__(self):
|
||||
super().__init__(conn=dbus.SystemBus(), object_path='/at/xundeenergie/notifications/advanced/Notification')
|
||||
|
@ -1667,19 +1676,18 @@ def restore(args):
|
|||
#class desktop_notification:
|
||||
# def __init__(self, args, urgency=1):
|
||||
# self.args = args
|
||||
# self.dbus_path = "/at/xundeenergie/notifications"
|
||||
# self.dbus_iface = "at.xundeenergie.notifications.advanced"
|
||||
# self.dbus_busname = "at.xundeenergie.notifications"
|
||||
# self.dbus_path = "/at/xundeenergie/notifications/advanced"
|
||||
# self.dbus_iface = "at.xundeenergie.Notification"
|
||||
# self.timestamp = datetime.datetime.now()
|
||||
# self.time = self.timestamp.strftime('%H:%M:%S')
|
||||
# self.date = self.timestamp.strftime('%d. %B %Y')
|
||||
# self.bus = dbus.SystemBus()
|
||||
# if int(urgency) == 0:
|
||||
# self.signal_name = 'Notification_low'
|
||||
# self.signal_name = 'low'
|
||||
# elif int(urgency) == 1:
|
||||
# self.signal_name = 'Notification_normal'
|
||||
# self.signal_name = 'normal'
|
||||
# else:
|
||||
# self.signal_name = 'Notification_critical'
|
||||
# self.signal_name = 'critical'
|
||||
# print('NO',int(urgency),self.signal_name)
|
||||
#
|
||||
# def send_signal(self, intv='default', *args):
|
||||
|
@ -1695,7 +1703,8 @@ def restore(args):
|
|||
#""" % (self.date, self.time, '\n'.join(args), self.signal_name)
|
||||
# msg['expiration_timeout'] = '-1'
|
||||
# message = dbus.lowlevel.SignalMessage(self.dbus_path, self.dbus_iface, self.signal_name)
|
||||
# message.append(msg)
|
||||
# #message.append(msg)
|
||||
# message.append({'body': 'blafoo'})
|
||||
# self.bus.send_message(message)
|
||||
|
||||
# PARSER
|
||||
|
@ -2009,6 +2018,12 @@ Author: %s""" % (confversion,__version__,__author__))
|
|||
args.mdb = EmDBUS()
|
||||
args.mdb.reset(args.tag)
|
||||
args.mdb.start(args.tag)
|
||||
args.mdbd = EmDBUSDesktop()
|
||||
# msg = dict()
|
||||
# msg['sender'] = "mkbackup"
|
||||
# msg['header'] = "%s-backup" % (args.tag)
|
||||
# msg['body'] = "Start"
|
||||
# args.mdbd.critical(msg)
|
||||
#################################################################
|
||||
## Run action ##
|
||||
#################################################################
|
||||
|
@ -2120,8 +2135,6 @@ snapshots: %s
|
|||
um %s Uhr abgeschlossen.
|
||||
|
||||
%s
|
||||
http://www.google.com
|
||||
<a href="file:///home/jakob/backup">TEST</a>
|
||||
(Ugency: normal)
|
||||
""" % (args.ts.strftime('%Y-%m-%d'), args.ts.strftime('%H:%M:%S'), '\r'.join(volumes))
|
||||
# msg['action'] = dict()
|
||||
|
@ -2132,6 +2145,7 @@ http://www.google.com
|
|||
|
||||
advnotify = Notification()
|
||||
advnotify.normal(msg)
|
||||
args.mdbd.critical(msg)
|
||||
elif args.notification == None:
|
||||
logger.critical("No notification at all")
|
||||
else:
|
||||
|
@ -2154,4 +2168,4 @@ http://www.google.com
|
|||
# msg = """
|
||||
# Hello!""" # The /n separates the message from the headers
|
||||
# server.sendmail("first.recipient@provider1.example", "second.recipient@provider2.example", msg)
|
||||
#
|
||||
#header
|
||||
|
|
Loading…
Reference in a new issue