def __init__(self, mcedit): Dialog.__init__(self) self.changes = {} self.changesNum = False self.enter = 0 self.root = None self.editor = None buttonRow = (albow.Button("Assign Key...", action=self.askAssignSelectedKey), albow.Button("Done", action=self.done), albow.Button("Cancel", action=self.cancel)) buttonRow = albow.Row(buttonRow) resetToDefaultRow = albow.Row((albow.Button("Reset to default", action=self.resetDefault),)) choiceButton = albow.ChoiceButton(["WASD", "ESDF", "Arrows", "Numpad", "WASD Old"], choose=self.choosePreset) if config.keys.forward.get() == "E": choiceButton.selectedChoice = "ESDF" elif config.keys.forward.get() == "Up": choiceButton.selectedChoice = "Arrows" elif config.keys.forward.get() == "[8]": choiceButton.selectedChoice = "Numpad" elif config.keys.brake.get() == "Space": choiceButton.selectedChoice = "WASD Old" self.oldChoice = choiceButton.selectedChoice choiceRow = albow.Row((albow.Label("Keybind Presets:"), choiceButton)) self.choiceButton = choiceButton #.# spacing = 0 tb = albow.TableView() self.nrows = 581 / tb.font.get_linesize() keyConfigTable = albow.TableView(nrows=581 / tb.font.get_linesize(), columns=[albow.TableColumn("Command", 200, "l"), albow.TableColumn("Assigned Key", 150, "r")]) del tb keyConfigTable.num_rows = lambda: len(self.keyConfigKeys) keyConfigTable.row_data = self.getRowData keyConfigTable.row_is_selected = lambda x: x == self.selectedKeyIndex keyConfigTable.click_row = self.selectTableRow keyConfigTable.key_down = self.key_down keyConfigTable.key_up = self.key_up tableWidget = albow.Widget() tableWidget.add(keyConfigTable) tableWidget.shrink_wrap() self.keyConfigTable = keyConfigTable #.# col = albow.Column((tableWidget, choiceRow, buttonRow, resetToDefaultRow), spacing=spacing, margin=0) self.add(col) self.shrink_wrap()
def __init__(self, mcedit): Dialog.__init__(self) self.mcedit = mcedit self.saveOldConfig = { config.settings.fov: config.settings.fov.get(), config.settings.targetFPS: config.settings.targetFPS.get(), config.settings.vertexBufferLimit: config.settings.vertexBufferLimit.get(), config.settings.fastLeaves: config.settings.fastLeaves.get(), config.settings.roughGraphics: config.settings.roughGraphics.get(), config.settings.enableMouseLag: config.settings.enableMouseLag.get(), config.settings.maxViewDistance: config.settings.maxViewDistance.get() } self.saveOldResourcePack = ResourcePackHandler.Instance( ).get_selected_resource_pack_name() self.fieldOfViewRow = albow.FloatInputRow("Field of View: ", ref=config.settings.fov, width=100, min=25, max=120) self.targetFPSRow = albow.IntInputRow("Target FPS: ", ref=config.settings.targetFPS, width=100, min=1, max=60) self.bufferLimitRow = albow.IntInputRow( "Vertex Buffer Limit (MB): ", ref=config.settings.vertexBufferLimit, width=100, min=0) fastLeavesRow = albow.CheckBoxLabel( "Fast Leaves", ref=config.settings.fastLeaves, tooltipText="Leaves are solid, like Minecraft's 'Fast' graphics") roughGraphicsRow = albow.CheckBoxLabel( "Rough Graphics", ref=config.settings.roughGraphics, tooltipText= "All blocks are drawn the same way (overrides 'Fast Leaves')") enableMouseLagRow = albow.CheckBoxLabel( "Enable Mouse Lag", ref=config.settings.enableMouseLag, tooltipText="Enable choppy mouse movement for faster loading.") playerSkins = albow.CheckBoxLabel( "Show Player Skins", ref=config.settings.downloadPlayerSkins, tooltipText="Show player skins while editing the world") self.maxView = albow.IntInputRow( "Max View Distance", ref=config.settings.maxViewDistance, tooltipText= "Sets the maximum view distance for the renderer. Values over 32 can possibly be unstable, so use it at your own risk" ) self.maxView.subwidgets[1]._increment = 2 packs = ResourcePackHandler.Instance().get_available_resource_packs() packs.remove('Default Resource Pack') packs.sort() packs.insert(0, 'Default Resource Pack') self.resourcePackButton = albow.ChoiceButton( packs, choose=self.change_texture, doNotTranslate=True) self.resourcePackButton.selectedChoice = self.saveOldResourcePack settingsColumn = albow.Column( ( fastLeavesRow, roughGraphicsRow, enableMouseLagRow, # texturePackRow, self.fieldOfViewRow, self.targetFPSRow, self.bufferLimitRow, self.maxView, playerSkins, self.resourcePackButton, ), align='r') settingsColumn = albow.Column( (albow.Label("Graphics Settings"), settingsColumn)) settingsRow = albow.Row((settingsColumn, )) buttonsRow = albow.Row((albow.Button("OK", action=self.dismiss), albow.Button("Cancel", action=self.cancel))) resetToDefaultRow = albow.Row( (albow.Button("Reset to default", action=self.resetDefault), )) optionsColumn = albow.Column( (settingsRow, buttonsRow, resetToDefaultRow)) self.add(optionsColumn) self.shrink_wrap()
def initComponents(self): """Initilize the window components. Call this after translation hs been loaded.""" autoBrakeRow = albow.CheckBoxLabel( "Autobrake", ref=config.controls.autobrake, tooltipText="Apply brake when not pressing movement keys") swapAxesRow = albow.CheckBoxLabel( "Swap Axes Looking Down", ref=config.controls.swapAxes, tooltipText= "Change the direction of the Forward and Backward keys when looking down" ) cameraAccelRow = albow.FloatInputRow("Camera Acceleration: ", ref=config.controls.cameraAccel, width=100, min=5.0) cameraDragRow = albow.FloatInputRow("Camera Drag: ", ref=config.controls.cameraDrag, width=100, min=1.0) cameraMaxSpeedRow = albow.FloatInputRow( "Camera Max Speed: ", ref=config.controls.cameraMaxSpeed, width=100, min=1.0) cameraBrakeSpeedRow = albow.FloatInputRow( "Camera Braking Speed: ", ref=config.controls.cameraBrakingSpeed, width=100, min=1.0) mouseSpeedRow = albow.FloatInputRow("Mouse Speed: ", ref=config.controls.mouseSpeed, width=100, min=0.1, max=20.0) undoLimitRow = albow.IntInputRow("Undo Limit: ", ref=config.settings.undoLimit, width=100, min=0) maxCopiesRow = albow.IntInputRow( "Copy Stack Size: ", ref=config.settings.maxCopies, width=100, min=0, tooltipText="Maximum number of copied objects.") compassSizeRow = albow.IntInputRow("Compass Size (%): ", ref=config.settings.compassSize, width=100, min=0, max=100) fontProportion = albow.IntInputRow( "Fonts Proportion (%): ", ref=config.settings.fontProportion, width=100, min=0, tooltipText= "Fonts sizing proportion. The number is a percentage.\nRestart needed!" ) albow.resource.font_proportion = config.settings.fontProportion.get() fogIntensityRow = albow.IntInputRow("Fog Intensity (%): ", ref=config.settings.fogIntensity, width=100, min=0, max=100) invertRow = albow.CheckBoxLabel( "Invert Mouse", ref=config.controls.invertMousePitch, tooltipText="Reverse the up and down motion of the mouse.") spaceHeightRow = albow.IntInputRow( "Low Detail Height", ref=config.settings.spaceHeight, tooltipText= "When you are this far above the top of the world, move fast and use low-detail mode." ) blockBufferRow = albow.IntInputRow( "Block Buffer (MB):", ref=albow.AttrRef(self, 'blockBuffer'), min=1, tooltipText= "Amount of memory used for temporary storage. When more than this is needed, the disk is used instead." ) setWindowPlacementRow = albow.CheckBoxLabel( "Set Window Placement", ref=config.settings.setWindowPlacement, tooltipText="Try to save and restore the window position.") rotateBlockBrushRow = albow.CheckBoxLabel( "Rotate block with brush", ref=config.settings.rotateBlockBrush, tooltipText= "When rotating your brush, also rotate the orientation of the block your brushing with" ) compassToggleRow = albow.CheckBoxLabel( "Toggle compass", ref=config.settings.compassToggle) windowSizeRow = albow.CheckBoxLabel( "Window Resize Alert", ref=config.settings.shouldResizeAlert, tooltipText= "Reminds you that the cursor won't work correctly after resizing the window." ) superSecretSettingsRow = albow.CheckBoxLabel( "Super Secret Settings", ref=config.settings.superSecretSettings, tooltipText="Weird stuff happen!") longDistanceRow = albow.CheckBoxLabel( "Long-Distance Mode", ref=config.settings.longDistanceMode, tooltipText= "Always target the farthest block under the cursor, even in mouselook mode." ) flyModeRow = albow.CheckBoxLabel( "Fly Mode", ref=config.settings.flyMode, tooltipText= "Moving forward and Backward will not change your altitude in Fly Mode." ) showCommandsRow = albow.CheckBoxLabel( "Show Commands", ref=config.settings.showCommands, tooltipText= "Show the command in a Command Block when hovering over it.") cancelCommandBlockOffset = albow.CheckBoxLabel( "Cancel Command Block Offset", ref=config.schematicCopying.cancelCommandBlockOffset, tooltipText="Cancels the command blocks coords changed when copied." ) lng = config.settings.langCode.get() langs = sorted(self.getLanguageChoices().items()) langNames = [k for k, v in langs] self.languageButton = albow.ChoiceButton(langNames, choose=self.changeLanguage, doNotTranslate=True) if self.sgnal[lng] in self.languageButton.choices: self.languageButton.selectedChoice = self.sgnal[lng] langButtonRow = albow.Row( (albow.Label("Language", tooltipText="Choose your language."), self.languageButton)) portableList = ["Portable", "Fixed"] self.goPortableButton = goPortableButton = albow.ChoiceButton( portableList, choose=self.togglePortable) goPortableButton.selectedChoice = self.saveOldPortable goPortableButton.tooltipText = self.portableButtonTooltip() goPortableRow = albow.Row( (albow.Label("Install Mode"), goPortableButton)) # Disabled Crash Reporting Option # reportRow = albow.CheckBoxLabel("Report Errors", # ref=config.settings.reportCrashes, # tooltipText="Automatically report errors to the developer.") self.inputs = ( spaceHeightRow, cameraAccelRow, cameraDragRow, cameraMaxSpeedRow, cameraBrakeSpeedRow, blockBufferRow, mouseSpeedRow, undoLimitRow, maxCopiesRow, compassSizeRow, fontProportion, fogIntensityRow, ) options = ( longDistanceRow, flyModeRow, autoBrakeRow, swapAxesRow, invertRow, superSecretSettingsRow, rotateBlockBrushRow, compassToggleRow, showCommandsRow, cancelCommandBlockOffset, langButtonRow, ) + (((sys.platform == "win32" and pygame.version.vernum == (1, 9, 1)) and (windowSizeRow, ) or ())) + ((sys.platform == "win32") and (setWindowPlacementRow, ) or ()) + ((not sys.platform == "darwin") and (goPortableRow, ) or ()) rightcol = albow.Column(options, align='r') leftcol = albow.Column(self.inputs, align='r') optionsColumn = albow.Column( (albow.Label("Options"), albow.Row((leftcol, rightcol), align="t"))) settingsRow = albow.Row((optionsColumn, )) buttonsRow = albow.Row((albow.Button("OK", action=self.dismiss), albow.Button("Cancel", action=self.cancel))) resetToDefaultRow = albow.Row( (albow.Button("Reset to default", action=self.resetDefault), )) optionsColumn = albow.Column( (settingsRow, buttonsRow, resetToDefaultRow)) optionsColumn.key_down = self.key_down self.add(optionsColumn) self.shrink_wrap()