示例#1
0
    def __init__(self, mcedit):
        Dialog.__init__(self)

        self.mcedit = mcedit

        fieldOfViewRow = mceutils.FloatInputRow("Field of View: ",
                                                ref=config.settings.fov, width=100, min=25, max=120)

        targetFPSRow = mceutils.IntInputRow("Target FPS: ",
                                            ref=config.settings.targetFPS, width=100, min=1, max=60)

        bufferLimitRow = mceutils.IntInputRow("Vertex Buffer Limit (MB): ",
                                              ref=config.settings.vertexBufferLimit, width=100, min=0)

        fastLeavesRow = mceutils.CheckBoxLabel("Fast Leaves",
                                               ref=config.settings.fastLeaves,
                                               tooltipText="Leaves are solid, like Minecraft's 'Fast' graphics")

        roughGraphicsRow = mceutils.CheckBoxLabel("Rough Graphics",
                                                  ref=config.settings.roughGraphics,
                                                  tooltipText="All blocks are drawn the same way (overrides 'Fast Leaves')")

        enableMouseLagRow = mceutils.CheckBoxLabel("Enable Mouse Lag",
                                                   ref=config.settings.enableMouseLag,
                                                 tooltipText="Enable choppy mouse movement for faster loading.")

        packs = resource_packs.packs.get_available_resource_packs()
        packs.remove('Default')
        packs.sort()
        packs.insert(0, 'Default')
        self.resourcePackButton = mceutils.ChoiceButton(packs, choose=self.change_texture)
        self.resourcePackButton.selectedChoice = resource_packs.packs.get_selected_resource_pack_name()

        settingsColumn = albow.Column((fastLeavesRow,
                                       roughGraphicsRow,
                                       enableMouseLagRow,
                                       #                                  texturePackRow,
                                       fieldOfViewRow,
                                       targetFPSRow,
                                       bufferLimitRow,
                                       self.resourcePackButton,
                                      ), align='r')

        settingsColumn = albow.Column((albow.Label("Settings"),
                                       settingsColumn))

        settingsRow = albow.Row((settingsColumn,))

        optionsColumn = albow.Column((settingsRow, albow.Button("OK", action=self.dismiss)))

        self.add(optionsColumn)
        self.shrink_wrap()
    def buildWidgets(self):
        for w in self.subwidgets:
            w.set_parent(None)

        helpColumn = []

        self.root.movementLabel = label = albow.Label(_("{0}/{1}/{2}/{3}/{4}/{5} to move").format(
            _(config.keys.forward.get()),
            _(config.keys.left.get()),
            _(config.keys.back.get()),
            _(config.keys.right.get()),
            _(config.keys.up.get()),
            _(config.keys.down.get()),
        ), doNotTranslate=True)
        label.anchor = 'whrt'
        label.align = 'r'
        helpColumn.append(label)

        def addHelp(text, dnt=False):
            label = albow.Label(text, doNotTranslate=dnt)
            label.anchor = 'whrt'
            label.align = "r"
            helpColumn.append(label)
            return label

        self.root.slowDownLabel = addHelp(_("{0} to slow down").format(_(config.keys.brake.get())), dnt=True)
        self.camCont = addHelp("Right-click to toggle camera control")
        self.toolDist = addHelp("Mousewheel to control tool distance")
        self.root.detailsLabel = addHelp(_("Hold {0} for details").format(_(config.keys.showBlockInfo.get())), dnt=True)

        self.helpColumn = helpColumn = albow.Column(helpColumn, align="r")
        helpColumn.topright = self.topright
        helpColumn.anchor = "whrt"
        # helpColumn.is_gl_container = True
        self.add(helpColumn)

        keysColumn = [albow.Label("")]
        buttonsColumn = [panels.ControlPanel.getHeader()]

        shortnames = []
        for world in self.mcedit.recentWorlds():
            shortname = os.path.basename(world)
            try:
                if pymclevel.MCInfdevOldLevel.isLevel(world):
                    lev = pymclevel.MCInfdevOldLevel(world, readonly=True)
                    shortname = lev.LevelName
                    if lev.LevelName != lev.displayName:
                        shortname = u"{0} ({1})".format(lev.LevelName, lev.displayName)
            except Exception, e:
                logging.warning(
                    'Couldn\'t get name from recent world: {0!r}'.format(e))

            if shortname == "level.dat":
                shortname = os.path.basename(os.path.dirname(world))

            if len(shortname) > 40:
                shortname = shortname[:37] + "..."
            shortnames.append(shortname)
