예제 #1
0
파일: find.py 프로젝트: smdabdoub/find
 def OnSaveState(self, event):
     from data.io import saveState
     
     dlg = wx.FileDialog(self, "Save project to file", "", "", "*.find", wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT)
     if dlg.ShowModal() == wx.ID_OK and dlg.Filename:
         if not '.find' in dlg.Filename:
             dlg.Filename = dlg.Filename + '.find'
             dlg.Path = dlg.Path + '.find'
         
         dv.saveToFigure(self.facsPlotPanel, FigureStore.getSelectedFigure())
         saveState(dlg.Directory, dlg.Filename)
         self.statusbar.SetStatusText("Project saved to %s" % dlg.Path, 0)
         
     dlg.Destroy()
예제 #2
0
파일: find.py 프로젝트: smdabdoub/find
    def OnAddFigure(self, event):
        if len(DataStore.getData()) == 0:
            return
        
        nameDlg = displayDialogs.EditNameDialog(self, '')
        if (nameDlg.ShowModal() == wx.ID_OK):
            newFig = Figure(nameDlg.Text, [dv.Subplot()], 1, (1,1), (0,1))
            currFig = FigureStore.getSelectedFigure() 
            FigureStore.add(newFig)
            dv.switchFigures(self.facsPlotPanel, currFig, newFig)
            self.facsPlotPanel.subplots = []  
            self.addSubplot()
    
            self.treeCtrlPanel.updateTree()   

        nameDlg.Destroy()
예제 #3
0
파일: view.py 프로젝트: smdabdoub/find
 def selectItemTreeSelection(self, rightClick=False):
     """
     Using the selected tree item, set the corresponding object 
     in the data store as the current selection.
     """
     item = self.getSanitizedItemSelectionData()
     
     if item is not None:
         if item[0] is DATA_SET_ITEM:
             self.applyToSelection(DataStore.selectDataSet, FacsData.selectClustering)
         
         if item[0] is FIGURE_SET_ITEM and not rightClick:
             if item[1] != FigureStore.getSelectedIndex():
                 currFig = FigureStore.getSelectedFigure()
                 newFig = FigureStore.get(item[1])
                 switchFigures(self.Parent.TopLevelParent.facsPlotPanel, currFig, newFig, True)
                 self.Parent.TopLevelParent.selectAxes(newFig.axes)
                 FigureStore.setSelectedFigure(item[1])
예제 #4
0
파일: find.py 프로젝트: smdabdoub/find
    def OnLoadState(self, event):
        from data.io import loadState
        
        if len(DataStore.getData()) > 0:
            dlgWarn = wx.MessageDialog(self, 'This action may overwrite currently loaded datasets and/or plots.\n\nContinue anyway?', 'Warning', 
                                   wx.YES_NO | wx.NO_DEFAULT | wx.ICON_WARNING)
            if dlgWarn.ShowModal() == wx.ID_NO:
                dlgWarn.Destroy()
                return
            dlgWarn.Destroy()

        formats = "FIND Project File (*.find)|*.find"
        dlg = wx.FileDialog(self, "Select saved project", self.dirname, "", formats, wx.FD_OPEN)
        if dlg.ShowModal() == wx.ID_OK:
            try:
                loadState(dlg.Directory, dlg.Filename)
            except error.ProjectLoadingError:
                return
            # Load all Figures with Subplot instances from the stored dicts
            for fID in FigureStore.getFigures():
                fig = FigureStore.get(fID)
                splots = []
                for plot in fig.subplots:
                    s = dv.Subplot()
                    s.load(plot)
                    s.parent = self.facsPlotPanel.figure
                    splots.append(s)
                fig.subplots = splots
            
            currFigure = FigureStore.getSelectedFigure()
            self.facsPlotPanel.subplots = currFigure.subplots
            self.facsPlotPanel.SelectedSubplotIndex = currFigure.selectedSubplot
            self.facsPlotPanel.updateAxes(currFigure.axes, False)
            self.facsPlotPanel.updateSubplotGrid(currFigure.grid[0], currFigure.grid[1], True)
            self.chkLinked.Value = self.facsPlotPanel.CurrentSubplotLinked
            labels = DataStore.getCurrentDataSet().labels if DataStore.getCurrentDataSet() is not None else []
            self.updateAxesList(labels, currFigure.axes)
            self.treeCtrlPanel.updateTree()
            self.statusbar.SetStatusText("Project loaded from %s" % dlg.Path, 0)
        
        dlg.Destroy()