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


Python flags.can_touch_runtime_system函数代码示例

本文整理汇总了Python中pyanaconda.flags.can_touch_runtime_system函数的典型用法代码示例。如果您正苦于以下问题:Python can_touch_runtime_system函数的具体用法?Python can_touch_runtime_system怎么用?Python can_touch_runtime_system使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: runDebug

    def runDebug(self, exc_info):
        if flags.can_touch_runtime_system("switch console") and self._intf_tty_num != 1:
            iutil.vtActivate(1)

        iutil.eintr_retry_call(os.open, "/dev/console", os.O_RDWR)  # reclaim stdin
        iutil.eintr_ignore(os.dup2, 0, 1)  # reclaim stdout
        iutil.eintr_ignore(os.dup2, 0, 2)  # reclaim stderr
        #                      ^
        #                      |
        #                      +------ dup2 is magic, I tells ya!

        # bring back the echo
        import termios

        si = sys.stdin.fileno()
        attr = termios.tcgetattr(si)
        attr[3] = attr[3] & termios.ECHO
        termios.tcsetattr(si, termios.TCSADRAIN, attr)

        print("\nEntering debugger...")
        print("Use 'continue' command to quit the debugger and get back to " "the main window")
        import pdb

        pdb.post_mortem(exc_info.stack)

        if flags.can_touch_runtime_system("switch console") and self._intf_tty_num != 1:
            iutil.vtActivate(self._intf_tty_num)
开发者ID:josefbacik,项目名称:anaconda,代码行数:27,代码来源:exception.py

示例2: initialize

    def initialize(self):
        NormalSpoke.initialize(self)
        self.initialize_start()

        # set X keyboard defaults
        # - this needs to be done early in spoke initialization so that
        #   the spoke status does not show outdated keyboard selection
        keyboard.set_x_keyboard_defaults(self.data, self._xkl_wrapper)

        # make sure the x_layouts list has at least one keyboard layout
        if not self.data.keyboard.x_layouts:
            self.data.keyboard.x_layouts.append(DEFAULT_KEYBOARD)

        self._add_dialog = AddLayoutDialog(self.data)
        self._add_dialog.initialize()

        if flags.can_touch_runtime_system("hide runtime keyboard configuration "
                                          "warning", touch_live=True):
            self.builder.get_object("warningBox").hide()

        # We want to store layouts' names but show layouts as
        # 'language (description)'.
        layoutColumn = self.builder.get_object("layoutColumn")
        layoutRenderer = self.builder.get_object("layoutRenderer")
        override_cell_property(layoutColumn, layoutRenderer, "text", _show_layout,
                                            self._xkl_wrapper)

        self._store = self.builder.get_object("addedLayoutStore")
        self._add_data_layouts()

        self._selection = self.builder.get_object("layoutSelection")

        self._switching_dialog = ConfigureSwitchingDialog(self.data)
        self._switching_dialog.initialize()

        self._layoutSwitchLabel = self.builder.get_object("layoutSwitchLabel")

        if not flags.can_touch_runtime_system("test X layouts", touch_live=True):
            # Disable area for testing layouts as we cannot make
            # it work without modifying runtime system

            widgets = [self.builder.get_object("testingLabel"),
                       self.builder.get_object("testingWindow"),
                       self.builder.get_object("layoutSwitchLabel")]

            # Use testingLabel's text to explain why this part is not
            # sensitive.
            widgets[0].set_text(_("Testing layouts configuration not "
                                  "available."))

            for widget in widgets:
                widget.set_sensitive(False)

        hubQ.send_not_ready(self.__class__.__name__)
        hubQ.send_message(self.__class__.__name__,
                          _("Getting list of layouts..."))
        threadMgr.add(AnacondaThread(name=THREAD_KEYBOARD_INIT,
                                     target=self._wait_ready))
开发者ID:dougsland,项目名称:anaconda,代码行数:58,代码来源:keyboard.py

