Python: package rox

rox | index

`To use ROX-Lib2 you need to copy the findrox.py script into your application
directory and import that before anything else. This module will locate
ROX-Lib2 and add ROX-Lib2/python to sys.path. If ROX-Lib2 is not found, it
will display a suitable error and quit.
Since the name of the gtk2 module can vary, it is best to import it from rox,
where it is named 'g'.
The AppRun script of a simple application might look like this:
import findrox
import rox
window = rox.Window()
window.set_title('My window')
window.show()
rox.mainloop()
This program creates and displays a window. The rox.Window widget keeps
track of how many toplevel windows are open. rox.mainloop() will return
when the last one is closed.
Other useful values from this module are:
TRUE and FALSE (copied from g.TRUE and g.FALSE as a convenience), and
'app_dir', which is the absolute pathname of your application (extracted from
sys.argv).`

Package Contents
`` |  |
Menu OptionsBox applet | choices debug filer | i18n loading mime | options processes saving

Classes
`` |  | gtk.Button(gtk.Bin) ButtonMixed gtk.Dialog(gtk.Window) Dialog gtk.Window(gtk.Bin) Window
class ButtonMixed(gtk.Button)
`` | `A button with a standard stock icon, but any label. This is useful when you want to express a concept similar to one of the stock ones.`
| Methods defined here: __init__(self, stock, message) `Specify the icon and text for the new button. The text may specify the mnemonic for the widget by putting a _ before the letter, eg: button = ButtonMixed(g.STOCK_DELETE, '_Delete message').`
class Dialog(gtk.Dialog)
`` | `This works in exactly the same way as a GtkDialog, except that it calls the toplevel_(un)ref functions for you automatically.`
| Methods defined here: __init__(*args, **kwargs)
class Window(gtk.Window)
`` | `This works in exactly the same way as a GtkWindow, except that it calls the toplevel_(un)ref functions for you automatically.`
| Methods defined here: __init__(*args, **kwargs)

Functions
`` |  | alert(message) `Display message in an error box. Return when the user closes the box.` confirm(message, stock_icon, action=None) `Display a <Cancel>/<Action> dialog. Result is true if the user chooses the action, false otherwise. If action is given then that is used as the text instead of the default for the stock item. Eg: if rox.confirm('Really delete everything?', g.STOCK_DELETE): delete()` croak(message) `Display message in an error box, then quit the program, returning with a non-zero exit status.` edit_options(options_file=None) `Edit the app_options (set using setup_app_options()) using the GUI specified in 'options_file' (default <app_dir>/Options.xml). If this function is called again while the box is still open, the old box will be redisplayed to the user.` get_local_path(uri) `Convert 'uri' to a local path and return, if possible. If 'uri' is a resource on a remote machine, return None.` info(message) `Display informational message. Returns when the user closes the box.` mainloop() `This is a wrapper around the gtk2.mainloop function. It only runs the loop if there are top level references, and exits when rox.toplevel_unref() reduces the count to zero.` our_host_name() `Try to return the canonical name for this computer. This is used in the drag-and-drop protocol to work out whether a drop is coming from a remote machine (and therefore has to be fetched differently).` report_exception() `Display the current python exception in an error box, returning when the user closes the box. This is useful in the 'except' clause of a 'try' block. Uses rox.debug.show_exception().` setup_app_options(program, leaf='Options.xml') `Most applications only have one set of options. This function can be used to set up the default group. 'program' is the name of the directory to use in <Choices> and 'leaf' is the name of the file used to store the group. You can refer to the group using rox.app_options. See rox.options.OptionGroup.` toplevel_ref() `Increment the toplevel ref count. rox.mainloop() won't exit until toplevel_unref() is called the same number of times.` toplevel_unref(*unused) `Decrement the toplevel ref count. If this is called while in rox.mainloop() and the count has reached zero, then rox.mainloop() will exit. Ignores any arguments passed in, so you can use it easily as a callback function.`