- Preparation for language translation part 1

- separate folder for general icons
- install edit for new dir lx-icons
This commit is contained in:
Désiré Werner Menrath 2024-11-09 19:01:53 +01:00
parent e9814f2b60
commit 10c3b07053

View File

@ -1,16 +1,14 @@
""" Wireguard Classes and Method for Wire-Py """ """ Wireguard Classes and Method for Wire-Py """
import gettext
import locale
import os import os
import shutil import shutil
import subprocess import subprocess
import time
import tkinter as tk import tkinter as tk
import zipfile import zipfile
import gettext
import locale
from datetime import datetime from datetime import datetime
from pathlib import Path from pathlib import Path
from subprocess import check_call
from tkinter import ttk from tkinter import ttk
import requests import requests
@ -27,12 +25,11 @@ path_to_file2 = Path('/etc/wire_py/settings.conf')
_u = Path.read_text(Path('/tmp/_u')) _u = Path.read_text(Path('/tmp/_u'))
class GiteaUpdate: class GiteaUpdate:
@staticmethod @staticmethod
def api_down(UPDATE_API_URL): def api_down(update_api_url):
try: try:
response = requests.get(UPDATE_API_URL) response = requests.get(update_api_url)
response_dict = response.json() response_dict = response.json()
response_dict = response_dict[0] response_dict = response_dict[0]
with open(path_to_file2, 'r') as set_file: with open(path_to_file2, 'r') as set_file:
@ -48,9 +45,9 @@ class GiteaUpdate:
return 'No Internet Connection!' return 'No Internet Connection!'
@staticmethod @staticmethod
def download(URLD): def download(urld):
try: try:
to_down = 'wget -qP ' + str(_u) + ' ' + URLD to_down = 'wget -qP ' + str(_u) + ' ' + urld
result = subprocess.call(to_down, shell=True) result = subprocess.call(to_down, shell=True)
if result == 0: if result == 0:
shutil.chown(str(_u) + f'/{res}.zip', 1000, 1000) shutil.chown(str(_u) + f'/{res}.zip', 1000, 1000)
@ -80,7 +77,6 @@ class GiteaUpdate:
res = GiteaUpdate.api_down('https://git.ilunix.de/api/v1/repos/punix/Wire-Py/releases') res = GiteaUpdate.api_down('https://git.ilunix.de/api/v1/repos/punix/Wire-Py/releases')
def msg_window(img_w, img_i, w_title, w_txt, txt2=None, com=None): def msg_window(img_w, img_i, w_title, w_txt, txt2=None, com=None):
""" """
Function for different message windows for the user. with 4 arguments to be passed. Function for different message windows for the user. with 4 arguments to be passed.
@ -103,7 +99,7 @@ def msg_window(img_w, img_i, w_title, w_txt, txt2=None, com=None):
label.grid(column=1, row=0) label.grid(column=1, row=0)
if txt2 != None and com != None: if txt2 is not None and com is not None:
label.config(font=('Ubuntu', 11), padx=15, justify='left') label.config(font=('Ubuntu', 11), padx=15, justify='left')
msg.i_window.grid(column=0, row=0, sticky='nw') msg.i_window.grid(column=0, row=0, sticky='nw')
button2 = ttk.Button(msg, text=f'{txt2}', command=com, padding=4) button2 = ttk.Button(msg, text=f'{txt2}', command=com, padding=4)
@ -125,7 +121,6 @@ def msg_window(img_w, img_i, w_title, w_txt, txt2=None, com=None):
class Tunnel: class Tunnel:
""" """
Class of Methods for Wire-Py Class of Methods for Wire-Py
""" """
@ -176,7 +171,6 @@ class Tunnel:
pre_key = final_dict['PreSharedKey'] pre_key = final_dict['PreSharedKey']
return address, dns, endpoint, pre_key return address, dns, endpoint, pre_key
""" """
Shows the Active Tunnel Shows the Active Tunnel
""" """
@ -204,7 +198,6 @@ class Tunnel:
tl = wg_s[::3] tl = wg_s[::3]
return tl return tl
""" """
This will export the tunnels. This will export the tunnels.
A zipfile with current date and time is created A zipfile with current date and time is created
@ -269,4 +262,5 @@ class Tunnel:
else: else:
return True return True
tips = Tunnel.if_tip() tips = Tunnel.if_tip()