本文整理汇总了Python中mcedit2.util.settings.Settings.value方法的典型用法代码示例。如果您正苦于以下问题:Python Settings.value方法的具体用法?Python Settings.value怎么用?Python Settings.value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mcedit2.util.settings.Settings
的用法示例。
在下文中一共展示了Settings.value方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: loadSettings
# 需要导入模块: from mcedit2.util.settings import Settings [as 别名]
# 或者: from mcedit2.util.settings.Settings import value [as 别名]
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)
示例2: __init__
# 需要导入模块: from mcedit2.util.settings import Settings [as 别名]
# 或者: from mcedit2.util.settings.Settings import value [as 别名]
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
示例3: __init__
# 需要导入模块: from mcedit2.util.settings import Settings [as 别名]
# 或者: from mcedit2.util.settings.Settings import value [as 别名]
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()