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