本文整理匯總了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)
示例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
示例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
示例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