Skip to content

Commit

Permalink
stuff
Browse files Browse the repository at this point in the history
1. don't use calibri
2. don't use https to check for internet connection
  • Loading branch information
i13k authored Jul 23, 2024
1 parent e45ce83 commit 8290a15
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions SoftwareUpdater.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@
import threading

VERSION = '1.1'

CHECK_NEW_VERSION_URL = 'https://api.github.com/repos/bartekl1/SoftwareUpdater/releases/latest'


polish_text = [
'Przygotowywanie...',
'Wszystko w porządku.',
Expand All @@ -25,11 +23,11 @@
'Dostępna nowa wersja.',
'Nie można sprawdzić dostępności nowej wersji.',
'Nie uruchomiono programu jako administrator.',
'Winget nie jest dostępny',
'winget nie jest dostępny',
'Pobierz',
'Uruchom jako administrator',
'Dalej',
'Sprawdzanie dostępnych aktualizacji...',
'Sprawdzanie dostępności aktualizacji...',
'Dostępne aktualizacje',
'Instalowanie aktualizacji...',
'Zakończono',
Expand Down Expand Up @@ -115,7 +113,7 @@ def check_system():

preparing_label = ctk.CTkLabel(preparing_frame,
text=get_text(0),
font=('Calibri', 22))
font=('Segoe UI', 22))
preparing_label.pack()

preparing_progressbar = ctk.CTkProgressBar(preparing_frame,
Expand All @@ -142,7 +140,7 @@ def check_system2():

# 2. Check internet connection
try:
requests.get('https://google.com/')
requests.get('http://example.org')
except Exception:
issues.append({'type': 'critical',
'message': 'no_internet_connection'})
Expand Down Expand Up @@ -191,17 +189,17 @@ def check_system2():
if len(issues) == 0:
check_system_label = ctk.CTkLabel(check_system_frame,
text=get_text(1),
font=('Calibri', 22),
font=('Segoe UI', 22),
text_color='green')
elif 'critical' not in [issue['type'] for issue in issues]:
check_system_label = ctk.CTkLabel(check_system_frame,
text=get_text(2),
font=('Calibri', 22),
font=('Segoe UI', 22),
text_color='orange')
else:
check_system_label = ctk.CTkLabel(check_system_frame,
text=get_text(3),
font=('Calibri', 22),
font=('Segoe UI', 22),
text_color='red')
check_system_label.pack()

Expand Down Expand Up @@ -277,7 +275,7 @@ def check_for_winget_packages_updates():

checking_label = ctk.CTkLabel(checking_updates_frame,
text=get_text(13),
font=('Calibri', 22))
font=('Segoe UI', 22))
checking_label.pack()

checking_progressbar = ctk.CTkProgressBar(checking_updates_frame,
Expand All @@ -293,8 +291,7 @@ def check_for_winget_packages_updates():


def check_updates():
global available_updates_frame, \
available_updates
global available_updates_frame, available_updates

s = subprocess.run('winget upgrade',
stdout=subprocess.PIPE,
Expand Down Expand Up @@ -410,7 +407,7 @@ def install_updates():

if 'Successfully installed' in output:
available_updates[i]['status'] = 'success'
elif 'Installer failed with exit code: 3010' in output:
elif 'code: 3010' in output:
available_updates[i]['status'] = 'reboot_required'
else:
available_updates[i]['status'] = 'error'
Expand Down Expand Up @@ -533,12 +530,11 @@ def install_updates():


def reboot():
os.system('shutdown -r -t 0')
os.system('shutdown.exe -r -t 0')


def main():
global language, \
window, home_frame
global language, window, home_frame

windll = ctypes.windll.kernel32
language = locale.windows_locale[windll.GetUserDefaultUILanguage()]
Expand All @@ -556,12 +552,12 @@ def main():

title_label = ctk.CTkLabel(home_frame,
text=f'Software Updater {VERSION}',
font=('Calibri', 30))
font=('Segoe UI', 30))
title_label.pack()

start_button = ctk.CTkButton(home_frame,
text='Start',
font=('Calibri', 24),
font=('Segoe UI', 24),
command=check_system)
start_button.pack(anchor='se', pady=14)

Expand Down

0 comments on commit 8290a15

Please sign in to comment.