当前位置: 首页>>代码示例>>Python>>正文


Python settings.Settings类代码示例

本文整理汇总了Python中mcedit2.util.settings.Settings的典型用法代码示例。如果您正苦于以下问题:Python Settings类的具体用法?Python Settings怎么用?Python Settings使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Settings类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: loadSettings

 def loadSettings(self):
     settings = Settings()
     state = settings.value("mainwindow/state", None)
     if state:
         self.restoreState(state)
     geometry = settings.value("mainwindow/geometry", None)
     if geometry:
         self.restoreGeometry(geometry)
开发者ID:qtx0213,项目名称:mcedit2,代码行数:8,代码来源:editorapp.py

示例2: __init__

    def __init__(self, name, parent, shortcutName=None, *args, **kwargs):
        super(MCEAction, self).__init__(name, parent, *args, **kwargs)
        self.shortcutName = shortcutName
        if shortcutName:
            settings = Settings()
            settingsKey = "keybinding/" + shortcutName
            option = settings.getOption(settingsKey)

            _binding_names[shortcutName] = name

            shortcutString = option.value()
            if shortcutString is not None:
                self.setShortcut(QtGui.QKeySequence(shortcutString))

            option.valueChanged.connect(self.shortcutChanged)
开发者ID:101baja202,项目名称:mcedit2,代码行数:15,代码来源:mceaction.py

示例3: __init__

    def __init__(self):
        """
        An action that can be bound to a keypress or mouse button click, drag, or movement with the bound key or button held.

        """
        super(ViewAction, self).__init__()

        if self.settingsKey is not None:
            settings = Settings()
            prefix = "keybindings/"
            try:
                modifiers = int(settings.value(prefix + self.settingsKey + "/modifiers", self.modifiers))
                button = int(settings.value(prefix + self.settingsKey + "/button", self.button))
                key = int(settings.value(prefix + self.settingsKey + "/key", self.key))
            except Exception as e:
                log.error("Error while reading key binding:")
            else:
                self.modifiers = modifiers
                self.button = button
                self.key = key
开发者ID:101baja202,项目名称:mcedit2,代码行数:20,代码来源:viewaction.py

示例4: setBinding

 def setBinding(self, button, key, modifiers):
     self.button = button
     self.key = key
     self.modifiers = modifiers
     if self.settingsKey is not None:
         settings = Settings()
         prefix = "keybindings/"
         settings.setValue(prefix + self.settingsKey + "/button", self.button)
         settings.setValue(prefix + self.settingsKey + "/key", self.key)
         settings.setValue(prefix + self.settingsKey + "/modifiers", int(self.modifiers))
开发者ID:101baja202,项目名称:mcedit2,代码行数:10,代码来源:viewaction.py

示例5: Settings

from mcedit2.util.worldloader import LoaderTimer

from mcedit2.widgets.layout import Column, Row, setWidgetError
from mcedit2.worldview.minimap import MinimapWorldView
from mceditlib.anvil.adapter import AnvilWorldAdapter
from mceditlib.geometry import Vector
from mceditlib.exceptions import LevelFormatError, PlayerNotFound
from mceditlib import worldeditor

import logging
from mceditlib.findadapter import isLevel
from mceditlib.worldeditor import WorldEditor

log = logging.getLogger(__name__)

WorldListSettings = Settings().getNamespace('world_list')
WorldListSettings.allSavesFolders = WorldListSettings.getOption('saves_folders', 'json', [])
WorldListSettings.currentSavesFolder = WorldListSettings.getOption('current_saves_folder', unicode, '')
WorldListSettings.lastChosenSavesFolder = WorldListSettings.getOption('last_chosen_saves_folder', unicode, '')

class WorldListItemWidget(QtGui.QWidget):
    doubleClicked = QtCore.Signal()

    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)

        self.displayNameLabel = QtGui.QLabel("namenamename")
        self.lastPlayedLabel = QtGui.QLabel("lastplayed")
        self.versionInfoLabel = QtGui.QLabel("version")

        #self.sizeLabel = QtGui.QLabel(self.tr("Calculating area..."))
开发者ID:KevinKelley,项目名称:mcedit2,代码行数:31,代码来源:worldlist.py

示例6: Settings

from mcedit2.worldview.minimap import MinimapWorldView
from mcedit2.worldview.overhead import OverheadWorldViewFrame
from mceditlib import util, nbt, faces
from mceditlib.anvil.biome_types import BiomeTypes
from mceditlib.geometry import Vector
from mceditlib.operations import ComposeOperations
from mceditlib.operations.entity import RemoveEntitiesOperation
from mceditlib.selection import BoundingBox
from mceditlib.exceptions import PlayerNotFound, ChunkNotPresent
from mceditlib.revisionhistory import UndoFolderExists, RevisionChanges
from mceditlib.worldeditor import WorldEditor
from mceditlib.blocktypes import BlockType

