Changeset 092a3d9 in sasview for src/sas/qtgui/PlotterBase.py


Ignore:
Timestamp:
Jan 20, 2017 8:26:35 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:
03c372d
Parents:
0f3c22d
Message:

Color Map control for 2D charts. Initial commit - SASVIEW-391

File:
1 edited

Legend:

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

    rb46f285 r092a3d9  
    33 
    44from PyQt4 import QtGui 
     5from PyQt4 import QtCore 
    56 
    67# TODO: Replace the qt4agg calls below with qt5 equivalent. 
     
    1617from sas.sasgui.plottools.binder import BindArtist 
    1718 
     19import sas.qtgui.GuiUtils as GuiUtils 
     20from sas.sasgui.guiframe.dataFitting import Data1D, Data2D 
    1821from sas.qtgui.ScaleProperties import ScaleProperties 
    1922from sas.qtgui.WindowTitle import WindowTitle 
     
    3740        # ... and the toolbar with all the default MPL buttons 
    3841        self.toolbar = NavigationToolbar(self.canvas, self) 
     42 
     43        # Simple window for data display 
     44        self.txt_widget = QtGui.QTextEdit(None) 
    3945 
    4046        # Set the layout and place the canvas widget in it. 
     
    474480            if self._scale_yhi is not None and self._scale_ylo is not None: 
    475481                ax.set_ylim(self._scale_ylo, self._scale_yhi) 
     482 
     483    def onDataInfo(self, plot_data): 
     484        """ 
     485        Displays data info text window for the selected plot 
     486        """ 
     487        if isinstance(plot_data, Data1D): 
     488            text_to_show = GuiUtils.retrieveData1d(plot_data) 
     489        else: 
     490            text_to_show = GuiUtils.retrieveData2d(plot_data) 
     491        # Hardcoded sizes to enable full width rendering with default font 
     492        self.txt_widget.resize(420,600) 
     493 
     494        self.txt_widget.setReadOnly(True) 
     495        self.txt_widget.setWindowFlags(QtCore.Qt.Window) 
     496        self.txt_widget.setWindowIcon(QtGui.QIcon(":/res/ball.ico")) 
     497        self.txt_widget.setWindowTitle("Data Info: %s" % plot_data.filename) 
     498        self.txt_widget.insertPlainText(text_to_show) 
     499 
     500        self.txt_widget.show() 
     501        # Move the slider all the way up, if present 
     502        vertical_scroll_bar = self.txt_widget.verticalScrollBar() 
     503        vertical_scroll_bar.triggerAction(QtGui.QScrollBar.SliderToMinimum) 
     504 
     505    def onSavePoints(self, plot_data): 
     506        """ 
     507        Saves plot data to a file 
     508        """ 
     509        if isinstance(plot_data, Data1D): 
     510            GuiUtils.saveData1D(plot_data) 
     511        else: 
     512            GuiUtils.saveData2D(plot_data) 
Note: See TracChangeset for help on using the changeset viewer.