本文整理汇总了Python中mcplatform.platform_open函数的典型用法代码示例。如果您正苦于以下问题:Python platform_open函数的具体用法?Python platform_open怎么用?Python platform_open使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了platform_open函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: makeSideColumn1
def makeSideColumn1(self):
def showLicense():
platform_open(os.path.join(directories.getDataDir(), "LICENSE.txt"))
def refresh():
version_utils.playercache.force_refresh()
hotkeys = [
("", "Controls", self.showKeyConfig),
("", "Graphics", self.showGraphicOptions),
("", "Options", self.showOptions),
("", "Homepage", lambda: platform_open("http://www.mcedit-unified.net"), "http://www.mcedit-unified.net"),
(
"",
"About MCEdit",
lambda: platform_open("http://www.mcedit-unified.net/about.html"),
"http://www.mcedit-unified.net/about.html",
),
("", "License", showLicense, os.path.join(directories.getDataDir(), "LICENSE.txt")),
("", "Refresh Player Names", refresh),
]
c = albow.HotkeyColumn(hotkeys)
return c
示例2: makeSideColumn1
def makeSideColumn1(self):
def showLicense():
#platform_open(os.path.join(directories.getDataDir(), "LICENSE.txt"))
platform_open(directories.getDataFile('LICENSE.txt'))
def refresh():
PlayerCache().force_refresh()
def update_mcver():
num = mcver_updater.run()
if num:
albow.alert("Version Definitions have been updated!\n\nPlease restart MCEdit-Unified to apply the changes")
else:
albow.alert("Version Definitions are already up-to-date!")
hotkeys = ([("",
"Controls",
self.showKeyConfig),
("",
"Graphics",
self.showGraphicOptions),
("",
"Options",
self.showOptions),
("",
"Homepage",
lambda: platform_open("http://www.mcedit-unified.net"),
"http://www.mcedit-unified.net"),
("",
"About MCEdit",
lambda: platform_open("http://www.mcedit-unified.net/about.html"),
"http://www.mcedit-unified.net/about.html"),
("",
"License",
showLicense,
#os.path.join(directories.getDataDir(), "LICENSE.txt")),
directories.getDataFile('LICENSE.txt')),
("",
"Refresh Player Names",
refresh),
("",
"Update Version Definitions",
update_mcver)
])
c = albow.HotkeyColumn(hotkeys)
return c
示例3: __init__
def __init__(self, tool):
Panel.__init__(self)
self.macro_steps = []
self.current_step = 0
self._filter_json = None
self.keys_panel = None
self.filterOptionsPanel = None
self.filterSelect = ChoiceButton([], choose=self.filterChanged, doNotTranslate=True)
self.binding_button = Button("", action=self.bind_key,
tooltipText="Click to bind this filter to a key")
self.filterLabel = Label("Filter:", fg_color=(177, 177, 255, 255))
self.filterLabel.mouse_down = lambda x: mcplatform.platform_open(directories.getFiltersDir())
self.filterLabel.tooltipText = "Click to open filters folder"
self.macro_button = Button("Record Macro", action=self.start_record_macro)
self.filterSelectRow = Row((self.filterLabel, self.filterSelect,
self.macro_button, self.binding_button))
self.confirmButton = Button("Filter", action=self.confirm)
self._recording = False
self._save_macro = False
self.tool = tool
self.selectedName = self.filter_json.get("Last Filter Opened", "")
示例4: __init__
def __init__(self, tool):
Panel.__init__(self, name="Panel.FilterToolPanel")
self.macro_steps = []
self.current_step = 0
self._filter_json = None
self.keys_panel = None
self.filterOptionsPanel = None
self.filterSelect = ChoiceButton([], choose=self.filterChanged, doNotTranslate=True)
self.binding_button = Button("", action=self.bind_key, tooltipText="Click to bind this filter to a key")
self.filterLabel = Label("Filter:", fg_color=(177, 177, 255, 255))
self.filterLabel.mouse_down = lambda x: mcplatform.platform_open(directories.getFiltersDir())
self.filterLabel.tooltipText = "Click to open filters folder"
self.macro_button = Button("Record Macro", action=self.start_record_macro)
self.filterSelectRow = Row((self.filterLabel, self.filterSelect, self.macro_button, self.binding_button))
self.confirmButton = Button("Filter", action=self.confirm)
self._recording = False
self._save_macro = False
self.tool = tool
self.selectedName = self.filter_json.get("Last Filter Opened", "")
utils = FilterUtils(
editor=tool.editor,
materials=self.tool.editor.level.materials,
custom_widget=tool.editor.addExternalWidget,
resize_selection_box=tool.editor._resize_selection_box,
)
utils_module = imp.new_module("filter_utils")
utils_module = utils
sys.modules["filter_utils"] = utils_module
示例5: check_for_version
def check_for_version(self):
new_version = release.check_for_new_version(self.version_info)
if new_version is not False:
answer = albow.ask(
_('Version {} is available').format(new_version["tag_name"]),
[
'Download',
'View',
'Ignore'
],
default=1,
cancel=2
)
if answer == "View":
platform_open(new_version["html_url"])
elif answer == "Download":
platform_open(new_version["asset"]["browser_download_url"])
albow.alert(_(' {} should now be downloading via your browser. You will still need to extract the downloaded file to use the updated version.').format(new_version["asset"]["name"]))
示例6: makeSideColumn
def makeSideColumn(self):
def showLicense():
platform_open(os.path.join(directories.getDataDir(), "LICENSE.txt"))
def showCacheDir():
platform_open(directories.getCacheDir())
readmePath = os.path.join(directories.getDataDir(), "README.html")
hotkeys = ([("",
"Controls",
self.showKeyConfig),
("",
"Graphics",
self.showGraphicOptions),
("",
"Options",
self.showOptions),
("",
"Homepage",
lambda: platform_open("http://khroki.github.io/MCEdit-Unified")),
("",
"About MCEdit",
lambda: platform_open("http://khroki.github.io/MCEdit-Unified/about.html")),
("",
"Recent Changes",
lambda: platform_open("http://khroki.github.io/MCEdit-Unified")),
("",
"License",
showLicense),
("",
"Config Files Folder",
showCacheDir),
])
c = mceutils.HotkeyColumn(hotkeys)
return c
示例7: reload
def reload(self):
for i in list(self.subwidgets):
self.remove(i)
tool = self.tool
if len(tool.filterModules) is 0:
self.add(Label("No filter modules found!"))
self.shrink_wrap()
return
if self.selectedFilterName is None or self.selectedFilterName not in tool.filterNames:
self.selectedFilterName = tool.filterNames[0]
self.filterSelect = ChoiceButton(tool.filterNames, choose=self.filterChanged)
self.filterSelect.selectedChoice = self.selectedFilterName
filterLabel = Label("Filter:", fg_color=(177, 177, 255, 255))
filterLabel.mouse_down = lambda x: mcplatform.platform_open(directories.getFiltersDir())
filterLabel.tooltipText = "Click to open filters folder"
self.filterSelectRow = filterSelectRow = Row((filterLabel, self.filterSelect))
self.confirmButton = Button("Filter", action=self.tool.confirm)
self.filterOptionsPanel = None
while self.filterOptionsPanel is None:
module = self.tool.filterModules[self.selectedFilterName]
try:
self.filterOptionsPanel = FilterModuleOptions(self.tool, module, _parent=self)
except Exception, e:
alert(_("Error creating filter inputs for {0}: {1}").format(module, e))
traceback.print_exc()
self.tool.filterModules.pop(self.selectedFilterName)
self.selectedFilterName = tool.filterNames[0]
if len(tool.filterNames) == 0:
raise ValueError("No filters loaded!")
示例8: showScreenshotsDir
def showScreenshotsDir():
try:
os.mkdir(os.path.join(directories.getCacheDir(), "screenshots"))
except OSError:
pass
platform_open(os.path.join(directories.getCacheDir(), "screenshots"))
示例9: showCacheDir
def showCacheDir():
try:
os.mkdir(directories.getCacheDir())
except OSError:
pass
platform_open(directories.getCacheDir())
示例10: showLicense
def showLicense():
platform_open(os.path.join(directories.getDataDir(), "LICENSE.txt"))
示例11: open_screenshots_folder
def open_screenshots_folder(self):
from mcplatform import platform_open
platform_open(os.path.join(directories.getCacheDir(), "screenshots"))
self.screenshot_notify()
示例12: revealCache
def revealCache():
mcplatform.platform_open(MCServerChunkGenerator.worldCacheDir)
示例13: revealStorage
def revealStorage():
mcplatform.platform_open(jarStorage.cacheDir)
示例14: main
def main(self):
displayContext = GLDisplayContext()
rootwidget = RootWidget(displayContext.display)
mcedit = MCEdit(displayContext)
rootwidget.displayContext = displayContext
rootwidget.confirm_quit = mcedit.confirm_quit
rootwidget.mcedit = mcedit
rootwidget.add(mcedit)
rootwidget.focus_switch = mcedit
if 0 == len(pymclevel.alphaMaterials.yamlDatas):
albow.alert("Failed to load minecraft.yaml. Check the console window for details.")
if mcedit.droppedLevel:
mcedit.loadFile(mcedit.droppedLevel)
new_version = release.check_for_new_version()
if new_version is not False:
answer = albow.ask(
_('Version {} is available').format(new_version["tag_name"]),
[
'Download',
'View',
'Ignore'
],
default=1,
cancel=2
)
if answer == "View":
platform_open(new_version["html_url"])
elif answer == "Download":
platform_open(new_version["asset"]["browser_download_url"])
albow.alert(_(' {} should now be downloading via your browser. You will still need to extract the downloaded file to use the updated version.').format(new_version["asset"]["name"]))
# Disabled old update code
# if hasattr(sys, 'frozen'):
# # We're being run from a bundle, check for updates.
# import esky
#
# app = esky.Esky(
# sys.executable.decode(sys.getfilesystemencoding()),
# 'https://bitbucket.org/codewarrior0/mcedit/downloads'
# )
# try:
# update_version = app.find_update()
# except:
# # FIXME: Horrible, hacky kludge.
# update_version = None
# logging.exception('Error while checking for updates')
#
# if update_version:
# answer = albow.ask(
# 'Version "%s" is available, would you like to '
# 'download it?' % update_version,
# [
# 'Yes',
# 'No',
# ],
# default=0,
# cancel=1
# )
# if answer == 'Yes':
# def callback(args):
# status = args['status']
# status_texts = {
# 'searching': u"Finding updates...",
# 'found': u"Found version {new_version}",
# 'downloading': u"Downloading: {received} / {size}",
# 'ready': u"Downloaded {path}",
# 'installing': u"Installing {new_version}",
# 'cleaning up': u"Cleaning up...",
# 'done': u"Done."
# }
# text = status_texts.get(status, 'Unknown').format(**args)
#
# panel = Dialog()
# panel.idleevent = lambda event: panel.dismiss()
# label = albow.Label(text, width=600)
# panel.add(label)
# panel.size = (500, 250)
# panel.present()
#
# try:
# app.auto_update(callback)
# except (esky.EskyVersionError, EnvironmentError):
# albow.alert(_("Failed to install update %s") % update_version)
# else:
# albow.alert(_("Version %s installed. Restart MCEdit to begin using it.") % update_version)
# raise SystemExit()
if config.settings.closeMinecraftWarning.get():
answer = albow.ask(
"Warning: Only open a world in one program at a time. If you open a world at the same time in MCEdit and in Minecraft, you will lose your work and possibly damage your save file.\n\n If you are using Minecraft 1.3 or earlier, you need to close Minecraft completely before you use MCEdit.",
["Don't remind me again.", "OK"], default=1, cancel=1)
if answer == "Don't remind me again.":
config.settings.closeMinecraftWarning.set(False)
# Disabled Crash Reporting Option
# if not config.settings.reportCrashesAsked.get():
#.........这里部分代码省略.........
示例15: showCacheDir
def showCacheDir():
platform_open(directories.getCacheDir())