def create_default_agui(attribute, obj, window, family=None, aguidata={}): """Create a default attribute gui for a aguilist entry attribute: the attribute of obj obj: the object we're making an agui for window: the parent of the agui family: see get_attribute_family aguidata: this dictionary will update the default aguidata dictionary """ value = getattr(obj, attribute) aguiDefaultDict = get_agui_default_dict() if isclass(value): attributeClass = value else: attributeClass = get_type(value) if aguiDefaultDict.has_key(attributeClass): guiType = attributeClass else: if not family: # figure out what gui to use family = get_attribute_family(obj, attribute) guiType = family agui = aguiDefaultDict[guiType][0] if len(aguiDefaultDict[guiType]) > 1: aguidatadefault = aguiDefaultDict[guiType][1] else: aguidatadefault = {} aguidatadefault.update(aguidata) attributegui = get_agui(agui, attribute, window, aguidata=aguidatadefault) return attributegui
def create_default_agui(attribute, obj, window, family = None, aguidata = {}): """Create a default attribute gui for a aguilist entry attribute: the attribute of obj obj: the object we're making an agui for window: the parent of the agui family: see get_attribute_family aguidata: this dictionary will update the default aguidata dictionary """ value = getattr(obj, attribute) aguiDefaultDict = get_agui_default_dict() if isclass(value): attributeClass = value else: attributeClass = get_type(value) if aguiDefaultDict.has_key(attributeClass): guiType = attributeClass else: if not family: # figure out what gui to use family = get_attribute_family(obj, attribute) guiType = family agui = aguiDefaultDict[guiType][0] if len(aguiDefaultDict[guiType]) > 1: aguidatadefault = aguiDefaultDict[guiType][1] else: aguidatadefault = {} aguidatadefault.update(aguidata) attributegui = get_agui(agui, attribute, window, aguidata=aguidatadefault) return attributegui
from pug.syswx.attributeguis.components import Components from pug.syswx.attributeguis.dropdown import Dropdown from pug.syswx.attributeguis.image_browser import ImageBrowser from pug.syswx.attributeguis.filename import Filename from pug.syswx.attributeguis.play_buttons import PlayButtons from pug.syswx.attributeguis.gname_dropdown import GnameDropdown from pug.syswx.attributeguis.listedit import ListEdit from pug.syswx.attributeguis.color_picker import ColorPicker from pug.syswx.attributeguis.my_components import MyComponents from pug.syswx.attributeguis.float_spin import FloatSpin #from pug.syswx.attributeguis.component_folder import ComponentFolder #from pug.syswx.attributeguis.font_button import FontButton # default attribute gui types from pug.component.ComponentObject import ComponentSet _AGUI_DEFAULT_DICT = { #families 'Objects': [ObjectButtons], 'Routine': [Routine], 'Default': [Generic], #types bool: [Checkbox], ComponentSet: [Components] } get_agui_default_dict().update(_AGUI_DEFAULT_DICT) # load other gui default stuff from pug.component import pugview # component fanciness
from pug.syswx.attributeguis.subobject import SubObject from pug.syswx.attributeguis.components import Components from pug.syswx.attributeguis.dropdown import Dropdown from pug.syswx.attributeguis.image_browser import ImageBrowser from pug.syswx.attributeguis.filename import Filename from pug.syswx.attributeguis.play_buttons import PlayButtons from pug.syswx.attributeguis.gname_dropdown import GnameDropdown from pug.syswx.attributeguis.listedit import ListEdit from pug.syswx.attributeguis.color_picker import ColorPicker from pug.syswx.attributeguis.my_components import MyComponents from pug.syswx.attributeguis.float_spin import FloatSpin #from pug.syswx.attributeguis.component_folder import ComponentFolder #from pug.syswx.attributeguis.font_button import FontButton # default attribute gui types from pug.component.ComponentObject import ComponentSet _AGUI_DEFAULT_DICT = { #families 'Objects':[ObjectButtons], 'Routine':[Routine], 'Default':[Generic], #types bool:[Checkbox], ComponentSet:[Components] } get_agui_default_dict().update(_AGUI_DEFAULT_DICT) # load other gui default stuff from pug.component import pugview # component fanciness
from pug import add_pugview from pug.pugview_manager import get_agui_default_dict from pug.syswx.wxconstants import * from pug.syswx.attributeguis import Base, Label, SubObject from pug.syswx.pugbutton import PugButton from pug.syswx.agui_label_sizer import AguiLabelSizer from Opioid2D.public.Vector import VectorReference as _opioidVectorReference from Opioid2D.public.Vector import Vector #make SubObject the default attribute gui for VectorReference get_agui_default_dict().update({ _opioidVectorReference: [SubObject, { 'sub_attributes': ['x', 'y'], 'no_button': True }] }) get_agui_default_dict().update( {Vector: [SubObject, { 'sub_attributes': ['x', 'y'], 'no_button': True }]}) # BELOW DEPRECATED! May not work anymore with current system # attribute gui # Not used any more... but might be worth looking at as an example of # horizontally laid out sub-attributes class VectorReference(Base):
import wx from pug import add_pugview from pug.pugview_manager import get_agui_default_dict from pug.syswx.wxconstants import * from pug.syswx.attributeguis import Base, Label, SubObject from pug.syswx.pugbutton import PugButton from pug.syswx.agui_label_sizer import AguiLabelSizer from Opioid2D.public.Vector import VectorReference as _opioidVectorReference from Opioid2D.public.Vector import Vector #make SubObject the default attribute gui for VectorReference get_agui_default_dict().update({_opioidVectorReference: [SubObject,{'sub_attributes':['x','y'], 'no_button':True}] }) get_agui_default_dict().update({Vector: [SubObject,{'sub_attributes':['x','y'], 'no_button':True}] }) # BELOW DEPRECATED! May not work anymore with current system # attribute gui # Not used any more... but might be worth looking at as an example of # horizontally laid out sub-attributes class VectorReference (Base): """An attribute gui for viewing Opioid2D VectorReferences VectorReference(attribute, window, **kwargs) attribute: what attribute of window.object is being controlled window: the parent pugFrame.