diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index cf6dd78..58d9c5d 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,11 +4,11 @@
-
-
+
+
@@ -260,7 +260,15 @@
1725119445803
-
+
+
+ 1725391658456
+
+
+
+ 1725391658456
+
+
@@ -308,6 +316,7 @@
-
+
+
\ No newline at end of file
diff --git a/main.py b/main.py
index 44b7f5a..a7dbdf5 100755
--- a/main.py
+++ b/main.py
@@ -180,6 +180,8 @@ class FrameWidgets(ttk.Frame):
text='Autoconnect on:',
variable=self.selected_option,
command=lambda: FileHandle.box_set(self))
+ self.wg_autostart.grid(column=1, row=4, sticky='nw')
+
on_or_off = open('wg_py.xml', 'r')
res = on_or_off.read()
if 'true' in res:
@@ -192,8 +194,6 @@ class FrameWidgets(ttk.Frame):
self.auto_con = 'no Autoconnect'
on_or_off.close()
- self.wg_autostart.grid(column=1, row=4, sticky='nw')
-
self.autoconnect_var = tk.StringVar()
self.autoconnect_var.set(self.auto_con)
self.autoconnect = tk.Label(self, textvariable=self.autoconnect_var, bd=2, fg='blue', padx=5)
diff --git a/wg_func.py b/wg_func.py
index c4293a5..a5dfd41 100755
--- a/wg_func.py
+++ b/wg_func.py
@@ -233,6 +233,8 @@ class FileHandle:
def __init__(self):
+ self.wg_autostart = None
+ self.autoconnect = None
self.auto_con = None
self.autoconnect_var = None
self.tl = None
@@ -257,7 +259,6 @@ class FileHandle:
os.system('nmcli con mod ' + str(tl) + ' connection.autoconnect no')
replacement = replacement + changes + "\n"
set_on.close()
- self.autoconnect_var.set('')
if self.selected_option.get() == 1:
set_on = open('wg_py.xml', 'r')
replacement = ""
@@ -271,10 +272,27 @@ class FileHandle:
set_off = open('wg_py.xml', 'w')
set_off.write(replacement)
set_off.close()
- self.autoconnect_var.set(self.auto_con)
except IndexError:
self.selected_option.set(1)
+ on_or_off = open('wg_py.xml', 'r')
+ res = on_or_off.read()
+ if 'true' in res:
+ self.selected_option.set(1)
+ self.auto_con = res
+ self.auto_con = self.auto_con[5:]
+ print(self.auto_con)
+ else:
+ self.wg_autostart.configure(state='disabled')
+ self.auto_con = 'no Autoconnect'
+ on_or_off.close()
+
+ self.autoconnect_var = tk.StringVar()
+ self.autoconnect_var.set(self.auto_con)
+ self.autoconnect = tk.Label(self, textvariable=self.autoconnect_var, bd=2, fg='blue', padx=5)
+ self.autoconnect.config(font=('Ubuntu', 11))
+ self.autoconnect.grid(column=1, row=4, sticky='we')
+
class ExportTunnels:
@staticmethod
diff --git a/wg_py.xml b/wg_py.xml
index 4cd957e..1162854 100644
--- a/wg_py.xml
+++ b/wg_py.xml
@@ -1 +1 @@
-true iphone-wg
+false iphone-wg