aboutsummaryrefslogtreecommitdiffstats
path: root/backend
diff options
context:
space:
mode:
authorPapoteur <papoteur@mageia.org>2018-10-16 21:39:09 +0200
committerPapoteur <papoteur@mageia.org>2018-10-16 21:48:35 +0200
commit4a9c58c02b6153516c6305093f70c165f7013672 (patch)
treeb9d766ab1464453f643a8196af4888cc3c4307d1 /backend
parentd29ee386825071e1795fd1d30c208bcef29b417d (diff)
downloadisodumper-4a9c58c02b6153516c6305093f70c165f7013672.tar
isodumper-4a9c58c02b6153516c6305093f70c165f7013672.tar.gz
isodumper-4a9c58c02b6153516c6305093f70c165f7013672.tar.bz2
isodumper-4a9c58c02b6153516c6305093f70c165f7013672.tar.xz
isodumper-4a9c58c02b6153516c6305093f70c165f7013672.zip
Add translation management in magiback.
Add logging feature.
Diffstat (limited to 'backend')
-rwxr-xr-xbackend/magiback14
1 files changed, 12 insertions, 2 deletions
diff --git a/backend/magiback b/backend/magiback
index 7f3785b..25eff28 100755
--- a/backend/magiback
+++ b/backend/magiback
@@ -4,10 +4,15 @@ from gi.repository import GLib
from pydbus import SystemBus
import isodumper.raw_write as raw_write
import threading
+import gettext
+import logging
+import sys
+import io
DEAMON_ORG = 'org.mageia.Magiback'
DEAMON_INTERFACE = DEAMON_ORG
ISODUMPER_INTERFACE = DEAMON_ORG + ".Isodumper"
+logging.basicConfig(filename="/var/log/magiback.log",level=logging.DEBUG)
class Isodumper(raw_write.Dumper):
"""
@@ -46,7 +51,12 @@ class Isodumper(raw_write.Dumper):
"""
def __init__(self):
super().__init__()
+ APP="isodumper"
+ DIR="/usr/share/locale"
+ # Call translation catalog
+ gettext.install(APP, localedir=DIR,)
self.finished = threading.Event()
+ self.finished.clear()
self._progress = 0
self.loop = GLib.MainLoop()
self.return_state = False
@@ -55,10 +65,11 @@ class Isodumper(raw_write.Dumper):
self.authorized_sender_write = set()
def do_write(self,source, target, size, dbus_context):
+ self.finished.clear()
if check_permission('org.mageia.Magiback.Isodumper.write',dbus_context):
- self.finished.clear()
self.thread = threading.Thread(target=self._do_write, args=(source, target, size, ))
self.thread.start()
+ logging.debug("Writing thread started")
else:
self.return_message = "Access denied"
self.finished.set()
@@ -146,7 +157,6 @@ class ConfFile(object):
if __name__ == '__main__':
print("Running Magiback service.")
-
bus = SystemBus()
conf_file = ConfFile()
bus.publish(DEAMON_ORG, conf_file,