albow package¶
Submodules¶
albow.controls module¶
-
class
albow.controls.
ButtonBase
[source]¶ Bases:
albow.controls.Control
-
action
= None¶
-
align
= 'c'¶
-
rightClickAction
= None¶
-
-
class
albow.controls.
CheckBox
(**kwds)[source]¶ Bases:
albow.controls.CheckControl
,albow.controls.CheckWidget
-
class
albow.controls.
CheckControl
[source]¶ Bases:
albow.controls.Control
-
class
albow.controls.
CheckWidget
(**kwds)[source]¶ Bases:
albow.widget.Widget
-
border_width
= 1¶
-
check_mark_tweak
= 2¶
-
default_size
= (16, 16)¶
-
margin
= 4¶
-
-
class
albow.controls.
Control
[source]¶ Bases:
object
-
enable
= None¶
-
enabled
¶
-
highlighted
¶
-
ref
= None¶
-
value
¶
-
-
class
albow.controls.
GLLabel
(text, width=None, base_text=None, **kwds)[source]¶ Bases:
albow.controls.Label
-
class
albow.controls.
Image
(image=None, rect=None, prefix='', **kwds)[source]¶ Bases:
albow.widget.Widget
-
highlighted
= False¶
-
image
¶
-
-
class
albow.controls.
Label
(text, width=None, base_text=None, **kwds)[source]¶ Bases:
albow.widget.Widget
-
align
¶
-
enabled
= True¶
-
highlighted
= False¶
-
is_default
= False¶
-
text
¶
-
-
class
albow.controls.
RadioButton
(**kwds)[source]¶ Bases:
albow.controls.RadioControl
,albow.controls.CheckWidget
-
class
albow.controls.
RadioControl
[source]¶ Bases:
albow.controls.Control
-
setting
= None¶
-
-
class
albow.controls.
RotatableImage
(angle=0.0, min_angle=0, max_angle=360, **kwds)[source]¶ Bases:
albow.controls.Image
-
class
albow.controls.
SmallLabel
(text, width=None, base_text=None, **kwds)[source]¶ Bases:
albow.controls.Label
Small text size. See theme.py
-
class
albow.controls.
SmallValueDisplay
(width=100, **kwds)[source]¶ Bases:
albow.controls.ValueDisplay
-
class
albow.controls.
ValueButton
(width=100, **kwds)[source]¶ Bases:
albow.controls.ButtonBase
,albow.controls.ValueDisplay
-
align
= 'c'¶
-
-
class
albow.controls.
ValueDisplay
(width=100, **kwds)[source]¶ Bases:
albow.controls.Control
,albow.controls.Label
-
align
= 'l'¶
-
format
= '%s'¶
-
albow.dialogs module¶
-
class
albow.dialogs.
Dialog
(client=None, responses=None, default=0, cancel=-1, **kwds)[source]¶ Bases:
albow.dialogs.Modal
,albow.widget.Widget
-
click_outside_response
= None¶
-
-
class
albow.dialogs.
QuickDialog
(client=None, responses=None, default=0, cancel=-1, **kwds)[source]¶ Bases:
albow.dialogs.Dialog
Dialog that closes as soon as you click outside or press a key
-
albow.dialogs.
ask
(mess, responses=['OK', 'Cancel'], default=0, cancel=-1, wrap_width=60, **kwds)[source]¶
albow.extended_widgets module¶
-
class
albow.extended_widgets.
ChoiceButton
(choices, scrolling=True, scroll_items=30, **kw)[source]¶ Bases:
albow.controls.ValueButton
-
align
= 'c'¶
-
choices
¶
-
choose
= None¶
-
selectedChoice
¶
-
-
class
albow.extended_widgets.
HotkeyColumn
(items, keysColumn=None, buttonsColumn=None, item_spacing=None, translateButtons=True)[source]¶ Bases:
albow.widget.Widget
-
is_gl_container
= True¶
-
-
class
albow.extended_widgets.
MenuButton
(title, choices, **kw)[source]¶ Bases:
albow.controls.Button
-
albow.extended_widgets.
showProgress
(progressText, progressIterator, cancel=False)[source]¶ Show the progress for a long-running synchronous operation. progressIterator should be a generator-like object that can return either None, for an indeterminate indicator, A float value between 0.0 and 1.0 for a determinate indicator, A string, to update the progress info label or a tuple of (float value, string) to set the progress and update the label
albow.fields module¶
-
class
albow.fields.
Field
(width=None, **kwds)[source]¶ Bases:
albow.controls.Control
,albow.fields.TextEditor
-
empty
= NotImplemented¶
-
enter_passes
= False¶
-
format
= u'%s'¶
-
max
= None¶
-
min
= None¶
-
-
class
albow.fields.
FieldWrapped
(width=None, lines=1, allowed_chars=None, **kwds)[source]¶ Bases:
albow.controls.Control
,albow.fields.TextEditorWrapped
-
empty
= ''¶
-
enter_passes
= False¶
-
format
= u'%s'¶
-
max
= None¶
-
min
= None¶
-
-
class
albow.fields.
FloatField
(width=None, **kwds)[source]¶ Bases:
albow.fields.Field
-
allowed_chars
= '-+.0123456789'¶
-
increment
¶
-
tooltipText
= u'Point here and use mousewheel to adjust'¶
-
type
¶ alias of
float
-
zero
= 1e-12¶
-
-
class
albow.fields.
IntField
(width=None, **kwds)[source]¶ Bases:
albow.fields.Field
-
allowed_chars
= '-+*/<>()0123456789'¶
-
increment
¶
-
tooltipText
= u'Point here and use mousewheel to adjust'¶
-
-
class
albow.fields.
TextEditor
(width, upper=None, **kwds)[source]¶ Bases:
albow.widget.Widget
-
tab_stop
= True¶
-
text
¶
-
upper
= False¶
-
-
class
albow.fields.
TextEditorWrapped
(width, lines, upper=None, allowed_chars=None, **kwds)[source]¶ Bases:
albow.widget.Widget
-
tab_stop
= True¶
-
text
¶
-
textL
= []¶
-
textRefList
= []¶
-
upper
= False¶
-
-
class
albow.fields.
TextField
(width=None, **kwds)[source]¶ Bases:
albow.fields.Field
-
type
¶ alias of
unicode
-
-
class
albow.fields.
TextFieldWrapped
(width=None, lines=1, allowed_chars=None, **kwds)[source]¶ Bases:
albow.fields.FieldWrapped
-
type
¶ alias of
unicode
-
albow.file_dialogs module¶
TODO:
- Implement Windows support.
-
class
albow.file_dialogs.
DirPathView
(width, client, **kwds)[source]¶ Bases:
albow.widget.Widget
-
class
albow.file_dialogs.
FSTree
(client, *args, **kwargs)[source]¶ Bases:
albow.tree.Tree
-
class
albow.file_dialogs.
FileDialog
(prompt=None, suffixes=None, **kwds)[source]¶ Bases:
albow.dialogs.Dialog
-
box_width
= 450¶
-
default_prompt
= None¶
-
directory
¶
-
-
class
albow.file_dialogs.
FileOpenDialog
(prompt=None, suffixes=None, **kwds)[source]¶ Bases:
albow.file_dialogs.FileDialog
-
ok_label
= 'Open'¶
-
pathname
¶
-
saving
= False¶
-
-
class
albow.file_dialogs.
FileSaveDialog
(prompt=None, suffixes=None, **kwds)[source]¶ Bases:
albow.file_dialogs.FileDialog
-
default_prompt
= 'Save as:'¶
-
filename
¶
-
ok_label
= 'Save'¶
-
pathname
¶
-
saving
= True¶
-
-
class
albow.file_dialogs.
LookForFileDialog
(target, **kwds)[source]¶ Bases:
albow.file_dialogs.FileOpenDialog
-
target
= None¶
-
albow.file_opener module¶
-
class
albow.file_opener.
FileOpener
(mcedit, *args, **kwargs)[source]¶ Bases:
albow.widget.Widget
-
is_gl_container
= True¶
-
albow.grid_view module¶
albow.image_array module¶
albow.layout module¶
-
class
albow.layout.
Column
(items, height=None, **kwds)[source]¶ Bases:
albow.layout.RowOrColumn
-
align_map
= {'c': (1, 'midtop', 'midbottom'), 'r': (2, 'topright', 'bottomright'), 'l': (0, 'topleft', 'bottomleft')}¶
-
axis
= 'v'¶
-
crossways
= 'width'¶
-
d
= (0, 1)¶
-
longways
= 'height'¶
-
-
class
albow.layout.
Frame
(client, border_spacing=None, **kwds)[source]¶ Bases:
albow.widget.Widget
-
border_width
= 1¶
-
margin
= 2¶
-
-
class
albow.layout.
Grid
(rows, row_spacing=10, column_spacing=10, **kwds)[source]¶ Bases:
albow.widget.Widget
albow.music module¶
-
class
albow.music.
EnableMusicControl
(**kwds)[source]¶ Bases:
albow.controls.CheckBox
-
class
albow.music.
MusicOptionsDialog
[source]¶ Bases:
albow.dialogs.Dialog
-
class
albow.music.
MusicVolumeControl
(**kwds)[source]¶ Bases:
albow.widget.Widget
-
class
albow.music.
PlayList
(items, random=False, repeat=False)[source]¶ Bases:
object
A collection of music filenames to be played sequentially or randomly. If random is true, items will be played in a random order. If repeat is true, the list will be repeated indefinitely, otherwise each item will only be played once.
-
albow.music.
change_music
(new_music, repeat=False)[source]¶ Fade out any currently playing music and start playing the given music file.
-
albow.music.
change_playlist
(new_playlist)[source]¶ Fade out any currently playing music and start playing from the given playlist.
-
albow.music.
get_music
(*names, **kwds)[source]¶ Return the full pathname of a music file from the “music” resource subdirectory.
albow.openglwidgets module¶
-
class
albow.openglwidgets.
GLOrtho
(rect=None, xmin=-1, xmax=1, ymin=-1, ymax=1, near=-1, far=1, **kwds)[source]¶
-
class
albow.openglwidgets.
GLPixelOrtho
(rect=None, near=-1, far=1, **kwds)[source]¶ Bases:
albow.openglwidgets.GLOrtho
-
class
albow.openglwidgets.
GLViewport
(rect=None, **kwds)[source]¶ Bases:
albow.widget.Widget
-
is_gl_container
= True¶
-
albow.palette_view module¶
-
class
albow.palette_view.
PaletteView
(cell_size, nrows, ncols, scrolling=False, **kwds)[source]¶ Bases:
albow.grid_view.GridView
albow.resource module¶
albow.root module¶
-
class
albow.root.
RootWidget
(surface)[source]¶ Bases:
albow.widget.Widget
-
bonus_draw_time
= False¶
-
captured_widget
= None¶
-
frames
= 0¶
-
hover_widget
= None¶
-
labelClass
(s, t)¶
-
redraw_every_frame
= False¶
-
albow.screen module¶
albow.scrollpanel module¶
-
class
albow.scrollpanel.
ScrollPanel
(*args, **kwargs)[source]¶ Bases:
albow.layout.Column
-
column_margin
= 2¶
-
-
class
albow.scrollpanel.
ScrollRow
(cell_size, nrows, **kwargs)[source]¶ Bases:
albow.palette_view.PaletteView
-
tooltipText
¶
-
albow.shell module¶
albow.sound module¶
albow.tab_panel module¶
-
class
albow.tab_panel.
TabPanel
(pages=None, **kwds)[source]¶ Bases:
albow.widget.Widget
-
tab_titles
= None¶
-
albow.table_view module¶
-
class
albow.table_view.
TableColumn
(title, width, align='l', fmt=None)[source]¶ Bases:
object
-
format_string
= '%s'¶
-
-
class
albow.table_view.
TableRowView
(cell_size, nrows, scrolling)[source]¶ Bases:
albow.table_view.TableRowBase
-
highlight_style
= 'fill'¶
-
vstretch
= True¶
-
albow.text_screen module¶
albow.theme module¶
-
class
albow.theme.
FontProperty
(name)[source]¶ Bases:
albow.theme.ThemeProperty
albow.translate module¶
This module adds translation functionnalities to Albow.
It looks for locale files in a sub folder ‘lang’ according to the system default, or user specified locale.
The locale files are text files where ‘entries’ are defined.
Syntax example:
o0 This is the first entry. t0 Ceci est la première entrée. o1 Here is the second one. You can see it is splitted on two lines. t1 Voici la deuxième. Vous pouvez constater qu’elle est sur deux lignes.
The ‘oN’ markers on the begining of a line marks the original string; the ‘tN’, the translations. Strings can be splited on several lines and contain any sort of characters (thus, be aware of unicode).
Files are named according to their language name, e.g. fr_FR.trn for french. The extension .trn is an arbitrary convention. The file ‘template.trn’ is given to be used as a base for other ones. It contains the strings used in Albow. They are not translated.
As convention, english is considered as the default language, and the file en_EN.trn would never be present.
Usage:
You need, a least, these three function in your program: * setLangPath to define the translations location; * buildTranslation to build up the cache; * _ function to translate strings.
-
albow.translate.
buildTranslation
(lang, extend=False, langPath=None)[source]¶ Finds the file corresponding to ‘lang’ builds up string_cache. If the file is not valid, does nothing. Errors encountered during the process are silently ignored. Returns string_cache (dict) and wether the file exists (bool).
-
albow.translate.
correctEncoding
(data, oldEnc='ascii', newEnc='cp1252')[source]¶ Returns encoded/decoded data. Disabled for now...
-
albow.translate.
getLangName
(file, path=None)[source]¶ Return the language name defined in the .trn file. If the name is not found, return the file base name.
-
albow.translate.
getPlatInfo
(**kwargs)[source]¶ kwargs: dict: {“module_name”: module,...} used to display version information about modules.
-
albow.translate.
loadTemplate
(fName='template.trn')[source]¶ Load the template fName file in the global template variable. Returns the template.
albow.tree module¶
-
class
albow.tree.
SelectItemTypePanel
(title, responses, default=None, ok_action=None)[source]¶ Bases:
albow.dialogs.Dialog
-
class
albow.tree.
SetupNewItemPanel
(type_string, types={'Boolean': (<type 'bool'>, <class 'albow.controls.CheckBox'>, True), 'Text': (<type 'unicode'>, <class 'albow.fields.TextFieldWrapped'>, ''), 'Floating point': (<type 'float'>, <class 'albow.fields.FloatField'>, 0.0), 'Compound': (<type 'dict'>, None, {}), 'Integer': (<type 'int'>, <class 'albow.fields.IntField'>, 0)}, ok_action=None)[source]¶ Bases:
albow.dialogs.Dialog
-
class
albow.tree.
Tree
(*args, **kwargs)[source]¶ Bases:
albow.layout.Column
...
-
column_margin
= 2¶
-
row_margin
= 2¶
-
rows
= []¶
-
-
class
albow.tree.
TreeRow
(cell_size, nrows, **kwargs)[source]¶ Bases:
albow.scrollpanel.ScrollRow
-
albow.tree.
create_bool
(self, i_type, i_name, i_value)¶
-
albow.tree.
create_dict
(self, i_type, i_name, i_value)¶
-
albow.tree.
create_float
(self, i_type, i_name, i_value)¶
-
albow.tree.
create_int
(self, i_type, i_name, i_value)¶
-
albow.tree.
create_unicode
(self, i_type, i_name, i_value)¶
-
albow.tree.
select_item_type
(ok_action, types={'Boolean': (<type 'bool'>, <class 'albow.controls.CheckBox'>, True), 'Text': (<type 'unicode'>, <class 'albow.fields.TextFieldWrapped'>, ''), 'Floating point': (<type 'float'>, <class 'albow.fields.FloatField'>, 0.0), 'Compound': (<type 'dict'>, None, {}), 'Integer': (<type 'int'>, <class 'albow.fields.IntField'>, 0)})[source]¶
albow.utils module¶
albow.vectors module¶
albow.version module¶
albow.widget module¶
-
class
albow.widget.
Widget
(rect=None, **kwds)[source]¶ Bases:
object
-
anchor
= 'ltwh'¶
-
bottom
¶
-
bottomleft
¶
-
bottomright
¶
-
cancel_response
= None¶
-
center
¶
-
centerx
¶
-
centery
¶
-
debug_resize
= False¶
-
doNotTranslate
= False¶
-
enter_response
= None¶
-
get_update_translation
¶
-
height
¶
-
is_gl_container
¶
-
is_hover
¶
-
left
¶
-
midbottom
¶
-
midleft
¶
-
midright
¶
-
midtop
¶
-
name
= 'Widget'¶
-
rect
¶
-
redraw_every_event
= True¶
-
resizing_axes
= {'h': 'lr', 'v': 'tb'}¶
-
resizing_values
= {'': [0], 's': [0, 1], 'm': [1]}¶
-
right
¶
-
size
¶
-
tab_stop
= False¶
-
tooltip
= None¶
-
tooltipText
= None¶
-
top
¶
-
topleft
¶
-
topright
¶
-
visible
¶
-
width
¶
-
Module contents¶
ALBOW - A Little Bit of Widgetry for PyGame by Gregory Ewing greg.ewing@canterbury.ac.nz