New version

This commit is contained in:
Ambulance Clerc
2022-06-06 17:28:34 +02:00
parent 80fa01633e
commit e3c4ee9d3e
3 changed files with 10 additions and 4 deletions

View File

@@ -5,6 +5,7 @@ import io
class auto_updater:
dl_version = 0
temp_dir = ""
def clean(self, str):
str = str.replace('/','')
@@ -25,8 +26,8 @@ class auto_updater:
ssl._create_default_https_context = ssl._create_unverified_context
if self.dl_version != VERSION:
print(f"Version différente trouvée {self.dl_version} téléchargement en cours")
urllib.request.urlretrieve(url=f"https://gitea.prod.resk-u.ch/CLERC/AttribWinbiz/releases/download/{self.clean(self.dl_version)}/Clercattrib2Biz_setup.exe", filename="update.exe")
print(f"Version différente trouvée {self.dl_version} téléchargement en cours => {self.temp_dir}update.exe")
urllib.request.urlretrieve(url=f"https://gitea.prod.resk-u.ch/CLERC/AttribWinbiz/releases/download/{self.clean(self.dl_version)}/Clercattrib2Biz_setup.exe", filename=f"{self.temp_dir}update.exe")
ret = True
return ret

View File

@@ -27,6 +27,7 @@ from version import *
src_dir = os.getenv('APPDATA') + "\Attrib2Biz\src"
dest_dir = os.getenv('APPDATA') + "\Attrib2Biz\output"
temp_dir = os.getenv('APPDATA') + '\Attrib2Biz\.temp'
file_path ="" #os.path.dirname(__file__)
Elements = []
@@ -40,6 +41,9 @@ if not os.path.exists(src_dir):
if not os.path.exists(dest_dir):
os.makedirs(dest_dir)
if not os.path.exists(temp_dir):
os.makedirs(temp_dir)
class SuggestionPopup(Toplevel):
x_row = 0
@@ -319,10 +323,11 @@ class ClercAttrib2Biz():
self.thread = Thread(target=self.start_parsing)
auto_update = auto_updater()
auto_update.temp_dir = temp_dir + '\\'
if auto_update.new_update_available():
self.logger.warning(f"Nouvelle version du script disponible. {auto_update.dl_version}")
if messagebox.askyesno(title="Nouvelle version trouvée", message=f"Une nouvelle version a été trouvée, vous pouvez l'installer dès maintenant !", ):
subprocess.call("update.exe")
subprocess.call(temp_dir + "\\update.exe")
self.fenetre.destroy()
def disable_prompt(self):

View File

@@ -1 +1 @@
VERSION = "20220606-1715"
VERSION = "20220606-1728"