本文整理汇总了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