0

我有一个给定的代码:

import wx

from application.gui.ctrls.panelCalibration.PanelGridCalibration import PanelGridCalibration
from lib.common.dataStructures.Value import ExpressionValue


class PanelValueCalibration(PanelGridCalibration):
    def __init__(self, parent, defaultValues, changeableSize=False):
        PanelGridCalibration.__init__(self, parent, defaultValues, False)
        self.grid.SetRowLabelSize(0)
        self.grid.SetColLabelSize(0)
        self.grid.SetDimension(1, 1)
        self.grid.Unbind(wx.grid.EVT_GRID_CELL_RIGHT_CLICK)
        wx.CallAfter(self.ExpandCell)

        self.DisableWriteByVariable()

    def ExpandCell(self):
        self.grid.SetColSize(0, self.grid.GetClientSize().x - 20)

    def SetDefaultValues(self, defaultValue):
        pass
        #self.grid.GetTable().SetDefaultValue(0, 0, defaultValue)

    def SetValues(self, value):
        self.grid.GetTable().SetValue(0, 0, value.GetValue())

    def OnGridDimensionChanged(self, oldDimension, newDimension):
        pass

    def GetValues(self):
        return ExpressionValue(self.grid.GetCellValue(0, 0))

    def CheckInput(self):
        if self.GetValues().GetValue() == None:
            self.ShowErrorDialog(_(u"Kein Wert zum Schreiben angegeben!"))
            return False
        return True

如您所见,PanelValueCalibration继承自PanelGridCalibration. 但是,我想修改PanelValueCalibration为使用 aTextCtrl而不是 a GridCtrl。我看到有一个ExpressionTextCtrl类,但我不知道如何将它导入到我的PanelValueCalibration类中。

编辑:我已经插入:

from application.gui.ctrls.ExpressionCtrls import ExpressionTextCtrl

但不知道如何init正确定义:

class PanelValueCalibration(ExpressionTextCtrl):
    def __init__(self, parent, defaultValues, changeableSize=False):
        ExpressionTextCtrl.__init__(self, parent, defaultValues, False)
4

0 回答 0