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


Python threadMgr.wait函数代码示例

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


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

示例1: _doExecute

 def _doExecute(self):
     self._ready = False
     hubQ.send_not_ready(self.__class__.__name__)
     # on the off-chance dasdfmt is running, we can't proceed further
     threadMgr.wait(constants.THREAD_DASDFMT)
     hubQ.send_message(self.__class__.__name__, _("Saving storage configuration..."))
     try:
         doKickstartStorage(self.storage, self.data, self.instclass)
     except (StorageError, KickstartValueError) as e:
         log.error("storage configuration failed: %s", e)
         StorageChecker.errors = str(e).split("\n")
         hubQ.send_message(self.__class__.__name__, _("Failed to save storage configuration..."))
         self.data.bootloader.bootDrive = ""
         self.data.ignoredisk.drives = []
         self.data.ignoredisk.onlyuse = []
         self.storage.config.update(self.data)
         self.storage.reset()
         self.disks = getDisks(self.storage.devicetree)
         # now set ksdata back to the user's specified config
         applyDiskSelection(self.storage, self.data, self.selected_disks)
     except BootLoaderError as e:
         log.error("BootLoader setup failed: %s", e)
         StorageChecker.errors = str(e).split("\n")
         hubQ.send_message(self.__class__.__name__, _("Failed to save storage configuration..."))
         self.data.bootloader.bootDrive = ""
     else:
         if self.autopart:
             self.run()
     finally:
         resetCustomStorageData(self.data)
         self._ready = True
         hubQ.send_ready(self.__class__.__name__, True)
开发者ID:jresch,项目名称:anaconda,代码行数:32,代码来源:storage.py

示例2: refresh

    def refresh(self, args = None):
        NormalTUISpoke.refresh(self, args)

        # Join the initialization thread to block on it
        # This print is foul.  Need a better message display
        print(_("Probing storage..."))
        threadMgr.wait(THREAD_STORAGE_WATCHER)

        # synchronize our local data store with the global ksdata
        # Commment out because there is no way to select a disk right
        # now without putting it in ksdata.  Seems wrong?
        #self.selected_disks = self.data.ignoredisk.onlyuse[:]
        self.autopart = self.data.autopart.autopart

        message = self._update_summary()

        # loop through the disks and present them.
        for disk in self.disks:
            size = size_str(disk.size)
            c = CheckboxWidget(title="%i) %s: %s (%s)" % (self.disks.index(disk) + 1,
                                                 disk.model, size, disk.name),
                               completed=(disk.name in self.selected_disks))
            self._window += [c, ""]

        self._window += [TextWidget(message), ""]

        return True
开发者ID:joesaland,项目名称:qubes-installer-qubes-os,代码行数:27,代码来源:storage.py

示例3: install

    def install(self):
        """ Install the payload. """
        self.pct_lock = Lock()
        self.pct = 0
        threadMgr.add(AnacondaThread(name=THREAD_LIVE_PROGRESS,
                                     target=self.progress))

        cmd = "rsync"
        # preserve: permissions, owners, groups, ACL's, xattrs, times,
        #           symlinks, hardlinks
        # go recursively, include devices and special files, don't cross
        # file system boundaries
        args = ["-pogAXtlHrDx", "--exclude", "/dev/", "--exclude", "/proc/",
                "--exclude", "/sys/", "--exclude", "/run/", "--exclude", "/boot/*rescue*",
                "--exclude", "/etc/machine-id", INSTALL_TREE+"/", ROOT_PATH]
        try:
            rc = iutil.execWithRedirect(cmd, args)
        except (OSError, RuntimeError) as e:
            msg = None
            err = str(e)
            log.error(err)
        else:
            err = None
            msg = "%s exited with code %d" % (cmd, rc)
            log.info(msg)

        if err or rc == 12:
            exn = PayloadInstallError(err or msg)
            if errorHandler.cb(exn) == ERROR_RAISE:
                raise exn

        # Wait for progress thread to finish
        with self.pct_lock:
            self.pct = 100
        threadMgr.wait(THREAD_LIVE_PROGRESS)
开发者ID:akozumpl,项目名称:anaconda,代码行数:35,代码来源:livepayload.py

