本文整理汇总了Python中albow.Column.add方法的典型用法代码示例。如果您正苦于以下问题:Python Column.add方法的具体用法?Python Column.add怎么用?Python Column.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类albow.Column
的用法示例。
在下文中一共展示了Column.add方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GeneratorPanel
# 需要导入模块: from albow import Column [as 别名]
# 或者: from albow.Column import add [as 别名]
def GeneratorPanel():
panel = Widget()
panel.chunkHeight = 64
panel.grass = True
panel.simulate = False
panel.snapshot = False
jarStorage = MCServerChunkGenerator.getDefaultJarStorage()
if jarStorage:
jarStorage.reloadVersions()
generatorChoice = ChoiceButton(["Minecraft Server", "Flatland"])
panel.generatorChoice = generatorChoice
col = [Row((Label("Generator:"), generatorChoice))]
noVersionsRow = Label("Will automatically download and use the latest version")
versionContainer = Widget()
heightinput = IntInputRow("Height: ", ref=AttrRef(panel, "chunkHeight"), min=0, max=255)
grassinput = CheckBoxLabel("Grass", ref=AttrRef(panel, "grass"))
flatPanel = Column([heightinput, grassinput], align="l")
def generatorChoiceChanged():
serverPanel.visible = generatorChoice.selectedChoice == "Minecraft Server"
flatPanel.visible = not serverPanel.visible
generatorChoice.choose = generatorChoiceChanged
versionChoice = None
if len(jarStorage.versions):
def checkForUpdates():
def _check():
yield
jarStorage.downloadCurrentServer(panel.snapshot)
yield
showProgress("Checking for server updates...", _check())
versionChoice.choices = sorted(jarStorage.versions, reverse=True)
versionChoice.choiceIndex = 0
versionChoice = ChoiceButton(sorted(jarStorage.versions, reverse=True))
versionChoice.set_size_for_text(200)
versionChoiceRow = (Row((
Label("Server version:"),
versionChoice,
Label("or"),
Button("Check for Updates", action=checkForUpdates))))
panel.versionChoice = versionChoice
versionContainer.add(versionChoiceRow)
else:
versionContainer.add(noVersionsRow)
versionContainer.shrink_wrap()
menu = Menu("Advanced", [
("Open Server Storage", "revealStorage"),
("Reveal World Cache", "revealCache"),
("Delete World Cache", "clearCache")
])
def presentMenu():
i = menu.present(advancedButton.parent, advancedButton.topleft)
if i != -1:
(revealStorage, revealCache, clearCache)[i]()
advancedButton = Button("Advanced...", presentMenu)
@alertException
def revealStorage():
mcplatform.platform_open(jarStorage.cacheDir)
@alertException
def revealCache():
mcplatform.platform_open(MCServerChunkGenerator.worldCacheDir)
# revealCacheRow = Row((Label("Minecraft Server Storage: "), Button("Open Folder", action=revealCache, tooltipText="Click me to install your own minecraft_server.jar if you have any.")))
@alertException
def clearCache():
MCServerChunkGenerator.clearWorldCache()
simRow = CheckBoxLabel("Simulate world", ref=AttrRef(panel, "simulate"),
tooltipText="Simulate the world for a few seconds after generating it. Reduces the save file size by processing all of the TileTicks.")
useSnapshotServer = CheckBoxLabel("Use snapshot versions", ref=AttrRef(panel, "snapshot"),
tooltipText="Uses the Latest Snapshot Terrain Generation")
simRow = Row((simRow, advancedButton), anchor="lrh")
#deleteCacheRow = Row((Label("Delete Temporary World File Cache?"), Button("Delete Cache!", action=clearCache, tooltipText="Click me if you think your chunks are stale.")))
serverPanel = Column([useSnapshotServer, versionContainer, simRow], align="l")
col.append(serverPanel)
col = Column(col, align="l")
col.add(flatPanel)
flatPanel.topleft = serverPanel.topleft
flatPanel.visible = False
panel.add(col)
panel.shrink_wrap()
#.........这里部分代码省略.........