示例3: _set_keyboard_defaults

    def _set_keyboard_defaults(self, locale):
        """
        Set default keyboard settings (layouts, layout switching).

        :param locale: locale string (see localization.LANGCODE_RE)
        :type locale: str
        :return: list of preferred keyboard layouts
        :rtype: list of strings
        :raise InvalidLocaleSpec: if an invalid locale is given (see
                                  localization.LANGCODE_RE)

        """

        #remove all X layouts that are not valid X layouts (unsupported)
        #from the ksdata
        #XXX: could go somewhere else, but we need X running and we have
        #     XklWrapper instance here
        for layout in self.data.keyboard.x_layouts:
            if not self._xklwrapper.is_valid_layout(layout):
                self.data.keyboard.x_layouts.remove(layout)

        if self.data.keyboard.x_layouts:
            #do not add layouts if there are any specified in the kickstart
            return

        layouts = localization.get_locale_keyboards(locale)
        if layouts:
            # take the first locale (with highest rank) from the list and
            # store it normalized
            new_layouts = [keyboard.normalize_layout_variant(layouts[0])]
            if not langtable.supports_ascii(layouts[0]):
                # does not support typing ASCII chars, append the default layout
                new_layouts.append(DEFAULT_KEYBOARD)
        else:
            log.error("Failed to get layout for chosen locale '%s'", locale)
            new_layouts = [DEFAULT_KEYBOARD]

        self.data.keyboard.x_layouts = new_layouts
        if flags.can_touch_runtime_system("replace runtime X layouts", touch_live=True):
            self._xklwrapper.replace_layouts(new_layouts)

        if len(new_layouts) >= 2 and not self.data.keyboard.switch_options:
            #initialize layout switching if needed
            self.data.keyboard.switch_options = ["grp:alt_shift_toggle"]

            if flags.can_touch_runtime_system("init layout switching", touch_live=True):
                self._xklwrapper.set_switching_options(["grp:alt_shift_toggle"])
                # activate the language-default layout instead of the additional
                # one
                self._xklwrapper.activate_default_layout()
开发者ID:Sabayon,项目名称:anaconda,代码行数:50,代码来源:welcome.py

示例4: set_x_keyboard_defaults

def set_x_keyboard_defaults(ksdata, xkl_wrapper):
    """
    Set default keyboard settings (layouts, layout switching).

    :param ksdata: kickstart instance
    :type ksdata: object instance
    :param xkl_wrapper: XklWrapper instance
    :type xkl_wrapper: object instance
    :raise InvalidLocaleSpec: if an invalid locale is given (see
                              localization.LANGCODE_RE)
    """
    locale = ksdata.lang.lang

    # remove all X layouts that are not valid X layouts (unsupported)
    for layout in ksdata.keyboard.x_layouts:
        if not xkl_wrapper.is_valid_layout(layout):
            ksdata.keyboard.x_layouts.remove(layout)

    if ksdata.keyboard.x_layouts:
        # do not add layouts if there are any specified in the kickstart
        # (the x_layouts list comes from kickstart)
        return

    layouts = localization.get_locale_keyboards(locale)
    if layouts:
        # take the first locale (with highest rank) from the list and
        # store it normalized
        new_layouts = [normalize_layout_variant(layouts[0])]
        if not langtable.supports_ascii(layouts[0]):
            # does not support typing ASCII chars, append the default layout
            new_layouts.append(DEFAULT_KEYBOARD)
    else:
        log.error("Failed to get layout for chosen locale '%s'", locale)
        new_layouts = [DEFAULT_KEYBOARD]

    ksdata.keyboard.x_layouts = new_layouts
    if can_touch_runtime_system("replace runtime X layouts", touch_live=True):
        xkl_wrapper.replace_layouts(new_layouts)

    if len(new_layouts) >= 2 and not ksdata.keyboard.switch_options:
        # initialize layout switching if needed
        ksdata.keyboard.switch_options = ["grp:alt_shift_toggle"]

        if can_touch_runtime_system("init layout switching", touch_live=True):
            xkl_wrapper.set_switching_options(["grp:alt_shift_toggle"])
            # activate the language-default layout instead of the additional
            # one
            xkl_wrapper.activate_default_layout()