log = logging.getLogger(__name__)

sessionSettings = Settings().getNamespace("editorsession")
currentViewSetting = sessionSettings.getOption("currentview", unicode, "cam")

# An EditorSession is a world currently opened for editing, the state of the editor including the
# current selection box, the editor tab containing its viewports, its command history, its shared OpenGL context,
# a separate instance of each editor tool (why?), and the ChunkLoader that coordinates loading
# chunks into its viewports.

class PendingImport(object):
    def __init__(self, schematic, pos, text):
        self.text = text
        self.pos = pos
        self.schematic = schematic

    def __repr__(self):
        return "%s(%r, %r)" % (self.__class__.__name__, self.schematic, self.pos)
开发者ID:EvilSupahFly,项目名称:mcedit2,代码行数:31,代码来源:editorsession.py

示例7: ChangeBinding

def ChangeBinding(shortcutName, shortcutString):
    settings = Settings()
    settings.setValue("keybinding/" + shortcutName, shortcutString)
开发者ID:101baja202,项目名称:mcedit2,代码行数:3,代码来源:mceaction.py

示例8: Settings

from PySide import QtGui, QtCore

from mcedit2.sentry import get_sentry_client
from mcedit2.ui.dialogs.error_dialog import Ui_errorDialog
from mcedit2.util import qglcontext
from mcedit2.util.resources import isSrcCheckout
from mcedit2.util.screen import centerWidgetInScreen
from mcedit2.util.settings import Settings
from mcedit2.util.showprogress import MCEProgressDialog

log = logging.getLogger(__name__)

_errorShown = False

settings = Settings()

ReportErrorSetting = settings.getOption("errors/reporting_enabled", bool, True)


def showErrorDialog(text, tb=None, fatal=True, report=True):
    global _errorShown
    if tb is None:
        tb = sys.exc_info()
    _errorShown = True
    grabber = QtGui.QWidget.mouseGrabber()
    if grabber:
        grabber.releaseMouse()
        
    dialog = ErrorDialog(text, tb, fatal, report)
    dialog.exec_()
开发者ID:mcedit,项目名称:mcedit2,代码行数:30,代码来源:error_dialog.py

示例9: saveSettings

 def saveSettings(self):
     settings = Settings()
     settings.setValue("mainwindow/state", self.saveState())
     settings.setValue("mainwindow/geometry", self.saveGeometry())
     settings.sync()
开发者ID:qtx0213,项目名称:mcedit2,代码行数:5,代码来源:editorapp.py

示例10: Settings

from mcedit2.util import profiler
from mcedit2.util.settings import Settings
from mcedit2.widgets.layout import Column, Row
from mcedit2.widgets.spinslider import SpinSlider
from mceditlib import faces
from mceditlib.geometry import Vector
from mceditlib.util.lazyprop import lazyprop
from mcedit2.worldview.viewcontrols import ViewControls
from mcedit2.worldview.worldview import WorldView, iterateChunks, anglesToVector
from mcedit2.worldview.viewaction import ViewAction


log = logging.getLogger(__name__)

settings = Settings().getNamespace("worldview/camera")
ViewDistanceSetting = settings.getOption("view_distance", int, 12)
PerspectiveSetting = settings.getOption("perspective", bool, True)

class CameraWorldViewFrame(QtGui.QWidget):
    def __init__(self, dimension, textureAtlas, geometryCache, shareGLWidget, *args, **kwargs):
        super(CameraWorldViewFrame, self).__init__(*args, **kwargs)

        self.worldView = view = CameraWorldView(dimension, textureAtlas, geometryCache, shareGLWidget)

        self.viewControls = ViewControls(view)

        ViewDistanceSetting.connectAndCall(view.setViewDistance)

        viewDistanceInput = QtGui.QSpinBox(minimum=2, maximum=64, singleStep=2)
        viewDistanceInput.setValue(self.worldView.viewDistance)
开发者ID:pamunoz,项目名称:mcedit2,代码行数:30,代码来源:camera.py

示例11: Settings

import os
import imp
from mcedit2 import editortools
from mcedit2.editortools import generate
from mcedit2.util import load_ui
from mcedit2.util.settings import Settings
from mcedit2.widgets import inspector
from mceditlib.anvil import entities

log = logging.getLogger(__name__)

import sys

sys.dont_write_bytecode = True

settings = Settings().getNamespace("plugins")

