def initLayout(self): self.setPostItemFocusNum(0) # self.postStnBtnDefs = ( # {'label': 'Load', 'value': 'F','funct': self.switchLoadMode}, # {'label': 'Rotation', 'value': 'IMU','funct': self.switchRotMode} # ) self.postItems = [] #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=True, 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)))
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' )
def addStnBtns(self): self.stnBtns = [] for i in range(len(self.stnBtnDefs)): row = self.stnBtnsRows[i // 3] col = self.stnBtnsCols[i % 3] self.stnBtns.append( vb.ViewBtn(app=self.app, pos=(col, row), dim=(22 * d.px, 18 * d.py), label=self.stnBtnDefs[i]['label'], funct=self.stnBtnDefs[i]['funct'], focus=i == self.stnBtnFocusNum), )
def addStnBtns(self): self.stnBtns = [] for i in range(len(self.stnBtnDefs)): row = self.stnBtnsRows[i // self.numStnBtnCom] col = self.stnBtnsCols[i % self.numStnBtnRow] self.stnBtns.append( vb.ViewBtn(app=self.app, pos=(col, row), dim=(24 * d.px, 24 * d.py), label=self.stnBtnDefs[i]['label'], value='N/A', font=self.app.lvVbFONT, formating=lambda lab, val: lab + ':\n' + str(val), txtMode='mpte'))
def addStnBtns(self): self.stnBtns = [] for i in range(len(self.stnBtnDefs)): row = self.stnBtnsRows[i // 3] col = self.stnBtnsCols[i % 3] stnBtn = vb.ViewBtn(app=self.app, pos=(col, row), dim=(13 * d.px, 10 * d.px), label=self.stnBtnDefs[i]['label'], id=self.stnBtnDefs[i]['id'], value=self.colors[i // 3][i % 3] / 255.0, focus=i == self.stnBtnFocusNum, formating=lambda lab, val: lab[2:] + '\n' + lab[0] + ': ' + str("%0.1f" % val)) # stnBtn = self.SettingBtn(self.app, {'x': col, 'y': row}, self.stnBtnDefs[i],i == self.stnBtnFocusNum) # stnBtn.setValue(self.colors[i // 3][i % 3]/255.0) self.stnBtns.append(stnBtn)
def addViewBtns(self): self.viewBtns = [] for i in range(len(self.viewBtnDefs)): row = self.viewBtnsRows[i // self.numViewBtnCom] col = self.viewBtnsCols[i % self.numViewBtnRow] self.viewBtns.append( vb.ViewBtn( app=self.app, pos=(col, row), dim=(32 * d.px, 18 * d.py), label=self.viewBtnDefs[i]['label'], value='N/A', funct=self.viewBtnDefs[i]['funct'], focus=False, formating=lambda lab, val: lab + ':\n' + str(val) #, # txtMode = 'mpte' ))
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)))
def initPreTestInfoLayout(self): self.setItemFocusNum(0) self.cols = [self.cax - 20 * d.px, self.cax + 20 * d.px] self.items = [] yRef = 26 * d.py yInt = 20 * d.py self.columns = 2 self.rows = 4 self.items.append( vb.ViewBtn(app=self.app, pos=(self.cols[0], self.cay - yRef + 0 * yInt), dim=(28 * d.px, 18 * d.py), label='FOLDER', value=self.app.getSetting(d.TEST_FOLDER), funct=self.toTestFolderSetting, focus=True, formating=lambda lab, val: lab + ':\n' + str(val))) self.items.append( self.NoteListWrapper(self.app, self.disp, { 'x': self.cols[1], 'y': self.cay - 16 * d.py, 'xdim': 24 * d.px, 'ydim': 18 * d.py }, listName='preTestNotes', focus=False, metaData={'funct': self.toNoteSetting})) self.items.append( vb.ViewBtn(app=self.app, pos=(self.cols[0], self.cay - yRef + 1 * yInt), dim=(28 * d.px, 18 * d.py), label='PLOT #', value=self.app.getSetting(d.TEST_PLOT), funct=self.toPlotSetting, focus=False, formating=lambda lab, val: lab + ':\n' + str(val))) self.items.append(None) self.items.append( vb.ViewBtn(app=self.app, pos=(self.cols[0], self.cay - yRef + 2 * yInt), dim=(28 * d.px, 18 * d.py), label='HEIGHT', value=self.app.getSetting(d.TEST_HEIGHT), funct=self.toHeightSetting, focus=False, formating=lambda lab, val: lab + ':\n' + str(val))) self.items.append( self.NoteListWrapper(self.app, self.disp, { 'x': self.cols[1], 'y': self.cay + 22 * d.py, 'xdim': 24 * d.px, 'ydim': 18 * d.py }, listName='postTestNotes', focus=False, metaData={'funct': self.toNoteSetting})) self.items.append( vb.ViewBtn(app=self.app, pos=(self.cols[0], self.cay - yRef + 3 * yInt), dim=(28 * d.px, 18 * d.py), label='OPERATOR', value=self.app.getSetting(d.OPERATOR), funct=self.setOperator, focus=False, formating=lambda lab, val: lab + ':\n' + str(val))) self.items.append(None)