def setup_main_panel(self): """ Lays Out Main Panel. Binds some functions to presenter. :return: None """ # Create Status Bar self.CreateStatusBar(7) self.SetStatusWidths([-1, 300, 200, 200, 250, 150, 130]) # Sizers to develop layout # s1 = (min(self.displaysize[0], 1851), self.displaysize[1]) # s2 = (550, self.displaysize[1]) splitterwindow = wx.SplitterWindow(self, -1, style=wx.SP_3D | wx.SP_BORDER) splitterwindow2 = wx.SplitterWindow(splitterwindow, -1, style=wx.SP_3D | wx.SP_BORDER) panelp = wx.Panel(splitterwindow2, -1) panel = scrolled.ScrolledPanel(splitterwindow2, -1) # wx.Panel(splitterwindow2, -1) splitterwindow2.SplitVertically(panelp, panel, sashPosition=-250 - self.config.imflag * 20) splitterwindow2.SetMinimumPaneSize(175) splitterwindow.SetMinimumPaneSize(175) # splitterwindow.SetMinSize((0,0)) # splitterwindow2.SetMinSize((0,0)) file_drop_target = MyFileDropTarget(self) splitterwindow.SetDropTarget(file_drop_target) # ................................. # # Layout the Plots # # ................................... # Tabbed view of plots if self.tabbed == 1: figsize = (6, 5) plotwindow = wx.Notebook(splitterwindow) splitterwindow.SplitVertically(plotwindow, splitterwindow2, sashPosition=-550) tab1 = wx.Panel(plotwindow) tab2 = wx.Panel(plotwindow) tab3 = wx.Panel(plotwindow) tab4 = wx.Panel(plotwindow) tab5 = wx.Panel(plotwindow) tab6 = wx.Panel(plotwindow) self.plot1 = plot1d.Plot1d(tab1, smash=1, figsize=figsize) self.plot2 = plot1d.Plot1d(tab2, integrate=1, figsize=figsize) self.plot3 = plot2d.Plot2d(tab3, figsize=figsize) self.plot4 = plot1d.Plot1d(tab4, figsize=figsize) self.plot5 = plot2d.Plot2d(tab5, figsize=figsize) self.plot6 = plot1d.Plot1d(tab6, figsize=figsize) miscwindows.setup_tab_box(tab1, self.plot1) miscwindows.setup_tab_box(tab2, self.plot2) miscwindows.setup_tab_box(tab3, self.plot3) miscwindows.setup_tab_box(tab4, self.plot4) miscwindows.setup_tab_box(tab5, self.plot5) miscwindows.setup_tab_box(tab6, self.plot6) if self.config.imflag == 1: tab1im = wx.Panel(plotwindow) tab1fit = wx.Panel(plotwindow) tab2ccs = wx.Panel(plotwindow) tab3color = wx.Panel(plotwindow) tab5mccs = wx.Panel(plotwindow) tab5ccsz = wx.Panel(plotwindow) tab9 = wx.Panel(plotwindow) tab10 = wx.Panel(plotwindow) self.plot1im = plot2d.Plot2d(tab1im, figsize=figsize) self.plot1fit = plot2d.Plot2d(tab1fit, figsize=figsize) self.plot2ccs = plot1d.Plot1d(tab2ccs, figsize=figsize) self.plot5mccs = plot2d.Plot2d(tab5mccs, figsize=figsize) self.plot5ccsz = plot2d.Plot2d(tab5ccsz, figsize=figsize) self.plot3color = ColorPlot.ColorPlot2D(tab3color, figsize=figsize) self.plot9 = plot3d.CubePlot(tab9, figsize=figsize) self.plot10 = plot3d.CubePlot(tab10, figsize=figsize) miscwindows.setup_tab_box(tab1im, self.plot1im) miscwindows.setup_tab_box(tab1fit, self.plot1fit) miscwindows.setup_tab_box(tab2ccs, self.plot2ccs) miscwindows.setup_tab_box(tab3color, self.plot3color) miscwindows.setup_tab_box(tab5mccs, self.plot5mccs) miscwindows.setup_tab_box(tab5ccsz, self.plot5ccsz) miscwindows.setup_tab_box(tab9, self.plot9) miscwindows.setup_tab_box(tab10, self.plot10) plotwindow.AddPage(tab1, "MS Data v. Fit") if self.config.imflag == 1: plotwindow.AddPage(tab1im, "IM-MS Data") plotwindow.AddPage(tab1fit, "IM-MS Fit") plotwindow.AddPage(tab3color, "IM-MS Charges") plotwindow.AddPage(tab9, "m/z Cube") plotwindow.AddPage(tab3, "m/z Grid") plotwindow.AddPage(tab2, "Mass Distribution") if self.config.imflag == 1: plotwindow.AddPage(tab2ccs, "CCS Distribution") plotwindow.AddPage(tab4, "Individual Peaks") plotwindow.AddPage(tab5, "Mass vs. Charge") if self.config.imflag == 1: plotwindow.AddPage(tab5mccs, "Mass vs. CCS ") plotwindow.AddPage(tab5ccsz, "CCS vs. Charge") plotwindow.AddPage(tab10, "Mass Cube") plotwindow.AddPage(tab6, "Bar Chart") # Scrolled panel view of plots else: # TODO: Line up plots on left hand side so that they share an m/z axis plotwindow = scrolled.ScrolledPanel(splitterwindow) splitterwindow.SplitVertically(plotwindow, splitterwindow2, sashPosition=-550) sizerplot = wx.GridBagSizer() figsize = self.config.figsize self.plot1 = plot1d.Plot1d(plotwindow, smash=1, figsize=figsize) self.plot2 = plot1d.Plot1d(plotwindow, integrate=1, figsize=figsize) self.plot3 = plot2d.Plot2d(plotwindow, figsize=figsize) self.plot4 = plot1d.Plot1d(plotwindow, figsize=figsize) self.plot5 = plot2d.Plot2d(plotwindow, figsize=figsize) self.plot6 = plot1d.Plot1d(plotwindow, figsize=figsize) if self.config.imflag == 1: self.plot1im = plot2d.Plot2d(plotwindow, figsize=figsize) self.plot1fit = plot2d.Plot2d(plotwindow, figsize=figsize) self.plot2ccs = plot1d.Plot1d(plotwindow, figsize=figsize) self.plot5mccs = plot2d.Plot2d(plotwindow, figsize=figsize) self.plot5ccsz = plot2d.Plot2d(plotwindow, figsize=figsize) self.plot3color = ColorPlot.ColorPlot2D(plotwindow, figsize=figsize) self.plot9 = plot3d.CubePlot(plotwindow, figsize=figsize) self.plot10 = plot3d.CubePlot(plotwindow, figsize=figsize) if self.config.imflag == 0: sizerplot.Add(self.plot1, (0, 0), span=(1, 1), flag=wx.EXPAND) sizerplot.Add(self.plot2, (0, 1), span=(1, 1), flag=wx.EXPAND) sizerplot.Add(self.plot3, (1, 0), span=(1, 1), flag=wx.EXPAND) sizerplot.Add(self.plot4, (1, 1), span=(1, 1), flag=wx.EXPAND) sizerplot.Add(self.plot5, (2, 0), span=(1, 1), flag=wx.EXPAND) sizerplot.Add(self.plot6, (2, 1), span=(1, 1), flag=wx.EXPAND) else: sizerplot.Add(self.plot1, (0, 0), span=(1, 1), flag=wx.EXPAND) sizerplot.Add(self.plot1im, (0, 1), span=(1, 1), flag=wx.EXPAND) sizerplot.Add(self.plot1fit, (1, 1), span=(1, 1), flag=wx.EXPAND) sizerplot.Add(self.plot3color, (1, 0), span=(1, 1), flag=wx.EXPAND) sizerplot.Add(self.plot2, (2, 0), span=(1, 1), flag=wx.EXPAND) sizerplot.Add(self.plot2ccs, (3, 0), span=(1, 1), flag=wx.EXPAND) sizerplot.Add(self.plot3, (2, 1), span=(1, 1), flag=wx.EXPAND) sizerplot.Add(self.plot4, (4, 0), span=(1, 1), flag=wx.EXPAND) sizerplot.Add(self.plot5, (3, 1), span=(1, 1), flag=wx.EXPAND) sizerplot.Add(self.plot5mccs, (4, 1), span=(1, 1), flag=wx.EXPAND) sizerplot.Add(self.plot5ccsz, (5, 1), span=(1, 1), flag=wx.EXPAND) sizerplot.Add(self.plot6, (5, 0), span=(1, 1), flag=wx.EXPAND) sizerplot.Add(self.plot9, (6, 0), span=(1, 1), flag=wx.EXPAND) sizerplot.Add(self.plot10, (6, 1), span=(1, 1), flag=wx.EXPAND) # plotwindow.SetScrollbars(1, 1,1,1) if self.system == "Linux": plotwindow.SetSizer(sizerplot) sizerplot.Fit(self) else: plotwindow.SetSizerAndFit(sizerplot) plotwindow.SetupScrolling() self.plots = [ self.plot1, self.plot2, self.plot3, self.plot4, self.plot5, self.plot6 ] if self.config.imflag == 1: self.plots = self.plots + [ self.plot1im, self.plot1fit, self.plot2ccs, self.plot5mccs, self.plot5ccsz, self.plot3color, self.plot9, self.plot10 ] self.plotnames = [ "Figure1", "Figure2", "Figure3", "Figure4", "Figure5", "Figure6" ] if self.config.imflag == 1: self.plotname = self.plotnames + [ "Figure1im", "Figure1fit", "Figure2ccs", "Figure3color", "Figure5ccsz", "Figure5massccs", "mzCube", "massCube" ] # ........................... # # Sizer for Peaks # # ........................... sizerpeaks = wx.BoxSizer(wx.VERTICAL) self.peakpanel = peaklistsort.PeakListCtrlPanel(panelp) self.Bind(self.peakpanel.EVT_DELETE_SELECTION_2, self.pres.on_delete, self.peakpanel) self.Bind(self.peakpanel.EVT_CHARGE_STATE, self.pres.on_charge_states, self.peakpanel) self.Bind(self.peakpanel.EVT_DIFFERENCES, self.pres.on_differences, self.peakpanel) sizerpeaks.Add(self.peakpanel, 0, wx.EXPAND) panelp.SetSizer(sizerpeaks) sizerpeaks.Fit(self) # .......................... # # Setup Control Panel # # ............................. sizercontrols = wx.BoxSizer(wx.VERTICAL) self.controls = ud_controls.main_controls(self, self.config, self.pres, panel, self.icon_path) sizercontrols.Add(self.controls, 1, wx.EXPAND) panel.SetSizer(sizercontrols) sizercontrols.Fit(self) # panel.SetAutoLayout(1) # panel.SetupScrolling(scroll_x=False, scroll_y=True) if self.system == "Linux" and self.tabbed != 1: sizerplot.Fit(splitterwindow) sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.Add(splitterwindow, 1, wx.EXPAND) # Set everything up self.SetSizer(sizer) sizer.Fit(self) pass
def setupmainpanel(self): sizer = wx.BoxSizer(wx.HORIZONTAL) panel = wx.Panel(self) file_drop_target = MyFileDropTarget(self) panel.SetDropTarget(file_drop_target) self.ypanel = ListCtrlPanel(panel, self.pres, size=(300, 300)) sizer.Add(self.ypanel, 0, wx.EXPAND) # Tabbed view of plots if self.tabbed == 1: figsize = (6, 5) plotwindow = wx.Notebook(panel) tab1 = wx.Panel(plotwindow) tab2 = wx.Panel(plotwindow) tab3 = wx.Panel(plotwindow) tab5 = wx.Panel(plotwindow) tab6 = wx.Panel(plotwindow) tab7 = wx.Panel(plotwindow) tab8 = wx.Panel(plotwindow) tab9 = wx.Panel(plotwindow) self.plot1 = plot1d.Plot1d(tab1, smash=1, figsize=figsize) self.plot2 = plot1d.Plot1d(tab2, integrate=1, figsize=figsize) self.plot3 = plot2d.Plot2d(tab3, figsize=figsize) self.plot5 = plot2d.Plot2d(tab5, figsize=figsize) self.plot6 = plot1d.Plot1d(tab6, figsize=figsize) self.plot7 = plot1d.Plot1d(tab7, figsize=figsize) self.plot8 = plot2d.Plot2d(tab8, figsize=figsize) self.plot9 = plot1d.Plot1d(tab9, figsize=figsize) miscwindows.setup_tab_box(tab1, self.plot1) miscwindows.setup_tab_box(tab2, self.plot2) miscwindows.setup_tab_box(tab3, self.plot3) miscwindows.setup_tab_box(tab5, self.plot5) miscwindows.setup_tab_box(tab6, self.plot6) miscwindows.setup_tab_box(tab7, self.plot7) miscwindows.setup_tab_box(tab8, self.plot8) miscwindows.setup_tab_box(tab9, self.plot9) plotwindow.AddPage(tab1, "MS Data") plotwindow.AddPage(tab9, "Charge Distributions") plotwindow.AddPage(tab2, "Mass Distribution") plotwindow.AddPage(tab7, "Extracts Line Plot") plotwindow.AddPage(tab8, "Extracts Grid Plot") plotwindow.AddPage(tab6, "Bar Chart") plotwindow.AddPage(tab3, "m/z Grid") plotwindow.AddPage(tab5, "Mass vs. Charge") sizer.Add(plotwindow, 1, wx.EXPAND) else: self.plotpanel = scrolled.ScrolledPanel(panel) sizerplot = wx.GridBagSizer() figsize = self.config.figsize self.plot1 = plot1d.Plot1d(self.plotpanel, smash=1, figsize=figsize) self.plot2 = plot1d.Plot1d(self.plotpanel, integrate=1, figsize=figsize) self.plot3 = plot2d.Plot2d(self.plotpanel, figsize=figsize) self.plot5 = plot2d.Plot2d(self.plotpanel, figsize=figsize) self.plot6 = plot1d.Plot1d(self.plotpanel, figsize=figsize) self.plot7 = plot1d.Plot1d(self.plotpanel, figsize=figsize) self.plot8 = plot2d.Plot2d(self.plotpanel, figsize=figsize) self.plot9 = plot1d.Plot1d(self.plotpanel, figsize=figsize) sizerplot.Add(self.plot1, (0, 0), span=(1, 1), flag=wx.EXPAND) sizerplot.Add(self.plot9, (0, 1), span=(1, 1), flag=wx.EXPAND) sizerplot.Add(self.plot2, (1, 0), span=(1, 2), flag=wx.EXPAND) sizerplot.Add(self.plot6, (3, 0), span=(1, 2), flag=wx.EXPAND) sizerplot.Add(self.plot7, (2, 0), span=(1, 1), flag=wx.EXPAND) sizerplot.Add(self.plot8, (2, 1), span=(1, 1), flag=wx.EXPAND) sizerplot.Add(self.plot3, (4, 0), span=(1, 1), flag=wx.EXPAND) sizerplot.Add(self.plot5, (4, 1), span=(1, 1), flag=wx.EXPAND) self.plotpanel.SetSizerAndFit(sizerplot) self.plotpanel.SetupScrolling() sizer.Add(self.plotpanel, 1, wx.EXPAND) self.plots = [self.plot1, self.plot2, self.plot6, self.plot7, self.plot8, self.plot9, self.plot3, self.plot5] self.plotnames = ["MetaFigure1", "MetaFigure2", "MetaFigure3", "MetaFigure4", "MetaFigure5", "MetaFigure6", "MeatFigure7", "MetaFigure8"] self.peakpanel = peaklistsort.PeakListCtrlPanel(panel, meta=True) self.Bind(self.peakpanel.EVT_DELETE_SELECTION_2, self.pres.on_delete, self.peakpanel) self.Bind(self.peakpanel.EVT_CHARGE_STATE, self.pres.on_charge_states_mud, self.peakpanel) self.Bind(self.peakpanel.EVT_DIFFERENCES, self.pres.on_differences, self.peakpanel) self.Bind(self.peakpanel.EVT_MASSES, self.pres.on_label_masses, self.peakpanel) sizer.Add(self.peakpanel, 0, wx.EXPAND) self.controls = main_controls(self, self.config, self.pres, panel, self.icon_path) sizer.Add(self.controls, 0, wx.EXPAND) # Set everything up panel.SetSizer(sizer) sizer.Fit(self) self.CreateStatusBar(7) self.SetStatusWidths([-1, 600, 120, 0, 230, 250, 130])