Changeset 4992ff2 in sasview for src/sas/qtgui/MainWindow
- 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)
- Location:
- src/sas/qtgui/MainWindow
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/MainWindow/AboutBox.py
- Property mode changed from 100755 to 100644
rb3e8629 r4992ff2 1 1 import functools 2 from PyQt 4 import QtGui2 from PyQt5 import QtWidgets 3 3 4 4 import sas.sasview … … 10 10 from .UI.AboutUI import Ui_AboutUI 11 11 12 class AboutBox(Qt Gui.QDialog, Ui_AboutUI):12 class AboutBox(QtWidgets.QDialog, Ui_AboutUI): 13 13 def __init__(self, parent=None): 14 14 super(AboutBox, self).__init__(parent) -
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 -
src/sas/qtgui/MainWindow/DroppableDataLoadWidget.py
rcd2cc745 r4992ff2 1 1 # global 2 from PyQt4 import QtGui, QtCore 2 from PyQt5 import QtCore 3 from PyQt5 import QtGui 4 from PyQt5 import QtWidgets 3 5 4 6 # UI … … 6 8 from sas.qtgui.MainWindow.UI.DataExplorerUI import Ui_DataLoadWidget 7 9 8 class DroppableDataLoadWidget(Qt Gui.QTabWidget, Ui_DataLoadWidget):10 class DroppableDataLoadWidget(QtWidgets.QTabWidget, Ui_DataLoadWidget): 9 11 """ 10 12 Overwrite drag and drop methods in the base class -
src/sas/qtgui/MainWindow/GuiManager.py
rcee5c78 r4992ff2 6 6 import webbrowser 7 7 8 from PyQt4 import QtCore 9 from PyQt4 import QtGui 10 from PyQt4 import QtWebKit 8 from PyQt5.QtWidgets import * 9 from PyQt5.QtGui import * 10 from PyQt5.QtCore import Qt 11 from PyQt5.QtWebKitWidgets import QWebView 11 12 12 13 from twisted.internet import reactor … … 38 39 from sas.qtgui.MainWindow.DataExplorer import DataExplorerWindow 39 40 40 class Acknowledgements(Q tGui.QDialog, Ui_Acknowledgements):41 class Acknowledgements(QDialog, Ui_Acknowledgements): 41 42 def __init__(self, parent=None): 42 Q tGui.QDialog.__init__(self, parent)43 QDialog.__init__(self, parent) 43 44 self.setupUi(self) 44 45 … … 77 78 # Invoke the initial perspective 78 79 self.perspectiveChanged("Fitting") 79 80 80 self.addWidgets() 81 81 … … 94 94 # Show the Welcome panel 95 95 self.welcomePanel = WelcomePanel() 96 self._workspace.workspace.add Window(self.welcomePanel)96 self._workspace.workspace.addSubWindow(self.welcomePanel) 97 97 98 98 # Current help file 99 self._helpView = Q tWebKit.QWebView()99 self._helpView = QWebView() 100 100 # Needs URL like path, so no path.join() here 101 101 self._helpLocation = GuiUtils.HELP_DIRECTORY_LOCATION + "/index.html" … … 116 116 ObjectLibrary.addObject('DataExplorer', self.filesWidget) 117 117 118 self.dockedFilesWidget = QtGui.QDockWidget("Data Explorer", self._workspace) 118 self.dockedFilesWidget = QDockWidget("Data Explorer", self._workspace) 119 self.dockedFilesWidget.setFloating(True) 119 120 self.dockedFilesWidget.setWidget(self.filesWidget) 120 121 121 122 # Disable maximize/minimize and close buttons 122 self.dockedFilesWidget.setFeatures(QtGui.QDockWidget.NoDockWidgetFeatures) 123 self._workspace.addDockWidget(QtCore.Qt.LeftDockWidgetArea, 124 self.dockedFilesWidget) 123 self.dockedFilesWidget.setFeatures(QDockWidget.NoDockWidgetFeatures) 124 self.dockedFilesWidget.setFeatures(Qt.LeftDockWidgetArea) 125 126 self._workspace.workspace.addDockWidget(Qt.LeftDockWidgetArea, self.dockedFilesWidget) 125 127 126 128 # Add the console window as another docked widget 127 self.logDockWidget = Q tGui.QDockWidget("Log Explorer", self._workspace)129 self.logDockWidget = QDockWidget("Log Explorer", self._workspace) 128 130 self.logDockWidget.setObjectName("LogDockWidget") 129 self.listWidget = QtGui.QTextBrowser() 131 132 self.listWidget = QTextBrowser() 130 133 self.logDockWidget.setWidget(self.listWidget) 131 self._workspace.addDockWidget(QtCore.Qt.BottomDockWidgetArea, 132 self.logDockWidget) 134 self._workspace.workspace.addDockWidget(Qt.BottomDockWidgetAre, self.logDockWidget) 133 135 134 136 # Add other, minor widgets … … 152 154 Progress bar invisible until explicitly shown 153 155 """ 154 self.progress = Q tGui.QProgressBar()156 self.progress = QProgressBar() 155 157 self._workspace.statusbar.setSizeGripEnabled(False) 156 158 157 self.statusLabel = Q tGui.QLabel()159 self.statusLabel = QLabel() 158 160 self.statusLabel.setText("Welcome to SasView") 159 161 self._workspace.statusbar.addPermanentWidget(self.statusLabel, 1) … … 194 196 self._current_perspective = Perspectives.PERSPECTIVES[str(perspective_name)](parent=self) 195 197 196 self. setupPerspectiveMenubarOptions(self._current_perspective)197 self._workspace.workspace.addWindow(self._current_perspective) 198 self._workspace.workspace.addSubWindow(self._current_perspective) 199 198 200 # Resize to the workspace height 199 201 workspace_height = self._workspace.workspace.sizeHint().height() … … 265 267 # Display confirmation messagebox 266 268 quit_msg = "Are you sure you want to exit the application?" 267 reply = Q tGui.QMessageBox.question(269 reply = QMessageBox.question( 268 270 self._parent, 269 271 'Information', 270 272 quit_msg, 271 Q tGui.QMessageBox.Yes,272 Q tGui.QMessageBox.No)273 QMessageBox.Yes, 274 QMessageBox.No) 273 275 274 276 # Exit if yes 275 if reply == Q tGui.QMessageBox.Yes:277 if reply == QMessageBox.Yes: 276 278 reactor.callFromThread(reactor.stop) 277 279 return True … … 587 589 588 590 # Add the console window as another docked widget 589 self.ipDockWidget = Q tGui.QDockWidget("IPython", self._workspace)591 self.ipDockWidget = QDockWidget("IPython", self._workspace) 590 592 self.ipDockWidget.setObjectName("IPythonDockWidget") 591 593 self.ipDockWidget.setWidget(terminal) 592 self._workspace.addDockWidget(QtCore.Qt.RightDockWidgetArea, 593 self.ipDockWidget) 594 self._workspace.workspace.addSubWindow(self.ipDockWidget, Qt.RightDockWidgetArea) 594 595 595 596 def actionImage_Viewer(self): … … 716 717 TODO: use QNetworkAccessManager to assure _helpLocation is valid 717 718 """ 718 self._helpView.load(Q tCore.QUrl(self._helpLocation))719 self._helpView.load(QUrl(self._helpLocation)) 719 720 self._helpView.show() 720 721 … … 761 762 :param new_datalist_item: 762 763 """ 763 if not isinstance(new_item, Q tGui.QStandardItem) or \764 if not isinstance(new_item, QStandardItem) or \ 764 765 not isinstance(new_datalist_item, dict): 765 766 msg = "Wrong data type returned from calculations." -
src/sas/qtgui/MainWindow/MainWindow.py
- Property mode changed from 100755 to 100644
rb3e8629 r4992ff2 1 1 # UNLESS EXEPTIONALLY REQUIRED TRY TO AVOID IMPORTING ANY MODULES HERE 2 2 # ESPECIALLY ANYTHING IN SAS, SASMODELS NAMESPACE 3 from PyQt4 import QtGui 3 #from PyQt4 import QtGui 4 from PyQt5.QtWidgets import * 5 from PyQt5.QtGui import * 4 6 5 7 # Local UI … … 10 12 import sas.qtgui.Utilities.SasviewLogger 11 13 12 class MainSasViewWindow(Q tGui.QMainWindow, Ui_MainWindow):14 class MainSasViewWindow(QMainWindow, Ui_MainWindow): 13 15 # Main window of the application 14 16 def __init__(self, parent=None): … … 17 19 18 20 # define workspace for dialogs. 19 self.workspace = Q tGui.QWorkspace(self)21 self.workspace = QMdiArea(self) 20 22 self.setCentralWidget(self.workspace) 21 23 22 24 # Create the gui manager 23 25 from .GuiManager import GuiManager 24 self.guiManager = GuiManager(self) 26 try: 27 self.guiManager = GuiManager(self) 28 except Exception as ex: 29 print("EXCEPTION: ", ex) 25 30 26 31 def closeEvent(self, event): … … 37 42 """ 38 43 # TODO: standardize path to images 39 pixmap = Q tGui.QPixmap("src/sas/qtgui/images/SVwelcome_mini.png")40 splashScreen = Q tGui.QSplashScreen(pixmap)44 pixmap = QPixmap("src/sas/qtgui/images/SVwelcome_mini.png") 45 splashScreen = QSplashScreen(pixmap) 41 46 return splashScreen 42 47 43 48 def run(): 44 app = Q tGui.QApplication([])49 app = QApplication([]) 45 50 46 51 # Main must have reference to the splash screen, so making it explicit … … 55 60 # DO NOT move the following import to the top! 56 61 # (unless you know what you're doing) 57 import qt 4reactor62 import qt5reactor 58 63 # Using the Qt4 reactor wrapper from https://github.com/ghtdak/qtreactor 59 qt 4reactor.install()64 qt5reactor.install() 60 65 61 66 # DO NOT move the following import to the top! -
src/sas/qtgui/MainWindow/WelcomePanel.py
rcd2cc745 r4992ff2 2 2 import sys 3 3 import os 4 from PyQt4 import QtCore 5 from PyQt4 import QtGui 6 from PyQt4 import QtWebKit 4 5 from PyQt5 import QtWidgets 7 6 8 7 import sas.sasview … … 13 12 from sas.qtgui.MainWindow.UI.WelcomePanelUI import Ui_WelcomePanelUI 14 13 15 class WelcomePanel(Qt Gui.QDialog, Ui_WelcomePanelUI):14 class WelcomePanel(QtWidgets.QDialog, Ui_WelcomePanelUI): 16 15 def __init__(self, parent=None): 17 16 super(WelcomePanel, self).__init__(parent)
Note: See TracChangeset
for help on using the changeset viewer.