Пример #1
0
    def test_imgGetterUTCOffSet(self):
        ## Test int
        tests = range(-12, 12)

        for test in tests:
            result = CellEdit(self.parent, self.serviceManager, self.recordService)\
                .imgGetterUTCOFFset(Points(utcOffSet=str(test)))
            if result == "error":
                assert False
            else:
                assert True
Пример #2
0
    def test_imgGetterDate(self):
        tests = [u'1973-12-15', u'2016-2-29', u'2016-02-29', u'2013-1-1']

        for test in tests:
            result = CellEdit(self.parent, self.serviceManager, self.recordService)\
                .imgGetterDate(Points(date=test))
            if result == "error":
                assert False
            else:
                assert True

        failTests = [u'1999-90-9', u'12/12/2012']

        for test in failTests:
            result = CellEdit(self.parent, self.serviceManager, self.recordService)\
                .imgGetterTime(Points(time=test))
            if result == "error":
                assert True
            else:
                assert False
Пример #3
0
    def test_imgGetterDataValue(self):
        ## Test unicode, int, float,
        tests = [u'-9999', 10, 14.5, -9999]

        for test in tests:
            result = CellEdit(self.parent, self.serviceManager, self.recordService)\
                .imgGetterDataValue(Points(dataValue=test))
            if result == "error":
                assert False
            else:
                assert True
Пример #4
0
    def test_imgGetterOffsetValue(self):
        ## Test int, float, NULL
        import numpy as np
        tests = np.arange(-100, 100, 0.1).tolist() + ["NULL"] + range(-100, 100)

        for test in tests:
            result = CellEdit(self.parent, self.serviceManager, self.recordService)\
                .imgGetterOffSetValue(Points(offSetValue=str(test)))
            if result == "error":
                assert False
            else:
                assert True
Пример #5
0
    def test_imgGetterTime(self):
        tests = [u'00:00:00', u'0:0:0', u'23:00:00', u'12:00:12', "00:00:00"]

        for test in tests:
            result = CellEdit(self.parent, self.serviceManager, self.recordService)\
                .imgGetterTime(Points(time=test))
            if result == "error":
                assert False
            else:
                assert True

        failTests = [u'Hello', u'a2:s3:s4', u'00:oo:00', u'♣☺☻♥', u'00:♦:00', u'26:05:50',
                     u'12:90:00', u'12:40:80', u'-0:-3:-1']

        for test in failTests:
            result = CellEdit(self.parent, self.serviceManager, self.recordService)\
                .imgGetterTime(Points(time=test))
            if result == "error":
                assert True
            else:
                assert False
Пример #6
0
    def __init__(self, *args, **kwargs):
        """

        :param args:
        :param kwargs:
        :return:
        """

        try:
            self.serviceManager = kwargs.pop("serviceManager")
        except:
            self.serviceManager = None
        try:
            self.recordService = kwargs.pop("recordService")
        except:
            self.recordService = None

        FastObjectListView.__init__(self, *args, **kwargs)

        cellEdit = CellEdit(self, self.serviceManager, self.recordService)

        self.checkedObjects = []

        # # Custom Image Getters
        self.imgGetterDataValue = cellEdit.imgGetterDataValue
        self.imgGetterDate = cellEdit.imgGetterDate
        self.imgGetterTime = cellEdit.imgGetterTime
        self.imgGetterCensorCode = cellEdit.imgGetterCensorCode
        self.imgGetterUTCOffset = cellEdit.imgGetterUTCOFFset
        self.imgGetterValueAcc = cellEdit.imgGetterValueAcc
        self.imgGetterlabSample = cellEdit.imgGetterLabSampleCode
        self.imgGetterQualifier = cellEdit.imgGetterQualifierCode
        self.imgGetterOffSetType = cellEdit.imgGetterOffSetType
        self.imgGetterOffSetValue = cellEdit.imgGetterOffSetValue

        ## Custom Value Setters
        ## Sets the value, can modify rules for setting value
        self.valueSetterDataValue = cellEdit.valueSetterDataValue
        self.valueSetterUTCOffset = cellEdit.valueSetterUTCOffset

        ## Custom String Converters
        ## Changes how the string will appear in the cell after editing
        self.localtime2Str = cellEdit.strConverterLocalTime
        self.str2DataValue = cellEdit.strConverterDataValue
        self.utcOffSet2Str = cellEdit.strConverterUTCOffset
        self.offSetValue2Str = cellEdit.strConverterOffSetValue

        ## Custom CellEditors
        ## Custom cell editors for each cell
        self.dateEditor = cellEdit.dateEditor
        self.timeEditor = cellEdit.localTimeEditor
        self.censorEditor = cellEdit.censorCodeEditor
        self.offSetTypeEditor = cellEdit.offSetTypeEditor
        self.qualifierCodeEditor = cellEdit.qualifierCodeEditor
        self.labSampleEditor = cellEdit.labSampleCodeEditor

        self.SetEmptyListMsg("Add points either by csv or by adding a new row")
        self.AddNamedImages("error", x_mark_16.GetBitmap(),
                            x_mark_32.GetBitmap())
        self.AddNamedImages("star", star_16.GetBitmap(), star_32.GetBitmap())
        self.AddNamedImages("check", check_mark_3_16.GetBitmap(),
                            check_mark_3_32.GetBitmap())

        self.buildOlv()

        self.useAlternateBackColors = True
        self.oddRowsBackColor = wx.Colour(191, 239, 255)
        self.cellEditMode = self.CELLEDIT_DOUBLECLICK