📄 xxx.py
字号:
class xxxListbook(xxxContainer): allParams = ['pos', 'size', 'style'] winStyles = ['wxLB_DEFAULT', 'wxLB_LEFT', 'wxLB_RIGHT', 'wxLB_TOP', 'wxLB_BOTTOM'] class xxxSplitterWindow(xxxContainer): allParams = ['orientation', 'sashpos', 'minsize', 'pos', 'size', 'style'] paramDict = {'orientation': ParamOrientation, 'sashpos': ParamUnit, 'minsize': ParamUnit } winStyles = ['wxSP_3D', 'wxSP_3DSASH', 'wxSP_3DBORDER', 'wxSP_FULLSASH', 'wxSP_NOBORDER', 'wxSP_PERMIT_UNSPLIT', 'wxSP_LIVE_UPDATE', 'wxSP_NO_XP_THEME' ]class xxxGenericDirCtrl(xxxObject): allParams = ['defaultfolder', 'filter', 'defaultfilter', 'pos', 'size', 'style'] paramDict = {'defaultfilter': ParamIntNN} winStyles = ['wxDIRCTRL_DIR_ONLY', 'wxDIRCTRL_3D_INTERNAL', 'wxDIRCTRL_SELECT_FIRST', 'wxDIRCTRL_SHOW_FILTERS']class xxxScrolledWindow(xxxContainer): allParams = ['pos', 'size', 'style'] winStyles = ['wxHSCROLL', 'wxVSCROLL', 'wxNO_3D', 'wxTAB_TRAVERSAL']class xxxDateCtrl(xxxObject): allParams = ['pos', 'size', 'style', 'borders'] winStyles = ['wxDP_DEFAULT', 'wxDP_SPIN', 'wxDP_DROPDOWN', 'wxDP_ALLOWNONE', 'wxDP_SHOWCENTURY']class xxxGrid(xxxObject): allParams = ['pos', 'size', 'style']class xxxFilePickerCtrl(xxxObject): allParams = ['value', 'message', 'wildcard', 'pos', 'size', 'style'] winStyles = ['wxFLP_OPEN', 'wxFLP_SAVE', 'wxFLP_OVERWRITE_PROMPT', 'wxFLP_FILE_MUST_EXIST', 'wxFLP_CHANGE_DIR', 'wxFLP_DEFAULT_STYLE']################################################################################# Buttonsclass xxxButton(xxxObject): allParams = ['label', 'default', 'pos', 'size', 'style'] paramDict = {'default': ParamBool} required = ['label'] winStyles = ['wxBU_LEFT', 'wxBU_TOP', 'wxBU_RIGHT', 'wxBU_BOTTOM', 'wxBU_EXACTFIT', 'wxNO_BORDER']class xxxBitmapButton(xxxObject): allParams = ['bitmap', 'selected', 'focus', 'disabled', 'default', 'pos', 'size', 'style'] paramDict = {'selected': ParamBitmap, 'focus': ParamBitmap, 'disabled': ParamBitmap, 'default': ParamBool} required = ['bitmap'] winStyles = ['wxBU_AUTODRAW', 'wxBU_LEFT', 'wxBU_RIGHT', 'wxBU_TOP', 'wxBU_BOTTOM']class xxxRadioButton(xxxObject): allParams = ['label', 'value', 'pos', 'size', 'style'] paramDict = {'value': ParamBool} required = ['label'] winStyles = ['wxRB_GROUP', 'wxRB_SINGLE']class xxxSpinButton(xxxObject): allParams = ['value', 'min', 'max', 'pos', 'size', 'style'] paramDict = {'value': ParamInt} winStyles = ['wxSP_HORIZONTAL', 'wxSP_VERTICAL', 'wxSP_ARROW_KEYS', 'wxSP_WRAP']class xxxSpinCtrl(xxxObject): allParams = ['value', 'min', 'max', 'pos', 'size', 'style'] paramDict = {'value': ParamInt} winStyles = ['wxSP_HORIZONTAL', 'wxSP_VERTICAL', 'wxSP_ARROW_KEYS', 'wxSP_WRAP']class xxxToggleButton(xxxObject): allParams = ['label', 'checked', 'pos', 'size', 'style'] paramDict = {'checked': ParamBool} required = ['label']################################################################################# Boxesclass xxxStaticBox(xxxObject): allParams = ['label', 'pos', 'size', 'style'] required = ['label']class xxxRadioBox(xxxObject): allParams = ['label', 'content', 'selection', 'dimension', 'pos', 'size', 'style'] paramDict = {'dimension': ParamIntNN} required = ['label', 'content'] default = {'content': '[]'} winStyles = ['wxRA_SPECIFY_ROWS', 'wxRA_SPECIFY_COLS', 'wxRA_HORIZONTAL', 'wxRA_VERTICAL']class xxxCheckBox(xxxObject): allParams = ['label', 'checked', 'pos', 'size', 'style'] paramDict = {'checked': ParamBool} winStyles = ['wxCHK_2STATE', 'wxCHK_3STATE', 'wxCHK_ALLOW_3RD_STATE_FOR_USER', 'wxALIGN_RIGHT'] required = ['label']class xxxComboBox(xxxObject): allParams = ['content', 'selection', 'value', 'pos', 'size', 'style'] required = ['content'] default = {'content': '[]'} winStyles = ['wxCB_SIMPLE', 'wxCB_SORT', 'wxCB_READONLY', 'wxCB_DROPDOWN']class xxxListBox(xxxObject): allParams = ['content', 'selection', 'pos', 'size', 'style'] required = ['content'] default = {'content': '[]'} winStyles = ['wxLB_SINGLE', 'wxLB_MULTIPLE', 'wxLB_EXTENDED', 'wxLB_HSCROLL', 'wxLB_ALWAYS_SB', 'wxLB_NEEDED_SB', 'wxLB_SORT']class xxxCheckList(xxxObject): allParams = ['content', 'pos', 'size', 'style'] required = ['content'] default = {'content': '[]'} winStyles = ['wxLB_SINGLE', 'wxLB_MULTIPLE', 'wxLB_EXTENDED', 'wxLB_HSCROLL', 'wxLB_ALWAYS_SB', 'wxLB_NEEDED_SB', 'wxLB_SORT'] paramDict = {'content': ParamContentCheckList}################################################################################# Sizersclass xxxSizer(xxxContainer): hasName = hasStyle = False paramDict = {'orient': ParamOrient} isSizer = True itemTag = 'sizeritem' # different for some sizersclass xxxBoxSizer(xxxSizer): allParams = ['orient'] required = ['orient'] default = {'orient': 'wxVERTICAL'} # Tree icon depends on orientation def treeImage(self): if self.params['orient'].value() == 'wxHORIZONTAL': return self.imageH else: return self.imageVclass xxxStaticBoxSizer(xxxBoxSizer): allParams = ['label', 'orient'] required = ['label', 'orient']class xxxGridSizer(xxxSizer): allParams = ['cols', 'rows', 'vgap', 'hgap'] required = ['cols'] default = {'cols': '2', 'rows': '2'}class xxxStdDialogButtonSizer(xxxSizer): allParams = [] itemTag = 'button'# For repeated parametersclass xxxParamMulti: def __init__(self, node): self.node = node self.l, self.data = [], [] def append(self, param): self.l.append(param) self.data.append(param.value()) def value(self): return self.data def remove(self): for param in self.l: param.remove() self.l, self.data = [], []class xxxFlexGridSizer(xxxGridSizer): specials = ['growablecols', 'growablerows'] allParams = ['cols', 'rows', 'vgap', 'hgap'] + specials paramDict = {'growablecols': ParamIntList, 'growablerows': ParamIntList}class xxxGridBagSizer(xxxSizer): specials = ['growablecols', 'growablerows'] allParams = ['vgap', 'hgap'] + specials paramDict = {'growablecols': ParamIntList, 'growablerows': ParamIntList}# Container with only one child.# Not shown in tree.class xxxChildContainer(xxxObject): hasName = hasStyle = False hasChild = True def __init__(self, parent, element, refElem=None): xxxObject.__init__(self, parent, element, refElem) # Must have one child with 'object' tag, but we don't check it nodes = element.childNodes[:] # create copy for node in nodes: if node.nodeType == minidom.Node.ELEMENT_NODE: if node.tagName in ['object', 'object_ref']: # Create new xxx object for child node self.child = MakeXXXFromDOM(self, node) self.child.parent = parent # Copy hasChildren and isSizer attributes self.hasChildren = self.child.hasChildren self.isSizer = self.child.isSizer return # success else: element.removeChild(node) node.unlink() assert 0, 'no child found' def resetChild(self, xxx): '''Reset child info (for replacing with another class).''' self.child = xxx self.hasChildren = xxx.hasChildren self.isSizer = xxx.isSizer class xxxSizerItem(xxxChildContainer): allParams = ['option', 'flag', 'border', 'minsize', 'ratio'] paramDict = {'option': ParamInt, 'minsize': ParamPosSize, 'ratio': ParamPosSize} defaults_panel = {} defaults_control = {} def __init__(self, parent, element, refElem=None): # For GridBag sizer items, extra parameters added if isinstance(parent, xxxGridBagSizer): self.allParams = self.allParams + ['cellpos', 'cellspan'] xxxChildContainer.__init__(self, parent, element, refElem) # Remove pos parameter - not needed for sizeritems if 'pos' in self.child.allParams: self.child.allParams = self.child.allParams[:] self.child.allParams.remove('pos') def resetChild(self, xxx): xxxChildContainer.resetChild(self, xxx) # Remove pos parameter - not needed for sizeritems if 'pos' in self.child.allParams: self.child.allParams = self.child.allParams[:] self.child.allParams.remove('pos') class xxxSizerItemButton(xxxSizerItem): allParams = [] paramDict = {} def __init__(self, parent, element, refElem=None): xxxChildContainer.__init__(self, parent, element, refElem=None) # Remove pos parameter - not needed for sizeritems if 'pos' in self.child.allParams: self.child.allParams = self.child.allParams[:] self.child.allParams.remove('pos')class xxxPage(xxxChildContainer): allParams = ['label', 'selected'] paramDict = {'selected': ParamBool} required = ['label'] def __init__(self, parent, element, refElem=None): xxxChildContainer.__init__(self, parent, element, refElem) # pos and size dont matter for notebookpages if 'pos' in self.child.allParams: self.child.allParams = self.child.allParams[:] self.child.allParams.remove('pos') if 'size' in self.child.allParams: self.child.allParams = self.child.allParams[:] self.child.allParams.remove('size')class xxxSpacer(xxxObject): hasName = hasStyle = False allParams = ['size', 'option', 'flag', 'border'] paramDict = {'option': ParamInt} default = {'size': '0,0'} def __init__(self, parent, element, refElem=None): # For GridBag sizer items, extra parameters added if isinstance(parent, xxxGridBagSizer): self.allParams = self.allParams + ['cellpos', 'cellspan'] xxxObject.__init__(self, parent, element, refElem)class xxxMenuBar(xxxContainer): allParams = ['style'] paramDict = {'style': ParamNonGenericStyle} # no generic styles winStyles = ['wxMB_DOCKABLE']class xxxMenu(xxxContainer): allParams = ['label', 'help', 'style'] default = {'label': ''} paramDict = {'style': ParamNonGenericStyle} # no generic styles winStyles = ['wxMENU_TEAROFF']class xxxMenuItem(xxxObject): allParams = ['label', 'bitmap', 'accel', 'help', 'checkable', 'radio', 'enabled', 'checked'] default = {'label': ''} hasStyle = Falseclass xxxSeparator(xxxObject): hasName = hasStyle = False################################################################################# Unknown controlclass xxxUnknown(xxxObject): allParams = ['pos', 'size', 'style'] winStyles = ['wxNO_FULL_REPAINT_ON_RESIZE']################################################################################# Comment_handlers = [] # custom handler classes/funcsdef getHandlers(): return _handlersdef setHandlers(handlers): global _handlers _handlers = handlers_CFuncPtr = None # ctypes function typedef register(hndlr): """Register hndlr function or XmlResourceHandler class.""" if _CFuncPtr and isinstance(hndlr, _CFuncPtr): _handlers.append(hndlr) return if not isinstance(hndlr, type): wx.LogError('handler is not a type: %s' % hndlr) elif not issubclass(hndlr, wx.xrc.XmlResourceHandler): wx.LogError('handler is not a XmlResourceHandler: %s' % hndlr) else: _handlers.append(hndlr)def load_dl(path, localname=''): """Load shared/dynamic library into xxx namespace. If path is not absolute or relative, try to find in the module's directory. """ if not localname: localname = os.path.basename(os.path.splitext(path)[0]) try: import ctypes global _CFuncPtr _CFuncPtr = ctypes._CFuncPtr # use as a flag of loaded ctypes
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -