def writeConstructor(self, output, collectionMethod, stripFrmId=""): ContainerDTC.writeConstructor(self, output, collectionMethod, stripFrmId="") if self.textConstr: # Add call to init utils after frame constructor if self.textConstr.comp_name == "" and collectionMethod == sourceconst.init_ctrls: if self.designer.dataView.objects: output.append("%sself.%s()" % (sourceconst.bodyIndent, sourceconst.init_utils))
def notification(self, compn, action): ContainerDTC.notification(self, compn, action) if action == 'delete': # If the splitter itself is deleted it should unsplit so that # deletion notifications from it's children won't cause # access to deleted controls if compn.control == self.control: self.win1 = self.win2 = None self.splitWindow(None, None) return # Win 1 # If Window1 is None, splitter can only be unsplit if compn.control == self.win1:#self.GetWindow1(None): self.control.Unsplit(self.win1) if self.win2: self.win2.Show(True) self.win1 = self.win2 = None setterName = self.modeMethMap[self.control.GetSplitMode()] self.propRevertToDefault('Window1', setterName) self.designer.inspector.propertyUpdate('Window1') self.designer.inspector.propertyUpdate('Window2') return if compn.control == self.win2:#self.GetWindow2(None): self.SetWindow2(None) setterName = self.modeMethMap[self.control.GetSplitMode()] self.persistProp('Window2', setterName, None) self.designer.inspector.propertyUpdate('Window2') return
def __init__(self, name, designer, frameCtrl): ContainerDTC.__init__(self, name, designer, None, None) self.control = frameCtrl self.editors['Flags'] = FlagsConstrPropEdit # XXX should rather be enumerated self.windowStyles = ['wx.SIMPLE_BORDER', 'wx.DOUBLE_BORDER', 'wx.SUNKEN_BORDER', 'wx.RAISED_BORDER', 'wx.STATIC_BORDER', 'wx.NO_BORDER']
def __init__(self, name, designer, parent, ctrlClass): ContainerDTC.__init__(self, name, designer, parent, ctrlClass) self.editors.update({'Tools': CollectionPropEdit}) self.subCompanions['Tools'] = ToolBarToolsCDTC self.windowStyles = ['wx.TB_FLAT', 'wx.TB_DOCKABLE', 'wx.TB_HORIZONTAL', 'wx.TB_VERTICAL', 'wx.TB_3DBUTTONS', 'wx.TB_TEXT', 'wx.TB_NOICONS', 'wx.TB_NODIVIDER', 'wx.TB_NOALIGN', ] + self.windowStyles
def __init__(self, name, designer, parent, ctrlClass): ContainerDTC.__init__(self, name, designer, parent, ctrlClass) self.editors.update({ 'Pages': CollectionPropEdit, 'ImageList': ImageListClassLinkPropEdit }) self.subCompanions['Pages'] = BookCtrlPagesCDTC self.letClickThru = True
def updatePosAndSize(self): ContainerDTC.updatePosAndSize(self) # Argh, this is needed so that ClientSize is up to date if self.textPropList: for prop in self.textPropList: if prop.prop_name == 'ClientSize': size = self.control.GetClientSize() prop.params = ['wx.Size(%d, %d)' % (size.x, size.y)]
def writeConstructor(self, output, collectionMethod, stripFrmId=''): ContainerDTC.writeConstructor(self, output, collectionMethod, stripFrmId='') if self.textConstr: # Add call to init utils after frame constructor if self.textConstr.comp_name == '' and \ collectionMethod == sourceconst.init_ctrls: if self.designer.dataView.objects: output.append('%sself.%s()'%(sourceconst.bodyIndent, sourceconst.init_utils))
def renameCtrlRefs(self, oldName, newName): ContainerDTC.renameCtrlRefs(self, oldName, newName) # Check if subwindow references have changed # XXX should maybe be done with notification, action = 'rename' oldSrc = Utils.srcRefFromCtrlName(oldName) for prop in self.textPropList: if prop.prop_setter in ('SplitVertically', 'SplitHorizontally'): if oldSrc in prop.params: prop.params[prop.params.index(oldSrc)] = \ Utils.srcRefFromCtrlName(newName)
def persistProp(self, name, setterName, value): if setterName == 'SetSashVisible': edge, visbl = value.split(',') for prop in self.textPropList: if prop.prop_setter == setterName and prop.params[0] == edge: prop.params = [edge.strip(), visbl.strip()] return self.textPropList.append(methodparse.PropertyParse( None, self.name, setterName, [edge.strip(), visbl.strip()], 'SetSashVisible')) else: ContainerDTC.persistProp(self, name, setterName, value)
def __init__(self, name, designer, parent, ctrlClass): ContainerDTC.__init__(self, name, designer, parent, ctrlClass) self.editors.update({'SplitMode': EnumPropEdit, 'Window1' : SplitterWindow1LinkPropEdit, 'Window2' : SplitterWindow2LinkPropEdit}) self.options['SplitMode'] = splitterWindowSplitMode self.names['SplitMode'] = splitterWindowSplitModeNames self.windowStyles = ['wx.SP_3D', 'wx.SP_3DSASH', 'wx.SP_3DBORDER', 'wx.SP_BORDER', 'wx.SP_NOBORDER', 'wx.SP_PERMIT_UNSPLIT', 'wx.SP_LIVE_UPDATE', ] + self.windowStyles self.win1 = None self.win2 = None
def __init__(self, name, designer, parent, ctrlClass): ContainerDTC.__init__(self, name, designer, parent, ctrlClass) self.editors.update({'SashVisibleLeft' : SashVisiblePropEdit, 'SashVisibleTop' : SashVisiblePropEdit, 'SashVisibleRight' : SashVisiblePropEdit, 'SashVisibleBottom' : SashVisiblePropEdit}) self.windowStyles = ['wx.SW_3D', 'wx.SW_3DSASH', 'wx.SW_3DBORDER', 'wx.SW_BORDER'] + self.windowStyles self.edgeNameMap = {'SashVisibleLeft' : wx.SASH_LEFT, 'SashVisibleTop' : wx.SASH_TOP, 'SashVisibleRight' : wx.SASH_RIGHT, 'SashVisibleBottom': wx.SASH_BOTTOM} for name in self.edgeNameMap.keys() + ['SashVisible']: self.customPropEvaluators[name] = self.EvalSashVisible
def dontPersistProps(self): # Note this is a workaround for a problem on wxGTK where the size # passed to the frame constructor is actually means ClientSize on wxGTK. # By having this property always set, this overrides the frame size # and uses the same size on Win and Lin props = ContainerDTC.dontPersistProps(self) props.remove('ClientSize') return props
def properties(self): props = ContainerDTC.properties(self) props.update({ 'Window1': ('CompnRoute', self.GetWindow1, self.SetWindow1), 'Window2': ('CompnRoute', self.GetWindow2, self.SetWindow2), 'SplitMode': ('CompnRoute', self.GetSplitMode, self.SetSplitMode), }) return props
def persistedPropVal(self, name, setterName): # Unlike usual properties, SashPosition is persisted as a Split* method # Therefore it needs to check the Split* method for the source value if setterName == 'SetSashPosition': for prop in self.textPropList: if prop.prop_setter in ('SplitVertically', 'SplitHorizontally'): return prop.params[2] return ContainerDTC.persistedPropVal(self, name, setterName)
def hideDesignTime(self): return ContainerDTC.hideDesignTime(self) + [ "ToolBar", "MenuBar", "StatusBar", "Icon", "Anchors", "Constraints", "Label", ]
def persistProp(self, name, setterName, value): """ When attempting to persist the Window properties and the SplitMode property, add, or update a previously defined SplitVertically or SplitHorizontally method.""" if setterName in ('SetWindow1', 'SetWindow2'): propSN = setterName setterName = self.modeMethMap[self.control.GetSplitMode()] win1, win2 = self.GetWindow1(None), self.GetWindow2(None) sashPos = ` self.control.GetSashPosition() ` if win1: win1 = 'self.' + win1.GetName() else: win1 = 'None' if win2: win2 = 'self.' + win2.GetName() else: win2 = 'None' for prop in self.textPropList: if prop.prop_setter in ('SplitVertically', 'SplitHorizontally'): prop.prop_setter = setterName prop.params = [win1, win2, sashPos] return self.textPropList.append( methodparse.PropertyParse(None, self.name, setterName, [win1, win2, sashPos], setterName)) elif setterName == 'SetSplitMode': sm = self.control.GetSplitMode() setterName = self.modeMethMap[sm] for prop in self.textPropList: if prop.prop_setter == 'SplitVertically' and sm == wx.SPLIT_HORIZONTAL or \ prop.prop_setter == 'SplitHorizontally' and sm == wx.SPLIT_VERTICAL: prop.prop_setter = setterName return elif setterName == 'SetSashPosition': for prop in self.textPropList: if prop.prop_setter in ('SplitVertically', 'SplitHorizontally'): prop.params[2] = value return else: ContainerDTC.persistProp(self, name, setterName, value)
def persistProp(self, name, setterName, value): """ When attempting to persist the Window properties and the SplitMode property, add, or update a previously defined SplitVertically or SplitHorizontally method.""" if setterName in ('SetWindow1', 'SetWindow2'): propSN = setterName setterName = self.modeMethMap[self.control.GetSplitMode()] win1, win2 = self.GetWindow1(None), self.GetWindow2(None) sashPos = `self.control.GetSashPosition()` if win1: win1 = 'self.'+win1.GetName() else: win1 = 'None' if win2: win2 = 'self.'+win2.GetName() else: win2 = 'None' for prop in self.textPropList: if prop.prop_setter in ('SplitVertically', 'SplitHorizontally'): prop.prop_setter = setterName prop.params = [win1, win2, sashPos] return self.textPropList.append(methodparse.PropertyParse( None, self.name, setterName, [win1, win2, sashPos], setterName)) elif setterName == 'SetSplitMode': sm = self.control.GetSplitMode() setterName = self.modeMethMap[sm] for prop in self.textPropList: if prop.prop_setter == 'SplitVertically' and sm == wx.SPLIT_HORIZONTAL or \ prop.prop_setter == 'SplitHorizontally' and sm == wx.SPLIT_VERTICAL: prop.prop_setter = setterName return elif setterName == 'SetSashPosition': for prop in self.textPropList: if prop.prop_setter in ('SplitVertically', 'SplitHorizontally'): prop.params[2] = value return else: ContainerDTC.persistProp(self, name, setterName, value)
def events(self): return ContainerDTC.events(self) + ['PanelEvent']
def __init__(self, name, designer, parent, ctrlClass): ContainerDTC.__init__(self, name, designer, parent, ctrlClass) self.editors['DefaultItem'] = ButtonClassLinkPropEdit self.windowStyles.insert(0, 'wx.TAB_TRAVERSAL')
def properties(self): props = ContainerDTC.properties(self) props.update({'Pages': ('NoneRoute', None, None)}) del props['Sizer'] return props
def events(self): return ContainerDTC.events(self) + ['SplitterWindowEvent']
def properties(self): props = ContainerDTC.properties(self) props.update({'Window1' : ('CompnRoute', self.GetWindow1, self.SetWindow1), 'Window2' : ('CompnRoute', self.GetWindow2, self.SetWindow2), 'SplitMode': ('CompnRoute', self.GetSplitMode, self.SetSplitMode),}) return props
def dependentProps(self): return ContainerDTC.dependentProps(self) + \ ['SplitVertically', 'SplitHorizontally']
def dontPersistProps(self): return ContainerDTC.dontPersistProps(self) + ['Selection']
def dependentProps(self): return ContainerDTC.dependentProps(self) + ['ImageList', 'Pages']
def dependentProps(self): return ContainerDTC.dependentProps(self) + ['Tools']
def notification(self, compn, action): ContainerDTC.notification(self, compn, action) if action == 'delete': if self.control.GetImageList() == compn.control: self.propRevertToDefault('ImageList', 'SetImageList') self.control.SetImageList(None)
def properties(self): props = ContainerDTC.properties(self) props.update({'Tools': ('NoneRoute', None, None)}) return props
def properties(self): props = ContainerDTC.properties(self) prop = ('NameRoute', self.GetSashVisible, self.SetSashVisible) for name in self.edgeNameMap.keys(): props[name] = prop return props
def __init__(self, name, designer, parent, ctrlClass): ContainerDTC.__init__(self, name, designer, parent, ctrlClass) self.editors.update({'Pages': CollectionPropEdit, 'ImageList': ImageListClassLinkPropEdit}) self.subCompanions['Pages'] = BookCtrlPagesCDTC self.letClickThru = True
def dependentProps(self): return ContainerDTC.dependentProps(self) + ['DefaultItem']
def hideDesignTime(self): return ContainerDTC.hideDesignTime(self) + ['SplitMode']
def designTimeControl(self, position, size, args = None): ctrl = ContainerDTC.designTimeControl(self, position, size, args) ctrl.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.OnPageChanged, id=ctrl.GetId()) return ctrl
def events(self): return ContainerDTC.events(self) + ['SashEvent']
def notification(self, compn, action): ContainerDTC.notification(self, compn, action) if action == 'delete': if self.control.GetTargetWindow() == compn.control: self.propRevertToDefault('TargetWindow', 'SetTargetWindow') self.control.SetTargetWindow(self.control)