Changeset b4b8589 in sasview


Ignore:
Timestamp:
Dec 8, 2016 5:53:56 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:
fecfe28
Parents:
cad617b
Message:

Code review from WP. Also, added 1D plots with error bars as default.

Location:
src/sas/qtgui
Files:
4 edited

Legend:

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

    rcad617b rb4b8589  
    411411                raise AttributeError, msg 
    412412 
     413 
    413414        if plots and \ 
    414            hasattr(new_plot, 'data') and \ 
    415            len(new_plot.data.x) > 0: 
    416             self.plotAdd(new_plot) 
     415            hasattr(new_plot, 'data') and \ 
     416            isinstance(new_plot.data, Data1D): 
     417                self.plotAdd(new_plot) 
    417418 
    418419    def plotAdd(self, new_plot): 
  • src/sas/qtgui/Plotter.py

    r416fa8f rb4b8589  
    2323        self.title(title=value.title) 
    2424 
    25     def plot(self, marker=None, linestyle=None): 
     25    def plot(self, marker=None, linestyle=None, hide_error=False): 
    2626        """ 
    2727        Plot self._data 
     
    3434 
    3535        if linestyle == None: 
    36             linestyle = '-' 
    37  
    38         # plot data with title 
    39         ax.plot(self._data.view.x, 
    40                 self._data.view.y, 
    41                 marker=marker, 
    42                 linestyle=linestyle, 
    43                 label=self._title) 
     36            linestyle = '' 
     37 
     38        # plot data with/without errorbars 
     39        if hide_error: 
     40            ax.plot(self._data.view.x, self._data.view.y, 
     41                    marker=marker, 
     42                    linestyle=linestyle, 
     43                    label=self._title) 
     44        else: 
     45            ax.errorbar(self._data.view.x, self._data.view.y, 
     46                        yerr=self._data.view.dx, xerr=None, 
     47                        capsize=2, linestyle='', 
     48                        barsabove=False, 
     49                        marker=marker, 
     50                        lolims=False, uplims=False, 
     51                        xlolims=False, xuplims=False, 
     52                        label=self._title) 
    4453 
    4554        # Now add the legend with some customizations. 
     
    206215        QtGui.QDialog.__init__(self) 
    207216        PlotterWidget.__init__(self, manager=parent, quickplot=quickplot) 
    208  
     217        icon = QtGui.QIcon() 
     218        icon.addPixmap(QtGui.QPixmap(":/res/ball.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off) 
     219        self.setWindowIcon(icon) 
     220 
     221 
  • src/sas/qtgui/Plotter2D.py

    rcad617b rb4b8589  
    154154 
    155155            cbax = self.figure.add_axes([0.84, 0.2, 0.02, 0.7]) 
     156 
     157            # Current labels for axes 
     158            self.ax.set_ylabel(self.y_label) 
     159            self.ax.set_xlabel(self.x_label) 
     160 
     161            # Title only for regular charts 
     162            if not self.quickplot: 
     163                self.ax.set_title(label=self._title) 
     164 
     165 
    156166        else: 
    157167            # clear the previous 2D from memory 
     
    166176            ax = Axes3D(self.figure) 
    167177            cbax = self.figure.add_axes([0.84, 0.1, 0.02, 0.8]) 
     178 
    168179            # Disable rotation for large sets. 
    169180            # TODO: Define "large" for a dataset 
     
    182193        else: 
    183194            cb = self.figure.colorbar(im, cax=cbax) 
     195 
    184196        cb.update_bruteforce(im) 
    185197        cb.set_label('$' + self.scale + '$') 
     
    195207        QtGui.QDialog.__init__(self) 
    196208        Plotter2DWidget.__init__(self, manager=parent, quickplot=quickplot, dimension=dimension) 
     209        icon = QtGui.QIcon() 
     210        icon.addPixmap(QtGui.QPixmap(":/res/ball.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off) 
     211        self.setWindowIcon(icon) 
  • src/sas/qtgui/PlotterBase.py

    r416fa8f rb4b8589  
    1414DEFAULT_CMAP = pylab.cm.jet 
    1515from sas.qtgui.ScaleProperties import ScaleProperties 
    16 import sas.qtgui.PlotUtilities as PlotUtilities 
    1716import sas.qtgui.PlotHelper as PlotHelper 
    1817 
     
    5049        self.qx_data = [] 
    5150        self.qy_data = [] 
    52         self.color=0 
    53         self.symbol=0 
     51        self.color = 0 
     52        self.symbol = 0 
    5453        self.grid_on = False 
    5554        self.scale = 'linear' 
     
    7978    @property 
    8079    def data(self): 
     80        """ data getter """ 
    8181        return self._data 
    8282 
     
    158158        Display the context menu 
    159159        """ 
    160         self.contextMenu.exec_( self.canvas.mapToGlobal(event.pos()) ) 
     160        self.contextMenu.exec_(self.canvas.mapToGlobal(event.pos())) 
    161161 
    162162    def clean(self): 
     
    201201        dialog.setModal(True) 
    202202        dialog.setWindowTitle("Print") 
    203         if(dialog.exec_() != QtGui.QDialog.Accepted): 
     203        if dialog.exec_() != QtGui.QDialog.Accepted: 
    204204            return 
    205205 
    206206        painter = QtGui.QPainter(printer) 
     207        # Grab the widget screenshot 
     208        pmap = QtGui.QPixmap.grabWidget(self) 
    207209        # Create a label with pixmap drawn 
    208         pmap = QtGui.QPixmap.grabWidget(self) 
    209210        printLabel = QtGui.QLabel() 
    210211        printLabel.setPixmap(pmap) 
Note: See TracChangeset for help on using the changeset viewer.