當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。