• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python threadMgr.get函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: _software_is_ready

 def _software_is_ready(self):
     # FIXME:  Would be nicer to just ask the spoke if it's ready.
     return (not threadMgr.get(constants.THREAD_PAYLOAD) and
             not threadMgr.get(constants.THREAD_PAYLOAD_MD) and
             not threadMgr.get(constants.THREAD_SOFTWARE_WATCHER) and
             not threadMgr.get(constants.THREAD_CHECK_SOFTWARE) and
             self.payload.baseRepo is not None)
开发者ID:cs2c-zhangchao,项目名称:nkwin1.0-anaconda,代码行数:7,代码来源:storage.py


示例2: ready

 def ready(self):
     """ Check if the spoke is ready. """
     return (
         self._ready
         and not threadMgr.get(THREAD_PAYLOAD_MD)
         and not threadMgr.get(THREAD_SOFTWARE_WATCHER)
         and not threadMgr.get(THREAD_CHECK_SOFTWARE)
     )
开发者ID:akozumpl,项目名称:anaconda,代码行数:8,代码来源:source.py


示例3: completed

    def completed(self):
        retval = (threadMgr.get(constants.THREAD_EXECUTE_STORAGE) is None and
                  threadMgr.get(constants.THREAD_CHECK_STORAGE) is None and
                  self.storage.rootDevice is not None and
                  not self.errors)

        if flags.automatedInstall:
            return retval and self.data.bootloader.seen
        else:
            return retval
开发者ID:cs2c-zhangchao,项目名称:nkwin1.0-anaconda,代码行数:10,代码来源:storage.py


示例4: ready

    def ready(self):
        # By default, the software selection spoke is not ready.  We have to
        # wait until the installation source spoke is completed.  This could be
        # because the user filled something out, or because we're done fetching
        # repo metadata from the mirror list, or we detected a DVD/CD.

        return bool(not threadMgr.get(constants.THREAD_SOFTWARE_WATCHER) and
                    not threadMgr.get(constants.THREAD_PAYLOAD_MD) and
                    not threadMgr.get(constants.THREAD_CHECK_SOFTWARE) and
                    self.payload.baseRepo is not None)
开发者ID:pombreda,项目名称:anaconda,代码行数:10,代码来源:software.py


示例5: completed

    def completed(self):
        processingDone = bool(not threadMgr.get(constants.THREAD_CHECK_SOFTWARE) and
                              not threadMgr.get(constants.THREAD_PAYLOAD) and
                              not self._errorMsgs and self.txid_valid)

        # we should always check processingDone before checking the other variables,
        # as they might be inconsistent until processing is finished
        if self._kickstarted:
            return processingDone and self.data.packages.seen
        else:
            return processingDone and self._get_selected_environment() is not None
开发者ID:KosiehBarter,项目名称:anaconda,代码行数:11,代码来源:software.py


示例6: wait_and_fetch_net_data

def wait_and_fetch_net_data(url, out_file, ca_certs=None):
    """
    Function that waits for network connection and starts a thread that fetches
    data over network.

    :see: org_fedora_oscap.data_fetch.fetch_data
    :return: the name of the thread running fetch_data
    :rtype: str

    """

    # get thread that tries to establish a network connection
    nm_conn_thread = threadMgr.get(constants.THREAD_WAIT_FOR_CONNECTING_NM)
    if nm_conn_thread:
        # NM still connecting, wait for it to finish
        nm_conn_thread.join()

    if not nm.nm_is_connected():
        raise OSCAPaddonNetworkError("Network connection needed to fetch data.")

    fetch_data_thread = AnacondaThread(name=THREAD_FETCH_DATA,
                                       target=fetch_data,
                                       args=(url, out_file, ca_certs),
                                       fatal=False)

    # register and run the thread
    threadMgr.add(fetch_data_thread)

    return THREAD_FETCH_DATA
开发者ID:vpodzime,项目名称:oscap-anaconda-addon,代码行数:29,代码来源:common.py


示例7: _check_discover

    def _check_discover(self, *args):
        """ After the zFCP discover thread runs, check to see whether a valid
            device was discovered. Display an error message if not.

            If the discover is not done, return True to indicate that the check
            has to be run again, otherwise check the discovery and return False.
        """
        # Discovery is not done, return True.
        if threadMgr.get(constants.THREAD_ZFCP_DISCOVER):
            return True

        # Discovery has finished, run the check.
        self._spinner.stop()

        if self._discoveryError:
            # Failure, display a message and leave the user on the dialog so
            # they can try again (or cancel)
            self._errorLabel.set_text(self._discoveryError)
            self._discoveryError = None

            self._conditionNotebook.set_current_page(2)
            self._set_configure_sensitive(True)
        else:
            # Great success. Just return to the advanced storage window and let the
            # UI update with the newly-added device
            self.window.response(1)
            return False

        self._cancelButton.set_sensitive(True)
        # Discovery and the check have finished, return False.
        return False
