当前位置: 首页>>代码示例>>Python>>正文


Python UI.delayed_display方法代码示例

本文整理汇总了Python中umake.ui.UI.delayed_display方法的典型用法代码示例。如果您正苦于以下问题:Python UI.delayed_display方法的具体用法?Python UI.delayed_display怎么用?Python UI.delayed_display使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在umake.ui.UI的用法示例。


在下文中一共展示了UI.delayed_display方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _display

# 需要导入模块: from umake.ui import UI [as 别名]
# 或者: from umake.ui.UI import delayed_display [as 别名]
 def _display(self, contentType):
     # print depending on the content type
     while True:
         try:
             if isinstance(contentType, InputText):
                 contentType.run_callback(result=rlinput(contentType.content, contentType.default_input))
             elif isinstance(contentType, LicenseAgreement):
                 print(contentType.content)
                 contentType.choose(answer=input(contentType.input))
             elif isinstance(contentType, TextWithChoices):
                 contentType.choose(answer=input(contentType.prompt))
             elif isinstance(contentType, DisplayMessage):
                 print(contentType.text)
             elif isinstance(contentType, UnknownProgress):
                 if not contentType.bar:
                     contentType.bar = ProgressBar(widgets=[BouncingBar()])
                 with suppress(StopIteration):
                     # pulse and add a timeout callback
                     contentType.bar(contentType._iterator()).next()
                     UI.delayed_display(contentType)
                 # don't recall the callback
                 return False
             else:
                 logger.error("Unexcepted content type to display to CLI UI: {}".format(contentType))
                 MainLoop().quit(status_code=1)
             break
         except InputError as e:
             logger.error(str(e))
             continue
开发者ID:Ubuntu420,项目名称:ubuntu-make,代码行数:31,代码来源:__init__.py

示例2: post_install

# 需要导入模块: from umake.ui import UI [as 别名]
# 或者: from umake.ui.UI import delayed_display [as 别名]
 def post_install(self):
     """Add go necessary env variables"""
     add_env_to_user(
         self.name,
         {"PATH": {"value": os.path.join(self.install_path, "bin")}, "GOROOT": {"value": self.install_path}},
     )
     UI.delayed_display(DisplayMessage(_("You need to restart a shell session for your installation to work")))
开发者ID:fcole90,项目名称:ubuntu-make,代码行数:9,代码来源:go.py

示例3: post_install

# 需要导入模块: from umake.ui import UI [as 别名]
# 或者: from umake.ui.UI import delayed_display [as 别名]
 def post_install(self):
     """Add rust necessary env variables"""
     add_env_to_user(self.name, {"PATH": {"value": "{}:{}".format(os.path.join(self.install_path, "rustc", "bin"),
                                                                  os.path.join(self.install_path, "cargo", "bin"))},
                                 "LD_LIBRARY_PATH": {"value": os.path.join(self.install_path, "rustc", "lib")}})
     UI.delayed_display(DisplayMessage(_("You need to restart your current shell session for your {} installation "
                                         "to work properly").format(self.name)))
开发者ID:pombredanne,项目名称:ubuntu-make,代码行数:9,代码来源:rust.py

示例4: post_install

# 需要导入模块: from umake.ui import UI [as 别名]
# 或者: from umake.ui.UI import delayed_display [as 别名]
    def post_install(self):
        """Add necessary environment variables"""
        add_env_to_user(self.name, {"ANDROID_HOME": {"value": self.install_path, "keep": False}})
        # add "platform-tools" to PATH to ensure "adb" can be run once the platform tools are installed via
        # the SDK manager
        add_env_to_user(
            self.name,
            {
                "PATH": {
                    "value": [os.path.join("$ANDROID_HOME", "tools"), os.path.join("$ANDROID_HOME", "platform-tools")]
                }
            },
        )
        UI.delayed_display(
            DisplayMessage(
                _("You need to restart your current shell session for your {} installation " "to work properly").format(
                    self.name
                )
            )
        )

        # print wiki page message
        UI.delayed_display(
            DisplayMessage(
                "SDK installed in {}. More information on how to use it on {}".format(
                    self.install_path, "https://developer.android.com/sdk/installing/adding-packages.html"
                )
            )
        )
开发者ID:oijazsh,项目名称:ubuntu-make,代码行数:31,代码来源:android.py

示例5: post_install

# 需要导入模块: from umake.ui import UI [as 别名]
# 或者: from umake.ui.UI import delayed_display [as 别名]
 def post_install(self):
     """Add nodejs necessary env variables and move module folder"""
     subprocess.call([os.path.join(self.install_path, "bin", "npm"), "config", "set", "prefix", "~/.node_modules"])
     add_env_to_user(self.name, {"PATH": {"value": "{}:{}".format(os.path.join(self.install_path, "bin"),
                                                                  os.path.join(os.path.expanduser('~'),
                                                                               ".node_modules", "bin"))}})
     UI.delayed_display(DisplayMessage(_("You need to restart your current shell session for your {} installation "
                                         "to work properly").format(self.name)))
开发者ID:EdRondon,项目名称:ubuntu-make,代码行数:10,代码来源:nodejs.py

