示例#1
0
    def __init__(self, parent, nb, idPg, heatersPage, font):
        wx.Panel.__init__(self, nb, wx.ID_ANY)
        Page.__init__(self, font)
        self.parent = parent
        self.heatersPage = heatersPage
        self.font = font
        self.id = idPg

        self.sensorTypeKeys = {
            'TT_MAX6675': 'TEMP_MAX6675',
            'TT_THERMISTOR': 'TEMP_THERMISTOR',
            'TT_AD595': 'TEMP_AD595',
            'TT_PT100': 'TEMP_PT100',
            'TT_INTERCOM': 'TEMP_INTERCOM'
        }
        self.labels = {
            'TEMP_MAX6675': "MAX6675",
            'TEMP_THERMISTOR': "Thermistor",
            'TEMP_AD595': "AD595",
            'TEMP_PT100': "PT100",
            'TEMP_INTERCOM': "Intercom"
        }

        self.validPins = pinNames

        sz = wx.GridBagSizer()
        sz.AddSpacer((10, 10), pos=(0, 0))

        self.sensors = []

        self.lb = SensorList(self, font)
        sz.Add(self.lb, pos=(1, 1))
        sz.AddSpacer((20, 20), pos=(1, 2))

        bsz = wx.BoxSizer(wx.VERTICAL)
        self.bAdd = wx.Button(self, wx.ID_ANY, "Add", size=BSIZESMALL)
        self.bAdd.SetBackgroundColour(self.deco.getBackgroundColour())
        self.bAdd.SetFont(font)
        self.Bind(wx.EVT_BUTTON, self.doAdd, self.bAdd)
        self.bAdd.Enable(False)
        self.bAdd.SetToolTipString("Add a sensor to the configuration.")

        bsz.Add(self.bAdd)

        bsz.AddSpacer((10, 10))
        self.bModify = wx.Button(self, wx.ID_ANY, "Modify", size=BSIZESMALL)
        self.bModify.SetBackgroundColour(self.deco.getBackgroundColour())
        self.bModify.SetFont(font)
        self.bModify.Enable(False)
        self.Bind(wx.EVT_BUTTON, self.doModify, self.bModify)
        bsz.Add(self.bModify)
        self.bModify.SetToolTipString(
            "Modify the selected temperature sensor.")

        bsz.AddSpacer((10, 10))
        self.bDelete = wx.Button(self, wx.ID_ANY, "Delete", size=BSIZESMALL)
        self.bDelete.SetBackgroundColour(self.deco.getBackgroundColour())
        self.bDelete.SetFont(font)
        self.bDelete.Enable(False)
        self.Bind(wx.EVT_BUTTON, self.doDelete, self.bDelete)
        bsz.Add(self.bDelete)
        self.bDelete.SetToolTipString("Remove the selected temperature sensor "
                                      "from the configuration.")

        sz.Add(bsz, pos=(1, 3))

        self.SetSizer(sz)
        self.enableAll(False)