开发者ID:dougsland,项目名称:anaconda,代码行数:31,代码来源:zfcp.py


示例8: restartThread

    def restartThread(self, storage, ksdata, payload, instClass, fallback=False, checkmount=True):
        """Start or restart the payload thread.

           This method starts a new thread to restart the payload thread, so
           this method's return is not blocked by waiting on the previous payload
           thread. If there is already a payload thread restart pending, this method
           has no effect.

           :param blivet.Blivet storage: The blivet storage instance
           :param kickstart.AnacondaKSHandler ksdata: The kickstart data instance
           :param packaging.Payload payload: The payload instance
           :param installclass.BaseInstallClass instClass: The install class instance
           :param bool fallback: Whether to fall back to the default repo in case of error
           :param bool checkmount: Whether to check for valid mounted media
        """

        log.debug("Restarting payload thread")

        # If a restart thread is already running, don't start a new one
        if threadMgr.get(THREAD_PAYLOAD_RESTART):
            return

        # Launch a new thread so that this method can return immediately
        threadMgr.add(AnacondaThread(name=THREAD_PAYLOAD_RESTART, target=self._restartThread,
            args=(storage, ksdata, payload, instClass, fallback, checkmount)))
开发者ID:NealSCarffery,项目名称:anaconda,代码行数:25,代码来源:__init__.py


示例9: _check_discover

    def _check_discover(self, *args):
        if threadMgr.get(constants.THREAD_ISCSI_DISCOVER):
            return True

        # When iscsi discovery is done, update the UI.  We don't need to worry
        # about the user escaping from the dialog because all the buttons are
        # marked insensitive.
        spinner = self.builder.get_object("waitSpinner")
        spinner.stop()

        if self._discoveryError:
            # Failure.  Display some error message and leave the user on the
            # dialog to try again.
            self.builder.get_object("discoveryErrorLabel").set_text(self._discoveryError)
            self._discoveryError = None
            self._conditionNotebook.set_current_page(2)
            self._set_configure_sensitive(True)
        else:
            # Success.  Now populate the node store and kick the user on over to
            # that subscreen.
            self._add_nodes(self._discoveredNodes)
            self._iscsiNotebook.set_current_page(1)
            self._okButton.set_sensitive(True)

            # If some form of login credentials were used for discovery,
            # default to using the same for login.
            if self._authTypeCombo.get_active() != 0:
                self._loginAuthTypeCombo.set_active(3)

        # We always want to enable this button, in case the user's had enough.
        self._cancelButton.set_sensitive(True)
        return False
开发者ID:mairin,项目名称:anaconda,代码行数:32,代码来源:iscsi.py


示例10: refresh

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

        # check if the storage refresh thread is running
        if threadMgr.get(THREAD_STORAGE_WATCHER):
            # storage refresh is running - just report it
            # so that the user can refresh until it is done
            # TODO: refresh once the thread is done ?
            message = _(PAYLOAD_STATUS_PROBING_STORAGE)
            self._window += [TextWidget(message), ""]
            return True

        # check if there are any mountable devices
        if self._mountable_devices:
            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)

            devices = [TextWidget(d[1]) for d in self._mountable_devices]

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

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

        else:
            message = _("No mountable devices found")
            self._window += [TextWidget(message), ""]
        return True
开发者ID:adrelanos,项目名称:qubes-installer-qubes-os,代码行数:32,代码来源:source.py


示例11: completed

    def completed(self):
        processingDone = not threadMgr.get(constants.THREAD_CHECK_SOFTWARE) and \
                         not self._errorMsgs and self.txid_valid

        if flags.automatedInstall:
            return processingDone and self.data.packages.seen
        else:
            return self._get_selected_environment() is not None and processingDone
开发者ID:pombreda,项目名称:anaconda,代码行数:8,代码来源:software.py


示例12: completed

    def completed(self):
        """ Make sure our threads are done running and vars are set. """
        processingDone = not threadMgr.get(THREAD_CHECK_SOFTWARE) and \
                         not self.errors and self.txid_valid

        if flags.automatedInstall:
            return processingDone and self.payload.baseRepo and self.data.packages.seen
        else:
            return self.payload.baseRepo and self.environment is not None and processingDone
开发者ID:joesaland,项目名称:qubes-installer-qubes-os,代码行数:9,代码来源:software.py