enabledPluginsSetting = settings.getOption("enabled_plugins", "json", {})
autoReloadSetting = settings.getOption("auto_reload", bool, True)

# *** plugins dialog will need to:
# v get a list of (plugin display name, plugin reference, isEnabled) tuples for loaded and
#       unloaded plugins.
# v enable or disable a plugin using its reference
# - reload a plugin
# - find out if a plugin was removed from the folder or failed to compile or run
# - install a new plugin using a file chooser
# - open the plugins folder(s) in Finder/Explorer

# *** on startup:
# v scan all plugins dirs for plugins
开发者ID:pamunoz,项目名称:mcedit2,代码行数:31,代码来源:plugins.py

示例12: __init__

    def __init__(self, editorSession):
        """

        :type editorSession: mcedit2.editorsession.EditorSession
        :rtype: EditorTab
        """
        settings = Settings()

        QtGui.QWidget.__init__(self)
        self.setContentsMargins(0, 0, 0, 0)

        self.editorSession = editorSession
        self.editorSession.dimensionChanged.connect(self.dimensionDidChange)
        self.debugLastCenters = []

        self.viewButtonGroup = QtGui.QButtonGroup(self)
        self.viewButtonToolbar = QtGui.QToolBar()
        self.viewButtons = {}
        self.viewFrames = []
        self.views = []

        for name, handler in (
            ("2D", self.showCutawayView),
            ("Over", self.showOverheadView),
            # ("Iso", self.showIsoView),
            ("Cam", self.showCameraView),
            # ("4-up", self.showFourUpView),
        ):
            button = QtGui.QToolButton(text=name, checkable=True)
            button.clicked.connect(handler)
            self.viewButtonGroup.addButton(button)
            self.viewButtonToolbar.addWidget(button)
            self.viewButtons[name] = button

        self.viewStack = QtGui.QStackedWidget()

        self.miniMap = MinimapWorldView(editorSession.currentDimension, editorSession.textureAtlas, editorSession.geometryCache)
        self.miniMapDockWidget = QtGui.QDockWidget("Minimap", objectName="MinimapWidget", floating=True)
        self.miniMapDockWidget.setWidget(self.miniMap)
        self.miniMapDockWidget.setFixedSize(256, 256)

        self.viewFrames.append(self.miniMap)

        self.toolOptionsArea = QtGui.QScrollArea()
        self.toolOptionsArea.setWidgetResizable(True)

        self.toolOptionsDockWidget = QtGui.QDockWidget("Tool Options", objectName="ToolOptionsWidget", floating=True)
        self.toolOptionsDockWidget.setWidget(self.toolOptionsArea)
        editorSession.dockWidgets.append((Qt.LeftDockWidgetArea, self.miniMapDockWidget))
        editorSession.dockWidgets.append((Qt.LeftDockWidgetArea, self.toolOptionsDockWidget))

        editorSession.loader.addClient(self.miniMap)

        self.overheadViewFrame = OverheadWorldViewFrame(editorSession.currentDimension, editorSession.textureAtlas, editorSession.geometryCache, self.miniMap)
        self.overheadViewFrame.worldView.viewID = "Over"
        self._addView(self.overheadViewFrame)

        self.cutawayViewFrame = CutawayWorldViewFrame(editorSession.currentDimension, editorSession.textureAtlas, editorSession.geometryCache, self.miniMap)
        self.cutawayViewFrame.worldView.viewID = "2D"
        self._addView(self.cutawayViewFrame)
        #
        # self.fourUpViewFrame = FourUpWorldViewFrame(editorSession.currentDimension, editorSession.textureAtlas, editorSession.geometryCache, self.miniMap)
        # self.fourUpViewFrame.worldView.viewID = "4-up"
        # self._addView(self.fourUpViewFrame)

        self.cameraViewFrame = CameraWorldViewFrame(editorSession.currentDimension, editorSession.textureAtlas, editorSession.geometryCache, self.miniMap)
        self.cameraViewFrame.worldView.viewID = "Cam"
        self.cameraView = self.cameraViewFrame.worldView
        self._addView(self.cameraViewFrame)

        self.viewStack.currentChanged.connect(self._viewChanged)
        self.viewChanged.connect(self.viewDidChange)

        self.setLayout(Column(self.viewButtonToolbar,
                              Row(self.viewStack, margin=0), margin=0))

        currentViewName = settings.value("mainwindow/currentview", "Cam")
        if currentViewName not in self.viewButtons:
            currentViewName = "Cam"
        self.viewButtons[currentViewName].click()
开发者ID:funplayer123456,项目名称:mcedit2,代码行数:80,代码来源:editorsession.py

示例13: Settings