开发者ID:jaymzh,项目名称:anaconda,代码行数:48,代码来源:keyboard.py

示例5: input

    def input(self, args, key):
        """Override input so that we can launch the VNC password spoke"""

        try:
            keyid = int(key) - 1
            if 0 <= keyid < len(self._choices):
                choice = self._choices[keyid]
                if choice == _(USETEXT):
                    self._usevnc = False
                else:
                    self._usevnc = True
                    newspoke = VNCPassSpoke(self.app, self.data, self.storage,
                                            self.payload, self.instclass)
                    self.app.switch_screen_modal(newspoke)

                self.apply()
                self.close()
            return INPUT_PROCESSED
        except ValueError:
            pass

        # TRANSLATORS: 'q' to quit
        if key.lower() == C_('TUI|Spoke Navigation', 'q'):
            d = YesNoDialog(self.app, _(self.app.quit_message))
            self.app.switch_screen_modal(d)
            if d.answer:
                iutil.ipmi_report(IPMI_ABORTED)
                if can_touch_runtime_system("Quit and Reboot"):
                    execWithRedirect("systemctl", ["--no-wall", "reboot"])
                else:
                    exit(1)
        else:
            return key
开发者ID:thaygiaoth,项目名称:anaconda,代码行数:33,代码来源:askvnc.py

示例6: completed

 def completed(self):
     """ Check whether this spoke is complete or not. Do an additional
         check if we're installing from CD/DVD, since a network connection
         should not be required in this case.
     """
     return (not can_touch_runtime_system("require network connection")
             or nm.nm_activated_devices())
开发者ID:dougsland,项目名称:anaconda,代码行数:7,代码来源:network.py

示例7: setupLoggingFromOpts

def setupLoggingFromOpts(options):
    if (options.debug or options.updateSrc) and not options.loglevel:
        # debugging means debug logging if an explicit level hasn't been st
        options.loglevel = "debug"

    if options.loglevel and options.loglevel in anaconda_log.logLevelMap:
        log.info("Switching logging level to %s", options.loglevel)
        level = anaconda_log.logLevelMap[options.loglevel]
        anaconda_log.logger.loglevel = level
        anaconda_log.setHandlersLevel(log, level)
        storage_log = logging.getLogger("storage")
        anaconda_log.setHandlersLevel(storage_log, level)
        packaging_log = logging.getLogger("packaging")
        anaconda_log.setHandlersLevel(packaging_log, level)

    if can_touch_runtime_system("syslog setup"):
        if options.syslog:
            anaconda_log.logger.updateRemote(options.syslog)

    if options.remotelog:
        try:
            host, port = options.remotelog.split(":", 1)
            port = int(port)
            anaconda_log.logger.setup_remotelog(host, port)
        except ValueError:
            log.error("Could not setup remotelog with %s", options.remotelog)
开发者ID:Jakuje,项目名称:anaconda,代码行数:26,代码来源:anaconda.py

示例8: run

    def run(self):
        self.window.show()
        rc = self.window.run()
        self.window.hide()

        #OK clicked
        if rc == 1:
            new_servers = list()

            for row in self._serversStore:
                #if server checked
                if row[2]:
                    new_servers.append(row[0])

            if flags.can_touch_runtime_system("save NTP servers configuration"):
                ntp.save_servers_to_config(new_servers)
                iutil.restart_service(NTP_SERVICE)

        #Cancel clicked, window destroyed...
        else:
            self._epoch_lock.acquire()
            self._epoch += 1
            self._epoch_lock.release()

            self._initialize_store_from_config()

        return rc
开发者ID:cs2c-zhangchao,项目名称:nkwin1.0-anaconda,代码行数:27,代码来源:datetime_spoke.py

示例9: setup_logging_from_options