示例13: completed

    def completed(self):
        processingDone = bool(not threadMgr.get(constants.THREAD_CHECK_SOFTWARE) and
                              not threadMgr.get(constants.THREAD_PAYLOAD) and
                              not self._errorMsgs and self.txid_valid)

        # * we should always check processingDone before checking the other variables,
        #   as they might be inconsistent until processing is finished
        # * we can't let the installation proceed until a valid environment has been set
        if processingDone:
            if self.environment is not None:
                # if we have environment it needs to be valid
                return self.environment_valid
            # if we don't have environment we need to at least have the %packages
            # section in kickstart
            elif flags.automatedInstall and self.data.packages.seen:
                return True
            # no environment and no %packages section -> manual intervention is needed
            else:
                return False
        else:
            return False
开发者ID:dougsland,项目名称:anaconda,代码行数:21,代码来源:software.py


示例14: _initialize

    def _initialize(self):
        for day in xrange(1, 32):
            self.add_to_store(self._daysStore, day)

        for i in xrange(1, 13):
            #a bit hacky way, but should return the translated string
            #TODO: how to handle language change? Clear and populate again?
            month = datetime.date(2000, i, 1).strftime('%B')
            self.add_to_store(self._monthsStore, month)
            self._months_nums[month] = i

        for year in xrange(1990, 2051):
            self.add_to_store(self._yearsStore, year)

        cities = set()
        xlated_regions = ((region, get_xlated_timezone(region))
                          for region in self._regions_zones.iterkeys())
        for region, xlated in sorted(xlated_regions, cmp=_compare_regions):
            self.add_to_store_xlated(self._regionsStore, region, xlated)
            for city in self._regions_zones[region]:
                cities.add((city, get_xlated_timezone(city)))

        for city, xlated in sorted(cities, cmp=_compare_cities):
            self.add_to_store_xlated(self._citiesStore, city, xlated)

        if self._radioButton24h.get_active():
            self._set_amPm_part_sensitive(False)

        self._update_datetime_timer_id = None
        if is_valid_timezone(self.data.timezone.timezone):
            self._set_timezone(self.data.timezone.timezone)
        elif not flags.flags.automatedInstall:
            log.warning("%s is not a valid timezone, falling back to default (%s)",
                        self.data.timezone.timezone, DEFAULT_TZ)
            self._set_timezone(DEFAULT_TZ)
            self.data.timezone.timezone = DEFAULT_TZ

        if not flags.can_touch_runtime_system("modify system time and date"):
            self._set_date_time_setting_sensitive(False)

        self._config_dialog = NTPconfigDialog(self.data)
        self._config_dialog.initialize()

        time_init_thread = threadMgr.get(constants.THREAD_TIME_INIT)
        if time_init_thread is not None:
            hubQ.send_message(self.__class__.__name__,
                             _("Restoring hardware time..."))
            threadMgr.wait(constants.THREAD_TIME_INIT)

        hubQ.send_ready(self.__class__.__name__, False)
开发者ID:joesaland,项目名称:qubes-installer-qubes-os,代码行数:50,代码来源:datetime_spoke.py


示例15: refresh

    def refresh(self):
        """Refresh location info"""
        # first check if a provider is available
        if self._provider is None:
            log.error("Geoloc: can't refresh - no provider")
            return

        # then check if a refresh is already in progress
        if threadMgr.get(constants.THREAD_GEOLOCATION_REFRESH):
            log.debug("Geoloc: refresh already in progress")
        else:  # wait for Internet connectivity
            if network.wait_for_connectivity():
                threadMgr.add(AnacondaThread(name=constants.THREAD_GEOLOCATION_REFRESH, target=self._provider.refresh))
            else:
                log.error("Geolocation refresh failed" " - no connectivity")
开发者ID:NealSCarffery,项目名称:anaconda,代码行数:15,代码来源:geoloc.py


示例16: _initialize

    def _initialize(self):
        # a bit hacky way, but should return the translated strings
        for i in range(1, 32):
            day = datetime.date(2000, 1, i).strftime(self._day_format)
            self.add_to_store_idx(self._daysStore, i, day)

        for i in range(1, 13):
            month = datetime.date(2000, i, 1).strftime(self._month_format)
            self.add_to_store_idx(self._monthsStore, i, month)

        for i in range(1990, 2051):
            year = datetime.date(i, 1, 1).strftime(self._year_format)
            self.add_to_store_idx(self._yearsStore, i, year)

        cities = set()
        xlated_regions = ((region, get_xlated_timezone(region))
                          for region in self._regions_zones.keys())
        for region, xlated in sorted(xlated_regions, key=functools.cmp_to_key(_compare_regions)):
            self.add_to_store_xlated(self._regionsStore, region, xlated)
            for city in self._regions_zones[region]:
                cities.add((city, get_xlated_timezone(city)))

        for city, xlated in sorted(cities, key=functools.cmp_to_key(_compare_cities)):
            self.add_to_store_xlated(self._citiesStore, city, xlated)

        self._update_datetime_timer_id = None
        if is_valid_timezone(self.data.timezone.timezone):
            self._set_timezone(self.data.timezone.timezone)
        elif not flags.flags.automatedInstall:
            log.warning("%s is not a valid timezone, falling back to default (%s)",
                        self.data.timezone.timezone, DEFAULT_TZ)
            self._set_timezone(DEFAULT_TZ)
            self.data.timezone.timezone = DEFAULT_TZ

        time_init_thread = threadMgr.get(constants.THREAD_TIME_INIT)
        if time_init_thread is not None:
            hubQ.send_message(self.__class__.__name__,
                             _("Restoring hardware time..."))
            threadMgr.wait(constants.THREAD_TIME_INIT)

        hubQ.send_ready(self.__class__.__name__, False)

        # report that we are done
        self.initialize_done()
