little fixes a labels when stop and start, installer first functions works

This commit is contained in:
2024-09-10 20:06:33 +02:00
parent 35406026f0
commit 8fa6e6374f
5 changed files with 66 additions and 21 deletions

View File

@ -186,19 +186,23 @@ class ImportTunnel(tk.Tk):
file.close()
path_split = filepath.split('/')
path_split1 = path_split[-1]
self.a = TunnelActiv.active()
if 'PrivateKey = ' in read and 'PublicKey = ' in read:
if len(path_split1) > 17:
p1 = shutil.copy(filepath, home / 'tester/')
path_split = path_split1[len(path_split1) - 17:]
os.rename(p1, home / 'tester/' / str(path_split))
if self.a != '':
check_call(['nmcli', 'connection', 'down', TunnelActiv.active()])
ShowAddress.label_empty(self)
check_call(['nmcli', 'connection', 'import', 'type', 'wireguard', 'file', home / 'tester' /
path_split])
else:
shutil.copy(filepath, home / 'tester/')
if self.a != '':
check_call(['nmcli', 'connection', 'down', TunnelActiv.active()])
ShowAddress.label_empty(self)
check_call(['nmcli', 'connection', 'import', 'type', 'wireguard', 'file', filepath])
self.StrVar.set('')
@ -248,6 +252,9 @@ class FileHandle:
off = open(path_to_file, 'w')
off.write('false ' + '\n')
off.close()
tl = ListTunnels.tl_list()
if len(tl) == 0:
self.wg_autostart.configure(state='disabled')
if self.selected_option.get() >= 1:
set_on = open(path_to_file, 'w')
set_on.write('true ' + select_tl)