本文整理汇总了Python中umake.ui.UI.display方法的典型用法代码示例。如果您正苦于以下问题:Python UI.display方法的具体用法?Python UI.display怎么用?Python UI.display使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类umake.ui.UI
的用法示例。
在下文中一共展示了UI.display方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: check_external_license
# 需要导入模块: from umake.ui import UI [as 别名]
# 或者: from umake.ui.UI import display [as 别名]
def check_external_license(self, result):
"""Check external license which is in a separate page (can be factorized in BaseInstaller)"""
logger.debug("Parse license page")
error_msg = result[self.license_url].error
if error_msg:
logger.error("An error occurred while downloading {}: {}".format(self.license_url, error_msg))
UI.return_main_screen(status_code=1)
with StringIO() as license_txt:
in_license = False
for line in result[self.license_url].buffer:
line = line.decode()
if ('SOFTWARE LICENSE TERMS' in line):
in_license = True
if in_license and "<strong>* * *</strong>" in line:
in_license = False
continue
if in_license:
license_txt.write(line.strip() + "\n")
if license_txt.getvalue() != "":
logger.debug("Check license agreement.")
UI.display(LicenseAgreement(strip_tags(license_txt.getvalue()).strip(),
self.start_download_and_install,
UI.return_main_screen))
else:
logger.error("We were expecting to find a license, we didn't.")
UI.return_main_screen(status_code=1)
示例2: confirm_path
# 需要导入模块: from umake.ui import UI [as 别名]
# 或者: from umake.ui.UI import display [as 别名]
def confirm_path(self, path_dir=""):
"""Confirm path dir"""
if not path_dir:
logger.debug("No installation path provided. Requesting one.")
UI.display(InputText("Choose installation path:", self.confirm_path, self.install_path))
return
logger.debug("Installation path provided. Checking if exists.")
with suppress(FileNotFoundError):
if os.listdir(path_dir):
# we already told we were ok to overwrite as it was the previous install path
if path_dir not in self._paths_to_clean:
if path_dir == "/":
logger.error("This doesn't seem wise. We won't let you shoot in your feet.")
self.confirm_path()
return
self.install_path = path_dir # we don't set it before to not repropose / as installation path
UI.display(YesNo("{} isn't an empty directory, do you want to remove its content and install "
"there?".format(path_dir), self.set_installdir_to_clean, UI.return_main_screen))
return
self.install_path = path_dir
if self.desktop_filename:
self.exec_path = os.path.join(self.install_path, self.required_files_path[0])
# if self.exec_rel_path:
# self.exec_path = os.path.join(self.install_path, self.exec_rel_path)
self.download_provider_page()
示例3: post_install
# 需要导入模块: from umake.ui import UI [as 别名]
# 或者: from umake.ui.UI import display [as 别名]
def post_install(self):
"""Add necessary environment variables"""
add_env_to_user(self.name, {"NDK_ROOT": {"value": self.install_path, "keep": False}})
# print wiki page message
UI.display(DisplayMessage("NDK installed in {}. More information on how to use it on {}".format(
self.install_path,
"https://developer.android.com/tools/sdk/ndk/index.html#GetStarted")))
示例4: decompress_and_install
# 需要导入模块: from umake.ui import UI [as 别名]
# 或者: from umake.ui.UI import display [as 别名]
def decompress_and_install(self, fd):
UI.display(DisplayMessage("Installing {}".format(self.name)))
# empty destination directory if reinstall
for dir_to_remove in self._paths_to_clean:
with suppress(FileNotFoundError):
shutil.rmtree(dir_to_remove)
Decompressor({fd: Decompressor.DecompressOrder(dir=self.dir_to_decompress_in_tarball, dest=self.install_path)},
self.decompress_and_install_done)
UI.display(UnknownProgress(self.iterate_until_install_done))
示例5: test_call_display
# 需要导入模块: from umake.ui import UI [as 别名]
# 或者: from umake.ui.UI import display [as 别名]
def test_call_display(self, mocksys):
"""We call the display method from the UIPlug"""
UI.display(self.contentType)
self.start_glib_mainloop()
self.wait_for_mainloop_shutdown()
self.assertTrue(self.mockUIPlug._display.called)
self.assertIsNotNone(self.mainloop_thread)
self.assertIsNotNone(self.display_thread)
self.assertEqual(self.mainloop_thread, self.display_thread)
示例6: setup
# 需要导入模块: from umake.ui import UI [as 别名]
# 或者: from umake.ui.UI import display [as 别名]
def setup(self, arg_install_path=None):
self.arg_install_path = arg_install_path
super().setup()
# first step, check if installed
if self.is_installed:
UI.display(YesNo("{} is already installed on your system, do you want to reinstall "
"it anyway?".format(self.name), self.reinstall, UI.return_main_screen))
else:
self.confirm_path(arg_install_path)
示例7: decompress_and_install
# 需要导入模块: from umake.ui import UI [as 别名]
# 或者: from umake.ui.UI import display [as 别名]
def decompress_and_install(self, fd):
UI.display(DisplayMessage("Installing {}".format(self.name)))
shutil.copyfile(fd.name, self.install_path + '/drjava.jar')
self.post_install()
# Mark as installation done in configuration
self.mark_in_config()
UI.delayed_display(DisplayMessage("Installation done"))
UI.return_main_screen()
示例8: get_metadata_and_check_license
# 需要导入模块: from umake.ui import UI [as 别名]
# 或者: from umake.ui.UI import display [as 别名]
def get_metadata_and_check_license(self, result):
"""Download files to download + license and check it"""
logger.debug("Parse download metadata")
error_msg = result[self.download_page].error
if error_msg:
logger.error("An error occurred while downloading {}: {}".format(self.download_page, error_msg))
UI.return_main_screen(status_code=1)
url, checksum = (None, None)
with StringIO() as license_txt:
in_license = False
in_download = False
for line in result[self.download_page].buffer:
line_content = line.decode()
if self.expect_license and not self.auto_accept_license:
in_license = self.parse_license(line_content, license_txt, in_license)
# always take the first valid (url, checksum) if not match_last_link is set to True:
download = None
if url is None or (self.checksum_type and not checksum) or self.match_last_link:
(download, in_download) = self.parse_download_link(line_content, in_download)
if download is not None:
(newurl, new_checksum) = download
url = newurl if newurl is not None else url
checksum = new_checksum if new_checksum is not None else checksum
if url is not None:
if self.checksum_type and checksum:
logger.debug("Found download link for {}, checksum: {}".format(url, checksum))
elif not self.checksum_type:
logger.debug("Found download link for {}".format(url))
if url is None:
logger.error("Download page changed its syntax or is not parsable (url missing)")
UI.return_main_screen(status_code=1)
if (self.checksum_type and checksum is None):
logger.error("Download page changed its syntax or is not parsable (checksum missing)")
logger.error("URL is: {}".format(url))
UI.return_main_screen(status_code=1)
self.download_requests.append(DownloadItem(url, Checksum(self.checksum_type, checksum)))
if license_txt.getvalue() != "":
logger.debug("Check license agreement.")
UI.display(LicenseAgreement(strip_tags(license_txt.getvalue()).strip(),
self.start_download_and_install,
UI.return_main_screen))
elif self.expect_license and not self.auto_accept_license:
logger.error("We were expecting to find a license on the download page, we didn't.")
UI.return_main_screen(status_code=1)
else:
self.start_download_and_install()
示例9: start_download_and_install
# 需要导入模块: from umake.ui import UI [as 别名]
# 或者: from umake.ui.UI import display [as 别名]
def start_download_and_install(self):
self.last_progress_download = None
self.last_progress_requirement = None
self.balance_requirement_download = None
self.pkg_size_download = 0
self.result_requirement = None
self.result_download = None
self._download_done_callback_called = False
UI.display(DisplayMessage("Downloading and installing requirements"))
self.pbar = ProgressBar().start()
self.pkg_to_install = RequirementsHandler().install_bucket(self.packages_requirements,
self.get_progress_requirement,
self.requirement_done)
DownloadCenter(urls=self.download_requests, on_done=self.download_done, report=self.get_progress_download)
示例10: check_data_and_start_download
# 需要导入模块: from umake.ui import UI [as 别名]
# 或者: from umake.ui.UI import display [as 别名]
def check_data_and_start_download(self, url=None, checksum=None, license_txt=StringIO()):
if url is None:
logger.error("Download page changed its syntax or is not parsable (url missing)")
UI.return_main_screen(status_code=1)
if (self.checksum_type and checksum is None):
logger.error("Download page changed its syntax or is not parsable (checksum missing)")
logger.error("URL is: {}".format(url))
UI.return_main_screen(status_code=1)
self.download_requests.append(DownloadItem(url, Checksum(self.checksum_type, checksum)))
if license_txt.getvalue() != "":
logger.debug("Check license agreement.")
UI.display(LicenseAgreement(strip_tags(license_txt.getvalue()).strip(),
self.start_download_and_install,
UI.return_main_screen))
elif self.expect_license and not self.auto_accept_license:
logger.error("We were expecting to find a license on the download page, we didn't.")
UI.return_main_screen(status_code=1)
else:
self.start_download_and_install()
示例11: remove
# 需要导入模块: from umake.ui import UI [as 别名]
# 或者: from umake.ui.UI import display [as 别名]
def remove(self):
"""Remove current framework if installed
Not that we only remove desktop file, launcher icon and dir content, we do not remove
packages as they might be in used for other framework"""
# check if it's installed and so on.
super().remove()
UI.display(DisplayMessage("Removing {}".format(self.name)))
if self.desktop_filename:
with suppress(FileNotFoundError):
os.remove(get_launcher_path(self.desktop_filename))
if self.icon_filename:
with suppress(FileNotFoundError):
os.remove(get_icon_path(self.icon_filename))
with suppress(FileNotFoundError):
shutil.rmtree(self.install_path)
remove_framework_envs_from_user(self.name)
self.remove_from_config()
UI.delayed_display(DisplayMessage("Suppression done"))
UI.return_main_screen()
示例12: decompress_and_install
# 需要导入模块: from umake.ui import UI [as 别名]
# 或者: from umake.ui.UI import display [as 别名]
def decompress_and_install(self, fds):
UI.display(DisplayMessage("Installing {}".format(self.name)))
# empty destination directory if reinstall
for dir_to_remove in self._paths_to_clean:
with suppress(FileNotFoundError):
shutil.rmtree(dir_to_remove)
# marked them as cleaned
self._paths_to_clean = []
os.makedirs(self.install_path, exist_ok=True)
decompress_fds = {}
for fd in fds:
direct_copy = False
for ext in self.DIRECT_COPY_EXT:
if fd.name.endswith(ext):
direct_copy = True
break
if direct_copy:
shutil.copy2(fd.name, os.path.join(self.install_path, os.path.basename(fd.name)))
else:
decompress_fds[fd] = Decompressor.DecompressOrder(dir=self.dir_to_decompress_in_tarball,
dest=self.install_path)
Decompressor(decompress_fds, self.decompress_and_install_done)
UI.display(UnknownProgress(self.iterate_until_install_done))
示例13: post_install
# 需要导入模块: from umake.ui import UI [as 别名]
# 或者: from umake.ui.UI import display [as 别名]
def post_install(self):
"""Print wiki page message"""
UI.display(DisplayMessage("NDK installed in {}. More information on how to use it on {}".format(
self.install_path,
"https://developer.android.com/tools/sdk/ndk/index.html#GetStarted")))
示例14: run_display
# 需要导入模块: from umake.ui import UI [as 别名]
# 或者: from umake.ui.UI import display [as 别名]
def run_display(future):
self.function_thread = threading.current_thread().ident
UI.display(self.contentType)