Esempio n. 1
0
    def onCopyCalib(self, event):
        """Creates a new calibration entry for the monitor.
        Note that the calibration date will reflect the save date/time
        """

        # use time as initial guess at name
        calibTime = time.localtime()
        calibTimeStr = monitors.strFromDate(calibTime)

        # then use dialogue so user can override
        msg = _translate(
            'Name of this calibration (for monitor "%(name)s") will be:)')
        infoStr = msg % {'name': self.currentMon.name}
        dlg = wx.TextEntryDialog(self, message=infoStr,
                                 defaultValue=calibTimeStr,
                                 caption=_translate('Input text'))
        if dlg.ShowModal() == wx.ID_OK:
            newCalibName = dlg.GetValue()
            # update the GUI to reflect new calibration
            self.currentMon.copyCalib(newCalibName)
            self.currentMon.setCalibDate(calibTime)

            self.onChangeCalibSelection(1, newCalibName)
            self.updateCalibList()
            self.unSavedMonitor = True
        dlg.Destroy()
Esempio n. 2
0
    def onChangeCalibSelection(self, event, newCalib=None):
        #get data under current calibration
        if newCalib == None:
            #probably came from an event - check the new name
            newCalib = self.ctrlCalibList.GetStringSelection()
        #do the load and check new name
        self.currentCalibName = self.currentMon.setCurrent(newCalib)

        #keys that may not exist
        #todo remove this code - only needed for monitor objects made pre version 0.63
        if not self.currentMon.currentCalib.has_key('gammaGrid'):
            self.currentMon.currentCalib['gammaGrid'] = monitors.numpy.ones(
                (4, 3), 'd')
        if not self.currentMon.currentCalib.has_key('lms_rgb'):
            self.currentMon.currentCalib['lms_rgb'] = monitors.numpy.ones(
                (3, 3), 'd')
        if not self.currentMon.currentCalib.has_key('dkl_rgb'):
            self.currentMon.currentCalib['dkl_rgb'] = monitors.numpy.ones(
                (3, 3), 'd')
        if not self.currentMon.currentCalib.has_key('sizePix'):
            self.currentMon.currentCalib['sizePix'] = [1024, 768]

        #insert values from new calib into GUI
        self.ctrlCalibDate.SetValue(
            monitors.strFromDate(self.currentMon.getCalibDate()))
        self.ctrlScrDist.SetValue(str(self.currentMon.getDistance()))
        self.ctrlScrWidth.SetValue(str(self.currentMon.getWidth()))
        self.ctrlScrPixHoriz.SetValue(
            str(self.currentMon.currentCalib['sizePix'][0]))
        self.ctrlScrPixVert.SetValue(
            str(self.currentMon.currentCalib['sizePix'][1]))
        #self.ctrlScrGamma.SetValue(str(self.currentMon.getGamma()))
        self.ctrlCalibNotes.SetValue(str(self.currentMon.getNotes()))
        self.ctrlUseBits.SetValue(self.currentMon.getUseBits())
        self.gammaGrid.setData(self.currentMon.getGammaGrid())
        #self.choiceLinearMethod.SetSelection(self.currentMon.getLineariseMethod()-1)
        self.LMSgrid.setData(self.currentMon.getLMS_RGB())
        self.DKLgrid.setData(self.currentMon.getDKL_RGB())

        if not self.currentMon.currentCalib.has_key('lumsPre'):
            self.btnPlotGamma.Enable(True)
        else:
            self.btnPlotGamma.Enable(True)
        if not self.currentMon.currentCalib.has_key('spectraRGB'):
            self.btnPlotSpectra.Enable(False)
        else:
            self.btnPlotSpectra.Enable(True)

        self.unSavedMonitor = False
        return 1
Esempio n. 3
0
    def onChangeCalibSelection(self, event, newCalib=None):
        #get data under current calibration
        if newCalib == None:
            #probably came from an event - check the new name
            newCalib = self.ctrlCalibList.GetStringSelection()
        #do the load and check new name
        self.currentCalibName= self.currentMon.setCurrent(newCalib)
        
        #keys that may not exist
        #todo remove this code - only needed for monitor objects made pre version 0.63
        if not self.currentMon.currentCalib.has_key('gammaGrid'):
            self.currentMon.currentCalib['gammaGrid']=monitors.numpy.ones((4,3), 'd')
        if not self.currentMon.currentCalib.has_key('lms_rgb'):
            self.currentMon.currentCalib['lms_rgb']=monitors.numpy.ones((3,3), 'd')
        if not self.currentMon.currentCalib.has_key('dkl_rgb'):
            self.currentMon.currentCalib['dkl_rgb']=monitors.numpy.ones((3,3), 'd')
        if not self.currentMon.currentCalib.has_key('sizePix'):
            self.currentMon.currentCalib['sizePix']= [1024,768]

        #insert values from new calib into GUI
        self.ctrlCalibDate.SetValue(
            monitors.strFromDate(self.currentMon.getCalibDate()))
        self.ctrlScrDist.SetValue(str(self.currentMon.getDistance()))
        self.ctrlScrWidth.SetValue(str(self.currentMon.getWidth()))
        self.ctrlScrPixHoriz.SetValue(str(self.currentMon.currentCalib['sizePix'][0]))
        self.ctrlScrPixVert.SetValue(str(self.currentMon.currentCalib['sizePix'][1]))
        #self.ctrlScrGamma.SetValue(str(self.currentMon.getGamma()))
        self.ctrlCalibNotes.SetValue(str(self.currentMon.getNotes()))
        self.ctrlUseBits.SetValue(self.currentMon.getUseBits())                    
        self.gammaGrid.setData(self.currentMon.getGammaGrid())
        #self.choiceLinearMethod.SetSelection(self.currentMon.getLineariseMethod()-1)
        self.LMSgrid.setData(self.currentMon.getLMS_RGB())
        self.DKLgrid.setData(self.currentMon.getDKL_RGB())
        
        if not self.currentMon.currentCalib.has_key('lumsPre'):
            self.btnPlotGamma.Enable(True)
        else: self.btnPlotGamma.Enable(True)
        if not self.currentMon.currentCalib.has_key('spectraRGB'):
            self.btnPlotSpectra.Enable(False)
        else: self.btnPlotSpectra.Enable(True)
        
        self.unSavedMonitor=False
        return 1
