Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
settingsd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
settingsd
Commits
b6d81a29
Commit
b6d81a29
authored
Sep 07, 2010
by
Devaev Maxim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
API for removing shared objects
parent
23d6012b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
3 deletions
+20
-3
hello.py
functions/hello.py
+6
-0
service.py
settingsd/service.py
+6
-1
shared.py
settingsd/shared.py
+8
-2
No files found.
functions/hello.py
View file @
b6d81a29
import
sys
sys
.
path
.
append
(
".."
)
# path hook
import
settingsd.service
import
settingsd.shared
class
Hello
(
settingsd
.
service
.
FunctionObject
)
:
...
...
@@ -16,6 +17,11 @@ class Hello(settingsd.service.FunctionObject) :
def
dump
(
self
)
:
return
str
(
self
)
@settingsd.service.customMethod
(
"org.liksys.settingsd"
)
def
die
(
self
)
:
settingsd
.
shared
.
Functions
.
Hello
.
removeFromConnection
()
settingsd
.
shared
.
Functions
.
removeSharedObject
(
"Hello"
)
class
Requisites
(
settingsd
.
service
.
Requisites
)
:
@classmethod
def
serviceName
(
self
)
:
...
...
settingsd/service.py
View file @
b6d81a29
...
...
@@ -34,7 +34,6 @@ class Service(object) :
def
init
(
self
)
:
pass
@abc.abstractmethod
def
close
(
self
)
:
pass
...
...
@@ -49,6 +48,12 @@ class CustomObject(dbus.service.Object) :
def
objectPath
(
self
)
:
self
.
_object_path
def
addToConnection
(
self
,
connection
=
None
,
path
=
None
)
:
self
.
add_to_connection
(
connection
,
path
)
def
removeFromConnection
(
self
,
conneciton
=
None
,
path
=
None
)
:
self
.
remove_from_connection
(
conneciton
,
path
)
class
FunctionObject
(
CustomObject
)
:
def
__init__
(
self
,
object_path
)
:
CustomObject
.
__init__
(
self
,
dbus_tools
.
joinPath
(
config
.
value
(
"service"
,
"path"
),
"functions"
,
object_path
))
...
...
settingsd/shared.py
View file @
b6d81a29
...
...
@@ -5,6 +5,9 @@
class
SharedConflict
(
Exception
)
:
pass
class
SharedNotExist
(
Exception
)
:
pass
#####
class
SharedMeta
(
type
)
:
...
...
@@ -19,8 +22,11 @@ class SharedMeta(type) :
setattr
(
cls
,
shared_object_name
,
shared_object
)
def
removeSharedObject
(
cls
,
shared_object_name
)
:
if
cls
.
_shared_objects_dict
.
has_key
(
shared_object_name
)
:
cls
.
_shared_objects_dict
.
pop
(
shared_object_name
)
if
not
cls
.
_shared_objects_dict
.
has_key
(
shared_object_name
)
:
raise
SharedNotExist
(
"Shared
\"
%
s
\"
does not exist in collection
\"
%
s
\"
"
%
(
shared_object_name
,
cls
.
__name__
))
cls
.
_shared_objects_dict
.
pop
(
shared_object_name
)
delattr
(
cls
,
shared_object_name
)
def
hasSharedObject
(
cls
,
shared_object
)
:
return
(
shared_object
in
cls
.
_shared_objects_dict
.
keys
()
or
shared_object
in
cls
.
_shared_objects_dict
.
values
()
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment