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


Python progress.Progress方法代碼示例

本文整理匯總了Python中progress.Progress方法的典型用法代碼示例。如果您正苦於以下問題:Python progress.Progress方法的具體用法?Python progress.Progress怎麽用?Python progress.Progress使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在progress的用法示例。


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

示例1: refreshButtonClick

# 需要導入模塊: import progress [as 別名]
# 或者: from progress import Progress [as 別名]
def refreshButtonClick(self):

        self.progress = Progress()
        self.progress(0.0,0.1)

        web = urllib2.urlopen("http://www.makehumancommunity.org/sites/default/files/assets.json");
        jsonstring = web.read()
        assetJson = json.loads(jsonstring)

        increment = 0.8 / len(assetJson.keys())
        current = 0.1

        log.debug("Finished downloading json file")

        for key in assetJson.keys():
            current = current + increment
            self.progress(current,current + increment)
            self.setupOneAsset(assetJson[key])

        with open(os.path.join(self.root,"assets.json"),"w") as f:
            f.write(jsonstring)

        self.loadAssetsFromJson(assetJson)

        self.progress(1.0) 
開發者ID:makehumancommunity,項目名稱:community-plugins,代碼行數:27,代碼來源:assetdownload.py

示例2: create_adjacencies

# 需要導入模塊: import progress [as 別名]
# 或者: from progress import Progress [as 別名]
def create_adjacencies(fregex, pool=None):
    adjacencies = set()
    addresses = set()
    files = glob(fregex)
    pb = Progress(len(files), 'Reading traceroutes', increment=1, callback=lambda: 'Adjacencies {:,d} Addresses {:,d}'.format(len(adjacencies), len(addresses)))
    if pool:
        p = create_cluster(pool)
        dv, lv = setup_parallel()
        with dv.sync_imports():
            import json
            import numpy
        dv['Popen'] = Popen
        dv['PIPE'] = PIPE
        dv['Warts'] = Warts
        dv['extract_trace'] = extract_trace
        dv['cycle_free'] = cycle_free
        results = lv.map_async(process_trace_file, files)
    else:
        results = map(process_trace_file, files)
    for new_adjacencies, new_addresses in pb.iterator(results):
        adjacencies.update(new_adjacencies)
        addresses.update(new_addresses)
    if pool:
        stop_cluster()
    return adjacencies, addresses 
開發者ID:alexmarder,項目名稱:MAP-IT,代碼行數:27,代碼來源:mapit.py

示例3: __init__

# 需要導入模塊: import progress [as 別名]
# 或者: from progress import Progress [as 別名]
def __init__(self, **kvargs):
        super(PDialog, self).__init__(**kvargs)

        self.box = BoxLayout(orientation='vertical')
        self.label_one = Label(text='', size_hint=(1, .1), markup=True)
        self.label_two = Label(text='', size_hint=(1, .1), markup=True)
        self.progress_load = Progress()
        self.button_cancel = Button(
            text='Cancel', on_press=self.events_callback, size_hint=(1, .1),
            background_normal=self.background_image_buttons[0],
            background_down=self.background_image_shadows[0]
        )

        self.label_one.bind(size=lambda *args: self._update_text_size(args))
        self.label_two.bind(size=lambda *args: self._update_text_size(args))

        self.box.add_widget(self.label_one)
        self.box.add_widget(self.label_two)
        self.box.add_widget(Widget(size_hint=(None, .02)))
        self.box.add_widget(SettingSpacer())
        self.box.add_widget(Widget(size_hint=(None, .02)))
        self.box.add_widget(self.progress_load)
        self.box.add_widget(Widget(size_hint=(None, .3)))
        self.box.add_widget(SettingSpacer())
        self.box.add_widget(Widget(size_hint=(None, .02)))
        self.box.add_widget(self.button_cancel)

        self.progress_load.min = 0
        self.progress_load.max = 100
        self.progress_load.bar_value = 0
        self.progress_load.height_widget = self.dp(self.progress_line_height)
        self.progress_load.color = self.progress_line_color
        self.progress_load.border_color = self.progress_border_color 
開發者ID:HeaTTheatR,項目名稱:Easy,代碼行數:35,代碼來源:pdialog.py

示例4: __init__

# 需要導入模塊: import progress [as 別名]
# 或者: from progress import Progress [as 別名]
def __init__(self, **kvargs):
        super(PDialog, self).__init__(**kvargs)

        self.box = BoxLayout(orientation='vertical')
        self.label_one = Label(text='', size_hint=(1, .1), markup=True)
        self.label_two = Label(text='', size_hint=(1, .1), markup=True)
        self.progress_load = Progress()
        self.button_cancel = Button(
            text='Cancel', on_press=self.events_callback, size_hint=(1, .1),
            background_normal=self.background_image_buttons[0],
            background_down=self.background_image_shadows[0],
            background_color=choice(self.background_color_buttons)
        )

        self.label_one.bind(size=lambda *args: self._update_text_size(args))
        self.label_two.bind(size=lambda *args: self._update_text_size(args))

        self.box.add_widget(self.label_one)
        self.box.add_widget(self.label_two)
        self.box.add_widget(Widget(size_hint=(None, .02)))
        self.box.add_widget(SettingSpacer())
        self.box.add_widget(Widget(size_hint=(None, .02)))
        self.box.add_widget(self.progress_load)
        self.box.add_widget(Widget(size_hint=(None, .3)))
        self.box.add_widget(SettingSpacer())
        self.box.add_widget(Widget(size_hint=(None, .02)))
        self.box.add_widget(self.button_cancel)

        self.progress_load.min = 0
        self.progress_load.max = 100
        self.progress_load.bar_value = 0
        self.progress_load.height_widget = self.dp(self.progress_line_height)
        self.progress_load.color = self.progress_line_color
        self.progress_load.border_color = self.progress_border_color 
開發者ID:HeaTTheatR,項目名稱:kdialog,代碼行數:36,代碼來源:pdialog.py


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