To design an interface panel, interphase.Interface can be subclassed. Within the __init__() method call interphase.Interface.__init__(). Interface Object provides methods to design and utilize an interface panel. Use add() to add controls to panel, place into a method called add_controls(); if controls added otherwise call activate() to activate the panel. The module maintains the update of the panel including changes through the methods, however panel_update() can be used to force an update if required. If the Interface Object is subclassed, when overriding the update() method call interphase.Interface.update().
Interface interaction can be maintained with the InterfaceState object, that is returned by update() or get_state(), or through Pygame event queue checking for event.type interphase.EVENT[ 'controlselect' ] and interphase.EVENT[ 'controlinteract' ] with the attribute event.state that references the InterfaceState object. To turn the panel off, deactivate() sets state.active to false. The panel can be drawn to the display with the draw() method.
|
__init__(self,
identity='Interface_Panel',
position=None,
image=None,
color=(0,0,0),
size=(350,100),
screen=(500,500),
moveable=False,
position_offset=(0,0),
move_rate=(200,200),
fixed=False,
button_image=None,
control_image=None,
color_key=None,
control_minsize=None,
control_size='min',
button_size=(12,12),
function_button='left',
control_button='right',
scroll_button=None,
font_color=(125,130,135),
font_type=None,
font_size=10,
label_display=False,
info_display=False,
info_fontsize=10,
info_fontcolor=(125,130,135),
info_position=(2,0),
tips_display=False,
tips_fontsize=8,
tips_fontcolor=(125,130,135),
tips_position=(0,-15),
control_response=125,
pointer_interact=False,
data_folder='data',
data_zip=None,
text_paste=False,
event=False)
**Interface Object: Define panel.** |
|
|
|
add_controls(self)
Method to overide in subclass for adding controls. |
|
|
|
add(self,
identity,
control_type,
position,
**parameters)
Add control to panel. |
|
|
|
activate(self,
activate_panel=True)
Panel activation. |
|
|
|
deactivate(self)
Panel deactivation. |
|
|
|
add_control(self,
identity,
control_type,
position,
**parameters)
Add control to panel. |
|
|
|
get_control(self,
*control)
Retrieve control object. Multiple controls return a dictionary of control objects, and if no parameter given return dictionary of all control objects. |
|
|
|
remove_control(self,
*control)
Remove control from panel. |
|
|
|
enable_control(self,
*control)
Set control enabled. |
|
|
|
disable_control(self,
*control)
Set control disabled. |
|
|
|
get_value(self,
*control)
Retrieve current value of control. Multiple controls return a dictionary of values, and if no parameter given return dictionary of all values. |
|
|
|
get_position(self)
Retrieve panel position. |
|
|
|
get_size(self)
Retrieve panel size. |
|
|
|
get_default_image(self,
mode=None,
path=None)
Get or save default images. |
|
|
|
get_panel_image(self,
change=False)
Get panel image to modify. Parameter Change - True: mod permanent, False: mod transitory. |
|
|
|
set_panel_image(self,
image=None,
data_folder=None,
data_zip=None,
file_obj=None,
color_key=None,
surface=None)
Set image used for panel. |
|
|
|
set_control_image(self,
control_image=None,
data_folder=None,
data_zip=None,
file_obj=None,
color_key=None,
surface=None)
Set image used for control. |
|
|
|
set_button_image(self,
button_image=None,
data_folder=None,
data_zip=None,
file_obj=None,
color_key=None,
surface=None)
Set image used for buttons. |
|
|
|
get_clipboard(self)
Retrieve text from clipboard. |
|
|
|
set_clipboard(self,
text)
Save text to clipboard. |
|
|
|
is_active(self)
Check whether panel is active. |
|
|
|
is_moveable(self,
setting=None)
Check whether panel is moveable. |
|
|
|
set_moveable(self,
setting='Toggle',
position_offset=None,
move_rate=None)
Set panel moveable setting. |
|
|
|
move(self,
x,
y)
Move panel to new position x,y. |
|
|
|
is_panel_display(self)
Check whether panel controls displayed or toggled with pointer interaction. |
|
|
|
set_panel_display(self,
setting='Toggle')
Set panel controls displayed or toggled with pointer interaction. |
|
|
|
is_info_display(self)
Check whether info is displayed. |
|
|
|
set_info_display(self,
setting='Toggle')
Set info display setting. |
|
|
|
is_label_display(self)
Check whether label is displayed. |
|
|
|
set_label_display(self,
setting='Toggle')
Set label display setting. |
|
|
|
is_tips_display(self)
Check whether tips are displayed. |
|
|
|
set_tips_display(self,
setting='Toggle')
Set tips display setting. |
|
|
|
add_info(self,
*message_append)
Add text to info. |
|
|
|
clear_info(self)
Clear text from info. |
|
|
|
get_id(self)
Get panel identity |
|
|
|
get_state(self)
Get the state object of the panel. |
|
|
|
set_update(self,
sustain=False)
Set panel update. Parameter: sustain bool for continuous update, default False. |
|
|
|
is_update(self)
Check if panel was updated or set to sustained update. |
|
|
|
draw(self,
surface)
Draw panel on surface. Return Rect of surface area changed. |
|
|
|
clear(self,
surface,
background)
Clear panel from surface of previous draw, using background. |
|
|
|
get_pointer_position(self)
Get position of pointer determined at latest update. |
|
|
|
set_pointer_interact(self,
setting='Toggle')
Set pointer interact monitoring. |
|
|
|
process_event(self,
clear=False)
Internally process event handlers.
Required if no call to framework event method such as event.get or event.pump.
Optional clear argument to remove events from framework event queue.
With scroll_button active, call panel update prior to framework event method calls. |
|
|
|
get_event_queue(self)
Return interface event queue.
Event queue has mouse press events sequestered upon panel interaction with scroll_button active. |
|
|
|
move_control(self,
control=None,
position=None,
offset=None)
Move selected control. If no position supplied, use position of mouse pointer. |
|
|
|
set_control_move(self,
control=None,
mouse_visible=True)
Select control to move. |
|
|
|
get_control_move(self)
Return selected control to move. |
|
|
|
is_control_moveable(self)
Check whether control is moveable. |
|
|
|
set_control_moveable(self,
setting='Toggle')
Set control moveable. |
|
|
|
set_panel_function(self,
function=None)
Add function to panel update list, call without function to delete list. |
|
|
|
panel_update(self,
force_update=True)
Update control panel, determines interaction, does control action. |
|
|
|
update(self)
Update control panel. If overriding in interface subclass, call Interface.update(self). |
|
|