示例#1
0
 def __init__(self, parent, grid, cols=None):
     gridlib.Grid.__init__(self, parent)
     self.grid = grid
     self.backgroundColour = wx.Colour(216, 122, 50, 127)
     self.parent = parent
     self.SetGridLineColour(wx.LIGHT_GREY)
     self.CreateGrid(12, cols)
     self.SetColLabelAlignment(wx.ALIGN_LEFT, wx.ALIGN_BOTTOM)
     self.SetRowLabelSize(125)
     self.SetRowLabelAlignment(0, 0)
     self.SetRowLabelValue(0, "Variable name")
     self.SetRowLabelValue(1, "Alignment")
     self.SetRowLabelValue(2, "Label")
     self.SetRowLabelValue(3, "Measure")
     self.SetRowLabelValue(4, "Variable type")
     self.SetRowLabelValue(5, "Decimal places")
     self.SetRowLabelValue(6, "Missing values")
     self.SetRowLabelValue(7, " ")
     self.SetRowLabelValue(8, "Your data row 1")
     self.SetRowLabelValue(9, "Your data row 2")
     self.SetRowLabelValue(10, "Your data row 3")
     self.SetRowLabelValue(11, "Your data row 4")
     self.choices_align = ['Left', 'Centre', 'Right']
     self.choice_align = gridlib.GridCellChoiceEditor(
         self.choices_align, False)
     self.choices_measure = [
         'Nominal', 'Ordinal', 'Interval', 'Ratio', 'Unset'
     ]
     self.choice_measure = gridlib.GridCellChoiceEditor(
         self.choices_measure, False)
     self.choices_ivdv = ['None', 'IV', 'DV']
     self.choice_ivdv = gridlib.GridCellChoiceEditor(
         self.choices_ivdv, False)
     self.ResetGrid()
     gridlib.EVT_GRID_CELL_CHANGE(self, self.CellChanged)
示例#2
0
    def makeCalibBox(self, parent, levels):
        '''do my best to make a calibration box'''
        gammaBox = wx.StaticBox(parent, -1, _translate('Luminance Values'))
        gammaBox.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.NORMAL))
        gammaBoxSizer = wx.StaticBoxSizer(gammaBox, wx.VERTICAL)

        theCols = map(str, levels)
        self.gammaGrid = SimpleGrid(parent, id=-1,
                                    cols=theCols,
                                    rows=['lum', 'R', 'G', 'B'])
        gammaBoxSizer.Add(self.gammaGrid)
        grid.EVT_GRID_CELL_CHANGE(self.gammaGrid, self.onChangeGammaGrid)
        gammaBoxSizer.Layout()

        return gammaBoxSizer
示例#3
0
 def __init__(self, parent, inits=None):
     gridlib.Grid.__init__(self, parent)
     self.backgroundColour = wx.Colour(216, 122, 50, 127)
     self.parent = parent
     self.named = False
     self.Saved = True
     self.filename = "Untitled"
     self.moveTo = None
     self.SetGridLineColour(wx.LIGHT_GREY)
     self.inits = inits
     self.CreateGrid(int(self.inits.get("gridcellsy")), \
                                 int(self.inits.get("gridcellsx")))
     self.SetColLabelAlignment(wx.ALIGN_LEFT, wx.ALIGN_BOTTOM)
     #for i in range(20):
     #self.SetColFormatFloat(i, 8, 4)
     gridlib.EVT_GRID_CELL_CHANGE(self, self.AlterSaveStatus)
     gridlib.EVT_GRID_RANGE_SELECT(self, self.RangeSelected)
     self.wildcard = "Any File (*.*)|*.*|" \
                     "ASCII data format (*.dat)|*.dat|" \
                     "SalStat Format (*.xml)|*.xml"
     self.colnames = 21
     self.BeginMeta()