示例4: refresh

    def refresh(self, args=None):
        EditTUISpoke.refresh(self, args)

        threadMgr.wait(THREAD_PAYLOAD)
        threadMgr.wait(THREAD_PAYLOAD_MD)

        _methods = [_("CD/DVD"), _("local ISO file"), _("Network")]
        if args == 3:
            text = [TextWidget(p) for p in self._protocols]
        else:
            self._window += [TextWidget(_("Choose an installation source type."))]
            text = [TextWidget(m) for m in _methods]

        def _prep(i, w):
            """ Mangle our text to make it look pretty on screen. """
            number = TextWidget("%2d)" % (i + 1))
            return ColumnWidget([(4, [number]), (None, [w])], 1)

        # gnarl and mangle all of our widgets so things look pretty on screen
        choices = [_prep(i, w) for i, w in enumerate(text)]

        displayed = ColumnWidget([(78, choices)], 1)
        self._window.append(displayed)

        return True
开发者ID:joesaland,项目名称:qubes-installer-qubes-os,代码行数:25,代码来源:source.py

示例5: refresh

    def refresh(self):
        NormalSpoke.refresh(self)

        threadMgr.wait(constants.THREAD_PAYLOAD_MD)

        self._environmentStore.clear()

        firstEnvironment = True
        for environment in self.payload.environments:
            (name, desc) = self.payload.environmentDescription(environment)

            itr = self._environmentStore.append([environment == self.environment, "<b>%s</b>\n%s" % (name, desc), environment])
            # Either:
            # (1) Select the environment given by kickstart or selected last
            #     time this spoke was displayed; or
            # (2) Select the first environment given by display order as the
            #     default if nothing is selected.
            if (environment == self.environment) or \
               (not self.environment and firstEnvironment):
                self.environment = environment
                sel = self.builder.get_object("environmentSelector")
                sel.select_iter(itr)

            firstEnvironment = False

        self.refreshAddons()
开发者ID:Sabayon,项目名称:anaconda,代码行数:26,代码来源:software.py

示例6: refresh

    def refresh(self, args=None):
        EditTUISpoke.refresh(self, args)

        threadMgr.wait(THREAD_PAYLOAD)

        _methods = [_("CD/DVD"), _("local ISO file"), _("Network")]

        if self.data.method.method == "harddrive" and \
           get_mount_device(DRACUT_ISODIR) == get_mount_device(DRACUT_REPODIR):
            message = _("The installation source is in use by the installer and cannot be changed.")
            self._window += [TextWidget(message), ""]
            return True

        if args == 3:
            text = [TextWidget(_(p)) for p in self._protocols]
        else:
            self._window += [TextWidget(_("Choose an installation source type."))]
            text = [TextWidget(m) for m in _methods]

        def _prep(i, w):
            """ Mangle our text to make it look pretty on screen. """
            number = TextWidget("%2d)" % (i + 1))
            return ColumnWidget([(4, [number]), (None, [w])], 1)

        # gnarl and mangle all of our widgets so things look pretty on screen
        choices = [_prep(i, w) for i, w in enumerate(text)]

        displayed = ColumnWidget([(78, choices)], 1)
        self._window.append(displayed)

        return True
开发者ID:adrelanos,项目名称:qubes-installer-qubes-os,代码行数:31,代码来源:source.py

示例7: run_dasdfmt

    def run_dasdfmt(self):
        """
        Though the same function exists in pyanaconda.ui.gui.spokes.lib.dasdfmt,
        this instance doesn't include any of the UI pieces and should only
        really be getting called on ks installations with "zerombr".
        """
        # wait for the initial storage thread to complete before taking any new
        # actions on storage devices
        threadMgr.wait(constants.THREAD_STORAGE)

        to_format = make_unformatted_dasd_list(self.selected_disks)
        if not to_format:
            # nothing to do here; bail
            return

        hubQ.send_message(self.__class__.__name__, _("Formatting DASDs"))
        for disk in to_format:
            try:
                format_dasd(disk)
            except DasdFormatError as err:
                # Log errors if formatting fails, but don't halt the installer
                log.error(str(err))
                continue

        # now re-initialize storage to pick up the newly formatted disks
        protectedNames = [d.name for d in self.storage.protectedDevices]
        storageInitialize(self.storage, self.data, protectedNames)

        # I really hate doing this, but the way is the way; probably the most
        # correct way to kajigger the storage spoke into becoming ready
        self.execute()
