Changeset b0ab6cb in sasview for calculatorview/perspectives/calculator/collimation_editor.py
- Timestamp:
- Oct 27, 2010 4:41:30 PM (14 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, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 6cda91f
- Parents:
- c4d6900
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
calculatorview/perspectives/calculator/collimation_editor.py
r6137b150 rb0ab6cb 1 1 """ 2 """ 2 3 import wx 3 4 import sys … … 28 29 """ 29 30 """ 30 kwds['size'] = (PANEL_WIDTH, PANEL_HEIGHT)31 kwds['size'] = (PANEL_WIDTH, PANEL_HEIGHT) 31 32 kwds['title'] = "Collimation Editor" 32 33 wx.Dialog.__init__(self, parent=parent, *args, **kwds) … … 37 38 self._notes = "" 38 39 self._description = "Edit collimation" 40 #layout attributes 41 self.main_sizer = None 42 self.box_collimation = None 43 self.boxsizer_collimation = None 44 45 39 46 self._do_layout() 40 47 self.set_values() … … 45 52 """ 46 53 self.main_sizer = wx.BoxSizer(wx.VERTICAL) 47 self.box_collimation = wx.StaticBox(self, -1,str("Edit Selected Collimation")) 48 self.boxsizer_collimation = wx.StaticBoxSizer(self.box_collimation, wx.VERTICAL) 54 self.box_collimation = wx.StaticBox(self, -1, 55 str("Edit Selected Collimation")) 56 self.boxsizer_collimation = wx.StaticBoxSizer(self.box_collimation, 57 wx.VERTICAL) 49 58 50 59 collimation_box = wx.StaticBox(self, -1, "Edit Number of Collimations") … … 80 89 81 90 self.bt_remove_collimation = wx.Button(self, -1, "Remove") 82 self.bt_remove_collimation.SetToolTipString("Remove data's collimation.") 91 hint = "Remove data's collimation." 92 self.bt_remove_collimation.SetToolTipString(hint) 83 93 self.bt_remove_collimation.Bind(wx.EVT_BUTTON, self.remove_collimation) 84 94 85 self.collimation_button_sizer.AddMany([(collimation_name_txt, 0, wx.LEFT, 15), 95 self.collimation_button_sizer.AddMany([(collimation_name_txt, 0, 96 wx.LEFT, 15), 86 97 (self.collimation_cbox, 0, wx.LEFT, 5), 87 98 (self.bt_add_collimation, 0, wx.LEFT, 10), 88 (self.bt_remove_collimation, 0, wx.LEFT, 5)]) 99 (self.bt_remove_collimation, 100 0, wx.LEFT, 5)]) 89 101 collimation_hint_txt = 'No collimation is available for this data.' 90 102 self.collimation_txt = wx.StaticText(self, -1, collimation_hint_txt) 91 103 self.collimation_hint_sizer.Add(self.collimation_txt, 0, wx.LEFT, 10) 92 self.collimation_sizer.AddMany([(self.collimation_button_sizer, 0, wx.ALL, 10), 93 (self.collimation_hint_sizer, 0, wx.ALL, 10)]) 104 self.collimation_sizer.AddMany([(self.collimation_button_sizer, 105 0, wx.ALL, 10), 106 (self.collimation_hint_sizer, 107 0, wx.ALL, 10)]) 94 108 95 109 self.fill_collimation_combox() … … 115 129 self.length_tcl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH, 20), style=0) 116 130 length_unit_txt = wx.StaticText(self, -1, 'Unit: ') 117 self.length_unit_tcl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH, 20),style=0) 131 self.length_unit_tcl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH, 20), 132 style=0) 118 133 self.length_sizer.AddMany([(length_txt, 0, wx.LEFT|wx.RIGHT, 10), 119 134 (self.length_tcl, 0, wx.LEFT, 12), … … 165 180 self.aperture_txt = wx.StaticText(self, -1, aperture_hint_txt) 166 181 self.aperture_hint_sizer.Add(self.aperture_txt, 0, wx.LEFT, 10) 167 self.aperture_sizer.AddMany([(self.aperture_button_sizer, 0, wx.ALL, 10), 182 self.aperture_sizer.AddMany([(self.aperture_button_sizer, 183 0, wx.ALL, 10), 168 184 (self.aperture_hint_sizer, 0, wx.ALL, 10)]) 169 185 self.fill_aperture_combox() 170 186 self.enable_aperture() 171 187 172 def _do_layout(self , data=None):188 def _do_layout(self): 173 189 """ 174 190 Draw the current panel … … 265 281 def on_select_collimation(self, event): 266 282 """ 267 fill the control on the panel according to the current selected collimation 283 fill the control on the panel according to 284 the current selected collimation 268 285 """ 269 286 self.set_values() … … 275 292 Enable /disable widgets related to collimation 276 293 """ 277 if self._collimation is not None and self.collimation_cbox.GetCount() > 0: 294 if self._collimation is not None and \ 295 self.collimation_cbox.GetCount() > 0: 278 296 self.collimation_cbox.Enable() 279 297 self.bt_remove_collimation.Enable() 280 298 n_collimation = self.collimation_cbox.GetCount() 281 collimation_hint_txt = 'collimations available: %s '%str(n_collimation) 299 collimation_hint_txt = "collimations" 300 collimation_hint_txt += " available: %s "% str(n_collimation) 282 301 if len(self._collimation) > 0: 283 302 self.bt_remove_collimation.Enable() … … 491 510 collimation.length = float(length) 492 511 else: 493 self._notes += "Error: Expected a float for collimation length 494 self._notes += " won't changes length from "512 self._notes += "Error: Expected a float for collimation length" 513 self._notes += " won't changes length from " 495 514 self._notes += "%s to %s"%(collimation.length, length) 496 515 #change length unit … … 518 537 self.set_values() 519 538 if self.manager is not None: 520 539 self.manager.set_collimation(self._collimation) 521 540 522 541 523 if __name__ == "__main__":542 if __name__ == "__main__": 524 543 525 544 app = wx.App()
Note: See TracChangeset
for help on using the changeset viewer.