Module eagle :: Class App
[show private | hide private]
[frames | no frames]

Type App

object --+    
         |    
 _EGObject --+
             |
object --+   |
         |   |
 AutoGenId --+
             |
            App


An application window.

This is the base of Eagle programs, since it will hold every graphical component.

An App window is split in 5 areas:

the first 3 have a vertical layout, the other have horizontal layout. Every area has its own scroll bars that are shown automatically when need.

Also provided is an extra area, that is shown in another window. This is the preferences area. It have a vertical layout and components that hold data are made persistent automatically. You should use PreferencesButton to show this area.

Extra information like author, description, help, version, license and copyright are used in specialized dialogs. You may show these dialogs with AboutButton and HelpButton.

Widgets can be reach with get_widget_by_id, example:
>>> app = App( "My App", left=Entry( id="entry" ) )
>>> app.get_widget_by_id( "entry" )
Entry( id='entry', label='entry', value='' )
You may also reach widgets using dict-like syntax, but with the special case for widgets that hold data, these will be provided using their set_data and get_data, it make things easier, but be careful to don't misuse it!. Example:
>>> app= App( "My App", left=Entry( id="entry" ),
...           right=Canvas( "canvas", 300, 300 ) )
>>> app[ "entry" ]
''

>>> app[ "entry" ] = "text"
>>> app[ "entry" ]
'text'

>>> app[ "canvas" ]
Canvas( id='canvas', width=300, height=300, label='' )

>>> app[ "canvas" ].draw_text( "hello" )
>>> app[ "entry" ].get_value() # will fail, since it's a data widget

Method Summary
  __init__(self, title, id, center, left, right, top, bottom, preferences, quit_callback, data_changed_callback, author, description, help, version, license, copyright)
App Constructor.
  __add_to_app_list__(self)
  __add_widget__(self, widget)
  __delete_event__(self, *args)
  __get_window__(self)
  __getitem__(self, name)
  __persistence_filename__(self)
  __setitem__(self, name, value)
  __setup_connections__(self)
  __setup_gui__(self)
  __setup_gui_bottom__(self)
  __setup_gui_center__(self)
  __setup_gui_left__(self)
  __setup_gui_preferences__(self)
  __setup_gui_right__(self)
  __setup_gui_top__(self)
  close(self)
Close application window.
  data_changed(self, widget, value)
Notify that widget changed it's value.
  file_chooser(self, action, filename, filter, multiple)
Show FileChooser and return selected file(s).
  get_widget_by_id(self, widget_id)
Return referece to widget with provided id or None if not found.
  load(self)
Load data to widgets from file.
  save(self)
Save data from widgets to file.
  show_about_dialog(self)
Show AboutDialog of this App.
  show_help_dialog(self)
Show HelpDialog of this App.
  show_preferences_dialog(self)
Show PreferencesDialog associated with this App.
    Inherited from _EGObject
  __repr__(self)
  __str__(self)
    Inherited from AutoGenId
  __get_id__(classobj)
(Class method)
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value

Property Summary
  bottom
  center
  left
  preferences
  right
  title
  top
  _widgets
    Inherited from _EGObject
  id

Class Variable Summary
int border_width = 10                                                                    
int spacing = 3                                                                     
    Inherited from AutoGenId
int last_id_num = 0                                                                     

Instance Method Details

__init__(self, title, id=None, center=None, left=None, right=None, top=None, bottom=None, preferences=None, quit_callback=None, data_changed_callback=None, author=None, description=None, help=None, version=None, license=None, copyright=None)
(Constructor)

App Constructor.
Parameters:
title - application name, to be displayed in the title bar.
id - unique id to this application, or None to generate one automatically.
center - list of widgets to be laid out vertically in the window's center.
left - list of widgets to be laid out vertically in the window's left side.
right - list of widgets to be laid out vertically in the window's right side.
top - list of widgets to be laid out horizontally in the window's top.
bottom - list of widgets to be laid out horizontally in the window's bottom.
preferences - list of widgets to be laid out vertically in another window, this can be shown with PreferencesButton.
quit_callback - function (or list of functions) that will be called when application is closed. Function will receive as parameter the reference to App.
data_changed_callback - function (or list of functions) that will be called when some widget that holds data have its data changed. Function will receive as parameters:
  • App reference
  • Widget reference
  • new value
author - the application author or list of author, used in AboutDialog, this can be shown with AboutButton.
description - application description, used in AboutDialog.
help - help text, used in AboutDialog and HelpDialog, this can be shown with HelpButton.
version - application version, used in AboutDialog.
license - application license, used in AboutDialog.
copyright - application copyright, used in AboutDialog.
Overrides:
eagle._EGObject.__init__

close(self)

Close application window.

data_changed(self, widget, value)

Notify that widget changed it's value.

Probably you will not need to call this directly.

file_chooser(self, action, filename=None, filter=None, multiple=False)

Show FileChooser and return selected file(s).
Parameters:
action - must be one of ACTION_* as defined in FileChooser.
filter - a pattern (ie: '*.png'), mime type or a list.

See Also: FileChooser

get_widget_by_id(self, widget_id)

Return referece to widget with provided id or None if not found.

load(self)

Load data to widgets from file.

Probably you will not need to call this directly.

save(self)

Save data from widgets to file.

Probably you will not need to call this directly.

show_about_dialog(self)

Show AboutDialog of this App.

show_help_dialog(self)

Show HelpDialog of this App.

show_preferences_dialog(self)

Show PreferencesDialog associated with this App.

Property Details

bottom

Get Method:
get(...)
Set Method:
set(...)

center

Get Method:
get(...)
Set Method:
set(...)

left

Get Method:
get(...)
Set Method:
set(...)

preferences

Get Method:
get(...)
Set Method:
set(...)

right

Get Method:
get(...)
Set Method:
set(...)

title

Get Method:
get(...)
Set Method:
set(...)

top

Get Method:
get(...)
Set Method:
set(...)

_widgets

Get Method:
get(...)
Set Method:
set(...)

Class Variable Details

border_width

Type:
int
Value:
10                                                                    

spacing

Type:
int
Value:
3                                                                     

Generated by Epydoc 2.1 on Sun Dec 25 16:27:52 2005 http://epydoc.sf.net