(self, event)
| 58 | self.multiSwitch.tabs_container.handleDrag = self.handleDrag |
| 59 | |
| 60 | def fitSelected(self, event): |
| 61 | count = -1 |
| 62 | # @todo pheonix: _pages is supposed to be private? |
| 63 | for index, page in enumerate(self.multiSwitch._pages): |
| 64 | if not isinstance(page, gui.builtinViews.emptyView.BlankPage): # Don't try and process it if it's a blank page. |
| 65 | try: |
| 66 | if page.activeFitID == event.fitID: |
| 67 | count += 1 |
| 68 | self.multiSwitch.SetSelection(index) |
| 69 | wx.PostEvent(self.mainFrame, GE.FitChanged(fitIDs=(event.fitID,))) |
| 70 | break |
| 71 | except (KeyboardInterrupt, SystemExit): |
| 72 | raise |
| 73 | except Exception as e: |
| 74 | pyfalog.critical("Caught exception in fitSelected") |
| 75 | pyfalog.critical(e) |
| 76 | if count < 0: |
| 77 | startup = getattr(event, "startup", False) # see OpenFitsThread in gui.mainFrame |
| 78 | from_import = getattr(event, "from_import", False) # always open imported into a new tab |
| 79 | sFit = Fit.getInstance() |
| 80 | openFitInNew = sFit.serviceFittingOptions["openFitInNew"] |
| 81 | mstate = wx.GetMouseState() |
| 82 | modifierKey = mstate.GetModifiers() == wx.MOD_CONTROL |
| 83 | if from_import or (not openFitInNew and modifierKey) or startup or (openFitInNew and not modifierKey): |
| 84 | self.multiSwitch.AddPage() |
| 85 | |
| 86 | view = self.multiSwitch.GetSelectedPage() |
| 87 | |
| 88 | if not isinstance(view, FittingView): |
| 89 | view = FittingView(self.multiSwitch) |
| 90 | pyfalog.debug("###################### Created new view:" + repr(view)) |
| 91 | self.multiSwitch.ReplaceActivePage(view) |
| 92 | |
| 93 | view.fitSelected(event) |
| 94 | |
| 95 | def handleDrag(self, type, fitID): |
| 96 | if type == "fit": |
nothing calls this directly
no test coverage detected