开发者ID:akozumpl,项目名称:anaconda,代码行数:31,代码来源:storage.py

示例8: _initialize

    def _initialize(self):
        threadMgr.wait(THREAD_PAYLOAD)

        if not self._kickstarted:
            # If an environment was specified in the instclass, use that.
            # Otherwise, select the first environment.
            if self.payload.environments:
                environments = self.payload.environments
                instclass = self.payload.instclass

                if instclass and instclass.defaultPackageEnvironment and \
                        instclass.defaultPackageEnvironment in environments:
                    self._selection = environments.index(instclass.defaultPackageEnvironment)
                else:
                    self._selection = 0

        # Apply the initial selection
        self._apply()

        # Wait for the software selection thread that might be started by _apply().
        # We are already running in a thread, so it should not needlessly block anything
        # and only like this we can be sure we are really initialized.
        threadMgr.wait(THREAD_CHECK_SOFTWARE)

        # report that the software spoke has been initialized
        self.initialize_done()
开发者ID:dougsland,项目名称:anaconda,代码行数:26,代码来源:software.py

示例9: time_initialize

def time_initialize(timezone, storage, bootloader):
    """
    Try to guess if RTC uses UTC time or not, set timezone.isUtc properly and
    set system time from RTC using the UTC guess.
    Guess is done by searching for bootable ntfs devices.

    :param timezone: ksdata.timezone object
    :param storage: blivet.Blivet instance
    :param bootloader: bootloader.Bootloader instance

    """

    if arch.is_s390():
        # nothing to do on s390(x) were hwclock doesn't exist
        return

    if not timezone.isUtc and not flags.automatedInstall:
        # if set in the kickstart, no magic needed here
        threadMgr.wait(THREAD_STORAGE)
        ntfs_devs = filter(lambda dev: dev.format.name == "ntfs",
                           storage.devices)

        timezone.isUtc = not bootloader.has_windows(ntfs_devs)

    cmd = "hwclock"
    args = ["--hctosys"]
    if timezone.isUtc:
        args.append("--utc")
    else:
        args.append("--localtime")

    iutil.execWithRedirect(cmd, args)
开发者ID:Jakuje,项目名称:anaconda,代码行数:32,代码来源:timezone.py

示例10: refresh

    def refresh(self, args=None):
        NormalTUISpoke.refresh(self, args)

        # Join the initialization thread to block on it
        # This print is foul.  Need a better message display
        print(_(PAYLOAD_STATUS_PROBING_STORAGE))
        threadMgr.wait(THREAD_STORAGE_WATCHER)

        # synchronize our local data store with the global ksdata
        # Commment out because there is no way to select a disk right
        # now without putting it in ksdata.  Seems wrong?
        #self.selected_disks = self.data.ignoredisk.onlyuse[:]
        self.autopart = self.data.autopart.autopart

        message = self._update_summary()

        # loop through the disks and present them.
        for disk in self.disks:
            disk_info = self._format_disk_info(disk)
            c = CheckboxWidget(title="%i) %s" % (self.disks.index(disk) + 1, disk_info),
                               completed=(disk.name in self.selected_disks))
            self._window += [c, ""]

        # if we have more than one disk, present an option to just
        # select all disks
        if len(self.disks) > 1:
            c = CheckboxWidget(title="%i) %s" % (len(self.disks) + 1, _("Select all")),
                                completed=(self.selection == len(self.disks)))

            self._window += [c, ""]

        self._window += [TextWidget(message), ""]

        return True
开发者ID:galleguindio,项目名称:anaconda,代码行数:34,代码来源:storage.py

