| Home | Trees | Index | Help |
|---|
| Package ocempgui :: Package widgets :: Module GenericDialog :: Class GenericDialog |
|
object--+ |INotifyable--+ |BaseObject--+ |object--+ | | |Sprite--+ |BaseWidget--+ |Bin--+ |Window--+ |DialogWindow--+ | GenericDialog
FileDialog
GenericDialog (title, buttons, results) -> GenericDialog
A generic dialog window, which supports result values.
The GenericDialog widget class is suitable to create dialog windows
which need to check for certain dialog results in an easy
way. Specific result values can be bound to the buttons of the
dialog and will be emitted upon clicking the buttons.
The creation of the GenericDialog is a bit different from other
widgets. Besides the title, it receives two lists for the buttons to
display and the results they have to send. Both lists need to have
the same length.
dialog = GenericDialog ('Test', [Button ('OK'), Button ('Cancel')],
[DLGRESULT_OK, DLGRESULT_CANCEL])
The index of the result values need to match the index of the
button, that should emit them. Of course the buttons can be changed
at runtime programmatically with the set_buttons() method, which is
similar to the constructor.
dialog.set_buttons ([Button ('Close'), Button ('ClickMe')],
[DLGRESULT_CLOSE, DLGRESULT_USER])
The result values to set must match a valid value from the
DLGRESULT_TYPES tuple.
Given the above set_buttons() example, a callback for the
SIG_DIALOGRESPONSE signal will receive either the DLGRESULT_CLOSE or
DLGRESULT_USER value upon which certain actions can take place.
def dialog_callback (result, dialog):
if result == DLGRESULT_CLOSE:
dialog.destroy ()
elif result == DLGRESULT_USER:
...
mydialog.connect_signal (SIG_DIALOGRESPONSE, dialog_callback, mydialog)
The GenericDialog is separated in several frames, to which user
content can be added. The main frame, which holds anything else, can
be accessed through the 'main' attribute. While it is possible to
change most of its attributes without unwanted side effects, its
children should not be modifed or deleted to prevent misbehaviour of
the dialog.
dialog.main.spacing = 10
The second frame, which is usually the most interesting is the
content frame, packed into the main frame. It can be accessed
through the 'content' attribute and should (only) be used to add own
widgets. Those can be deleted and modified, too.
label = Label ('Label on the dialog')
dialog.content.add_child (label)
dialog.content.add_child (Button ('Button after label'))
dialog.content.remove_child (label)
Default action (invoked by activate()):
See the DialogWindow class.
Mnemonic action (invoked by activate_mnemonic()):
See the DialogWindow class.
Signals:
SIG_DIALOGRESPONSE - Invoked, when an attached button is pressed.
| Method Summary | |
|---|---|
__init__(self,
title,
buttons,
results)
| |
G.set_buttons (buttons. | |
| Inherited from DialogWindow | |
D.destroy () -> None | |
D.set_event_manager (...) -> None | |
| Inherited from Window | |
W.dispose_widget (...) -> int, int | |
W.draw () -> None | |
W.draw_bg () -> Surface | |
W.notify (event) -> None | |
W.set_align (...) -> None | |
W.set_focus (...) -> None | |
W.set_title (...) -> None | |
| Inherited from Bin | |
B.set_child (...) -> None | |
B.set_depth (...) -> None | |
B.set_indexable (...) -> None | |
B.set_padding (...) -> None | |
B.set_sensitive (...) -> None | |
B.update (...) -> None | |
| Inherited from BaseWidget | |
W.activate () -> None | |
W.activate_mnemonic (...) -> bool | |
W.check_sizes (...) -> int, int | |
W.create_style () -> WidgetStyle | |
For debugging usage only | |
W.get_style () -> WidgetStyle | |
B.initclass () -> None (Class method) | |
W.lock () -> None | |
W.rect_to_client (...) -> pygame.Rect | |
W.set_dirty (...) -> None | |
W.set_entered (...) -> None | |
W.set_event_area (...) -> None | |
W.set_index (...) -> None | |
W.set_maximum_size (...) -> None | |
W.set_minimum_size (...) -> None | |
W.set_opacity (...) -> None | |
W.set_position (...) -> None | |
W.set_size (...) -> None | |
W.set_state (...) -> None | |
W.set_style (...) -> None | |
W.set_tooltip (...) -> None | |
W.unlock () -> None | |
| Inherited from BaseObject | |
B.connect_signal (...) -> EventCallback | |
B.disconnect_signal (...) -> None | |
B.emit (...) -> bool | |
B.run_signal_handlers (...) -> None | |
| Inherited from Sprite | |
| |
add(group or list of of groups, ...) add a sprite to container | |
| |
alive() -> bool check to see if the sprite is in any groups | |
groups() -> list of groups list used sprite containers | |
kill() remove this sprite from all groups | |
remove(group or list of groups, ...) remove a sprite from container | |
| |
| Inherited from object | |
x.__delattr__('name') <==> del x.name | |
x.__getattribute__('name') <==> x.name | |
x.__hash__() <==> hash(x) | |
T.__new__(S, ...) -> a new object with type S, a subtype of T | |
helper for pickle | |
helper for pickle | |
x.__setattr__('name', value) <==> x.name = value | |
x.__str__() <==> str(x) | |
| Property Summary | |
|---|---|
content: The content frame to add widgets to. | |
main: The main frame of the dialog. | |
| Inherited from Window | |
align: The alignment of the child. | |
title: The title caption of the Window. | |
| Inherited from Bin | |
child: The widget hold by the Bin. | |
padding: Additional padding between child and borders. | |
| Inherited from BaseWidget | |
bottom | |
bottomleft | |
bottomright | |
center | |
centerx | |
centery | |
controls: Widgets associated with the widget. | |
depth: The z-axis layer depth of the widget. | |
dirty: Indicates, whether the widget need to be redrawn. | |
entered: Indicates, whether the widget is entered. | |
eventarea: The area, which gets the events. | |
focus: The focus of the widget. | |
h | |
height | |
image: The visible surface of the widget. | |
index: The tab index position of the widget. | |
indexable: The IIndexable, the widget is attached to. | |
left | |
locked: Indicates, whether the widget is locked. | |
maxsize: The maximum size to occupy by the widget. | |
midbottom | |
midleft | |
midright | |
midtop | |
minsize: The guaranteed size of the widget. | |
opacity: The opacity of the widget. | |
position: The position of the topleft corner. | |
rect: The area occupied by the widget. | |
right | |
sensitive: The sensitivity of the widget. | |
size | |
state: The current state of the widget. | |
style: The style of the widget. | |
tooltip: The tool tip text to display for the widget. | |
top | |
topleft | |
topright | |
w | |
width | |
x | |
y | |
| Inherited from BaseObject | |
manager: The event manager to use by the object. | |
| Instance Method Details |
|---|
set_buttons(self, buttons, results)G.set_buttons (buttons. results) -> None Sets the buttons for the dialog and their wanted result values. |
| Property Details |
|---|
contentThe content frame to add widgets to.
|
mainThe main frame of the dialog.
|
| Home | Trees | Index | Help |
|---|
| Generated by Epydoc 2.1 on Thu Jan 10 10:18:43 2008 | http://epydoc.sf.net |