Changeset 0f3c22d in sasview


Ignore:
Timestamp:
Jan 16, 2017 4:05:40 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:
092a3d9
Parents:
239214f
Message:

Code review for SASVIEW-383

Location:
src/sas/qtgui
Files:
3 edited

Legend:

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

    • Property mode changed from 100755 to 100644
    r239214f r0f3c22d  
    11from PyQt4 import QtGui 
    2  
    3 import sas.sasview 
    42 
    53from sas.qtgui.PlotUtilities import COLORS, SHAPES 
     
    2422        self._legend = legend 
    2523        self._markersize = marker_size if marker_size else 5 
    26         self.custom_color = False 
     24        self.custom_color = False if isinstance(self._color, int) else True 
    2725 
    2826        # Fill out the color combobox 
     
    6866            return self.cbColor.currentIndex() 
    6967 
    70     def onColorChange(self, event): 
     68    def onColorChange(self): 
    7169        """ 
    7270        Pop up the standard Qt color change dialog 
    7371        """ 
    7472        # Pick up the chosen color 
    75         self._color = QtGui.QColorDialog.getColor(parent=self) 
     73        proposed_color = QtGui.QColorDialog.getColor(parent=self) 
    7674        # Update the text control 
    77         if self._color.isValid(): 
     75        if proposed_color.isValid(): 
    7876            # Block currentIndexChanged 
    7977            self.cbColor.blockSignals(True) 
     
    8583            # Save the color as #RRGGBB 
    8684            self.custom_color = True 
    87             self._color = str(self._color.name()) 
     85            self._color = str(proposed_color.name()) 
    8886    
    89     def onColorIndexChange(self, index): 
     87    def onColorIndexChange(self): 
    9088        """ 
    9189        Dynamically add/remove "Custom" color index 
     
    9694        if custom_index > -1: 
    9795            self.cbColor.removeItem(custom_index) 
    98  
    99         pass # debug hook 
    10096         
  • src/sas/qtgui/Plotter.py

    r239214f r0f3c22d  
    438438        """ 
    439439        selected_plot = self.plot_dict[id] 
    440         current = selected_plot.hide_error 
    441440 
    442441        # Old style color - single integer for enum color 
     
    455454                                legend=legend) 
    456455        if plotPropertiesWidget.exec_() == QtGui.QDialog.Accepted: 
    457             marker = plotPropertiesWidget.marker() 
    458             marker_size = plotPropertiesWidget.markersize() 
    459             color = plotPropertiesWidget.color() 
    460             legend = plotPropertiesWidget.legend() 
    461  
    462456            # Update Data1d 
    463             selected_plot.markersize = marker_size 
    464             selected_plot.custom_color = color 
    465             selected_plot.symbol = marker 
    466             selected_plot.title = legend 
     457            selected_plot.markersize = plotPropertiesWidget.markersize() 
     458            selected_plot.custom_color = plotPropertiesWidget.color() 
     459            selected_plot.symbol = plotPropertiesWidget.marker() 
     460            selected_plot.title = plotPropertiesWidget.legend() 
    467461 
    468462            # Redraw the plot 
  • src/sas/qtgui/UnitTesting/PlotPropertiesTest.py

    r239214f r0f3c22d  
    5757        QtGui.QColorDialog.getColor = MagicMock(return_value=QtGui.QColor(255, 0, 255)) 
    5858 
    59         self.widget.onColorChange(None) 
     59        self.widget.onColorChange() 
    6060 
    6161        self.assertEqual(self.widget.color(), "#ff00ff") 
     
    7272        bad_color = QtGui.QColor() # constructs an invalid color 
    7373        QtGui.QColorDialog.getColor = MagicMock(return_value=bad_color) 
    74         self.widget.onColorChange(None) 
     74        self.widget.onColorChange() 
    7575 
    7676        self.assertEqual(self.widget.color(), 1) 
     
    8383        '''Test the response to color index change event''' 
    8484        # Intitial population of the color combo box 
    85         self.widget.onColorIndexChange(0) 
     85        self.widget.onColorIndexChange() 
    8686        self.assertEqual(self.widget.cbColor.count(), 7) 
    8787        # Block the callback so we can update the cb 
     
    9494        self.assertEqual(self.widget.cbColor.count(), 8) 
    9595        # Call the method 
    96         self.widget.onColorIndexChange(0) 
     96        self.widget.onColorIndexChange() 
    9797        # see that the Custom entry disappeared 
    9898        self.assertEqual(self.widget.cbColor.count(), 7) 
Note: See TracChangeset for help on using the changeset viewer.