def setup_logging_from_options(options):
    """Configure logging according to Anaconda command line/boot options.

    :param options: Anaconda command line/boot options
    """
    if (options.debug or options.updateSrc) and not options.loglevel:
        # debugging means debug logging if an explicit level hasn't been st
        options.loglevel = "debug"

    if options.loglevel and options.loglevel in anaconda_logging.logLevelMap:
        log.info("Switching logging level to %s", options.loglevel)
        level = anaconda_logging.logLevelMap[options.loglevel]
        anaconda_logging.logger.loglevel = level
        anaconda_logging.setHandlersLevel(log, level)
        storage_log = get_storage_logger()
        anaconda_logging.setHandlersLevel(storage_log, level)
        packaging_log = get_packaging_logger()
        anaconda_logging.setHandlersLevel(packaging_log, level)

    if can_touch_runtime_system("syslog setup"):
        if options.syslog:
            anaconda_logging.logger.updateRemote(options.syslog)

    if options.remotelog:
        try:
            host, port = options.remotelog.split(":", 1)
            port = int(port)
            anaconda_logging.logger.setup_remotelog(host, port)
        except ValueError:
            log.error("Could not setup remotelog with %s", options.remotelog)
开发者ID:jaymzh,项目名称:anaconda,代码行数:30,代码来源:startup_utils.py

示例10: refresh

    def refresh(self):
        self._shown = True

        #update the displayed time
        self._update_datetime_timer_id = GLib.timeout_add_seconds(1,
                                                    self._update_datetime)
        self._start_updating_timer_id = None

        if is_valid_timezone(self.data.timezone.timezone):
            self._tzmap.set_timezone(self.data.timezone.timezone)

        self._update_datetime()

        has_active_network = nm.nm_is_connected()
        if not has_active_network:
            self._show_no_network_warning()
        else:
            self.clear_info()
            gtk_call_once(self._config_dialog.refresh_servers_state)

        if flags.can_touch_runtime_system("get NTP service state"):
            ntp_working = has_active_network and iutil.service_running(NTP_SERVICE)
        else:
            ntp_working = not self.data.timezone.nontp

        self._ntpSwitch.set_active(ntp_working)
开发者ID:cyclefusion,项目名称:anaconda,代码行数:26,代码来源:datetime_spoke.py

示例11: _addLayout

    def _addLayout(self, store, name):
        # first try to add the layout
        if flags.can_touch_runtime_system("add runtime X layout", touch_live=True):
            self._xkl_wrapper.add_layout(name)

        # valid layout, append it to the store
        store.append([name])
开发者ID:KosiehBarter,项目名称:anaconda,代码行数:7,代码来源:keyboard.py

示例12: initialize

    def initialize(self):
        NormalSpoke.initialize(self)
        self._add_dialog = AddLayoutDialog(self.data)
        self._add_dialog.initialize()

        if flags.can_touch_runtime_system("hide runtime keyboard configuration "
                                          "warning", touch_live=True):
            self.builder.get_object("warningBox").hide()

        # We want to store layouts' names but show layouts as
        # 'language (description)'.
        layoutColumn = self.builder.get_object("layoutColumn")
        layoutRenderer = self.builder.get_object("layoutRenderer")
        layoutColumn.set_cell_data_func(layoutRenderer, _show_layout,
                                            self._xkl_wrapper)

        self._store = self.builder.get_object("addedLayoutStore")
        self._add_data_layouts()

        self._selection = self.builder.get_object("layoutSelection")

        self._switching_dialog = ConfigureSwitchingDialog(self.data)
        self._switching_dialog.initialize()

        self._layoutSwitchLabel = self.builder.get_object("layoutSwitchLabel")

        if not flags.can_touch_runtime_system("test X layouts", touch_live=True):
            # Disable area for testing layouts as we cannot make
            # it work without modifying runtime system

            widgets = [self.builder.get_object("testingLabel"),
                       self.builder.get_object("testingWindow"),
                       self.builder.get_object("layoutSwitchLabel")]

            # Use testingLabel's text to explain why this part is not
            # sensitive.
            widgets[0].set_text(_("Testing layouts configuration not "
                                  "available."))

            for widget in widgets:
                widget.set_sensitive(False)

        hubQ.send_not_ready(self.__class__.__name__)
        hubQ.send_message(self.__class__.__name__,
                          _("Getting list of layouts..."))
        threadMgr.add(AnacondaThread(name=THREAD_KEYBOARD_INIT,
                                     target=self._wait_ready))
