Changeset 55bc56bc in sasview for src/sas/sasgui/perspectives/file_converter/meta_panels.py
- Timestamp:
- Jul 19, 2016 11:08:42 AM (8 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- bf23693
- Parents:
- a027549
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/file_converter/meta_panels.py
r9318c4e r55bc56bc 297 297 self.SetSizer(vbox) 298 298 299 class SourcePanel(MetadataPanel): 300 301 def __init__(self, parent, source, base=None, *args, **kwargs): 302 MetadataPanel.__init__(self, parent, source, base, *args, **kwargs) 303 if source.name is None: 304 source.name = '' 305 source.wavelength_unit = 'nm' 306 307 self._do_layout() 308 self.SetAutoLayout(True) 309 self.Layout() 310 311 def on_close(self, event=None): 312 if not MetadataPanel.on_close(self, event): 313 return 314 315 self.parent.manager.metadata['source'] = self.metadata 316 self.parent.on_close(event) 317 318 def _do_layout(self): 319 vbox = wx.BoxSizer(wx.VERTICAL) 320 321 section = wx.StaticBox(self, -1, "Source") 322 section_sizer = wx.StaticBoxSizer(section, wx.VERTICAL) 323 section_sizer.SetMinSize((_STATICBOX_WIDTH, -1)) 324 325 input_grid = wx.GridBagSizer(5, 5) 326 327 y = 0 328 name_label = wx.StaticText(self, -1, "Name: ") 329 input_grid.Add(name_label, (y,0), (1,1), wx.ALL, 5) 330 name_input = wx.TextCtrl(self, -1, name="name") 331 input_grid.Add(name_input, (y,1), (1,1)) 332 name_input.Bind(wx.EVT_TEXT, self.on_change) 333 y += 1 334 335 radiation_label = wx.StaticText(self, -1, "Radiation: ") 336 input_grid.Add(radiation_label, (y,0), (1,1), wx.ALL, 5) 337 radiation_input = wx.ComboBox(self, -1, 338 choices=["neutron", "x-ray", "muon", "electron"], 339 name="radiation", style=wx.CB_READONLY) 340 radiation_input.Bind(wx.EVT_COMBOBOX, self.on_change) 341 input_grid.Add(radiation_input, (y,1), (1,1)) 342 y += 1 343 344 size_label = wx.StaticText(self, -1, "Beam Size (mm): ") 345 input_grid.Add(size_label, (y,0), (1,1), wx.ALL, 5) 346 size_input = VectorInput(self, "beam_size") 347 self._vectors.append(size_input) 348 input_grid.Add(size_input.GetSizer(), (y,1), (1,1)) 349 y += 1 350 351 shape_label = wx.StaticText(self, -1, "Beam Shape: ") 352 input_grid.Add(shape_label, (y,0), (1,1), wx.ALL, 5) 353 shape_input = wx.TextCtrl(self, -1, name="beam_shape") 354 shape_input.Bind(wx.EVT_TEXT, self.on_change) 355 input_grid.Add(shape_input, (y,1), (1,1)) 356 y += 1 357 358 wavelength_label = wx.StaticText(self, -1, "Wavelength (nm): ") 359 input_grid.Add(wavelength_label, (y,0), (1,1), wx.ALL, 5) 360 wavelength_input = wx.TextCtrl(self, -1, name="wavelength", 361 size=(50,-1)) 362 wavelength_input.Bind(wx.EVT_TEXT, self.on_change) 363 self._to_validate.append(wavelength_input) 364 input_grid.Add(wavelength_input, (y,1), (1,1)) 365 y += 1 366 367 min_wavelength_label = wx.StaticText(self, -1, "Min. Wavelength (nm): ") 368 input_grid.Add(min_wavelength_label, (y,0), (1,1), wx.ALL, 5) 369 min_wavelength_input = wx.TextCtrl(self, -1, name="wavelength_min", 370 size=(50,-1)) 371 min_wavelength_input.Bind(wx.EVT_TEXT, self.on_change) 372 self._to_validate.append(min_wavelength_input) 373 input_grid.Add(min_wavelength_input, (y,1), (1,1)) 374 y += 1 375 376 max_wavelength_label = wx.StaticText(self, -1, "Max. Wavelength (nm): ") 377 input_grid.Add(max_wavelength_label, (y,0), (1,1), wx.ALL, 5) 378 max_wavelength_input = wx.TextCtrl(self, -1, name="wavelength_max", 379 size=(50,-1)) 380 max_wavelength_input.Bind(wx.EVT_TEXT, self.on_change) 381 self._to_validate.append(max_wavelength_input) 382 input_grid.Add(max_wavelength_input, (y,1), (1,1)) 383 y += 1 384 385 wavelength_spread_label = wx.StaticText(self, -1, 386 "Wavelength Spread (%): ") 387 input_grid.Add(wavelength_spread_label, (y,0), (1,1), wx.ALL, 5) 388 wavelength_spread_input = wx.TextCtrl(self, -1, 389 name="wavelength_spread", size=(50,-1)) 390 wavelength_spread_input.Bind(wx.EVT_TEXT, self.on_change) 391 self._to_validate.append(wavelength_spread_input) 392 input_grid.Add(wavelength_spread_input, (y,1), (1,1)) 393 y += 1 394 395 396 name_input.SetValue(self.get_property_string("name")) 397 radiation_input.SetValue(self.get_property_string("radiation")) 398 size_input.SetValue(self.metadata.beam_size) 399 shape_input.SetValue(self.get_property_string("beam_shape")) 400 wavelength_input.SetValue( 401 self.get_property_string("wavelength", is_float=True)) 402 min_wavelength_input.SetValue( 403 self.get_property_string("wavelength_min", is_float=True)) 404 max_wavelength_input.SetValue( 405 self.get_property_string("wavelength_max", is_float=True)) 406 407 done_btn = wx.Button(self, -1, "Done") 408 input_grid.Add(done_btn, (y,0), (1,1), wx.ALL, 5) 409 done_btn.Bind(wx.EVT_BUTTON, self.on_close) 410 411 section_sizer.Add(input_grid) 412 vbox.Add(section_sizer, flag=wx.ALL, border=10) 413 414 vbox.Fit(self) 415 self.SetSizer(vbox) 416 417 299 418 class MetadataWindow(widget.CHILD_FRAME): 300 419
Note: See TracChangeset
for help on using the changeset viewer.