Exemple #1
0
    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
Exemple #2
0
    def __init__(self,
                 parent,
                 title,
                 config=None,
                 iconfile="logo.ico",
                 *args,
                 **kwargs):
        mainwindow_base.MainwindowBase.__init__(self, parent, title, config,
                                                iconfile)
        # wx.Frame.__init__(self, None, title=title)  # ,size=(200,-1))
        self.pres = parent
        if config is None:
            self.config = self.pres.eng.config
        else:
            self.config = config
        self.icon_path = iconfile

        self.datachoices = {
            0: "Raw Data",
            1: "Processed Data",
            2: "Zero Charge Mass Spectrum"
        }
        self.extractchoices = {
            0: "Height",
            1: "Local Max",
            2: "Area",
            3: "Center of Mass",
            4: "Local Max Position"
        }
        self.extractlabels = {
            0: "Intensity",
            1: "Intensity",
            2: "Area",
            3: "Mass",
            4: "Mass"
        }

        self.CreateStatusBar(7)
        self.SetStatusWidths([-1, 200, 120, 200, 230, 250, 130])
        pub.subscribe(self.on_motion, 'newxy')
        pub.subscribe(self.pres.on_selection, 'scans_selected')

        self.menu = meta_menu(self, self.config, self.pres, type="Chrom")
        self.SetMenuBar(self.menu.menuBar)

        self.panel = wx.Panel(self)
        self.panel.SetDropTarget(ChromDropTarget(self))

        self.mainsizer = wx.BoxSizer(wx.HORIZONTAL)

        self.leftsizer = wx.BoxSizer(wx.VERTICAL)

        labelfont = wx.Font(16, wx.DECORATIVE, wx.ITALIC, wx.NORMAL)

        self.ctlsizer = wx.BoxSizer(wx.VERTICAL)
        label = wx.StaticText(self.panel,
                              label="Chromatogram Parsing Tools",
                              size=(300, 30))
        label.SetFont(labelfont)
        self.ctlsizer.Add(label, 0)

        self.manual_add_button = wx.Button(self.panel,
                                           label="Add From Manual Selection")
        self.Bind(wx.EVT_BUTTON, self.pres.on_manual_add,
                  self.manual_add_button)
        self.ctlsizer.Add(self.manual_add_button)

        tsizer0 = wx.BoxSizer(wx.HORIZONTAL)
        self.cpeaksbutton = wx.Button(self.panel,
                                      label="Find Chrom. Peaks Near Width:")
        self.Bind(wx.EVT_BUTTON, self.pres.on_chrom_peaks, self.cpeaksbutton)
        tsizer0.Add(self.cpeaksbutton)

        self.ctlcpeaks_param1 = wx.TextCtrl(self.panel,
                                            value=str(
                                                self.config.chrom_peak_width),
                                            size=(50, 20))
        tsizer0.Add(self.ctlcpeaks_param1, 0, wx.ALIGN_CENTER_VERTICAL)
        tsizer0.Add(wx.StaticText(self.panel, label="min"), 0,
                    wx.ALIGN_CENTER_VERTICAL)

        self.ctlsizer.Add(tsizer0)

        tsizer1 = wx.BoxSizer(wx.HORIZONTAL)
        self.timepartbutton = wx.Button(self.panel,
                                        label="Partition in Time Steps of:")
        self.Bind(wx.EVT_BUTTON, self.pres.on_timepart, self.timepartbutton)
        tsizer1.Add(self.timepartbutton)

        self.ctlmin = wx.TextCtrl(self.panel,
                                  value=str(self.config.time_window),
                                  size=(50, 20))
        tsizer1.Add(self.ctlmin, 0, wx.ALIGN_CENTER_VERTICAL)
        tsizer1.Add(wx.StaticText(self.panel, label="min"), 0,
                    wx.ALIGN_CENTER_VERTICAL)

        self.ctlsizer.Add(tsizer1)

        tsizer2 = wx.BoxSizer(wx.HORIZONTAL)
        self.swbutton = wx.Button(self.panel, label="Sliding Window (min):")
        self.Bind(wx.EVT_BUTTON, self.pres.on_sliding_window, self.swbutton)
        tsizer2.Add(self.swbutton)

        self.ctlswwin = wx.TextCtrl(self.panel,
                                    value=str(self.config.sw_time_window),
                                    size=(50, 20))
        tsizer2.Add(self.ctlswwin, 0, wx.ALIGN_CENTER_VERTICAL)
        tsizer2.Add(wx.StaticText(self.panel, label="Offset (#):"), 0,
                    wx.ALIGN_CENTER_VERTICAL)

        self.ctlswoffset = wx.TextCtrl(self.panel,
                                       value=str(
                                           int(self.config.sw_scan_offset)),
                                       size=(50, 20))
        tsizer2.Add(self.ctlswoffset, 0, wx.ALIGN_CENTER_VERTICAL)
        tsizer2.Add(wx.StaticText(self.panel, label="min"), 0,
                    wx.ALIGN_CENTER_VERTICAL)

        self.ctlsizer.Add(tsizer2)

        tsizer2 = wx.BoxSizer(wx.HORIZONTAL)
        tsizer2.Add(wx.StaticText(self.panel, label="Time Start:"), 0,
                    wx.ALIGN_CENTER_VERTICAL)
        self.ctltmin = wx.TextCtrl(self.panel,
                                   value=str(self.config.time_start),
                                   size=(50, 20))
        tsizer2.Add(self.ctltmin, 0, wx.ALIGN_CENTER_VERTICAL)
        tsizer2.Add(wx.StaticText(self.panel, label="End:"), 0,
                    wx.ALIGN_CENTER_VERTICAL)
        self.ctltmax = wx.TextCtrl(self.panel,
                                   value=str(self.config.time_end),
                                   size=(50, 20))
        tsizer2.Add(self.ctltmax, 0, wx.ALIGN_CENTER_VERTICAL)
        # tsizer2.Add(wx.StaticText(self.panel, label="min. Offset:"), 0, wx.ALIGN_CENTER_VERTICAL)
        self.ctlsizer.Add(tsizer2)

        self.clear_button = wx.Button(self.panel, label="Clear All Spectra")
        self.Bind(wx.EVT_BUTTON, self.pres.on_clear_spectra, self.clear_button)
        self.ctlsizer.Add(self.clear_button)

        label = wx.StaticText(self.panel,
                              label="Parsed Spectra",
                              size=(300, 30))
        label.SetFont(labelfont)
        self.ctlsizer.Add(label, 0)

        self.leftsizer.Add(self.ctlsizer)

        self.ypanel = ListCtrlPanel(self.panel, self.pres, size=(300, 300))
        self.leftsizer.Add(self.ypanel, 1, wx.EXPAND)

        self.ctlsizer2 = wx.BoxSizer(wx.VERTICAL)
        label = wx.StaticText(self.panel,
                              label="UniDec of Manual Selection",
                              size=(300, 30))
        label.SetFont(labelfont)
        self.ctlsizer2.Add(label, 0)

        self.run_ud_button = wx.Button(self.panel,
                                       label="Run UniDec On Selection")
        self.Bind(wx.EVT_BUTTON, self.pres.on_unidec_run, self.run_ud_button)
        self.ctlsizer2.Add(self.run_ud_button)

        self.pick_peaks_button_individual = wx.Button(
            self.panel, label="Pick Peaks On Selection")
        self.Bind(wx.EVT_BUTTON, self.pres.on_pick_peaks_individual,
                  self.pick_peaks_button_individual)
        self.ctlsizer2.Add(self.pick_peaks_button_individual)

        self.open_ud_button = wx.Button(self.panel,
                                        label="Open Selection in UniDec GUI")
        self.Bind(wx.EVT_BUTTON, self.pres.on_open_ud, self.open_ud_button)
        self.ctlsizer2.Add(self.open_ud_button)

        label = wx.StaticText(self.panel,
                              label="Peaks for Manual Selection",
                              size=(300, 30))
        label.SetFont(labelfont)
        self.ctlsizer2.Add(label, 0)

        self.singlepeakpanel = peaklistsort.PeakListCtrlPanel(self.panel,
                                                              meta=False,
                                                              size=(300, 300))
        self.Bind(self.singlepeakpanel.EVT_DELETE_SELECTION_2,
                  self.pres.on_single_delete, self.singlepeakpanel)
        self.Bind(self.singlepeakpanel.EVT_CHARGE_STATE,
                  self.pres.on_single_charge_states, self.singlepeakpanel)
        self.Bind(self.singlepeakpanel.EVT_DIFFERENCES,
                  self.pres.on_single_differences, self.singlepeakpanel)
        self.Bind(self.singlepeakpanel.EVT_MASSES,
                  self.pres.on_single_label_masses, self.singlepeakpanel)
        self.ctlsizer2.Add(self.singlepeakpanel, 0, wx.EXPAND)

        self.leftsizer.Add(self.ctlsizer2, 0, wx.EXPAND)

        self.mainsizer.Add(self.leftsizer, 0, wx.EXPAND)

        plotwindow = scrolled.ScrolledPanel(self.panel)
        sizerplot = wx.GridBagSizer()

        figsize = (4.9, 3.5)
        self.plotc = plot1d.Plot1d(plotwindow, figsize=figsize)  # Chromatogram
        self.plotm = plot1d.Plot1d(
            plotwindow, figsize=figsize)  # Selection from chromatogram
        self.plot1 = plot1d.Plot1d(plotwindow, smash=1,
                                   figsize=figsize)  # MUD Plot 1 m/z cascade
        self.plot2 = plot1d.Plot1d(plotwindow,
                                   figsize=figsize)  # MUD Deconvolved Data
        self.plot7 = plot1d.Plot1d(plotwindow,
                                   figsize=figsize)  # MUD Extraction
        self.plot2s = plot1d.Plot1d(plotwindow,
                                    figsize=figsize)  # Selection mass
        self.plot3 = plot2d.Plot2d(plotwindow,
                                   figsize=figsize)  # MUD 2D m/z vs. time
        self.plot5 = plot2d.Plot2d(plotwindow,
                                   figsize=figsize)  # MUD 2D mass vs. time

        sizerplot.Add(self.plotc, (0, 0), span=(1, 1), flag=wx.EXPAND)
        sizerplot.Add(self.plotm, (1, 0), span=(1, 1), flag=wx.EXPAND)
        sizerplot.Add(self.plot1, (0, 1), span=(1, 1), flag=wx.EXPAND)
        sizerplot.Add(self.plot2, (1, 1), span=(1, 1), flag=wx.EXPAND)
        sizerplot.Add(self.plot7, (2, 1), span=(1, 1), flag=wx.EXPAND)
        sizerplot.Add(self.plot2s, (2, 0), span=(1, 1), flag=wx.EXPAND)
        sizerplot.Add(self.plot3, (3, 0), span=(1, 1), flag=wx.EXPAND)
        sizerplot.Add(self.plot5, (3, 1), span=(1, 1), flag=wx.EXPAND)

        self.plots = [
            self.plotc, self.plotm, self.plot1, self.plot2, self.plot7,
            self.plot2s, self.plot3, self.plot5
        ]
        self.plotnames = [
            "Chrom_TIC", "Chrom_mz_selected", "ChromFigure_mz",
            "ChromFigure_mass", "ChromFigure_XIC", "Chrom_mass_selected",
            "Chrom2Dmz", "Chrom2Dmass"
        ]

        plotwindow.SetSizerAndFit(sizerplot)
        plotwindow.SetupScrolling()

        self.mainsizer.Add(plotwindow, 1, wx.EXPAND)

        self.sizer3 = wx.BoxSizer(wx.VERTICAL)
        label = wx.StaticText(self.panel,
                              label=" Peaks for Parsed Spectra",
                              size=(300, 30))
        label.SetFont(labelfont)
        self.sizer3.Add(label, 0)
        self.peakpanel = peaklistsort.PeakListCtrlPanel(self.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)
        self.sizer3.Add(self.peakpanel, 0, wx.EXPAND)
        self.mainsizer.Add(self.sizer3, 0, wx.EXPAND)

        self.controls = main_controls(self, self.config, self.pres, self.panel,
                                      self.icon_path)
        self.mainsizer.Add(self.controls, 0, wx.EXPAND)

        self.panel.SetSizer(self.mainsizer)
        self.mainsizer.Fit(self)

        keys = [
            ["E", self.pres.on_auto, self.controls.autobutton],
            # ["G", self.pres.on_paste_spectrum, self.menu.menupastespectrum],
            ["R", self.pres.on_unidec_button, self.controls.udbutton],
            ["D", self.pres.on_dataprep_button, self.controls.dataprepbutton],
            ["O", self.pres.on_open,
             self.menu.openmenu],  # ["I", self.pres.on_integrate],
            ["P", self.pres.on_pick_peaks,
             self.controls.plotbutton],  # ["K", self.pres.on_plot_peaks],
            # ["C", self.pres.on_plot_composite, self.controls.compositebutton],
            # ["N", self.pres.on_wizard, self.menu.wizardmenu],
            # ["F", self.pres.on_plot_offsets],  # ["Z", self.pres.on_charge_plot],
            # ["L", self.pres.on_load_state], ["S", self.pres.on_save_state],
            # ["B", self.pres.on_batch_run, self.menu.menubatchrun],
            ["Q", self.on_exit, self.menu.menuExit],
            ["T", self.pres.on_mass_tools, self.menu.menuMassFile],
            ["M", self.pres.on_match, self.menu.menumatch],
            ["W", self.pres.on_auto_peak_width, self.menu.menuAutoWidth],
            # ["Z", self.pres.on_undo, self.menu.menuundo],
            # ["Y", self.pres.on_redo, self.menu.menuredo],
            ["K", self.pres.on_kendrick, self.menu.menukendrick]
        ]
        self.setup_shortcuts(keys)

        self.Centre()
        self.Show(True)
