Commit b88fe79e authored by Devaev Maxim's avatar Devaev Maxim

Refactoring

parent 703b60e2
...@@ -8,6 +8,10 @@ from settingsd import service ...@@ -8,6 +8,10 @@ from settingsd import service
from settingsd import shared from settingsd import shared
##### Private constants #####
SERVICE_NAME = "example"
##### Private classes ##### ##### Private classes #####
class Example(service.FunctionObject) : class Example(service.FunctionObject) :
...@@ -29,8 +33,8 @@ class Example(service.FunctionObject) : ...@@ -29,8 +33,8 @@ class Example(service.FunctionObject) :
@service.customMethod("com.example.settingsd.sharedObject") @service.customMethod("com.example.settingsd.sharedObject")
def die(self) : def die(self) :
self.removeFromConnection() # shared.Functions.Test.Example.removeFromConnection() self.removeFromConnection() # shared.Functions.test.example.removeFromConnection()
self.shared().removeSharedObject(self.name()) # shared.Functions.Test.removeSharedObject("Example") self.shared().removeSharedObject(self.name()) # shared.Functions.test.removeSharedObject("example")
@service.customMethod("com.example.settingsd.sharedObject") @service.customMethod("com.example.settingsd.sharedObject")
def path(self) : def path(self) :
...@@ -50,16 +54,16 @@ class Example(service.FunctionObject) : ...@@ -50,16 +54,16 @@ class Example(service.FunctionObject) :
##### Public classes ##### ##### Public classes #####
class Service(service.Service) : class Service(service.Service) :
def initService(self) : def initService(self) :
shared.Functions.addShared("Test") shared.Functions.addShared("test")
shared.Functions.Test.addSharedObject("Example", Example(self.serviceName(), self)) shared.Functions.test.addSharedObject(SERVICE_NAME, Example(SERVICE_NAME, self))
@classmethod @classmethod
def serviceName(self) : def serviceName(self) :
return "example" return SERVICE_NAME
@classmethod @classmethod
def options(self) : def options(self) :
return [ return [
(self.serviceName(), "hello_string", "Hello, World!", str) (SERVICE_NAME, "hello_string", "Hello, World!", str)
] ]
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