[4faf4ba] | 1 | """ |
---|
[1d67243] | 2 | This module provide GUI for the neutron scattering length density calculator |
---|
[4faf4ba] | 3 | @author: Gervaise B. Alina |
---|
| 4 | """ |
---|
| 5 | |
---|
[785c8233] | 6 | import wx |
---|
[4faf4ba] | 7 | import sys |
---|
| 8 | |
---|
| 9 | from sans.guiframe.utils import format_number, check_float |
---|
| 10 | from sans.guicomm.events import StatusEvent |
---|
[1d67243] | 11 | from sldCalculator import SldCalculator |
---|
[4faf4ba] | 12 | |
---|
[785c8233] | 13 | _BOX_WIDTH = 76 |
---|
| 14 | _STATICBOX_WIDTH = 350 |
---|
[4faf4ba] | 15 | _SCALE = 1e-6 |
---|
[785c8233] | 16 | |
---|
| 17 | class SldPanel(wx.Panel): |
---|
[4faf4ba] | 18 | """ |
---|
| 19 | Provides the SLD calculator GUI. |
---|
| 20 | """ |
---|
| 21 | def __init__(self, parent,base=None, id = -1): |
---|
[785c8233] | 22 | wx.Panel.__init__(self, parent, id = id) |
---|
[4faf4ba] | 23 | # Object that receive status event |
---|
| 24 | self.base= base |
---|
[1d67243] | 25 | self.calculator = SldCalculator() |
---|
| 26 | self.wavelength = self.calculator.wavelength |
---|
| 27 | |
---|
[785c8233] | 28 | self._do_layout() |
---|
| 29 | self.SetAutoLayout(True) |
---|
| 30 | self.Layout() |
---|
| 31 | |
---|
| 32 | |
---|
| 33 | def _do_layout(self): |
---|
| 34 | """ |
---|
| 35 | Draw window content |
---|
| 36 | """ |
---|
| 37 | sizer_input = wx.GridBagSizer(5,5) |
---|
| 38 | sizer_output = wx.GridBagSizer(5,5) |
---|
| 39 | sizer_button = wx.BoxSizer(wx.HORIZONTAL) |
---|
| 40 | sizer1 = wx.BoxSizer(wx.HORIZONTAL) |
---|
| 41 | sizer2 = wx.BoxSizer(wx.HORIZONTAL) |
---|
| 42 | sizer3 = wx.BoxSizer(wx.HORIZONTAL) |
---|
| 43 | #---------inputs---------------- |
---|
| 44 | inputbox = wx.StaticBox(self, -1, "Input") |
---|
| 45 | boxsizer1 = wx.StaticBoxSizer(inputbox, wx.VERTICAL) |
---|
| 46 | boxsizer1.SetMinSize((_STATICBOX_WIDTH,-1)) |
---|
| 47 | |
---|
| 48 | compound_txt = wx.StaticText(self, -1, 'Compound') |
---|
| 49 | self.compound_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1)) |
---|
| 50 | density_txt = wx.StaticText(self, -1, 'Density(g/cm^3)') |
---|
| 51 | self.density_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1)) |
---|
| 52 | wavelength_txt = wx.StaticText(self, -1, 'Wavelength (A)') |
---|
| 53 | self.wavelength_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1)) |
---|
[1d67243] | 54 | self.wavelength_ctl.SetValue(str(self.wavelength)) |
---|
[785c8233] | 55 | iy = 0 |
---|
| 56 | ix = 0 |
---|
| 57 | sizer_input.Add(compound_txt,(iy, ix),(1,1),\ |
---|
| 58 | wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
| 59 | ix +=1 |
---|
| 60 | sizer_input.Add(self.compound_ctl,(iy, ix),(1,1),\ |
---|
| 61 | wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 62 | iy += 1 |
---|
| 63 | ix = 0 |
---|
| 64 | sizer_input.Add(density_txt,(iy, ix),(1,1),\ |
---|
| 65 | wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
| 66 | ix +=1 |
---|
| 67 | sizer_input.Add(self.density_ctl,(iy, ix),(1,1),\ |
---|
| 68 | wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 69 | iy += 1 |
---|
| 70 | ix = 0 |
---|
| 71 | sizer_input.Add(wavelength_txt,(iy, ix),(1,1),\ |
---|
| 72 | wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
| 73 | ix +=1 |
---|
| 74 | sizer_input.Add(self.wavelength_ctl,(iy, ix),(1,1),\ |
---|
| 75 | wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 76 | boxsizer1.Add( sizer_input ) |
---|
| 77 | sizer1.Add(boxsizer1,0, wx.EXPAND | wx.ALL, 10) |
---|
| 78 | #---------Outputs sizer-------- |
---|
| 79 | outputbox = wx.StaticBox(self, -1, "Output") |
---|
| 80 | boxsizer2 = wx.StaticBoxSizer(outputbox, wx.VERTICAL) |
---|
| 81 | boxsizer2.SetMinSize((_STATICBOX_WIDTH,-1)) |
---|
| 82 | |
---|
| 83 | unit_a= '[A^(-2)]' |
---|
| 84 | unit_cm1='[cm^(-1)]' |
---|
| 85 | unit_cm='[cm]' |
---|
| 86 | i_complex= '+ i' |
---|
| 87 | neutron_sld_txt = wx.StaticText(self, -1, 'Neutron SLD') |
---|
| 88 | self.neutron_sld_reel_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1)) |
---|
| 89 | self.neutron_sld_reel_ctl.SetEditable(False) |
---|
| 90 | self.neutron_sld_reel_ctl.SetToolTipString("Neutron SLD reel.") |
---|
| 91 | self.neutron_sld_im_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1)) |
---|
| 92 | self.neutron_sld_im_ctl.SetEditable(False) |
---|
| 93 | self.neutron_sld_im_ctl.SetToolTipString("Neutron SLD imaginary.") |
---|
| 94 | neutron_sld_units_txt = wx.StaticText(self, -1, unit_a) |
---|
| 95 | |
---|
| 96 | cu_ka_sld_txt = wx.StaticText(self, -1, 'Cu Ka SLD') |
---|
| 97 | self.cu_ka_sld_reel_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1)) |
---|
| 98 | self.cu_ka_sld_reel_ctl.SetEditable(False) |
---|
| 99 | self.cu_ka_sld_reel_ctl.SetToolTipString("Cu Ka SLD reel.") |
---|
| 100 | self.cu_ka_sld_im_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1)) |
---|
| 101 | self.cu_ka_sld_im_ctl.SetEditable(False) |
---|
| 102 | self.cu_ka_sld_im_ctl.SetToolTipString("Cu Ka SLD imaginary.") |
---|
| 103 | cu_ka_sld_units_txt = wx.StaticText(self, -1, unit_a) |
---|
| 104 | |
---|
| 105 | mo_ka_sld_txt = wx.StaticText(self, -1, 'Mo Ka SLD') |
---|
| 106 | self.mo_ka_sld_reel_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1)) |
---|
| 107 | self.mo_ka_sld_reel_ctl.SetEditable(False) |
---|
| 108 | self.mo_ka_sld_reel_ctl.SetToolTipString("Mo Ka SLD reel.") |
---|
| 109 | self.mo_ka_sld_im_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1)) |
---|
| 110 | self.mo_ka_sld_im_ctl.SetEditable(False) |
---|
| 111 | self.mo_ka_sld_im_ctl.SetToolTipString("Mo Ka SLD reel.") |
---|
| 112 | mo_ka_sld_units_txt = wx.StaticText(self, -1, unit_a) |
---|
| 113 | |
---|
| 114 | neutron_inc_txt = wx.StaticText(self, -1, 'Neutron Inc. Xs') |
---|
| 115 | self.neutron_inc_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1)) |
---|
| 116 | self.neutron_inc_ctl.SetEditable(False) |
---|
| 117 | self.neutron_inc_ctl.SetToolTipString("Neutron Inc. Xs") |
---|
[4faf4ba] | 118 | neutron_inc_units_txt = wx.StaticText(self, -1, unit_cm1) |
---|
[785c8233] | 119 | |
---|
| 120 | neutron_abs_txt = wx.StaticText(self, -1, 'Neutron Abs. Xs') |
---|
| 121 | self.neutron_abs_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1)) |
---|
| 122 | self.neutron_abs_ctl.SetEditable(False) |
---|
| 123 | self.neutron_abs_ctl.SetToolTipString("Neutron Abs. Xs") |
---|
[4faf4ba] | 124 | neutron_abs_units_txt = wx.StaticText(self, -1, unit_cm1) |
---|
[785c8233] | 125 | |
---|
| 126 | neutron_length_txt = wx.StaticText(self, -1, 'Neutron 1/e length') |
---|
| 127 | self.neutron_length_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1)) |
---|
| 128 | self.neutron_length_ctl.SetEditable(False) |
---|
| 129 | self.neutron_length_ctl.SetToolTipString("Neutron 1/e length") |
---|
[4faf4ba] | 130 | neutron_length_units_txt = wx.StaticText(self, -1, unit_cm) |
---|
[785c8233] | 131 | iy = 0 |
---|
| 132 | ix = 0 |
---|
| 133 | sizer_output.Add(neutron_sld_txt,(iy, ix),(1,1), |
---|
| 134 | wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
| 135 | ix +=1 |
---|
| 136 | sizer_output.Add(self.neutron_sld_reel_ctl,(iy, ix),(1,1), |
---|
| 137 | wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 138 | ix +=1 |
---|
| 139 | sizer_output.Add(wx.StaticText(self, -1, i_complex) |
---|
| 140 | ,(iy, ix),(1,1),wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 141 | ix +=1 |
---|
| 142 | sizer_output.Add(self.neutron_sld_im_ctl |
---|
| 143 | ,(iy, ix),(1,1),wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 144 | ix +=1 |
---|
| 145 | sizer_output.Add(neutron_sld_units_txt |
---|
| 146 | ,(iy, ix),(1,1),wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 147 | iy += 1 |
---|
| 148 | ix = 0 |
---|
| 149 | sizer_output.Add(cu_ka_sld_txt,(iy, ix),(1,1), |
---|
| 150 | wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
| 151 | ix +=1 |
---|
| 152 | sizer_output.Add(self.cu_ka_sld_reel_ctl,(iy, ix),(1,1), |
---|
| 153 | wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 154 | ix +=1 |
---|
| 155 | sizer_output.Add(wx.StaticText(self, -1, i_complex) |
---|
| 156 | ,(iy, ix),(1,1),wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 157 | ix +=1 |
---|
| 158 | sizer_output.Add(self.cu_ka_sld_im_ctl |
---|
| 159 | ,(iy, ix),(1,1),wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 160 | ix +=1 |
---|
| 161 | sizer_output.Add(cu_ka_sld_units_txt |
---|
| 162 | ,(iy, ix),(1,1),wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 163 | iy += 1 |
---|
| 164 | ix = 0 |
---|
| 165 | sizer_output.Add(mo_ka_sld_txt,(iy, ix),(1,1), |
---|
| 166 | wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
| 167 | ix +=1 |
---|
| 168 | sizer_output.Add(self.mo_ka_sld_reel_ctl,(iy, ix),(1,1), |
---|
| 169 | wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 170 | ix +=1 |
---|
| 171 | sizer_output.Add(wx.StaticText(self, -1, i_complex) |
---|
| 172 | ,(iy, ix),(1,1),wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 173 | ix +=1 |
---|
| 174 | sizer_output.Add(self.mo_ka_sld_im_ctl |
---|
| 175 | ,(iy, ix),(1,1),wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 176 | ix +=1 |
---|
| 177 | sizer_output.Add(mo_ka_sld_units_txt |
---|
| 178 | ,(iy, ix),(1,1),wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 179 | iy += 1 |
---|
| 180 | ix = 0 |
---|
| 181 | sizer_output.Add(neutron_inc_txt,(iy, ix),(1,1), |
---|
| 182 | wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
| 183 | ix +=1 |
---|
| 184 | sizer_output.Add(self.neutron_inc_ctl,(iy, ix),(1,1), |
---|
| 185 | wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
[4faf4ba] | 186 | ix +=2 |
---|
| 187 | sizer_output.Add(neutron_inc_units_txt,(iy, ix),(1,1), |
---|
| 188 | wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
[785c8233] | 189 | iy += 1 |
---|
| 190 | ix = 0 |
---|
| 191 | sizer_output.Add(neutron_abs_txt,(iy, ix),(1,1), |
---|
| 192 | wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
| 193 | ix +=1 |
---|
| 194 | sizer_output.Add(self.neutron_abs_ctl,(iy, ix),(1,1), |
---|
| 195 | wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
[4faf4ba] | 196 | ix +=2 |
---|
| 197 | sizer_output.Add(neutron_abs_units_txt,(iy, ix),(1,1), |
---|
| 198 | wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
[785c8233] | 199 | iy += 1 |
---|
| 200 | ix = 0 |
---|
| 201 | sizer_output.Add(neutron_length_txt,(iy, ix),(1,1), |
---|
| 202 | wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
| 203 | ix +=1 |
---|
| 204 | sizer_output.Add(self.neutron_length_ctl,(iy, ix),(1,1), |
---|
[4faf4ba] | 205 | wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 206 | ix +=2 |
---|
| 207 | sizer_output.Add(neutron_length_units_txt,(iy, ix),(1,1), |
---|
| 208 | wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
[785c8233] | 209 | boxsizer2.Add( sizer_output ) |
---|
| 210 | sizer2.Add(boxsizer2,0, wx.EXPAND | wx.ALL, 10) |
---|
| 211 | #-----Button sizer------------ |
---|
| 212 | id = wx.NewId() |
---|
[4faf4ba] | 213 | button_help = wx.Button(self, id, "Help") |
---|
| 214 | button_help.SetToolTipString("Help SlD calculations and formula.") |
---|
| 215 | self.Bind(wx.EVT_BUTTON, self.onHelp, id = id) |
---|
| 216 | |
---|
| 217 | id = wx.NewId() |
---|
[785c8233] | 218 | button_calculate = wx.Button(self, id, "Calculate") |
---|
| 219 | button_calculate.SetToolTipString("Calculate SlD of neutrons.") |
---|
[4faf4ba] | 220 | self.Bind(wx.EVT_BUTTON, self.calculateSld, id = id) |
---|
| 221 | |
---|
| 222 | sizer_button.Add((200, 20), 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 223 | sizer_button.Add(button_help, 0, wx.RIGHT|wx.ADJUST_MINSIZE,10) |
---|
| 224 | sizer_button.Add(button_calculate, 0, wx.RIGHT|wx.ADJUST_MINSIZE,20) |
---|
[785c8233] | 225 | sizer3.Add(sizer_button) |
---|
| 226 | #---------layout---------------- |
---|
| 227 | vbox = wx.BoxSizer(wx.VERTICAL) |
---|
| 228 | vbox.Add(sizer1) |
---|
| 229 | vbox.Add(sizer2) |
---|
| 230 | vbox.Add(sizer3) |
---|
| 231 | vbox.Fit(self) |
---|
| 232 | self.SetSizer(vbox) |
---|
| 233 | |
---|
[1d67243] | 234 | |
---|
[4faf4ba] | 235 | def check_inputs(self): |
---|
| 236 | """Check validity user inputs""" |
---|
| 237 | flag= True |
---|
| 238 | |
---|
| 239 | if check_float(self.density_ctl): |
---|
| 240 | self.density = float(self.density_ctl.GetValue()) |
---|
| 241 | else: |
---|
| 242 | flag=False |
---|
| 243 | raise ValueError,"Error for Density value :expect float" |
---|
| 244 | |
---|
| 245 | self.wavelength= self.wavelength_ctl.GetValue() |
---|
| 246 | if self.wavelength.lstrip().rstrip()=="": |
---|
[1d67243] | 247 | self.wavelength = self.calculator.wavelength |
---|
[4faf4ba] | 248 | else: |
---|
| 249 | if check_float(self.wavelength_ctl): |
---|
| 250 | self.wavelength= float(self.wavelength) |
---|
| 251 | else: |
---|
| 252 | flag = False |
---|
| 253 | raise ValueError,"Error for wavelenth value :expect float" |
---|
| 254 | |
---|
| 255 | self.formulata_text= self.compound_ctl.GetValue().lstrip().rstrip() |
---|
| 256 | if self.formulata_text!="": |
---|
| 257 | self.compound_ctl.SetBackgroundColour(wx.WHITE) |
---|
| 258 | self.compound_ctl.Refresh() |
---|
| 259 | else: |
---|
| 260 | self.compound_ctl.SetBackgroundColour("pink") |
---|
| 261 | self.compound_ctl.Refresh() |
---|
| 262 | flag=False |
---|
| 263 | raise ValueError, "Enter a formula" |
---|
| 264 | return flag |
---|
| 265 | |
---|
[1d67243] | 266 | |
---|
[4faf4ba] | 267 | def onHelp(self, event): |
---|
| 268 | """ |
---|
| 269 | provide more hint on the SLD calculator |
---|
| 270 | """ |
---|
| 271 | from helpPanel import HelpWindow |
---|
| 272 | frame = HelpWindow(None, -1, pageToOpen="doc/sld_calculator_help.html") |
---|
| 273 | frame.Show(True) |
---|
| 274 | name = "SLD_calculator" |
---|
| 275 | if frame.rhelp.HasAnchor(name): |
---|
| 276 | frame.rhelp.ScrollToAnchor(name) |
---|
| 277 | else: |
---|
| 278 | msg= "Cannot find SLD Calculator description " |
---|
| 279 | msg +="Please.Search in the Help window" |
---|
| 280 | wx.PostEvent(self.base, StatusEvent(status = msg )) |
---|
| 281 | |
---|
| 282 | |
---|
| 283 | def calculateSld(self, event): |
---|
| 284 | """ |
---|
| 285 | Calculate the neutron scattering density length of a molecule |
---|
| 286 | """ |
---|
| 287 | try: |
---|
| 288 | #Check validity user inputs |
---|
| 289 | if self.check_inputs(): |
---|
| 290 | #get ready to compute |
---|
| 291 | try: |
---|
[1d67243] | 292 | self.calculator.setValue(self.formulata_text,self.density,self.wavelength) |
---|
[4faf4ba] | 293 | except: |
---|
| 294 | if self.base !=None: |
---|
| 295 | msg= "SLD Calculator: %s" % (sys.exc_value) |
---|
| 296 | wx.PostEvent(self.base, StatusEvent(status= msg )) |
---|
| 297 | else: |
---|
| 298 | raise |
---|
| 299 | return |
---|
[1d67243] | 300 | |
---|
[4faf4ba] | 301 | # Compute the Cu SLD |
---|
[1d67243] | 302 | Cu_reel, Cu_im = self.calculator.calculateXRaySld( "Cu") |
---|
[4faf4ba] | 303 | self.cu_ka_sld_reel_ctl.SetValue(format_number(Cu_reel*_SCALE)) |
---|
| 304 | self.cu_ka_sld_im_ctl.SetValue(format_number(Cu_im*_SCALE)) |
---|
[1d67243] | 305 | |
---|
[4faf4ba] | 306 | # Compute the Mo SLD |
---|
[1d67243] | 307 | Mo_reel, Mo_im = self.calculator.calculateXRaySld( "Mo") |
---|
[4faf4ba] | 308 | self.mo_ka_sld_reel_ctl.SetValue(format_number(Mo_reel*_SCALE)) |
---|
| 309 | self.mo_ka_sld_im_ctl.SetValue(format_number(Mo_im*_SCALE)) |
---|
| 310 | |
---|
[1d67243] | 311 | coh,absorp,inc= self.calculator.calculateNSld() |
---|
[6c5239c] | 312 | im = self.calculator.calculateAbsorptionIm() |
---|
| 313 | length = self.calculator.calculateLength() |
---|
[1d67243] | 314 | # Neutron SLD |
---|
[4faf4ba] | 315 | self.neutron_sld_reel_ctl.SetValue(format_number(coh*_SCALE)) |
---|
| 316 | self.neutron_sld_im_ctl.SetValue(format_number(im*_SCALE)) |
---|
| 317 | self.neutron_inc_ctl.SetValue(format_number(inc )) |
---|
| 318 | self.neutron_abs_ctl.SetValue(format_number(absorp)) |
---|
[1d67243] | 319 | # Neutron length |
---|
[4faf4ba] | 320 | self.neutron_length_ctl.SetValue(format_number(length)) |
---|
[1d67243] | 321 | # display wavelength |
---|
| 322 | self.wavelength_ctl.SetValue(str(self.wavelength)) |
---|
[4faf4ba] | 323 | except: |
---|
| 324 | if self.base !=None: |
---|
| 325 | msg= "SLD Calculator: %s" % (sys.exc_value) |
---|
| 326 | wx.PostEvent(self.base, StatusEvent(status= msg )) |
---|
| 327 | else: |
---|
| 328 | raise |
---|
| 329 | return |
---|
| 330 | |
---|
[1d67243] | 331 | |
---|
[4faf4ba] | 332 | |
---|
[1d67243] | 333 | |
---|
[4faf4ba] | 334 | |
---|
| 335 | |
---|
| 336 | |
---|
[785c8233] | 337 | |
---|
[4faf4ba] | 338 | |
---|
[785c8233] | 339 | class SldWindow(wx.Frame): |
---|
[4faf4ba] | 340 | def __init__(self, parent=None, id=1, title="SLD Calculator",base=None): |
---|
[785c8233] | 341 | wx.Frame.__init__(self, parent, id, title, size=(400, 400)) |
---|
| 342 | |
---|
[4faf4ba] | 343 | self.panel = SldPanel(self, base=base) |
---|
[785c8233] | 344 | self.Centre() |
---|
| 345 | self.Show(True) |
---|
| 346 | |
---|
| 347 | class ViewApp(wx.App): |
---|
| 348 | def OnInit(self): |
---|
| 349 | frame = SldWindow(None, -1, 'SLD Calculator') |
---|
| 350 | frame.Show(True) |
---|
| 351 | self.SetTopWindow(frame) |
---|
| 352 | |
---|
| 353 | return True |
---|
| 354 | |
---|
| 355 | |
---|
| 356 | if __name__ == "__main__": |
---|
| 357 | app = ViewApp(0) |
---|
| 358 | app.MainLoop() |
---|