Changeset fed94a2 in sasview


Ignore:
Timestamp:
Jan 9, 2017 3:28:03 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:
a66ff280
Parents:
570a58f9
Message:

Improved label formatting in charts

Location:
src/sas/qtgui
Files:
4 edited

Legend:

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

    r570a58f9 rfed94a2  
    99import webbrowser 
    1010import urlparse 
     11import numpy 
    1112 
    1213warnings.simplefilter("ignore") 
  • src/sas/qtgui/LinearFit.py

    • Property mode changed from 100755 to 100644
    r570a58f9 rfed94a2  
    22Adds a linear fit plot to the chart 
    33""" 
     4import re 
    45import numpy 
    56from PyQt4 import QtGui 
     
    4647        self.txtBerr.setText("0") 
    4748        self.txtChi2.setText("0") 
     49 
    4850        # Initial ranges 
    4951        self.txtRangeMin.setText(str(max_range[0])) 
     
    5254        self.txtFitRangeMax.setText(str(fit_range[1])) 
    5355 
    54         self.lblRange.setText('Fit range of ' + self.xLabel) 
     56        # cast xLabel into html 
     57        label = re.sub(r'\^\((.)\)(.*)', r'<span style=" vertical-align:super;">\1</span>\2', 
     58                      str(self.xLabel).rstrip()) 
     59        self.lblRange.setText('Fit range of ' + label) 
    5560 
    5661        self.model = LineModel() 
     
    6267        self.transform = transform 
    6368 
     69        # connect Fit button 
    6470        self.cmdFit.clicked.connect(self.fit) 
    6571 
     
    108114        # Set the qmin and qmax in the panel that matches the 
    109115        # transformed min and max 
    110         self.txtRangeMin.setText(formatNumber(self.floatInvTransform(xmin))) 
    111         self.txtRangeMax.setText(formatNumber(self.floatInvTransform(xmax))) 
     116        #value_xmin = X_VAL_DICT[self.xLabel].floatTransform(xmin) 
     117        #value_xmax = X_VAL_DICT[self.xLabel].floatTransform(xmax) 
     118        value_xmin = self.floatInvTransform(xmin) 
     119        value_xmax = self.floatInvTransform(xmax) 
     120        self.txtRangeMin.setText(formatNumber(value_xmin)) 
     121        self.txtRangeMax.setText(formatNumber(value_xmax)) 
    112122 
    113123        # Store the transformed values of view x, y and dy before the fit 
     
    233243        return flag 
    234244 
    235     #def checkFitRanges(self, usermin, usermax): 
    236     #    """ 
    237     #    Ensure that fields parameter contains a min and a max value 
    238     #    within x min and x max range 
    239     #    """ 
    240     #    self.mini = float(self.xminFit.GetValue()) 
    241     #    self.maxi = float(self.xmaxFit.GetValue()) 
    242     #    flag = True 
    243     #    try: 
    244     #        mini = float(usermin.GetValue()) 
    245     #        maxi = float(usermax.GetValue()) 
    246     #        if mini < maxi: 
    247     #            usermin.SetBackgroundColour(wx.WHITE) 
    248     #            usermin.Refresh() 
    249     #        else: 
    250     #            flag = False 
    251     #            usermin.SetBackgroundColour("pink") 
    252     #            usermin.Refresh() 
    253     #    except: 
    254     #        # Check for possible values entered 
    255     #        flag = False 
    256     #        usermin.SetBackgroundColour("pink") 
    257     #        usermin.Refresh() 
    258  
    259     #    return flag 
    260245    def floatInvTransform(self, x): 
    261246        """ 
  • src/sas/qtgui/Plotter.py

    r570a58f9 rfed94a2  
    2222 
    2323        self.parent = parent 
    24         self.addText = AddText(self) 
    2524 
    2625        # Dictionary of {plot_id:Data1d} 
     
    2928        # Simple window for data display 
    3029        self.txt_widget = QtGui.QTextEdit(None) 
    31  
     30        # Window for text add 
     31        self.addText = AddText(self) 
     32 
     33        # Log-ness of the axes 
    3234        self.xLogLabel = "log10(x)" 
    3335        self.yLogLabel = "log10(y)" 
     
    3941 
    4042        # Add a slot for receiving update signal from LinearFit 
    41         # NEW style signals - don't work! 
     43        # NEW style signals 
    4244        #self.updatePlot = QtCore.pyqtSignal(tuple) 
    43         #self.updatePlot.connect(self.updateWithData) 
    44         # OLD style signals - work perfectly 
     45        # self.updatePlot.connect(self.onFitDisplay) 
     46        # OLD style signals 
    4547        QtCore.QObject.connect(self, QtCore.SIGNAL('updatePlot'), self.onFitDisplay) 
    4648 
     
    6870        is_fit = (self._data.id=="fit") 
    6971 
    70         # Shortcut for an axis 
     72        # Shortcut for the current axis 
    7173        ax = self.ax 
    7274 
     
    436438                self.removePlot(id) 
    437439                continue 
     440 
    438441            new_xlabel, new_ylabel, xscale, yscale =\ 
    439442                GuiUtils.xyTransform(current_plot, xLabel, yLabel) 
  • src/sas/qtgui/ScaleProperties.py

    r3b7b218 rfed94a2  
    4545        Return current values from comboboxes 
    4646        """ 
    47         return self.cbX.currentText(), self.cbY.currentText() 
     47        return str(self.cbX.currentText()), str(self.cbY.currentText()) 
    4848 
    4949    def viewIndexChanged(self, index): 
Note: See TracChangeset for help on using the changeset viewer.