示例#3
0
    def __init__(self, mcedit):
        Dialog.__init__(self)
        #.#
        spacing = 0
        keyConfigTable = albow.TableView(
            nrows=30,
            columns=[
                albow.TableColumn("Command", 200, "l"),
                albow.TableColumn("Assigned Key", 150, "r")
            ])
        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
        #.#
        self.changes = {}
        self.changesNum = False
        self.enter = 0
        self.root = None
        self.editor = None
        tableWidget = albow.Widget()
        tableWidget.add(keyConfigTable)
        tableWidget.shrink_wrap()

        self.keyConfigTable = keyConfigTable

        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 = mceutils.ChoiceButton(
            ["WASD", "Arrows", "Numpad", "WASD Old"], choose=self.choosePreset)
        if 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("Presets: "), choiceButton))
        self.choiceButton = choiceButton

        col = albow.Column(
            (tableWidget, choiceRow, buttonRow, resetToDefaultRow),
            spacing=spacing,
            margin=0)
        self.add(col)
        self.shrink_wrap()
示例#4
0
    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()
class FileOpener(albow.Widget):
    is_gl_container = True

    def __init__(self, mcedit, *args, **kwargs):
        kwargs['rect'] = mcedit.rect
        albow.Widget.__init__(self, *args, **kwargs)
        self.anchor = 'tlbr'
        self.mcedit = mcedit
        self.root = self.get_root()

    #-# Translation live update
        self.buildWidgets()

    def buildWidgets(self):
        for w in self.subwidgets:
            w.set_parent(None)

        helpColumn = []

        self.root.movementLabel = label = albow.Label(_("{0}/{1}/{2}/{3}/{4}/{5} to move").format(
            _(config.keys.forward.get()),
            _(config.keys.left.get()),
            _(config.keys.back.get()),
            _(config.keys.right.get()),
            _(config.keys.up.get()),
            _(config.keys.down.get()),
        ), doNotTranslate=True)
        label.anchor = 'whrt'
        label.align = 'r'
        helpColumn.append(label)

        def addHelp(text, dnt=False):
            label = albow.Label(text, doNotTranslate=dnt)
            label.anchor = 'whrt'
            label.align = "r"
            helpColumn.append(label)
            return label

        self.root.slowDownLabel = addHelp(_("{0} to slow down").format(_(config.keys.brake.get())), dnt=True)
        self.camCont = addHelp("Right-click to toggle camera control")
        self.toolDist = addHelp("Mousewheel to control tool distance")
        self.root.detailsLabel = addHelp(_("Hold {0} for details").format(_(config.keys.showBlockInfo.get())), dnt=True)

        self.helpColumn = helpColumn = albow.Column(helpColumn, align="r")
        helpColumn.topright = self.topright
        helpColumn.anchor = "whrt"
        # helpColumn.is_gl_container = True
        self.add(helpColumn)

        keysColumn = [albow.Label("")]
        buttonsColumn = [panels.ControlPanel.getHeader()]

        shortnames = []
        for world in self.mcedit.recentWorlds():
            shortname = os.path.basename(world)
            try:
                if pymclevel.MCInfdevOldLevel.isLevel(world):
                    lev = pymclevel.MCInfdevOldLevel(world, readonly=True)
                    shortname = lev.LevelName
                    if lev.LevelName != lev.displayName:
                        shortname = u"{0} ({1})".format(lev.LevelName, lev.displayName)
            except Exception, e:
                logging.warning(
                    'Couldn\'t get name from recent world: {0!r}'.format(e))

            if shortname == "level.dat":
                shortname = os.path.basename(os.path.dirname(world))

            if len(shortname) > 40:
                shortname = shortname[:37] + "..."
            shortnames.append(shortname)

        hotkeys = ([(config.keys.newWorld.get(), 'Create New World', self.createNewWorld),
                    (config.keys.quickLoad.get(), 'Quick Load', self.mcedit.editor.askLoadWorld),
                    (config.keys.open.get(), 'Open...', self.promptOpenAndLoad)] + [
                       ('F{0}'.format(i + 1), shortnames[i], self.createLoadButtonHandler(world))
                       for i, world in enumerate(self.mcedit.recentWorlds())])

        self.root.commandRow = commandRow = albow.HotkeyColumn(hotkeys, keysColumn, buttonsColumn)
        commandRow.anchor = 'lrh'

        sideColumn1 = self.mcedit.makeSideColumn1()
        sideColumn1.anchor = 'wh'
        spaceLabel = albow.Label("")
        spaceLabel.anchor = 'wh'
        sideColumn2 = self.mcedit.makeSideColumn2()
        sideColumn2.anchor = 'wh'

        contentRow = albow.Row((commandRow, albow.Column((sideColumn1, spaceLabel, sideColumn2))))
        contentRow.center = self.center
        contentRow.anchor = "rh"
        self.contentRow = contentRow
        self.add(contentRow)
        self.invalidate()
