Changeset e540cd2 in sasview for src/sas/qtgui
- Timestamp:
- Jul 7, 2016 4:54:18 AM (8 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:
- 0cd8612
- Parents:
- f0f309d
- Location:
- src/sas/qtgui
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/DataExplorer.py
r481ff26 re540cd2 2 2 import sys 3 3 import os 4 import time 4 5 import logging 5 6 … … 16 17 from sas.sascalc.dataloader.loader import Loader 17 18 from sas.sasgui.guiframe.data_manager import DataManager 19 from sas.sasgui.guiframe.dataFitting import Data1D 20 from sas.sasgui.guiframe.dataFitting import Data2D 18 21 19 22 from DroppableDataLoadWidget import DroppableDataLoadWidget … … 57 60 self._helpView = QtWebKit.QWebView() 58 61 62 # Context menu in the treeview 63 #self.treeView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu) 64 #self.actionDataInfo.triggered.connect(self.contextDataInfo) 65 #self.treeView.addAction(self.actionDataInfo) 66 67 # Custom context menu 68 self.treeView.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) 69 self.treeView.customContextMenuRequested.connect(self.onCustomContextMenu) 70 59 71 # Connect the comboboxes 60 72 self.cbSelect.currentIndexChanged.connect(self.selectData) … … 62 74 #self.closeEvent.connect(self.closeEvent) 63 75 # self.aboutToQuit.connect(self.closeEvent) 64 76 self.communicator = self.parent.communicator() 65 77 self.communicator.fileReadSignal.connect(self.loadFromURL) 66 78 … … 133 145 # get content of dir into a list 134 146 path_str = [os.path.join(os.path.abspath(folder), filename) 135 147 for filename in os.listdir(folder)] 136 148 137 149 self.loadFromURL(path_str) … … 144 156 delete_msg = "This operation will delete the checked data sets and all the dependents." +\ 145 157 "\nDo you want to continue?" 146 reply = QtGui.QMessageBox.question(self, 'Warning', delete_msg, 147 QtGui.QMessageBox.Yes, QtGui.QMessageBox.No) 158 reply = QtGui.QMessageBox.question(self, 159 'Warning', 160 delete_msg, 161 QtGui.QMessageBox.Yes, 162 QtGui.QMessageBox.No) 148 163 149 164 if reply == QtGui.QMessageBox.No: … … 201 216 202 217 # Set the signal handlers 203 self.communicator = self._perspective.communicator()204 218 self.communicator.updateModelFromPerspectiveSignal.connect(self.updateModelFromPerspective) 205 219 … … 254 268 theories_copied += 1 255 269 new_item = self.recursivelyCloneItem(subitem) 270 # Append a "unique" descriptor to the name 271 time_bit = str(time.time())[7:-1].replace('.','') 272 new_name = new_item.text() + '_@' + time_bit 273 new_item.setText(new_name) 256 274 self.theory_model.appendRow(new_item) 257 275 self.theory_model.reset() … … 261 279 return 262 280 elif theories_copied == 1: 263 freeze_msg = "1 theory sent to Theory tab"281 freeze_msg = "1 theory copied to the Theory tab as a data set" 264 282 elif theories_copied > 1: 265 freeze_msg = "%i theories sent to Theory tab" % theories_copied283 freeze_msg = "%i theories copied to the Theory tab as data sets" % theories_copied 266 284 else: 267 285 freeze_msg = "Unexpected number of theories copied: %i" % theories_copied … … 313 331 return 314 332 315 #if type(paths) == QtCore.QStringList:316 333 if isinstance(paths, QtCore.QStringList): 317 334 paths = [str(f) for f in paths] 318 335 319 if paths.__class__.__name__ != "list":336 if type(paths) is not list: 320 337 paths = [paths] 321 338 … … 335 352 error_message = "" 336 353 337 for p_file in path: 354 number_of_files = len(path) 355 self.communicator.progressBarUpdateSignal.emit(0.0) 356 357 for index, p_file in enumerate(path): 338 358 basename = os.path.basename(p_file) 339 359 _, extension = os.path.splitext(basename) … … 406 426 info = "error" 407 427 428 current_percentage = int(100.0* index/number_of_files) 429 self.communicator.progressBarUpdateSignal.emit(current_percentage) 430 408 431 if any_error or error_message: 409 432 self.communicator.statusBarUpdateSignal.emit(error_message) … … 412 435 message = "Loading Data Complete! " 413 436 message += log_msg 437 self.communicator.progressBarUpdateSignal.emit(-1) 414 438 415 439 return output, message … … 461 485 462 486 try: 463 is1D = item.child(0).data().toPyObject().__class__.__name__ == 'Data1D'487 is1D = type(item.child(0).data().toPyObject()) is Data1D 464 488 except AttributeError: 465 489 msg = "Bad structure of the data model." … … 475 499 476 500 try: 477 is1D = item.child(0).data().toPyObject().__class__.__name__ == 'Data1D'501 is1D = type(item.child(0).data().toPyObject()) is Data1D 478 502 except AttributeError: 479 503 msg = "Bad structure of the data model." … … 489 513 item.setCheckState(QtCore.Qt.Unchecked) 490 514 try: 491 is2D = item.child(0).data().toPyObject().__class__.__name__ == 'Data2D'515 is2D = type(item.child(0).data().toPyObject()) is Data2D 492 516 except AttributeError: 493 517 msg = "Bad structure of the data model." … … 503 527 504 528 try: 505 is2D = item.child(0).data().toPyObject().__class__.__name__ == 'Data2D'529 is2D = type(item.child(0).data().toPyObject()) is Data2D 506 530 except AttributeError: 507 531 msg = "Bad structure of the data model." … … 516 540 raise Exception, msg 517 541 542 def contextDataInfo(self): 543 """ 544 """ 545 print("contextDataInfo TRIGGERED") 546 pass 547 548 def onCustomContextMenu(self, position): 549 """ 550 """ 551 print "onCustomContextMenu triggered at point ", position.x(), position.y() 552 index = self.treeView.indexAt(position) 553 if index.isValid(): 554 print "VALID CONTEXT MENU" 555 # self.context_menu.exec(self.treeView.mapToGlobal(position)) 556 pass 518 557 519 558 def loadComplete(self, output): … … 521 560 Post message to status bar and update the data manager 522 561 """ 562 assert type(output) == tuple 563 523 564 # Reset the model so the view gets updated. 524 565 self.model.reset() 525 assert type(output) == tuple566 self.communicator.progressBarUpdateSignal.emit(-1) 526 567 527 568 output_data = output[0] -
src/sas/qtgui/DroppableDataLoadWidget.py
r481ff26 re540cd2 16 16 self.setAcceptDrops(True) 17 17 self.communicator = guimanager.communicator() 18 flags = QtCore.Qt.CustomizeWindowHint | QtCore.Qt.WindowTitleHint | QtCore.Qt.WindowSystemMenuHint 19 self.setWindowFlags(flags) 18 20 19 21 def dragIsOK(self, event): … … 22 24 """ 23 25 # Analyze mime data 24 if event.mimeData().hasUrls() and self.currentIndex() == 0: 25 return True 26 else: 27 return False 26 return bool(event.mimeData().hasUrls() and self.currentIndex() == 0) 28 27 29 28 def dragEnterEvent(self, event): … … 61 60 event.ignore() 62 61 62 def closeEvent(self, event): 63 """ 64 Overwrite the close event - no close! 65 """ 66 event.ignore() -
src/sas/qtgui/GuiManager.py
r481ff26 re540cd2 60 60 # Add FileDialog widget as docked 61 61 self.filesWidget = DataExplorerWindow(parent, self) 62 #flags = (QtCore.Qt.Window | QtCore.Qt.WindowTitleHint | QtCore.Qt.WindowMinimizeButtonHint) 63 flags = (QtCore.Qt.CustomizeWindowHint | QtCore.Qt.WindowTitleHint | 64 QtCore.Qt.WindowMinMaxButtonsHint) 65 66 self.dockedFilesWidget = QtGui.QDockWidget("Data explorer", self._workspace, flags=flags) 62 63 self.dockedFilesWidget = QtGui.QDockWidget("Data explorer", self._workspace) 67 64 self.dockedFilesWidget.setWidget(self.filesWidget) 65 self.dockedFilesWidget.setFeatures(QtGui.QDockWidget.NoDockWidgetFeatures) 68 66 self._workspace.addDockWidget(QtCore.Qt.DockWidgetArea(1), self.dockedFilesWidget) 69 67 … … 71 69 self.aboutWidget = AboutBox() 72 70 73 # Disable the close button (?) 71 # Set up the status bar 72 self.statusBarSetup() 74 73 75 74 # Show the Welcome panel … … 95 94 # Default perspective 96 95 self._current_perspective = self.invariantWidget 96 97 def statusBarSetup(self): 98 """ 99 Define the status bar. 100 | <message label> .... | Progress Bar | 101 102 Progress bar invisible until explicitly shown 103 """ 104 self.progress = QtGui.QProgressBar() 105 self._workspace.statusbar.setSizeGripEnabled(False) 106 107 self.statusLabel = QtGui.QLabel() 108 self.statusLabel.setText("Welcome to SasView") 109 self._workspace.statusbar.addPermanentWidget(self.statusLabel,1) 110 self._workspace.statusbar.addPermanentWidget(self.progress, stretch=0) 111 self.progress.setRange(0,100) 112 self.progress.setValue(0) 113 self.progress.setTextVisible(True) 114 self.progress.setVisible(False) 97 115 98 116 def fileRead(self, data): … … 133 151 return self._current_perspective 134 152 153 def updateProgressBar(self, value): 154 """ 155 Update progress bar with the required value (0-100) 156 """ 157 assert(-1 <= value <= 100) 158 if value == -1: 159 self.progress.setVisible(False) 160 return 161 if not self.progress.isVisible(): 162 self.progress.setTextVisible(True) 163 self.progress.setVisible(True) 164 165 self.progress.setValue(value) 166 135 167 def updateStatusBar(self, text): 136 168 """ 137 169 """ 138 self._workspace.statusbar.showMessage(text) 170 #self._workspace.statusbar.showMessage(text) 171 self.statusLabel.setText(text) 139 172 140 173 def createGuiData(self, item, p_file=None): … … 237 270 self.communicate.statusBarUpdateSignal.connect(self.updateStatusBar) 238 271 self.communicate.updatePerspectiveWithDataSignal.connect(self.updatePerspective) 272 self.communicate.progressBarUpdateSignal.connect(self.updateProgressBar) 239 273 240 274 def addTriggers(self): … … 284 318 # Window 285 319 self._workspace.actionCascade.triggered.connect(self.actionCascade) 286 self._workspace.actionTile_Horizontally.triggered.connect(self.actionTile_Horizontally) 287 self._workspace.actionTile_Vertically.triggered.connect(self.actionTile_Vertically) 320 self._workspace.actionTile.triggered.connect(self.actionTile) 288 321 self._workspace.actionArrange_Icons.triggered.connect(self.actionArrange_Icons) 289 322 self._workspace.actionNext.triggered.connect(self.actionNext) … … 402 435 def actionHide_Toolbar(self): 403 436 """ 404 """ 405 print("actionHide_Toolbar TRIGGERED") 437 Toggle toolbar vsibility 438 """ 439 if self._workspace.toolBar.isVisible(): 440 self._workspace.actionHide_Toolbar.setText("Show Toolbar") 441 self._workspace.toolBar.setVisible(False) 442 else: 443 self._workspace.actionHide_Toolbar.setText("Hide Toolbar") 444 self._workspace.toolBar.setVisible(True) 406 445 pass 407 446 … … 532 571 def actionCascade(self): 533 572 """ 534 """ 535 print("actionCascade TRIGGERED") 536 pass 537 538 def actionTile_Horizontally(self): 539 """ 540 """ 541 print("actionTile_Horizontally TRIGGERED") 542 pass 543 544 def actionTile_Vertically(self): 545 """ 546 """ 547 print("actionTile_Vertically TRIGGERED") 548 pass 573 Arranges all the child windows in a cascade pattern. 574 """ 575 self._workspace.workspace.cascade() 576 577 def actionTile(self): 578 """ 579 Tile workspace windows 580 """ 581 self._workspace.workspace.tile() 549 582 550 583 def actionArrange_Icons(self): 551 584 """ 552 """553 print("actionArrange_Icons TRIGGERED")554 pass585 Arranges all iconified windows at the bottom of the workspace 586 """ 587 self._workspace.workspace.arrangeIcons() 555 588 556 589 def actionNext(self): 557 590 """ 558 """559 print("actionNext TRIGGERED")560 pass591 Gives the input focus to the next window in the list of child windows. 592 """ 593 self._workspace.workspace.activateNextWindow() 561 594 562 595 def actionPrevious(self): 563 596 """ 564 """565 print("actionPrevious TRIGGERED")566 pass597 Gives the input focus to the previous window in the list of child windows. 598 """ 599 self._workspace.workspace.activatePreviousWindow() 567 600 568 601 #============ HELP ================= -
src/sas/qtgui/GuiUtils.py
r481ff26 re540cd2 80 80 fObj, path_config, descr = imp.find_module(confg_file, [path]) 81 81 config_module = imp.load_module(confg_file, fObj, path_config, descr) 82 except :82 except ImportError: 83 83 logging.error("Error loading %s/%s: %s" % (path, confg_file, sys.exc_value)) 84 84 finally: … … 104 104 logging.info("using default local_config") 105 105 else: 106 logging.info("found local_config in %s" %os.getcwd())106 logging.info("found local_config in %s", os.getcwd()) 107 107 else: 108 logging.info("found local_config in %s" %PATH_APP)108 logging.info("found local_config in %s", PATH_APP) 109 109 110 110 … … 118 118 logging.info(msgConfig) 119 119 else: 120 logging.info("using custom_config in %s" %os.getcwd())120 logging.info("using custom_config in %s", os.getcwd()) 121 121 else: 122 logging.info("using custom_config from %s" %c_conf_dir)122 logging.info("using custom_config from %s", c_conf_dir) 123 123 124 124 #read some constants from config … … 154 154 else: 155 155 DEFAULT_OPEN_FOLDER = PATH_APP 156 except :156 except AttributeError: 157 157 DATALOADER_SHOW = True 158 158 TOOLBAR_SHOW = True … … 181 181 try: 182 182 PLUGINS_WLIST = '|'.join(config.PLUGINS_WLIST) 183 except :183 except AttributeError: 184 184 PLUGINS_WLIST = '' 185 185 APPLICATION_WLIST = config.APPLICATION_WLIST … … 214 214 plotRequestedSignal = QtCore.pyqtSignal(str) 215 215 216 # Progress bar update value 217 progressBarUpdateSignal = QtCore.pyqtSignal(int) 218 216 219 217 220 def updateModelItem(item, update_data, name=""): … … 220 223 Adds QVariant 'update_data' to that row. 221 224 """ 222 assert type(item) == QtGui.QStandardItem223 assert type(update_data) == QtCore.QVariant225 assert isinstance(item, QtGui.QStandardItem) 226 assert isinstance(update_data, QtCore.QVariant) 224 227 225 228 checkbox_item = QtGui.QStandardItem(True) … … 230 233 # Add "Info" item 231 234 py_update_data = update_data.toPyObject() 232 if type(py_update_data) == (Data1D or Data2D):235 if isinstance(py_update_data, (Data1D or Data2D)): 233 236 # If Data1/2D added - extract Info from it 234 237 info_item = infoFromData(py_update_data) … … 254 257 Returns the list of plots for items in the model which are checked 255 258 """ 256 assert type(model_item) == QtGui.QStandardItemModel 257 258 checkbox_item = QtGui.QStandardItem(True) 259 assert isinstance(model_item, QtGui.QStandardItemModel) 260 259 261 plot_data = [] 260 261 262 # Iterate over model looking for items with checkboxes 262 263 for index in range(model_item.rowCount()): … … 279 280 and add them to a model item 280 281 """ 281 assert type(data) in [Data1D, Data2D]282 assert isinstance(data, (Data1D, Data2D)) 282 283 283 284 info_item = QtGui.QStandardItem("Info") -
src/sas/qtgui/LocalConfig.py
rf721030 re540cd2 4 4 import time 5 5 import os 6 import logging 7 6 8 from sas.sasgui.guiframe.gui_style import GUIFRAME 7 9 import sas.sasview 8 import logging9 10 10 11 # Version of the application … … 58 59 59 60 icon_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "images")) 60 logging.info("icon path: %s" %icon_path)61 logging.info("icon path: %s", icon_path) 61 62 media_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "media")) 62 63 test_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "test")) … … 133 134 134 135 def printEVT(message): 136 """ 137 Post a debug message to console/file 138 """ 135 139 if __EVT_DEBUG__: 136 """137 :TODO - Need method doc string138 """139 140 print "%g: %s" % (time.clock(), message) 140 141 -
src/sas/qtgui/MainWindow.py
r481ff26 re540cd2 1 1 import sys 2 2 3 from PyQt4 import QtCore4 3 from PyQt4 import QtGui 5 4 -
src/sas/qtgui/Perspectives/Invariant/InvariantPerspective.py
r1042dba re540cd2 43 43 super(InvariantWindow, self).__init__(parent) 44 44 self.setWindowTitle("Invariant Perspective") 45 45 46 # initial input params 46 47 self._background = 0.0 … … 95 96 self.setupMapper() 96 97 98 def closeEvent(self, event): 99 """ 100 Overwrite the default close method of QWidget 101 """ 102 # No close on perspectives - one must always be active. 103 event.ignore() 104 97 105 def communicator(self): 98 """ 99 """ 106 """ Getter for the communicator """ 100 107 return self.communicate 101 108 -
src/sas/qtgui/Perspectives/Invariant/UI/TabbedInvariantUI.py
r488c49d re540cd2 26 26 def setupUi(self, tabbedInvariantUI): 27 27 tabbedInvariantUI.setObjectName(_fromUtf8("tabbedInvariantUI")) 28 tabbedInvariantUI.resize(46 5, 408)28 tabbedInvariantUI.resize(466, 408) 29 29 self.gridLayout_11 = QtGui.QGridLayout(tabbedInvariantUI) 30 30 self.gridLayout_11.setObjectName(_fromUtf8("gridLayout_11")) … … 45 45 self.horizontalLayout_4.addWidget(self.label) 46 46 self.lineEdit = QtGui.QLineEdit(self.groupBox) 47 self.lineEdit.setEnabled(False) 47 self.lineEdit.setEnabled(True) 48 self.lineEdit.setFrame(False) 48 49 self.lineEdit.setReadOnly(False) 49 50 self.lineEdit.setObjectName(_fromUtf8("lineEdit")) … … 85 86 self.lineEdit_14 = QtGui.QLineEdit(self.groupBox_7) 86 87 self.lineEdit_14.setEnabled(True) 88 self.lineEdit_14.setAutoFillBackground(True) 89 self.lineEdit_14.setStyleSheet(_fromUtf8("")) 90 self.lineEdit_14.setFrame(True) 91 self.lineEdit_14.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) 87 92 self.lineEdit_14.setReadOnly(True) 88 93 self.lineEdit_14.setObjectName(_fromUtf8("lineEdit_14")) … … 93 98 self.lineEdit_15 = QtGui.QLineEdit(self.groupBox_7) 94 99 self.lineEdit_15.setEnabled(True) 100 self.lineEdit_15.setFrame(True) 101 self.lineEdit_15.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) 95 102 self.lineEdit_15.setReadOnly(True) 96 103 self.lineEdit_15.setObjectName(_fromUtf8("lineEdit_15")) … … 101 108 self.lineEdit_17 = QtGui.QLineEdit(self.groupBox_7) 102 109 self.lineEdit_17.setEnabled(True) 110 self.lineEdit_17.setFrame(True) 111 self.lineEdit_17.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) 103 112 self.lineEdit_17.setReadOnly(True) 104 113 self.lineEdit_17.setObjectName(_fromUtf8("lineEdit_17")) … … 109 118 self.lineEdit_16 = QtGui.QLineEdit(self.groupBox_7) 110 119 self.lineEdit_16.setEnabled(True) 120 self.lineEdit_16.setFrame(True) 121 self.lineEdit_16.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) 111 122 self.lineEdit_16.setReadOnly(True) 112 123 self.lineEdit_16.setObjectName(_fromUtf8("lineEdit_16")) … … 125 136 self.lineEdit_19 = QtGui.QLineEdit(self.groupBox_7) 126 137 self.lineEdit_19.setEnabled(True) 127 self.lineEdit_19.setStyleSheet(_fromUtf8("background-color: rgb(253, 253, 126);")) 138 self.lineEdit_19.setStyleSheet(_fromUtf8("background-color: rgb(253, 253, 126);\n" 139 "font: bold 8pt \"MS Shell Dlg 2\";")) 140 self.lineEdit_19.setFrame(True) 141 self.lineEdit_19.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) 128 142 self.lineEdit_19.setReadOnly(True) 129 143 self.lineEdit_19.setObjectName(_fromUtf8("lineEdit_19")) … … 134 148 self.lineEdit_18 = QtGui.QLineEdit(self.groupBox_7) 135 149 self.lineEdit_18.setEnabled(True) 136 self.lineEdit_18.setStyleSheet(_fromUtf8("background-color: rgb(253, 253, 126);")) 150 self.lineEdit_18.setStyleSheet(_fromUtf8("background-color: rgb(253, 253, 126);\n" 151 "font: bold 8pt \"MS Shell Dlg 2\";")) 152 self.lineEdit_18.setFrame(True) 153 self.lineEdit_18.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) 137 154 self.lineEdit_18.setReadOnly(True) 138 155 self.lineEdit_18.setObjectName(_fromUtf8("lineEdit_18")) -
src/sas/qtgui/Perspectives/Invariant/UI/TabbedInvariantUI.ui
r488c49d re540cd2 7 7 <x>0</x> 8 8 <y>0</y> 9 <width>46 5</width>9 <width>466</width> 10 10 <height>408</height> 11 11 </rect> … … 43 43 <widget class="QLineEdit" name="lineEdit"> 44 44 <property name="enabled"> 45 <bool>true</bool> 46 </property> 47 <property name="frame"> 45 48 <bool>false</bool> 46 49 </property> … … 122 125 <bool>true</bool> 123 126 </property> 127 <property name="autoFillBackground"> 128 <bool>true</bool> 129 </property> 130 <property name="styleSheet"> 131 <string notr="true"/> 132 </property> 133 <property name="frame"> 134 <bool>true</bool> 135 </property> 136 <property name="alignment"> 137 <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> 138 </property> 124 139 <property name="readOnly"> 125 140 <bool>true</bool> … … 139 154 <bool>true</bool> 140 155 </property> 156 <property name="frame"> 157 <bool>true</bool> 158 </property> 159 <property name="alignment"> 160 <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> 161 </property> 141 162 <property name="readOnly"> 142 163 <bool>true</bool> … … 156 177 <bool>true</bool> 157 178 </property> 179 <property name="frame"> 180 <bool>true</bool> 181 </property> 182 <property name="alignment"> 183 <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> 184 </property> 158 185 <property name="readOnly"> 159 186 <bool>true</bool> … … 172 199 <property name="enabled"> 173 200 <bool>true</bool> 201 </property> 202 <property name="frame"> 203 <bool>true</bool> 204 </property> 205 <property name="alignment"> 206 <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> 174 207 </property> 175 208 <property name="readOnly"> … … 206 239 </property> 207 240 <property name="styleSheet"> 208 <string notr="true">background-color: rgb(253, 253, 126);</string> 241 <string notr="true">background-color: rgb(253, 253, 126); 242 font: bold 8pt "MS Shell Dlg 2";</string> 243 </property> 244 <property name="frame"> 245 <bool>true</bool> 246 </property> 247 <property name="alignment"> 248 <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> 209 249 </property> 210 250 <property name="readOnly"> … … 226 266 </property> 227 267 <property name="styleSheet"> 228 <string notr="true">background-color: rgb(253, 253, 126);</string> 268 <string notr="true">background-color: rgb(253, 253, 126); 269 font: bold 8pt "MS Shell Dlg 2";</string> 270 </property> 271 <property name="frame"> 272 <bool>true</bool> 273 </property> 274 <property name="alignment"> 275 <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> 229 276 </property> 230 277 <property name="readOnly"> … … 578 625 </layout> 579 626 </widget> 627 <resources/> 580 628 <connections/> 581 629 </ui> -
src/sas/qtgui/UI/DataExplorerUI.py
r481ff26 re540cd2 69 69 self.gridLayout.addLayout(self.horizontalLayout_2, 0, 0, 1, 1) 70 70 self.treeView = QtGui.QTreeView(self.groupBox) 71 self.treeView.setContextMenuPolicy(QtCore.Qt.NoContextMenu) 71 72 self.treeView.setAcceptDrops(True) 72 73 self.treeView.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers) … … 191 192 self.gridLayout_8.addLayout(self.gridLayout_5, 1, 0, 1, 1) 192 193 DataLoadWidget.addTab(self.theoryTab, _fromUtf8("")) 194 self.actionDataInfo = QtGui.QAction(DataLoadWidget) 195 self.actionDataInfo.setObjectName(_fromUtf8("actionDataInfo")) 196 self.actionSaveAs = QtGui.QAction(DataLoadWidget) 197 self.actionSaveAs.setObjectName(_fromUtf8("actionSaveAs")) 198 self.actionQuickPlot = QtGui.QAction(DataLoadWidget) 199 self.actionQuickPlot.setObjectName(_fromUtf8("actionQuickPlot")) 200 self.actionQuick3DPlot = QtGui.QAction(DataLoadWidget) 201 self.actionQuick3DPlot.setObjectName(_fromUtf8("actionQuick3DPlot")) 202 self.actionEditMask = QtGui.QAction(DataLoadWidget) 203 self.actionEditMask.setObjectName(_fromUtf8("actionEditMask")) 193 204 194 205 self.retranslateUi(DataLoadWidget) … … 227 238 self.cmdHelp_2.setText(_translate("DataLoadWidget", "Help", None)) 228 239 DataLoadWidget.setTabText(DataLoadWidget.indexOf(self.theoryTab), _translate("DataLoadWidget", "Theory", None)) 240 self.actionDataInfo.setText(_translate("DataLoadWidget", "Data Info", None)) 241 self.actionSaveAs.setText(_translate("DataLoadWidget", "Save As", None)) 242 self.actionQuickPlot.setText(_translate("DataLoadWidget", "Quick Plot", None)) 243 self.actionQuick3DPlot.setText(_translate("DataLoadWidget", "Quick 3DPlot (slow)", None)) 244 self.actionEditMask.setText(_translate("DataLoadWidget", "Edit Mask", None)) 229 245 230 246 import main_resources_rc -
src/sas/qtgui/UI/DataExplorerUI.ui
r481ff26 re540cd2 111 111 <item row="1" column="0"> 112 112 <widget class="QTreeView" name="treeView"> 113 <property name="contextMenuPolicy"> 114 <enum>Qt::NoContextMenu</enum> 115 </property> 113 116 <property name="acceptDrops"> 114 117 <bool>true</bool> … … 395 398 </layout> 396 399 </widget> 400 <action name="actionDataInfo"> 401 <property name="text"> 402 <string>Data Info</string> 403 </property> 404 </action> 405 <action name="actionSaveAs"> 406 <property name="text"> 407 <string>Save As</string> 408 </property> 409 </action> 410 <action name="actionQuickPlot"> 411 <property name="text"> 412 <string>Quick Plot</string> 413 </property> 414 </action> 415 <action name="actionQuick3DPlot"> 416 <property name="text"> 417 <string>Quick 3DPlot (slow)</string> 418 </property> 419 </action> 420 <action name="actionEditMask"> 421 <property name="text"> 422 <string>Edit Mask</string> 423 </property> 424 </action> 397 425 </widget> 398 426 <resources> -
src/sas/qtgui/UI/MainWindowUI.py
rf721030 re540cd2 26 26 def setupUi(self, MainWindow): 27 27 MainWindow.setObjectName(_fromUtf8("MainWindow")) 28 MainWindow.resize(915, 5 55)28 MainWindow.resize(915, 527) 29 29 icon = QtGui.QIcon() 30 30 icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/res/ball.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off) … … 157 157 self.actionCascade = QtGui.QAction(MainWindow) 158 158 self.actionCascade.setObjectName(_fromUtf8("actionCascade")) 159 self.actionTile _Horizontally= QtGui.QAction(MainWindow)160 self.actionTile _Horizontally.setObjectName(_fromUtf8("actionTile_Horizontally"))159 self.actionTile = QtGui.QAction(MainWindow) 160 self.actionTile.setObjectName(_fromUtf8("actionTile")) 161 161 self.actionTile_Vertically = QtGui.QAction(MainWindow) 162 162 self.actionTile_Vertically.setObjectName(_fromUtf8("actionTile_Vertically")) … … 240 240 self.menuFitting.addAction(self.actionEdit_Custom_Model) 241 241 self.menuWindow.addAction(self.actionCascade) 242 self.menuWindow.addAction(self.actionTile_Horizontally) 243 self.menuWindow.addAction(self.actionTile_Vertically) 242 self.menuWindow.addAction(self.actionTile) 244 243 self.menuWindow.addSeparator() 245 244 self.menuWindow.addAction(self.actionArrange_Icons) … … 331 330 self.actionEdit_Custom_Model.setText(_translate("MainWindow", "Edit Custom Model", None)) 332 331 self.actionCascade.setText(_translate("MainWindow", "Cascade", None)) 333 self.actionTile _Horizontally.setText(_translate("MainWindow", "Tile Horizontally", None))332 self.actionTile.setText(_translate("MainWindow", "Tile", None)) 334 333 self.actionTile_Vertically.setText(_translate("MainWindow", "Tile Vertically", None)) 335 334 self.actionArrange_Icons.setText(_translate("MainWindow", "Arrange Icons", None)) -
src/sas/qtgui/UI/MainWindowUI.ui
rf721030 re540cd2 8 8 <y>0</y> 9 9 <width>915</width> 10 <height>5 55</height>10 <height>527</height> 11 11 </rect> 12 12 </property> … … 112 112 </property> 113 113 <addaction name="actionCascade"/> 114 <addaction name="actionTile_Horizontally"/> 115 <addaction name="actionTile_Vertically"/> 114 <addaction name="actionTile"/> 116 115 <addaction name="separator"/> 117 116 <addaction name="actionArrange_Icons"/> … … 399 398 </property> 400 399 </action> 401 <action name="actionTile _Horizontally">402 <property name="text"> 403 <string>Tile Horizontally</string>400 <action name="actionTile"> 401 <property name="text"> 402 <string>Tile</string> 404 403 </property> 405 404 </action> -
src/sas/qtgui/UnitTesting/AboutBoxTest.py
rf82ab8c re540cd2 76 76 LocalConfig._ill_url, 77 77 LocalConfig._inst_url] 78 78 79 79 # Press the buttons 80 80 buttonList = self.widget.findChildren(QPushButton) -
src/sas/qtgui/UnitTesting/DataExplorerTest.py
r481ff26 re540cd2 92 92 self.assertIsInstance(self.form.freezeView, QTreeView) 93 93 94 94 def testWidgets(self): 95 """ 96 Test if all required widgets got added 97 """ 95 98 def testLoadButton(self): 96 99 loadButton = self.form.cmdLoad … … 111 114 112 115 # Make sure the signal has not been emitted 113 #self.assertEqual(spy_file_read.count(), 0)116 self.assertEqual(spy_file_read.count(), 0) 114 117 115 118 # Now, return a single file 116 119 QtGui.QFileDialog.getOpenFileNames = MagicMock(return_value=filename) 117 120 118 121 # Click on the Load button 119 122 QTest.mouseClick(loadButton, Qt.LeftButton) 123 QtGui.qApp.processEvents() 120 124 121 125 # Test the getOpenFileName() dialog called once … … 127 131 #self.assertIn(filename, str(spy_file_read.called()[0]['args'][0])) 128 132 133 def testLoadFiles(self): 134 """ 135 Test progress bar update while loading of multiple files 136 """ 137 # Set up the spy on progress bar update signal 138 spy_progress_bar_update = QtSignalSpy(self.form, 139 self.form.communicator.progressBarUpdateSignal) 140 141 # Populate the model 142 filename = ["cyl_400_20.txt", "Dec07031.ASC", "cyl_400_20.txt"] 143 self.form.readData(filename) 144 145 # 0, 0, 33, 66, -1 -> 5 signals reaching progressBar 146 self.assertEqual(spy_progress_bar_update.count(), 5) 147 148 expected_list = [0, 0, 33, 66, -1] 149 spied_list = [spy_progress_bar_update.called()[i]['args'][0] for i in xrange(5)] 150 self.assertEqual(expected_list, spied_list) 151 129 152 def testDeleteButton(self): 130 153 """ … … 441 464 default_list = defaults.split(';;') 442 465 443 for format in default_list:444 self.assertIn( format, w_list)466 for def_format in default_list: 467 self.assertIn(def_format, w_list) 445 468 446 469 def testLoadComplete(self): -
src/sas/qtgui/UnitTesting/DroppableDataLoadWidgetTest.py
r481ff26 re540cd2 4 4 from PyQt4.QtGui import QApplication 5 5 from PyQt4.QtTest import QTest 6 from PyQt4 .QtCore import Qt6 from PyQt4 import QtCore 7 7 from DroppableDataLoadWidget import DroppableDataLoadWidget 8 8 from GuiUtils import * 9 from UnitTesting.TestUtils import QtSignalSpy 9 10 10 11 app = QApplication(sys.argv) … … 21 22 22 23 self.form = DroppableDataLoadWidget(None, guimanager=dummy_manager()) 23 # create dummy mime objects 24 25 # create dummy mime object 26 self.mime_data = QtCore.QMimeData() 27 self.testfile = 'testfile.txt' 28 self.mime_data.setUrls([QtCore.QUrl(self.testfile)]) 24 29 25 30 def testDragIsOK(self): … … 27 32 Test the item being dragged over the load widget 28 33 """ 29 pass 34 good_drag_event = QtGui.QDragMoveEvent(QtCore.QPoint(0,0), 35 QtCore.Qt.CopyAction, 36 self.mime_data, 37 QtCore.Qt.LeftButton, 38 QtCore.Qt.NoModifier) 39 mime_data = QtCore.QMimeData() 40 bad_drag_event = QtGui.QDragMoveEvent(QtCore.QPoint(0,0), 41 QtCore.Qt.CopyAction, 42 mime_data, 43 QtCore.Qt.LeftButton, 44 QtCore.Qt.NoModifier) 45 46 # Call the drag handler with good event 47 self.assertTrue(self.form.dragIsOK(good_drag_event)) 48 49 # Call the drag handler with bad event 50 self.assertFalse(self.form.dragIsOK(bad_drag_event)) 30 51 31 52 def testDropEvent(self): … … 33 54 Test what happens if an object is dropped onto the load widget 34 55 """ 35 pass 56 spy_file_read = QtSignalSpy(self.form, self.form.communicator.fileReadSignal) 57 58 drop_event = QtGui.QDropEvent(QtCore.QPoint(0,0), 59 QtCore.Qt.CopyAction, 60 self.mime_data, 61 QtCore.Qt.LeftButton, 62 QtCore.Qt.NoModifier) 63 64 self.form.dropEvent(drop_event) 65 QtGui.qApp.processEvents() 66 self.assertEqual(spy_file_read.count(), 1) 67 self.assertIn(self.testfile, str(spy_file_read.signal(index=0))) 68 36 69 37 70 if __name__ == "__main__": -
src/sas/qtgui/UnitTesting/GuiManagerTest.py
r481ff26 re540cd2 12 12 13 13 # Local 14 from DataExplorer import DataExplorerWindow 15 from UI.AcknowledgementsUI import Acknowledgements 16 from AboutBox import AboutBox 17 from WelcomePanel import WelcomePanel 18 14 19 from GuiManager import GuiManager 15 20 from UI.MainWindowUI import MainWindow … … 38 43 39 44 def testDefaults(self): 40 '''Test the object in its default state''' 41 pass 42 45 """ 46 Test the object in its default state 47 """ 48 self.assertIsInstance(self.manager.filesWidget, DataExplorerWindow) 49 self.assertIsInstance(self.manager.dockedFilesWidget, QDockWidget) 50 self.assertEqual(self.manager.dockedFilesWidget.features(), QDockWidget.NoDockWidgetFeatures) 51 self.assertEqual(self.manager._workspace.dockWidgetArea(self.manager.dockedFilesWidget), Qt.LeftDockWidgetArea) 52 self.assertIsInstance(self.manager.ackWidget, Acknowledgements) 53 self.assertIsInstance(self.manager.aboutWidget, AboutBox) 54 self.assertIsInstance(self.manager.welcomePanel, WelcomePanel) 55 43 56 def testUpdatePerspective(self): 44 57 """ … … 76 89 # See that the MessageBox method got called 77 90 self.assertTrue(QMessageBox.question.called) 78 # sys.exit() not called this time79 self.assertFalse(sys.exit.called)80 91 81 92 # Say Yes to the close dialog … … 139 150 webbrowser.open.assert_called_with("https://github.com/SasView/sasview/releases") 140 151 141 ## 4. version > LocalConfig.__version__ and standalone 142 #version_info = {u'version' : u'999.0.0'} 143 #spy_status_update = QtSignalSpy(self.manager, self.manager.communicate.statusBarUpdateSignal) 144 #webbrowser.open = MagicMock() 145 146 #self.manager.processVersion(version_info, standalone=True) 147 148 #self.assertEqual(spy_status_update.count(), 1) 149 #message = 'See the help menu to download it' 150 #self.assertIn(message, str(spy_status_update.signal(index=0))) 151 152 #self.assertFalse(webbrowser.open.called) 153 154 # 5. couldn't load version 152 # 4. couldn't load version 155 153 version_info = {} 156 154 logging.error = MagicMock() … … 173 171 pass 174 172 173 #### FILE #### 175 174 def testActionLoadData(self): 176 175 """ … … 185 184 # Test the getOpenFileName() dialog called once 186 185 self.assertTrue(QFileDialog.getOpenFileNames.called) 187 186 187 def testActionLoadDataFolder(self): 188 """ 189 Menu File/Load Data Folder 190 """ 191 # Mock the system file open method 192 QFileDialog.getExistingDirectory = MagicMock(return_value=None) 193 194 # invoke the action 195 self.manager.actionLoad_Data_Folder() 196 197 # Test the getOpenFileName() dialog called once 198 self.assertTrue(QFileDialog.getExistingDirectory.called) 199 200 #### VIEW #### 201 def testActionHideToolbar(self): 202 """ 203 Menu View/Hide Toolbar 204 """ 205 # Need to display the main window to initialize the toolbar. 206 self.manager._workspace.show() 207 208 # Check the initial state 209 self.assertTrue(self.manager._workspace.toolBar.isVisible()) 210 self.assertEqual('Hide Toolbar', self.manager._workspace.actionHide_Toolbar.text()) 211 212 # Invoke action 213 self.manager.actionHide_Toolbar() 214 215 # Assure changes propagated correctly 216 self.assertFalse(self.manager._workspace.toolBar.isVisible()) 217 self.assertEqual('Show Toolbar', self.manager._workspace.actionHide_Toolbar.text()) 218 219 # Revert 220 self.manager.actionHide_Toolbar() 221 222 # Assure the original values are back 223 self.assertTrue(self.manager._workspace.toolBar.isVisible()) 224 self.assertEqual('Hide Toolbar', self.manager._workspace.actionHide_Toolbar.text()) 225 226 227 #### HELP #### 188 228 def testActionDocumentation(self): 189 229 """ -
src/sas/qtgui/UnitTesting/GuiUtilsTest.py
rf82ab8c re540cd2 2 2 import unittest 3 3 import webbrowser 4 import urlparse5 4 6 5 from PyQt4 import QtCore … … 59 58 'updatePerspectiveWithDataSignal', 60 59 'updateModelFromPerspectiveSignal', 61 'plotRequestedSignal' 60 'plotRequestedSignal', 61 'progressBarUpdateSignal', 62 62 ] 63 63 … … 188 188 with self.assertRaises(AttributeError): 189 189 openLink(bad_url3) 190 pass191 190 192 191 if __name__ == "__main__": -
src/sas/qtgui/WelcomePanel.py
rf82ab8c re540cd2 20 20 21 21 ver = "\nSasView %s\nBuild: %s" % (version, build) 22 #ver += "\n(c) 2009 - 2013, UTK, UMD, NIST, ORNL, ISIS, ESS and IL"23 22 ver += LocalConfig._copyright 24 23
Note: See TracChangeset
for help on using the changeset viewer.