Package horizons :: Package gui :: Module windows :: Class Dialog
[hide private]
[frames] | no frames]

Class Dialog

source code

Window --+
         |
        Dialog

A dialog is very similar to a window, the major difference between the two is that when showing a `Window`, control flow will continue immediately. However the call to show a `Dialog` will only return when the dialog is closed.

Instance Methods [hide private]
 
__init__(self, windows) source code
 
prepare(self, **kwargs)
Setup the dialog gui.
source code
 
act(self, retval)
Do something after dialog is closed.
source code
 
show(self, **kwargs)
Show the window.
source code
 
hide(self)
Hide the window.
source code
 
close(self)
Closes the window.
source code
 
on_escape(self)
Define what happens when ESC is pressed.
source code
 
_on_keypress(self, event)
Intercept ESC and ENTER keys and execute the appropriate actions.
source code
 
trigger_close(self, event_name)
Close the dialog and execute the received event
source code
 
_abort(self, retval=False)
Break out of mainloop.
source code
 
_execute(self)
Execute the dialog synchronously.
source code
    Inherited from Window
 
_hide_modal_background(self) source code
 
_show_modal_background(self)
Loads transparent background that de facto prohibits access to other gui elements by eating all input events.
source code
 
on_return(self)
Define what happens when RETURN is pressed.
source code
 
open(self, **kwargs)
Open the window.
source code
Class Methods [hide private]
 
create_from_widget(cls, dlg, bind, event_map=None, modal=False, focus=None)
Shows any pychan dialog.
source code
Class Variables [hide private]
  modal = False
  focus = None
hash(x)
  return_events = {}
Method Details [hide private]

__init__(self, windows)
(Constructor)

source code 
Overrides: Window.__init__

prepare(self, **kwargs)

source code 

Setup the dialog gui.

The widget has to be stored in `self._gui`. If you want to abort the dialog here return False.

act(self, retval)

source code 
Do something after dialog is closed.

If you want to show the dialog again, you need to do that explicitly, e.g. with:

        self._windows.open(self)

show(self, **kwargs)

source code 

Show the window.

After this call, the window should be visible. You should *never* call this directly in your code.

Overrides: Window.show
(inherited documentation)

hide(self)

source code 

Hide the window.

After this call, the window should not be visible anymore. However, it remains in the stack of open windows and will be visible once it becomes the topmost window again.

You should *never* call this directly in your code, other than in `close()` when you overwrote it in your subclass.

Overrides: Window.hide
(inherited documentation)

close(self)

source code 

Closes the window.

You should *never* call this directly in your code. Use `self._windows.close()` to ask the WindowManager to remove the window instead.

You may override this method in a subclass if you need to do stuff when a window is closed.

Overrides: Window.close
(inherited documentation)

on_escape(self)

source code 

Define what happens when ESC is pressed.

By default, the window will be closed.

Overrides: Window.on_escape
(inherited documentation)

_abort(self, retval=False)

source code 

Break out of mainloop.

Program flow continues after the `self._execute` call in `show`.

_execute(self)

source code 

Execute the dialog synchronously.

This is done by entering a new mainloop in the engine until the dialog is closed (see `abort`).

create_from_widget(cls, dlg, bind, event_map=None, modal=False, focus=None)
Class Method

source code 

Shows any pychan dialog.

Parameters:
  • dlg - dialog that is to be shown
  • bind - events that make the dialog return + return values {'ok': True, 'cancel': False}
  • event_map - dictionary with callbacks for buttons. See pychan docu: pychan.widget.mapEvents()
  • modal - Whether to block user interaction while displaying the dialog
  • focus - Which child widget should take focus