示例6: post_install

# 需要导入模块: from umake.ui import UI [as 别名]
# 或者: from umake.ui.UI import delayed_display [as 别名]
    def post_install(self):
        """Add nodejs necessary env variables and move module folder"""
        if not self.prefix_set():
            with open(os.path.join(os.environ['HOME'], '.npmrc'), 'a+') as file:
                file.write("prefix = ${HOME}/.npm_modules\n")

        add_env_to_user(self.name, {"PATH": {"value": "{}:{}".format(os.path.join(self.install_path, "bin"),
                                                                     os.path.join(os.path.expanduser('~'),
                                                                                  ".npm_modules", "bin"))}})
        UI.delayed_display(DisplayMessage(self.RELOGIN_REQUIRE_MSG.format(self.name)))
开发者ID:ubuntu,项目名称:ubuntu-make,代码行数:12,代码来源:nodejs.py

示例7: test_call_delayed_display

# 需要导入模块: from umake.ui import UI [as 别名]
# 或者: from umake.ui.UI import delayed_display [as 别名]
    def test_call_delayed_display(self, mocksys):
        """We call the display method from the UIPlug in delayed_display with 50ms waiting"""
        UI.delayed_display(self.contentType)
        now = time()
        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)
        self.assertTrue(self.time_display_call - now > 0.05)
开发者ID:EdRondon,项目名称:ubuntu-make,代码行数:14,代码来源:test_ui.py

示例8: decompress_and_install

# 需要导入模块: from umake.ui import UI [as 别名]
# 或者: from umake.ui.UI import delayed_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()
开发者ID:mbkulik,项目名称:umake-misc,代码行数:14,代码来源:misc.py

示例9: post_install

# 需要导入模块: from umake.ui import UI [as 别名]
# 或者: from umake.ui.UI import delayed_display [as 别名]
 def post_install(self):
     """Create the Arduino launcher"""
     icon_path = join(self.install_path, 'lib', 'arduino_icon.ico')
     comment = _("The Arduino Software IDE")
     categories = "Development;IDE;"
     create_launcher(self.desktop_filename,
                     get_application_desktop_file(name=_("Arduino"),
                                                  icon_path=icon_path,
                                                  exec='"{}" %f'.format(self.exec_path),
                                                  comment=comment,
                                                  categories=categories))
     if not self.was_in_arduino_group:
         UI.delayed_display(DisplayMessage(_("You need to logout and login again for your installation to work")))
开发者ID:jravetch,项目名称:ubuntu-make,代码行数:15,代码来源:ide.py

示例10: post_install

# 需要导入模块: from umake.ui import UI [as 别名]
# 或者: from umake.ui.UI import delayed_display [as 别名]
    def post_install(self):
        """Add rust necessary env variables"""
        add_env_to_user(self.name, {"PATH": {"value": "{}:{}".format(os.path.join(self.install_path, "rustc", "bin"),
                                                                     os.path.join(self.install_path, "cargo", "bin"))},
                                    "LD_LIBRARY_PATH": {"value": os.path.join(self.install_path, "rustc", "lib")}})

        # adjust for rust 1.5 some symlinks magic to have stdlib craft available
        os.chdir(os.path.join(self.install_path, "rustc", "lib"))
        os.rename("rustlib", "rustlib.init")
        os.symlink(glob(os.path.join('..', '..', 'rust-std-*', 'lib', 'rustlib'))[0], 'rustlib')
        os.symlink(os.path.join('..', 'rustlib.init', 'etc'), os.path.join('rustlib', 'etc'))

        UI.delayed_display(DisplayMessage(self.RELOGIN_REQUIRE_MSG.format(self.name)))
开发者ID:jravetch,项目名称:ubuntu-make,代码行数:15,代码来源:rust.py

示例11: post_install

# 需要导入模块: from umake.ui import UI [as 别名]
# 或者: from umake.ui.UI import delayed_display [as 别名]
    def post_install(self):
        """Add rust necessary env variables"""
        add_env_to_user(self.name, {"PATH": {"value": "{}:{}".format(os.path.join(self.install_path, "rustc", "bin"),
                                                                     os.path.join(self.install_path, "cargo", "bin"))},
                                    "LD_LIBRARY_PATH": {"value": os.path.join(self.install_path, "rustc", "lib")}})

        # adjust for rust 1.5 some symlinks magic to have stdlib craft available
        os.chdir(os.path.join(self.install_path, "rustc", "lib"))
        os.rename("rustlib", "rustlib.init")
        os.symlink(glob(os.path.join('..', '..', 'rust-std-*', 'lib', 'rustlib'))[0], 'rustlib')
        os.symlink(os.path.join('..', 'rustlib.init', 'etc'), os.path.join('rustlib', 'etc'))

        UI.delayed_display(DisplayMessage(_("You need to restart your current shell session for your {} installation "
                                            "to work properly").format(self.name)))
开发者ID:EdRondon,项目名称:ubuntu-make,代码行数:16,代码来源:rust.py

示例12: get_metadata_and_check_license

