(self, parent, includeHidden=False)
| 44 | class GraphFrame(AuxiliaryFrame): |
| 45 | |
| 46 | def __init__(self, parent, includeHidden=False): |
| 47 | if not canvasPanel.graphFrame_enabled: |
| 48 | pyfalog.warning('Matplotlib is not enabled. Skipping initialization.') |
| 49 | return |
| 50 | |
| 51 | super().__init__(parent, title=_t('Graphs'), size=(520, 390), resizeable=True) |
| 52 | self.mainFrame = gui.mainFrame.MainFrame.getInstance() |
| 53 | self.includeHidden = includeHidden |
| 54 | |
| 55 | self.SetIcon(wx.Icon(BitmapLoader.getBitmap('graphs_small', 'gui'))) |
| 56 | |
| 57 | mainSizer = wx.BoxSizer(wx.VERTICAL) |
| 58 | |
| 59 | # Layout - graph selector |
| 60 | self.graphSelection = wx.Choice(self, wx.ID_ANY, style=0) |
| 61 | self.graphSelection.Bind(wx.EVT_CHOICE, self.OnGraphSwitched) |
| 62 | mainSizer.Add(self.graphSelection, 0, wx.EXPAND) |
| 63 | |
| 64 | # Layout - plot area |
| 65 | self.canvasPanel = canvasPanel.GraphCanvasPanel(self, self) |
| 66 | mainSizer.Add(self.canvasPanel, 1, wx.EXPAND | wx.ALL, 0) |
| 67 | |
| 68 | mainSizer.Add(wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL), 0, wx.EXPAND) |
| 69 | |
| 70 | # Layout - graph control panel |
| 71 | self.ctrlPanel = GraphControlPanel(self, self) |
| 72 | mainSizer.Add(self.ctrlPanel, 0, wx.EXPAND | wx.ALL, 0) |
| 73 | |
| 74 | self.SetSizer(mainSizer) |
| 75 | |
| 76 | # Setup - graph selector |
| 77 | for view in FitGraph.views: |
| 78 | if view.hidden and not self.includeHidden: |
| 79 | continue |
| 80 | self.graphSelection.Append(view.name, view()) |
| 81 | self.graphSelection.SetSelection(0) |
| 82 | self.ctrlPanel.updateControls(layout=False) |
| 83 | |
| 84 | # Event bindings - local events |
| 85 | self.Bind(wx.EVT_CLOSE, self.OnClose) |
| 86 | self.Bind(wx.EVT_CHAR_HOOK, self.kbEvent) |
| 87 | |
| 88 | # Event bindings - external events |
| 89 | self.mainFrame.Bind(GE.FIT_RENAMED, self.OnFitRenamed) |
| 90 | self.mainFrame.Bind(GE.FIT_CHANGED, self.OnFitChanged) |
| 91 | self.mainFrame.Bind(GE.FIT_REMOVED, self.OnFitRemoved) |
| 92 | self.mainFrame.Bind(GE.TARGET_PROFILE_RENAMED, self.OnProfileRenamed) |
| 93 | self.mainFrame.Bind(GE.TARGET_PROFILE_CHANGED, self.OnProfileChanged) |
| 94 | self.mainFrame.Bind(GE.TARGET_PROFILE_REMOVED, self.OnProfileRemoved) |
| 95 | self.mainFrame.Bind(RESIST_MODE_CHANGED, self.OnResistModeChanged) |
| 96 | self.mainFrame.Bind(GE.GRAPH_OPTION_CHANGED, self.OnGraphOptionChanged) |
| 97 | self.mainFrame.Bind(GE.EFFECTIVE_HP_TOGGLED, self.OnEffectiveHpToggled) |
| 98 | |
| 99 | self.drawTimer = wx.Timer(self) |
| 100 | self.Bind(wx.EVT_TIMER, self.OnDrawTimer, self.drawTimer) |
| 101 | |
| 102 | self.Layout() |
| 103 | self.UpdateWindowSize() |
nothing calls this directly
no test coverage detected