Esempio n. 4
0
    def onChangeCalibSelection(self, event, newCalib=None):
        # get data under current calibration
        if newCalib is None:
            # probably came from an event - check the new name
            newCalib = self.ctrlCalibList.GetStringSelection()
        # do the load and check new name
        self.currentCalibName = self.currentMon.setCurrent(newCalib)

        # keys that may not exist
        # todo remove this code - only needed for monitor objects made pre version 0.63
        if not "gammaGrid" in self.currentMon.currentCalib:
            self.currentMon.currentCalib["gammaGrid"] = monitors.numpy.ones((4, 3), "d")
        if not "lms_rgb" in self.currentMon.currentCalib:
            self.currentMon.currentCalib["lms_rgb"] = monitors.numpy.ones((3, 3), "d")
        if not "dkl_rgb" in self.currentMon.currentCalib:
            self.currentMon.currentCalib["dkl_rgb"] = monitors.numpy.ones((3, 3), "d")
        if not "sizePix" in self.currentMon.currentCalib:
            self.currentMon.currentCalib["sizePix"] = [1024, 768]

        # insert values from new calib into GUI
        self.ctrlCalibDate.SetValue(monitors.strFromDate(self.currentMon.getCalibDate()))
        self.ctrlScrDist.SetValue(locale.str(self.currentMon.getDistance() or 0))
        self.ctrlScrWidth.SetValue(locale.str(self.currentMon.getWidth() or 0))
        self.ctrlScrPixHoriz.SetValue(locale.str(self.currentMon.currentCalib["sizePix"][0] or 0))
        self.ctrlScrPixVert.SetValue(locale.str(self.currentMon.currentCalib["sizePix"][1] or 0))
        # self.ctrlScrGamma.SetValue(str(self.currentMon.getGamma()))
        self.ctrlCalibNotes.SetValue(self.currentMon.getNotes() or "")
        self.ctrlUseBits.SetValue(self.currentMon.getUseBits())
        self.gammaGrid.setData(self.currentMon.getGammaGrid())
        if self.currentMon.getLinearizeMethod() == 4:
            self.choiceLinearMethod.SetSelection(1)
        else:
            self.choiceLinearMethod.SetSelection(0)
        self.LMSgrid.setData(self.currentMon.getLMS_RGB())
        self.DKLgrid.setData(self.currentMon.getDKL_RGB())

        self.enableDisableCtrls()
        self.unSavedMonitor = False
        return 1
Esempio n. 5
0
    def onChangeCalibSelection(self, event, newCalib=None):
        # get data under current calibration
        if newCalib is None:
            # probably came from an event - check the new name
            newCalib = self.ctrlCalibList.GetStringSelection()
        # do the load and check new name
        self.currentCalibName = self.currentMon.setCurrent(newCalib)

        # insert values from new calib into GUI
        _date = monitors.strFromDate(self.currentMon.getCalibDate())
        self.ctrlCalibDate.SetValue(_date)

        _dist = self.currentMon.getDistance() or 0
        self.ctrlScrDist.SetValue(locale.str(_dist))

        _width = self.currentMon.getWidth() or 0
        self.ctrlScrWidth.SetValue(locale.str(_width))

        _pix = self.currentMon.currentCalib['sizePix'][0] or 0
        self.ctrlScrPixHoriz.SetValue(locale.str(_pix))

        _size = self.currentMon.currentCalib['sizePix'][1] or 0
        self.ctrlScrPixVert.SetValue(locale.str(_size))

        # self.ctrlScrGamma.SetValue(str(self.currentMon.getGamma()))
        self.ctrlCalibNotes.SetValue(self.currentMon.getNotes() or '')
        self.ctrlUseBits.SetValue(self.currentMon.getUseBits())
        self.gammaGrid.setData(self.currentMon.getGammaGrid())
        if self.currentMon.getLinearizeMethod() == 4:
            self.choiceLinearMethod.SetSelection(1)
        else:
            self.choiceLinearMethod.SetSelection(0)
        self.LMSgrid.setData(self.currentMon.getLMS_RGB())
        self.DKLgrid.setData(self.currentMon.getDKL_RGB())

        self.enableDisableCtrls()
        self.unSavedMonitor = False
        return 1