Changeset e540cd2 in sasview


Ignore:
Timestamp:
Jul 7, 2016 2:54:18 AM (8 years ago)
Author:
Piotr Rozyczko <piotr.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:
0cd8612
Parents:
f0f309d
Message:

Status bar, progress bar, initial treeview context menu + minor cleanup

Location:
src/sas/qtgui
Files:
19 edited

Legend:

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

    r481ff26 re540cd2  
    22import sys 
    33import os 
     4import time 
    45import logging 
    56 
     
    1617from sas.sascalc.dataloader.loader import Loader 
    1718from sas.sasgui.guiframe.data_manager import DataManager 
     19from sas.sasgui.guiframe.dataFitting import Data1D 
     20from sas.sasgui.guiframe.dataFitting import Data2D 
    1821 
    1922from DroppableDataLoadWidget import DroppableDataLoadWidget 
     
    5760        self._helpView = QtWebKit.QWebView() 
    5861 
     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 
    5971        # Connect the comboboxes 
    6072        self.cbSelect.currentIndexChanged.connect(self.selectData) 
     
    6274        #self.closeEvent.connect(self.closeEvent) 
    6375        # self.aboutToQuit.connect(self.closeEvent) 
    64  
     76        self.communicator = self.parent.communicator() 
    6577        self.communicator.fileReadSignal.connect(self.loadFromURL) 
    6678 
     
    133145        # get content of dir into a list 
    134146        path_str = [os.path.join(os.path.abspath(folder), filename) 
    135                         for filename in os.listdir(folder)] 
     147                    for filename in os.listdir(folder)] 
    136148 
    137149        self.loadFromURL(path_str) 
     
    144156        delete_msg = "This operation will delete the checked data sets and all the dependents." +\ 
    145157                     "\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) 
    148163 
    149164        if reply == QtGui.QMessageBox.No: 
     
    201216 
    202217        # Set the signal handlers 
    203         self.communicator = self._perspective.communicator() 
    204218        self.communicator.updateModelFromPerspectiveSignal.connect(self.updateModelFromPerspective) 
    205219 
     
    254268                    theories_copied += 1 
    255269                    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) 
    256274                    self.theory_model.appendRow(new_item) 
    257275            self.theory_model.reset() 
     
    261279            return 
    262280        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" 
    264282        elif theories_copied > 1: 
    265             freeze_msg = "%i theories sent to Theory tab" % theories_copied 
     283            freeze_msg = "%i theories copied to the Theory tab as data sets" % theories_copied 
    266284        else: 
    267285            freeze_msg = "Unexpected number of theories copied: %i" % theories_copied 
     
    313331            return 
    314332 
    315         #if type(paths) == QtCore.QStringList: 
    316333        if isinstance(paths, QtCore.QStringList): 
    317334            paths = [str(f) for f in paths] 
    318335 
    319         if paths.__class__.__name__ != "list": 
     336        if type(paths) is not list: 
    320337            paths = [paths] 
    321338 
     
    335352        error_message = "" 
    336353 
    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): 
    338358            basename = os.path.basename(p_file) 
    339359            _, extension = os.path.splitext(basename) 
     
    406426                info = "error" 
    407427 
     428            current_percentage = int(100.0* index/number_of_files) 
     429            self.communicator.progressBarUpdateSignal.emit(current_percentage) 
     430 
    408431        if any_error or error_message: 
    409432            self.communicator.statusBarUpdateSignal.emit(error_message) 
     
    412435            message = "Loading Data Complete! " 
    413436        message += log_msg 
     437        self.communicator.progressBarUpdateSignal.emit(-1) 
    414438 
    415439        return output, message 
     
    461485 
    462486                try: 
    463                     is1D = item.child(0).data().toPyObject().__class__.__name__ == 'Data1D' 
     487                    is1D = type(item.child(0).data().toPyObject()) is Data1D 
    464488                except AttributeError: 
    465489                    msg = "Bad structure of the data model." 
     
    475499 
    476500                try: 
    477                     is1D = item.child(0).data().toPyObject().__class__.__name__ == 'Data1D' 
     501                    is1D = type(item.child(0).data().toPyObject()) is Data1D 
    478502                except AttributeError: 
    479503                    msg = "Bad structure of the data model." 
     
    489513                item.setCheckState(QtCore.Qt.Unchecked) 
    490514                try: 
    491                     is2D = item.child(0).data().toPyObject().__class__.__name__ == 'Data2D' 
     515                    is2D = type(item.child(0).data().toPyObject()) is Data2D 
    492516                except AttributeError: 
    493517                    msg = "Bad structure of the data model." 
     
    503527 
    504528                try: 
    505                     is2D = item.child(0).data().toPyObject().__class__.__name__ == 'Data2D' 
     529                    is2D = type(item.child(0).data().toPyObject()) is Data2D 
    506530                except AttributeError: 
    507531                    msg = "Bad structure of the data model." 
     
    516540            raise Exception, msg 
    517541 
     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 
    518557 
    519558    def loadComplete(self, output): 
     
    521560        Post message to status bar and update the data manager 
    522561        """ 
     562        assert type(output) == tuple 
     563 
    523564        # Reset the model so the view gets updated. 
    524565        self.model.reset() 
    525         assert type(output) == tuple 
     566        self.communicator.progressBarUpdateSignal.emit(-1) 
    526567 
    527568        output_data = output[0] 
  • src/sas/qtgui/DroppableDataLoadWidget.py

    r481ff26 re540cd2  
    1616        self.setAcceptDrops(True) 
    1717        self.communicator = guimanager.communicator() 
     18        flags = QtCore.Qt.CustomizeWindowHint | QtCore.Qt.WindowTitleHint | QtCore.Qt.WindowSystemMenuHint 
     19        self.setWindowFlags(flags) 
    1820 
    1921    def dragIsOK(self, event): 
     
    2224        """ 
    2325        # 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) 
    2827 
    2928    def dragEnterEvent(self, event): 
     
    6160            event.ignore() 
    6261 
     62    def closeEvent(self, event): 
     63        """ 
     64        Overwrite the close event - no close! 
     65        """ 
     66        event.ignore() 
  • src/sas/qtgui/GuiManager.py

    r481ff26 re540cd2  
    6060        # Add FileDialog widget as docked 
    6161        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) 
    6764        self.dockedFilesWidget.setWidget(self.filesWidget) 
     65        self.dockedFilesWidget.setFeatures(QtGui.QDockWidget.NoDockWidgetFeatures) 
    6866        self._workspace.addDockWidget(QtCore.Qt.DockWidgetArea(1), self.dockedFilesWidget) 
    6967 
     
    7169        self.aboutWidget = AboutBox() 
    7270 
    73         # Disable the close button (?) 
     71        # Set up the status bar 
     72        self.statusBarSetup() 
    7473 
    7574        # Show the Welcome panel 
     
    9594        # Default perspective 
    9695        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) 
    97115 
    98116    def fileRead(self, data): 
     
    133151        return self._current_perspective 
    134152 
     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 
    135167    def updateStatusBar(self, text): 
    136168        """ 
    137169        """ 
    138         self._workspace.statusbar.showMessage(text) 
     170        #self._workspace.statusbar.showMessage(text) 
     171        self.statusLabel.setText(text) 
    139172 
    140173    def createGuiData(self, item, p_file=None): 
     
    237270        self.communicate.statusBarUpdateSignal.connect(self.updateStatusBar) 
    238271        self.communicate.updatePerspectiveWithDataSignal.connect(self.updatePerspective) 
     272        self.communicate.progressBarUpdateSignal.connect(self.updateProgressBar) 
    239273 
    240274    def addTriggers(self): 
     
    284318        # Window 
    285319        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) 
    288321        self._workspace.actionArrange_Icons.triggered.connect(self.actionArrange_Icons) 
    289322        self._workspace.actionNext.triggered.connect(self.actionNext) 
     
    402435    def actionHide_Toolbar(self): 
    403436        """ 
    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) 
    406445        pass 
    407446 
     
    532571    def actionCascade(self): 
    533572        """ 
    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() 
    549582 
    550583    def actionArrange_Icons(self): 
    551584        """ 
    552         """ 
    553         print("actionArrange_Icons TRIGGERED") 
    554         pass 
     585        Arranges all iconified windows at the bottom of the workspace 
     586        """ 
     587        self._workspace.workspace.arrangeIcons() 
    555588 
    556589    def actionNext(self): 
    557590        """ 
    558         """ 
    559         print("actionNext TRIGGERED") 
    560         pass 
     591        Gives the input focus to the next window in the list of child windows. 
     592        """ 
     593        self._workspace.workspace.activateNextWindow() 
    561594 
    562595    def actionPrevious(self): 
    563596        """ 
    564         """ 
    565         print("actionPrevious TRIGGERED") 
    566         pass 
     597        Gives the input focus to the previous window in the list of child windows. 
     598        """ 
     599        self._workspace.workspace.activatePreviousWindow() 
    567600 
    568601    #============ HELP ================= 
  • src/sas/qtgui/GuiUtils.py

    r481ff26 re540cd2  
    8080        fObj, path_config, descr = imp.find_module(confg_file, [path]) 
    8181        config_module = imp.load_module(confg_file, fObj, path_config, descr) 
    82     except: 
     82    except ImportError: 
    8383        logging.error("Error loading %s/%s: %s" % (path, confg_file, sys.exc_value)) 
    8484    finally: 
     
    104104        logging.info("using default local_config") 
    105105    else: 
    106         logging.info("found local_config in %s" % os.getcwd()) 
     106        logging.info("found local_config in %s", os.getcwd()) 
    107107else: 
    108     logging.info("found local_config in %s" % PATH_APP) 
     108    logging.info("found local_config in %s", PATH_APP) 
    109109 
    110110 
     
    118118        logging.info(msgConfig) 
    119119    else: 
    120         logging.info("using custom_config in %s" % os.getcwd()) 
     120        logging.info("using custom_config in %s", os.getcwd()) 
    121121else: 
    122     logging.info("using custom_config from %s" % c_conf_dir) 
     122    logging.info("using custom_config from %s", c_conf_dir) 
    123123 
    124124#read some constants from config 
     
    154154    else: 
    155155        DEFAULT_OPEN_FOLDER = PATH_APP 
    156 except: 
     156except AttributeError: 
    157157    DATALOADER_SHOW = True 
    158158    TOOLBAR_SHOW = True 
     
    181181try: 
    182182    PLUGINS_WLIST = '|'.join(config.PLUGINS_WLIST) 
    183 except: 
     183except AttributeError: 
    184184    PLUGINS_WLIST = '' 
    185185APPLICATION_WLIST = config.APPLICATION_WLIST 
     
    214214    plotRequestedSignal = QtCore.pyqtSignal(str) 
    215215 
     216    # Progress bar update value 
     217    progressBarUpdateSignal = QtCore.pyqtSignal(int) 
     218 
    216219 
    217220def updateModelItem(item, update_data, name=""): 
     
    220223    Adds QVariant 'update_data' to that row. 
    221224    """ 
    222     assert type(item) == QtGui.QStandardItem 
    223     assert type(update_data) == QtCore.QVariant 
     225    assert isinstance(item, QtGui.QStandardItem) 
     226    assert isinstance(update_data, QtCore.QVariant) 
    224227 
    225228    checkbox_item = QtGui.QStandardItem(True) 
     
    230233    # Add "Info" item 
    231234    py_update_data = update_data.toPyObject() 
    232     if type(py_update_data) == (Data1D or Data2D): 
     235    if isinstance(py_update_data, (Data1D or Data2D)): 
    233236        # If Data1/2D added - extract Info from it 
    234237        info_item = infoFromData(py_update_data) 
     
    254257    Returns the list of plots for items in the model which are checked 
    255258    """ 
    256     assert type(model_item) == QtGui.QStandardItemModel 
    257  
    258     checkbox_item = QtGui.QStandardItem(True) 
     259    assert isinstance(model_item, QtGui.QStandardItemModel) 
     260 
    259261    plot_data = [] 
    260  
    261262    # Iterate over model looking for items with checkboxes 
    262263    for index in range(model_item.rowCount()): 
     
    279280    and add them to a model item 
    280281    """ 
    281     assert type(data) in [Data1D, Data2D] 
     282    assert isinstance(data, (Data1D, Data2D)) 
    282283 
    283284    info_item = QtGui.QStandardItem("Info") 
  • src/sas/qtgui/LocalConfig.py

    rf721030 re540cd2  
    44import time 
    55import os 
     6import logging 
     7 
    68from sas.sasgui.guiframe.gui_style import GUIFRAME 
    79import sas.sasview 
    8 import logging 
    910 
    1011# Version of the application 
     
    5859 
    5960icon_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "images")) 
    60 logging.info("icon path: %s" % icon_path) 
     61logging.info("icon path: %s", icon_path) 
    6162media_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "media")) 
    6263test_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "test")) 
     
    133134 
    134135def printEVT(message): 
     136    """ 
     137    Post a debug message to console/file 
     138    """ 
    135139    if __EVT_DEBUG__: 
    136         """ 
    137         :TODO - Need method doc string 
    138         """ 
    139140        print "%g:  %s" % (time.clock(), message) 
    140141 
  • src/sas/qtgui/MainWindow.py

    r481ff26 re540cd2  
    11import sys 
    22 
    3 from PyQt4 import QtCore 
    43from PyQt4 import QtGui 
    54 
  • src/sas/qtgui/Perspectives/Invariant/InvariantPerspective.py

    r1042dba re540cd2  
    4343        super(InvariantWindow, self).__init__(parent) 
    4444        self.setWindowTitle("Invariant Perspective") 
     45 
    4546        # initial input params 
    4647        self._background = 0.0 
     
    9596        self.setupMapper() 
    9697 
     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 
    97105    def communicator(self): 
    98         """ 
    99         """ 
     106        """ Getter for the communicator """ 
    100107        return self.communicate 
    101108 
  • src/sas/qtgui/Perspectives/Invariant/UI/TabbedInvariantUI.py

    r488c49d re540cd2  
    2626    def setupUi(self, tabbedInvariantUI): 
    2727        tabbedInvariantUI.setObjectName(_fromUtf8("tabbedInvariantUI")) 
    28         tabbedInvariantUI.resize(465, 408) 
     28        tabbedInvariantUI.resize(466, 408) 
    2929        self.gridLayout_11 = QtGui.QGridLayout(tabbedInvariantUI) 
    3030        self.gridLayout_11.setObjectName(_fromUtf8("gridLayout_11")) 
     
    4545        self.horizontalLayout_4.addWidget(self.label) 
    4646        self.lineEdit = QtGui.QLineEdit(self.groupBox) 
    47         self.lineEdit.setEnabled(False) 
     47        self.lineEdit.setEnabled(True) 
     48        self.lineEdit.setFrame(False) 
    4849        self.lineEdit.setReadOnly(False) 
    4950        self.lineEdit.setObjectName(_fromUtf8("lineEdit")) 
     
    8586        self.lineEdit_14 = QtGui.QLineEdit(self.groupBox_7) 
    8687        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) 
    8792        self.lineEdit_14.setReadOnly(True) 
    8893        self.lineEdit_14.setObjectName(_fromUtf8("lineEdit_14")) 
     
    9398        self.lineEdit_15 = QtGui.QLineEdit(self.groupBox_7) 
    9499        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) 
    95102        self.lineEdit_15.setReadOnly(True) 
    96103        self.lineEdit_15.setObjectName(_fromUtf8("lineEdit_15")) 
     
    101108        self.lineEdit_17 = QtGui.QLineEdit(self.groupBox_7) 
    102109        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) 
    103112        self.lineEdit_17.setReadOnly(True) 
    104113        self.lineEdit_17.setObjectName(_fromUtf8("lineEdit_17")) 
     
    109118        self.lineEdit_16 = QtGui.QLineEdit(self.groupBox_7) 
    110119        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) 
    111122        self.lineEdit_16.setReadOnly(True) 
    112123        self.lineEdit_16.setObjectName(_fromUtf8("lineEdit_16")) 
     
    125136        self.lineEdit_19 = QtGui.QLineEdit(self.groupBox_7) 
    126137        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) 
    128142        self.lineEdit_19.setReadOnly(True) 
    129143        self.lineEdit_19.setObjectName(_fromUtf8("lineEdit_19")) 
     
    134148        self.lineEdit_18 = QtGui.QLineEdit(self.groupBox_7) 
    135149        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) 
    137154        self.lineEdit_18.setReadOnly(True) 
    138155        self.lineEdit_18.setObjectName(_fromUtf8("lineEdit_18")) 
  • src/sas/qtgui/Perspectives/Invariant/UI/TabbedInvariantUI.ui

    r488c49d re540cd2  
    77    <x>0</x> 
    88    <y>0</y> 
    9     <width>465</width> 
     9    <width>466</width> 
    1010    <height>408</height> 
    1111   </rect> 
     
    4343             <widget class="QLineEdit" name="lineEdit"> 
    4444              <property name="enabled"> 
     45               <bool>true</bool> 
     46              </property> 
     47              <property name="frame"> 
    4548               <bool>false</bool> 
    4649              </property> 
     
    122125             <bool>true</bool> 
    123126            </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> 
    124139            <property name="readOnly"> 
    125140             <bool>true</bool> 
     
    139154             <bool>true</bool> 
    140155            </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> 
    141162            <property name="readOnly"> 
    142163             <bool>true</bool> 
     
    156177             <bool>true</bool> 
    157178            </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> 
    158185            <property name="readOnly"> 
    159186             <bool>true</bool> 
     
    172199            <property name="enabled"> 
    173200             <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> 
    174207            </property> 
    175208            <property name="readOnly"> 
     
    206239            </property> 
    207240            <property name="styleSheet"> 
    208              <string notr="true">background-color: rgb(253, 253, 126);</string> 
     241             <string notr="true">background-color: rgb(253, 253, 126); 
     242font: bold 8pt &quot;MS Shell Dlg 2&quot;;</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> 
    209249            </property> 
    210250            <property name="readOnly"> 
     
    226266            </property> 
    227267            <property name="styleSheet"> 
    228              <string notr="true">background-color: rgb(253, 253, 126);</string> 
     268             <string notr="true">background-color: rgb(253, 253, 126); 
     269font: bold 8pt &quot;MS Shell Dlg 2&quot;;</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> 
    229276            </property> 
    230277            <property name="readOnly"> 
     
    578625  </layout> 
    579626 </widget> 
     627 <resources/> 
    580628 <connections/> 
    581629</ui> 
  • src/sas/qtgui/UI/DataExplorerUI.py

    r481ff26 re540cd2  
    6969        self.gridLayout.addLayout(self.horizontalLayout_2, 0, 0, 1, 1) 
    7070        self.treeView = QtGui.QTreeView(self.groupBox) 
     71        self.treeView.setContextMenuPolicy(QtCore.Qt.NoContextMenu) 
    7172        self.treeView.setAcceptDrops(True) 
    7273        self.treeView.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers) 
     
    191192        self.gridLayout_8.addLayout(self.gridLayout_5, 1, 0, 1, 1) 
    192193        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")) 
    193204 
    194205        self.retranslateUi(DataLoadWidget) 
     
    227238        self.cmdHelp_2.setText(_translate("DataLoadWidget", "Help", None)) 
    228239        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)) 
    229245 
    230246import main_resources_rc 
  • src/sas/qtgui/UI/DataExplorerUI.ui

    r481ff26 re540cd2  
    111111       <item row="1" column="0"> 
    112112        <widget class="QTreeView" name="treeView"> 
     113         <property name="contextMenuPolicy"> 
     114          <enum>Qt::NoContextMenu</enum> 
     115         </property> 
    113116         <property name="acceptDrops"> 
    114117          <bool>true</bool> 
     
    395398   </layout> 
    396399  </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> 
    397425 </widget> 
    398426 <resources> 
  • src/sas/qtgui/UI/MainWindowUI.py

    rf721030 re540cd2  
    2626    def setupUi(self, MainWindow): 
    2727        MainWindow.setObjectName(_fromUtf8("MainWindow")) 
    28         MainWindow.resize(915, 555) 
     28        MainWindow.resize(915, 527) 
    2929        icon = QtGui.QIcon() 
    3030        icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/res/ball.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off) 
     
    157157        self.actionCascade = QtGui.QAction(MainWindow) 
    158158        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")) 
    161161        self.actionTile_Vertically = QtGui.QAction(MainWindow) 
    162162        self.actionTile_Vertically.setObjectName(_fromUtf8("actionTile_Vertically")) 
     
    240240        self.menuFitting.addAction(self.actionEdit_Custom_Model) 
    241241        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) 
    244243        self.menuWindow.addSeparator() 
    245244        self.menuWindow.addAction(self.actionArrange_Icons) 
     
    331330        self.actionEdit_Custom_Model.setText(_translate("MainWindow", "Edit Custom Model", None)) 
    332331        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)) 
    334333        self.actionTile_Vertically.setText(_translate("MainWindow", "Tile Vertically", None)) 
    335334        self.actionArrange_Icons.setText(_translate("MainWindow", "Arrange Icons", None)) 
  • src/sas/qtgui/UI/MainWindowUI.ui

    rf721030 re540cd2  
    88    <y>0</y> 
    99    <width>915</width> 
    10     <height>555</height> 
     10    <height>527</height> 
    1111   </rect> 
    1212  </property> 
     
    112112    </property> 
    113113    <addaction name="actionCascade"/> 
    114     <addaction name="actionTile_Horizontally"/> 
    115     <addaction name="actionTile_Vertically"/> 
     114    <addaction name="actionTile"/> 
    116115    <addaction name="separator"/> 
    117116    <addaction name="actionArrange_Icons"/> 
     
    399398   </property> 
    400399  </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> 
    404403   </property> 
    405404  </action> 
  • src/sas/qtgui/UnitTesting/AboutBoxTest.py

    rf82ab8c re540cd2  
    7676                LocalConfig._ill_url, 
    7777                LocalConfig._inst_url] 
    78          
     78 
    7979        # Press the buttons 
    8080        buttonList = self.widget.findChildren(QPushButton) 
  • src/sas/qtgui/UnitTesting/DataExplorerTest.py

    r481ff26 re540cd2  
    9292        self.assertIsInstance(self.form.freezeView, QTreeView) 
    9393 
    94          
     94    def testWidgets(self): 
     95        """ 
     96        Test if all required widgets got added 
     97        """         
    9598    def testLoadButton(self): 
    9699        loadButton = self.form.cmdLoad 
     
    111114 
    112115        # Make sure the signal has not been emitted 
    113         #self.assertEqual(spy_file_read.count(), 0) 
     116        self.assertEqual(spy_file_read.count(), 0) 
    114117 
    115118        # Now, return a single file 
    116119        QtGui.QFileDialog.getOpenFileNames = MagicMock(return_value=filename) 
    117          
     120 
    118121        # Click on the Load button 
    119122        QTest.mouseClick(loadButton, Qt.LeftButton) 
     123        QtGui.qApp.processEvents() 
    120124 
    121125        # Test the getOpenFileName() dialog called once 
     
    127131        #self.assertIn(filename, str(spy_file_read.called()[0]['args'][0])) 
    128132 
     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         
    129152    def testDeleteButton(self): 
    130153        """ 
     
    441464        default_list = defaults.split(';;') 
    442465 
    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) 
    445468        
    446469    def testLoadComplete(self): 
  • src/sas/qtgui/UnitTesting/DroppableDataLoadWidgetTest.py

    r481ff26 re540cd2  
    44from PyQt4.QtGui import QApplication 
    55from PyQt4.QtTest import QTest 
    6 from PyQt4.QtCore import Qt 
     6from PyQt4 import QtCore 
    77from DroppableDataLoadWidget import DroppableDataLoadWidget 
    88from GuiUtils import * 
     9from UnitTesting.TestUtils import QtSignalSpy 
    910 
    1011app = QApplication(sys.argv) 
     
    2122 
    2223        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)]) 
    2429 
    2530    def testDragIsOK(self): 
     
    2732        Test the item being dragged over the load widget 
    2833        """ 
    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)) 
    3051 
    3152    def testDropEvent(self): 
     
    3354        Test what happens if an object is dropped onto the load widget 
    3455        """ 
    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 
    3669 
    3770if __name__ == "__main__": 
  • src/sas/qtgui/UnitTesting/GuiManagerTest.py

    r481ff26 re540cd2  
    1212 
    1313# Local 
     14from DataExplorer import DataExplorerWindow 
     15from UI.AcknowledgementsUI import Acknowledgements 
     16from AboutBox import AboutBox 
     17from WelcomePanel import WelcomePanel 
     18 
    1419from GuiManager import GuiManager 
    1520from UI.MainWindowUI import MainWindow 
     
    3843 
    3944    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 
    4356    def testUpdatePerspective(self): 
    4457        """ 
     
    7689        # See that the MessageBox method got called 
    7790        self.assertTrue(QMessageBox.question.called) 
    78         # sys.exit() not called this time 
    79         self.assertFalse(sys.exit.called) 
    8091 
    8192        # Say Yes to the close dialog 
     
    139150        webbrowser.open.assert_called_with("https://github.com/SasView/sasview/releases") 
    140151 
    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 
    155153        version_info = {} 
    156154        logging.error = MagicMock() 
     
    173171        pass 
    174172 
     173    #### FILE #### 
    175174    def testActionLoadData(self): 
    176175        """ 
     
    185184        # Test the getOpenFileName() dialog called once 
    186185        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 #### 
    188228    def testActionDocumentation(self): 
    189229        """ 
  • src/sas/qtgui/UnitTesting/GuiUtilsTest.py

    rf82ab8c re540cd2  
    22import unittest 
    33import webbrowser 
    4 import urlparse 
    54 
    65from PyQt4 import QtCore 
     
    5958            'updatePerspectiveWithDataSignal', 
    6059            'updateModelFromPerspectiveSignal', 
    61             'plotRequestedSignal' 
     60            'plotRequestedSignal', 
     61            'progressBarUpdateSignal', 
    6262        ] 
    6363 
     
    188188        with self.assertRaises(AttributeError): 
    189189            openLink(bad_url3) 
    190         pass 
    191190 
    192191if __name__ == "__main__": 
  • src/sas/qtgui/WelcomePanel.py

    rf82ab8c re540cd2  
    2020 
    2121        ver = "\nSasView %s\nBuild: %s" % (version, build) 
    22         #ver += "\n(c) 2009 - 2013, UTK, UMD, NIST, ORNL, ISIS, ESS and IL" 
    2322        ver += LocalConfig._copyright 
    2423 
Note: See TracChangeset for help on using the changeset viewer.