def newSceneButtonCb(event, button): if self.sceneDirty: ynd = gui.Dialog.createYesNoDialog( "Save existing scene first?") ynd.run() if ynd.result: saveScene(self) wid = gui.InputDialog("Enter new scene width") wid.run() w = int(wid.textInput.text) if wid.textInput.text.isdigit( ) else configuration.default_width_in_tiles hid = gui.InputDialog("Enter new scene height") hid.run() h = int(hid.textInput.text) if hid.textInput.text.isdigit( ) else configuration.default_height_in_tiles bid = gui.Dialog.createYesNoDialog("Choose different base tile?") bid.run() bt = None if bid.result: ts = TileSelector(self.scene) ts.show() bt = ts.selectedTile self.engine.scene = scene.Scene(self.engine, widthInTiles=w, heightInTiles=h, players=[self.scene.player]) if bt: self.engine.scene.baseTile = bt self.engine.scene.initScene() button.ancestor.exit()
def playblast_and_upload(): if not gui.confirm_upload_to_playground(): return filepath = maya_scene.playblast() if not filepath: return webm_file = video.convert_to_webm(filepath) if not webm_file: return user_input = gui.InputDialog() if not user_input.response: return uploaded_media_url = user.upload_to_playground(webm_file, user_input.response_text) if not uploaded_media_url: return title = 'Upload Successful' info_message = 'Your file has successfully been uploaded. Please follow this link:' UploadedMediaDialog = gui.InfoDialog( title=title, info_text=info_message, media_url=uploaded_media_url.json()['reviewURL']) UploadedMediaDialog.exec_()
def open_input_dialog(self): self.inputDialog = gui.InputDialog('Input Dialog', 'Your name?') self.inputDialog.set_on_confirm_value_listener( self, 'on_input_dialog_confirm') # here is returned the Input Dialog widget, and it will be shown self.inputDialog.show(self)
def saveScene(self): id = gui.InputDialog("Scene filename:", width=300) id.run() if id.result: self.scene.save( os.path.join(configuration.mapdir, id.textInput.text)) self.sceneDirty = False cd.exit(None)
def handleMiddleButton(self): self.sceneDirty = True mousePos = pygame.mouse.get_pos() ts = self.engine.scene.getTilestackAt( self.scene.viewport.x + mousePos[0], self.scene.viewport.y + mousePos[1]) if self.middleClickAction == "walk": ts.isWalkable = self.walkPaintMode else: id = gui.InputDialog("Enter trigger ID:") id.run() print "Received trigger id: %s" % id.textInput.text if id.textInput.text and id.textInput.text != "": triggerId = id.textInput.text.replace(" ", "_") ts.triggerId = triggerId self.pressingMiddleButton = False