Changeset 4992ff2 in sasview for src/sas/qtgui/MainWindow/DataExplorer.py
- Timestamp:
- Nov 9, 2017 8:43:07 AM (7 years ago)
- 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)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/MainWindow/DataExplorer.py
r7fb471d r4992ff2 5 5 import logging 6 6 7 from PyQt 4import QtCore8 from PyQt 4import QtGui9 from PyQt 4 import QtWebKit10 from PyQt 4.Qt import QMutex7 from PyQt5 import QtCore 8 from PyQt5 import QtGui 9 from PyQt5 import QtWidgets 10 from PyQt5 import QtWebKitWidgets 11 11 12 12 from twisted.internet import threads … … 48 48 self.loader = Loader() 49 49 self.manager = manager if manager is not None else DataManager() 50 self.txt_widget = Qt Gui.QTextEdit(None)50 self.txt_widget = QtWidgets.QTextEdit(None) 51 51 52 52 # Be careful with twisted threads. 53 self.mutex = Q Mutex()53 self.mutex = QtCore.QMutex() 54 54 55 55 # Active plots … … 69 69 70 70 # Display HTML content 71 self._helpView = QtWebKit .QWebView()71 self._helpView = QtWebKitWidgets.QWebView() 72 72 73 73 # Fill in the perspectives combo … … 98 98 99 99 # Proxy model for showing a subset of Data1D/Data2D content 100 self.data_proxy = Qt Gui.QSortFilterProxyModel(self)100 self.data_proxy = QtCore.QSortFilterProxyModel(self) 101 101 self.data_proxy.setSourceModel(self.model) 102 102 … … 108 108 109 109 # Proxy model for showing a subset of Theory content 110 self.theory_proxy = Qt Gui.QSortFilterProxyModel(self)110 self.theory_proxy = QtCore.QSortFilterProxyModel(self) 111 111 self.theory_proxy.setSourceModel(self.theory_model) 112 112 … … 182 182 Opens the Qt "Open File..." dialog 183 183 """ 184 print("A") 184 185 path_str = self.chooseFiles() 185 186 if not path_str: … … 192 193 Opens the Qt "Open Folder..." dialog 193 194 """ 194 folder = Qt Gui.QFileDialog.getExistingDirectory(self, "Choose a directory", "",195 Qt Gui.QFileDialog.ShowDirsOnly | QtGui.QFileDialog.DontUseNativeDialog)195 folder = QtWidgets.QFileDialog.getExistingDirectory(self, "Choose a directory", "", None, 196 QtWidgets.QFileDialog.ShowDirsOnly | QtWidgets.QFileDialog.DontUseNativeDialog) 196 197 if folder is None: 197 198 return … … 216 217 'caption' : 'Open Project', 217 218 'filter' : 'Project (*.json);;All files (*.*)', 218 'options' : Qt Gui.QFileDialog.DontUseNativeDialog219 'options' : QtWidgets.QFileDialog.DontUseNativeDialog 219 220 } 220 filename = str(Qt Gui.QFileDialog.getOpenFileName(**kwargs))221 filename = str(QtWidgets.QFileDialog.getOpenFileName(**kwargs)) 221 222 if filename: 222 223 load_thread = threads.deferToThread(self.readProject, filename) 223 224 load_thread.addCallback(self.readProjectComplete) 224 225 load_thread.addErrback(self.readProjectFailed) 226 227 def loadFailed(self, reason): 228 """ 229 """ 230 print("file load FAILED: ", reason) 231 pass 225 232 226 233 def readProjectFailed(self, reason): … … 248 255 249 256 self.manager.assign(manager) 257 self.model.beginResetModel() 250 258 for id, item in self.manager.get_all_data().items(): 251 259 self.updateModel(item.data, item.path) 252 260 253 self.model. reset()261 self.model.endResetModel() 254 262 255 263 def saveProject(self): … … 261 269 'caption' : 'Save Project', 262 270 'filter' : 'Project (*.json)', 263 'options' : Qt Gui.QFileDialog.DontUseNativeDialog271 'options' : QtWidgets.QFileDialog.DontUseNativeDialog 264 272 } 265 filename = str(Qt Gui.QFileDialog.getSaveFileName(**kwargs))273 filename = str(QtWidgets.QFileDialog.getSaveFileName(**kwargs)) 266 274 if filename: 267 275 self.communicator.statusBarUpdateSignal.emit("Saving Project... %s\n" % os.path.basename(filename)) … … 617 625 # Location is automatically saved - no need to keep track of the last dir 618 626 # But only with Qt built-in dialog (non-platform native) 619 paths = Qt Gui.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) 621 629 if paths is None: 622 630 return … … 835 843 """ 836 844 # Create a custom menu based on actions defined in the UI file 837 self.context_menu = Qt Gui.QMenu(self)845 self.context_menu = QtWidgets.QMenu(self) 838 846 self.context_menu.addAction(self.actionDataInfo) 839 847 self.context_menu.addAction(self.actionSaveAs) … … 1071 1079 # If so, delete them 1072 1080 # TODO: fix this to resemble GuiUtils.updateModelItemWithPlot 1073 # 1081 # 1082 self.model.beginResetModel() 1074 1083 current_tab_name = model_item.text()[:2] 1075 1084 for current_index in range(self.theory_model.rowCount()): … … 1079 1088 1080 1089 # Reset the view 1081 self.model. reset()1090 self.model.endResetModel() 1082 1091 1083 1092 # Reset the view
Note: See TracChangeset
for help on using the changeset viewer.