本文整理汇总了Python中ProgressBar.ProgressBar.setFormat方法的典型用法代码示例。如果您正苦于以下问题:Python ProgressBar.setFormat方法的具体用法?Python ProgressBar.setFormat怎么用?Python ProgressBar.setFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProgressBar.ProgressBar
的用法示例。
在下文中一共展示了ProgressBar.setFormat方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: DailyPorker
# 需要导入模块: from ProgressBar import ProgressBar [as 别名]
# 或者: from ProgressBar.ProgressBar import setFormat [as 别名]
#.........这里部分代码省略.........
self.build_wbr_button.clicked.connect(self.buildWBR)
def buildDBR(self):
self.build_dbr_button.setEnabled(False)
self.alertMessage("Please Wait","This could take a while.")
dbr = MOSES.getDBR(self.user_id, self.password, self.start_date_edit.date().toPyDate(), self.category_tree)
self.dbr_report.showDataFrame(dbr)
self.dbr_report.adjustToColumns()
self.build_dbr_button.setEnabled(True)
self.alertMessage("Success","Successfully Pulled the DBR")
def buildWBR(self):
self.build_wbr_button.setEnabled(False)
self.alertMessage("Please Wait","This could take a while.")
wbr = MOSES.getWBR(self.user_id, self.password, self.start_date_edit.date().toPyDate(), self.category_tree)
self.wbr_report.showDataFrame(wbr)
self.wbr_report.adjustToColumns()
self.build_wbr_button.setEnabled(True)
self.alertMessage("Success","Successfully Pulled the WBR")
def getWritersList(self):
self.writers_data_frame = MOSES.getWritersList(self.user_id, self.password, self.start_date_edit.date().toPyDate())
writer_names_list = list(set(self.writers_data_frame["Name"]))
writer_names_list.sort()
return writer_names_list
def displayGraphs(self,handle):
if handle:
self.graphs.graph_date = self.pork_lane.start_date
self.graphs.enable_plotting = True
self.graphs.plotGraph()
self.progress_bar.setRange(0,100)
self.progress_bar.setFormat("Completed at %s." %(datetime.datetime.strftime(datetime.datetime.now(),"%H:%M:%S")))
self.status.setText("Beware the alien, the mutant, the heretic.")
self.progress_bar.setValue(100)
#self.export_graphs_button.setEnabled(True)
else:
self.export_graphs_button.setEnabled(False)
self.status.setText("Creating Graphs...")
self.progress_bar.setValue(0)
self.progress_bar.setRange(0,0)
def refreshSortFilter(self):
report_types = self.getRequiredReportTypes()
self.sorting_filter_combobox.clear()
if len(report_types) > 0:
self.sorting_filter_combobox.setEnabled(True)
self.sorting_filter_combobox.addItems(report_types)
else:
self.sorting_filter_combobox.setEnabled(False)
self.sorting_filter_combobox.setCurrentIndex(-1)
def buildReport(self):
self.build_button.setEnabled(False)
report_types = self.getRequiredReportTypes()
if len(report_types) > 0:
self.build = True
self.pork_lane.writers_data_frame = self.writers_data_frame
self.pork_lane.parameter_list = self.parameters_combobox.getCheckedItems() #set pork lane report types.]
self.pork_lane.time_frame_list = self.report_time_frames_combobox.getCheckedItems()
selected_writers_list = self.writers_combobox.getCheckedItems()
if len(selected_writers_list)>0:
self.pork_lane.writers_list = selected_writers_list
else:
示例2: DataSelector
# 需要导入模块: from ProgressBar import ProgressBar [as 别名]
# 或者: from ProgressBar.ProgressBar import setFormat [as 别名]
#.........这里部分代码省略.........
QtGui.QMessageBox.about(self, title, message)
def downloadFromFK(self):
"""Triggers FKRetriever."""
fsns = self.fsn_text_edit.getFSNs()
self.fetch_images_attributes_button.setEnabled(False)
if len(fsns) >=1:
self.fetching_activity.setText("Preparing to download images and specifications off the Flipkart website!")
self.fk_retriever.fsn_list = fsns
self.fk_retriever.allow_run = True
else:
print "No FSNS to process."
def prepareDataRetrievedFromFK(self, status, data_set, progress_value, fsn_lists, completion_status, eta):
"""Gets data from FK from the thread's signal and prepares it."""
self.fetching_progress.setValue(progress_value)
eta_string = eta.strftime("%a (%d-%b), %H:%M:%S")
self.putAttributes(data_set)
self.data_from_fk = data_set
now_string = datetime.datetime.now().strftime("(%d-%b), %H:%M:%S")
completed_fsns = fsn_lists[0]
pending_fsns = fsn_lists[1]
failed_fsns = fsn_lists[2]
self.completed_fsns_count_spinbox.setValue(len(completed_fsns))
self.pending_fsns_count_spinbox.setValue(len(pending_fsns))
self.failed_fsns_count_spinbox.setValue(len(failed_fsns))
self.completed_fsns_list_text_edit.setText("\n".join(completed_fsns))
self.pending_fsns_list_text_edit.setText("\n".join(pending_fsns))
self.failed_fsns_list_text_edit.setText("\n".join(failed_fsns))
self.eta_datetimeedit.setDateTime(QtCore.QDateTime(eta))
if completion_status:
self.fetching_progress.setFormat("%d%% (Completed at %s)"%(progress_value, now_string))
message = "Completed at %s."%now_string
self.fsn_mode_data_options.setEnabled(True)
self.fetch_images_attributes_button.setEnabled(True)
self.sendAlert("Cowabunga!","Completed fetching data and images for the given list.")
else:
self.fetching_progress.setFormat("%d%% @(%s)"%(progress_value, now_string))
message = "%s ETA: %s"%(status, eta_string)
self.fsn_mode_data_options.setEnabled(False)
self.fetching_activity.setText(message)
self.activity_log_textedit.append(message)
def putAttributes(self, data_set):
attributes = []
for fsn in data_set:
attributes+=data_set[fsn].keys()
attributes = list(set(attributes))
self.attributes_list_box.setSortingEnabled(False)
self.attributes_list_box.clear()
self.primary_attributes_list_box.clear()
self.secondary_attributes_list_box.clear()
self.attributes_list_box.addItems(attributes)
self.attributes_list_box.setSortingEnabled(True)
self.attributes_list_box.sortItems()
def getData(self):
return self.data
def changePage(self, current, previous):
if not current:
current = previous
self.fsn_or_csv_stacked_widget.setCurrentIndex(self.page_selector.row(current))
示例3: Seeker
# 需要导入模块: from ProgressBar import ProgressBar [as 别名]
# 或者: from ProgressBar.ProgressBar import setFormat [as 别名]
#.........这里部分代码省略.........
self.type_selector.setCurrentIndex(0)
self.output_table = CopiableQTableWidget(0, 0)
self.progress_bar = ProgressBar()
self.fetch_data_button = ImageButton(os.path.join("Images","find.png"),64,64,os.path.join("Images","find_mouseover.png"))
self.fetch_data_button.setFlat(True)
form_searcher_layout = QtGui.QVBoxLayout()
form_searcher_layout.addWidget(self.fsns_label, 0)
form_searcher_layout.addWidget(self.fsns_text_edit, 2)
self.seeker_button = ImageButton(os.path.join("Images","seeker.png"),100,100,os.path.join("Images","seeker_mouseover.png"))
self.seeker_button.setFlat(True)
self.seeker_button.setToolTip("You're a Wizard, Harry.")
form_options_layout = QtGui.QVBoxLayout()
form_options_layout.addStretch(1)
form_options_layout.addWidget(self.seeker_button,1, QtCore.Qt.AlignHCenter | QtCore.Qt.AlignBottom)
form_options_layout.addStretch(2)
form_options_layout.addWidget(self.type_selector, 0)
form_options_layout.addWidget(self.fetch_data_button, 0, QtCore.Qt.AlignHCenter | QtCore.Qt.AlignBottom)
form_layout = QtGui.QHBoxLayout()
form_layout.addLayout(form_searcher_layout, 3)
form_layout.addLayout(form_options_layout, 0)
layout = QtGui.QVBoxLayout()
layout.addLayout(form_layout, 0)
layout.addWidget(self.output_table, 3)
layout.addWidget(self.progress_bar, 0)
self.setLayout(layout)
self.setWindowTitle("Seeker: The FSN Finding Tool")
self.setWindowIcon(QtGui.QIcon(os.path.join('Images','PORK_Icon.png')))
self.show()
def createEvents(self):
""""""
self.fetch_data_button.clicked.connect(self.fetchData)
self.peeves.sendProgress.connect(self.displayProgress)
#self.peeves.sendRow.connect(self.displayFSNs)
self.peeves.sendData.connect(self.populateTable)
def fetchData(self):
text_edit_contents = str(self.fsns_text_edit.toPlainText()).strip()
if '"' in text_edit_contents:
text_edit_contents.replace('"',"")
if " " in text_edit_contents:
text_edit_contents.replace(' ', "")
search_items = list(set(text_edit_contents.split("\n")))
self.search_type = self.type_selector.currentIndex()
self.peeves.fetchData(search_items, self.search_type)
def populateTable(self, fsn_data):
#print "Populating the table!"
self.output_table.setSortingEnabled(False)
table_headers = [
"FSN",
"Status",
"Item ID",
"Description Type",
"Writer ID",
"Writer Name",
"Article Date",
"Database table",
"BU",
"Super-Category",
"Category",
"Sub-Category",
"Vertical",
"Brand"
]
#print table_headers
rows = len(fsn_data)
columns = len(table_headers)
self.output_table.setRowCount(rows)
self.output_table.setColumnCount(columns)
row_counter = 0
for each_fsn in fsn_data:
column_counter = 0
# self.output_table.addRow(row_counter)
for key in table_headers:
item = QtGui.QTableWidgetItem(str(each_fsn[key]))
self.output_table.setItem(row_counter, column_counter, item)
column_counter += 1
row_counter += 1
self.output_table.setHorizontalHeaderLabels(table_headers)
self.output_table.setSortingEnabled(True)
self.output_table.sortItems(1)
self.output_table.resizeColumnsToContents()
self.output_table.resizeRowsToContents()
#print fsn_data
def displayProgress(self, done, total, eta):
progress = float(done)/float(total)
if done < total:
time_string = datetime.datetime.strftime(eta, "%d %B, %H:%M:%S")
self.progress_bar.setFormat("Getting FSN Data. Finished %d of %d. ETA: %s" %(done, total, time_string))
else:
self.progress_bar.setFormat("Completed fetching FSN Data")
self.progress_bar.setValue(int(progress*100))