PyMaemo/Python-osso examples: Difference between revisions

From Maemo Wiki
Jump to navigationJump to search
imported>lmoura
Adding OSSO example page
 
imported>amigadave
add link
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== Introduction ==
This document shows some examples of the functionalities available in the [http://maemo.org/packages/view/python-osso/ python-osso package]. See also the [[Documentation/Maemo 5 Developer Guide/Application Development/LibOSSO library|documentation for the libosso]] library.
 
This document shows some examples of the functionalities available in the python-osso package.


== List of examples ==
== List of examples ==


[http://pymaemo.garage.maemo.org/documentation/python_osso_examples/code/osso_examples.tar.gz Download all examples]
[https://garage.maemo.org/svn/pymaemo/wwwold/documentation/python_osso_examples/code/osso_examples.tar.gz Download all examples]


=== Application ===
=== Application ===
Line 11: Line 9:
This example shows how to bring an application to foreground using osso.Application.application_top().
This example shows how to bring an application to foreground using osso.Application.application_top().


* [http://pymaemo.garage.maemo.org/documentation/python_osso_examples/code/application/osso_test_app.py osso_test_app.py] - Application that will be brought to foreground.
* [https://garage.maemo.org/svn/pymaemo/wwwold/documentation/python_osso_examples/code/application/osso_test_app.py osso_test_app.py] - Application that will be brought to foreground.
* [http://pymaemo.garage.maemo.org/documentation/python_osso_examples/code/application/osso_test_app.service osso_test_app.service] - Service file for the target application.
* [https://garage.maemo.org/svn/pymaemo/wwwold/documentation/python_osso_examples/code/application/osso_test_app.service osso_test_app.service] - Service file for the target application.
* [http://pymaemo.garage.maemo.org/documentation/python_osso_examples/code/application/osso_test_sender.py osso_test_sender.py] - Application that will call the OSSO service.
* [https://garage.maemo.org/svn/pymaemo/wwwold/documentation/python_osso_examples/code/application/osso_test_sender.py osso_test_sender.py] - Application that will call the OSSO service.


=== Auto-saving / State Saving ===
=== Auto-saving / State Saving ===
Line 19: Line 17:
These examples show how to use the auto-saving and state saving features from python-osso. Each file is a separate example.
These examples show how to use the auto-saving and state saving features from python-osso. Each file is a separate example.


* [http://pymaemo.garage.maemo.org/documentation/python_osso_examples/code/autosave/osso_test_autosave.py osso_test_autosave.py] - The same objects from the example below, but instead of calling the save function directly, any changes call user_data_changed, and when exiting force_autosave is called.
* [https://garage.maemo.org/svn/pymaemo/wwwold/documentation/python_osso_examples/code/autosave/osso_test_autosave.py osso_test_autosave.py] - The same objects from the example below, but instead of calling the save function directly, any changes call <code>user_data_changed</code>, and when exiting <code>force_autosave</code> is called.
* [http://pymaemo.garage.maemo.org/documentation/python_osso_examples/code/autosave/osso_test_statesaving.py osso_test_statesaving.py] - Creates a gtk.Entry and a gtk.HScale. It saves the state when the application goes to background or exits, restoring the state on the next startup, unless the device resets or is turned off.
* [https://garage.maemo.org/svn/pymaemo/wwwold/documentation/python_osso_examples/code/autosave/osso_test_statesaving.py osso_test_statesaving.py] - Creates a <code>gtk.Entry</code> and a <code>gtk.HScale</code>. It saves the state when the application goes to background or exits, restoring the state on the next startup, unless the device resets or is turned off.


=== Device State ===
=== Device State ===
Line 26: Line 24:
These examples show how to interact with the display and the device.
These examples show how to interact with the display and the device.


* [http://pymaemo.garage.maemo.org/documentation/python_osso_examples/code/device-state/osso_test_device_on.py osso_test_device_on.py] - Requests to turn on the display.
* [https://garage.maemo.org/svn/pymaemo/wwwold/documentation/python_osso_examples/code/device-state/osso_test_device_on.py osso_test_device_on.py] - Requests to turn on the display.
* [http://pymaemo.garage.maemo.org/documentation/python_osso_examples/code/device-state/osso_test_device_blank_pause.py osso_test_device_blank_pause.py] - Requests to do not blank the screen. This will keep the screen on for 60 seconds.
* [https://garage.maemo.org/svn/pymaemo/wwwold/documentation/python_osso_examples/code/device-state/osso_test_device_blank_pause.py osso_test_device_blank_pause.py] - Requests to do not blank the screen. This will keep the screen on for 60 seconds.
* [http://pymaemo.garage.maemo.org/documentation/python_osso_examples/code/device-state/osso_test_device_state_cb.py osso_test_device_state_cb.py] - Registers a callback for device state changes (Offline mode, etc...).
* [https://garage.maemo.org/svn/pymaemo/wwwold/documentation/python_osso_examples/code/device-state/osso_test_device_state_cb.py osso_test_device_state_cb.py] - Registers a callback for device state changes (Offline mode, etc...).


=== Help ===
=== Help ===
These examples show how to use HELP and enable the "?" button in dialogs
These examples show how to use HELP and enable the "?" button in dialogs


* [http://pymaemo.garage.maemo.org/documentation/python_osso_examples/code/helplib/osso_test_help.py osso_test_help.py] - Shows two buttons: one to load a help topic and another to open a dialog with an "?" button in titlebar.
* [https://garage.maemo.org/svn/pymaemo/wwwold/documentation/python_osso_examples/code/helplib/osso_test_help.py osso_test_help.py] - Shows two buttons: one to load a help topic and another to open a dialog with an "?" button in titlebar.
 
=== MIME ===


=== Mime ===
These examples show how use the MIME functions.
These examples show how use the MIME functions.


* [http://pymaemo.garage.maemo.org/documentation/python_osso_examples/code/mime/osso_test_mime_category.py osso_test_mime_category.py] - Prints the category the specified mime type is in.
* [https://garage.maemo.org/svn/pymaemo/wwwold/documentation/python_osso_examples/code/mime/osso_test_mime_category.py osso_test_mime_category.py] - Prints the category the specified mime type is in.
* [http://pymaemo.garage.maemo.org/documentation/python_osso_examples/code/mime/osso_test_mime_default-app.py osso_test_mime_default-app.py] - Prints information about the current default application for the given mime type.
* [https://garage.maemo.org/svn/pymaemo/wwwold/documentation/python_osso_examples/code/mime/osso_test_mime_default-app.py osso_test_mime_default-app.py] - Prints information about the current default application for the given mime type.
* [http://pymaemo.garage.maemo.org/documentation/python_osso_examples/code/mime/osso_test_mime_open.py osso_test_mime_open.py] - Opens an file using the default application for its mime type.
* [https://garage.maemo.org/svn/pymaemo/wwwold/documentation/python_osso_examples/code/mime/osso_test_mime_open.py osso_test_mime_open.py] - Opens an file using the default application for its mime type.
* [http://pymaemo.garage.maemo.org/documentation/python_osso_examples/code/mime/osso_test_mime_icons.py osso_test_mime_icons.py] - Shows icons associated with a given mime type.
* [https://garage.maemo.org/svn/pymaemo/wwwold/documentation/python_osso_examples/code/mime/osso_test_mime_icons.py osso_test_mime_icons.py] - Shows icons associated with a given mime type.


=== Plugin ===
=== Plugin ===
This example shows how to load plugins.
This example shows how to load plugins.


* [http://pymaemo.garage.maemo.org/documentation/python_osso_examples/code/plugin/test_plugin_app.py test_plugin_app.py] - Loads the test plugin.
* [https://garage.maemo.org/svn/pymaemo/wwwold/documentation/python_osso_examples/code/plugin/test_plugin_app.py test_plugin_app.py] - Loads the test plugin.
* [http://pymaemo.garage.maemo.org/documentation/python_osso_examples/code/plugin/testplugin.c testplugin.c] - Test plugin.
* [https://garage.maemo.org/svn/pymaemo/wwwold/documentation/python_osso_examples/code/plugin/testplugin.c testplugin.c] - Test plugin.
* [http://pymaemo.garage.maemo.org/documentation/python_osso_examples/code/plugin/testplugin.desktop testplugin.desktop] - Desktop file for the test plugin.
* [https://garage.maemo.org/svn/pymaemo/wwwold/documentation/python_osso_examples/code/plugin/testplugin.desktop testplugin.desktop] - Desktop file for the test plugin.


=== RPC ===
=== RPC ===
These examples show how to make remote procedure calls using python-osso.
These examples show how to make remote procedure calls using python-osso.


* [http://pymaemo.garage.maemo.org/documentation/python_osso_examples/code/rpc/osso_test_sender.py osso_test_sender.py] - GUI app that requests a service from the target app.
* [https://garage.maemo.org/svn/pymaemo/wwwold/documentation/python_osso_examples/code/rpc/osso_test_sender.py osso_test_sender.py] - GUI app that requests a service from the target app.
* [http://pymaemo.garage.maemo.org/documentation/python_osso_examples/code/rpc/osso_test_receiver.py osso_test_receiver.py] - Sample service that will be called by osso_test_sender.py
* [https://garage.maemo.org/svn/pymaemo/wwwold/documentation/python_osso_examples/code/rpc/osso_test_receiver.py osso_test_receiver.py] - Sample service that will be called by <code>osso_test_sender.py</code>


=== Status Bar ===
=== Status Bar ===
Line 60: Line 62:
This example shows how to send events to status bar applets.
This example shows how to send events to status bar applets.


* [http://pymaemo.garage.maemo.org/documentation/python_osso_examples/code/statusbar/osso_test_statusbar.py osso_test_statusbar.py] - Requests the display applet to change the display brightness.
* [https://garage.maemo.org/svn/pymaemo/wwwold/documentation/python_osso_examples/code/statusbar/osso_test_statusbar.py osso_test_statusbar.py] - Requests the display applet to change the display brightness.


=== System Note ===
=== System Note ===


These examples show how to use notification dialogs with applications that run without gui.
These examples show how to use notification dialogs with applications that run without GUI.


* [http://pymaemo.garage.maemo.org/documentation/python_osso_examples/code/systemnote/osso_test_note_dialog.py osso_test_note_dialog.py] - Shows a dialog note.
* [https://garage.maemo.org/svn/pymaemo/wwwold/documentation/python_osso_examples/code/systemnote/osso_test_note_dialog.py osso_test_note_dialog.py] - Shows a dialog note.
* [http://pymaemo.garage.maemo.org/documentation/python_osso_examples/code/systemnote/osso_test_note_infoprint.py osso_test_note_infoprint.py] - Shows an information banner.
* [https://garage.maemo.org/svn/pymaemo/wwwold/documentation/python_osso_examples/code/systemnote/osso_test_note_infoprint.py osso_test_note_infoprint.py] - Shows an information banner.


=== Time Notification ===
=== Time Notification ===
This example registers a callback and tries to set the system time. Notice: Currently this won't change the time. (Even in C).
This example registers a callback and tries to set the system time. Notice: Currently this won't change the time. (Even in C).


* [http://pymaemo.garage.maemo.org/documentation/python_osso_examples/code/timenotification/osso_test_timenotification.py osso_test_note_timenotification.py]
* [https://garage.maemo.org/svn/pymaemo/wwwold/documentation/python_osso_examples/code/timenotification/osso_test_timenotification.py osso_test_note_timenotification.py]
 
== References ==


[6] Debian New Maintainers' Guide: [http://www.us.debian.org/doc/maint-guide/]
[[Category:Python]]

Latest revision as of 09:50, 25 October 2010

This document shows some examples of the functionalities available in the python-osso package. See also the documentation for the libosso library.

List of examples

Download all examples

Application

This example shows how to bring an application to foreground using osso.Application.application_top().

Auto-saving / State Saving

These examples show how to use the auto-saving and state saving features from python-osso. Each file is a separate example.

  • osso_test_autosave.py - The same objects from the example below, but instead of calling the save function directly, any changes call user_data_changed, and when exiting force_autosave is called.
  • osso_test_statesaving.py - Creates a gtk.Entry and a gtk.HScale. It saves the state when the application goes to background or exits, restoring the state on the next startup, unless the device resets or is turned off.

Device State

These examples show how to interact with the display and the device.

Help

These examples show how to use HELP and enable the "?" button in dialogs

  • osso_test_help.py - Shows two buttons: one to load a help topic and another to open a dialog with an "?" button in titlebar.

MIME

These examples show how use the MIME functions.

Plugin

This example shows how to load plugins.

RPC

These examples show how to make remote procedure calls using python-osso.

Status Bar

This example shows how to send events to status bar applets.

System Note

These examples show how to use notification dialogs with applications that run without GUI.

Time Notification

This example registers a callback and tries to set the system time. Notice: Currently this won't change the time. (Even in C).