當前位置: 首頁>>代碼示例>>Python>>正文


Python screen_handler.ScreenHandler類代碼示例

本文整理匯總了Python中simpleline.render.screen_handler.ScreenHandler的典型用法代碼示例。如果您正苦於以下問題:Python ScreenHandler類的具體用法?Python ScreenHandler怎麽用?Python ScreenHandler使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了ScreenHandler類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: input

    def input(self, args, key):
        """ Handle the input; this chooses the desktop environment. """
        if self._container is not None and self._container.process_user_input(key):
            self.redraw()
        else:
            # TRANSLATORS: 'c' to continue
            if key.lower() == C_('TUI|Spoke Navigation', 'c'):

                # No environment was selected, close
                if self._selected_environment is None:
                    self.close()

                # The environment was selected, switch screen
                elif args is None:
                    # Get addons for the selected environment
                    environment = self._translate_env_selection_to_name(self._selected_environment)
                    environment_id = self._translate_env_name_to_id(environment)
                    addons = self._get_available_addons(environment_id)

                    # Switch the screen
                    ScreenHandler.replace_screen(self, addons)

                # The addons were selected, apply and close
                else:
                    self.apply()
                    self.close()

                return InputState.PROCESSED
            else:
                return super(SoftwareSpoke, self).input(args, key)

        return InputState.PROCESSED
開發者ID:jaymzh,項目名稱:anaconda,代碼行數:32,代碼來源:software_selection.py

示例2: _quit_callback

 def _quit_callback(self, data):
     d = YesNoDialog(_(QUIT_MESSAGE))
     ScreenHandler.push_screen_modal(d)
     self.redraw()
     if d.answer:
         self._rescue.reboot = True
         self._rescue.finish()
開發者ID:rvykydal,項目名稱:anaconda,代碼行數:7,代碼來源:rescue.py

示例3: start_rescue_mode_ui

def start_rescue_mode_ui(anaconda):
    """Start the rescue mode UI."""

    ksdata_rescue = None
    if anaconda.ksdata.rescue.seen:
        ksdata_rescue = anaconda.ksdata.rescue
    scripts = anaconda.ksdata.scripts
    storage = anaconda.storage
    reboot = True
    if conf.target.is_image:
        reboot = False
    if flags.automatedInstall and anaconda.ksdata.reboot.action not in [KS_REBOOT, KS_SHUTDOWN]:
        reboot = False

    rescue = Rescue(storage, ksdata_rescue, reboot, scripts)
    rescue.initialize()

    # We still want to choose from multiple roots, or unlock encrypted devices
    # if needed, so we run UI even for kickstarts (automated install).
    App.initialize()
    loop = App.get_event_loop()
    loop.set_quit_callback(tui_quit_callback)
    spoke = RescueModeSpoke(rescue)
    ScreenHandler.schedule_screen(spoke)
    App.run()
開發者ID:rvykydal,項目名稱:anaconda,代碼行數:25,代碼來源:rescue.py

示例4: _set_iso_install_source

 def _set_iso_install_source(self, data):
     new_spoke = SelectDeviceSpoke(self.data,
                                   self.storage, self.payload,
                                   self.instclass)
     ScreenHandler.push_screen_modal(new_spoke)
     self.apply()
     self.close()
開發者ID:zhangsju,項目名稱:anaconda,代碼行數:7,代碼來源:installation_source.py

示例5: run_dasdfmt_dialog

    def run_dasdfmt_dialog(self, dasd_formatting):
        """Do DASD formatting if user agrees."""
        # Prepare text of the dialog.
        text = ""
        text += _("The following unformatted or LDL DASDs have been "
                  "detected on your system. You can choose to format them "
                  "now with dasdfmt or cancel to leave them unformatted. "
                  "Unformatted DASDs cannot be used during installation.\n\n")

        text += dasd_formatting.dasds_summary + "\n\n"

        text += _("Warning: All storage changes made using the installer will "
                  "be lost when you choose to format.\n\nProceed to run dasdfmt?\n")

        # Run the dialog.
        question_window = YesNoDialog(text)
        ScreenHandler.push_screen_modal(question_window)
        if not question_window.answer:
            return None

        print(_("This may take a moment."), flush=True)

        # Do the DASD formatting.
        dasd_formatting.report.connect(self._show_dasdfmt_report)
        dasd_formatting.run(self.storage, self.data)
        dasd_formatting.report.disconnect(self._show_dasdfmt_report)

        self.update_disks()
開發者ID:rvykydal,項目名稱:anaconda,代碼行數:28,代碼來源:storage.py

示例6: _quit_callback

 def _quit_callback(self, data):
     d = YesNoDialog(_(u"Do you really want to quit?"))
     ScreenHandler.push_screen_modal(d)
     self.redraw()
     if d.answer:
         self._rescue.reboot = True
         self._rescue.finish()
開發者ID:jaymzh,項目名稱:anaconda,代碼行數:7,代碼來源:rescue.py

示例7: _configure_connection

    def _configure_connection(self, iface, connection_uuid):
        connection = self.nm_client.get_connection_by_uuid(connection_uuid)

        new_spoke = ConfigureDeviceSpoke(self.data, self.storage, self.payload,
                                         self._network_module, iface, connection)
        ScreenHandler.push_screen_modal(new_spoke)

        if new_spoke.errors:
            self.errors.extend(new_spoke.errors)
            self.redraw()
            return

        if new_spoke.apply_configuration:
            self._apply = True
            device = self.nm_client.get_device_by_iface(iface)
            log.debug("activating connection %s with device %s",
                      connection_uuid, iface)
            self.nm_client.activate_connection_async(connection, device, None, None)

        self._network_module.proxy.LogConfigurationState(
            "Settings of {} updated in TUI.".format(iface)
        )

        self.redraw()
        self.apply()