示例11: refresh

    def refresh(self):
        NormalSpoke.refresh(self)

        threadMgr.wait(constants.THREAD_PAYLOAD_MD)

        if self.environment not in self.payload.environments:
            self.environment = None

        firstEnvironment = True
        firstRadio = None

        self._clear_listbox(self._environmentListBox)

        for environment in self.payload.environments:
            (name, desc) = self.payload.environmentDescription(environment)

            radio = Gtk.RadioButton(group=firstRadio)

            active = environment == self.environment or \
                     not self.environment and firstEnvironment
            radio.set_active(active)
            if active:
                self.environment = environment

            self._add_row(self._environmentListBox, name, desc, radio)
            firstRadio = firstRadio or radio

            firstEnvironment = False

        self.refreshAddons()
开发者ID:pombreda,项目名称:anaconda,代码行数:30,代码来源:software.py

示例12: _restartThread

    def _restartThread(self, storage, ksdata, payload, instClass, fallback, checkmount):
        # Wait for the old thread to finish
        threadMgr.wait(THREAD_PAYLOAD)

        # Start a new payload thread
        threadMgr.add(AnacondaThread(name=THREAD_PAYLOAD, target=self._runThread,
            args=(storage, ksdata, payload, instClass, fallback, checkmount)))
开发者ID:NealSCarffery,项目名称:anaconda,代码行数:7,代码来源:__init__.py

示例13: refresh

    def refresh(self, args=None):
        """ Refresh screen. """
        NormalTUISpoke.refresh(self, args)

        threadMgr.wait(THREAD_PAYLOAD)

        if not self.payload.baseRepo:
            message = TextWidget(_("Installation source needs to be set up first."))
            self._window.append(message)

            # add some more space below
            self._window.append(TextWidget(""))
            return True

        threadMgr.wait(THREAD_CHECK_SOFTWARE)
        displayed = []

        # Display the environments
        if args is None:
            environments = self.payload.environments
            length = len(environments)
            msg = _("Base environment")

            for env in environments:
                name = self.payload.environmentDescription(env)[0]
                selected = environments.index(env) == self._selection
                displayed.append(CheckboxWidget(title="%s" % name, completed=selected))

        # Display the add-ons
        else:
            length = len(args)

            if length > 0:
                msg = _("Add-ons for selected environment")
            else:
                msg = _("No add-ons to select.")

            for addon_id in args:
                name = self.payload.groupDescription(addon_id)[0]
                selected = addon_id in self._addons_selection
                displayed.append(CheckboxWidget(title="%s" % name, completed=selected))

        def _prep(i, w):
            """ Do some format magic for display. """
            num = TextWidget("%2d)" % (i + 1))
            return ColumnWidget([(4, [num]), (None, [w])], 1)

        # split list of DE's into two columns
        mid = length / 2
        left = [_prep(i, w) for i, w in enumerate(displayed) if i <= mid]
        right = [_prep(i, w) for i, w in enumerate(displayed) if i > mid]

        cw = ColumnWidget([(38, left), (38, right)], 2)

        self._window.append(TextWidget(msg))
        self._window.append(TextWidget(""))
        self._window.append(cw)
        self._window.append(TextWidget(""))
        return True
开发者ID:adrelanos,项目名称:qubes-installer-qubes-os,代码行数:59,代码来源:software.py

示例14: payloadInitialize

def payloadInitialize(storage, ksdata, payload, instClass):
    from pyanaconda.threads import threadMgr

    threadMgr.wait(THREAD_STORAGE)

    # FIXME: condition for cases where we don't want network
    # (set and use payload.needsNetwork ?)
    threadMgr.wait(THREAD_WAIT_FOR_CONNECTING_NM)

    payload.setup(storage, instClass)
开发者ID:akozumpl,项目名称:anaconda,代码行数:10,代码来源:__init__.py

示例15: _wait_for_connectivity

    def _wait_for_connectivity(self):
        """ Wait for Internet connectivity to become available.

        :return: True is connectivity is available, False otherwise
        :rtype: bool
        """
        # wait for the thread that waits for NM to connect
        threadMgr.wait(constants.THREAD_WAIT_FOR_CONNECTING_NM)
        # then check if NM connected successfully
        return nm.nm_is_connected()
开发者ID:cs2c-zhangchao,项目名称:nkwin1.0-anaconda,代码行数:10,代码来源:geoloc.py


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