# 需要导入模块: from umake.ui import UI [as 别名]
# 或者: from umake.ui.UI import delayed_display [as 别名]
    def get_metadata_and_check_license(self, result):
        """Diverge from the baseinstaller implementation in order to allow language selection"""

        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)

        arch = platform.machine()
        arg_lang_url = None
        default_label = ''
        tag_machine = ''
        if arch == 'x86_64':
            tag_machine = '64'

        reg_expression = '<td class="download linux{}"><a href="(.*)" title'.format(tag_machine)
        languages = []
        decoded_page = result[self.download_page].buffer.getvalue().decode()
        for index, p in enumerate(re.finditer(reg_expression, decoded_page)):
            with suppress(AttributeError):
                url = p.group(1)

            m = re.search(r'lang=(.*)', url)
            with suppress(AttributeError):
                lang = m.group(1)

            if self.arg_lang and self.arg_lang.lower() == lang.lower():
                arg_lang_url = url
                break
            else:
                is_default_choice = False
                if lang == "en-US":
                    default_label = "(default: en-US)"
                    is_default_choice = True
                choice = Choice(index, lang, partial(self.language_select_callback, url), is_default=is_default_choice)
                languages.append(choice)

        if self.arg_lang:
            logger.debug("Selecting {} lang".format(self.arg_lang))
            if not arg_lang_url:
                logger.error("Could not find a download url for language {}".format(self.arg_lang))
                UI.return_main_screen(status_code=1)
            self.language_select_callback(arg_lang_url)
        else:
            if not languages:
                logger.error("Download page changed its syntax or is not parsable")
                UI.return_main_screen(status_code=1)
            logger.debug("Check list of installable languages.")
            UI.delayed_display(TextWithChoices(_("Choose language: {}".format(default_label)), languages, True))
开发者ID:pombredanne,项目名称:ubuntu-make,代码行数:52,代码来源:web.py

示例13: post_install

# 需要导入模块: from umake.ui import UI [as 别名]
# 或者: from umake.ui.UI import delayed_display [as 别名]
    def post_install(self):
        """Add necessary environment variables"""
        # add a few fall-back variables that might be used by some tools
        # do not set ANDROID_SDK_HOME here as that is the path of the preference folder expected by the Android tools
        add_env_to_user(self.name, {"ANDROID_HOME": {"value": self.install_path, "keep": False},
                                    "ANDROID_SDK": {"value": self.install_path, "keep": False},
                                    "PATH": {"value": [os.path.join(self.install_path, "tools"),
                                                       os.path.join(self.install_path, "tools", "bin")]}})
        UI.delayed_display(DisplayMessage(self.RELOGIN_REQUIRE_MSG.format(self.name)))

        # print wiki page message
        UI.delayed_display(DisplayMessage("SDK installed in {}. More information on how to use it on {}".format(
                                          self.install_path,
                                          "https://developer.android.com/sdk/installing/adding-packages.html")))
开发者ID:ubuntu,项目名称:ubuntu-make,代码行数:16,代码来源:android.py

示例14: post_install

# 需要导入模块: from umake.ui import UI [as 别名]
# 或者: from umake.ui.UI import delayed_display [as 别名]
    def post_install(self):
        """Add rust necessary env variables"""
        add_env_to_user(self.name, {"PATH": {"value": "{}:{}".format(os.path.join(self.install_path, "rustc", "bin"),
                                                                     os.path.join(self.install_path, "cargo", "bin"))},
                                    "LD_LIBRARY_PATH": {"value": os.path.join(self.install_path, "rustc", "lib")}})

        # adjust for rust: some symlinks magic to have stdlib craft available
        arch_lib_folder = '{}-unknown-linux-gnu'.format(self.arch_trans[get_current_arch()])
        lib_folder = os.path.join(self.install_path, 'rust-std-{}'.format(arch_lib_folder),
                                  'lib', 'rustlib', arch_lib_folder, 'lib')
        for f in os.listdir(lib_folder):
            os.symlink(os.path.join(lib_folder, f),
                       os.path.join(self.install_path, 'rustc', 'lib', 'rustlib', arch_lib_folder, 'lib', f))

        UI.delayed_display(DisplayMessage(self.RELOGIN_REQUIRE_MSG.format(self.name)))
开发者ID:ubuntu,项目名称:ubuntu-make,代码行数:17,代码来源:rust.py

示例15: decompress_and_install_done

# 需要导入模块: from umake.ui import UI [as 别名]
# 或者: from umake.ui.UI import delayed_display [as 别名]
    def decompress_and_install_done(self, result):
        self._install_done = True
        error_detected = False
        for fd in result:
            if result[fd].error:
                logger.error(result[fd].error)
                error_detected = True
            fd.close()
        if error_detected:
            UI.return_main_screen(status_code=1)

        self.post_install()

        # Mark as installation done in configuration
        self.mark_in_config()

        UI.delayed_display(DisplayMessage("Installation done"))
        UI.return_main_screen()
开发者ID:collinsnji,项目名称:ubuntu-make,代码行数:20,代码来源:baseinstaller.py


注:本文中的umake.ui.UI.delayed_display方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。