(self, parent, title=_t('Add Fits'), excludedFitIDs=())
| 15 | class FitBrowserLiteDialog(wx.Dialog): |
| 16 | |
| 17 | def __init__(self, parent, title=_t('Add Fits'), excludedFitIDs=()): |
| 18 | super().__init__(parent, title=title, style=wx.DEFAULT_DIALOG_STYLE) |
| 19 | |
| 20 | listWidth = 250 if 'wxGTK' in wx.PlatformInfo else 200 |
| 21 | |
| 22 | self.sFit = Fit.getInstance() |
| 23 | self.allFits = sorted( |
| 24 | (f for f in self.sFit.getAllFitsLite() if f.ID not in excludedFitIDs), |
| 25 | key=fitSorter) |
| 26 | self.SetMinSize((400, 400)) |
| 27 | |
| 28 | mainSizer = wx.BoxSizer(wx.VERTICAL) |
| 29 | |
| 30 | searchSizer = wx.BoxSizer(wx.HORIZONTAL) |
| 31 | self.searchBox = wx.TextCtrl(self, wx.ID_ANY, style=wx.TE_PROCESS_ENTER) |
| 32 | searchSizer.Add(self.searchBox, 1, wx.EXPAND | wx.ALL, 5) |
| 33 | mainSizer.Add(searchSizer, 0, wx.EXPAND | wx.ALL, 0) |
| 34 | |
| 35 | listSizer = wx.BoxSizer(wx.HORIZONTAL) |
| 36 | self.fromList = FitListView(self, size=(listWidth, -1)) |
| 37 | self.fromList.Bind(wx.EVT_LEFT_DCLICK, self.OnFromListDclick) |
| 38 | listSizer.Add(self.fromList, 1, wx.EXPAND | wx.ALL, 5) |
| 39 | |
| 40 | listButtonSizer = wx.BoxSizer(wx.VERTICAL) |
| 41 | listButtonSizer.AddStretchSpacer() |
| 42 | addButton = wx.Button(self, wx.ID_ANY, '>>', wx.DefaultPosition, wx.DefaultSize, 0) |
| 43 | addButton.Bind(wx.EVT_BUTTON, self.OnButtonAdd) |
| 44 | listButtonSizer.Add(addButton, 0, wx.EXPAND | wx.ALL, 5) |
| 45 | removeButton = wx.Button(self, wx.ID_ANY, '<<', wx.DefaultPosition, wx.DefaultSize, 0) |
| 46 | removeButton.Bind(wx.EVT_BUTTON, self.OnButtonRemove) |
| 47 | listButtonSizer.Add(removeButton, 0, wx.EXPAND | wx.ALL, 5) |
| 48 | listButtonSizer.AddStretchSpacer() |
| 49 | listSizer.Add(listButtonSizer, 0, wx.EXPAND | wx.ALL, 5) |
| 50 | |
| 51 | self.toList = FitListView(self, size=(listWidth, -1)) |
| 52 | self.toList.Bind(wx.EVT_LEFT_DCLICK, self.OnToListDclick) |
| 53 | listSizer.Add(self.toList, 1, wx.EXPAND | wx.ALL, 5) |
| 54 | mainSizer.Add(listSizer, 1, wx.EXPAND | wx.ALL, 0) |
| 55 | |
| 56 | buttonSizer = self.CreateButtonSizer(wx.OK | wx.CANCEL) |
| 57 | if buttonSizer: |
| 58 | mainSizer.Add(buttonSizer, 0, wx.EXPAND | wx.ALL, 5) |
| 59 | |
| 60 | self.resetContents() |
| 61 | |
| 62 | self.inputTimer = wx.Timer(self) |
| 63 | self.Bind(wx.EVT_TIMER, self.OnInputTimer, self.inputTimer) |
| 64 | self.searchBox.Bind(event=wx.EVT_TEXT, handler=self.OnSearchChanged) |
| 65 | |
| 66 | self.SetSizer(mainSizer) |
| 67 | self.Layout() |
| 68 | self.SetSize(self.GetBestSize()) |
| 69 | self.CenterOnParent() |
| 70 | self.searchBox.SetFocus() |
| 71 | |
| 72 | def OnButtonAdd(self, event): |
| 73 | event.Skip() |
nothing calls this directly
no test coverage detected