Changeset 2d88fc4 in sasview
- Timestamp:
- Oct 20, 2015 8:55:16 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:
- 6f16e25
- Parents:
- 6f3fea2
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
sasview/wxcruft.py
r6f3fea2 r2d88fc4 57 57 58 58 def __init__(self, millis, callableObj, *args, **kwargs): 59 print "=================== entering CallLater constructor"59 # print "=================== entering CallLater constructor" 60 60 assert callable(callableObj), "callableObj is not callable" 61 61 self.millis = millis … … 81 81 self.SetArgs(*args, **kwargs) 82 82 self.Stop() 83 self.timer = wx.PyTimer(self.Notify, id=self.id)83 self.timer = PyTimer(self.Notify, id=self.id) # PAK 84 84 self.timer.Start(self.millis, wx.TIMER_ONE_SHOT) 85 85 self.running = True -
src/sas/guiframe/local_perspectives/plotting/Plotter1D.py
r098f3d2 r2d88fc4 36 36 return [k for k, v in dic.iteritems() if v == val][0] 37 37 38 class IdCollection: 39 def __init__(self): 40 self._ids = [] 41 self._index = 0 42 def next(self): 43 if len(self._ids) == self._index: 44 self._ids.append(wx.NewId()) 45 self._index += 1 46 return self._ids[self._index-1] 47 def reset(self): 48 self._index = 0 38 49 39 50 … … 52 63 ## Group ID 53 64 group_id = None 65 _menu_ids = IdCollection() 54 66 55 67 def __init__(self, parent, id=-1, color=None, … … 556 568 self._slicerpop.set_plots(self.plots) 557 569 self._slicerpop.set_graph(self.graph) 570 self._menu_ids.reset() 558 571 if not self.graph.selected_plottable in self.plots: 559 572 # Various plot options 560 wx_id = wx.NewId()573 wx_id = self._menu_ids.next() 561 574 self._slicerpop.Append(wx_id, '&Save Image', 'Save image as PNG') 562 575 wx.EVT_MENU(self, wx_id, self.onSaveImage) 563 wx_id = wx.NewId()576 wx_id = self._menu_ids.next() 564 577 self._slicerpop.Append(wx_id, '&Print Image', 'Print image ') 565 578 wx.EVT_MENU(self, wx_id, self.onPrint) 566 579 567 wx_id = wx.NewId()580 wx_id = self._menu_ids.next() 568 581 self._slicerpop.Append(wx_id, '&Copy to Clipboard', 569 582 'Copy to the clipboard') … … 582 595 continue 583 596 584 wx_id = wx.NewId()597 wx_id = self._menu_ids.next() 585 598 plot_menu.Append(wx_id, "&DataInfo", name) 586 599 wx.EVT_MENU(self, wx_id, self. _onDataShow) 587 wx_id = wx.NewId()600 wx_id = self._menu_ids.next() 588 601 plot_menu.Append(wx_id, "&Save Points as a File", name) 589 602 wx.EVT_MENU(self, wx_id, self._onSave) … … 597 610 598 611 try: 599 wx_id = wx.NewId()612 wx_id = self._menu_ids.next() 600 613 plot_menu.Append(wx_id, item[0], name) 601 614 wx.EVT_MENU(self, wx_id, item[2]) … … 607 620 608 621 if self.parent.ClassName.count('wxDialog') == 0: 609 wx_id = wx.NewId()622 wx_id = self._menu_ids.next() 610 623 plot_menu.Append(wx_id, '&Linear Fit', name) 611 624 wx.EVT_MENU(self, wx_id, self.onFitting) 612 625 plot_menu.AppendSeparator() 613 626 614 wx_id = wx.NewId()627 wx_id = self._menu_ids.next() 615 628 plot_menu.Append(wx_id, "Remove", name) 616 629 wx.EVT_MENU(self, wx_id, self._onRemove) 617 630 if not plot.is_data: 618 wx_id = wx.NewId()631 wx_id = self._menu_ids.next() 619 632 plot_menu.Append(wx_id, '&Freeze', name) 620 633 wx.EVT_MENU(self, wx_id, self.onFreeze) … … 622 635 623 636 if plot.is_data: 624 wx_id = wx.NewId()637 wx_id = self._menu_ids.next() 625 638 self.hide_menu = plot_menu.Append(wx_id, "Hide Error Bar", name) 626 639 … … 636 649 plot_menu.AppendSeparator() 637 650 638 wx_id = wx.NewId()651 wx_id = self._menu_ids.next() 639 652 plot_menu.Append(wx_id, '&Modify Plot Property', name) 640 653 wx.EVT_MENU(self, wx_id, self.createAppDialog) 641 wx_id = wx.NewId()654 wx_id = self._menu_ids.next() 642 655 # plot_menu.SetTitle(name) 643 656 self._slicerpop.AppendMenu(wx_id, '&%s' % name, plot_menu) … … 648 661 loc_menu = wx.Menu() 649 662 for label in self._loc_labels: 650 wx_id = wx.NewId()663 wx_id = self._menu_ids.next() 651 664 loc_menu.Append(wx_id, str(label), str(label)) 652 665 wx.EVT_MENU(self, wx_id, self.onChangeLegendLoc) 653 666 654 wx_id = wx.NewId()667 wx_id = self._menu_ids.next() 655 668 self._slicerpop.Append(wx_id, '&Modify Graph Appearance', 656 669 'Modify graph appearance') … … 660 673 661 674 if self.position != None: 662 wx_id = wx.NewId()675 wx_id = self._menu_ids.next() 663 676 self._slicerpop.Append(wx_id, '&Add Text') 664 677 wx.EVT_MENU(self, wx_id, self._on_addtext) 665 wx_id = wx.NewId()678 wx_id = self._menu_ids.next() 666 679 self._slicerpop.Append(wx_id, '&Remove Text') 667 680 wx.EVT_MENU(self, wx_id, self._on_removetext) 668 681 self._slicerpop.AppendSeparator() 669 wx_id = wx.NewId()682 wx_id = self._menu_ids.next() 670 683 self._slicerpop.Append(wx_id, '&Change Scale') 671 684 wx.EVT_MENU(self, wx_id, self._onProperties) 672 685 self._slicerpop.AppendSeparator() 673 wx_id = wx.NewId()686 wx_id = self._menu_ids.next() 674 687 self._slicerpop.Append(wx_id, '&Reset Graph Range') 675 688 wx.EVT_MENU(self, wx_id, self.onResetGraph) … … 677 690 if self.parent.ClassName.count('wxDialog') == 0: 678 691 self._slicerpop.AppendSeparator() 679 wx_id = wx.NewId()692 wx_id = self._menu_ids.next() 680 693 self._slicerpop.Append(wx_id, '&Window Title') 681 694 wx.EVT_MENU(self, wx_id, self.onChangeCaption) -
src/sas/guiframe/local_perspectives/plotting/Plotter2D.py
r098f3d2 r2d88fc4 287 287 288 288 """ 289 self._menu_ids.reset() 289 290 slicerpop = PanelMenu() 290 291 slicerpop.set_plots(self.plots) 291 292 slicerpop.set_graph(self.graph) 292 293 293 wx_id = wx.NewId()294 wx_id = self._menu_ids.next() 294 295 slicerpop.Append(wx_id, '&Save Image') 295 296 wx.EVT_MENU(self, wx_id, self.onSaveImage) 296 297 297 wx_id = wx.NewId()298 wx_id = self._menu_ids.next() 298 299 slicerpop.Append(wx_id, '&Print Image', 'Print image') 299 300 wx.EVT_MENU(self, wx_id, self.onPrint) 300 301 301 wx_id = wx.NewId()302 wx_id = self._menu_ids.next() 302 303 slicerpop.Append(wx_id, '&Copy to Clipboard', 'Copy to the clipboard') 303 304 wx.EVT_MENU(self, wx_id, self.OnCopyFigureMenu) … … 305 306 # saving data 306 307 plot = self.data2D 307 wx_id = wx.NewId()308 wx_id = self._menu_ids.next() 308 309 slicerpop.Append(wx_id, "&Data Info") 309 310 wx.EVT_MENU(self, wx_id, self._onDataShow) 310 311 311 wx_id = wx.NewId()312 wx_id = self._menu_ids.next() 312 313 slicerpop.Append(wx_id, "&Save as a File (DAT)") 313 314 self.action_ids[str(wx_id)] = plot … … 322 323 for item in item_list: 323 324 try: 324 wx_id = wx.NewId()325 wx_id = self._menu_ids.next() 325 326 slicerpop.Append(wx_id, item[0], item[1]) 326 327 wx.EVT_MENU(self, wx_id, item[2]) … … 331 332 slicerpop.AppendSeparator() 332 333 333 wx_id = wx.NewId()334 wx_id = self._menu_ids.next() 334 335 slicerpop.Append(wx_id, '&Perform Circular Average') 335 336 wx.EVT_MENU(self, wx_id, self.onCircular) \ 336 337 # For Masked Data 337 338 if not plot.mask.all(): 338 wx_id = wx.NewId()339 wx_id = self._menu_ids.next() 339 340 slicerpop.Append(wx_id, '&Masked Circular Average') 340 341 wx.EVT_MENU(self, wx_id, self.onMaskedCircular) 341 wx_id = wx.NewId()342 wx_id = self._menu_ids.next() 342 343 slicerpop.Append(wx_id, '&Sector [Q View]') 343 344 wx.EVT_MENU(self, wx_id, self.onSectorQ) 344 wx_id = wx.NewId()345 wx_id = self._menu_ids.next() 345 346 slicerpop.Append(wx_id, '&Annulus [Phi View ]') 346 347 wx.EVT_MENU(self, wx_id, self.onSectorPhi) 347 wx_id = wx.NewId()348 wx_id = self._menu_ids.next() 348 349 slicerpop.Append(wx_id, '&Box Sum') 349 350 wx.EVT_MENU(self, wx_id, self.onBoxSum) 350 wx_id = wx.NewId()351 wx_id = self._menu_ids.next() 351 352 slicerpop.Append(wx_id, '&Box Averaging in Qx') 352 353 wx.EVT_MENU(self, wx_id, self.onBoxavgX) 353 wx_id = wx.NewId()354 wx_id = self._menu_ids.next() 354 355 slicerpop.Append(wx_id, '&Box Averaging in Qy') 355 356 wx.EVT_MENU(self, wx_id, self.onBoxavgY) 356 357 if self.slicer != None: 357 wx_id = wx.NewId()358 wx_id = self._menu_ids.next() 358 359 slicerpop.Append(wx_id, '&Clear Slicer') 359 360 wx.EVT_MENU(self, wx_id, self.onClearSlicer) 360 361 if self.slicer.__class__.__name__ != "BoxSum": 361 wx_id = wx.NewId()362 wx_id = self._menu_ids.next() 362 363 slicerpop.Append(wx_id, '&Edit Slicer Parameters') 363 364 wx.EVT_MENU(self, wx_id, self._onEditSlicer) 364 365 slicerpop.AppendSeparator() 365 366 366 wx_id = wx.NewId()367 wx_id = self._menu_ids.next() 367 368 slicerpop.Append(wx_id, '&Edit Graph Label', 'Edit Graph Label') 368 369 wx.EVT_MENU(self, wx_id, self.onEditLabels) … … 371 372 # ILL mod here 372 373 373 wx_id = wx.NewId()374 wx_id = self._menu_ids.next() 374 375 slicerpop.Append(wx_id, '&Modify graph appearance', 'Modify graph appearance') 375 376 wx.EVT_MENU(self, wx_id, self.modifyGraphAppearance) 376 377 slicerpop.AppendSeparator() 377 378 378 wx_id = wx.NewId()379 wx_id = self._menu_ids.next() 379 380 slicerpop.Append(wx_id, '&2D Color Map') 380 381 wx.EVT_MENU(self, wx_id, self._onEditDetector) 381 382 slicerpop.AppendSeparator() 382 383 383 wx_id = wx.NewId()384 wx_id = self._menu_ids.next() 384 385 slicerpop.Append(wx_id, '&Toggle Linear/Log Scale') 385 386 wx.EVT_MENU(self, wx_id, self._onToggleScale) 386 387 387 388 slicerpop.AppendSeparator() 388 wx_id = wx.NewId()389 wx_id = self._menu_ids.next() 389 390 slicerpop.Append(wx_id, '&Window Title') 390 391 wx.EVT_MENU(self, wx_id, self.onChangeCaption) -
src/sas/plottools/toolbar.py
rd3d67f0 r2d88fc4 19 19 20 20 class NavigationToolBar(NavigationToolbar2WxAgg): 21 _NTB2_HOME = wx.NewId() 22 _NTB2_BACK = wx.NewId() 23 _NTB2_FORWARD = wx.NewId() 24 _NTB2_PAN = wx.NewId() 25 _NTB2_ZOOM = wx.NewId() 26 _NTB2_SAVE = wx.NewId() 27 _NTB2_PRINT = wx.NewId() 28 _NTB2_RESET = wx.NewId() 29 _NTB2_COPY = wx.NewId() 21 30 """ 22 31 Overwrite matplotlib toolbar … … 31 40 def _init_toolbar(self): 32 41 self._parent = self.canvas.GetParent() 33 self._NTB2_HOME = wx.NewId()34 self._NTB2_BACK = wx.NewId()35 self._NTB2_FORWARD = wx.NewId()36 self._NTB2_PAN = wx.NewId()37 self._NTB2_ZOOM = wx.NewId()38 self._NTB2_SAVE = wx.NewId()39 self._NTB2_PRINT = wx.NewId()40 self._NTB2_RESET = wx.NewId()41 42 42 43 # for mpl 1.2+ compatibility … … 101 102 """ 102 103 # Slicer plot popup menu 103 wx_id = wx.NewId()104 104 popup = wx.Menu() 105 popup.Append( wx_id, '&Save image', 'Save image as PNG')106 wx.EVT_MENU(self, wx_id, self.save_figure)105 popup.Append(self._NTB2_SAVE, '&Save image', 'Save image as PNG') 106 wx.EVT_MENU(self, self._NTB2_SAVE, self.save_figure) 107 107 108 wx_id = wx.NewId() 109 popup.Append(wx_id, '&Print image', 'Print image ') 110 wx.EVT_MENU(self, wx_id, self.print_figure) 108 popup.Append(self._NTB2_PRINT, '&Print image', 'Print image ') 109 wx.EVT_MENU(self, self._NTB2_PRINT, self.print_figure) 111 110 112 wx_id = wx.NewId() 113 popup.Append(wx_id, '&Copy to Clipboard', 'Copy image to the clipboard') 114 wx.EVT_MENU(self, wx_id, self.copy_figure) 111 popup.Append(self._NTB2_COPY, '&Copy to Clipboard', 'Copy image to the clipboard') 112 wx.EVT_MENU(self, self._NTB2_COPY, self.copy_figure) 115 113 116 114 # Show the popup menu relative to the location of the toolbar
Note: See TracChangeset
for help on using the changeset viewer.