Personal tools
 
Document Actions

Class "sys"

Functions providing access to system services

Thierry Nancy

This tutorial provides functions and parameters description while illustrating each item with examples
Page 7 of 8.

Functions List

   1.7) Class : tux.sys
1.7.1) Function : tux.sys.add_time_event
1.7.2) Function : tux.sys.clear_time_events
1.7.3) Function : tux.sys.delayed_function
1.7.4) Function : tux.sys.looped_function
1.7.5) Function : tux.sys.shell
1.7.6) Function : tux.sys.shell_free
1.7.7) Function : tux.sys.time
1.7.8) Function : tux.sys.wait

Functions Details


Class : tux.sys

1.7.1) Function : tux.sys.add_time_event

Add a time event in the time event handler

Parameters:
"cmd_type" as number : Command type (CT_SHELL|CT_FUNCTION)
"cmd" as string : Command to execute
"year" as integer : (ex : 2006) (9999 : parameter ignored)
"month" as integer : (ex : 12) (99 : parameter ignored)
"day" as integer : (ex : 23) (99 : parameter ignored)
"hour" as integer : (ex : 08) (99 : parameter ignored)
"minute" as integer : (ex : 55) (99 : parameter ignored)
"second" as integer : (ex : 30) (99 : parameter ignored)

Example:
>>> tux.sys.add_time_event(CT_SHELL,'xmms',9999,99,99,8,5,0)

1.7.2) Function : tux.sys.clear_time_events

Clear the time events of the time event handle

Example:
>>> tux.sys.clear_time_events()

1.7.3) Function : tux.sys.delayed_function

To execute a function with a delay

Parameters:
"function" as pointer of function : function to execute
"delay" as float : time to wait before executing
the function. In seconds

Example:
>>> def test():
... print "hello world"
...
>>> tux.sys.delayed_function(test,10)

1.7.4) Function : tux.sys.looped_function

Looping on a function with a delay

Parameters:
"function" as pointer of function: function to execute
"delay" as float : time to wait between 2 executions
of the function. In seconds

Example:
>>> def test():
... print "hello world"
... return True
...
>>> tux.sys.looped_function(test,10)

Comment:
While the return of the function is true, the loop remains
active

1.7.5) Function : tux.sys.shell

Execute a shell command

Parameters:
"command" as string : Shell command

Example:
>>> tux.sys.shell('ls -al')

1.7.6) Function : tux.sys.shell_free

Execute a shell command in free mode

Parameters:
"command" as string : Shell command

Example:
>>> tux.sys.shell_free('ls -al')

1.7.7) Function : tux.sys.time

Get the current time in seconds

Return an integer

Example:
>>> var=tux.sys.time()

1.7.8) Function : tux.sys.wait

Wait a time in seconds

Parameters:
"seconds" as float : Time to wait in seconds

Example:
>>> tux.sys.wait(2.4)


 
by Thierry Nancy last modified 2007-05-02 16:16
Contributors: Rémi Jocaille, Thierry Nancy
You are here: Home Documentation Tutorials Tux API Documentation Class "sys"

Powered by Plone CMS, the Open Source Content Management System