| 75 | | # XXX: Depreciate these out... |
|---|
| 76 | | sizerAuto = self.settings.get('sizerAuto', self) |
|---|
| 77 | | if sizerAuto is not self: |
|---|
| 78 | | self.settings['autosize'] = sizerAuto |
|---|
| 79 | | warnings.warn('"sizerAuto" attribute should be replaced with "autosize"', DeprecationWarning) |
|---|
| 80 | | sizerHints = self.settings.get('sizerHints', self) |
|---|
| 81 | | if sizerHints is not self: |
|---|
| 82 | | self.settings['sethints'] = sizerHints |
|---|
| 83 | | warnings.warn('"sizerHints" attribute should be replaced with "sethints"', DeprecationWarning) |
|---|
| 84 | | sizerFit = self.settings.get('sizerFit', self) |
|---|
| 85 | | if sizerFit is not self: |
|---|
| 86 | | self.settings['fit'] = sizerFit |
|---|
| 87 | | warnings.warn('"sizerFit" attribute should be replaced with "fit"', DeprecationWarning) |
|---|
| 88 | | |
|---|
| 89 | | orientation = self.settings.get('orientation', 'opposite') |
|---|
| 90 | | # Grab the window parent object, or the first layout derived parent |
|---|
| 91 | | self.winParent = self.wxGetParentObject((wx.wxWindowPtr, layout)) |
|---|
| 92 | | if isinstance(self.winParent, wx.wxWindowPtr): |
|---|
| 93 | | # Set sizercfg default for context, if not set |
|---|
| 94 | | if 'sizercfg' not in self.settings: |
|---|
| 95 | | self.settings['sizercfg'] = '1, wxEXPAND' |
|---|
| 96 | | else: |
|---|
| 97 | | # Set sizercfg default for context, if not set |
|---|
| 98 | | if 'sizercfg' not in self.settings: |
|---|
| 99 | | self.settings['sizercfg'] = '0, wxEXPAND' |
|---|
| 100 | | |
|---|
| 101 | | # Layouts cancel the window parent |
|---|
| 102 | | parentLayout = self.winParent |
|---|
| 103 | | self.winParent = None |
|---|
| 104 | | |
|---|
| 105 | | # Figure out what type of sizer we should be creating |
|---|
| 106 | | if orientation == 'opposite': |
|---|
| 107 | | orientation = 'vertical' # New Default |
|---|
| 108 | | # Calculate the "real" opposite |
|---|
| 109 | | try: GetOrientation = parentLayout.GetOrientation |
|---|
| 110 | | except AttributeError: pass |
|---|
| 111 | | else: |
|---|
| 112 | | if GetOrientation() == wx.wxVERTICAL: |
|---|
| 113 | | orientation = 'horizontal' |
|---|
| 114 | | else: orientation = 'vertical' |
|---|
| 115 | | elif orientation == 'same': |
|---|
| 116 | | orientation = 'vertical' # New Default |
|---|
| 117 | | # Calculate the "real" value |
|---|
| 118 | | try: GetOrientation = parentLayout.GetOrientation |
|---|
| 119 | | except AttributeError: pass |
|---|
| 120 | | else: |
|---|
| 121 | | if GetOrientation() == wx.wxVERTICAL: |
|---|
| 122 | | orientation = 'vertical' |
|---|
| 123 | | else: orientation = 'horizontal' |
|---|
| 124 | | |
|---|
| 183 | | def _GetChildSizerArgsKw(self, ChildNode): |
|---|
| 184 | | sizerargs, sizerkw = ChildNode.wxEvalCond('sizercfg', (None, {}), codefmtstr='argskw(%s)') |
|---|
| 185 | | if sizerargs is None: |
|---|
| 186 | | sizerargs = [ChildNode.wxEvalCond(*evalargs) for evalargs in (('sizerOption', 0), ('sizerFlag', 0), ('sizerBorder', 0))] |
|---|
| 187 | | if sizerargs != [0,0,0]: |
|---|
| 188 | | warnings.warn('"sizerOption", "sizerFlag", and "sizerBorder" attributes should be replaced with "sizercfg"', DeprecationWarning) |
|---|
| 189 | | return tuple(sizerargs), dict(sizerkw) |
|---|
| | 136 | def _GetOrientation(self, orientation=None, default='opposite'): |
|---|
| | 137 | orientation = orientation or self.settings.get('orientation', None) or self.settings.get('orient', None) or default |
|---|
| | 138 | orientation = self.orientation_aliases.get(orientation, orientation) |
|---|
| | 139 | # Grab the window parent object, or the first layout derived parent |
|---|
| | 140 | self.winParent = self.wxGetParentObject((wx.wxWindowPtr, layout)) |
|---|
| | 141 | if isinstance(self.winParent, wx.wxWindowPtr): |
|---|
| | 142 | # Set sizercfg default for context, if not set |
|---|
| | 143 | if 'sizercfg' not in self.settings: |
|---|
| | 144 | self.settings['sizercfg'] = '1, wxEXPAND' |
|---|
| | 145 | else: |
|---|
| | 146 | # Set sizercfg default for context, if not set |
|---|
| | 147 | if 'sizercfg' not in self.settings: |
|---|
| | 148 | self.settings['sizercfg'] = '0, wxEXPAND' |
|---|
| | 150 | # Layouts cancel the window parent |
|---|
| | 151 | parentLayout = self.winParent |
|---|
| | 152 | self.winParent = None |
|---|
| | 153 | |
|---|
| | 154 | # Figure out what type of sizer we should be creating |
|---|
| | 155 | if orientation == 'opposite': |
|---|
| | 156 | orientation = 'vertical' # New Default |
|---|
| | 157 | # Calculate the "real" opposite |
|---|
| | 158 | try: GetOrientation = parentLayout.GetOrientation |
|---|
| | 159 | except AttributeError: pass |
|---|
| | 160 | else: |
|---|
| | 161 | if GetOrientation() == wx.wxVERTICAL: |
|---|
| | 162 | orientation = 'horizontal' |
|---|
| | 163 | else: orientation = 'vertical' |
|---|
| | 164 | elif orientation == 'same': |
|---|
| | 165 | orientation = 'vertical' # New Default |
|---|
| | 166 | # Calculate the "real" value |
|---|
| | 167 | try: GetOrientation = parentLayout.GetOrientation |
|---|
| | 168 | except AttributeError: pass |
|---|
| | 169 | else: |
|---|
| | 170 | if GetOrientation() == wx.wxVERTICAL: |
|---|
| | 171 | orientation = 'vertical' |
|---|
| | 172 | else: orientation = 'horizontal' |
|---|
| | 173 | |
|---|
| | 174 | orientation = self.orientation_aliases.get(orientation, orientation) |
|---|
| | 175 | return orientation |
|---|