开发者ID:akozumpl,项目名称:anaconda,代码行数:47,代码来源:keyboard.py

示例13: _set_keyboard_defaults

    def _set_keyboard_defaults(self, lang_name, country):
        """
        Set default keyboard settings (layouts, layout switching).

        :param lang_name: name of the selected language (e.g. "Czech")

        """

        #remove all X layouts that are not valid X layouts (unsupported)
        #from the ksdata
        #XXX: could go somewhere else, but we need X running and we have
        #     XklWrapper instance here
        for layout in self.data.keyboard.x_layouts:
            if not self._xklwrapper.is_valid_layout(layout):
                self.data.keyboard.x_layouts.remove(layout)

        if self.data.keyboard.x_layouts:
            #do not add layouts if there are any specified in the kickstart
            return

        #get language name without any additional specifications
        #e.g. 'English (United States)' -> 'English'
        lang_name = lang_name.split()[0]

        default_layout = self._xklwrapper.get_default_lang_country_layout(lang_name,
                                                                          country)
        if default_layout:
            new_layouts = [default_layout]
        else:
            new_layouts = ["us"]

        checkbutton = self.builder.get_object("setKeyboardCheckButton")
        if not checkbutton.get_active() and "us" not in new_layouts:
            #user doesn't want only the language-default layout, prepend
            #'English (US)' layout
            new_layouts.insert(0, "us")

        self.data.keyboard.x_layouts = new_layouts
        if flags.can_touch_runtime_system("replace runtime X layouts"):
            self._xklwrapper.replace_layouts(new_layouts)

        if len(new_layouts) >= 2 and not self.data.keyboard.switch_options:
            #initialize layout switching if needed
            self.data.keyboard.switch_options = ["grp:alt_shift_toggle"]

            if flags.can_touch_runtime_system("init layout switching"):
                self._xklwrapper.set_switching_options(["grp:alt_shift_toggle"])
开发者ID:cs2c-zhangchao,项目名称:nkwin1.0-anaconda,代码行数:47,代码来源:welcome.py

示例14: completed

 def completed(self):
     """ Check whether this spoke is complete or not. Do an additional
         check if we're installing from CD/DVD, since a network connection
         should not be required in this case.
     """
     localinst = bool(self.data.method.method in ["cdrom", "harddrive"])
     return (not can_touch_runtime_system("require network connection")
             or nm.nm_activated_devices() or localinst)
开发者ID:pombreda,项目名称:anaconda,代码行数:8,代码来源:network.py

示例15: on_ntp_switched

    def on_ntp_switched(self, switch, *args):
        if switch.get_active():
            #turned ON
            if not flags.can_touch_runtime_system("start NTP service"):
                #cannot touch runtime system, not much to do here
                return

            if not nm.nm_is_connected():
                self._show_no_network_warning()
                switch.set_active(False)
                return
            else:
                self.clear_info()

                working_server = self._config_dialog.working_server
                if working_server is None:
                    self._show_no_ntp_server_warning()
                else:
                    #we need a one-time sync here, because chronyd would not change
                    #the time as drastically as we need
                    ntp.one_time_sync_async(working_server)

            ret = iutil.start_service(NTP_SERVICE)
            self._set_date_time_setting_sensitive(False)

            #if starting chronyd failed and chronyd is not running,
            #set switch back to OFF
            if (ret != 0) and not iutil.service_running(NTP_SERVICE):
                switch.set_active(False)

        else:
            #turned OFF
            if not flags.can_touch_runtime_system("stop NTP service"):
                #cannot touch runtime system, nothing to do here
                return

            self._set_date_time_setting_sensitive(True)
            ret = iutil.stop_service(NTP_SERVICE)

            #if stopping chronyd failed and chronyd is running,
            #set switch back to ON
            if (ret != 0) and iutil.service_running(NTP_SERVICE):
                switch.set_active(True)

            self.clear_info()
开发者ID:cs2c-zhangchao,项目名称:nkwin1.0-anaconda,代码行数:45,代码来源:datetime_spoke.py


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