本文整理汇总了Python中mcedit2.util.load_ui.load_ui函数的典型用法代码示例。如果您正苦于以下问题:Python load_ui函数的具体用法?Python load_ui怎么用?Python load_ui使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了load_ui函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, editorSession):
"""
:param editorSession:
:type editorSession: mcedit2.editorsession.EditorSession
:return:
:rtype:
"""
super(InspectorWidget, self).__init__()
load_ui("inspector.ui", baseinstance=self)
self.editorSession = editorSession
self.blockNBTEditor.editorSession = self.editorSession
self.entityNBTEditor.editorSession = self.editorSession
self.chunkNBTEditor.editorSession = self.editorSession
self.blockEditorWidget = None
self.tileEntity = None
self.entity = None
self.currentChunk = None
# xxxx unused! how!
self.selectionNode = None
self.overlayNode = scenenode.Node()
self.chunkTabWidget.currentChanged.connect(self.chunkTabDidChange)
self.terrainPopulatedInput.toggled.connect(self.terrainPopulatedDidChange)
self.lightPopulatedInput.toggled.connect(self.lightPopulatedDidChange)
self.inhabitedTimeInput.valueChanged.connect(self.inhabitedTimeDidChange)
self.updateTimeInput.valueChanged.connect(self.updateTimeDidChange)
示例2: __init__
def __init__(self, text, exc_info, fatal):
super(ErrorDialog, self).__init__()
load_ui("error_dialog.ui", baseinstance=self)
exc_type, exc_value, exc_tb = exc_info
self.errorDescriptionLabel.setText(text)
tbText = "".join(traceback.format_exception(exc_type, exc_value, exc_tb))
contextInfo = qglcontext.getContextInfo() or ""
from mcedit2 import __version__
tbText = "MCEdit version: %s\n" \
"Python version: %s\n" \
"Platform: %s\n" \
"System version: %s\n" \
"Processor: %s\n" \
"\n" \
"%s\n" \
"------\n\n" \
"%s\n\n" \
"%s" % (__version__, sys.version, sys.platform,
platform.platform(), platform.processor(),
contextInfo, text, tbText)
self.tracebackView.setText(tbText)
self.restartMCEditLabel.setVisible(fatal)
示例3: __init__
def __init__(self):
super(RotationWidget, self).__init__()
load_ui("rotation_widget.ui", baseinstance=self)
self.xRotSlider.valueChanged.connect(self.setXRot)
self.yRotSlider.valueChanged.connect(self.setYRot)
self.zRotSlider.valueChanged.connect(self.setZRot)
self.xRotSlider.sliderReleased.connect(self.sliderReleased)
self.yRotSlider.sliderReleased.connect(self.sliderReleased)
self.zRotSlider.sliderReleased.connect(self.sliderReleased)
self.xRotSpinBox.valueChanged.connect(self.setXRot)
self.yRotSpinBox.valueChanged.connect(self.setYRot)
self.zRotSpinBox.valueChanged.connect(self.setZRot)
icon = QtGui.QIcon(resourcePath("mcedit2/assets/mcedit2/icons/right_angle.png"))
self.xRot90Button.setIcon(icon)
self.yRot90Button.setIcon(icon)
self.zRot90Button.setIcon(icon)
self.xRot90Button.clicked.connect(self.xRot90Clicked)
self.yRot90Button.clicked.connect(self.yRot90Clicked)
self.zRot90Button.clicked.connect(self.zRot90Clicked)
self.xRot = self.yRot = self.zRot = 0
示例4: __init__
def __init__(self, blocktypes, textureAtlas, blocksToShow=None):
"""
:param blocktypes:
:type blocktypes: mceditlib.blocktypes.BlockTypeSet
:param textureAtlas:
:type textureAtlas: mcedit2.rendering.textureatlas.TextureAtlas
:param blocksToShow:
:type blocksToShow: None or list[basestring or BlockType]
:return:
:rtype: BlockListWidget
"""
super(BlockListWidget, self).__init__()
load_ui("blocktype_list.ui", baseinstance=self)
table = self.tableWidget
columns = ("Block", "Name", "ID", "blockData", "unlocalizedName")
table.setRowCount(len(blocktypes))
table.setColumnCount(len(columns))
table.setHorizontalHeaderLabels(columns)
for row, block in enumerate(blocktypes):
icon = QtGui.QIcon(BlockTypePixmap(block, textureAtlas))
table.setItem(row, 0, QtGui.QTableWidgetItem(icon, block.internalName + block.blockState))
datas = (None, block.displayName, str(block.ID), str(block.meta), block.internalName + block.blockState)
for i, data in enumerate(datas):
if data is not None:
table.setItem(row, i, QtGui.QTableWidgetItem(data))
示例5: __init__
def __init__(self, *args, **kwargs):
super(CoordinateWidget, self).__init__(*args, **kwargs)
load_ui("coord_widget.ui", baseinstance=self)
self.xInput.valueChanged.connect(self.setX)
self.yInput.valueChanged.connect(self.setY)
self.zInput.valueChanged.connect(self.setZ)
示例6: __init__
def __init__(self, editorSession):
"""
:type editorSession: mcedit2.editorsession.EditorSession
:rtype: PlayerPanel
"""
super(PlayerPanel, self).__init__(f=Qt.Tool)
self.editorSession = editorSession
self.selectedUUID = None
load_ui("panels/player.ui", baseinstance=self)
self.movePlayerButton.clicked.connect(self.movePlayerToCamera)
self.viewPlayerButton.clicked.connect(self.showPlayerView)
playerUUIDs = list(editorSession.worldEditor.listPlayers())
try:
sp = editorSession.worldEditor.getPlayer("")
singlePlayerUUID = sp.UUID
except PlayerNotFound:
log.info("No single-player.")
singlePlayerUUID = None
except KeyError:
log.info("Failed to get single-player UUID.")
singlePlayerUUID = None
for UUID in playerUUIDs: # xxx live update?
if UUID == "":
displayName = "[Single-player](%s)" % singlePlayerUUID
else:
displayName = UUID # xxx mojang api here
try:
UUID = uuid.UUID(hex=UUID)
if UUID == singlePlayerUUID:
continue # Don't count single-player twice when it appears under playerData/
except ValueError: # badly formed uuid?
log.warn("Could not get a UUID from %s", UUID)
continue
self.playerListBox.addItem(displayName, UUID)
self.playerListBox.currentIndexChanged[int].connect(self.setSelectedPlayerIndex)
if len(playerUUIDs):
self.setSelectedPlayerIndex(0)
icon = QtGui.QIcon(resourcePath("mcedit2/assets/mcedit2/icons/edit_player.png"))
action = QtGui.QAction(icon, "Edit Player", self)
action.setCheckable(True)
action.triggered.connect(self.toggleView)
self._toggleViewAction = action
self.editorSession.revisionChanged.connect(self.revisionDidChange)
self.initPropertiesWidget()
self.nbtEditor.editorSession = self.editorSession
self.nbtEditor.editMade.connect(self.nbtEditWasMade)
centerWidgetInScreen(self)
示例7: __init__
def __init__(self, *args, **kwargs):
super(SelectionCoordinateWidget, self).__init__(*args, **kwargs)
load_ui("selection_coord_widget.ui", baseinstance=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)
self.editSizeInput.stateChanged.connect(self.editSizeClicked)
示例8: __init__
def __init__(
self, editorSession, blockCount, entityCount, tileEntityCount, worldName, parent=None, *args, **kwargs
):
super(AnalyzeOutputDialog, self).__init__(parent, *args, **kwargs)
self.editorSession = editorSession
self.blocktypes = editorSession.worldEditor.blocktypes
self.worldName = worldName
load_ui("analyze.ui", baseinstance=self)
self.setupTables(blockCount, entityCount, tileEntityCount)
self.txtButton.clicked.connect(self.export_txt)
self.csvButton.clicked.connect(self.export_csv)
示例9: __init__
def __init__(self, parent=None):
super(WorldListWidget, self).__init__(parent, f=Qt.Tool)
self.setWindowTitle("World List")
self.setWindowModality(Qt.NonModal)
load_ui('world_list.ui', baseinstance=self)
self.worldView = None
self.chunkLoader = None
self.errorWidget = None
self.blankWidget = QtGui.QWidget()
self.stackedWidget.addWidget(self.blankWidget)
self.editButton.clicked.connect(self.editClicked)
self.cancelButton.clicked.connect(self.reject)
self.showListAgainInput.setEnabled(False)
self.viewButton.clicked.connect(self.viewClicked)
self.viewButton.setEnabled(False)
self.openWorldButton.clicked.connect(self.openWorldClicked)
self.repairButton.clicked.connect(self.repairClicked)
self.repairButton.setEnabled(False)
self.backupButton.clicked.connect(self.backupClicked)
self.backupButton.setEnabled(False)
self.configureButton.clicked.connect(self.configureClicked)
centerWidgetInScreen(self, 0.75)
delegate = WorldListItemDelegate()
self.worldListView.setItemDelegate(delegate)
delegate.setParent(self.worldListView) # PYSIDE-152: get the view widget to the drawPrimitive call
self.worldListView.clicked.connect(self.worldListItemClicked)
self.worldListView.doubleClicked.connect(self.worldListItemDoubleClicked)
self.loadTimer = LoaderTimer(interval=0, timeout=self.loadTimerFired)
self.loadTimer.start()
self._updateInstalls()
self.savesFolderComboBox.currentIndexChanged.connect(self.reloadList)
self.minecraftInstallBox.currentIndexChanged.connect(minecraftinstall.currentInstallOption.setValue)
self.minecraftVersionBox.currentIndexChanged[str].connect(minecraftinstall.currentVersionOption.setValue)
self.resourcePackBox.currentIndexChanged.connect(self.resourcePackChanged)
self.worldListModel = None
self.reloadList()
self.reloadRecentWorlds()
示例10: __init__
def __init__(self, editorSession, *args, **kwargs):
"""
:type editorSession: EditorSession
"""
super(ChunkTool, self).__init__(editorSession, *args, **kwargs)
self.toolWidget = load_ui("editortools/edit_chunk.ui")
self.toolWidget.tabWidget.currentChanged.connect(self.tabDidChange)
self.toolWidget.terrainPopulatedInput.toggled.connect(self.terrainPopulatedDidChange)
self.toolWidget.lightPopulatedInput.toggled.connect(self.lightPopulatedDidChange)
self.toolWidget.inhabitedTimeInput.valueChanged.connect(self.inhabitedTimeDidChange)
self.toolWidget.updateTimeInput.valueChanged.connect(self.updateTimeDidChange)
self.toolWidget.cxSpinBox.valueChanged.connect(self.chunkPositionDidChange)
self.toolWidget.czSpinBox.valueChanged.connect(self.chunkPositionDidChange)
self.toolWidget.nbtEditor.editorSession = self.editorSession
self.currentChunk = None
self.selectionNode = None
self.overlayNode = scenegraph.Node()
self.updateChunkWidget()
self.updateNBTView()
示例11: __init__
def __init__(self, editorSession, *args, **kwargs):
super(BrushTool, self).__init__(editorSession, *args, **kwargs)
self.toolWidget = load_ui("editortools/brush.ui")
BrushModeSetting.connectAndCall(self.modeSettingChanged)
self.cursorWorldScene = None
self.cursorNode = scenegraph.TranslateNode()
self.toolWidget.xSpinSlider.setMinimum(1)
self.toolWidget.ySpinSlider.setMinimum(1)
self.toolWidget.zSpinSlider.setMinimum(1)
self.toolWidget.xSpinSlider.valueChanged.connect(self.setX)
self.toolWidget.ySpinSlider.valueChanged.connect(self.setY)
self.toolWidget.zSpinSlider.valueChanged.connect(self.setZ)
self.toolWidget.brushShapeInput.shapeChanged.connect(self.updateCursor)
self.fillBlock = editorSession.worldEditor.blocktypes["stone"]
self.brushSize = BrushSizeSetting.value(QtGui.QVector3D(5, 5, 5)).toTuple() # calls updateCursor
self.toolWidget.xSpinSlider.setValue(self.brushSize[0])
self.toolWidget.ySpinSlider.setValue(self.brushSize[1])
self.toolWidget.zSpinSlider.setValue(self.brushSize[2])
示例12: __init__
def __init__(self, editorSession, *args, **kwargs):
"""
:type editorSession: EditorSession
"""
super(SelectBlockTool, self).__init__(editorSession, *args, **kwargs)
self.mousePos = None
self.toolWidget = load_ui("editortools/select_block.ui")
示例13: __init__
def __init__(self, editorSession, *args, **kwargs):
super(BrushTool, self).__init__(editorSession, *args, **kwargs)
self.toolWidget = load_ui("editortools/brush.ui")
self.brushMode = None
self.brushLoader = None
self.brushModesByName = {cls.name:cls() for cls in BrushModeClasses}
modes = self.brushModesByName.values()
modes.sort(key=lambda m: m.name)
self.toolWidget.brushModeInput.setModes(modes)
BrushModeSetting.connectAndCall(self.modeSettingChanged)
self.cursorWorldScene = None
self.cursorNode = TranslateNode()
self.toolWidget.xSpinSlider.setMinimum(1)
self.toolWidget.ySpinSlider.setMinimum(1)
self.toolWidget.zSpinSlider.setMinimum(1)
self.toolWidget.xSpinSlider.valueChanged.connect(self.setX)
self.toolWidget.ySpinSlider.valueChanged.connect(self.setY)
self.toolWidget.zSpinSlider.valueChanged.connect(self.setZ)
self.toolWidget.brushShapeInput.shapeChanged.connect(self.updateCursor)
self.toolWidget.brushShapeInput.shapeOptionsChanged.connect(self.updateCursor)
self.fillBlock = editorSession.worldEditor.blocktypes["stone"]
self.brushSize = BrushSizeSetting.value(QtGui.QVector3D(5, 5, 5)).toTuple() # calls updateCursor
self.toolWidget.xSpinSlider.setValue(self.brushSize[0])
self.toolWidget.ySpinSlider.setValue(self.brushSize[1])
self.toolWidget.zSpinSlider.setValue(self.brushSize[2])
示例14: __init__
def __init__(self, editorSession, *args, **kwargs):
super(FindReplaceDialog, self).__init__(*args, **kwargs)
self.editorSession = editorSession
self.blocktypes = editorSession.worldEditor.blocktypes
load_ui("find_replace.ui", baseinstance=self)
self.findReplaceBlocks = FindReplaceBlocks(editorSession, self)
self.findReplaceNBT = FindReplaceNBT(editorSession, self)
self.nbtTab.setLayout(Column(self.findReplaceNBT.widget, margin=0))
self.resultsWidgets = [
# self.findReplaceBlocks.resultsDockWidget,
self.findReplaceNBT.resultsDockWidget,
]
self.adjustSize()
示例15: __init__
def __init__(self, parent):
super(ConfigureBlocksDialog, self).__init__(parent)
load_ui("configure_blocks_dialog.ui", baseinstance=self)
self.okButton.clicked.connect(self.accept)
self.texListNameProxyModel = None
self.texListZipProxyModel = None
self.model = ConfigureBlocksItemModel()
self.itemDelegate = ConfigureBlocksItemDelegate()
self.blocksView.setModel(self.model)
self.blocksView.setItemDelegate(self.itemDelegate)
self.blocksView.clicked.connect(self.currentBlockClicked)
self.addBlockButton.clicked.connect(self.addBlock)
self.removeBlockButton.clicked.connect(self.removeBlock)
headerWidths = [
48,
200,
75,
60,
60,
75,
180,
180,
]
for i, w in enumerate(headerWidths):
self.blocksView.setColumnWidth(i, w)
self.setModelControlsEnabled(False)
self.modelNameBox.activated.connect(self.modelNameChanged)
header = self.modelTexturesTable.horizontalHeader()
header.resizeSection(0, 50)
header.resizeSection(2, 40)
header.setResizeMode(2, QtGui.QHeaderView.Fixed)
header.setResizeMode(1, QtGui.QHeaderView.Stretch)
self.textureList.clicked.connect(self.textureClicked)
self.textureSearchBox.editTextChanged.connect(self.textureSearched)
self.textureZipBox.activated[int].connect(self.textureZipChanged)