-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
33 lines (25 loc) · 1.09 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import requests
from PyQt5 import QtWidgets
from GUI.menu_principal import MainWindow
from utils import info_window
def check_for_update(current_version, w):
try:
response = requests.get("https://api.github.com/repos/LucasSom/cortes-geologicos/releases/latest")
latest_version = response.json()["tag_name"]
if current_version < latest_version:
notify_user(latest_version, w)
except Exception as e:
if type(e) == requests.exceptions.ConnectionError:
info_window(w, "No se pudieron comprobar actualizaciones por problemas de conexión.")
else:
print(e)
info_window(w, "No se pudieron comprobar actualizaciones por un problema desconocido.")
def notify_user(latest_version, w):
info_window(w, f"Hay una nueva versión disponible: {latest_version}.\n"
f"Actualizar descargando de https://github.com/LucasSom/cortes-geologicos")
if __name__ == '__main__':
app = QtWidgets.QApplication([])
window = MainWindow()
check_for_update("v1.0.7", window)
window.show()
app.exec_()