- Timestamp:
- Oct 21, 2015 8:35:00 AM (9 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:
- 85130cb
- Parents:
- 2d88fc4
- Location:
- src/sas
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/guiframe/gui_toolbar.py
r79492222 r6f16e25 36 36 Implement toolbar for guiframe 37 37 """ 38 ID_BOOKMARK = wx.NewId() 38 39 def __init__(self, parent, *args, **kwds): 39 40 Tbar.__init__(self, parent, *args, **kwds) … … 133 134 Add default items in bookmark menu 134 135 """ 135 id = wx.NewId() 136 self._bookmark_menu.Append(id, 'Bookmark This Page State') 136 self._bookmark_menu.Append(self.ID_BOOKMARK, 'Bookmark This Page State') 137 137 self._bookmark_menu.AppendSeparator() 138 wx.EVT_MENU(self, id, self.on_bookmark)138 wx.EVT_MENU(self, self.ID_BOOKMARK, self.on_bookmark) 139 139 140 140 def on_bind_button(self): -
src/sas/guiframe/local_perspectives/plotting/Plotter1D.py
r2d88fc4 r6f16e25 19 19 from sas.guiframe.events import StatusEvent 20 20 from sas.guiframe.events import PanelOnFocusEvent 21 from sas.guiframe.utils import PanelMenu 21 from sas.guiframe.utils import PanelMenu, IdList 22 22 from sas.guiframe.panel_base import PanelBase 23 23 from sas.guiframe.gui_style import GUIFRAME_ICON … … 35 35 """return the key of dictionary dic given the value""" 36 36 return [k for k, v in dic.iteritems() if v == val][0] 37 38 class IdCollection:39 def __init__(self):40 self._ids = []41 self._index = 042 def next(self):43 if len(self._ids) == self._index:44 self._ids.append(wx.NewId())45 self._index += 146 return self._ids[self._index-1]47 def reset(self):48 self._index = 049 50 37 51 38 class ModelPanel1D(PlotPanel, PanelBase): … … 63 50 ## Group ID 64 51 group_id = None 65 _menu_ids = Id Collection()52 _menu_ids = IdList() 66 53 67 54 def __init__(self, parent, id=-1, color=None, … … 80 67 81 68 self._available_data = [] 82 self._menu_add_ids = []83 69 self._symbol_labels = self.get_symbol_label() 84 70 self._color_labels = self.get_color_label() … … 568 554 self._slicerpop.set_plots(self.plots) 569 555 self._slicerpop.set_graph(self.graph) 570 self._menu_ids.reset()556 ids = iter(self._menu_ids) 571 557 if not self.graph.selected_plottable in self.plots: 572 558 # Various plot options 573 wx_id = self._menu_ids.next()559 wx_id = ids.next() 574 560 self._slicerpop.Append(wx_id, '&Save Image', 'Save image as PNG') 575 561 wx.EVT_MENU(self, wx_id, self.onSaveImage) 576 wx_id = self._menu_ids.next()562 wx_id = ids.next() 577 563 self._slicerpop.Append(wx_id, '&Print Image', 'Print image ') 578 564 wx.EVT_MENU(self, wx_id, self.onPrint) 579 565 580 wx_id = self._menu_ids.next()566 wx_id = ids.next() 581 567 self._slicerpop.Append(wx_id, '&Copy to Clipboard', 582 568 'Copy to the clipboard') … … 595 581 continue 596 582 597 wx_id = self._menu_ids.next()583 wx_id = ids.next() 598 584 plot_menu.Append(wx_id, "&DataInfo", name) 599 585 wx.EVT_MENU(self, wx_id, self. _onDataShow) 600 wx_id = self._menu_ids.next()586 wx_id = ids.next() 601 587 plot_menu.Append(wx_id, "&Save Points as a File", name) 602 588 wx.EVT_MENU(self, wx_id, self._onSave) … … 605 591 # add menu of other plugins 606 592 item_list = self.parent.get_current_context_menu(self) 607 608 593 if (not item_list == None) and (not len(item_list) == 0): 609 for item in item_list: 594 # Note: reusing menu ids in submenu. This code works because 595 # IdItems is set up as a lazy iterator returning each id in 596 # sequence, creating new ids as needed so it never runs out. 597 # zip() is set up to stop when any iterator is empty, so it 598 # only asks for the number of ids in item_list. 599 for item, wx_id in zip(item_list, self._menu_ids): 610 600 611 601 try: 612 wx_id = self._menu_ids.next()613 602 plot_menu.Append(wx_id, item[0], name) 614 603 wx.EVT_MENU(self, wx_id, item[2]) … … 620 609 621 610 if self.parent.ClassName.count('wxDialog') == 0: 622 wx_id = self._menu_ids.next()611 wx_id = ids.next() 623 612 plot_menu.Append(wx_id, '&Linear Fit', name) 624 613 wx.EVT_MENU(self, wx_id, self.onFitting) 625 614 plot_menu.AppendSeparator() 626 615 627 wx_id = self._menu_ids.next()616 wx_id = ids.next() 628 617 plot_menu.Append(wx_id, "Remove", name) 629 618 wx.EVT_MENU(self, wx_id, self._onRemove) 630 619 if not plot.is_data: 631 wx_id = self._menu_ids.next()620 wx_id = ids.next() 632 621 plot_menu.Append(wx_id, '&Freeze', name) 633 622 wx.EVT_MENU(self, wx_id, self.onFreeze) … … 635 624 636 625 if plot.is_data: 637 wx_id = self._menu_ids.next()626 wx_id = ids.next() 638 627 self.hide_menu = plot_menu.Append(wx_id, "Hide Error Bar", name) 639 628 … … 649 638 plot_menu.AppendSeparator() 650 639 651 wx_id = self._menu_ids.next()640 wx_id = ids.next() 652 641 plot_menu.Append(wx_id, '&Modify Plot Property', name) 653 642 wx.EVT_MENU(self, wx_id, self.createAppDialog) 654 wx_id = self._menu_ids.next()643 wx_id = ids.next() 655 644 # plot_menu.SetTitle(name) 656 645 self._slicerpop.AppendMenu(wx_id, '&%s' % name, plot_menu) … … 661 650 loc_menu = wx.Menu() 662 651 for label in self._loc_labels: 663 wx_id = self._menu_ids.next()652 wx_id = ids.next() 664 653 loc_menu.Append(wx_id, str(label), str(label)) 665 654 wx.EVT_MENU(self, wx_id, self.onChangeLegendLoc) 666 655 667 wx_id = self._menu_ids.next()656 wx_id = ids.next() 668 657 self._slicerpop.Append(wx_id, '&Modify Graph Appearance', 669 658 'Modify graph appearance') … … 673 662 674 663 if self.position != None: 675 wx_id = self._menu_ids.next()664 wx_id = ids.next() 676 665 self._slicerpop.Append(wx_id, '&Add Text') 677 666 wx.EVT_MENU(self, wx_id, self._on_addtext) 678 wx_id = self._menu_ids.next()667 wx_id = ids.next() 679 668 self._slicerpop.Append(wx_id, '&Remove Text') 680 669 wx.EVT_MENU(self, wx_id, self._on_removetext) 681 670 self._slicerpop.AppendSeparator() 682 wx_id = self._menu_ids.next()671 wx_id = ids.next() 683 672 self._slicerpop.Append(wx_id, '&Change Scale') 684 673 wx.EVT_MENU(self, wx_id, self._onProperties) 685 674 self._slicerpop.AppendSeparator() 686 wx_id = self._menu_ids.next()675 wx_id = ids.next() 687 676 self._slicerpop.Append(wx_id, '&Reset Graph Range') 688 677 wx.EVT_MENU(self, wx_id, self.onResetGraph) … … 690 679 if self.parent.ClassName.count('wxDialog') == 0: 691 680 self._slicerpop.AppendSeparator() 692 wx_id = self._menu_ids.next()681 wx_id = ids.next() 693 682 self._slicerpop.Append(wx_id, '&Window Title') 694 683 wx.EVT_MENU(self, wx_id, self.onChangeCaption) -
src/sas/guiframe/local_perspectives/plotting/Plotter2D.py
r2d88fc4 r6f16e25 287 287 288 288 """ 289 self._menu_ids.reset()289 ids = iter(self._menu_ids) 290 290 slicerpop = PanelMenu() 291 291 slicerpop.set_plots(self.plots) 292 292 slicerpop.set_graph(self.graph) 293 293 294 wx_id = self._menu_ids.next()294 wx_id = ids.next() 295 295 slicerpop.Append(wx_id, '&Save Image') 296 296 wx.EVT_MENU(self, wx_id, self.onSaveImage) 297 297 298 wx_id = self._menu_ids.next()298 wx_id = ids.next() 299 299 slicerpop.Append(wx_id, '&Print Image', 'Print image') 300 300 wx.EVT_MENU(self, wx_id, self.onPrint) 301 301 302 wx_id = self._menu_ids.next()302 wx_id = ids.next() 303 303 slicerpop.Append(wx_id, '&Copy to Clipboard', 'Copy to the clipboard') 304 304 wx.EVT_MENU(self, wx_id, self.OnCopyFigureMenu) … … 306 306 # saving data 307 307 plot = self.data2D 308 wx_id = self._menu_ids.next()308 wx_id = ids.next() 309 309 slicerpop.Append(wx_id, "&Data Info") 310 310 wx.EVT_MENU(self, wx_id, self._onDataShow) 311 311 312 wx_id = self._menu_ids.next()312 wx_id = ids.next() 313 313 slicerpop.Append(wx_id, "&Save as a File (DAT)") 314 314 self.action_ids[str(wx_id)] = plot … … 321 321 self.data2D.name.split(" ")[0] != 'Residuals': 322 322 # The line above; Not for trunk 323 for item in item_list: 323 # Note: reusing menu ids for the sub-menus. See Plotter1D. 324 for item, wx_id in zip(item_list, self._menu_ids): 324 325 try: 325 wx_id = self._menu_ids.next()326 326 slicerpop.Append(wx_id, item[0], item[1]) 327 327 wx.EVT_MENU(self, wx_id, item[2]) … … 332 332 slicerpop.AppendSeparator() 333 333 334 wx_id = self._menu_ids.next()334 wx_id = ids.next() 335 335 slicerpop.Append(wx_id, '&Perform Circular Average') 336 336 wx.EVT_MENU(self, wx_id, self.onCircular) \ 337 337 # For Masked Data 338 338 if not plot.mask.all(): 339 wx_id = self._menu_ids.next()339 wx_id = ids.next() 340 340 slicerpop.Append(wx_id, '&Masked Circular Average') 341 341 wx.EVT_MENU(self, wx_id, self.onMaskedCircular) 342 wx_id = self._menu_ids.next()342 wx_id = ids.next() 343 343 slicerpop.Append(wx_id, '&Sector [Q View]') 344 344 wx.EVT_MENU(self, wx_id, self.onSectorQ) 345 wx_id = self._menu_ids.next()345 wx_id = ids.next() 346 346 slicerpop.Append(wx_id, '&Annulus [Phi View ]') 347 347 wx.EVT_MENU(self, wx_id, self.onSectorPhi) 348 wx_id = self._menu_ids.next()348 wx_id = ids.next() 349 349 slicerpop.Append(wx_id, '&Box Sum') 350 350 wx.EVT_MENU(self, wx_id, self.onBoxSum) 351 wx_id = self._menu_ids.next()351 wx_id = ids.next() 352 352 slicerpop.Append(wx_id, '&Box Averaging in Qx') 353 353 wx.EVT_MENU(self, wx_id, self.onBoxavgX) 354 wx_id = self._menu_ids.next()354 wx_id = ids.next() 355 355 slicerpop.Append(wx_id, '&Box Averaging in Qy') 356 356 wx.EVT_MENU(self, wx_id, self.onBoxavgY) 357 357 if self.slicer != None: 358 wx_id = self._menu_ids.next()358 wx_id = ids.next() 359 359 slicerpop.Append(wx_id, '&Clear Slicer') 360 360 wx.EVT_MENU(self, wx_id, self.onClearSlicer) 361 361 if self.slicer.__class__.__name__ != "BoxSum": 362 wx_id = self._menu_ids.next()362 wx_id = ids.next() 363 363 slicerpop.Append(wx_id, '&Edit Slicer Parameters') 364 364 wx.EVT_MENU(self, wx_id, self._onEditSlicer) 365 365 slicerpop.AppendSeparator() 366 366 367 wx_id = self._menu_ids.next()367 wx_id = ids.next() 368 368 slicerpop.Append(wx_id, '&Edit Graph Label', 'Edit Graph Label') 369 369 wx.EVT_MENU(self, wx_id, self.onEditLabels) … … 372 372 # ILL mod here 373 373 374 wx_id = self._menu_ids.next()374 wx_id = ids.next() 375 375 slicerpop.Append(wx_id, '&Modify graph appearance', 'Modify graph appearance') 376 376 wx.EVT_MENU(self, wx_id, self.modifyGraphAppearance) 377 377 slicerpop.AppendSeparator() 378 378 379 wx_id = self._menu_ids.next()379 wx_id = ids.next() 380 380 slicerpop.Append(wx_id, '&2D Color Map') 381 381 wx.EVT_MENU(self, wx_id, self._onEditDetector) 382 382 slicerpop.AppendSeparator() 383 383 384 wx_id = self._menu_ids.next()384 wx_id = ids.next() 385 385 slicerpop.Append(wx_id, '&Toggle Linear/Log Scale') 386 386 wx.EVT_MENU(self, wx_id, self._onToggleScale) 387 387 388 388 slicerpop.AppendSeparator() 389 wx_id = self._menu_ids.next()389 wx_id = ids.next() 390 390 slicerpop.Append(wx_id, '&Window Title') 391 391 wx.EVT_MENU(self, wx_id, self.onChangeCaption) -
src/sas/guiframe/utils.py
r79492222 r6f16e25 123 123 return begin_flag, end_flag 124 124 125 class IdList: 126 """ 127 Create a list of wx ids that can be reused. 128 129 Ids for items need to be unique within their context. In a dynamic 130 application where the number of ids needed different each time the 131 form is created, depending for example, on the number of items that 132 need to be shown in the context menu, you cannot preallocate the 133 ids that you are going to use for the form. Instead, you can use 134 an IdList, which will reuse ids from context to context, adding new 135 ones if the new context requires more than a previous context. 136 137 IdList is set up as an iterator, which returns new ids forever 138 or until it runs out. This makes it pretty useful for defining 139 menus:: 140 141 class Form(wx.Dialog): 142 _form_id_pool = IdList() 143 def __init__(self): 144 ... 145 menu = wx.Menu() 146 for item, wx_id in zip(menu_items, self._form_id_pool): 147 name, description, callback = item 148 menu.Append(wx_id, name, description) 149 wx.EVT_MENU(self, wx_id, callback) 150 ... 151 152 It is a little unusual to use an iterator outside of a loop, but it is 153 supported. For example, when defining a form, your class definition 154 might look something like:: 155 156 class Form(wx.Dialog): 157 _form_id_pool = IdList() 158 def __init__(self, pairs, ...): 159 ids = iter(_form_id_pool) 160 ... 161 wx.StaticText(self, ids.next(), "Some key-value pairs") 162 for name, value in pairs: 163 label = wx.StaticText(self, ids.next(), name) 164 input = wx.TextCtrl(self, ids.next(), value=str(value)) 165 ... 166 ... 167 168 If the dialog is really dynamic, and not defined all in one place, then 169 save the id list iterator as *self._ids = iter(_form_id_pool)* in the 170 constructor. 171 172 The wx documentation is not clear on whether ids need to be unique. 173 Clearly different dialogs can use the same ids, as this is done for the 174 standard button ids such as wx.ID_HELP. Presumably each widget on the 175 form needs its own id, but whether these ids can match the ids of menu 176 items is not indicated, or whether different submenus need their own 177 ids. Using different id lists for menu items and widgets is safest, 178 but probably not necessary. And what about notebook tabs. Do the 179 ids need to be unique across all tabs? 180 """ 181 def __init__(self): 182 self._ids = [] 183 def __iter__(self): 184 return _IdListIterator(self) 185 def __getitem__(self, index): 186 while index >= len(self._ids): 187 self._ids.append(wx.NewId()) 188 return self._ids[index] 189 190 class _IdListIterator: 191 def __init__(self, id_list): 192 self.id_list = id_list 193 self.index = -1 194 def next(self): 195 self.index += 1 196 return self.id_list[self.index] 197 -
src/sas/perspectives/fitting/basepage.py
r2c8dc19 r6f16e25 15 15 from wx.lib.scrolledpanel import ScrolledPanel 16 16 from sas.guiframe.panel_base import PanelBase 17 from sas.guiframe.utils import format_number, check_float 17 from sas.guiframe.utils import format_number, check_float, IdList 18 18 from sas.guiframe.events import PanelOnFocusEvent 19 19 from sas.guiframe.events import StatusEvent … … 57 57 ## Title to appear on top of the window 58 58 window_caption = "Fit Page " 59 # These two buttons have specific IDs since they seem to be created more 60 # frequently than they need to. In particular, set_dispers_sizer() is 61 # called by _on_select_model 62 ID_BOOKMARK = wx.NewId() 63 ID_DISPERSER_HELP = wx.NewId() 64 _id_pool = IdList() 59 65 60 66 def __init__(self, parent, color='blue', **kwargs): … … 66 72 #Set window's font size 67 73 self.SetWindowVariant(variant=FONT_VARIANT) 68 69 74 self.SetBackgroundColour(color) 75 76 self._ids = iter(self._id_pool) 70 77 ## parent of the page 71 78 self.parent = parent … … 199 206 self.popUpMenu = wx.Menu() 200 207 201 id = wx.NewId()202 self._keep = wx.MenuItem(self.popUpMenu, id, "Add bookmark",208 wx_id = self._ids.next() 209 self._keep = wx.MenuItem(self.popUpMenu, wx_id, "Add bookmark", 203 210 " Keep the panel status to recall it later") 204 211 self.popUpMenu.AppendItem(self._keep) … … 206 213 self._set_bookmark_flag(False) 207 214 self._set_save_flag(False) 208 wx.EVT_MENU(self, id, self.on_bookmark)215 wx.EVT_MENU(self, wx_id, self.on_bookmark) 209 216 self.popUpMenu.AppendSeparator() 210 217 … … 594 601 fill sizer containing dispersity info 595 602 """ 603 #print "==== entering set_dispers_sizer ===" 596 604 self.sizer4.Clear(True) 597 605 name = "Polydispersity and Orientational Distribution" 598 box_description = wx.StaticBox(self, -1, name)606 box_description = wx.StaticBox(self, wx.ID_ANY, name) 599 607 box_description.SetForegroundColour(wx.BLUE) 600 608 boxsizer1 = wx.StaticBoxSizer(box_description, wx.VERTICAL) 601 609 #---------------------------------------------------- 602 self.disable_disp = wx.RadioButton(self, -1, 'Off', (10, 10),610 self.disable_disp = wx.RadioButton(self, wx.ID_ANY, 'Off', (10, 10), 603 611 style=wx.RB_GROUP) 604 self.enable_disp = wx.RadioButton(self, -1, 'On', (10, 30))612 self.enable_disp = wx.RadioButton(self, wx.ID_ANY, 'On', (10, 30)) 605 613 # best size for MAC and PC 606 614 if ON_MAC: … … 608 616 else: 609 617 size_q = (20, 15) 610 self.disp_help_bt = wx.Button(self, wx.NewId(), '?',618 self.disp_help_bt = wx.Button(self, self.ID_DISPERSER_HELP, '?', 611 619 style=wx.BU_EXACTFIT, 612 620 size=size_q) … … 624 632 sizer_dispersion.Add((20, 20)) 625 633 name = "" # Polydispersity and \nOrientational Distribution " 626 sizer_dispersion.Add(wx.StaticText(self, -1, name))634 sizer_dispersion.Add(wx.StaticText(self, wx.ID_ANY, name)) 627 635 sizer_dispersion.Add(self.enable_disp) 628 636 sizer_dispersion.Add((20, 20)) … … 795 803 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 796 804 797 id = wx.NewId() 798 self.popUpMenu.Append(id, name, str(msg)) 799 wx.EVT_MENU(self, id, self.onResetModel) 805 self.popUpMenu.Append(self.ID_BOOKMARK, name, str(msg)) 806 wx.EVT_MENU(self, self.ID_BOOKMARK, self.onResetModel) 800 807 wx.PostEvent(self._manager.parent, 801 808 AppendBookmarkEvent(title=name, … … 1438 1445 reset the context menu 1439 1446 """ 1447 ids = iter(self._id_pool) # Reusing ids for context menu 1440 1448 for name, _ in self.state.saved_states.iteritems(): 1441 1449 self.number_saved_state += 1 1442 1450 ## Add item in the context menu 1443 id = wx.NewId()1451 wx_id = ids.next() 1444 1452 msg = 'Save model and state %g' % self.number_saved_state 1445 self.popUpMenu.Append( id, name, msg)1446 wx.EVT_MENU(self, id, self.onResetModel)1453 self.popUpMenu.Append(wx_id, name, msg) 1454 wx.EVT_MENU(self, wx_id, self.onResetModel) 1447 1455 1448 1456 def _reset_plotting_range(self, state): … … 1831 1839 sld_data.name = 'SLD' 1832 1840 sld_data.axes = self.sld_axes 1833 self.panel = SLDPanel(self, data=sld_data, axes=self.sld_axes, id= -1) 1841 self.panel = SLDPanel(self, data=sld_data, axes=self.sld_axes, 1842 id=wx.ID_ANY) 1834 1843 self.panel.ShowModal() 1835 1844 … … 2421 2430 self.sizer4_4.Clear(True) 2422 2431 text = "No polydispersity available for this model" 2423 model_disp = wx.StaticText(self, -1, text)2432 model_disp = wx.StaticText(self, wx.ID_ANY, text) 2424 2433 self.sizer4_4.Add(model_disp, (iy, ix), (1, 1), 2425 2434 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 10) … … 2851 2860 name = self.formfactorbox.GetValue() 2852 2861 _PageAnchor = '#' + name.lower() 2853 _doc_viewer = DocumentationWindow(self, -1, _TreeLocation,2862 _doc_viewer = DocumentationWindow(self, wx.ID_ANY, _TreeLocation, 2854 2863 _PageAnchor, name + " Help") 2855 2864 else: 2856 _doc_viewer = DocumentationWindow(self, -1, _TreeLocation, "",2857 2865 _doc_viewer = DocumentationWindow(self, wx.ID_ANY, _TreeLocation, 2866 "", "General Model Help") 2858 2867 2859 2868 … … 2906 2915 2907 2916 _TreeLocation = "_images/M_angles_pic.bmp" 2908 _doc_viewer = DocumentationWindow(self, -1, _TreeLocation, "",2917 _doc_viewer = DocumentationWindow(self, wx.ID_ANY, _TreeLocation, "", 2909 2918 "Magnetic Angle Defintions") 2910 2919 … … 2926 2935 2927 2936 _TreeLocation = "user/perspectives/fitting/mag_help.html" 2928 _doc_viewer = DocumentationWindow(self, -1, _TreeLocation, "",2937 _doc_viewer = DocumentationWindow(self, wx.ID_ANY, _TreeLocation, "", 2929 2938 "Polarized Beam/Magnetc Help") 2930 2939 … … 2973 2982 _TreeLocation = "user/perspectives/fitting/pd_help.html" 2974 2983 _PageAnchor = "" 2975 _doc_viewer = DocumentationWindow(self, -1, _TreeLocation,2984 _doc_viewer = DocumentationWindow(self, wx.ID_ANY, _TreeLocation, 2976 2985 _PageAnchor, "Polydispersity Help") 2977 2986 … … 3517 3526 fill sizer containing model info 3518 3527 """ 3528 # This should only be called once per fit tab 3529 #print "==== Entering _fill_model_sizer" 3519 3530 ##Add model function Details button in fitpanel. 3520 3531 ##The following 3 lines are for Mac. Let JHC know before modifying... … … 3522 3533 self.formfactorbox = None 3523 3534 self.multifactorbox = None 3524 self.mbox_description = wx.StaticBox(self, -1, str(title))3535 self.mbox_description = wx.StaticBox(self, wx.ID_ANY, str(title)) 3525 3536 boxsizer1 = wx.StaticBoxSizer(self.mbox_description, wx.VERTICAL) 3526 3537 sizer_cat = wx.BoxSizer(wx.HORIZONTAL) 3527 3538 self.mbox_description.SetForegroundColour(wx.RED) 3528 id = wx.NewId() 3529 self.model_func = wx.Button(self, id, 'Help', size=(80, 23)) 3530 self.model_func.Bind(wx.EVT_BUTTON, self.on_function_help_clicked, id=id) 3539 wx_id = self._ids.next() 3540 self.model_func = wx.Button(self, wx_id, 'Help', size=(80, 23)) 3541 self.model_func.Bind(wx.EVT_BUTTON, self.on_function_help_clicked, 3542 id=wx_id) 3531 3543 self.model_func.SetToolTipString("Full Model Function Help") 3532 id = wx.NewId() 3533 self.model_help = wx.Button(self, id, 'Description', size=(80, 23)) 3534 self.model_help.Bind(wx.EVT_BUTTON, self.on_model_help_clicked, id=id) 3544 wx_id = self._ids.next() 3545 self.model_help = wx.Button(self, wx_id, 'Description', size=(80, 23)) 3546 self.model_help.Bind(wx.EVT_BUTTON, self.on_model_help_clicked, 3547 id=wx_id) 3535 3548 self.model_help.SetToolTipString("Short Model Function Description") 3536 id = wx.NewId()3537 self.model_view = wx.Button(self, id, "Show 2D", size=(80, 23))3538 self.model_view.Bind(wx.EVT_BUTTON, self._onModel2D, id= id)3549 wx_id = self._ids.next() 3550 self.model_view = wx.Button(self, wx_id, "Show 2D", size=(80, 23)) 3551 self.model_view.Bind(wx.EVT_BUTTON, self._onModel2D, id=wx_id) 3539 3552 hint = "toggle view of model from 1D to 2D or 2D to 1D" 3540 3553 self.model_view.SetToolTipString(hint) 3541 3554 3542 cat_set_box = wx.StaticBox(self, -1, 'Category')3555 cat_set_box = wx.StaticBox(self, wx.ID_ANY, 'Category') 3543 3556 sizer_cat_box = wx.StaticBoxSizer(cat_set_box, wx.HORIZONTAL) 3544 3557 sizer_cat_box.SetMinSize((200, 50)) 3545 self.categorybox = wx.ComboBox(self, -1, style=wx.CB_READONLY) 3558 self.categorybox = wx.ComboBox(self, wx.ID_ANY, 3559 style=wx.CB_READONLY) 3546 3560 self.categorybox.SetToolTip(wx.ToolTip("Select a Category/Type")) 3547 3561 self._populate_listbox() 3548 wx.EVT_COMBOBOX(self.categorybox, -1, self._show_combox)3549 #self.shape_rbutton = wx.RadioButton(self, -1, 'Shapes',3562 wx.EVT_COMBOBOX(self.categorybox, wx.ID_ANY, self._show_combox) 3563 #self.shape_rbutton = wx.RadioButton(self, wx.ID_ANY, 'Shapes', 3550 3564 # style=wx.RB_GROUP) 3551 #self.shape_indep_rbutton = wx.RadioButton(self, -1,3565 #self.shape_indep_rbutton = wx.RadioButton(self, wx.ID_ANY, 3552 3566 # "Shape-Independent") 3553 #self.struct_rbutton = wx.RadioButton(self, -1, "Structure Factor ") 3554 #self.plugin_rbutton = wx.RadioButton(self, -1, "Uncategorized") 3567 #self.struct_rbutton = wx.RadioButton(self, wx.ID_ANY, 3568 # "Structure Factor ") 3569 #self.plugin_rbutton = wx.RadioButton(self, wx.ID_ANY, 3570 # "Uncategorized") 3555 3571 3556 3572 #self.Bind(wx.EVT_RADIOBUTTON, self._show_combox, … … 3564 3580 #MAC needs SetValue 3565 3581 3566 show_cat_button = wx.Button(self, -1, "Modify")3582 show_cat_button = wx.Button(self, wx.ID_ANY, "Modify") 3567 3583 cat_tip = "Modify model categories \n" 3568 3584 cat_tip += "(also accessible from the menu bar)." … … 3590 3606 mutifactor_selection = wx.BoxSizer(wx.HORIZONTAL) 3591 3607 3592 self.text1 = wx.StaticText(self, -1, "")3593 self.text2 = wx.StaticText(self, -1, "P(Q)*S(Q)")3594 self.mutifactor_text = wx.StaticText(self, -1, "No. of Shells: ")3595 self.mutifactor_text1 = wx.StaticText(self, -1, "")3596 self.show_sld_button = wx.Button(self, -1, "Show SLD Profile")3608 self.text1 = wx.StaticText(self, wx.ID_ANY, "") 3609 self.text2 = wx.StaticText(self, wx.ID_ANY, "P(Q)*S(Q)") 3610 self.mutifactor_text = wx.StaticText(self, wx.ID_ANY, "No. of Shells: ") 3611 self.mutifactor_text1 = wx.StaticText(self, wx.ID_ANY, "") 3612 self.show_sld_button = wx.Button(self, wx.ID_ANY, "Show SLD Profile") 3597 3613 self.show_sld_button.Bind(wx.EVT_BUTTON, self._on_show_sld) 3598 3614 3599 self.formfactorbox = wx.ComboBox(self, -1, style=wx.CB_READONLY)3615 self.formfactorbox = wx.ComboBox(self, wx.ID_ANY, style=wx.CB_READONLY) 3600 3616 self.formfactorbox.SetToolTip(wx.ToolTip("Select a Model")) 3601 3617 if self.model != None: 3602 3618 self.formfactorbox.SetValue(self.model.name) 3603 self.structurebox = wx.ComboBox(self, -1, style=wx.CB_READONLY)3604 self.multifactorbox = wx.ComboBox(self, -1, style=wx.CB_READONLY)3619 self.structurebox = wx.ComboBox(self, wx.ID_ANY, style=wx.CB_READONLY) 3620 self.multifactorbox = wx.ComboBox(self, wx.ID_ANY, style=wx.CB_READONLY) 3605 3621 self.initialize_combox() 3606 wx.EVT_COMBOBOX(self.formfactorbox, -1, self._on_select_model)3607 3608 wx.EVT_COMBOBOX(self.structurebox, -1, self._on_select_model)3609 wx.EVT_COMBOBOX(self.multifactorbox, -1, self._on_select_model)3622 wx.EVT_COMBOBOX(self.formfactorbox, wx.ID_ANY, self._on_select_model) 3623 3624 wx.EVT_COMBOBOX(self.structurebox, wx.ID_ANY, self._on_select_model) 3625 wx.EVT_COMBOBOX(self.multifactorbox, wx.ID_ANY, self._on_select_model) 3610 3626 ## check model type to show sizer 3611 3627 if self.model != None: -
src/sas/perspectives/fitting/batchfitpage.py
r373d4ee r6f16e25 38 38 fill sizer 0 with data info 39 39 """ 40 self.data_box_description = wx.StaticBox(self, -1, 'I(q) Data Source')40 self.data_box_description = wx.StaticBox(self, wx.ID_ANY, 'I(q) Data Source') 41 41 if check_data_validity(self.data): 42 42 dname_color = wx.BLUE … … 47 47 #---------------------------------------------------------- 48 48 sizer_data = wx.BoxSizer(wx.VERTICAL) 49 text1 = wx.StaticText(self, -1, ' - Choose a file to set initial fit parameters -')49 text1 = wx.StaticText(self, wx.ID_ANY, ' - Choose a file to set initial fit parameters -') 50 50 text1.SetForegroundColour(wx.RED) 51 51 sizer_data.Add(text1) 52 text2 = wx.StaticText(self, -1, ' - This panel is not designed to view individual fits. - ')52 text2 = wx.StaticText(self, wx.ID_ANY, ' - This panel is not designed to view individual fits. - ') 53 53 text2.SetForegroundColour(wx.RED) 54 54 sizer_data.Add(text2) 55 55 56 56 combo = wx.BoxSizer(wx.HORIZONTAL) 57 self.dataSource = wx.ComboBox(self, -1, style=wx.CB_READONLY)58 wx.EVT_COMBOBOX(self.dataSource, -1, self.on_select_data)57 self.dataSource = wx.ComboBox(self, wx.ID_ANY, style=wx.CB_READONLY) 58 wx.EVT_COMBOBOX(self.dataSource, wx.ID_ANY, self.on_select_data) 59 59 self.dataSource.SetMinSize((_DATA_BOX_WIDTH, -1)) 60 60 61 combo.Add(wx.StaticText(self, -1, 'Name : '))61 combo.Add(wx.StaticText(self, wx.ID_ANY, 'Name : ')) 62 62 combo.Add((0, 5)) 63 63 combo.Add(self.dataSource) … … 86 86 # 87 87 # #Sizers 88 # box_description_range = wx.StaticBox(self, -1, str(title))88 # box_description_range = wx.StaticBox(self, wx.ID_ANY, str(title)) 89 89 # boxsizer_range = wx.StaticBoxSizer(box_description_range, wx.VERTICAL) 90 90 # self.sizer_set_smearer = wx.BoxSizer(wx.VERTICAL) … … 96 96 # sizer_fit = wx.GridSizer(2, 4, 2, 6) 97 97 # #Fit button 98 # self.btFit = wx.Button(self, wx.NewId(), 'Fit', size=(88, 25))98 # self.btFit = wx.Button(self, self._ids.next(), 'Fit', size=(88, 25)) 99 99 # self.default_bt_colour = self.btFit.GetDefaultAttributes() 100 100 # self.btFit.Bind(wx.EVT_BUTTON, self._onFit, id= self.btFit.GetId()) … … 102 102 # 103 103 # # Update and Draw button 104 # self.draw_button = wx.Button(self, wx.NewId(), 'Compute', size=(88, 24))104 # self.draw_button = wx.Button(self, self._ids.next(), 'Compute', size=(88, 24)) 105 105 # self.draw_button.Bind(wx.EVT_BUTTON, \ 106 106 # self._onDraw,id=self.draw_button.GetId()) … … 122 122 # self.sizer5.Clear(True) 123 123 # 124 # self.qmin = ModelTextCtrl(self, -1, size=(_BOX_WIDTH, 20),124 # self.qmin = ModelTextCtrl(self, wx.ID_ANY, size=(_BOX_WIDTH, 20), 125 125 # style=wx.TE_PROCESS_ENTER, 126 126 # text_enter_callback = self._onQrangeEnter) … … 128 128 # self.qmin.SetToolTipString("Minimun value of Q in linear scale.") 129 129 # 130 # self.qmax = ModelTextCtrl(self, -1, size=(_BOX_WIDTH, 20),130 # self.qmax = ModelTextCtrl(self, wx.ID_ANY, size=(_BOX_WIDTH, 20), 131 131 # style=wx.TE_PROCESS_ENTER, 132 132 # text_enter_callback=self._onQrangeEnter) … … 134 134 # self.qmax.SetToolTipString("Maximum value of Q in linear scale.") 135 135 # 136 # id = wx.NewId()136 # id = self._ids.next() 137 137 # self.reset_qrange =wx.Button(self, id, 'Reset', size=(77, 20)) 138 138 # … … 144 144 # sizer = wx.GridSizer(2, 4, 2, 6) 145 145 # 146 # self.btEditMask = wx.Button(self, wx.NewId(),'Editor', size=(88, 23))146 # self.btEditMask = wx.Button(self, self._ids.next(),'Editor', size=(88, 23)) 147 147 # self.btEditMask.Bind(wx.EVT_BUTTON, 148 148 # self._onMask,id=self.btEditMask.GetId()) 149 149 # self.btEditMask.SetToolTipString("Edit Mask.") 150 # self.EditMask_title = wx.StaticText(self, -1, ' Masking(2D)')151 # 152 # sizer.Add(wx.StaticText(self, -1, 'Q range'))153 # sizer.Add(wx.StaticText(self, -1, ' Min[1/A]'))154 # sizer.Add(wx.StaticText(self, -1, ' Max[1/A]'))150 # self.EditMask_title = wx.StaticText(self, wx.ID_ANY, ' Masking(2D)') 151 # 152 # sizer.Add(wx.StaticText(self, wx.ID_ANY, 'Q range')) 153 # sizer.Add(wx.StaticText(self, wx.ID_ANY, ' Min[1/A]')) 154 # sizer.Add(wx.StaticText(self, wx.ID_ANY, ' Max[1/A]')) 155 155 # sizer.Add(self.EditMask_title) 156 156 # -
src/sas/perspectives/fitting/fitpage.py
r225aca8 r6f16e25 93 93 fill sizer 0 with data info 94 94 """ 95 self.data_box_description = wx.StaticBox(self, -1, 'I(q) Data Source') 95 self.data_box_description = wx.StaticBox(self, wx.ID_ANY, 96 'I(q) Data Source') 96 97 if check_data_validity(self.data): 97 98 dname_color = wx.BLUE … … 102 103 #---------------------------------------------------------- 103 104 sizer_data = wx.BoxSizer(wx.HORIZONTAL) 104 self.dataSource = wx.ComboBox(self, -1, style=wx.CB_READONLY)105 wx.EVT_COMBOBOX(self.dataSource, -1, self.on_select_data)105 self.dataSource = wx.ComboBox(self, wx.ID_ANY, style=wx.CB_READONLY) 106 wx.EVT_COMBOBOX(self.dataSource, wx.ID_ANY, self.on_select_data) 106 107 self.dataSource.SetMinSize((_DATA_BOX_WIDTH, -1)) 107 sizer_data.Add(wx.StaticText(self, -1, 'Name : '))108 sizer_data.Add(wx.StaticText(self, wx.ID_ANY, 'Name : ')) 108 109 sizer_data.Add(self.dataSource) 109 110 sizer_data.Add((0, 5)) … … 221 222 222 223 #Sizers 223 box_description_range = wx.StaticBox(self, -1, str(title))224 box_description_range = wx.StaticBox(self, wx.ID_ANY, str(title)) 224 225 box_description_range.SetForegroundColour(wx.BLUE) 225 226 boxsizer_range = wx.StaticBoxSizer(box_description_range, wx.VERTICAL) … … 229 230 self.sizer_set_masking = wx.BoxSizer(wx.HORIZONTAL) 230 231 sizer_chi2 = wx.BoxSizer(wx.VERTICAL) 231 smear_set_box = wx.StaticBox(self, -1, 'Set Instrumental Smearing') 232 smear_set_box = wx.StaticBox(self, wx.ID_ANY, 233 'Set Instrumental Smearing') 232 234 sizer_smearer_box = wx.StaticBoxSizer(smear_set_box, wx.HORIZONTAL) 233 235 sizer_smearer_box.SetMinSize((_DATA_BOX_WIDTH, 60)) 234 236 235 weighting_set_box = wx.StaticBox(self, -1, \237 weighting_set_box = wx.StaticBox(self, wx.ID_ANY, 236 238 'Set Weighting by Selecting dI Source') 237 239 weighting_box = wx.StaticBoxSizer(weighting_set_box, wx.HORIZONTAL) … … 239 241 weighting_box.SetMinSize((_DATA_BOX_WIDTH, 40)) 240 242 #Filling the sizer containing weighting info. 241 self.dI_noweight = wx.RadioButton(self, -1, 'No Weighting',242 style=wx.RB_GROUP)243 self.dI_didata = wx.RadioButton(self, -1, 'Use dI Data')244 self.dI_sqrdata = wx.RadioButton(self, -1, 'Use |sqrt(I Data)|')245 self.dI_idata = wx.RadioButton(self, -1, 'Use |I Data|')243 self.dI_noweight = wx.RadioButton(self, wx.ID_ANY, 244 'No Weighting', style=wx.RB_GROUP) 245 self.dI_didata = wx.RadioButton(self, wx.ID_ANY, 'Use dI Data') 246 self.dI_sqrdata = wx.RadioButton(self, wx.ID_ANY, 'Use |sqrt(I Data)|') 247 self.dI_idata = wx.RadioButton(self, wx.ID_ANY, 'Use |I Data|') 246 248 self.Bind(wx.EVT_RADIOBUTTON, self.onWeighting, 247 249 id=self.dI_noweight.GetId()) … … 269 271 270 272 # combobox for smear2d accuracy selection 271 self.smear_accuracy = wx.ComboBox(self, -1, size=(50, -1),272 s tyle=wx.CB_READONLY)273 self.smear_accuracy = wx.ComboBox(self, wx.ID_ANY, 274 size=(50, -1), style=wx.CB_READONLY) 273 275 self._set_accuracy_list() 274 276 self.smear_accuracy.SetValue(self.smear2d_accuracy) 275 277 self.smear_accuracy.SetSelection(0) 276 self.smear_accuracy.SetToolTipString( \278 self.smear_accuracy.SetToolTipString( 277 279 "'Higher' uses more Gaussian points for smearing computation.") 278 280 279 wx.EVT_COMBOBOX(self.smear_accuracy, -1, self._on_select_accuracy) 281 wx.EVT_COMBOBOX(self.smear_accuracy, wx.ID_ANY, 282 self._on_select_accuracy) 280 283 281 284 #Fit button 282 self.btFit = wx.Button(self, wx.NewId(), 'Fit')285 self.btFit = wx.Button(self, self._ids.next(), 'Fit') 283 286 self.default_bt_colour = self.btFit.GetDefaultAttributes() 284 287 self.btFit.Bind(wx.EVT_BUTTON, self._onFit, id=self.btFit.GetId()) … … 286 289 287 290 #General Help button 288 self.btFitHelp = wx.Button(self, -1, 'Help')291 self.btFitHelp = wx.Button(self, wx.ID_ANY, 'Help') 289 292 self.btFitHelp.SetToolTipString("General fitting help.") 290 293 self.btFitHelp.Bind(wx.EVT_BUTTON, self._onFitHelp) … … 299 302 else: 300 303 size_q = (30, 20) #on MAC 301 self.btSmearHelp = wx.Button(self, -1, '?', style=wx.BU_EXACTFIT,\302 s ize=size_q)304 self.btSmearHelp = wx.Button(self, wx.ID_ANY, '?', 305 style=wx.BU_EXACTFIT, size=size_q) 303 306 self.btSmearHelp.SetToolTipString("Resolution smearing help.") 304 307 self.btSmearHelp.Bind(wx.EVT_BUTTON, self._onSmearHelp) 305 308 306 309 #textcntrl for custom resolution 307 self.smear_pinhole_max = ModelTextCtrl(self, -1,310 self.smear_pinhole_max = ModelTextCtrl(self, wx.ID_ANY, 308 311 size=(_BOX_WIDTH - 25, 20), 309 312 style=wx.TE_PROCESS_ENTER, 310 313 text_enter_callback=self.onPinholeSmear) 311 self.smear_pinhole_min = ModelTextCtrl(self, -1,314 self.smear_pinhole_min = ModelTextCtrl(self, wx.ID_ANY, 312 315 size=(_BOX_WIDTH - 25, 20), 313 316 style=wx.TE_PROCESS_ENTER, 314 317 text_enter_callback=self.onPinholeSmear) 315 self.smear_slit_height = ModelTextCtrl(self, -1,318 self.smear_slit_height = ModelTextCtrl(self, wx.ID_ANY, 316 319 size=(_BOX_WIDTH - 25, 20), 317 320 style=wx.TE_PROCESS_ENTER, 318 321 text_enter_callback=self.onSlitSmear) 319 self.smear_slit_width = ModelTextCtrl(self, -1,322 self.smear_slit_width = ModelTextCtrl(self, wx.ID_ANY, 320 323 size=(_BOX_WIDTH - 25, 20), 321 324 style=wx.TE_PROCESS_ENTER, … … 323 326 324 327 ## smear 325 self.smear_data_left = BGTextCtrl(self, -1,328 self.smear_data_left = BGTextCtrl(self, wx.ID_ANY, 326 329 size=(_BOX_WIDTH - 25, 20), style=0) 327 330 self.smear_data_left.SetValue(str(self.dq_l)) 328 self.smear_data_right = BGTextCtrl(self, -1,331 self.smear_data_right = BGTextCtrl(self, wx.ID_ANY, 329 332 size=(_BOX_WIDTH - 25, 20), style=0) 330 333 self.smear_data_right.SetValue(str(self.dq_r)) … … 337 340 338 341 #Filling the sizer containing instruments smearing info. 339 self.disable_smearer = wx.RadioButton(self, -1,342 self.disable_smearer = wx.RadioButton(self, wx.ID_ANY, 340 343 'None', style=wx.RB_GROUP) 341 self.enable_smearer = wx.RadioButton(self, -1, 342 'Use dQ Data') 344 self.enable_smearer = wx.RadioButton(self, wx.ID_ANY, 'Use dQ Data') 343 345 #self.enable_smearer.SetToolTipString( 344 346 #"Click to use the loaded dQ data for smearing.") 345 self.pinhole_smearer = wx.RadioButton(self, -1,347 self.pinhole_smearer = wx.RadioButton(self, wx.ID_ANY, 346 348 'Custom Pinhole Smear') 347 349 #self.pinhole_smearer.SetToolTipString 348 350 #("Click to input custom resolution for pinhole smearing.") 349 self.slit_smearer = wx.RadioButton(self, -1, 'Custom Slit Smear')351 self.slit_smearer = wx.RadioButton(self, wx.ID_ANY, 'Custom Slit Smear') 350 352 #self.slit_smearer.SetToolTipString 351 353 #("Click to input custom resolution for slit smearing.") … … 368 370 369 371 # StaticText for chi2, N(for fitting), Npts + Log/linear spacing 370 self.tcChi = BGTextCtrl(self, -1, "-", size=(75, 20), style=0)372 self.tcChi = BGTextCtrl(self, wx.ID_ANY, "-", size=(75, 20), style=0) 371 373 self.tcChi.SetToolTipString("Chi2/Npts(Fit)") 372 self.Npts_fit = BGTextCtrl(self, -1, "-", size=(75, 20), style=0)373 self.Npts_fit.SetToolTipString( \374 self.Npts_fit = BGTextCtrl(self, wx.ID_ANY, "-", size=(75, 20), style=0) 375 self.Npts_fit.SetToolTipString( 374 376 " Npts : number of points selected for fitting") 375 self.Npts_total = ModelTextCtrl(self, -1, 376 size=(_BOX_WIDTH, 20), 377 self.Npts_total = ModelTextCtrl(self, wx.ID_ANY, size=(_BOX_WIDTH, 20), 377 378 style=wx.TE_PROCESS_ENTER, 378 379 text_enter_callback=self._onQrangeEnter) … … 382 383 383 384 # Update and Draw button 384 self.draw_button = wx.Button(self, wx.NewId(), 'Compute')385 self.draw_button.Bind(wx.EVT_BUTTON, \385 self.draw_button = wx.Button(self, self._ids.next(), 'Compute') 386 self.draw_button.Bind(wx.EVT_BUTTON, 386 387 self._onDraw, id=self.draw_button.GetId()) 387 388 self.draw_button.SetToolTipString("Compute and Draw.") 388 389 389 390 self.points_sizer = wx.BoxSizer(wx.HORIZONTAL) 390 self.pointsbox = wx.CheckBox(self, -1, 'Log?', (10, 10))391 self.pointsbox = wx.CheckBox(self, wx.ID_ANY, 'Log?', (10, 10)) 391 392 self.pointsbox.SetValue(False) 392 393 self.pointsbox.SetToolTipString("Check mark to use log spaced points") 393 394 wx.EVT_CHECKBOX(self, self.pointsbox.GetId(), self.select_log) 394 395 395 self.points_sizer.Add(wx.StaticText(self, -1, 'Npts '))396 self.points_sizer.Add(wx.StaticText(self, wx.ID_ANY, 'Npts ')) 396 397 self.points_sizer.Add(self.pointsbox) 397 398 398 box_description_1 = wx.StaticText(self, -1, ' Chi2/Npts')399 box_description_2 = wx.StaticText(self, -1, 'Npts(Fit)')399 box_description_1 = wx.StaticText(self, wx.ID_ANY, ' Chi2/Npts') 400 box_description_2 = wx.StaticText(self, wx.ID_ANY, 'Npts(Fit)') 400 401 401 402 # StaticText for smear 402 self.smear_description_none = wx.StaticText(self, -1,403 self.smear_description_none = wx.StaticText(self, wx.ID_ANY, 403 404 smear_message_none, style=wx.ALIGN_LEFT) 404 self.smear_description_dqdata = wx.StaticText(self, 405 - 1,smear_message_dqdata, style=wx.ALIGN_LEFT)406 self.smear_description_type = wx.StaticText(self, 407 - 1,"Type:", style=wx.ALIGN_LEFT)408 self.smear_description_accuracy_type = wx.StaticText(self, -1,409 410 self.smear_description_smear_type = BGTextCtrl(self, -1,405 self.smear_description_dqdata = wx.StaticText(self, wx.ID_ANY, 406 smear_message_dqdata, style=wx.ALIGN_LEFT) 407 self.smear_description_type = wx.StaticText(self, wx.ID_ANY, 408 "Type:", style=wx.ALIGN_LEFT) 409 self.smear_description_accuracy_type = wx.StaticText(self, wx.ID_ANY, 410 "Accuracy:", style=wx.ALIGN_LEFT) 411 self.smear_description_smear_type = BGTextCtrl(self, wx.ID_ANY, 411 412 size=(57, 20), style=0) 412 413 self.smear_description_smear_type.SetValue(str(self.dq_l)) 413 414 self.SetBackgroundColour(self.GetParent().GetBackgroundColour()) 414 self.smear_description_2d = wx.StaticText(self, -1,415 self.smear_description_2d = wx.StaticText(self, wx.ID_ANY, 415 416 smear_message_2d, style=wx.ALIGN_LEFT) 416 self.smear_message_new_s = wx.StaticText(self, -1,417 self.smear_message_new_s = wx.StaticText(self, wx.ID_ANY, 417 418 smear_message_new_ssmear, style=wx.ALIGN_LEFT) 418 self.smear_message_new_p = wx.StaticText(self, -1,419 self.smear_message_new_p = wx.StaticText(self, wx.ID_ANY, 419 420 smear_message_new_psmear, style=wx.ALIGN_LEFT) 420 self.smear_description_2d_x = wx.StaticText(self, -1,421 self.smear_description_2d_x = wx.StaticText(self, wx.ID_ANY, 421 422 smear_message_2d_x_title, style=wx.ALIGN_LEFT) 422 self.smear_description_2d_x.SetToolTipString( \423 self.smear_description_2d_x.SetToolTipString( 423 424 " dQp(parallel) in q_r direction.") 424 self.smear_description_2d_y = wx.StaticText(self, -1,425 self.smear_description_2d_y = wx.StaticText(self, wx.ID_ANY, 425 426 smear_message_2d_y_title, style=wx.ALIGN_LEFT) 426 427 self.smear_description_2d_y.SetToolTipString(\ 427 428 " dQs(perpendicular) in q_phi direction.") 428 self.smear_description_pin_min = wx.StaticText(self, -1,429 self.smear_description_pin_min = wx.StaticText(self, wx.ID_ANY, 429 430 smear_message_pinhole_min_title, style=wx.ALIGN_LEFT) 430 self.smear_description_pin_max = wx.StaticText(self, -1,431 self.smear_description_pin_max = wx.StaticText(self, wx.ID_ANY, 431 432 smear_message_pinhole_max_title, style=wx.ALIGN_LEFT) 432 self.smear_description_slit_height = wx.StaticText(self, -1,433 self.smear_description_slit_height = wx.StaticText(self, wx.ID_ANY, 433 434 smear_message_slit_height_title, style=wx.ALIGN_LEFT) 434 self.smear_description_slit_width = wx.StaticText(self, -1,435 self.smear_description_slit_width = wx.StaticText(self, wx.ID_ANY, 435 436 smear_message_slit_width_title, style=wx.ALIGN_LEFT) 436 437 … … 519 520 self.sizer5.Clear(True) 520 521 521 self.qmin = ModelTextCtrl(self, -1, size=(_BOX_WIDTH, 20),522 self.qmin = ModelTextCtrl(self, wx.ID_ANY, size=(_BOX_WIDTH, 20), 522 523 style=wx.TE_PROCESS_ENTER, 523 524 set_focus_callback=self.qrang_set_focus, … … 530 531 self.qmin.SetToolTipString(qmin_tip) 531 532 532 self.qmax = ModelTextCtrl(self, -1, size=(_BOX_WIDTH, 20),533 self.qmax = ModelTextCtrl(self, wx.ID_ANY, size=(_BOX_WIDTH, 20), 533 534 style=wx.TE_PROCESS_ENTER, 534 535 set_focus_callback=self.qrang_set_focus, … … 545 546 self.qmin.Bind(wx.EVT_TEXT, self.on_qrange_text) 546 547 self.qmax.Bind(wx.EVT_TEXT, self.on_qrange_text) 547 wx_id = wx.NewId()548 wx_id = self._ids.next() 548 549 self.reset_qrange = wx.Button(self, wx_id, 'Reset') 549 550 … … 553 554 sizer = wx.GridSizer(5, 5, 2, 6) 554 555 555 self.btEditMask = wx.Button(self, wx.NewId(), 'Editor')556 self.btEditMask = wx.Button(self, self._ids.next(), 'Editor') 556 557 self.btEditMask.Bind(wx.EVT_BUTTON, self._onMask, 557 558 id=self.btEditMask.GetId()) 558 559 self.btEditMask.SetToolTipString("Edit Mask.") 559 self.EditMask_title = wx.StaticText(self, -1, ' Masking(2D)')560 561 sizer.Add(wx.StaticText(self, -1, ' Q range'))562 sizer.Add(wx.StaticText(self, -1, ' Min[1/A]'))563 sizer.Add(wx.StaticText(self, -1, ' Max[1/A]'))560 self.EditMask_title = wx.StaticText(self, wx.ID_ANY, ' Masking(2D)') 561 562 sizer.Add(wx.StaticText(self, wx.ID_ANY, ' Q range')) 563 sizer.Add(wx.StaticText(self, wx.ID_ANY, ' Min[1/A]')) 564 sizer.Add(wx.StaticText(self, wx.ID_ANY, ' Max[1/A]')) 564 565 sizer.Add(self.EditMask_title) 565 566 sizer.Add((-1,5)) … … 618 619 619 620 ## fill a sizer with the combobox to select dispersion type 620 model_disp = wx.StaticText(self, -1, 'Function')621 model_disp = wx.StaticText(self, wx.ID_ANY, 'Function') 621 622 CHECK_STATE = self.cb1.GetValue() 622 623 import sas.models.dispersion_models … … 625 626 ix = 0 626 627 iy = 0 627 disp = wx.StaticText(self, -1, ' ')628 disp = wx.StaticText(self, wx.ID_ANY, ' ') 628 629 self.sizer4_4.Add(disp, (iy, ix), (1, 1), 629 630 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 630 631 ix += 1 631 values = wx.StaticText(self, -1, 'PD[ratio]')632 values = wx.StaticText(self, wx.ID_ANY, 'PD[ratio]') 632 633 polytext = "Polydispersity (= STD/mean); " 633 634 polytext += "the standard deviation over the mean value." … … 641 642 else: 642 643 err_text = '' 643 self.text_disp_1 = wx.StaticText(self, -1, err_text)644 self.text_disp_1 = wx.StaticText(self, wx.ID_ANY, err_text) 644 645 self.sizer4_4.Add(self.text_disp_1, (iy, ix), (1, 1), \ 645 646 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 646 647 647 648 ix += 1 648 self.text_disp_min = wx.StaticText(self, -1, 'Min')649 self.text_disp_min = wx.StaticText(self, wx.ID_ANY, 'Min') 649 650 self.sizer4_4.Add(self.text_disp_min, (iy, ix), (1, 1), \ 650 651 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 651 652 652 653 ix += 1 653 self.text_disp_max = wx.StaticText(self, -1, 'Max')654 self.text_disp_max = wx.StaticText(self, wx.ID_ANY, 'Max') 654 655 self.sizer4_4.Add(self.text_disp_max, (iy, ix), (1, 1), 655 656 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 656 657 657 658 ix += 1 658 npts = wx.StaticText(self, -1, 'Npts')659 npts = wx.StaticText(self, wx.ID_ANY, 'Npts') 659 660 npts.SetToolTipString("Number of sampling points for the numerical\n\ 660 661 integration over the distribution function.") … … 662 663 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 663 664 ix += 1 664 nsigmas = wx.StaticText(self, -1, 'Nsigs')665 nsigmas = wx.StaticText(self, wx.ID_ANY, 'Nsigs') 665 666 nsigmas.SetToolTipString("Number of sigmas between which the range\n\ 666 667 of the distribution function will be used for weighting. \n\ … … 695 696 if p == "width": 696 697 ix = 0 697 cb = wx.CheckBox(self, -1, name0, (10, 10))698 cb = wx.CheckBox(self, wx.ID_ANY, name0, (10, 10)) 698 699 cb.SetValue(CHECK_STATE) 699 700 cb.SetToolTipString("Check mark to fit") … … 703 704 ix = 1 704 705 value = self.model.getParam(name1) 705 ctl1 = ModelTextCtrl(self, -1,706 ctl1 = ModelTextCtrl(self, wx.ID_ANY, 706 707 size=(_BOX_WIDTH / 1.3, 20), 707 708 style=wx.TE_PROCESS_ENTER) … … 715 716 ## text to show error sign 716 717 ix = 2 717 text2 = wx.StaticText(self, -1, '+/-')718 text2 = wx.StaticText(self, wx.ID_ANY, '+/-') 718 719 self.sizer4_4.Add(text2, (iy, ix), (1, 1), 719 720 wx.EXPAND | wx.ADJUST_MINSIZE, 0) … … 722 723 723 724 ix = 3 724 ctl2 = wx.TextCtrl(self, -1,725 ctl2 = wx.TextCtrl(self, wx.ID_ANY, 725 726 size=(_BOX_WIDTH / 1.3, 20), 726 727 style=0) … … 732 733 733 734 ix = 4 734 ctl3 = ModelTextCtrl(self, -1,735 ctl3 = ModelTextCtrl(self, wx.ID_ANY, 735 736 size=(_BOX_WIDTH / 2, 20), 736 737 style=wx.TE_PROCESS_ENTER, … … 741 742 742 743 ix = 5 743 ctl4 = ModelTextCtrl(self, -1,744 ctl4 = ModelTextCtrl(self, wx.ID_ANY, 744 745 size=(_BOX_WIDTH / 2, 20), 745 746 style=wx.TE_PROCESS_ENTER, … … 755 756 ix = 6 756 757 value = self.model.getParam(name2) 757 Tctl = ModelTextCtrl(self, -1,758 Tctl = ModelTextCtrl(self, wx.ID_ANY, 758 759 size=(_BOX_WIDTH / 2.2, 20), 759 760 style=wx.TE_PROCESS_ENTER) … … 767 768 ix = 7 768 769 value = self.model.getParam(name3) 769 Tct2 = ModelTextCtrl(self, -1,770 Tct2 = ModelTextCtrl(self, wx.ID_ANY, 770 771 size=(_BOX_WIDTH / 2.2, 20), 771 772 style=wx.TE_PROCESS_ENTER) … … 779 780 780 781 ix = 8 781 disp_box = wx.ComboBox(self, -1, size=(65, -1),782 disp_box = wx.ComboBox(self, wx.ID_ANY, size=(65, -1), 782 783 style=wx.CB_READONLY, name='%s' % name1) 783 784 for key, value in self.polydisp.iteritems(): … … 785 786 disp_box.Append(name_disp, value) 786 787 disp_box.SetStringSelection("gaussian") 787 wx.EVT_COMBOBOX(disp_box, -1, self._on_disp_func)788 wx.EVT_COMBOBOX(disp_box, wx.ID_ANY, self._on_disp_func) 788 789 self.sizer4_4.Add(disp_box, (iy, ix), (1, 1), wx.EXPAND) 789 790 self.fittable_param.append([cb, name1, ctl1, text2, … … 815 816 if p == "width": 816 817 ix = 0 817 cb = wx.CheckBox(self, -1, name0, (10, 10))818 cb = wx.CheckBox(self, wx.ID_ANY, name0, (10, 10)) 818 819 cb.SetValue(CHECK_STATE) 819 820 cb.SetToolTipString("Check mark to fit") … … 828 829 ix = 1 829 830 value = self.model.getParam(name1) 830 ctl1 = ModelTextCtrl(self, -1,831 ctl1 = ModelTextCtrl(self, wx.ID_ANY, 831 832 size=(_BOX_WIDTH / 1.3, 20), 832 833 style=wx.TE_PROCESS_ENTER) … … 854 855 ## text to show error sign 855 856 ix = 2 856 text2 = wx.StaticText(self, -1, '+/-')857 text2 = wx.StaticText(self, wx.ID_ANY, '+/-') 857 858 self.sizer4_4.Add(text2, (iy, ix), (1, 1), 858 859 wx.EXPAND | wx.ADJUST_MINSIZE, 0) … … 861 862 862 863 ix = 3 863 ctl2 = wx.TextCtrl(self, -1,864 ctl2 = wx.TextCtrl(self, wx.ID_ANY, 864 865 size=(_BOX_WIDTH / 1.3, 20), 865 866 style=0) … … 876 877 877 878 ix = 4 878 ctl3 = ModelTextCtrl(self, -1,879 ctl3 = ModelTextCtrl(self, wx.ID_ANY, 879 880 size=(_BOX_WIDTH / 2, 20), 880 881 style=wx.TE_PROCESS_ENTER, … … 887 888 888 889 ix = 5 889 ctl4 = ModelTextCtrl(self, -1,890 ctl4 = ModelTextCtrl(self, wx.ID_ANY, 890 891 size=(_BOX_WIDTH / 2, 20), 891 892 style=wx.TE_PROCESS_ENTER, … … 903 904 ix = 6 904 905 value = self.model.getParam(name2) 905 Tctl = ModelTextCtrl(self, -1,906 Tctl = ModelTextCtrl(self, wx.ID_ANY, 906 907 size=(_BOX_WIDTH / 2.2, 20), 907 908 style=wx.TE_PROCESS_ENTER) … … 923 924 ix = 7 924 925 value = self.model.getParam(name3) 925 Tct2 = ModelTextCtrl(self, -1,926 Tct2 = ModelTextCtrl(self, wx.ID_ANY, 926 927 size=(_BOX_WIDTH / 2.2, 20), 927 928 style=wx.TE_PROCESS_ENTER) … … 943 944 944 945 ix = 8 945 disp_box = wx.ComboBox(self, -1, size=(65, -1),946 disp_box = wx.ComboBox(self, wx.ID_ANY, size=(65, -1), 946 947 style=wx.CB_READONLY, name='%s' % name1) 947 948 for key, value in self.polydisp.iteritems(): … … 949 950 disp_box.Append(name_disp, value) 950 951 disp_box.SetStringSelection("gaussian") 951 wx.EVT_COMBOBOX(disp_box, -1, self._on_disp_func)952 wx.EVT_COMBOBOX(disp_box, wx.ID_ANY, self._on_disp_func) 952 953 self.sizer4_4.Add(disp_box, (iy, ix), (1, 1), wx.EXPAND) 953 954 self.fittable_param.append([cb, name1, ctl1, text2, … … 1079 1080 1080 1081 _TreeLocation = "user/perspectives/fitting/fitting_help.html" 1081 _doc_viewer = DocumentationWindow(self, -1, _TreeLocation, "",1082 _doc_viewer = DocumentationWindow(self, wx.ID_ANY, _TreeLocation, "", 1082 1083 "General Fitting Help") 1083 1084 … … 1098 1099 1099 1100 _TreeLocation = "user/perspectives/fitting/sm_help.html" 1100 _doc_viewer = DocumentationWindow(self, -1, _TreeLocation, "",1101 _doc_viewer = DocumentationWindow(self, wx.ID_ANY, _TreeLocation, "", 1101 1102 "Instrumental Resolution Smearing \ 1102 1103 Help") … … 1182 1183 self._keep.Enable(False) 1183 1184 self._set_save_flag(False) 1185 # TODO: why do we have to variables for one flag?? 1184 1186 self.enable_disp.SetValue(False) 1185 1187 self.disable_disp.SetValue(True) 1188 # TODO: should not have an untrapped exception when displaying disperser 1189 # TODO: do we need to create the disperser panel on every model change? 1190 # Note: if we fix this, then remove ID_DISPERSER_HELP from basepage 1186 1191 try: 1187 1192 self.set_dispers_sizer() … … 2831 2836 return 2832 2837 2833 box_description = wx.StaticBox(self, -1, str("Model Parameters"))2838 box_description = wx.StaticBox(self, wx.ID_ANY, str("Model Parameters")) 2834 2839 boxsizer1 = wx.StaticBoxSizer(box_description, wx.VERTICAL) 2835 2840 sizer = wx.GridBagSizer(5, 5) … … 2898 2903 ix = 0 2899 2904 select_text = "Select All" 2900 self.cb1 = wx.CheckBox(self, -1, str(select_text), (10, 10))2905 self.cb1 = wx.CheckBox(self, wx.ID_ANY, str(select_text), (10, 10)) 2901 2906 wx.EVT_CHECKBOX(self, self.cb1.GetId(), self.select_all_param) 2902 2907 self.cb1.SetToolTipString("To check/uncheck all the boxes below.") … … 2906 2911 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 5) 2907 2912 ix += 1 2908 self.text2_2 = wx.StaticText(self, -1, 'Value')2913 self.text2_2 = wx.StaticText(self, wx.ID_ANY, 'Value') 2909 2914 sizer.Add(self.text2_2, (iy, ix), (1, 1), \ 2910 2915 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 2911 2916 ix += 2 2912 self.text2_3 = wx.StaticText(self, -1, 'Error')2917 self.text2_3 = wx.StaticText(self, wx.ID_ANY, 'Error') 2913 2918 sizer.Add(self.text2_3, (iy, ix), (1, 1), \ 2914 2919 wx.EXPAND | wx.ADJUST_MINSIZE, 0) … … 2916 2921 self.text2_3.Hide() 2917 2922 ix += 1 2918 self.text2_min = wx.StaticText(self, -1, 'Min')2923 self.text2_min = wx.StaticText(self, wx.ID_ANY, 'Min') 2919 2924 sizer.Add(self.text2_min, (iy, ix), (1, 1), \ 2920 2925 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 2921 2926 #self.text2_min.Hide() 2922 2927 ix += 1 2923 self.text2_max = wx.StaticText(self, -1, 'Max')2928 self.text2_max = wx.StaticText(self, wx.ID_ANY, 'Max') 2924 2929 sizer.Add(self.text2_max, (iy, ix), (1, 1), \ 2925 2930 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 2926 2931 #self.text2_max.Hide() 2927 2932 ix += 1 2928 self.text2_4 = wx.StaticText(self, -1, '[Units]')2933 self.text2_4 = wx.StaticText(self, wx.ID_ANY, '[Units]') 2929 2934 sizer.Add(self.text2_4, (iy, ix), (1, 1), \ 2930 2935 wx.EXPAND | wx.ADJUST_MINSIZE, 0) … … 2947 2952 self.temp_multi_functional)\ 2948 2953 and (item in self.model.non_fittable): 2949 non_fittable_name = wx.StaticText(self, -1, item)2954 non_fittable_name = wx.StaticText(self, wx.ID_ANY, item) 2950 2955 sizer.Add(non_fittable_name, (iy, ix), (1, 1), \ 2951 2956 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 21) … … 2955 2960 if len(self.model.fun_list) > 0: 2956 2961 #num = item.split('_')[1][5:7] 2957 fun_box = wx.ComboBox(self, -1, size=(100, -1),2962 fun_box = wx.ComboBox(self, wx.ID_ANY, size=(100, -1), 2958 2963 style=wx.CB_READONLY, name='%s' % item) 2959 2964 self._set_fun_box_list(fun_box) … … 2961 2966 #self.fun_box.SetToolTipString("A function 2962 2967 # describing the interface") 2963 wx.EVT_COMBOBOX(fun_box, -1, self._on_fun_box)2968 wx.EVT_COMBOBOX(fun_box, wx.ID_ANY, self._on_fun_box) 2964 2969 else: 2965 fun_box = ModelTextCtrl(self, -1,2970 fun_box = ModelTextCtrl(self, wx.ID_ANY, 2966 2971 size=(_BOX_WIDTH, 20), 2967 2972 style=wx.TE_PROCESS_ENTER, name='%s' % item) … … 2975 2980 else: 2976 2981 ## add parameters name with checkbox for selecting to fit 2977 cb = wx.CheckBox(self, -1, item)2982 cb = wx.CheckBox(self, wx.ID_ANY, item) 2978 2983 cb.SetValue(CHECK_STATE) 2979 2984 cb.SetToolTipString(" Check mark to fit.") … … 2987 2992 ix += 1 2988 2993 value = self.model.getParam(item) 2989 ctl1 = ModelTextCtrl(self, -1, size=(_BOX_WIDTH, 20),2994 ctl1 = ModelTextCtrl(self, wx.ID_ANY, size=(_BOX_WIDTH, 20), 2990 2995 style=wx.TE_PROCESS_ENTER) 2991 2996 ctl1.SetToolTipString(\ … … 2995 3000 ## text to show error sign 2996 3001 ix += 1 2997 text2 = wx.StaticText(self, -1, '+/-')3002 text2 = wx.StaticText(self, wx.ID_ANY, '+/-') 2998 3003 sizer.Add(text2, (iy, ix), (1, 1), \ 2999 3004 wx.EXPAND | wx.ADJUST_MINSIZE, 0) … … 3001 3006 text2.Hide() 3002 3007 ix += 1 3003 ctl2 = wx.TextCtrl(self, -1,3008 ctl2 = wx.TextCtrl(self, wx.ID_ANY, 3004 3009 size=(_BOX_WIDTH / 1.2, 20), style=0) 3005 3010 sizer.Add(ctl2, (iy, ix), (1, 1), … … 3009 3014 3010 3015 ix += 1 3011 ctl3 = ModelTextCtrl(self, -1,3016 ctl3 = ModelTextCtrl(self, wx.ID_ANY, 3012 3017 size=(_BOX_WIDTH / 1.9, 20), 3013 3018 style=wx.TE_PROCESS_ENTER, … … 3021 3026 3022 3027 ix += 1 3023 ctl4 = ModelTextCtrl(self, -1,3028 ctl4 = ModelTextCtrl(self, wx.ID_ANY, 3024 3029 size=(_BOX_WIDTH / 1.9, 20), 3025 3030 style=wx.TE_PROCESS_ENTER, … … 3034 3039 # Units 3035 3040 if item in self.model.details: 3036 units = wx.StaticText(self, -1,3041 units = wx.StaticText(self, wx.ID_ANY, 3037 3042 self.model.details[item][0], style=wx.ALIGN_LEFT) 3038 3043 else: 3039 units = wx.StaticText(self, -1, "",3044 units = wx.StaticText(self, wx.ID_ANY, "", 3040 3045 style=wx.ALIGN_LEFT) 3041 3046 sizer.Add(units, (iy, ix), (1, 1), … … 3060 3065 for item in keys: 3061 3066 if item in self.model.orientation_params: 3062 orient_angle = wx.StaticText(self, -1, '[For 2D only]:')3063 mag_on_button = wx.Button(self, -1, "Magnetic ON")3067 orient_angle = wx.StaticText(self, wx.ID_ANY, '[For 2D only]:') 3068 mag_on_button = wx.Button(self, wx.ID_ANY, "Magnetic ON") 3064 3069 mag_on_button.SetToolTipString("Turn Pol Beam/Mag scatt on/off") 3065 3070 mag_on_button.Bind(wx.EVT_BUTTON, self._on_mag_on) 3066 mag_angle_help_button = wx.Button(self, -1, "Magnetic angles?")3071 mag_angle_help_button = wx.Button(self, wx.ID_ANY, "Magnetic angles?") 3067 3072 mag_angle_help_button.SetToolTipString("see angle definitions") 3068 mag_help_button = wx.Button(self, -1, "Mag HELP")3073 mag_help_button = wx.Button(self, wx.ID_ANY, "Mag HELP") 3069 3074 mag_help_button.SetToolTipString("Help on pol beam/mag fitting") 3070 3075 mag_help_button.Bind(wx.EVT_BUTTON, self._on_mag_help) … … 3124 3129 ix = 0 3125 3130 ## add parameters name with checkbox for selecting to fit 3126 cb = wx.CheckBox(self, -1, item)3131 cb = wx.CheckBox(self, wx.ID_ANY, item) 3127 3132 cb.SetValue(CHECK_STATE) 3128 3133 cb.SetToolTipString("Check mark to fit") -
src/sas/perspectives/fitting/fitpanel.py
rac7be54 r6f16e25 36 36 """ 37 37 """ 38 nb.__init__(self, parent, -1,38 nb.__init__(self, parent, wx.ID_ANY, 39 39 style=wx.aui.AUI_NB_WINDOWLIST_BUTTON | 40 40 wx.aui.AUI_NB_DEFAULT_STYLE | … … 324 324 if caption == "Const & Simul Fit": 325 325 self.sim_page = SimultaneousFitPage(self, page_finder=page_finder, 326 id= -1, batch_on=False)326 id= wx.ID_ANY, batch_on=False) 327 327 self.sim_page.window_caption = caption 328 328 self.sim_page.window_name = caption -
src/sas/perspectives/fitting/fitting.py
r7945367 r6f16e25 277 277 model_list = model_manager.get_model_name_list() 278 278 plug_dir = models.find_plugins_dir() 279 textdial = TextDialog(None, self, -1, 'Easy Sum/Multi(p1, p2) Editor',279 textdial = TextDialog(None, self, wx.ID_ANY, 'Easy Sum/Multi(p1, p2) Editor', 280 280 model_list, plug_dir) 281 281 self.put_icon(textdial) … … 760 760 _TreeLocation = "user/perspectives/fitting/optimizer.html" 761 761 _anchor = "#fit-"+algorithm_id 762 DocumentationWindow(self.parent, -1, _TreeLocation, _anchor, "Optimizer Help")762 DocumentationWindow(self.parent, wx.ID_ANY, _TreeLocation, _anchor, "Optimizer Help") 763 763 764 764 -
src/sas/perspectives/fitting/fitting_widgets.py
r2f4b430 r6f16e25 41 41 """ 42 42 vbox = wx.BoxSizer(wx.VERTICAL) 43 box_description = wx.StaticBox(self, -1, str("Hint"))43 box_description = wx.StaticBox(self, wx.ID_ANY, str("Hint")) 44 44 hint_sizer = wx.StaticBoxSizer(box_description, wx.VERTICAL) 45 45 selection_sizer = wx.GridBagSizer(5, 5) 46 46 button_sizer = wx.BoxSizer(wx.HORIZONTAL) 47 self.data_1d_selected = wx.RadioButton(self, -1, 'Data1D',47 self.data_1d_selected = wx.RadioButton(self, wx.ID_ANY, 'Data1D', 48 48 style=wx.RB_GROUP) 49 self.data_2d_selected = wx.RadioButton(self, -1, 'Data2D')49 self.data_2d_selected = wx.RadioButton(self, wx.ID_ANY, 'Data2D') 50 50 self.data_1d_selected.SetValue(True) 51 51 self.data_2d_selected.SetValue(False) … … 55 55 hint = "Selected Data set contains both 1D and 2D Data.\n" 56 56 hint += "Please select on type of analysis before proceeding.\n" 57 hint_sizer.Add(wx.StaticText(self, -1, hint))57 hint_sizer.Add(wx.StaticText(self, wx.ID_ANY, hint)) 58 58 #draw area containing radio buttons 59 59 ix = 0 … … 72 72 vbox.Add(hint_sizer, 0, wx.EXPAND | wx.ALL, 10) 73 73 vbox.Add(selection_sizer, 0, wx.TOP | wx.BOTTOM, 10) 74 vbox.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)74 vbox.Add(wx.StaticLine(self, wx.ID_ANY), 0, wx.EXPAND, 0) 75 75 vbox.Add(button_sizer, 0, wx.TOP | wx.BOTTOM, 10) 76 76 self.SetSizer(vbox) … … 103 103 return 104 104 select_data_text = " %s Data selected.\n" % str(self._nb_selected_data) 105 self._data_text_ctrl = wx.StaticText(self, -1, str(select_data_text))105 self._data_text_ctrl = wx.StaticText(self, wx.ID_ANY, str(select_data_text)) 106 106 107 107 self._data_text_ctrl.SetForegroundColour('blue') … … 126 126 text += "for adequate plot display size. \n" 127 127 text += "unchecked data won't be send to fitting . \n" 128 text_ctrl = wx.StaticText(self, -1, str(text))128 text_ctrl = wx.StaticText(self, wx.ID_ANY, str(text)) 129 129 self._sizer_txt.Add(text_ctrl) 130 130 iy = 0 … … 133 133 for i in range(len(data_list)): 134 134 data_count += 1 135 cb = wx.CheckBox(self._panel, -1, str(data_list[i].name), (10, 10))135 cb = wx.CheckBox(self._panel, wx.ID_ANY, str(data_list[i].name), (10, 10)) 136 136 wx.EVT_CHECKBOX(self, cb.GetId(), self._count_selected_data) 137 137 if data_count <= MAX_NBR_DATA: … … 153 153 self._sizer_button.Add(button_OK, 0, 154 154 wx.LEFT | wx.RIGHT | wx.ADJUST_MINSIZE, 10) 155 static_line = wx.StaticLine(self, -1)155 static_line = wx.StaticLine(self, wx.ID_ANY) 156 156 self._sizer_txt.Add(self._panel, 0, wx.EXPAND | wx.ALL, 10) 157 157 self._sizer_main.Add(self._sizer_txt, 0, wx.EXPAND | wx.ALL, 10) -
src/sas/perspectives/fitting/hint_fitpage.py
r2f4b430 r6f16e25 27 27 """ 28 28 name = "Hint" 29 box_description = wx.StaticBox(self, -1, name)29 box_description = wx.StaticBox(self, wx.ID_ANY, name) 30 30 boxsizer = wx.StaticBoxSizer(box_description, wx.VERTICAL) 31 31 msg = " How to link data to the control panel: \n \n" … … 33 33 msg += " Then Highlight and right click on the data plot. \n" 34 34 msg += " Finally, select 'Select data for fitting' in the pop-up menu. \n" 35 self.hint_txt = wx.StaticText(self, -1, msg, style=wx.ALIGN_LEFT)35 self.hint_txt = wx.StaticText(self, wx.ID_ANY, msg, style=wx.ALIGN_LEFT) 36 36 boxsizer.Add(self.hint_txt, wx.ALL | wx.EXPAND, 20) 37 37 self.vbox = wx.BoxSizer(wx.VERTICAL) -
src/sas/perspectives/fitting/pagestate.py
r0e33a8d r6f16e25 605 605 images = self.set_plot_state(figs, canvases) 606 606 report_list = [report_str, text_str, images] 607 dialog = ReportDialog(report_list, None, -1, "")607 dialog = ReportDialog(report_list, None, wx.ID_ANY, "") 608 608 dialog.Show() 609 609 -
src/sas/perspectives/fitting/resultpanel.py
r9df6a03 r6f16e25 41 41 | wx.CLIP_CHILDREN) 42 42 & ~wx.aui.AUI_NB_CLOSE_ON_ACTIVE_TAB) 43 Notebook.__init__(self, parent, -1, style=style)43 Notebook.__init__(self, parent, wx.ID_ANY, style=style) 44 44 PanelBase.__init__(self, parent) 45 45 self.frame = parent -
src/sas/perspectives/fitting/simfitpage.py
racf8e4a5 r6f16e25 46 46 ## Title to appear on top of the window 47 47 window_caption = "Simultaneous Fit Page" 48 49 def __init__(self, parent, page_finder={}, id= -1, batch_on=False, 48 ID_SET_ALL = wx.NewId() 49 ID_REMOVE = wx.NewId() 50 ID_FIT = wx.NewId() 51 ID_ADD = wx.NewId() 52 53 def __init__(self, parent, page_finder={}, id= wx.ID_ANY, batch_on=False, 50 54 *args, **kwargs): 51 55 ScrolledPanel.__init__(self, parent, id=id, … … 78 82 self.model_cbox_left = None 79 83 self.model_cbox_right = None 80 self.uid = wx.NewId()81 84 ## draw page 82 85 self.define_page_structure() … … 294 297 295 298 self.sizer1.Clear(True) 296 box_description = wx.StaticBox(self, -1, "Fit Combinations")299 box_description = wx.StaticBox(self, wx.ID_ANY, "Fit Combinations") 297 300 boxsizer1 = wx.StaticBoxSizer(box_description, wx.VERTICAL) 298 301 sizer_title = wx.BoxSizer(wx.HORIZONTAL) … … 303 306 msg += " Please load data and set up " 304 307 msg += "at least two fit panels first..." 305 sizer_title.Add(wx.StaticText(self, -1, msg))308 sizer_title.Add(wx.StaticText(self, wx.ID_ANY, msg)) 306 309 else: 307 310 ## store model 308 311 self._store_model() 309 312 310 self.cb1 = wx.CheckBox(self, -1, 'Select all')313 self.cb1 = wx.CheckBox(self, wx.ID_ANY, 'Select all') 311 314 self.cb1.SetValue(False) 312 315 … … 370 373 Show constraint fields 371 374 """ 372 box_description = wx.StaticBox(self, -1, "Easy Setup ")375 box_description = wx.StaticBox(self, wx.ID_ANY, "Easy Setup ") 373 376 boxsizer = wx.StaticBoxSizer(box_description, wx.HORIZONTAL) 374 377 sizer_constraint = wx.BoxSizer(wx.HORIZONTAL) 375 self.model_cbox_left = wx.ComboBox(self, -1, style=wx.CB_READONLY)378 self.model_cbox_left = wx.ComboBox(self, wx.ID_ANY, style=wx.CB_READONLY) 376 379 self.model_cbox_left.Clear() 377 self.model_cbox_right = wx.ComboBox(self, -1, style=wx.CB_READONLY)380 self.model_cbox_right = wx.ComboBox(self, wx.ID_ANY, style=wx.CB_READONLY) 378 381 self.model_cbox_right.Clear() 379 wx.EVT_COMBOBOX(self.model_cbox_left, -1, self._on_select_modelcb)380 wx.EVT_COMBOBOX(self.model_cbox_right, -1, self._on_select_modelcb)381 egal_txt = wx.StaticText(self, -1, " = ")382 self.set_button = wx.Button(self, wx.NewId(), 'Set All')382 wx.EVT_COMBOBOX(self.model_cbox_left, wx.ID_ANY, self._on_select_modelcb) 383 wx.EVT_COMBOBOX(self.model_cbox_right, wx.ID_ANY, self._on_select_modelcb) 384 egal_txt = wx.StaticText(self, wx.ID_ANY, " = ") 385 self.set_button = wx.Button(self, self.ID_SET_ALL, 'Set All') 383 386 self.set_button.Bind(wx.EVT_BUTTON, self._on_set_all_equal, 384 387 id=self.set_button.GetId()) … … 399 402 boxsizer.Add(self.model_cbox_left, 400 403 flag=wx.RIGHT | wx.EXPAND, border=10) 401 boxsizer.Add(wx.StaticText(self, -1, ".parameters"),404 boxsizer.Add(wx.StaticText(self, wx.ID_ANY, ".parameters"), 402 405 flag=wx.RIGHT | wx.EXPAND, border=5) 403 406 boxsizer.Add(egal_txt, flag=wx.RIGHT | wx.EXPAND, border=5) 404 407 boxsizer.Add(self.model_cbox_right, 405 408 flag=wx.RIGHT | wx.EXPAND, border=10) 406 boxsizer.Add(wx.StaticText(self, -1, ".parameters"),409 boxsizer.Add(wx.StaticText(self, wx.ID_ANY, ".parameters"), 407 410 flag=wx.RIGHT | wx.EXPAND, border=5) 408 411 boxsizer.Add((20, -1)) … … 510 513 511 514 sizer_constraint = wx.BoxSizer(wx.HORIZONTAL) 512 model_cbox = wx.ComboBox(self, -1, style=wx.CB_READONLY)515 model_cbox = wx.ComboBox(self, wx.ID_ANY, style=wx.CB_READONLY) 513 516 model_cbox.Clear() 514 param_cbox = wx.ComboBox(self, -1, style=wx.CB_READONLY, size=(100, -1),)517 param_cbox = wx.ComboBox(self, wx.ID_ANY, style=wx.CB_READONLY, size=(100, -1),) 515 518 param_cbox.Hide() 516 519 … … 518 521 self.param_cbox = param_cbox 519 522 520 wx.EVT_COMBOBOX(param_cbox, -1, self._on_select_param)521 self.ctl2 = wx.TextCtrl(self, -1)522 egal_txt = wx.StaticText(self, -1, " = ")523 self.btRemove = wx.Button(self, wx.NewId(), 'Remove')523 wx.EVT_COMBOBOX(param_cbox, wx.ID_ANY, self._on_select_param) 524 self.ctl2 = wx.TextCtrl(self, wx.ID_ANY) 525 egal_txt = wx.StaticText(self, wx.ID_ANY, " = ") 526 self.btRemove = wx.Button(self, self.ID_REMOVE, 'Remove') 524 527 self.btRemove.Bind(wx.EVT_BUTTON, self.onRemove, 525 528 id=self.btRemove.GetId()) … … 536 539 self.model_cbox = model_cbox 537 540 538 wx.EVT_COMBOBOX(model_cbox, -1, self._on_select_model)539 sizer_constraint.Add((5, -1))541 wx.EVT_COMBOBOX(model_cbox, wx.ID_ANY, self._on_select_model) 542 sizer_constraint.Add((5, wx.ID_ANY)) 540 543 sizer_constraint.Add(model_cbox, flag=wx.RIGHT | wx.EXPAND, border=10) 541 544 sizer_constraint.Add(param_cbox, flag=wx.RIGHT | wx.EXPAND, border=5) … … 672 675 """ 673 676 self.sizer3.Clear(True) 674 box_description = wx.StaticBox(self, -1, "Fit ")677 box_description = wx.StaticBox(self, wx.ID_ANY, "Fit ") 675 678 boxsizer1 = wx.StaticBoxSizer(box_description, wx.VERTICAL) 676 679 sizer_button = wx.BoxSizer(wx.HORIZONTAL) 677 680 678 self.btFit = wx.Button(self, wx.NewId(), 'Fit', size=wx.DefaultSize)681 self.btFit = wx.Button(self, self.ID_FIT, 'Fit', size=wx.DefaultSize) 679 682 self.btFit.Bind(wx.EVT_BUTTON, self.onFit, id=self.btFit.GetId()) 680 683 self.btFit.SetToolTipString("Perform fit.") … … 684 687 text = " This page requires at least one FitPage with a data\n" 685 688 text = " and a model for fitting." 686 text_hint = wx.StaticText(self, -1, text)689 text_hint = wx.StaticText(self, wx.ID_ANY, text) 687 690 688 691 sizer_button.Add(text_hint, wx.RIGHT | wx.EXPAND, 10) … … 705 708 self.sizer2.Show(False) 706 709 return 707 box_description = wx.StaticBox(self, -1, "Fit Constraints")710 box_description = wx.StaticBox(self, wx.ID_ANY, "Fit Constraints") 708 711 boxsizer1 = wx.StaticBoxSizer(box_description, wx.VERTICAL) 709 712 sizer_title = wx.BoxSizer(wx.HORIZONTAL) … … 712 715 sizer_button = wx.BoxSizer(wx.HORIZONTAL) 713 716 714 self.hide_constraint = wx.RadioButton(self, -1, 'No', (10, 10),717 self.hide_constraint = wx.RadioButton(self, wx.ID_ANY, 'No', (10, 10), 715 718 style=wx.RB_GROUP) 716 self.show_constraint = wx.RadioButton(self, -1, 'Yes', (10, 30))719 self.show_constraint = wx.RadioButton(self, wx.ID_ANY, 'Yes', (10, 30)) 717 720 self.Bind(wx.EVT_RADIOBUTTON, self._display_constraint, 718 721 id=self.hide_constraint.GetId()) … … 725 728 self.show_constraint.SetValue(False) 726 729 727 sizer_title.Add(wx.StaticText(self, -1, " Model"))730 sizer_title.Add(wx.StaticText(self, wx.ID_ANY, " Model")) 728 731 sizer_title.Add((10, 10)) 729 sizer_title.Add(wx.StaticText(self, -1, " Parameter"))732 sizer_title.Add(wx.StaticText(self, wx.ID_ANY, " Parameter")) 730 733 sizer_title.Add((10, 10)) 731 sizer_title.Add(wx.StaticText(self, -1, " Add Constraint?"))734 sizer_title.Add(wx.StaticText(self, wx.ID_ANY, " Add Constraint?")) 732 735 sizer_title.Add((10, 10)) 733 736 sizer_title.Add(self.show_constraint) … … 735 738 sizer_title.Add((10, 10)) 736 739 737 self.btAdd = wx.Button(self, wx.NewId(), 'Add')740 self.btAdd = wx.Button(self, self.ID_ADD, 'Add') 738 741 self.btAdd.Bind(wx.EVT_BUTTON, self._onAdd_constraint, 739 742 id=self.btAdd.GetId()) … … 741 744 self.btAdd.Hide() 742 745 743 text_hint = wx.StaticText(self, -1,746 text_hint = wx.StaticText(self, wx.ID_ANY, 744 747 "Example: [M0][paramter] = M1.parameter") 745 748 sizer_button.Add(text_hint, 0 , wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 10) … … 821 824 sizer.Clear(True) 822 825 823 new_name = wx.StaticText(self, -1, ' Model Title ',826 new_name = wx.StaticText(self, wx.ID_ANY, ' Model Title ', 824 827 style=wx.ALIGN_CENTER) 825 828 new_name.SetBackgroundColour('orange') … … 828 831 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 829 832 ix += 2 830 model_type = wx.StaticText(self, -1, ' Model ')833 model_type = wx.StaticText(self, wx.ID_ANY, ' Model ') 831 834 model_type.SetBackgroundColour('grey') 832 835 model_type.SetForegroundColour(wx.WHITE) … … 834 837 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 835 838 ix += 1 836 data_used = wx.StaticText(self, -1, ' Data ')839 data_used = wx.StaticText(self, wx.ID_ANY, ' Data ') 837 840 data_used.SetBackgroundColour('grey') 838 841 data_used.SetForegroundColour(wx.WHITE) … … 840 843 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 841 844 ix += 1 842 tab_used = wx.StaticText(self, -1, ' FitPage ')845 tab_used = wx.StaticText(self, wx.ID_ANY, ' FitPage ') 843 846 tab_used.SetBackgroundColour('grey') 844 847 tab_used.SetForegroundColour(wx.WHITE) … … 879 882 if model is not None: 880 883 name = str(model.name) 881 cb = wx.CheckBox(self, -1, name)884 cb = wx.CheckBox(self, wx.ID_ANY, name) 882 885 cb.SetValue(False) 883 886 cb.Enable(model is not None and data.is_data) … … 887 890 ix += 2 888 891 type = model.__class__.__name__ 889 model_type = wx.StaticText(self, -1, str(type))892 model_type = wx.StaticText(self, wx.ID_ANY, str(type)) 890 893 sizer.Add(model_type, (iy, ix), (1, 1), 891 894 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 892 895 if self.batch_on: 893 data_used = wx.ComboBox(self, -1, style=wx.CB_READONLY)896 data_used = wx.ComboBox(self, wx.ID_ANY, style=wx.CB_READONLY) 894 897 data_used.AppendItems(data_list) 895 898 data_used.SetSelection(0) 896 899 else: 897 data_used = wx.StaticText(self, -1, data_list[0])900 data_used = wx.StaticText(self, wx.ID_ANY, data_list[0]) 898 901 899 902 ix += 1 … … 902 905 ix += 1 903 906 caption = value.get_fit_tab_caption() 904 tab_caption_used = wx.StaticText(self, -1, str(caption))907 tab_caption_used = wx.StaticText(self, wx.ID_ANY, str(caption)) 905 908 sizer.Add(tab_caption_used, (iy, ix), (1, 1), 906 909 wx.EXPAND | wx.ADJUST_MINSIZE, 0)
Note: See TracChangeset
for help on using the changeset viewer.