from mcedit2.rendering import cubes
from mcedit2.rendering.selection import SelectionScene, SelectionFaceNode
from mcedit2.ui.selection_coord_widget import Ui_selectionCoordWidget
from mcedit2.util.glutils import gl
from mcedit2.rendering.depths import DepthOffsets
from mcedit2.rendering.scenegraph import scenenode, rendernode
from mcedit2.util.settings import Settings
from mcedit2.widgets.layout import Column
from mcedit2.widgets.shapewidget import ShapeWidget
from mceditlib import faces
from mceditlib.geometry import Vector
from mceditlib.selection import BoundingBox

log = logging.getLogger(__name__)

SelectionOptions = Settings().getNamespace("select_tool")
ClassicSelectionOption = SelectionOptions.getOption("classic_selection", bool, False)
StickySelectionOption = SelectionOptions.getOption("sticky_selection", bool, False)


class SelectionCoordinateWidget(QtGui.QWidget, Ui_selectionCoordWidget):
    def __init__(self, *args, **kwargs):
        super(SelectionCoordinateWidget, self).__init__(*args, **kwargs)
        self.setupUi(self)

        self.xMinInput.valueChanged.connect(self.setMinX)
        self.yMinInput.valueChanged.connect(self.setMinY)
        self.zMinInput.valueChanged.connect(self.setMinZ)
        self.xMaxInput.valueChanged.connect(self.setMaxX)
        self.yMaxInput.valueChanged.connect(self.setMaxY)
        self.zMaxInput.valueChanged.connect(self.setMaxZ)
开发者ID:qtx0213,项目名称:mcedit2,代码行数:31,代码来源:select.py

示例14: Settings

from mcedit2.util import profiler
from mcedit2.util.settings import Settings
from mcedit2.widgets.layout import Column, Row
from mcedit2.widgets.spinslider import SpinSlider
from mceditlib import faces
from mceditlib.geometry import Vector
from mceditlib.util.lazyprop import lazyprop
from mcedit2.worldview.viewcontrols import ViewControls
from mcedit2.worldview.worldview import WorldView, iterateChunks, anglesToVector
from mcedit2.worldview.viewaction import ViewAction


log = logging.getLogger(__name__)

settings = Settings().getNamespace("worldview/camera")
ViewDistanceSetting = settings.getOption("view_distance", int, 12)
PerspectiveSetting = settings.getOption("perspective", bool, True)
StickyMouselookSetting = settings.getOption("sticky_mouselook", bool, True)


class CameraWorldViewFrame(QtGui.QWidget):
    def __init__(self, dimension, textureAtlas, geometryCache, shareGLWidget, *args, **kwargs):
        super(CameraWorldViewFrame, self).__init__(*args, **kwargs)

        self.worldView = view = CameraWorldView(dimension, textureAtlas, geometryCache, shareGLWidget)

        auxControlWidget = QtGui.QWidget()
        
        StickyMouselookSetting.connectAndCall(view.setStickyMouselook)
        
开发者ID:KevinKelley,项目名称:mcedit2,代码行数:29,代码来源:camera.py

示例15: Settings

from PySide.QtCore import Qt
from PySide import QtGui, QtCore

from mcedit2.rendering.layers import Layer
from mcedit2.util import profiler
from mcedit2.util.settings import Settings
from mcedit2.widgets.layout import Column, Row
from mcedit2.util.lazyprop import lazyprop
from mcedit2.worldview.viewcontrols import ViewControls
from mcedit2.worldview.worldview import WorldView, iterateChunks, LayerToggleGroup
from mcedit2.worldview.viewaction import ViewAction


log = logging.getLogger(__name__)

settings = Settings()
ViewDistanceSetting = settings.getOption("worldview/camera/view_distance", int, 32)
PerspectiveSetting = settings.getOption("worldview/camera/perspective", bool, True)

class CameraWorldViewFrame(QtGui.QWidget):
    def __init__(self, dimension, geometryCache, resourceLoader, shareGLWidget, *args, **kwargs):
        super(CameraWorldViewFrame, self).__init__(*args, **kwargs)

        self.worldView = view = CameraWorldView(dimension, geometryCache, resourceLoader, shareGLWidget)

        self.viewControls = ViewControls(view)

        ViewDistanceSetting.connectAndCall(view.setViewDistance)

        viewDistanceInput = QtGui.QSpinBox(minimum=2, maximum=64, singleStep=2)
        viewDistanceInput.setValue(self.worldView.viewDistance)
开发者ID:skinny121,项目名称:mcedit2,代码行数:31,代码来源:camera.py


注:本文中的mcedit2.util.settings.Settings类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。