示例#4
0
    def makeCalibBox(self, parent):
        boxLabel = wx.StaticBox(parent, -1, _translate('Calibration'))
        boxLabel.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.NORMAL))
        calibBox = wx.StaticBoxSizer(boxLabel)

        photometerBox = wx.FlexGridSizer(cols=2, hgap=6, vgap=6)
        # com port entry number
        self.comPortLabel = wx.StaticText(parent, -1, " ", size=(150, 20))
        # photometer button
        # photom type choices should not need localization:
        _choices = list([p.longName for p in hardware.getAllPhotometers()])
        self.ctrlPhotomType = wx.Choice(parent, -1, name="Type:",
                                        choices=_choices)

        _ports = list(hardware.getSerialPorts())
        self._photomChoices = [_translate("Scan all ports")] + _ports
        _size = self.ctrlPhotomType.GetSize() + [0, 5]
        self.ctrlPhotomPort = wx.ComboBox(parent, -1, name="Port:",
                                          value=self._photomChoices[0],
                                          choices=self._photomChoices,
                                          size=_size)

        # wx.EVT_CHOICE(self, self.ctrlPhotomType.GetId(),
        #               self.onChangePhotomType)  # not needed?
        self.btnFindPhotometer = wx.Button(parent, -1,
                                           _translate("Get Photometer"))
        wx.EVT_BUTTON(self, self.btnFindPhotometer.GetId(),
                      self.onBtnFindPhotometer)

        # gamma controls
        self.btnCalibrateGamma = wx.Button(
            parent, -1, _translate("Gamma Calibration..."))
        wx.EVT_BUTTON(self, self.btnCalibrateGamma.GetId(),
                      self.onCalibGammaBtn)
        self.btnTestGamma = wx.Button(
            parent, -1, _translate("Gamma Test..."))
        self.btnTestGamma.Enable(False)

        # color controls
        wx.EVT_BUTTON(self, self.btnTestGamma.GetId(), self.onCalibTestBtn)
        self.btnCalibrateColor = wx.Button(
            parent, -1, _translate("Chromatic Calibration..."))
        self.btnCalibrateColor.Enable(False)
        wx.EVT_BUTTON(self, self.btnCalibrateColor.GetId(),
                      self.onCalibColorBtn)
        self.btnPlotGamma = wx.Button(
            parent, -1, _translate("Plot gamma"))
        wx.EVT_BUTTON(self, self.btnPlotGamma.GetId(), self.plotGamma)
        self.btnPlotSpectra = wx.Button(
            parent, -1, _translate("Plot spectra"))
        wx.EVT_BUTTON(self, self.btnPlotSpectra.GetId(), self.plotSpectra)

        photometerBox.AddMany([self.ctrlPhotomType, self.btnFindPhotometer,
                               self.ctrlPhotomPort, (0, 0),
                               self.comPortLabel, (0, 0),
                               self.btnCalibrateGamma, (0, 0),
                               self.btnTestGamma, self.btnPlotGamma,
                               self.btnCalibrateColor, self.btnPlotSpectra])

        # ----GAMMA------------
        # calibration grid
        gammaBox = wx.StaticBox(parent, -1, _translate('Linearization'))
        gammaBox.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.NORMAL))
        gammaBoxSizer = wx.StaticBoxSizer(gammaBox, wx.VERTICAL)

        # don't localize the choices
        _choices = ['easy: a+kx^g', 'full: a+(b+kx)^g']
        self.choiceLinearMethod = wx.Choice(parent, -1, name='formula:',
                                            choices=_choices)
        if self.currentMon.getLinearizeMethod() == 4:
            self.choiceLinearMethod.SetSelection(1)
        else:
            self.choiceLinearMethod.SetSelection(0)
        wx.EVT_CHOICE(self, self.choiceLinearMethod.GetId(),
                      self.onChangeLinearMethod)
        gammaBoxSizer.Add(self.choiceLinearMethod, 1, wx.ALL, 2)

        self.gammaGrid = SimpleGrid(parent, id=-1,
                                    cols=['Min', 'Max', 'Gamma',
                                          'a', 'b', 'k'],
                                    rows=['lum', 'R', 'G', 'B'])
        gammaBoxSizer.Add(self.gammaGrid)
        grid.EVT_GRID_CELL_CHANGE(self.gammaGrid, self.onChangeGammaGrid)
        gammaBoxSizer.Layout()

        # LMS grid
        LMSbox = wx.StaticBox(parent, -1, 'LMS->RGB')
        LMSboxSizer = wx.StaticBoxSizer(LMSbox, wx.VERTICAL)
        self.LMSgrid = SimpleGrid(parent, id=-1,
                                  cols=['L', 'M', 'S'],
                                  rows=['R', 'G', 'B'])
        LMSboxSizer.Add(self.LMSgrid)
        LMSboxSizer.Layout()
        grid.EVT_GRID_CELL_CHANGE(self.LMSgrid, self.onChangeLMSgrid)

        # DKL grid
        DKLbox = wx.StaticBox(parent, -1, 'DKL->RGB')
        DKLboxSizer = wx.StaticBoxSizer(DKLbox, wx.VERTICAL)
        self.DKLgrid = SimpleGrid(parent, id=-1,
                                  cols=['Lum', 'L-M', 'L+M-S'],
                                  rows=['R', 'G', 'B'])
        DKLboxSizer.Add(self.DKLgrid)
        DKLboxSizer.Layout()
        grid.EVT_GRID_CELL_CHANGE(self.DKLgrid, self.onChangeDKLgrid)

        calibBoxMainSizer = wx.BoxSizer(wx.VERTICAL)
        calibBoxMainSizer.AddMany([photometerBox,
                                   gammaBoxSizer,
                                   LMSboxSizer,
                                   DKLboxSizer])
        calibBoxMainSizer.Layout()

        if NOTEBOOKSTYLE:
            return calibBoxMainSizer
        else:
            # put the main sizer into a labeled box
            calibBox.Add(calibBoxMainSizer)
            return calibBox