開發者ID:rvykydal,項目名稱:anaconda,代碼行數:25,代碼來源:network.py

示例8: _set_network_nfs

 def _set_network_nfs(self, data):
     self.set_source_nfs()
     new_spoke = SpecifyNFSRepoSpoke(self.data, self.storage,
                                     self.payload, self.instclass, self._error)
     ScreenHandler.push_screen_modal(new_spoke)
     self.apply()
     self.close()
開發者ID:zhangsju,項目名稱:anaconda,代碼行數:7,代碼來源:installation_source.py

示例9: _select_mountable_device

 def _select_mountable_device(self, data):
     self._device = data
     new_spoke = SelectISOSpoke(self.data,
                                self.storage, self.payload,
                                self.instclass, self._device)
     ScreenHandler.push_screen_modal(new_spoke)
     self.close()
開發者ID:zhangsju,項目名稱:anaconda,代碼行數:7,代碼來源:installation_source.py

示例10: input

 def input(self, args, key):
     if self._container.process_user_input(key):
         return InputState.PROCESSED
     else:
         if key.lower().replace("_", " ") in self._lower_zones:
             index = self._lower_zones.index(key.lower().replace("_", " "))
             self._selection = self._zones[index]
             self.apply()
             return InputState.PROCESSED_AND_CLOSE
         elif key.lower() in self._lower_regions:
             index = self._lower_regions.index(key.lower())
             if len(self._timezones[self._regions[index]]) == 1:
                 self._selection = "%s/%s" % (self._regions[index],
                                              self._timezones[self._regions[index]][0])
                 self.apply()
                 self.close()
             else:
                 ScreenHandler.replace_screen(self, self._regions[index])
             return InputState.PROCESSED
         # TRANSLATORS: 'b' to go back
         elif key.lower() == C_('TUI|Spoke Navigation|Time Settings', 'b'):
             ScreenHandler.replace_screen(self)
             return InputState.PROCESSED
         else:
             return key
開發者ID:rvykydal,項目名稱:anaconda,代碼行數:25,代碼來源:time_spoke.py

示例11: _unlock_devices

    def _unlock_devices(self):
        """Attempt to unlock all locked LUKS devices.

        Returns true if all devices were unlocked.
        """
        try_passphrase = None
        passphrase = None
        for device_name in self._rescue.get_locked_device_names():
            skip = False
            unlocked = False
            while not (skip or unlocked):
                if try_passphrase is None:
                    p = PasswordDialog(device_name)
                    ScreenHandler.push_screen_modal(p)
                    if p.answer:
                        passphrase = p.answer.strip()
                else:
                    passphrase = try_passphrase

                if passphrase is None:
                    # cancelled
                    skip = True
                else:
                    unlocked = self._rescue.unlock_device(device_name, passphrase)
                    try_passphrase = passphrase if unlocked else None

        return not self._rescue.get_locked_device_names()
開發者ID:rvykydal,項目名稱:anaconda,代碼行數:27,代碼來源:rescue.py

示例12: _select_region_callback

 def _select_region_callback(self, data):
     region = data
     selected_timezones = self._timezones[region]
     if len(selected_timezones) == 1:
         self._selection = "%s/%s" % (region, selected_timezones[0])
         self.apply()
         self.close()
     else:
         ScreenHandler.replace_screen(self, region)
開發者ID:rvykydal,項目名稱:anaconda,代碼行數:9,代碼來源:time_spoke.py

示例13: input

    def input(self, args, key):
        """Handle the input."""
        # TRANSLATORS: 'h' to help
        if key.lower() == Prompt.HELP:
            if self.has_help:
                help_path = get_help_path(self.helpFile, True)
                ScreenHandler.push_screen_modal(HelpScreen(help_path))
                return InputState.PROCESSED_AND_REDRAW

        return super().input(args, key)
開發者ID:rvykydal,項目名稱:anaconda,代碼行數:10,代碼來源:__init__.py

示例14: _showError

    def _showError(self, message):
        """Internal helper function that MUST BE CALLED FROM THE MAIN THREAD."""

        if flags.automatedInstall and not flags.ksprompt:
            log.error(message)
            # If we're in cmdline mode, just exit.
            return

        error_window = IpmiErrorDialog(message)
        ScreenHandler.push_screen_modal(error_window)
開發者ID:zhangsju,項目名稱:anaconda,代碼行數:10,代碼來源:__init__.py

示例15: input

 def input(self, args, key):
     """ Handle user input. """
     if self._container.process_user_input(key):
         return InputState.PROCESSED
     else:
         # TRANSLATORS: 'b' to go back
         if key.lower() == C_("TUI|Spoke Navigation|Language Support", "b"):
             ScreenHandler.replace_screen(self)
             return InputState.PROCESSED
         else:
             return super().input(args, key)
開發者ID:zhangsju,項目名稱:anaconda,代碼行數:11,代碼來源:language_support.py


注:本文中的simpleline.render.screen_handler.ScreenHandler類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。