Esempio n. 1
0
 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))
Esempio n. 2
0
    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
Esempio n. 3
0
    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']
Esempio n. 5
0
 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
Esempio n. 6
0
 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)]
Esempio n. 8
0
 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)]
Esempio n. 9
0
 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
Esempio n. 10
0
 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 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))
Esempio n. 12
0
 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)
Esempio n. 13
0
 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)
Esempio n. 14
0
 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)
Esempio n. 15
0
 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)
Esempio n. 16
0
 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
Esempio n. 17
0
 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
Esempio n. 18
0
 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
Esempio n. 19
0
 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
Esempio n. 20
0
 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 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
Esempio n. 22
0
 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
Esempio n. 23
0
 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)
Esempio n. 24
0
 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)
Esempio n. 25
0
 def hideDesignTime(self):
     return ContainerDTC.hideDesignTime(self) + [
         "ToolBar",
         "MenuBar",
         "StatusBar",
         "Icon",
         "Anchors",
         "Constraints",
         "Label",
     ]
Esempio n. 26
0
    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)
Esempio n. 27
0
    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)
Esempio n. 28
0
 def events(self):
     return ContainerDTC.events(self) + ['PanelEvent']
Esempio n. 29
0
 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')
Esempio n. 30
0
 def properties(self):
     props = ContainerDTC.properties(self)
     props.update({'Pages': ('NoneRoute', None, None)})
     del props['Sizer']
     return props
Esempio n. 31
0
 def events(self):
     return ContainerDTC.events(self) + ['SplitterWindowEvent']
Esempio n. 32
0
 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
Esempio n. 33
0
 def dependentProps(self):
     return ContainerDTC.dependentProps(self) + \
       ['SplitVertically', 'SplitHorizontally']
Esempio n. 34
0
 def dontPersistProps(self):
     return ContainerDTC.dontPersistProps(self) + ['Selection']
Esempio n. 35
0
 def dependentProps(self):
     return ContainerDTC.dependentProps(self) + ['ImageList', 'Pages']
Esempio n. 36
0
 def dependentProps(self):
     return ContainerDTC.dependentProps(self) + ['Tools']
Esempio n. 37
0
 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)
Esempio n. 38
0
 def properties(self):
     props = ContainerDTC.properties(self)
     props.update({'Tools': ('NoneRoute', None, None)})
     return props
Esempio n. 39
0
 def dependentProps(self):
     return ContainerDTC.dependentProps(self) + \
       ['SplitVertically', 'SplitHorizontally']
Esempio n. 40
0
 def properties(self):
     props = ContainerDTC.properties(self)
     prop = ('NameRoute', self.GetSashVisible, self.SetSashVisible)
     for name in self.edgeNameMap.keys():
         props[name] = prop
     return props
Esempio n. 41
0
 def events(self):
     return ContainerDTC.events(self) + ['PanelEvent']
Esempio n. 42
0
 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
Esempio n. 43
0
 def dependentProps(self):
     return ContainerDTC.dependentProps(self) + ['DefaultItem']
Esempio n. 44
0
 def hideDesignTime(self):
     return ContainerDTC.hideDesignTime(self) + ['SplitMode']
Esempio n. 45
0
 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
Esempio n. 46
0
 def properties(self):
     props = ContainerDTC.properties(self)
     prop = ('NameRoute', self.GetSashVisible, self.SetSashVisible)
     for name in self.edgeNameMap.keys():
         props[name] = prop
     return props
Esempio n. 47
0
 def hideDesignTime(self):
     return ContainerDTC.hideDesignTime(self) + ['SplitMode']
Esempio n. 48
0
 def properties(self):
     props = ContainerDTC.properties(self)
     props.update({'Tools': ('NoneRoute', None, None)})
     return props
Esempio n. 49
0
 def events(self):
     return ContainerDTC.events(self) + ['SplitterWindowEvent']
Esempio n. 50
0
 def events(self):
     return ContainerDTC.events(self) + ['SashEvent']
Esempio n. 51
0
 def properties(self):
     props = ContainerDTC.properties(self)
     props.update({'Pages': ('NoneRoute', None, None)})
     del props['Sizer']
     return props
Esempio n. 52
0
 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')
Esempio n. 53
0
 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
Esempio n. 54
0
 def dependentProps(self):
     return ContainerDTC.dependentProps(self) + ['ImageList', 'Pages']
Esempio n. 55
0
 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)
Esempio n. 56
0
 def dontPersistProps(self):
     return ContainerDTC.dontPersistProps(self) + ['Selection']
Esempio n. 57
0
 def dependentProps(self):
     return ContainerDTC.dependentProps(self) + ['Tools']
Esempio n. 58
0
 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)
Esempio n. 59
0
 def events(self):
     return ContainerDTC.events(self) + ['SashEvent']
Esempio n. 60
0
 def dependentProps(self):
     return ContainerDTC.dependentProps(self) + ['DefaultItem']