Changeset d3ca363 in sasview


Ignore:
Timestamp:
Dec 19, 2016 6:05:25 AM (8 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:
257bd57
Parents:
9290b1a
Message:

Setting graph range - SASVIEW-381

Location:
src/sas/qtgui
Files:
3 added
5 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified src/sas/qtgui/GUITests.py

    • Property mode changed from 100755 to 100644
    r9290b1a rd3ca363  
    1919from UnitTesting import DensityCalculatorTest 
    2020from UnitTesting import WindowTitleTest 
     21from UnitTesting import SetGraphRangeTest 
    2122 
    2223def suite(): 
     
    4041        unittest.makeSuite(DensityCalculatorTest.DensityCalculatorTest, 'test'), 
    4142        unittest.makeSuite(WindowTitleTest.WindowTitleTest, 'test'), 
     43        unittest.makeSuite(SetGraphRangeTest.SetGraphRangeTest, 'test'), 
    4244    ) 
    4345    return unittest.TestSuite(suites) 
  • TabularUnified src/sas/qtgui/Plotter.py

    r9290b1a rd3ca363  
    99from sas.qtgui.PlotterBase import PlotterBase 
    1010from sas.qtgui.AddText import AddText 
     11from sas.qtgui.SetGraphRange import SetGraphRange 
    1112 
    1213class PlotterWidget(PlotterBase): 
     
    206207        Show a dialog allowing setting the chart ranges 
    207208        """ 
    208         print("onSetGraphRange") 
    209         pass 
     209        # min and max of data 
     210        x_range = self.ax.get_xlim() 
     211        y_range = self.ax.get_ylim() 
     212        self.setRange = SetGraphRange(parent=self, 
     213            x_range=x_range, y_range=y_range) 
     214        if self.setRange.exec_() == QtGui.QDialog.Accepted: 
     215            x_range = self.setRange.xrange() 
     216            y_range = self.setRange.yrange() 
     217            if x_range is not None and y_range is not None: 
     218                self.ax.set_xlim(x_range) 
     219                self.ax.set_ylim(y_range) 
     220                self.canvas.draw_idle() 
    210221 
    211222    def onResetGraphRange(self): 
    212223        """ 
    213         Resets the chart X and Y ranges to the original values 
    214         """ 
    215         print("onResetGraphRange") 
    216         pass 
     224        Resets the chart X and Y ranges to their original values 
     225        """ 
     226        x_range = (self.data.x.min(), self.data.x.max()) 
     227        y_range = (self.data.y.min(), self.data.y.max()) 
     228        if x_range is not None and y_range is not None: 
     229            self.ax.set_xlim(x_range) 
     230            self.ax.set_ylim(y_range) 
     231            self.canvas.draw_idle() 
    217232 
    218233    def xyTransform(self, xLabel="", yLabel=""): 
  • TabularUnified src/sas/qtgui/UnitTesting/PlotterTest.py

    r9290b1a rd3ca363  
    162162        pass 
    163163 
     164    def testOnSetGraphRange(self): 
     165        """ Cheks if the graph can be resized for range """ 
     166        pass 
     167 
     168    def testOnResetGraphRange(self): 
     169        """ Cheks if the graph can be reset after resizing for range """ 
     170        pass 
    164171 
    165172if __name__ == "__main__": 
  • TabularUnified src/sas/qtgui/run_tests.bat

    r9290b1a rd3ca363  
    1818python -m UnitTesting.WindowTitleTest 
    1919python -m UnitTesting.AddTextTest 
     20python -m UnitTesting.SetGraphRangeTest 
  • TabularUnified src/sas/qtgui/run_tests.sh

    r9290b1a rd3ca363  
    1717python -m UnitTesting.WindowTitleTest 
    1818python -m UnitTesting.AddTextTest 
     19python -m UnitTesting.SetGraphRangeTest 
Note: See TracChangeset for help on using the changeset viewer.