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
11f3ec4d
Commit
11f3ec4d
authored
Oct 08, 2010
by
Devaev Maxim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hieratical structure of shareds with navigation
parent
46e6171e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
8 deletions
+74
-8
service.py
settingsd/service.py
+35
-8
shared.py
settingsd/shared.py
+39
-0
No files found.
settingsd/service.py
View file @
11f3ec4d
...
@@ -58,25 +58,52 @@ class Service(ServiceInterface, ServiceRequisitesInterface) :
...
@@ -58,25 +58,52 @@ class Service(ServiceInterface, ServiceRequisitesInterface) :
#####
#####
class
CustomObject
(
dbus
.
service
.
Object
)
:
class
CustomObject
(
dbus
.
service
.
Object
)
:
def
__init__
(
self
,
object_path
,
s
hared_path
,
servic
e
)
:
def
__init__
(
self
,
object_path
,
s
ervice
=
Non
e
)
:
dbus
.
service
.
Object
.
__init__
(
self
,
config
.
value
(
config
.
RUNTIME_SECTION
,
"bus_name"
),
object_path
)
dbus
.
service
.
Object
.
__init__
(
self
,
config
.
value
(
config
.
RUNTIME_SECTION
,
"bus_name"
),
object_path
)
self
.
_object_path
=
object_path
self
.
_object_path
=
object_path
self
.
_shared_path
=
shared_path
self
.
_service
=
service
self
.
_service
=
service
#####
self
.
_shared
=
None
### Public ###
### Public ###
def
name
(
self
)
:
if
self
.
shared
()
==
None
:
return
None
for
(
shared_object_name
,
shared_object
)
in
self
.
shared
()
.
sharedObjects
()
.
items
()
:
if
shared_object
==
self
:
return
shared_object_name
return
None
def
path
(
self
)
:
def
build_path
(
shared
)
:
if
shared
!=
None
:
path
=
build_path
(
shared
.
parentShared
())
return
(
shared
.
name
()
if
path
==
None
else
dbus_tools
.
joinMethod
(
path
,
shared
.
name
())
)
return
None
return
build_path
(
self
.
shared
())
def
objectPath
(
self
)
:
def
objectPath
(
self
)
:
return
self
.
_object_path
return
self
.
_object_path
def
sharedPath
(
self
)
:
###
return
self
.
_shared_path
def
setService
(
self
,
service
)
:
self
.
_service
=
service
def
service
(
self
)
:
def
service
(
self
)
:
return
self
.
_service
return
self
.
_service
def
setShared
(
self
,
shared
)
:
self
.
_shared
=
shared
def
shared
(
self
)
:
return
self
.
_shared
###
###
def
addToConnection
(
self
,
connection
=
None
,
path
=
None
)
:
def
addToConnection
(
self
,
connection
=
None
,
path
=
None
)
:
...
@@ -87,12 +114,12 @@ class CustomObject(dbus.service.Object) :
...
@@ -87,12 +114,12 @@ class CustomObject(dbus.service.Object) :
class
FunctionObject
(
CustomObject
)
:
class
FunctionObject
(
CustomObject
)
:
def
__init__
(
self
,
object_path
,
s
hared_path
,
servic
e
)
:
def
__init__
(
self
,
object_path
,
s
ervice
=
Non
e
)
:
CustomObject
.
__init__
(
self
,
dbus_tools
.
joinPath
(
config
.
value
(
config
.
APPLICATION_SECTION
,
"service_path"
),
CustomObject
.
__init__
(
self
,
dbus_tools
.
joinPath
(
config
.
value
(
config
.
APPLICATION_SECTION
,
"service_path"
),
"functions"
,
object_path
),
s
hared_path
,
s
ervice
)
"functions"
,
object_path
),
service
)
class
ActionObject
(
CustomObject
)
:
class
ActionObject
(
CustomObject
)
:
def
__init__
(
self
,
object_path
,
s
hared_path
,
servic
e
)
:
def
__init__
(
self
,
object_path
,
s
ervice
=
Non
e
)
:
CustomObject
.
__init__
(
self
,
dbus_tools
.
joinPath
(
config
.
value
(
config
.
APPLICATION_SECTION
,
"service_path"
),
CustomObject
.
__init__
(
self
,
dbus_tools
.
joinPath
(
config
.
value
(
config
.
APPLICATION_SECTION
,
"service_path"
),
"actions"
,
object_path
),
s
hared_path
,
s
ervice
)
"actions"
,
object_path
),
service
)
settingsd/shared.py
View file @
11f3ec4d
...
@@ -21,20 +21,44 @@ class SharedAbstract :
...
@@ -21,20 +21,44 @@ class SharedAbstract :
entity
.
_shareds_dict
=
{}
entity
.
_shareds_dict
=
{}
entity
.
_shared_objects_dict
=
{}
entity
.
_shared_objects_dict
=
{}
#####
entity
.
_parent_shared
=
None
### Public ###
### Public ###
def
setParentShared
(
entity
,
shared
)
:
entity
.
_parent_shared
=
shared
def
parentShared
(
entity
)
:
return
entity
.
_parent_shared
###
def
name
(
entity
)
:
if
entity
.
parentShared
()
==
None
:
return
None
for
(
shared_name
,
shared
)
in
entity
.
parentShared
()
.
shareds
()
.
items
()
:
if
shared
==
entity
:
return
shared_name
return
None
###
def
addShared
(
entity
,
shared_name
)
:
def
addShared
(
entity
,
shared_name
)
:
if
entity
.
_shareds_dict
.
has_key
(
shared_name
)
:
if
entity
.
_shareds_dict
.
has_key
(
shared_name
)
:
raise
SharedsConflict
(
"Shared
\"
%
s
\"
is already exists in collection
\"
%
s
\"
"
%
(
shared_name
,
entity
.
__name__
))
raise
SharedsConflict
(
"Shared
\"
%
s
\"
is already exists in collection
\"
%
s
\"
"
%
(
shared_name
,
entity
.
__name__
))
entity
.
_shareds_dict
[
shared_name
]
=
Shared
()
entity
.
_shareds_dict
[
shared_name
]
=
Shared
()
entity
.
_shareds_dict
[
shared_name
]
.
setParentShared
(
entity
)
setattr
(
entity
,
shared_name
,
entity
.
_shareds_dict
[
shared_name
])
setattr
(
entity
,
shared_name
,
entity
.
_shareds_dict
[
shared_name
])
def
removeShared
(
entity
,
shared_name
)
:
def
removeShared
(
entity
,
shared_name
)
:
if
not
entity
.
_shareds_dict
.
has_key
(
shared_name
)
:
if
not
entity
.
_shareds_dict
.
has_key
(
shared_name
)
:
raise
SharedNotExists
(
"Shared
\"
%
s
\"
does not exist in collection
\"
%
s
\"
"
%
(
shared_name
,
entity
.
__name__
))
raise
SharedNotExists
(
"Shared
\"
%
s
\"
does not exist in collection
\"
%
s
\"
"
%
(
shared_name
,
entity
.
__name__
))
entity
.
_shareds_dict
[
shared_name
]
.
setParentShared
(
None
)
entity
.
_shareds_dict
.
pop
(
shared_name
)
entity
.
_shareds_dict
.
pop
(
shared_name
)
delattr
(
entity
,
shared_name
)
delattr
(
entity
,
shared_name
)
...
@@ -54,12 +78,14 @@ class SharedAbstract :
...
@@ -54,12 +78,14 @@ class SharedAbstract :
raise
SharedObjectsConflict
(
"Shared object
\"
%
s
\"
is already exists in collection
\"
%
s
\"
"
%
(
shared_object_name
,
entity
.
__name__
))
raise
SharedObjectsConflict
(
"Shared object
\"
%
s
\"
is already exists in collection
\"
%
s
\"
"
%
(
shared_object_name
,
entity
.
__name__
))
entity
.
_shared_objects_dict
[
shared_object_name
]
=
shared_object
entity
.
_shared_objects_dict
[
shared_object_name
]
=
shared_object
entity
.
_shared_objects_dict
[
shared_object_name
]
.
setShared
(
entity
)
setattr
(
entity
,
shared_object_name
,
entity
.
_shared_objects_dict
[
shared_object_name
])
setattr
(
entity
,
shared_object_name
,
entity
.
_shared_objects_dict
[
shared_object_name
])
def
removeSharedObject
(
entity
,
shared_object_name
)
:
def
removeSharedObject
(
entity
,
shared_object_name
)
:
if
not
entity
.
_shared_objects_dict
.
has_key
(
shared_object_name
)
:
if
not
entity
.
_shared_objects_dict
.
has_key
(
shared_object_name
)
:
raise
SharedObjectNotExists
(
"Shared object
\"
%
s
\"
does not exist in collection
\"
%
s
\"
"
%
(
shared_object_name
,
entity
.
__name__
))
raise
SharedObjectNotExists
(
"Shared object
\"
%
s
\"
does not exist in collection
\"
%
s
\"
"
%
(
shared_object_name
,
entity
.
__name__
))
entity
.
_shared_objects_dict
[
shared_object_name
]
.
setShared
(
None
)
entity
.
_shared_objects_dict
.
pop
(
shared_object_name
)
entity
.
_shared_objects_dict
.
pop
(
shared_object_name
)
delattr
(
entity
,
shared_object_name
)
delattr
(
entity
,
shared_object_name
)
...
@@ -87,6 +113,19 @@ class Shared(object, SharedAbstract) :
...
@@ -87,6 +113,19 @@ class Shared(object, SharedAbstract) :
class
Functions
(
object
)
:
class
Functions
(
object
)
:
__metaclass__
=
SharedRootMeta
__metaclass__
=
SharedRootMeta
### Public ###
@classmethod
def
name
(
self
)
:
return
"Functions"
class
Actions
(
object
)
:
class
Actions
(
object
)
:
__metaclass__
=
SharedRootMeta
__metaclass__
=
SharedRootMeta
### Public ###
@classmethod
def
name
(
self
)
:
return
"Actions"
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