Exemple #3
0
    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])
Exemple #4
0
    def __init__(self,
                 parent,
                 title,
                 config,
                 iconfile="logo.ico",
                 tabbed=None):
        """
        initialize window and feed in links to presenter and config.

        :param parent: GUniDec Presenter -> self.pres
        :param title: Window title (string)
        :param config: UniDecConfig object ->self.config
        :return: None
        """
        MainwindowBase.__init__(self, parent, title, config, iconfile, tabbed)
        self.CreateStatusBar(4)
        self.SetStatusWidths([-1, 150, 150, 150])
        pub.subscribe(self.on_motion, 'newxy')
        # pub.subscribe(self.on_selection, 'scans_selected')

        self.filemenu = wx.Menu()
        self.menuOpen = self.filemenu.Append(wx.ID_SAVE, "Open File Set",
                                             "Open File Set")
        # self.Bind(wx.EVT_MENU, self.on_open, self.menuOpen)

        self.menuSave = self.filemenu.Append(wx.ID_SAVE, "Save File Set",
                                             "Save File Set")
        # self.Bind(wx.EVT_MENU, self.on_open, self.menuOpen)

        self.menuAdd = self.filemenu.Append(wx.ID_SAVE, "Add Files To Set",
                                            "Add Files To Set")
        self.Bind(wx.EVT_MENU, self.pres.on_add, self.menuAdd)

        self.menuBar = wx.MenuBar()
        self.menuBar.Append(self.filemenu, "&File")
        self.SetMenuBar(self.menuBar)

        self.panel = wx.Panel(self)
        # self.panel.SetDropTarget(ChromDropTarget(self))
        self.sizer = wx.BoxSizer(wx.VERTICAL)

        self.inputsizer = wx.BoxSizer(wx.HORIZONTAL)

        self.filelist = UDListCtrlPanel(self.panel)
        self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.on_click, self.filelist.list)

        self.inputsizer.Add(self.filelist)

        self.plotsizer = wx.BoxSizer(wx.VERTICAL)
        self.plot4 = plot1d.Plot1d(self.panel)
        self.plot2 = plot1d.Plot1d(self.panel)
        self.insetplot = plot1d.Plot1d(self.panel)
        self.multiplot = plot1d.Plot1d(self.panel)

        self.plotsizer.Add(self.multiplot)
        self.plotsizer.Add(self.insetplot)
        self.plotsizer.Add(self.plot4)
        self.plotsizer.Add(self.plot2)

        self.inputsizer.Add(self.plotsizer)

        self.peakpanel = peaklistsort.PeakListCtrlPanel(self.panel)
        self.Bind(self.peakpanel.EVT_DELETE_SELECTION_2, self.pres.on_replot,
                  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)
        self.Bind(self.peakpanel.EVT_MASSES, self.pres.on_label_masses,
                  self.peakpanel)
        self.inputsizer.Add(self.peakpanel, 0, wx.EXPAND)

        self.sizer.Add(self.inputsizer, 1, wx.EXPAND)

        self.panel.SetSizer(self.sizer)
        self.sizer.Fit(self)

        self.Centre()
        self.Show(True)