本文整理匯總了Python中mcedit2.util.settings.Settings.getOption方法的典型用法代碼示例。如果您正苦於以下問題:Python Settings.getOption方法的具體用法?Python Settings.getOption怎麽用?Python Settings.getOption使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類mcedit2.util.settings.Settings
的用法示例。
在下文中一共展示了Settings.getOption方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from mcedit2.util.settings import Settings [as 別名]
# 或者: from mcedit2.util.settings.Settings import getOption [as 別名]
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)
示例2: Settings
# 需要導入模塊: from mcedit2.util.settings import Settings [as 別名]
# 或者: from mcedit2.util.settings.Settings import getOption [as 別名]
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..."))
# areaText = self.tr("%.02f million square meters") % (world.chunkCount * 0.25)
示例3: Settings
# 需要導入模塊: from mcedit2.util.settings import Settings [as 別名]
# 或者: from mcedit2.util.settings.Settings import getOption [as 別名]
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)
示例4: Settings
# 需要導入模塊: from mcedit2.util.settings import Settings [as 別名]
# 或者: from mcedit2.util.settings.Settings import getOption [as 別名]
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_()
_errorShown = False
示例5: Settings
# 需要導入模塊: from mcedit2.util.settings import Settings [as 別名]
# 或者: from mcedit2.util.settings.Settings import getOption [as 別名]
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)
viewDistanceInput.valueChanged.connect(ViewDistanceSetting.setValue)
示例6: Settings
# 需要導入模塊: from mcedit2.util.settings import Settings [as 別名]
# 或者: from mcedit2.util.settings.Settings import getOption [as 別名]
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
# - check if a plugin is enabled (without executing it?)
# - load plugins set to "enabled" in settings
示例7: Settings
# 需要導入模塊: from mcedit2.util.settings import Settings [as 別名]
# 或者: from mcedit2.util.settings.Settings import getOption [as 別名]
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)
示例8: Settings
# 需要導入模塊: from mcedit2.util.settings import Settings [as 別名]
# 或者: from mcedit2.util.settings.Settings import getOption [as 別名]
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)
stickyCheckbox = QtGui.QCheckBox(self.tr("Sticky Mouselook"))
示例9: Settings
# 需要導入模塊: from mcedit2.util.settings import Settings [as 別名]
# 或者: from mcedit2.util.settings.Settings import getOption [as 別名]
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)
viewDistanceInput.valueChanged.connect(ViewDistanceSetting.setValue)