class to functions and check=True to subprocess.run

This commit is contained in:
Désiré Werner Menrath 2025-04-18 22:12:18 +02:00
parent 39550b392d
commit 28cc423138
3 changed files with 23 additions and 34 deletions

View File

@ -97,7 +97,7 @@ class Create:
process = subprocess.run( process = subprocess.run(
["pkexec", "/usr/local/bin/ssl_decrypt.py"], ["pkexec", "/usr/local/bin/ssl_decrypt.py"],
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
text=True, text=True, check=True
) )
# print(process.stdout) # print(process.stdout)
if process.returncode == 0: if process.returncode == 0:
@ -113,7 +113,7 @@ class Create:
process = subprocess.run( process = subprocess.run(
["pkexec", "/usr/local/bin/ssl_encrypt.py"], ["pkexec", "/usr/local/bin/ssl_encrypt.py"],
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
text=True, text=True, check=True
) )
print(process.stdout) print(process.stdout)
if process.returncode == 0: if process.returncode == 0:
@ -122,22 +122,18 @@ class Create:
print(f"Error with the following code... {process.returncode}") print(f"Error with the following code... {process.returncode}")
class UOS: def uos():
"""
The class is only for unixoidal systems "UOS" = UnixOS
""" """
@staticmethod uos = LOGIN USERNAME
def username():
""" This method displays the user name of the logged-in user,
This method displays the user name of the logged-in user, even if you are rooted in a shell
even if you are rooted in a shell """
""" logname = str(Path.home())[6:]
logname = str(Path.home())[6:] file = Path.home() / "/tmp/.loguser"
file = Path.home() / "/tmp/.loguser" with open(file, "w", encoding="utf-8") as f:
with open(file, "w", encoding="utf-8") as f: f.write(logname)
f.write(logname)
class GiteaUpdate: class GiteaUpdate:
@ -377,20 +373,13 @@ class Tunnel:
pass pass
class Tipi: def if_tip(path):
""" """
Class for Tooltip setting write in File method that writes in file whether tooltip is displayed or not
Calling request path to file
""" """
with open(path, "r", encoding="utf-8") as set_file2:
@staticmethod lines2 = set_file2.readlines()
def if_tip(path): if "False\n" in lines2:
""" return False
method that writes in file whether tooltip is displayed or not else:
""" return True
with open(path, "r", encoding="utf-8") as set_file2:
lines2 = set_file2.readlines()
if "False\n" in lines2:
return False
else:
return True

View File

@ -12,16 +12,16 @@ import tkinter as tk
from pathlib import Path from pathlib import Path
from subprocess import check_call from subprocess import check_call
from tkinter import filedialog, ttk, TclError from tkinter import filedialog, ttk, TclError
from cls_mth_fc import Tunnel, Create, msg_window, Tipi, GiteaUpdate, UOS from cls_mth_fc import Tunnel, Create, msg_window, if_tip, GiteaUpdate, uos
UOS.username() uos()
Create.dir_and_files() Create.dir_and_files()
Create.make_dir() Create.make_dir()
Create.decrypt() Create.decrypt()
tcl_path = Path("/usr/share/TK-Themes") tcl_path = Path("/usr/share/TK-Themes")
wg_set = Path(Path.home() / ".config/wire_py/settings") wg_set = Path(Path.home() / ".config/wire_py/settings")
wg_tips = Tipi.if_tip(wg_set) wg_tips = if_tip(wg_set)
dirname = Path("/tmp/tlecdcwg/") dirname = Path("/tmp/tlecdcwg/")
""" 1 = 1. Year, 09 = Month of the Year, 2924 = Day and Year of the Year """ """ 1 = 1. Year, 09 = Month of the Year, 2924 = Day and Year of the Year """