示例#5
0
    def makeCalibBox(self, parent):

        boxLabel = wx.StaticBox(parent, -1, 'Calibration')
        boxLabel.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.NORMAL))
        calibBox = wx.StaticBoxSizer(boxLabel)

        photometerBox = wx.FlexGridSizer(cols=2, hgap=6, vgap=6)
        #com port entry number
        self.comPortLabel = wx.StaticText(parent, -1, " ", size=(150, 20))
        #photometer button
        self.ctrlPhotomType = wx.Choice(
            parent,
            -1,
            name="Type:",
            choices=["PR655/PR670", "PR650", "LS100/LS110"])
        #wx.EVT_CHOICE(self, self.ctrlPhotomType.GetId(), self.onChangePhotomType)#not needed?
        self.btnFindPhotometer = wx.Button(parent, -1, "Get Photometer")
        wx.EVT_BUTTON(self, self.btnFindPhotometer.GetId(),
                      self.onBtnFindPhotometer)

        #gamma controls
        self.btnCalibrateGamma = wx.Button(parent, -1, "Gamma Calibration...")
        wx.EVT_BUTTON(self, self.btnCalibrateGamma.GetId(),
                      self.onCalibGammaBtn)
        self.btnTestGamma = wx.Button(parent, -1, "Gamma Test...")
        self.btnTestGamma.Enable(False)
        #self.choiceLinearMethod = wx.Choice(parent, -1,
        #choices=['a+(bx)^gamma','(a+bx)^gamma','interpolate'])
        #wx.EVT_CHOICE(self, self.choiceLinearMethod.GetId(), self.onChangeLinearMethod)

        #color controls
        wx.EVT_BUTTON(self, self.btnTestGamma.GetId(), self.onCalibTestBtn)
        self.btnCalibrateColor = wx.Button(parent, -1,
                                           "Chromatic Calibration...")
        self.btnCalibrateColor.Enable(False)
        wx.EVT_BUTTON(self, self.btnCalibrateColor.GetId(),
                      self.onCalibColorBtn)
        self.btnPlotGamma = wx.Button(parent, -1, "Plot gamma")
        wx.EVT_BUTTON(self, self.btnPlotGamma.GetId(), self.plotGamma)
        self.btnPlotSpectra = wx.Button(parent, -1, "Plot spectra")
        wx.EVT_BUTTON(self, self.btnPlotSpectra.GetId(), self.plotSpectra)

        photometerBox.AddMany([
            self.ctrlPhotomType,
            self.btnFindPhotometer,
            self.comPortLabel,
            (0, 0),
            self.btnCalibrateGamma,
            (0, 0),  #self.choiceLinearMethod,
            self.btnTestGamma,
            self.btnPlotGamma,
            self.btnCalibrateColor,
            self.btnPlotSpectra
        ])

        #-----------------------
        #----GAMMA------------
        #-----------------------
        #calibration grid
        gammaBox = wx.StaticBox(parent, -1, 'Linearisation')
        gammaBox.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.NORMAL))
        gammaBoxSizer = wx.StaticBoxSizer(gammaBox, wx.VERTICAL)

        self.gammaGrid = SimpleGrid(parent,
                                    id=-1,
                                    cols=['min', 'max', 'Gamma'],
                                    rows=['lum', 'R', 'G', 'B'])
        gammaBoxSizer.Add(self.gammaGrid)
        grid.EVT_GRID_CELL_CHANGE(self.gammaGrid, self.onChangeGammaGrid)
        gammaBoxSizer.Layout()

        #LMS grid
        LMSbox = wx.StaticBox(parent, -1, 'LMS->RGB')
        LMSboxSizer = wx.StaticBoxSizer(LMSbox, wx.VERTICAL)
        self.LMSgrid = SimpleGrid(parent,
                                  id=-1,
                                  cols=['L', 'M', 'S'],
                                  rows=['R', 'G', 'B'])
        LMSboxSizer.Add(self.LMSgrid)
        LMSboxSizer.Layout()
        grid.EVT_GRID_CELL_CHANGE(self.LMSgrid, self.onChangeLMSgrid)

        #DKL grid
        DKLbox = wx.StaticBox(parent, -1, 'DKL->RGB')
        DKLboxSizer = wx.StaticBoxSizer(DKLbox, wx.VERTICAL)
        self.DKLgrid = SimpleGrid(parent,
                                  id=-1,
                                  cols=['Lum', 'L-M', 'L+M-S'],
                                  rows=['R', 'G', 'B'])
        DKLboxSizer.Add(self.DKLgrid)
        DKLboxSizer.Layout()
        grid.EVT_GRID_CELL_CHANGE(self.DKLgrid, self.onChangeDKLgrid)

        calibBoxMainSizer = wx.BoxSizer(wx.VERTICAL)
        calibBoxMainSizer.AddMany([
            photometerBox,
            gammaBoxSizer,
            LMSboxSizer,
            DKLboxSizer,
        ])
        calibBoxMainSizer.Layout()

        if NOTEBOOKSTYLE:
            return calibBoxMainSizer
        else:
            #put the main sizer into a labeled box
            calibBox.Add(calibBoxMainSizer)
            return calibBox