def __init__(self, canvas, controller): super(ModeMenu, self).__init__(canvas, 'mode', 'Mode Selection') # Store controller instance self.controller = controller #Store modes from config to populate modemenu with self.modes = config.MenuConfig.Modes self.getPanel().fontSize(50) ########################## """creating modes panel""" ########################## #creating labels for modes self.modeLabels = {} for l in self.modes.iterkeys(): self.modeLabels[l] = viz.addText(l, parent=canvas) #creating radio buttons for modes self.modeGroup = viz.addGroup(parent=canvas) self.radioButtons = {} for rb in self.modes.iterkeys(): self.radioButtons[rb] = viz.addRadioButton(self.modeGroup, parent=canvas) self.radioButtons['Free Play'].set(1) #creating grid panel to add mode to modeGrid = vizdlg.GridPanel(parent=canvas) #adding modes and radio buttons to grid panel for i in self.modes.iterkeys(): modeGrid.addRow([self.modeLabels[i], self.radioButtons[i]]) ############################## """next and back buttons""" ############################## #creating grid panels to add next and back buttons to setGrid = vizdlg.GridPanel(parent=canvas) #create back and next buttons and add to grid panel backButton = viz.addButtonLabel('Back') startButton = viz.addButtonLabel('Next') setGrid.addRow([backButton, startButton]) #add back and state button actions self.backward = vizact.onbuttondown(backButton, self.controller.backMenu) self.forward = vizact.onbuttondown(startButton, self.controller.nextMenu) ############################### """add items to ModeMenu""" ############################### self.addItem(modeGrid) self.addItem(setGrid)
def __init__(self, canvas, controller): # Add Virtual Mouse canvas.setMouseStyle(viz.CANVAS_MOUSE_VIRTUAL) # Store controller instance self.controller = controller """initialize the Main menu""" super(MainMenu, self).__init__(canvas, 'main', 'Main Menu', True) # add play button, play button action, and scroll over animation self.play = self.addItem(viz.addButtonLabel('Play'), fontSize = 50) vizact.onbuttondown(self.play, self.controller.nextMenu) # add options button row self.Help = self.addItem(viz.addButtonLabel('Help'), fontSize = 50) vizact.onbuttondown(self.Help, self.helpButton) # add help button row self.Exit = self.addItem(viz.addButtonLabel('Exit'), fontSize = 50) vizact.onbuttondown(self.Exit, self.controller.exitGame) # #rendering # bb = self.getBoundingBox() # self.canvas.setRenderWorldOverlay([bb.width*1.8, bb.height*1.8], fov = bb.height*.1, distance = 3) #change scale depending on display mode self.setScale(*[i*config.menuScale[self.name] for i in [1,1,1]])
def __init__(self, canvas): vizinfo.InfoPanel.__init__(self, '', title='In Game', fontSize=100, align=viz.ALIGN_CENTER_CENTER, icon=False, parent=canvas) self.name = 'ingame' self.canvas = canvas self.active = False self.getPanel().fontSize(50) self.setPanelVisible(viz.OFF, animate=False) self.menuVisible = False self.restart = self.addItem(viz.addButtonLabel('Restart')) self.end = self.addItem(viz.addButtonLabel('End game')) #Callbacks vizact.onbuttondown(self.restart, self.restartButton) vizact.onbuttondown(self.end, self.endButton) #change scale depending on display mode self.setScale(*[i * config.menuScale[self.name] for i in [1, 1, 1]])
def __init__(self): # create simple GUI window with buttons for: pause, continue and a window to print strings self.pause_button = viz.addButtonLabel('pause Experiment') self.pause_button.setPosition(.5, .7) self.pause_button.setScale(2, 2) self.continue_button = viz.addButtonLabel('continue Experiment') self.continue_button.setPosition(.5, .5) self.continue_button.setScale(2, 2) self.text_screen = viz.addText('current marker:', viz.SCREEN) self.text_screen.setPosition(.25, .3) self.marker_field = viz.addButtonLabel('markers') self.marker_field.setPosition(.5, .2) self.marker_field.setScale(2, 2) # register callbacks for GUI to either pause or continue function viz.callback(viz.BUTTON_EVENT, self.on_button_press) # create network outlet self.connection_to_vr_machine = viz.addNetwork('BPN-C043') # register callback for network event handling viz.callback(viz.NETWORK_EVENT, self.write) # send behavioral to LSL stream (saved extra for faster testing of behavioral data) # create and start LSL marker stream self.behavior_stream_info = StreamInfo('BehavioralMarkerStream', 'Markers', 1, 0, 'string', socket.gethostname()) self.behavior_stream = StreamOutlet(self.behavior_stream_info)
def __init__(self, canvas): """initialize the Main menu""" vizinfo.InfoPanel.__init__(self, '', fontSize = 100, parent = canvas, align = viz.ALIGN_CENTER_CENTER, \ title = 'Main Menu', icon = False) # Since we are using the vizard pointer, hide system mouse viz.mouse.setVisible(False) viz.mouse.setTrap(True) self.menuVisible = True self.canvas = canvas self.active = True self.name = 'main' # add play button, play button action, and scroll over animation self.play = self.addItem(viz.addButtonLabel('Play'), fontSize=50) vizact.onbuttondown(self.play, self.playButton) # add options button row self.help = self.addItem(viz.addButtonLabel('Help'), fontSize=50) vizact.onbuttondown(self.help, self.helpButton) # add help button row self.exit = self.addItem(viz.addButtonLabel('Exit'), fontSize=50) vizact.onbuttondown(self.exit, self.exitButton) # #rendering # bb = self.getBoundingBox() # self.canvas.setRenderWorldOverlay([bb.width*1.8, bb.height*1.8], fov = bb.height*.1, distance = 1) #change scale depending on display mode self.setScale(*[i * config.menuScale[self.name] for i in [1, 1, 1]])
def __init__(self, canvas): """initialize the Main menu""" vizinfo.InfoPanel.__init__(self, '', fontSize = 100, parent = canvas, align = viz.ALIGN_CENTER_CENTER, \ title = 'Main Menu', icon = False) # Since we are using the vizard pointer, hide system mouse viz.mouse.setVisible(False) viz.mouse.setTrap(True) self.menuVisible = True self.canvas = canvas self.active = True self.name = 'main' # add play button, play button action, and scroll over animation self.play = self.addItem(viz.addButtonLabel('Play'), fontSize = 50) vizact.onbuttondown(self.play, self.playButton) # add options button row self.help = self.addItem(viz.addButtonLabel('Help'), fontSize = 50) vizact.onbuttondown(self.help, self.helpButton) # add help button row self.exit = self.addItem(viz.addButtonLabel('Exit'), fontSize = 50) vizact.onbuttondown(self.exit, self.exitButton) # #rendering # bb = self.getBoundingBox() # self.canvas.setRenderWorldOverlay([bb.width*1.8, bb.height*1.8], fov = bb.height*.1, distance = 1) #change scale depending on display mode self.setScale(*[i*config.menuScale[self.name] for i in [1,1,1]])
def __init__(self, canvas, controller): # Add Virtual Mouse canvas.setMouseStyle(viz.CANVAS_MOUSE_VIRTUAL) # Store controller instance self.controller = controller """initialize the Main menu""" super(MainMenu, self).__init__(canvas, 'main', 'Main Menu', True) # add play button, play button action, and scroll over animation self.play = self.addItem(viz.addButtonLabel('Play'), fontSize=50) vizact.onbuttondown(self.play, self.controller.nextMenu) # add options button row self.Help = self.addItem(viz.addButtonLabel('Help'), fontSize=50) vizact.onbuttondown(self.Help, self.helpButton) # add help button row self.Exit = self.addItem(viz.addButtonLabel('Exit'), fontSize=50) vizact.onbuttondown(self.Exit, self.controller.exitGame) # #rendering # bb = self.getBoundingBox() # self.canvas.setRenderWorldOverlay([bb.width*1.8, bb.height*1.8], fov = bb.height*.1, distance = 3) #change scale depending on display mode self.setScale(*[i * config.menuScale[self.name] for i in [1, 1, 1]])
def __init__(self, canvas, controller): super(ModeMenu, self).__init__(canvas, 'mode', 'Mode Selection') # Store controller instance self.controller = controller #Store modes from config to populate modemenu with self.modes = config.MenuConfig.Modes self.getPanel().fontSize(50) ########################## """creating modes panel""" ########################## #creating labels for modes self.modeLabels = {} for l in self.modes.iterkeys(): self.modeLabels[l] = viz.addText(l, parent = canvas) #creating radio buttons for modes self.modeGroup = viz.addGroup(parent = canvas) self.radioButtons = {} for rb in self.modes.iterkeys(): self.radioButtons[rb] = viz.addRadioButton(self.modeGroup, parent = canvas) self.radioButtons['Free Play'].set(1) #creating grid panel to add mode to modeGrid = vizdlg.GridPanel(parent = canvas) #adding modes and radio buttons to grid panel for i in self.modes.iterkeys(): modeGrid.addRow([self.modeLabels[i], self.radioButtons[i]]) ############################## """next and back buttons""" ############################## #creating grid panels to add next and back buttons to setGrid = vizdlg.GridPanel(parent = canvas) #create back and next buttons and add to grid panel backButton = viz.addButtonLabel('Back') startButton = viz.addButtonLabel('Next') setGrid.addRow([backButton, startButton]) #add back and state button actions self.backward = vizact.onbuttondown(backButton, self.controller.backMenu) self.forward = vizact.onbuttondown(startButton, self.controller.nextMenu) ############################### """add items to ModeMenu""" ############################### self.addItem(modeGrid) self.addItem(setGrid)
def CreateLabelledPanel(): panel = vizdlg.GridPanel(cellAlign=vizdlg.ALIGN_CENTER_TOP,border=False,spacing=0,padding=1,background=False,margin=0) diameterLabel = viz.addButtonLabel('d (mm)') thicknessLabel = viz.addButtonLabel('t (mm)') lengthLabel = viz.addButtonLabel('l (m)') quantityLabel = viz.addButtonLabel('qty') deleteLabel = viz.addButtonLabel('') headerRow = panel.addRow([diameterLabel,thicknessLabel,lengthLabel,quantityLabel,deleteLabel]) return panel
def __init__(self,canvas,controller): super(InGameMenu, self).__init__(canvas, 'ingame', 'In Game Menu') # Store controller instance self.controller = controller #menu buttons self.restart = self.addItem(viz.addButtonLabel('Restart'), fontSize = 50) self.end = self.addItem(viz.addButtonLabel('End game'), fontSize = 50) #Callbacks vizact.onbuttondown(self.restart, self.controller.restart) vizact.onbuttondown(self.end, self.controller.endGame) #change scale depending on display mode self.setScale(*[i*config.menuScale[self.name] for i in [1,1,1]])
def __init__(self, canvas, controller): super(InGameMenu, self).__init__(canvas, 'ingame', 'In Game Menu') # Store controller instance self.controller = controller #menu buttons self.restart = self.addItem(viz.addButtonLabel('Restart'), fontSize=50) self.end = self.addItem(viz.addButtonLabel('End game'), fontSize=50) #Callbacks vizact.onbuttondown(self.restart, self.controller.restart) vizact.onbuttondown(self.end, self.controller.endGame) #change scale depending on display mode self.setScale(*[i * config.menuScale[self.name] for i in [1, 1, 1]])
def displayInputPanel(): global inputPanel, names inputPanel = viz.addGUIGroup() # endG = viz.addGroup(viz.SCREEN) splashScreen = viz.addTexQuad(parent=viz.SCREEN,pos=[0.5,0.5,0],scale=[13,10.5,1]) splashScreen.texture(viz.addTexture('textures/splash_screen'+LANG+'.jpg')) splashScreen.setParent(inputPanel) names = [] pl = range(condition%2*2+1) pl.reverse() for i,p in enumerate(pl): name = viz.addTextbox() nameText = {'':'Player %s name:', 'GR':'Όνομα παίκτη %s:'} title = viz.addText(nameText[LANG]%str(i+1), viz.SCREEN) title.fontSize(24) title.addParent(inputPanel) title.setPosition([.4, .53+.1*p, 0]) name.setPosition([.5, .5+.1*p, 0]) name.addParent(inputPanel) names.append(name) startB = viz.addButtonLabel('START') startB.setPosition(.5,.4) startB.addParent(inputPanel) vizact.onbuttonup(startB, initialize)
def participantInfo(): #Add an InfoPanel with a title bar participantInfo = vizinfo.InfoPanel('', title='Participant Information', align=viz.ALIGN_CENTER, icon=False) #Add name and ID fields textbox_nr = participantInfo.addLabelItem('NR', viz.addTextbox()) participantInfo.addSeparator() textbox_id = participantInfo.addLabelItem('ID', viz.addTextbox()) participantInfo.addSeparator() #Add submit button aligned to the right and wait until it's pressed submitButton = participantInfo.addItem(viz.addButtonLabel('Submit'), align=viz.ALIGN_RIGHT_CENTER) yield viztask.waitButtonUp(submitButton) #Collect participant data exp.pp_nr = "%02d" % (int(textbox_nr.get()), ) exp.pp_id = textbox_id.get() pr.pp_nr = exp.pp_nr pr.pp_id = exp.pp_id participantInfo.remove()
def __init__(self): viz.EventClass.__init__(self) self.done = viztask.Signal() self.callback(viz.BUTTON_EVENT, self.onButton) self.rowantext = """ Charactor Creation Enter Your Charactor's name: """ vizcam.PivotNavigate(center=[15, -10, 0], distance=70, sensitivity=[1.0, 1.0]) self.text_2D_world = viz.addText(self.rowantext, pos=[2, 2, 2], scene=2) self.myButton2 = viz.addButtonLabel('Done!', scene=2) #Add a button. self.myButton2.setPosition(.5, .5) #Set its position. self.myButton2.setScale(1, 1) #Scale it. #Add a text box. self.box = viz.addTextbox(scene=2) #self.box.message('default') #Make it twice as long. self.box.length(2) #Place it in window. self.box.setPosition(.5, .8) #Have it grow when text reaches its boundary. self.box.overflow(viz.OVERFLOW_GROW)
def delete3DNote1(): noteNummer = textBox.get() infoBox.remove() def removeNotePanel(): notePanel.remove() okButton.remove() globalVariables.windowOpen = False try: if (int(noteNummer)>0): noteList[int (noteNummer)-1].remove() del noteList[int (noteNummer)-1] #Lösche 3D Notiz globalVariables.windowOpen = False else: raise except: notePanel = vizinfo.InfoPanel("Bitte nur Nummern im Bereich\nder verfĂ¼gbaren 3D Notizen eingeben.",align=viz.ALIGN_CENTER,fontSize=25,icon=False,key=None) notePanel.visible(True) #Erschaffe Bestätigungsbutton okButton = viz.addButtonLabel("Ok") okButton.setPosition(0.5,0.40) okButton.setScale(1,1) vizact.onbuttondown(okButton,removeNotePanel)
def porten(): #Position abfragen und infobox entfernen checkPointNummer = portBox.get() infoBox.remove() def removeCheckPointsPanel(): checkPointsPanel.remove() okButton.remove() globalVariables.windowOpen = False try: if (int(checkPointNummer)>0): #PrĂ¼fe eingabe und porte position = checkPointsList[int(checkPointNummer)-1] viz.MainView.setPosition(position[0], position[1], position[2]) tracker.setPosition(position[0], position[1], position[2]) else: raise except: checkPointsPanel = vizinfo.InfoPanel("Bitte nur Nummern im Bereich\nder verfĂ¼gbaren Checkpoints eingeben.",align=viz.ALIGN_CENTER,fontSize=25,icon=False,key=None) checkPointsPanel.visible(True) #Erschaffe Bestätigungsbutton okButton = viz.addButtonLabel("Ok") okButton.setPosition(0.5,0.40) okButton.setScale(1,1) vizact.onbuttondown(okButton,removeCheckPointsPanel)
def porten2(): #Position abfragen und infobox posiX = posiXBox.get() posiY = posiYBox.get() posiZ = posiZBox.get() infoBox.remove() def removePortPanel(): checkPointsPanel.remove() okButton.remove() globalVariables.windowOpen = False try: ###Kolissionserkennung einbauen### viz.MainView.setPosition(float(posiX), float(posiY), float(posiZ)) tracker.setPosition(float(posiX), float(posiY), float(posiZ)) globalVariables.windowOpen = False except: #####Noch Ă¼berarbeiten### checkPointsPanel = vizinfo.InfoPanel("Fehler",align=viz.ALIGN_CENTER,fontSize=25,icon=False,key=None) checkPointsPanel.visible(True) #Erschaffe Bestätigungsbutton okButton = viz.addButtonLabel("Ok") okButton.setPosition(0.5,0.40) okButton.setScale(1,1) vizact.onbuttondown(okButton,removePortPanel)
def getParticipantInfo(): #Add an InfoPanel with a title bar participantInfo = vizinfo.InfoPanel('', title='Participant Information', align=viz.ALIGN_CENTER, icon=False) #Add name and ID fields textbox_last = participantInfo.addLabelItem('Last Name', viz.addTextbox()) textbox_first = participantInfo.addLabelItem('First Name', viz.addTextbox()) textbox_id = participantInfo.addLabelItem('ID', viz.addTextbox()) participantInfo.addSeparator(padding=(20, 20)) #Add gender and age fields radiobutton_male = participantInfo.addLabelItem('Male', viz.addRadioButton(0)) radiobutton_female = participantInfo.addLabelItem('Female', viz.addRadioButton(0)) droplist_age = participantInfo.addLabelItem('Age Group', viz.addDropList()) ageList = ['20-30', '31-40', '41-50', '51-60', '61-70'] droplist_age.addItems(ageList) participantInfo.addSeparator(padding=(20, 20)) #Add 2d 3D fields radiobutton_2D = participantInfo.addLabelItem('2D', viz.addRadioButton(1)) radiobutton_3D = participantInfo.addLabelItem('3D', viz.addRadioButton(1)) participantInfo.addSeparator(padding=(20, 20)) #Add submit button aligned to the right and wait until it's pressed submitButton = participantInfo.addItem(viz.addButtonLabel('Submit'), align=viz.ALIGN_RIGHT_CENTER) yield viztask.waitButtonUp(submitButton) #Collect participant data data = viz.Data() data.lastName = textbox_last.get() data.firstName = textbox_first.get() data.id = textbox_id.get() data.ageGroup = ageList[droplist_age.getSelection()] if radiobutton_male.get() == viz.DOWN: data.gender = 'male' else: data.gender = 'female' if radiobutton_2D.get() == viz.DOWN: data.environment = '2D' else: data.environment = '3D' participantInfo.remove() # Return participant data viztask.returnValue(data)
def __init__(self,canvas): vizinfo.InfoPanel.__init__(self, '',title='In Game',fontSize = 100,align=viz.ALIGN_CENTER_CENTER,icon=False,parent=canvas) self.name = 'ingame' self.canvas = canvas self.active = False self.getPanel().fontSize(50) self.setPanelVisible(viz.OFF, animate = False) self.menuVisible = False self.restart = self.addItem(viz.addButtonLabel('Restart')) self.end = self.addItem(viz.addButtonLabel('End game')) #Callbacks vizact.onbuttondown(self.restart, self.restartButton) vizact.onbuttondown(self.end, self.endButton) #change scale depending on display mode self.setScale(*[i*config.menuScale[self.name] for i in [1,1,1]])
def getParticipantInfo(): #Add an InfoPanel with a title bar participantInfo = vizinfo.InfoPanel('',title='Participant Information',align=viz.ALIGN_CENTER, icon=False) #Add name and ID fields textbox_last = participantInfo.addLabelItem('Last Name',viz.addTextbox()) textbox_first = participantInfo.addLabelItem('First Name',viz.addTextbox()) textbox_id = participantInfo.addLabelItem('ID',viz.addTextbox()) participantInfo.addSeparator(padding=(20,20)) #Add gender and age fields radiobutton_male = participantInfo.addLabelItem('Male',viz.addRadioButton(0)) radiobutton_female = participantInfo.addLabelItem('Female',viz.addRadioButton(0)) droplist_age = participantInfo.addLabelItem('Age Group',viz.addDropList()) ageList = ['20-30','31-40','41-50','51-60','61-70'] droplist_age.addItems(ageList) participantInfo.addSeparator(padding=(20,20)) #Add 2d 3D fields radiobutton_2D = participantInfo.addLabelItem('2D',viz.addRadioButton(1)) radiobutton_3D = participantInfo.addLabelItem('3D',viz.addRadioButton(1)) participantInfo.addSeparator(padding=(20,20)) #Add submit button aligned to the right and wait until it's pressed submitButton = participantInfo.addItem(viz.addButtonLabel('Submit'),align=viz.ALIGN_RIGHT_CENTER) yield viztask.waitButtonUp(submitButton) #Collect participant data data = viz.Data() data.lastName = textbox_last.get() data.firstName = textbox_first.get() data.id = textbox_id.get() data.ageGroup = ageList[droplist_age.getSelection()] if radiobutton_male.get() == viz.DOWN: data.gender = 'male' else: data.gender = 'female' if radiobutton_2D.get() == viz.DOWN: data.environment = '2D' else: data.environment = '3D' participantInfo.remove() # Return participant data viztask.returnValue(data)
def __init__(self): viz.EventClass.__init__(self) self.callback(viz.BUTTON_EVENT, self.onButton) self.rowantext = """ _____ _____ _ _ | __ |___ _ _ _ ___ ___ |__ |___ _____| |_|_|___ | -| . | | | | .'| | | __| . | | . | | -_| |__|__|___|_____|__,|_|_| |_____|___|_|_|_|___|_|___| _____ _ _ _____ _ _ | __|_ _ ___ _ _|_|_ _ ___| | | __|_ _|_|_| |___ |__ | | | _| | | | | | .'| | | | | | | | . | -_| |_____|___|_| \_/|_|\_/|__,|_| |_____|___|_|___|___| May 2004: Electrical and Computer Engineering Students work on a new bio-algorithm to create zombies for the Biology Department. July 2004: The Biology Department finds a major bug in the algorithm, and expects them to all die off, so he hides them under the Engineering Building. Feb 2014: The Zombies are still alive. Due to the Engineering Building sinking 6 inches, the Zombies are extremely uncomfortable and ESCAPE. Instructions: Fight off the zombies to get to the roof of the Engineering Building. From there, you will zipline to the Science Building where the Biology Department can give you a cure. Make sure to grab objects along the way, so you can increase your power and toughness GOOD LUCK. No pressure, just all of our lives depend on you """ vizcam.PivotNavigate(center=[15, -10, 0], distance=70, sensitivity=[1.0, 1.0]) self.text_2D_world = viz.addText(self.rowantext, pos=[2, 2, 2]) self.myButton = viz.addButtonLabel('continue', scene=1) #Add a button. self.myButton.setPosition(.5, .8) #Set its position. self.myButton.setScale(1, 1) #Scale it. self.done = viztask.Signal()
def participantInfo(): info.visible(viz.OFF) participantInfo = vizinfo.InfoPanel('',title='Participant Information',align=viz.ALIGN_CENTER, icon=False) textbox_last = participantInfo.addLabelItem('Last Name',viz.addTextbox()) textbox_first = participantInfo.addLabelItem('First Name',viz.addTextbox()) textbox_id = participantInfo.addLabelItem('ID',viz.addTextbox()) participantInfo.addSeparator(padding=(20,20)) submitButton = participantInfo.addItem(viz.addButtonLabel('Submit'),align=viz.ALIGN_RIGHT_CENTER) yield viztask.waitButtonUp(submitButton) data = viz.Data() data.lastName = textbox_last.get() data.firstName = textbox_first.get() data.id = textbox_id.get() participantInfo.remove() viztask.returnValue(data)
def participantInfo(): manager.setDebug(viz.OFF) debugEventHandle.setEnabled(viz.OFF) # Hide info panel currently displayed info.visible(viz.OFF) # Add an InfoPanel with a title bar participantInfo = vizinfo.InfoPanel("", title="Participant Information", align=viz.ALIGN_CENTER, icon=False) # Add name and ID fields textbox_last = participantInfo.addLabelItem("Last Name", viz.addTextbox()) textbox_first = participantInfo.addLabelItem("First Name", viz.addTextbox()) textbox_id = participantInfo.addLabelItem("ID", viz.addTextbox()) participantInfo.addSeparator(padding=(20, 20)) # Add gender and age fields radiobutton_male = participantInfo.addLabelItem("Male", viz.addRadioButton(0)) radiobutton_female = participantInfo.addLabelItem("Female", viz.addRadioButton(0)) droplist_age = participantInfo.addLabelItem("Age Group", viz.addDropList()) ageList = ["20-30", "31-40", "41-50", "51-60", "61-70"] droplist_age.addItems(ageList) participantInfo.addSeparator() # Add submit button aligned to the right and wait until it's pressed submitButton = participantInfo.addItem(viz.addButtonLabel("Submit"), align=viz.ALIGN_RIGHT_CENTER) yield viztask.waitButtonUp(submitButton) # Collect participant data data = viz.Data() data.lastName = textbox_last.get() data.firstName = textbox_first.get() data.id = textbox_id.get() data.ageGroup = ageList[droplist_age.getSelection()] if radiobutton_male.get() == viz.DOWN: data.gender = "male" else: data.gender = "female" participantInfo.remove() # Return participant data viztask.returnValue(data)
def participantInfo(): #Turn off visibility of proximity sensors and disable toggle manager.setDebug(viz.OFF) debugEventHandle.setEnabled(viz.OFF) #Hide info panel currently displayed info.visible(viz.OFF) #Add an InfoPanel with a title bar participantInfo = vizinfo.InfoPanel('',title='Participant Information',align=viz.ALIGN_CENTER, icon=False) #Add name and ID fields textbox_last = participantInfo.addLabelItem('Last Name',viz.addTextbox()) textbox_first = participantInfo.addLabelItem('First Name',viz.addTextbox()) textbox_id = participantInfo.addLabelItem('ID',viz.addTextbox()) participantInfo.addSeparator(padding=(20,20)) #Add gender and age fields radiobutton_male = participantInfo.addLabelItem('Male',viz.addRadioButton(0)) radiobutton_female = participantInfo.addLabelItem('Female',viz.addRadioButton(0)) droplist_age = participantInfo.addLabelItem('Age Group',viz.addDropList()) ageList = ['20-30','31-40','41-50','51-60','61-70'] droplist_age.addItems(ageList) participantInfo.addSeparator() #Add submit button aligned to the right and wait until it's pressed submitButton = participantInfo.addItem(viz.addButtonLabel('Submit'),align=viz.ALIGN_RIGHT_CENTER) yield viztask.waitButtonUp(submitButton) #Collect participant data data = viz.Data() data.lastName = textbox_last.get() data.firstName = textbox_first.get() data.id = textbox_id.get() data.ageGroup = ageList[droplist_age.getSelection()] if radiobutton_male.get() == viz.DOWN: data.gender = 'male' else: data.gender = 'female' participantInfo.remove() # Return participant data viztask.returnValue(data)
def deleteCheckpoint1(): checkpointnummer = textBox.get() infoBox.remove() globalVariables.windowOpen = False def removeCheckPointsPanel(): checkPointsPanel.remove() okButton.remove() try: if (int(checkpointnummer)>0): del checkPointsList[int (checkpointnummer)-1] #Lösche Checkpoint else: raise except: checkPointsPanel = vizinfo.InfoPanel("Bitte nur Nummern im Bereich\nder verfĂ¼gbaren Checkpoints eingeben.",align=viz.ALIGN_CENTER,fontSize=25,icon=False,key=None) checkPointsPanel.visible(True) #Erschaffe Bestätigungsbutton okButton = viz.addButtonLabel("Ok") okButton.setPosition(0.5,0.40) okButton.setScale(1,1) vizact.onbuttondown(okButton,removeCheckPointsPanel)
def __init__(self, model, escena, gems, gemspos, gemcount, planes, planespos, nextScene, gemsound, planesound): self.mine = viz.addChild(model, scene=escena) self.planeList = list() contpos = 0 for x in planes: planeitem = Plane(x, planespos[contpos], escena, nextScene[contpos], planesound) self.planeList.append(planeitem) contpos = contpos + 1 self.btn_regresa = viz.addButtonLabel("regresar", scene=escena) self.btn_regresa.setPosition(0.9, 0.1) self.gemList = list() contpos = 0 print escena for x in gems: gemitem = Gem(x, gemspos[contpos], escena, gemsound) self.gemList.append(gemitem) contpos = contpos + 1
def porten(): #Position abfragen und textbox + button entfernen noteNummer = noteBox.get() infoBox.remove() def removeNotePanel(): notePanel.remove() okButton.remove() try: if (int(noteNummer)>0): #PrĂ¼fe eingabe und porte position = noteList[int(noteNummer)-1].getPosition() viz.MainView.setPosition(position[0], position[1], position[2]-0.5) tracker.setPosition(position[0], position[1], position[2]-0.5) else: raise except: notePanel = vizinfo.InfoPanel("Bitte nur Nummern im Bereich\nder verfĂ¼gbaren 3D Notizen eingeben.",align=viz.ALIGN_CENTER,fontSize=25,icon=False,key=None) notePanel.visible(True) #Erschaffe Bestätigungsbutton okButton = viz.addButtonLabel("Ok") okButton.setPosition(0.5,0.40) okButton.setScale(1,1) vizact.onbuttondown(okButton,removeNotePanel)
def __init__(self,win): viz.EventClass.__init__(self) self.callback(viz.BUTTON_EVENT,self.onButton) viz.cam.reset() vizcam.PivotNavigate(center=[15,-10,-2], distance=70, sensitivity=[1.0,1.0]) if win: self.text='CONRGATRULATIONS: YOU WON. Well, YOU WON this level. But there is only one level' else: self.text='YOU LOSE. Oh well.' self.text_2D_world = viz.addText(self.text,pos=[2, 2, 2],scene=4) #self.myButton = viz.addButtonLabel('Play Again',scene=4) #Add a button. #Weird Issue resetting scenes , disabling fo rnow #self.myButton.setPosition(.5,.) #Set its position. #self.myButton.setScale(1,1) #Scale it. self.done=viztask.Signal() self.myquit = viz.addButtonLabel('Quit Game',scene=4) #Add a button. self.myquit.setPosition(.5,.5) #Set its position. self.myquit.setScale(1,1) #Scale it. self.done=viztask.Signal() self.continu=False
def participantInfo(): #Add an InfoPanel with a title bar participantInfo = vizinfo.InfoPanel('', title='Participant Information', align=viz.ALIGN_CENTER, icon=False) #Add ID field textbox_id = participantInfo.addLabelItem('ID', viz.addTextbox()) participantInfo.addSeparator(padding=(10, 10)) #Add eye height field textbox_EH = participantInfo.addLabelItem('Eye Height (m)', viz.addTextbox()) participantInfo.addSeparator(padding=(10, 10)) #Add age field textbox_age = participantInfo.addLabelItem('Age', viz.addTextbox()) participantInfo.addSeparator(padding=(10, 10)) #Add gender field radiobutton_male = participantInfo.addLabelItem('Male', viz.addRadioButton(0)) radiobutton_female = participantInfo.addLabelItem('Female', viz.addRadioButton(0)) radiobutton_other = participantInfo.addLabelItem('Non-Binary', viz.addRadioButton(0)) participantInfo.addSeparator() #Add units field radiobutton_feet = participantInfo.addLabelItem('Feet', viz.addRadioButton(1)) radiobutton_meters = participantInfo.addLabelItem('Meters', viz.addRadioButton(1)) participantInfo.addSeparator() #Add submit button aligned to the right and wait until it's pressed submitButton = participantInfo.addItem(viz.addButtonLabel('Submit'), align=viz.ALIGN_RIGHT_CENTER) yield viztask.waitButtonUp(submitButton) #Collect participant data global data data = viz.Data() data_id = textbox_id.get() data_EH = textbox_EH.get() data_age = textbox_age.get() if radiobutton_male.get() == viz.DOWN: data.gender = 'm' elif radiobutton_female.get() == viz.DOWN: data.gender = 'f' else: data.gender = 'nb' if radiobutton_feet.get() == viz.DOWN: data.units = 'ft' else: data.units = 'm' participantInfo.remove() global IDNum IDNum = int(data_id) print IDNum global age age = float(data_age) global EHNum EHNum = float(data_EH) print age print EHNum print data.gender print data.units
def __init__(self,canvas,controller): super(LayerMenu, self).__init__(canvas, 'layer', 'Layer Selection') # Store controller instance self.controller = controller #Store region, layer, and mode data from config to populate menu self.regions = config.OntologicalGroups.regions #collections.OrderedDict type self.layers = config.OntologicalGroups.layers #collections.OrderedDict type self.modes = config.MenuConfig.Modes self.getPanel().fontSize(50) ##################### '''LAYER TAB PANEL SETUP''' ##################### #creating tab panel tp byRegionPanel = vizdlg.TabPanel(align = viz.ALIGN_LEFT_TOP, parent = canvas) #creating sub panels for tab panels(all layer data is stored in config.layers) storing sub panels in laypan layPan = {} for i, l in enumerate(self.regions.iteritems()): layPan[l[0]] = vizdlg.GridPanel(parent = canvas, fontSize = 50) #creating dict of checkboxes for layers self.checkBox = {} for key in self.regions.iterkeys(): self.checkBox[key] = {} for cb in self.layers.iterkeys(): self.checkBox[key][cb] = viz.addCheckbox(parent = canvas) #remove checkboxes from non-functioning region-layer selections for key in config.MenuConfig.RemoveCheckFromTab.iterkeys(): for cb in config.MenuConfig.RemoveCheckFromTab[key]: self.checkBox[key][cb].disable() #populate panels with layers and checkboxes for i in self.regions.iterkeys(): for j in self.layers.iterkeys(): layPan[i].addRow([viz.addText(j), self.checkBox[i][j]]) byRegionPanel.addPanel(i, layPan[i], align = viz.ALIGN_LEFT_TOP) ############################################# """CREATE TOTAL LAYER SELECTION CHECKBOXES""" ############################################# #creating grib panel to put checkboxes on selectAllPanel = vizdlg.GridPanel(parent = canvas, fontSize = 50) #creating checkboxes self.selectAllOf = {} for i in self.layers.iterkeys(): self.selectAllOf[i] = viz.addCheckbox(parent = canvas) #adding checkboxes to panel for i in self.layers: selectAllPanel.addRow([viz.addText('Load All ' + i, fontSize = 50), self.selectAllOf[i]]) ################################### '''CREATE START AND STOP BUTTONS''' ################################### #creating grid panels to add start and back buttons to setGrid = vizdlg.GridPanel(parent = canvas) #create back and start buttons and add to grid panel backButton = viz.addButtonLabel('Back') startButton = viz.addButtonLabel('Start') setGrid.addRow([backButton, startButton]) #add back and state button actions vizact.onbuttondown(backButton, self.controller.backMenu) vizact.onbuttondown(startButton, lambda: viztask.schedule(self.controller.start)) ############################ '''ADD ITEMS TO GAME MENU''' ############################ #add tab panel to info panel byRegionPanel.setCellPadding(5) self.addItem(byRegionPanel, align = viz.ALIGN_LEFT_TOP) #add grid panel to info panel self.addItem(selectAllPanel, align = viz.ALIGN_LEFT_TOP) #start and back buttons self.addItem(setGrid, align = viz.ALIGN_RIGHT_TOP) #change scale depending on display mode self.setScale(*[i*config.menuScale[self.name] for i in [1,1,1]]) #rendering bb = self.getBoundingBox() self.canvas.setRenderWorldOverlay([bb.width*1.8, bb.height*1.8], fov = bb.height*.1, distance = 1) ############################# """BUTTON CALLBACK""" ############################# viz.callback(viz.BUTTON_EVENT, controller.onAllSelection)
info.setPanelVisible(True) chime_sound.play() #vizact.ontimer(0,UpdateMovement) current_scene = 0 ################################################################# ################################################################# #Escenario1 mine = viz.addChild(model['mundo1'], scene = viz.Scene1) gem = viz.addChild(item['gem'], scene = viz.Scene1) gem.setScale(2.5,2.5,2.5) gem.setPosition(10,5) btn_regresa = viz.addButtonLabel("regresar", scene = viz.Scene1) btn_regresa.setPosition(0.9,0.1) rock = viz.addChild(item['gem'], scene = viz.Scene1) rock.setScale(2.5,2.5,2.5) rock.setPosition(-30,4) canvas = viz.addGUICanvas() canvas.alignment(viz.ALIGN_CENTER) viz.MainWindow.setDefaultGUICanvas(canvas) info = vizinfo.InfoPanel('AVERNO', align=viz.ALIGN_RIGHT_TOP, icon=False) info.setTitle( 'Ejemplo' ) info.setPanelVisible(False) #canvas.setRenderWorldOverlay([600,500],50,3) canvas.setRenderWorld([600,500],[3,viz.AUTO_COMPUTE]) canvas.setPosition([-30,5,2])
transfer_shader_radio = viz.addRadioButton(parent = viz.SCREEN, group = shader_radio_group) transfer_shader_radio.setScale(0.5, 0.5, 0.5) transfer_shader_radio.setPosition(0.085, 0.95) lighting_shader_radio_text = viz.addText("Lighting Shader:", parent = viz.SCREEN) lighting_shader_radio_text.setPosition(0.01, 0.975) lighting_shader_radio_text.scale( 0.1, 0.1, 0.1 ) lighting_shader_radio_text.alignment( viz.ALIGN_LEFT_CENTER) transfer_shader_radio_text = viz.addText("Transfer Shader:", parent = viz.SCREEN) transfer_shader_radio_text.setPosition(0.01, 0.95) transfer_shader_radio_text.scale( 0.1, 0.1, 0.1 ) transfer_shader_radio_text.alignment( viz.ALIGN_LEFT_CENTER) #Enable light location light_placement_button = viz.addButtonLabel(" Light Placement ", parent = viz.SCREEN) light_placement_button.setScale( 0.3, 0.3, 0.3 ) light_placement_button.setPosition( 0.035, 0.925 ) LIGHT_PLACEMENT_FLAG = False uvw_transform_manager = UVWTransform.UVWTransformManager(render_volume ) def loadState(state): tool_manager.loadState(state) def onUpdate( updateNum ): vector = viz.MainView.getMatrix().getForward() volume_region_extension.command( command = 1, x = vector[0], y = vector[1], z = vector[2] * -1.0) def onSlider( obj, pos ):
if abs(y) > 0.2: viz.MainView.move([0,0,-y*0.1],viz.BODY_ORI) if abs(z) > 0.2: viz.MainView.move([0,-z*0.1,0],viz.BODY_ORI) if abs(twist) > 0.2: viz.MainView.setEuler([twist,0,0],viz.BODY_ORI,viz.REL_PARENT) if abs(ry) > 0.2: viz.MainView.setEuler([0,ry,0],viz.HEAD_ORI,viz.REL_PARENT) if abs(rx) > 0.2: viz.MainView.setEuler([rx,0,0],viz.BODY_ORI,viz.REL_PARENT) if abs(rz) > 0.2: viz.MainView.setEuler([0,0,rz],viz.BODY_ORI,viz.REL_PARENT) #Escenario mine = viz.addChild("models/AbernoL04.obj", scene = viz.Scene1) btn_regresa = viz.addButtonLabel("regresar", scene = viz.Scene1) btn_regresa.setPosition(0.9,0.1) vizact.onbuttonup(btn_regresa, returntoMenu) #GUI inicial bgTexture = viz.add("img/Portada_Averno_1024.jpg") quad_bgtexture = viz.addTexQuad(parent = viz.SCREEN, scene = viz.Scene2) quad_bgtexture.texture(bgTexture) quad_bgtexture.setScale(12.8,10.24,0) #Escala a pantalla completa quad_bgtexture.setPosition(0.5, 0.5) #Centro de pantalla viz.scene(viz.Scene2) #Mostrar escena 2 #Botones de interaccion btn_newGame = viz.addButton(scene = viz.Scene2) btn_newGame.setPosition(0.75,0.75)
if TYPICAL_GUI_CANVAS: # Create canvas for displaying GUI objects canvas = viz.addGUICanvas() canvas.alignment(viz.ALIGN_CENTER) # Set canvas as default so all GUI objects are automatically added to it viz.MainWindow.setDefaultGUICanvas(canvas) controlPanel = vizinfo.InfoPanel(text='Navigate with WASD', title='Canvas Example') controlPanel.addSection('Render Mode') radio_world_overlay = controlPanel.addLabelItem('World Overlay', viz.addRadioButton('RenderMode')) radio_world = controlPanel.addLabelItem('World', viz.addRadioButton('RenderMode')) radio_screen_ortho = controlPanel.addLabelItem('Screen Ortho', viz.addRadioButton('RenderMode')) radio_world_overlay.set(1) controlPanel.addSeparator() manual_cursor = controlPanel.addLabelItem('Manual Cursor',viz.addCheckbox()) select_world = controlPanel.addItem(viz.addButtonLabel('Select World')) canvas.setRenderWorldOverlay([800,600],40,3) if NODE3D_CANVAS: pigeon = viz.addAvatar('pigeon.cfg',scale=[200]*3) pigeon.addAction(vizact.spin(0,1,0,45)) pigeon.enable(viz.DEPTH_TEST,op=viz.OP_ROOT) #Add the pigeon to the panel panel = vizinfo.InfoPanel('Find the pigeons before they fly away',align=viz.ALIGN_CENTER,fontSize=22,icon=False) panel.addItem(pigeon,align=viz.ALIGN_CENTER)
def __init__(self, canvas, controller): super(LayerMenu, self).__init__(canvas, 'layer', 'Layer Selection') # Store controller instance self.controller = controller #Store region, layer, and mode data from config to populate menu self.regions = config.OntologicalGroups.regions #collections.OrderedDict type self.layers = config.OntologicalGroups.layers #collections.OrderedDict type self.modes = config.MenuConfig.Modes self.getPanel().fontSize(50) ##################### '''LAYER TAB PANEL SETUP''' ##################### #creating tab panel tp byRegionPanel = vizdlg.TabPanel(align=viz.ALIGN_LEFT_TOP, parent=canvas) #creating sub panels for tab panels(all layer data is stored in config.layers) storing sub panels in laypan layPan = {} for i, l in enumerate(self.regions.iteritems()): layPan[l[0]] = vizdlg.GridPanel(parent=canvas, fontSize=50) #creating dict of checkboxes for layers self.checkBox = {} for key in self.regions.iterkeys(): self.checkBox[key] = {} for cb in self.layers.iterkeys(): self.checkBox[key][cb] = viz.addCheckbox(parent=canvas) #remove checkboxes from non-functioning region-layer selections for key in config.MenuConfig.RemoveCheckFromTab.iterkeys(): for cb in config.MenuConfig.RemoveCheckFromTab[key]: self.checkBox[key][cb].disable() #populate panels with layers and checkboxes for i in self.regions.iterkeys(): for j in self.layers.iterkeys(): layPan[i].addRow([viz.addText(j), self.checkBox[i][j]]) byRegionPanel.addPanel(i, layPan[i], align=viz.ALIGN_LEFT_TOP) ############################################# """CREATE TOTAL LAYER SELECTION CHECKBOXES""" ############################################# #creating grib panel to put checkboxes on selectAllPanel = vizdlg.GridPanel(parent=canvas, fontSize=50) #creating checkboxes self.selectAllOf = {} for i in self.layers.iterkeys(): self.selectAllOf[i] = viz.addCheckbox(parent=canvas) #adding checkboxes to panel for i in self.layers: selectAllPanel.addRow([ viz.addText('Load All ' + i, fontSize=50), self.selectAllOf[i] ]) ################################### '''CREATE START AND STOP BUTTONS''' ################################### #creating grid panels to add start and back buttons to setGrid = vizdlg.GridPanel(parent=canvas) #create back and start buttons and add to grid panel backButton = viz.addButtonLabel('Back') startButton = viz.addButtonLabel('Start') setGrid.addRow([backButton, startButton]) #add back and state button actions vizact.onbuttondown(backButton, self.controller.backMenu) vizact.onbuttondown(startButton, lambda: viztask.schedule(self.controller.start)) ############################ '''ADD ITEMS TO GAME MENU''' ############################ #add tab panel to info panel byRegionPanel.setCellPadding(5) self.addItem(byRegionPanel, align=viz.ALIGN_LEFT_TOP) #add grid panel to info panel self.addItem(selectAllPanel, align=viz.ALIGN_LEFT_TOP) #start and back buttons self.addItem(setGrid, align=viz.ALIGN_RIGHT_TOP) #change scale depending on display mode self.setScale(*[i * config.menuScale[self.name] for i in [1, 1, 1]]) #rendering bb = self.getBoundingBox() self.canvas.setRenderWorldOverlay([bb.width * 1.8, bb.height * 1.8], fov=bb.height * .1, distance=1) ############################# """BUTTON CALLBACK""" ############################# viz.callback(viz.BUTTON_EVENT, controller.onAllSelection)
PCB_GUI[7].addItem(viz.addText(LARGEST)) PCB_GUI[8].addItem(viz.addText(EVEN)) PCB_GUI[9].addItem(viz.addText(SQRT)) PID = 0 #PROCESS id TIMESLICE = 5 #tIME SLICE ACTUALTIME = 0 PC = 0 END = False procspace = vizdlg.Panel(layout=vizdlg.LAYOUT_HORZ_CENTER, align=viz.ALIGN_CENTER_CENTER, border=False) START = procspace.addItem(viz.addButtonLabel(" Start OS ")) START.fontSize(25) def RunProgram(prg, timeslice, pc): global PGCOMPLETE global END # global output # listitems=output.getItems() # #clear output # for i in listitems: # output.removeItem(i,True) #------------------------------- oldpc = pc global PC global PID
def participant_info(): """ Query the participant for basic data. Questions to select experimental condition and control type of the experimental condition. Returns: the queried data as a viz.data object """ participant_info = vizinfo.InfoPanel('', title='Participant Information', align=viz.ALIGN_CENTER, icon=False) # query control style droplist; Create a drop-down list drop_control_style = participant_info.addLabelItem('Choose control style', viz.addDropList()) items = ['dk2 head & right hand', 'mouse and keyboard'] # 'mouse and keyboard', 'joystick', 'dk2 head only', 'dk2 head wiimote', drop_control_style.addItems(items) # Add name and ID fields of maze configurations drop_maze_config = participant_info.addLabelItem('Choose maze configuration', viz.addDropList()) items2 = ['auto', 'baseline', 'training', 'I', 'L', 'Z', 'U']#, 'T', '+'] # Add a list of items. drop_maze_config.addItems(items2) # Add name and ID fields of experimental condition drop_maze_run = participant_info.addLabelItem('Choose maze run', viz.addDropList()) items2 = ['auto', '1', '2', '3'] drop_maze_run.addItems(items2) participant_info.addSeparator(padding=(10, 10)) textbox_id = participant_info.addLabelItem('ID', viz.addTextbox()) textbox_age = participant_info.addLabelItem('Age', viz.addTextbox()) textbox_handedness = participant_info.addLabelItem('Handedness', viz.addTextbox()) textbox_vision = participant_info.addLabelItem('Vision', viz.addTextbox()) textbox_cap_size = participant_info.addLabelItem('Cap size', viz.addTextbox()) textbox_neck_size = participant_info.addLabelItem('Neck size', viz.addTextbox()) textbox_labelscheme = participant_info.addLabelItem('Electrode Labelscheme', viz.addTextbox()) participant_info.addSeparator(padding=(10, 10)) # Add gender and age fields radiobutton_male = participant_info.addLabelItem('Male', viz.addRadioButton(2)) radiobutton_female = participant_info.addLabelItem('Female', viz.addRadioButton(2)) participant_info.addSeparator(padding=(10, 10)) # Add submit button aligned to the right and wait until it's pressed submit_button = participant_info.addItem(viz.addButtonLabel('Submit'), align=viz.ALIGN_CENTER) yield viztask.waitButtonUp(submit_button) # Collect participant data data = viz.Data() data.id = textbox_id.get() data.age = textbox_age.get() data.handedness = textbox_handedness.get() data.vision = textbox_vision.get() data.cap_size = textbox_cap_size.get() data.neck_size = textbox_neck_size.get() data.labelscheme = textbox_labelscheme.get() if radiobutton_male.get() == viz.DOWN: data.sex = 'male' else: data.sex = 'female' # Find the index of the current selection. Find the selection itself. data.control_style = drop_control_style.getItems()[drop_control_style.getSelection()] data.maze_config = drop_maze_config.getItems()[drop_maze_config.getSelection()] data.maze_run = drop_maze_run.getItems()[drop_maze_run.getSelection()] participant_info.remove() # Return participant data viztask.returnValue(data)
def __init__(self, canvas): vizinfo.InfoPanel.__init__(self, '', title='Game Menu', fontSize=100, align=viz.ALIGN_CENTER_CENTER, icon=False, parent=canvas) self.layers = config.layers self.modes = config.modes self.name = 'game' self.canvas = canvas self.active = False self.getPanel().fontSize(50) self.setPanelVisible(viz.OFF, animate=False) self.menuVisible = False ##################### '''LAYER TAB PANEL SETUP''' ##################### #creating tab panel tp tp = vizdlg.TabPanel(align=viz.ALIGN_LEFT_TOP, parent=canvas) #creating sub panels for tab panels(all layer data is stored in config.layers) storing sub panels in laypan layPan = {} for i, l in enumerate(self.layers): layPan[l] = vizdlg.GridPanel(parent=canvas) #creating dict of checkboxes for layers self.checkBox = {} for cb in [cb for l in self.layers.values() for cb in l]: self.checkBox[cb] = viz.addCheckbox(parent=canvas) #add layers and textboxes to panels for i in self.layers: for j in self.layers[i]: layPan[i].addRow([viz.addText(j), self.checkBox[j]]) tp.addPanel(i, layPan[i], align=viz.ALIGN_LEFT_TOP) ############################################### '''CREATING MODES PANEL''' ############################################### #creating labels for modes self.modeLabels = {} for l in self.modes.keys(): self.modeLabels[l] = viz.addText(l, parent=canvas) #creating radio buttons for modes self.modeGroup = viz.addGroup(parent=canvas) self.radioButtons = {} for rb in self.modes.keys(): self.radioButtons[rb] = viz.addRadioButton(self.modeGroup, parent=canvas) #creating grid panel to add mode to modeGrid = vizdlg.GridPanel(parent=canvas) #adding modes and radio buttons to grid panel for i in self.modes.keys(): modeGrid.addRow([self.modeLabels[i], self.radioButtons[i]]) ################################### '''CREATE START AND STOP BUTTONS''' ################################### #creating grid panels to add start and back buttons to setGrid = vizdlg.GridPanel(parent=canvas) #create back and start buttons and add to grid panel backButton = viz.addButtonLabel('Back') startButton = viz.addButtonLabel('Start') setGrid.addRow([backButton, startButton]) #add back and state button actions vizact.onbuttondown(backButton, self.back) vizact.onbuttondown(startButton, self.start) ############################ '''ADD ITEMS TO GAME MENU''' ############################ #directions self.addItem(viz.addText( 'Select Parts of the Skeletal System You Wish to Puzzle and Select a Mode:', parent=canvas), fontSize=30, align=viz.ALIGN_LEFT_TOP) #add tab panel to info panel tp.setCellPadding(5) self.addItem(tp, align=viz.ALIGN_LEFT_TOP) #modes self.addItem(modeGrid, align=viz.ALIGN_LEFT_TOP) #start and back buttons self.addItem(setGrid, align=viz.ALIGN_RIGHT_TOP) #change scale depending on display mode self.setScale(*[i * config.menuScale[self.name] for i in [1, 1, 1]]) #rendering bb = self.getBoundingBox() self.canvas.setRenderWorldOverlay([bb.width * 1.8, bb.height * 1.8], fov=bb.height * .1, distance=1)
def __init__(self,canvas): vizinfo.InfoPanel.__init__(self, '',title = 'Game Menu',fontSize = 100,align=viz.ALIGN_CENTER_CENTER,icon=False,parent= canvas) self.layers = config.layers self.modes = config.modes self.name = 'game' self.canvas = canvas self.active = False self.getPanel().fontSize(50) self.setPanelVisible(viz.OFF, animate = False) self.menuVisible = False ##################### '''LAYER TAB PANEL SETUP''' ##################### #creating tab panel tp tp = vizdlg.TabPanel(align = viz.ALIGN_LEFT_TOP, parent = canvas) #creating sub panels for tab panels(all layer data is stored in config.layers) storing sub panels in laypan layPan = {} for i, l in enumerate(self.layers): layPan[l] = vizdlg.GridPanel(parent = canvas) #creating dict of checkboxes for layers self.checkBox = {} for cb in [cb for l in self.layers.values() for cb in l]: self.checkBox[cb] = viz.addCheckbox(parent = canvas) #add layers and textboxes to panels for i in self.layers: for j in self.layers[i]: layPan[i].addRow([viz.addText(j), self.checkBox[j]]) tp.addPanel(i, layPan[i], align = viz.ALIGN_LEFT_TOP) ############################################### '''CREATING MODES PANEL''' ############################################### #creating labels for modes self.modeLabels = {} for l in self.modes.keys(): self.modeLabels[l] = viz.addText(l, parent = canvas) #creating radio buttons for modes self.modeGroup = viz.addGroup(parent = canvas) self.radioButtons = {} for rb in self.modes.keys(): self.radioButtons[rb] = viz.addRadioButton(self.modeGroup, parent = canvas) #creating grid panel to add mode to modeGrid = vizdlg.GridPanel(parent = canvas) #adding modes and radio buttons to grid panel for i in self.modes.keys(): modeGrid.addRow([self.modeLabels[i], self.radioButtons[i]]) ################################### '''CREATE START AND STOP BUTTONS''' ################################### #creating grid panels to add start and back buttons to setGrid = vizdlg.GridPanel(parent = canvas) #create back and start buttons and add to grid panel backButton = viz.addButtonLabel('Back') startButton = viz.addButtonLabel('Start') setGrid.addRow([backButton, startButton]) #add back and state button actions vizact.onbuttondown(backButton, self.back) vizact.onbuttondown(startButton, self.start) ############################ '''ADD ITEMS TO GAME MENU''' ############################ #directions self.addItem(viz.addText('Select Parts of the Skeletal System You Wish to Puzzle and Select a Mode:', parent = canvas), fontSize = 30, align = viz.ALIGN_LEFT_TOP) #add tab panel to info panel tp.setCellPadding(5) self.addItem(tp, align = viz.ALIGN_LEFT_TOP) #modes self.addItem(modeGrid, align = viz.ALIGN_LEFT_TOP) #start and back buttons self.addItem(setGrid, align = viz.ALIGN_RIGHT_TOP) #change scale depending on display mode self.setScale(*[i*config.menuScale[self.name] for i in [1,1,1]]) #rendering bb = self.getBoundingBox() self.canvas.setRenderWorldOverlay([bb.width*1.8, bb.height*1.8], fov = bb.height*.1, distance = 1)