Ignore:
Timestamp:
Nov 9, 2017 8:43:07 AM (6 years ago)
Author:
Piotr Rozyczko <rozyczko@…>
Branches:
ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
Children:
7969b9c
Parents:
7fb471d
git-author:
Piotr Rozyczko <rozyczko@…> (10/30/17 07:50:09)
git-committer:
Piotr Rozyczko <rozyczko@…> (11/09/17 08:43:07)
Message:

Initial, in-progress version. Not really working atm. SASVIEW-787

File:
1 edited

Legend:

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

    r7fb471d r4992ff2  
    55import logging 
    66 
    7 from PyQt4 import QtCore 
    8 from PyQt4 import QtGui 
    9 from PyQt4 import QtWebKit 
    10 from PyQt4.Qt import QMutex 
     7from PyQt5 import QtCore 
     8from PyQt5 import QtGui 
     9from PyQt5 import QtWidgets 
     10from PyQt5 import QtWebKitWidgets 
    1111 
    1212from twisted.internet import threads 
     
    4848        self.loader = Loader() 
    4949        self.manager = manager if manager is not None else DataManager() 
    50         self.txt_widget = QtGui.QTextEdit(None) 
     50        self.txt_widget = QtWidgets.QTextEdit(None) 
    5151 
    5252        # Be careful with twisted threads. 
    53         self.mutex = QMutex() 
     53        self.mutex = QtCore.QMutex() 
    5454 
    5555        # Active plots 
     
    6969 
    7070        # Display HTML content 
    71         self._helpView = QtWebKit.QWebView() 
     71        self._helpView = QtWebKitWidgets.QWebView() 
    7272 
    7373        # Fill in the perspectives combo 
     
    9898 
    9999        # Proxy model for showing a subset of Data1D/Data2D content 
    100         self.data_proxy = QtGui.QSortFilterProxyModel(self) 
     100        self.data_proxy = QtCore.QSortFilterProxyModel(self) 
    101101        self.data_proxy.setSourceModel(self.model) 
    102102 
     
    108108 
    109109        # Proxy model for showing a subset of Theory content 
    110         self.theory_proxy = QtGui.QSortFilterProxyModel(self) 
     110        self.theory_proxy = QtCore.QSortFilterProxyModel(self) 
    111111        self.theory_proxy.setSourceModel(self.theory_model) 
    112112 
     
    182182        Opens the Qt "Open File..." dialog 
    183183        """ 
     184        print("A") 
    184185        path_str = self.chooseFiles() 
    185186        if not path_str: 
     
    192193        Opens the Qt "Open Folder..." dialog 
    193194        """ 
    194         folder = QtGui.QFileDialog.getExistingDirectory(self, "Choose a directory", "", 
    195               QtGui.QFileDialog.ShowDirsOnly | QtGui.QFileDialog.DontUseNativeDialog) 
     195        folder = QtWidgets.QFileDialog.getExistingDirectory(self, "Choose a directory", "", None, 
     196              QtWidgets.QFileDialog.ShowDirsOnly | QtWidgets.QFileDialog.DontUseNativeDialog) 
    196197        if folder is None: 
    197198            return 
     
    216217            'caption'   : 'Open Project', 
    217218            'filter'    : 'Project (*.json);;All files (*.*)', 
    218             'options'   : QtGui.QFileDialog.DontUseNativeDialog 
     219            'options'   : QtWidgets.QFileDialog.DontUseNativeDialog 
    219220        } 
    220         filename = str(QtGui.QFileDialog.getOpenFileName(**kwargs)) 
     221        filename = str(QtWidgets.QFileDialog.getOpenFileName(**kwargs)) 
    221222        if filename: 
    222223            load_thread = threads.deferToThread(self.readProject, filename) 
    223224            load_thread.addCallback(self.readProjectComplete) 
    224225            load_thread.addErrback(self.readProjectFailed) 
     226 
     227    def loadFailed(self, reason): 
     228        """ 
     229        """ 
     230        print("file load FAILED: ", reason) 
     231        pass 
    225232 
    226233    def readProjectFailed(self, reason): 
     
    248255 
    249256        self.manager.assign(manager) 
     257        self.model.beginResetModel() 
    250258        for id, item in self.manager.get_all_data().items(): 
    251259            self.updateModel(item.data, item.path) 
    252260 
    253         self.model.reset() 
     261        self.model.endResetModel() 
    254262 
    255263    def saveProject(self): 
     
    261269            'caption'   : 'Save Project', 
    262270            'filter'    : 'Project (*.json)', 
    263             'options'   : QtGui.QFileDialog.DontUseNativeDialog 
     271            'options'   : QtWidgets.QFileDialog.DontUseNativeDialog 
    264272        } 
    265         filename = str(QtGui.QFileDialog.getSaveFileName(**kwargs)) 
     273        filename = str(QtWidgets.QFileDialog.getSaveFileName(**kwargs)) 
    266274        if filename: 
    267275            self.communicator.statusBarUpdateSignal.emit("Saving Project... %s\n" % os.path.basename(filename)) 
     
    617625        # Location is automatically saved - no need to keep track of the last dir 
    618626        # But only with Qt built-in dialog (non-platform native) 
    619         paths = QtGui.QFileDialog.getOpenFileNames(self, "Choose a file", "", 
    620                 wlist, QtGui.QFileDialog.DontUseNativeDialog) 
     627        paths = QtWidgets.QFileDialog.getOpenFileNames(self, "Choose a file", "", 
     628                wlist, None, QtWidgets.QFileDialog.DontUseNativeDialog) 
    621629        if paths is None: 
    622630            return 
     
    835843        """ 
    836844        # Create a custom menu based on actions defined in the UI file 
    837         self.context_menu = QtGui.QMenu(self) 
     845        self.context_menu = QtWidgets.QMenu(self) 
    838846        self.context_menu.addAction(self.actionDataInfo) 
    839847        self.context_menu.addAction(self.actionSaveAs) 
     
    10711079        # If so, delete them 
    10721080        # TODO: fix this to resemble GuiUtils.updateModelItemWithPlot 
    1073         #  
     1081        # 
     1082        self.model.beginResetModel() 
    10741083        current_tab_name = model_item.text()[:2] 
    10751084        for current_index in range(self.theory_model.rowCount()): 
     
    10791088 
    10801089        # Reset the view 
    1081         self.model.reset() 
     1090        self.model.endResetModel() 
    10821091 
    10831092        # Reset the view 
Note: See TracChangeset for help on using the changeset viewer.