开发者ID:dougsland,项目名称:anaconda,代码行数:44,代码来源:datetime_spoke.py


示例17: _check_login

    def _check_login(self, *args):
        if threadMgr.get(constants.THREAD_ISCSI_LOGIN):
            return True

        spinner = self.builder.get_object("loginSpinner")
        spinner.stop()
        spinner.hide()

        if self._loginError:
            self.builder.get_object("loginErrorLabel").set_text(self._loginError)
            self._loginError = None
            self._loginConditionNotebook.set_current_page(1)
            self._cancelButton.set_sensitive(True)
            self._loginButton.set_sensitive(True)
        else:
            anyLeft = False

            self._loginConditionNotebook.set_current_page(0)

            # Select the now-first target for the user in case they want to
            # log into another one.
            for row in self._store:
                if row[1]:
                    row[0] = True
                    anyLeft = True

                    # And make the login button sensitive if there are any more
                    # nodes to login to.
                    self._loginButton.set_sensitive(True)
                    break

            self._okButton.set_sensitive(True)

            # Once a node has been logged into, it doesn't make much sense to let
            # the user cancel.  Cancel what, exactly?
            self._cancelButton.set_sensitive(False)

            if not anyLeft:
                self.window.response(1)

        self._set_login_sensitive(True)
        return False
开发者ID:mairin,项目名称:anaconda,代码行数:42,代码来源:iscsi.py


示例18: _check_rescan

    def _check_rescan(self, *args):
        if threadMgr.get(constants.THREAD_STORAGE):
            self._elapsed += 1

            # If more than five seconds has elapsed since the rescan started,
            # give the user the option to return to the hub.
            if self._elapsed >= 5:
                self._notebook.set_current_page(2)

            return True

        # Seems a little silly to have this warning text still displayed
        # when everything is done.
        box = self.builder.get_object("warningBox")
        box.set_visible(False)

        self._cancel_button.set_sensitive(False)
        self._ok_button.set_sensitive(True)
        self._notebook.set_current_page(3)
        return False
开发者ID:KosiehBarter,项目名称:anaconda,代码行数:20,代码来源:refresh.py


示例19: one_time_sync_async

def one_time_sync_async(server, callback=None):
    """
    Asynchronously synchronize the system time with a given NTP server. This
    function is non-blocking it starts a new thread for synchronization and
    returns. Use callback argument to specify the function called when the
    new thread finishes if needed.

    :param server: NTP server
    :param callback: callback function to run after sync or failure
    :type callback: a function taking one boolean argument (success)

    """

    thread_name = "%s_%s" % (THREAD_SYNC_TIME_BASENAME, server)
    if threadMgr.get(thread_name):
        #syncing with the same server running
        return

    threadMgr.add(AnacondaThread(name=thread_name, target=one_time_sync,
                                 args=(server, callback)))
开发者ID:megaumi,项目名称:anaconda,代码行数:20,代码来源:ntp.py


示例20: status

 def status(self):
     if threadMgr.get(constants.THREAD_CHECK_SOFTWARE):
         return _("Checking software dependencies...")
     elif not self.ready:
         return _(BASEREPO_SETUP_MESSAGE)
     elif self._error or not self.payload.baseRepo:
         return _("Error setting up software source")
     elif self.data.method.method == "url":
         return self.data.method.url or self.data.method.mirrorlist
     elif self.data.method.method == "nfs":
         return _("NFS server %s") % self.data.method.server
     elif self.data.method.method == "cdrom":
         return _("CD/DVD drive")
     elif self.data.method.method == "harddrive":
         if not self._currentIsoFile:
             return _("Error setting up software source")
         return os.path.basename(self._currentIsoFile)
     elif self.payload.baseRepo:
         return _("Closest mirror")
     else:
         return _("Nothing selected")
开发者ID:Sabayon,项目名称:anaconda,代码行数:21,代码来源:source.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python threadMgr.wait函数代码示例发布时间:2022-05-25
下一篇:
Python threadMgr.add函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap