Adaptation du fonctionnement de la progessbar

This commit is contained in:
Ambulance Clerc
2022-09-02 14:39:11 +02:00
parent 355d17810f
commit 842ae5fb69

14
main.py
View File

@@ -306,7 +306,7 @@ class ClercAttrib2Biz():
print(f"remove src.csv => {os.path.join(dest_dir, 'src.csv')}")
self.progress_bar["value"] = 0
for filename in os.listdir(dir):
x += 1
if ".json" in filename:
@@ -316,6 +316,8 @@ class ClercAttrib2Biz():
if self.export_format_biz.get():
self.parseFile(data, filename)
messagebox.showinfo(title="Fin de conversion",
message="La conversion s'est terminée avec succès")
else:
self.convertFile(data, filename)
if self.delete_after_parse.get():
@@ -382,6 +384,7 @@ class ClercAttrib2Biz():
def parseFile(self, data, filename):
self.progress_bar["value"] = 0
self.index_counter += 1
lines = []
self.count_facture += len(data["invoices"])
@@ -393,10 +396,14 @@ class ClercAttrib2Biz():
csv_col.data[5] = f""
lines.append(csv_col.data)
x = 70
x = 0
cur_invoice_index = 0
for ele in data["invoices"]:
x += 1
for ele in data["invoices"]:
cur_invoice_index += 1
self.progress_bar["value"] = cur_invoice_index / x * 100
b_address_update = True
data = cls_Invoice()
data.parse_item(ele)
@@ -709,6 +716,7 @@ class ClercAttrib2Biz():
wr.writerow(cdr)
else:
self.save_file(lines,fileName=self.export_filename)
def addToIndexs(self,obj,data,cat, key):
#self.a_index[cat].append({"key":key,"index":len(obj.data)})
if key not in self.a_index[cat]: