Changeset adf81b8 in sasview


Ignore:
Timestamp:
Nov 29, 2016 6:08:29 AM (7 years ago)
Author:
Piotr Rozyczko <rozyczko@…>
Branches:
ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
Children:
8548d739
Parents:
e84ccf5
git-author:
Piotr Rozyczko <rozyczko@…> (11/29/16 00:56:47)
git-committer:
Piotr Rozyczko <rozyczko@…> (11/29/16 06:08:29)
Message:

Minor performance impromevements in DE

Location:
src/sas/qtgui
Files:
2 edited

Legend:

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

    r31c5b58 radf81b8  
    293293        self.communicator.updateModelFromPerspectiveSignal.connect(self.updateModelFromPerspective) 
    294294 
     295        def isItemReady(index): 
     296            item = self.model.item(index) 
     297            return item.isCheckable() and item.checkState() == QtCore.Qt.Checked 
     298 
    295299        # Figure out which rows are checked 
    296         selected_items = [] 
    297         for index in range(self.model.rowCount()): 
    298             item = self.model.item(index) 
    299             if item.isCheckable() and item.checkState() == QtCore.Qt.Checked: 
    300                 selected_items.append(item) 
     300        selected_items = [self.model.item(index) 
     301                          for index in xrange(self.model.rowCount()) 
     302                          if isItemReady(index)] 
    301303 
    302304        if len(selected_items) < 1: 
     
    312314            retval = msgbox.exec_() 
    313315            return 
    314  
    315         # TODO 
    316         # New plot or appended? 
    317316 
    318317        # Notify the GuiManager about the send request 
     
    378377        self.cbgraph.clear() 
    379378        graph_titles = [] 
    380         for graph in graph_list: 
    381             graph_titles.append("Graph"+str(graph)) 
     379        graph_titles= ["Graph"+str(graph) for graph in graph_list] 
     380 
    382381        self.cbgraph.insertItems(0, graph_titles) 
    383382        ind = self.cbgraph.findText(orig_text) 
     
    395394        # All same-type charts in one plot 
    396395        new_plot = Plotter(self) 
     396 
     397        def addDataPlot(plot, plot_set): 
     398            plot.data = plot_set 
     399            plot.plot() 
     400 
     401        def addDataPlot2D(plot_set): 
     402            plot2D = Plotter2D(self) 
     403            addDataPlot(plot2D, plot_set) 
     404            self.plotAdd(plot2D) 
     405 
    397406        for plot_set in plots: 
    398407            if isinstance(plot_set, Data1D): 
    399                 new_plot.data = plot_set 
    400                 new_plot.plot() 
     408                addDataPlot(new_plot, plot_set) 
    401409            elif isinstance(plot_set, Data2D): 
    402                 # Separate 2D plot 
    403                 plot2D = Plotter2D(self) 
    404                 plot2D.data = plot_set 
    405                 plot2D.plot() 
    406                 self.plotAdd(plot2D) 
     410                addDataPlot2D(plot_set) 
    407411            else: 
    408412                msg = "Incorrect data type passed to Plotting" 
    409413                raise AttributeError, msg 
     414 
    410415 
    411416        if plots and \ 
  • src/sas/qtgui/UnitTesting/WelcomePanelTest.py

    r31c5b58 radf81b8  
    22import unittest 
    33 
    4 from PyQt4.QtGui import * 
    5 from PyQt4.QtTest import QTest 
    6 from PyQt4.QtCore import * 
     4from PyQt4 import QtGui 
    75 
    86# set up import paths 
     
    1210from WelcomePanel import WelcomePanel 
    1311 
    14 app = QApplication(sys.argv) 
     12app = QtGui.QApplication(sys.argv) 
    1513 
    1614class WelcomePanelTest(unittest.TestCase): 
     
    2826    def testDefaults(self): 
    2927        '''Test the GUI in its default state''' 
    30         self.assertIsInstance(self.widget, QDialog) 
     28        self.assertIsInstance(self.widget, QtGui.QDialog) 
    3129        self.assertEqual(self.widget.windowTitle(), "Welcome") 
    3230         
    3331    def testVersion(self): 
    34         """ 
    35         """ 
     32        '''Test the version string''' 
    3633        version = self.widget.lblVersion 
    37         self.assertIsInstance(version, QLabel) 
    38         ver_text = "\nSasView 4.0.0-alpha\nBuild: 1\n(c) 2009 - 2013, UTK, UMD, NIST, ORNL, ISIS, ESS and IL" 
    39         #self.assertEqual(str(version.text()), ver_text) 
    40         self.assertIn("SasView", str(version.text())) 
    41         self.assertIn("Build:", str(version.text())) 
     34        self.assertIsInstance(version, QtGui.QLabel) 
     35 
     36        self.assertIn("SasView", version.text()) 
     37        self.assertIn("Build:", version.text()) 
     38        self.assertIn("UTK, UMD, NIST, ORNL, ISIS, ESS, ILL and ANSTO", version.text()) 
    4239        
    4340if __name__ == "__main__": 
Note: See TracChangeset for help on using the changeset viewer.