示例#6
0
    def __init__(self, mcedit, *args, **kwargs):
        kwargs['rect'] = mcedit.rect
        albow.Widget.__init__(self, *args, **kwargs)
        self.anchor = 'tlbr'
        self.mcedit = mcedit
        self.root = self.get_root()

        helpColumn = []

        label = albow.Label(
            _("{0}/{1}/{2}/{3}/{4}/{5} to move").format(
                config.keys.forward.get(),
                config.keys.left.get(),
                config.keys.back.get(),
                config.keys.right.get(),
                config.keys.up.get(),
                config.keys.down.get(),
            ))
        label.anchor = 'whrt'
        label.align = 'r'
        helpColumn.append(label)

        def addHelp(text):
            label = albow.Label(text)
            label.anchor = 'whrt'
            label.align = "r"
            helpColumn.append(label)

        addHelp(_("{0} to slow down").format(config.keys.brake.get()))
        addHelp("Right-click to toggle camera control")
        addHelp("Mousewheel to control tool distance")
        addHelp(
            _("Hold {0} for details").format(config.keys.showBlockInfo.get()))

        helpColumn = albow.Column(helpColumn, align="r")
        helpColumn.topright = self.topright
        helpColumn.anchor = "whrt"
        # helpColumn.is_gl_container = True
        self.add(helpColumn)

        keysColumn = [albow.Label("")]
        buttonsColumn = [panels.ControlPanel.getHeader()]

        shortnames = []
        for world in self.mcedit.recentWorlds():
            shortname = os.path.basename(world)
            try:
                if pymclevel.MCInfdevOldLevel.isLevel(world):
                    lev = pymclevel.MCInfdevOldLevel(world, readonly=True)
                    shortname = lev.LevelName
                    if lev.LevelName != lev.displayName:
                        shortname = u"{0} ({1})".format(
                            lev.LevelName, lev.displayName)
            except Exception, e:
                logging.warning(
                    'Couldn\'t get name from recent world: {0!r}'.format(e))

            if shortname == "level.dat":
                shortname = os.path.basename(os.path.dirname(world))

            if len(shortname) > 40:
                shortname = shortname[:37] + "..."
            shortnames.append(shortname)
示例#7
0
    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()