Ignore:
Timestamp:
Nov 12, 2018 4:47:59 AM (5 years ago)
Author:
Piotr Rozyczko <piotr.rozyczko@…>
Branches:
ESS_GUI, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
Children:
e5ae812
Parents:
ebcdb02
git-author:
Piotr Rozyczko <piotr.rozyczko@…> (10/31/18 04:34:14)
git-committer:
Piotr Rozyczko <piotr.rozyczko@…> (11/12/18 04:47:59)
Message:

Merged ESS_GUI

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/MainWindow/DataExplorer.py

    rebcdb02 r133812c7  
    4949        self.parent = guimanager 
    5050        self.loader = Loader() 
     51 
     52        # Read in default locations 
     53        self.default_save_location = None 
     54        self.default_load_location = GuiUtils.DEFAULT_OPEN_FOLDER 
     55        self.default_project_location = None 
     56 
    5157        self.manager = manager if manager is not None else DataManager() 
    5258        self.txt_widget = QtWidgets.QTextEdit(None) 
     
    99105        self.communicator.extMaskEditorSignal.connect(self.extShowEditDataMask) 
    100106        self.communicator.changeDataExplorerTabSignal.connect(self.changeTabs) 
     107        self.communicator.forcePlotDisplaySignal.connect(self.displayData) 
     108        self.communicator.updateModelFromPerspectiveSignal.connect(self.updateModelFromPerspective) 
    101109 
    102110        self.cbgraph.editTextChanged.connect(self.enableGraphCombo) 
     
    205213        Opens the Qt "Open Folder..." dialog 
    206214        """ 
    207         folder = QtWidgets.QFileDialog.getExistingDirectory(self, "Choose a directory", "", 
    208               QtWidgets.QFileDialog.ShowDirsOnly | QtWidgets.QFileDialog.DontUseNativeDialog) 
     215        kwargs = { 
     216            'parent'    : self, 
     217            'caption'   : 'Choose a directory', 
     218            'options'   : QtWidgets.QFileDialog.ShowDirsOnly | QtWidgets.QFileDialog.DontUseNativeDialog, 
     219            'directory' : self.default_load_location 
     220        } 
     221        folder = QtWidgets.QFileDialog.getExistingDirectory(**kwargs) 
     222 
    209223        if folder is None: 
    210224            return 
    211225 
    212226        folder = str(folder) 
    213  
    214227        if not os.path.isdir(folder): 
    215228            return 
    216  
     229        self.default_load_location = folder 
    217230        # get content of dir into a list 
    218231        path_str = [os.path.join(os.path.abspath(folder), filename) 
     
    251264        filename = QtWidgets.QFileDialog.getOpenFileName(**kwargs)[0] 
    252265        if filename: 
     266            self.default_project_location = os.path.dirname(filename) 
    253267            self.deleteAllItems() 
    254268            self.readProject(filename) 
     
    276290            'caption'   : 'Save Project', 
    277291            'filter'    : 'Project (*.json)', 
    278             'options'   : QtWidgets.QFileDialog.DontUseNativeDialog 
     292            'options'   : QtWidgets.QFileDialog.DontUseNativeDialog, 
     293            'directory' : self.default_project_location 
    279294        } 
    280295        name_tuple = QtWidgets.QFileDialog.getSaveFileName(**kwargs) 
     
    282297        if not filename: 
    283298            return 
     299        self.default_project_location = os.path.dirname(filename) 
    284300        _, extension = os.path.splitext(filename) 
    285301        if not extension: 
     
    616632        Send selected item data to the current perspective and set the relevant notifiers 
    617633        """ 
    618         # Set the signal handlers 
    619         self.communicator.updateModelFromPerspectiveSignal.connect(self.updateModelFromPerspective) 
    620  
    621634        def isItemReady(index): 
    622635            item = self.model.item(index) 
     
    903916            # Try the current item 
    904917            main_data = GuiUtils.dataFromItem(plot_item) 
     918        # 1D dependent plots of 2D sets - special treatment 
     919        if isinstance(main_data, Data2D) and isinstance(plot_to_show, Data1D): 
     920            main_data = None 
    905921 
    906922        # Make sure main data for 2D is always displayed 
    907         if main_data and not self.isPlotShown(main_data): 
     923        if main_data is not None and not self.isPlotShown(main_data): 
    908924            if isinstance(main_data, Data2D): 
    909925                self.plotData([(plot_item, main_data)]) 
     
    923939            # Plots with main data points on the same chart 
    924940            # Get the main data plot 
    925             if main_data and not self.isPlotShown(main_data): 
     941            if main_data is not None and not self.isPlotShown(main_data): 
    926942                new_plots.append((plot_item, main_data)) 
    927943            new_plots.append((plot_item, plot_to_show)) 
     
    10831099        # List of known extensions 
    10841100        wlist = self.getWlist() 
    1085  
    10861101        # Location is automatically saved - no need to keep track of the last dir 
    10871102        # But only with Qt built-in dialog (non-platform native) 
    1088         paths = QtWidgets.QFileDialog.getOpenFileNames(self, "Choose a file", "", 
    1089                 wlist, None, QtWidgets.QFileDialog.DontUseNativeDialog)[0] 
     1103        kwargs = { 
     1104            'parent'    : self, 
     1105            'caption'   : 'Choose files', 
     1106            'filter'    : wlist, 
     1107            'options'   : QtWidgets.QFileDialog.DontUseNativeDialog, 
     1108            'directory' : self.default_load_location 
     1109        } 
     1110        paths = QtWidgets.QFileDialog.getOpenFileNames(**kwargs)[0] 
    10901111        if not paths: 
    10911112            return 
     
    10941115            paths = [paths] 
    10951116 
     1117        self.default_load_location = os.path.dirname(paths[0]) 
    10961118        return paths 
    10971119 
     
    17291751            raise AttributeError(msg) 
    17301752 
    1731         # TODO: Assert other properties 
    1732  
    1733         # Reset the view 
    1734         ##self.model.reset() 
    1735         # Pass acting as a debugger anchor 
     1753        # send in the new item 
     1754        self.model.appendRow(model_item) 
    17361755        pass 
    17371756 
Note: See TracChangeset for help on using the changeset viewer.