screenlets.session.ScreenletSession

Package screenlets :: Module session :: Class ScreenletSession |
[hide private]
[frames] | no frames]

# Class ScreenletSession

source code

    object --+
             |
            ScreenletSession

The ScreenletSession manages instances of a Screenlet and handles saving/restoring options. Each Screenlet contains a reference to its session. Multiple instances of the same Screenlet share the same session-object.

Instance Methods | [hide private]
__init__(self, screenlet_classobj, backend_type=`'``caching``'`, name=`'``default``'`) x.__init__(...) initializes x; see help(type(x)) for signature | source code
connect_daemon(self) Connect to org.screenlets.ScreenletsDaemon. | source code
create_instance(self, id=None, **keyword_args) Create a new instance with ID 'id' and add it to this session. | source code
delete_instance(self, id) Delete the given instance with ID 'id' and remove its session file. | source code
get_instance_by_id(self, id) Return the instance with the given id from within this session. | source code
quit_instance(self, id) quit the given instance with ID 'id' | source code
start(self) Start a new session (or restore an existing session) for the current Screenlet-class. | source code
__register_screenlet(self) Create new entry for this session in the global TMP_FILE. | source code
__create_tempdir(self) Create the global temporary file for saving screenlets. | source code
__unregister_screenlet(self, name=None) Delete this session's entry from the gloabl tempfile (and delete the entire file if no more running screenlets are set. | source code
__delete_tempfile(self, name=None) Delete the tempfile for this session. | source code
__get_next_id(self) Get the next ID for an instance of the assigned Screenlet. | source code
__load_instances(self) Check for existing instances in the current session, create them and store them into self.instances if any are found. | source code
__restore_options_from_backend(self, screenlet, filename) Restore and apply a screenlet's options from the backend. | source code
__run_session(self, main_instance) Run the session by calling the main handler of the given Screenlet- instance. | source code
__parse_commandline(self) Check commandline args for "--session" argument and set session name if found. | source code
Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Properties | [hide private]
Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, screenlet_classobj, backend_type=`'``caching``'`, name=`'``default``'`) (Constructor) | source code
x.__init__(...) initializes x; see help(type(x)) for signature Overrides: object.__init__ (inherited documentation)

### create_instance(self, id=None, **keyword_args) | source code
Create a new instance with ID 'id' and add it to this session. The function returns either the new Screenlet-instance or None.

### delete_instance(self, id) | source code
Delete the given instance with ID 'id' and remove its session file. When the last instance within the session is removed, the session dir is completely removed.

### start(self) | source code
Start a new session (or restore an existing session) for the current Screenlet-class. Creates a new instance when none is found. Returns True if everything worked well, else False.

### __create_tempdir(self) | source code
Create the global temporary file for saving screenlets. The file is used for indicating which screnlets are currently running.

### __load_instances(self) | source code
Check for existing instances in the current session, create them and store them into self.instances if any are found. Returns True if at least one instance was found, else False.

### __run_session(self, main_instance) | source code
Run the session by calling the main handler of the given Screenlet- instance. Handles sigkill (?) and keyboard interrupts.

### __parse_commandline(self) | source code
Check commandline args for "--session" argument and set session name if found. Runs only once during __init__. TODO: handle more arguments and maybe allow setting options by commandline