예제 #1
0
    def initLayout(self):
        self.nls = []       
        self.nls.append(nl.NoteList(self.app, self.disp,
                                    {'x':self.cax - self.caxdim/2 + 2*d.px,'y':self.cay, 'xdim':10*d.px, 'ydim': 45*d.py},
                                    list = [],
                                    listName='REAL',
                                    hasFocus = True)
                        )
        self.nls.append(nl.NoteList(self.app, self.disp,
                                    {'x':self.cax - self.caxdim/2 + 13*d.px,'y':self.cay, 'xdim':10*d.px, 'ydim': 45*d.py},
                                    list = [],
                                    listName='ADC',
                                    hasFocus = True)
                        )

        self.infoBtnDefs = (
            {'label': 'REAL', 'id': REAL, 'value': '_','funct': None},
            {'label': 'ADC', 'id': ADC,'value': '_','funct': None},
            {'label': 'a', 'id': 'a','value': '_', 'funct': None},
            {'label': 'b', 'id': 'b','value': '_', 'funct': None}
        )

        self. infoBtns = []
        
        self.infoBtnsCols = (self.cax - self.caxdim/2 + 1*self.caxdim/8, self.cax - self.caxdim/2 + 3*self.caxdim/8,
                             self.cax - self.caxdim/2 + 5*self.caxdim/8, self.cax - self.caxdim/2 + 7*self.caxdim/8)
        self.infoBtnsRows = [self.cay + 42*d.py]

        self.numInfoBtnRow = len(self.infoBtnsRows)
        self.numInfoBtnCom = len(self.infoBtnsCols)
        for i in range(len(self.infoBtnDefs)):
            row = self.infoBtnsRows[i // self.numInfoBtnCom]
            col = self.infoBtnsCols[i % self.numInfoBtnCom]
            self.infoBtns.append(vb.ViewBtn(app = self.app,
                                            pos = (col, row),
                                            dim = (16*d.px, 14*d.py),
                                            label = self.infoBtnDefs[i]['label'],
                                            value = self.infoBtnDefs[i]['value'],
                                            id = self.infoBtnDefs[i]['id'],
                                            formating = lambda lab, val: lab + ':\n' +(str("%.2f" % val) if type(val) == type(0.0) else str(val)) + (self.sensorData['unit'] if self.infoBtnDefs[i]['id'] == REAL or self.infoBtnDefs[i]['id'] == ADC else '')
                                            )
                                 )
#             self.infoBtns.append(self.SettingBtn(self.app, {'x': col, 'y': row}, self.infoBtnDefs[i], self.sensorData['unit'] if self.infoBtnDefs[i]['label'] == REAL else ''))
        
        self.inPrRect = rl.RectLabel(app = self.app,
                             pos = (self.cax,  self.cay),
                             dim = (70*d.px, 70*d.py),
                             text = 'DATA COLLECTION\nIN PROGRESS',
                             font = self.app.viewTtlFont,
                             fontCol = self.app.font_col,
                             bcgCol = d.light_green,
                             scaleFactor = 0.7
                             )#in progress rectangle

        self.graph = self.app.testingView.graph
        self.graph.updatePlot(                    
                    xlabel = 'REAL ' + self.sensorType + ' [' + self.sensorData['unit'] + ']',
                    ylabel = self.sensorType + ' ADC'
)
예제 #2
0
 def replaceList(self, fieldType):
     l = [self.sensorData[fieldType]]
     self.nls[1] = (nl.NoteList(
         self.app, self.disp, {
             'x': self.cax + 16 * d.px,
             'y': self.cay,
             'xdim': 34 * d.px,
             'ydim': 50 * d.py
         }, l, self.nls[0].getItem(), False))
예제 #3
0
 def replaceList(self, l, folder):
     if folder is not None:
         self.folderList[1] = (nl.NoteList(
             self.app, self.disp, {
                 'x': self.cax + 14 * d.px,
                 'y': self.cay + 8 * d.py,
                 'xdim': 44 * d.px,
                 'ydim': 66 * d.py
             }, l, folder + ' Test files', False))
예제 #4
0
    def makeLists(self):
        with self.app.threadLock:
            self.focusNum = 0
            self.folderList = []

            if self.mode == 'Device':
                self.testsPath = os.path.join(d.RASPI_DATA_PATH, d.TESTS_DIR)
                l = self.getAllFolders()

            elif self.mode == 'USB':
                self.testsPath = os.path.join(d.USB_DATA_PATH, d.TESTS_DIR)
                if os.path.ismount(d.USB_DATA_PATH):
                    l = self.getAllFolders()
                else:
                    l = []

            self.folderList.append(
                nl.NoteList(
                    self.app, self.disp, {
                        'x': self.cax - 23 * d.px,
                        'y': self.cay + 8 * d.py,
                        'xdim': 28 * d.px,
                        'ydim': 66 * d.py
                    }, l, 'Test folders', True))

            if len(l):
                l = [
                    fullName[0:-4] for fullName in self.getAllFiles(
                        self.folderList[0].getItem())
                ]
                folderName = self.folderList[0].getItem()
            else:
                folderName = ''
            self.folderList.append(
                nl.NoteList(
                    self.app, self.disp, {
                        'x': self.cax + 14 * d.px,
                        'y': self.cay + 8 * d.py,
                        'xdim': 44 * d.px,
                        'ydim': 66 * d.py
                    }, l, folderName + ' Test files', False))
예제 #5
0
 def startList(self):
     self.noteLists = []
     self.noteLists.append(
         nl.NoteList(self.app,
                     self.disp, {
                         'x': self.cax,
                         'y': self.cay,
                         'xdim': 30 * d.px,
                         'ydim': 50 * d.py
                     },
                     listName='noteBank',
                     hasFocus=(self.focusNum == len(self.noteLists))))
예제 #6
0
    def initLists(self):
        self.nls = []

        self.nls.append(
            nl.NoteList(
                self.app, self.disp, {
                    'x': self.cax - 20 * d.px,
                    'y': self.cay,
                    'xdim': 28 * d.px,
                    'ydim': 50 * d.py
                }, d.SENSOR_FIELDS, 'Data field', True))

        l = [self.sensorData[self.nls[0].getItem()]]

        self.nls.append(
            nl.NoteList(
                self.app, self.disp, {
                    'x': self.cax + 20 * d.px,
                    'y': self.cay,
                    'xdim': 28 * d.px,
                    'ydim': 50 * d.py
                }, l, self.sensorData[self.nls[0].getItem()], False))
예제 #7
0
        def __init__(self,
                     app,
                     disp,
                     geoData,
                     list=None,
                     listName='',
                     focus=False,
                     metaData={}):
            self.app = app
            self.x = geoData['x']
            self.y = geoData['y']
            self.xdim = 1.2 * geoData['xdim']
            self.ydim = 1.5 * geoData['ydim']

            self.focus = focus
            self.disp = disp
            self.funct = metaData['funct']

            self.nl = nl.NoteList(app, disp, geoData, list, listName, False)

            self.setFocus(focus)
예제 #8
0
    def __init__(self, app, prevView=None):
        self.title = 'TESTING'
        self.btnDefs = [({
            'label': 'START',
            'id': 'startBtn',
            'funct': self.startTest
        }, {
            'label': 'TESTS',
            'id': 'testFilesBtn',
            'funct': self.toTestFiles
        }, {
            'label': 'EDIT',
            'id': 'editBtn',
            'funct': self.edit
        }, {
            'label': 'BACK',
            'id': 'bckBtn',
            'funct': self.back
        }),
                        ({}, {
                            'label': 'STOP',
                            'id': 'stopBtn',
                            'funct': self.stopTest
                        }, {}, {}),
                        ({
                            'label': 'BREAK\nHEIGHT',
                            'id': 'selectBtn',
                            'funct': self.setBreakHeight
                        }, {
                            'label': 'SELECT',
                            'id': 'selectBtn',
                            'funct': self.selectBtn
                        }, {}, {
                            'label': 'REJECT',
                            'id': 'bckBtn',
                            'funct': self.drop
                        })]
        self.saveBtnDef = {
            'label': 'SAVE',
            'id': 'saveBtn',
            'funct': self.save
        }
        super().__init__(app, prevView)

        self.streaming = False
        self.numBtnX = self.cax
        self.numBtnY = self.cay
        self.resetVectors()
        self.drawPots = False
        self.drawXY = False

        self.tests = 0

        self.startGraph()

        self.lastDataT = t.time()
        self.dataInt = 0.1
        self.inVals = 0
        self.tr = 0
        self.ta = 0

        self.initPreTestInfoLayout()

        self.inPrRect = rl.RectLabel(app=self.app,
                                     pos=(self.cax, self.cay),
                                     dim=(70 * d.px, 70 * d.py),
                                     text='TESTING\nIN PROGRESS',
                                     font=self.app.viewTtlFont,
                                     fontCol=self.app.font_col,
                                     bcgCol=d.light_green,
                                     scaleFactor=0.7)  #in progress rectangle

        self.postItems = []
        self.setPostItemFocusNum(0)

        self.envDataFlags = [0] * 4

        self.initConfMsgsShown = False

        self.postItems.append(
            nl.NoteList(self.app,
                        self.disp, {
                            'x': self.cax - 28 * d.px,
                            'y': self.cay,
                            'xdim': 20 * d.px,
                            'ydim': 25 * d.py
                        },
                        listName='postTestNotes',
                        hasFocus=True))

        self.postItems.append(
            vb.ViewBtn(app=self.app,
                       pos=(self.cax - 4 * d.px, self.cay + 42 * d.py),
                       dim=(22 * d.px, 12 * d.py),
                       label='Load',
                       value='F',
                       funct=self.switchLoadMode,
                       focus=False,
                       formating=lambda lab, val: lab + ': ' + str(val)))

        self.postItems.append(
            vb.ViewBtn(app=self.app,
                       pos=(self.cax + 22 * d.px, self.cay + 42 * d.py),
                       dim=(22 * d.px, 12 * d.py),
                       label='Rot.',
                       value='IMU',
                       funct=self.switchRotMode,
                       focus=False,
                       formating=lambda lab, val: lab + ': ' + str(val)))