コード例 #1
0
    def on_project_info_changed(self, event):
        """
		Event Handler for a property in the Project Info propgrid being changed
		"""

        self.project.unsaved_changes = True
        event.Skip()
        EVT_PROJECT_CHANGE.trigger()
コード例 #2
0
    def on_ammo_details_changed(self, event):
        """
		Event Handler for a property in the Ammunition Details tab being changed
		"""

        self.project.ammo_details_unsaved = True
        event.Skip()
        EVT_PROJECT_CHANGE.trigger()
コード例 #3
0
    def reload_project(self):
        self.project = Project.Project.load(self.project.filename.value)

        for experiment in self.project.experiment_objects:
            self.experiment_pages[experiment.name].experiment = experiment

        # self.compounds_tab.project = self.project

        EVT_PROJECT_CHANGE.trigger()
コード例 #4
0
    def on_method_changed(self, event):
        """
		Event Handler for a property in the Method tab being changed
		"""
        print("on_method_changed")
        print(self.project.method_data.ident_min_aligned_peaks)
        self.project.method_unsaved = True
        event.Skip()
        EVT_PROJECT_CHANGE.trigger()
コード例 #5
0
    def remove_consolidate_data(self):
        """
		Removes the consolidate data from the project file,
		closes the consolidate data tab (if open) and removes it from the tree
		"""

        self.project.remove_consolidate()
        self.project_ammo.fileNotSaved = False
        self.method_tab.fileNotSaved = False
        EVT_PROJECT_CHANGE.trigger()

        self.compounds_tab.remove_consolidate_and_data_tabs()

        # Tell ProjectNavigator to remove Consolidate for this Project
        pub.sendMessage("remove_consolidate", project=self.project.name)
コード例 #6
0
    def _bind_events(self):
        # Toolbar Events
        self.Bind(wx.EVT_MENU,
                  self.on_new_experiment,
                  id=ID_New_Experiment_Single)
        self.Bind(wx.EVT_MENU,
                  self.on_new_experiment_multiple,
                  id=ID_New_Experiment_Multiple)
        # self.Bind(wx.EVT_TOOL, self.on_new_experiment, id=ID_New_Experiment)

        # self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
        self.Bind(wx.EVT_SIZE, self.on_size)
        self.Bind(wx.EVT_CLOSE, self.OnClose)
        # self.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CLOSED, self.on_close_project)

        # WorkflowPanel
        self.Bind(wx.EVT_BUTTON, self.on_quick_start_guide,
                  self.workflow_panel.quick_start_guide_btn)
        self.Bind(wx.EVT_BUTTON, self.on_run_alignment,
                  self.workflow_panel.alignment_btn)
        self.Bind(wx.EVT_BUTTON, self.on_run_identify,
                  self.workflow_panel.identify_btn)
        self.Bind(wx.EVT_BUTTON, self.on_run_consolidate,
                  self.workflow_panel.consolidate_btn)
        self.Bind(wx.EVT_BUTTON, self.on_run_analysis,
                  self.workflow_panel.run_analysis_btn)

        # Notebook
        EVT_PROJECT_CHANGE.set_receiver(self)
        EVT_PROJECT_CHANGE.Bind(self.update_titles)
        self.Bind(aui.EVT_AUI_PANE_CLOSE, self.on_pane_close)

        # Export Dialog request exporting current page as PDF
        pub.subscribe(self.on_export_pdf, "export_current_pdf")
        pub.subscribe(self.on_export_project_report, "export_project_report")
        # pub.subscribe(self.on_export_images, "export_current_images")
        # pub.subscribe(self.on_export_csv, "export_current_csv")
        # TODO: above

        # Export Dialog request for exporting method and ammo_details files
        pub.subscribe(self.on_export_method, "export_method")
        pub.subscribe(self.on_export_ammo_details, "export_ammo_details")

        # Bind events for enabling and disabling controls
        pub.subscribe(self.toggle_spectrum_options, "toggle_view_tools")
        pub.subscribe(self.toggle_expr_options, "toggle_expr_tools")
        pub.subscribe(self.on_refresh_menus, "refresh_menus")
コード例 #7
0
    def remove_identification_data(self):
        """
		Removes the compound identification data from the project file,
		closes the appropriate tab (if open) and removes it from the tree
		"""

        for experiment in self.project.experiment_objects:
            experiment.identification_performed = False
            expr_tab = self.experiment_pages[experiment.name]
            expr_tab.remove_ident_tab()
        self.compounds_tab.remove_ident_tab()

        self.project.store(resave_experiments=True)
        self.project_ammo.fileNotSaved = False
        self.method_tab.fileNotSaved = False
        EVT_PROJECT_CHANGE.trigger()

        pub.sendMessage("remove_identify", project=self.project.name)
コード例 #8
0
    def remove_alignment_data(self):
        """
		Removes the alignment data from the project file,
		closes the alignment data tab (if open) and removes it from the tree
		"""

        self.project.remove_alignment()
        self.project_ammo.fileNotSaved = False
        self.method_tab.fileNotSaved = False
        EVT_PROJECT_CHANGE.trigger()

        # Find index of alignment page
        for tab_idx in range(self.notebook.GetPageCount()):
            if self.notebook.GetPageText(tab_idx) == "Alignment Data":
                self.notebook.RemovePage(tab_idx)
                break

        self.alignment_page.Destroy()
        self.alignment_page = None

        # Tell ProjectNavigator to remove Alignment for this Project
        pub.sendMessage("remove_alignment", project=self.name)
コード例 #9
0
    def save(self, filename=None):
        """
		Save the project, either to the filename of the project or, if given, the `filename` argument
		
		:param filename:
		:type filename:
		
		:return: True if the operation completed successfully, False otherwise.
		:rtype: bool
		"""

        # 1. Extract the project tarfile to a temporary directory
        # 2. Move any files that were changed to a timestamped folder
        # 3. In that folder, create a file called "user" containing the username of the user who made the change
        # 4. In the same folder, create a file called "device" containing the hostname of the device
        # 5. Save the changed files to the temporary directory
        # 6. Tar the contents of the temporary directory over the project file
        # 7. Get rid of the temporary directory

        if filename:
            self.project.filename.value = filename

        # TODO: Check if the project needs to be saved

        print(f"Saving changes as {self.project.filename}")

        # One of the files has been changed

        self.project.date_modified.value = datetime.datetime.now().timestamp()

        self.project.store()

        self.project_ammo.fileNotSaved = False
        self.method_tab.fileNotSaved = False

        EVT_PROJECT_CHANGE.trigger()
        return True
コード例 #10
0
 def hide_peak(self, event=None):
     self.selected_peak.hidden = not self.selected_peak.hidden
     self.update_show_hide_peak_btn()
     self.project.unsaved_changes = True
     EVT_PROJECT_CHANGE.trigger()