Commit 2da547e3 authored by Devaev Maxim's avatar Devaev Maxim

dbus_tools and tools now a tools packages

parent 72bd102f
...@@ -9,8 +9,8 @@ import abc ...@@ -9,8 +9,8 @@ import abc
import const import const
import config import config
import shared import shared
import dbus_tools
import logger import logger
import tools.dbus
from service_decorators import * from service_decorators import *
...@@ -77,7 +77,7 @@ class CustomObject(dbus.service.Object) : ...@@ -77,7 +77,7 @@ class CustomObject(dbus.service.Object) :
def build_path(shared) : def build_path(shared) :
if shared != None : if shared != None :
path = build_path(shared.parentShared()) path = build_path(shared.parentShared())
return ( shared.name() if path == None else dbus_tools.joinMethod(path, shared.name()) ) return ( shared.name() if path == None else tools.dbus.joinMethod(path, shared.name()) )
return None return None
return build_path(self.shared()) return build_path(self.shared())
...@@ -109,11 +109,11 @@ class CustomObject(dbus.service.Object) : ...@@ -109,11 +109,11 @@ class CustomObject(dbus.service.Object) :
class FunctionObject(CustomObject) : class FunctionObject(CustomObject) :
def __init__(self, object_path, service_object = None) : def __init__(self, object_path, service_object = None) :
CustomObject.__init__(self, dbus_tools.joinPath(config.value(config.APPLICATION_SECTION, "service_path"), CustomObject.__init__(self, tools.dbus.joinPath(config.value(config.APPLICATION_SECTION, "service_path"),
"functions", object_path), service_object) "functions", object_path), service_object)
class ActionObject(CustomObject) : class ActionObject(CustomObject) :
def __init__(self, object_path, service_object = None) : def __init__(self, object_path, service_object = None) :
CustomObject.__init__(self, dbus_tools.joinPath(config.value(config.APPLICATION_SECTION, "service_path"), CustomObject.__init__(self, tools.dbus.joinPath(config.value(config.APPLICATION_SECTION, "service_path"),
"actions", object_path), service_object) "actions", object_path), service_object)
...@@ -7,8 +7,8 @@ import dbus.glib ...@@ -7,8 +7,8 @@ import dbus.glib
import const import const
import config import config
import dbus_tools
import logger import logger
import tools.dbus
##### Private decorators ##### ##### Private decorators #####
...@@ -18,7 +18,7 @@ def tracer(function, statics_list=[0]) : ...@@ -18,7 +18,7 @@ def tracer(function, statics_list=[0]) :
logger.debug("%s%s %s::%s" % ( " "*statics_list[0], logger.debug("%s%s %s::%s" % ( " "*statics_list[0],
str((function.__dict__.has_key("_dbus_is_method") and "Called method") or str((function.__dict__.has_key("_dbus_is_method") and "Called method") or
(function.__dict__.has_key("_dbus_is_signal") and "Emited signal")), (function.__dict__.has_key("_dbus_is_signal") and "Emited signal")),
self.objectPath(), dbus_tools.joinMethod(function._dbus_interface, function.__name__) )) self.objectPath(), tools.dbus.joinMethod(function._dbus_interface, function.__name__) ))
statics_list[0] += 1 statics_list[0] += 1
try : try :
...@@ -55,13 +55,13 @@ def customMethod(interface_name, **kwargs_dict) : ...@@ -55,13 +55,13 @@ def customMethod(interface_name, **kwargs_dict) :
def functionMethod(interface_name, **kwargs_dict) : def functionMethod(interface_name, **kwargs_dict) :
def decorator(function) : def decorator(function) :
return customMethod(dbus_tools.joinMethod(config.value(config.APPLICATION_SECTION, "service_name"), return customMethod(tools.dbus.joinMethod(config.value(config.APPLICATION_SECTION, "service_name"),
"functions", interface_name), **kwargs_dict)(function) "functions", interface_name), **kwargs_dict)(function)
return decorator return decorator
def actionMethod(interface_name, **kwargs_dict) : def actionMethod(interface_name, **kwargs_dict) :
def decorator(function) : def decorator(function) :
return customMethod(dbus_tools.joinMethod(config.value(config.APPLICATION_SECTION, "service_name"), return customMethod(tools.dbus.joinMethod(config.value(config.APPLICATION_SECTION, "service_name"),
"actions", interface_name), **kwargs_dict)(function) "actions", interface_name), **kwargs_dict)(function)
return decorator return decorator
...@@ -74,13 +74,13 @@ def customSignal(interface_name, **kwargs_dict) : ...@@ -74,13 +74,13 @@ def customSignal(interface_name, **kwargs_dict) :
def functionSignal(interface_name, **kwargs_dict) : def functionSignal(interface_name, **kwargs_dict) :
def decorator(function) : def decorator(function) :
return customSignal(dbus_tools.joinMethod(config.value(config.APPLICATION_SECTION, "service_name"), return customSignal(tools.dbus.joinMethod(config.value(config.APPLICATION_SECTION, "service_name"),
"functions", interface_name), **kwargs_dict)(function) "functions", interface_name), **kwargs_dict)(function)
return decorator return decorator
def actionSignal(interface_name, **kwargs_dict) : def actionSignal(interface_name, **kwargs_dict) :
def decorator(function) : def decorator(function) :
return customSignal(dbus_tools.joinMethod(config.value(config.APPLICATION_SECTION, "service_name"), return customSignal(tools.dbus.joinMethod(config.value(config.APPLICATION_SECTION, "service_name"),
"actions", interface_name), **kwargs_dict)(function) "actions", interface_name), **kwargs_dict)(function)
return decorator return decorator
# -*- coding: utf-8 -*-
__all__ = ["dbus", "process"]
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import subprocess import subprocess
import logger from .. import logger
##### Exceptions ##### ##### Exceptions #####
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment