- Add Autoconnect settings to settings.conf

- Add run_as Bash script and open_gitea.py python script
- Add Tooltip disable/enable
- Rename settings to settings.conf for theme, updates and tooltip enable in one file
This commit is contained in:
Désiré Werner Menrath 2024-10-28 07:13:44 +01:00
parent 18e042400c
commit 9d44e7ab42
9 changed files with 211 additions and 122 deletions

View File

@ -4,10 +4,14 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="940e1630-c825-4d4c-be80-bc11f543c122" name="Changes" comment="- Optimize Class. Move to wg_main Import Start/StopBTN and Tooltip">
<list default="true" id="940e1630-c825-4d4c-be80-bc11f543c122" name="Changes" comment="- Optimize Class and Tooltip">
<change afterPath="$PROJECT_DIR$/run_as" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Changelog" beforeDir="false" afterPath="$PROJECT_DIR$/Changelog" afterDir="false" />
<change beforePath="$PROJECT_DIR$/testtheme.py" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/install" beforeDir="false" afterPath="$PROJECT_DIR$/install" afterDir="false" />
<change beforePath="$PROJECT_DIR$/settings" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/start_wg.py" beforeDir="false" afterPath="$PROJECT_DIR$/start_wg.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/theme" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/wg_func.py" beforeDir="false" afterPath="$PROJECT_DIR$/wg_func.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/wg_main.py" beforeDir="false" afterPath="$PROJECT_DIR$/wg_main.py" afterDir="false" />
</list>
@ -47,24 +51,25 @@
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"ASKED_ADD_EXTERNAL_FILES": "true",
"Python.INSTALL.executor": "Run",
"Python.install.executor": "Run",
"Python.main.executor": "Run",
"Python.messagebox.executor": "Run",
"Python.start_wg.executor": "Run",
"Python.testtheme.executor": "Run",
"Python.wg_func.executor": "Run",
"Python.wg_main.executor": "Run",
"RunOnceActivity.ShowReadmeOnStart": "true",
"Shell Script.install.executor": "Run",
"git-widget-placeholder": "main",
"last_opened_file_path": "/home/punix/Pyapps/wire-py",
"settings.editor.selected.configurable": "reference.settingsdialog.IDE.editor.colors"
<component name="PropertiesComponent">{
&quot;keyToString&quot;: {
&quot;ASKED_ADD_EXTERNAL_FILES&quot;: &quot;true&quot;,
&quot;Python.INSTALL.executor&quot;: &quot;Run&quot;,
&quot;Python.install.executor&quot;: &quot;Run&quot;,
&quot;Python.main.executor&quot;: &quot;Run&quot;,
&quot;Python.messagebox.executor&quot;: &quot;Run&quot;,
&quot;Python.start_wg.executor&quot;: &quot;Run&quot;,
&quot;Python.testtheme.executor&quot;: &quot;Run&quot;,
&quot;Python.wg_func.executor&quot;: &quot;Run&quot;,
&quot;Python.wg_main.executor&quot;: &quot;Run&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;Shell Script.install.executor&quot;: &quot;Run&quot;,
&quot;Shell Script.run_as.executor&quot;: &quot;Run&quot;,
&quot;git-widget-placeholder&quot;: &quot;main&quot;,
&quot;last_opened_file_path&quot;: &quot;/home/punix/Pyapps/wire-py&quot;,
&quot;settings.editor.selected.configurable&quot;: &quot;reference.settingsdialog.IDE.editor.colors&quot;
}
}]]></component>
}</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$" />
@ -143,14 +148,6 @@
<option name="presentableId" value="Default" />
<updated>1723279982210</updated>
</task>
<task id="LOCAL-00016" summary="fix label when laat Tunnel delete and fix Tuple error in delete and Start/Stop when listbox empty">
<option name="closed" value="true" />
<created>1724495688099</created>
<option name="number" value="00016" />
<option name="presentableId" value="LOCAL-00016" />
<option name="project" value="LOCAL" />
<updated>1724495688099</updated>
</task>
<task id="LOCAL-00017" summary="remove a ',' in DNS Name">
<option name="closed" value="true" />
<created>1724576599289</created>
@ -535,7 +532,15 @@
<option name="project" value="LOCAL" />
<updated>1729593628908</updated>
</task>
<option name="localTasksCounter" value="65" />
<task id="LOCAL-00065" summary="- Optimize Class and Tooltip">
<option name="closed" value="true" />
<created>1729938941026</created>
<option name="number" value="00065" />
<option name="presentableId" value="LOCAL-00065" />
<option name="project" value="LOCAL" />
<updated>1729938941027</updated>
</task>
<option name="localTasksCounter" value="66" />
<servers />
</component>
<component name="UnknownFeatures">
@ -576,7 +581,6 @@
</component>
<component name="VcsManagerConfiguration">
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
<MESSAGE value="fix set rights in install and a .conf a import Tunnel Filedialog Part 1 /home when open" />
<MESSAGE value="fix a filedialog for hidden Files work&#10;install rollback to bash for start wirepy and wirepy rollback to bash" />
<MESSAGE value="install rollback bash to py wirepy and wirepy rollback to py" />
<MESSAGE value="fix install and .desktop File Tar works now for user home and filebrowser.askfilebrowser start now in user home" />
@ -601,6 +605,18 @@
<MESSAGE value=" - Theme modify to water-theme&#10; - add ttk.Menubutton vor modern Menu and automatic theme and textvariable for color on font in menu" />
<MESSAGE value=" - Add Options, Help, Update Label and Update Menubutton &#10; - Theme now separate Light and Dark" />
<MESSAGE value="- Optimize Class. Move to wg_main Import Start/StopBTN and Tooltip" />
<option name="LAST_COMMIT_MESSAGE" value="- Optimize Class. Move to wg_main Import Start/StopBTN and Tooltip" />
<MESSAGE value="- Optimize Class and Tooltip" />
<option name="LAST_COMMIT_MESSAGE" value="- Optimize Class and Tooltip" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/start_wg.py</url>
<line>1</line>
<option name="timeStamp" value="2" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
</component>
</project>

View File

@ -4,12 +4,23 @@ My standard System: Linux Mint 22 Cinnamon
## [Unreleased]
- os import in wg_func replaced by other methods
- Guide to menu '?' with pictures
- In Gitea Readme enter text, images
- Own filedialog for import
- If Wire-Py already runs, prevent further start
- for loops with lists replaced by List Comprehensions
- Keeping Classes Together
- Update search after start of Wire-Py
### Added
27-10-2024
- Add Autoconnect settings to settings.conf
### Added
26-10-2024
- Add run_as Bash script and open_gitea.py python script
- Add Tooltip disable/enable
- Rename settings to settings.conf for theme, updates and tooltip enable in one file
### Added

16
install
View File

@ -7,8 +7,8 @@ BLUE='\033[30;1;34m'
install_file_with(){
clear
sudo apt install python3-tk && \
sudo cp -u wg_main.py start_wg.py wg_func.py wirepy.py /usr/bin/ && \
sudo mkdir -p /etc/wire_py && sudo touch /etc/wire_py/.keys && sudo cp -u settings theme /etc/wire_py/ && \
sudo cp -u wg_main.py start_wg.py wg_func.py wirepy.py run_as open_gitea.py /usr/bin/ && \
sudo mkdir -p /etc/wire_py && sudo touch /etc/wire_py/.keys && sudo cp -u settings.conf /etc/wire_py/ && \
sudo cp -uR wp-icons /usr/share/icons/ && sudo cp -uR TK-Themes /usr/share/ && \
sudo chown -R root:root /etc/wire_py && sudo chmod 755 /etc/wire_py && \
sudo ln -sf /usr/bin/wirepy.py /usr/local/bin/wirepy && \
@ -21,8 +21,8 @@ install_file_with(){
install_arch_d(){
clear
sudo pacman -S --noconfirm tk python3 python-requests && \
sudo cp -u wg_main.py start_wg.py wg_func.py wirepy.py /usr/bin/ && \
sudo mkdir -p /etc/wire_py && sudo touch /etc/wire_py/.keys && sudo cp -u settings theme /etc/wire_py/ && \
sudo cp -u wg_main.py start_wg.py wg_func.py wirepy.py run_as open_gitea.py /usr/bin/ && \
sudo mkdir -p /etc/wire_py && sudo touch /etc/wire_py/.keys && sudo cp -u settings.conf /etc/wire_py/ && \
sudo cp -uR wp-icons /usr/share/icons/ && sudo cp -uR TK-Themes /usr/share/ && \
sudo chown -R root:root /etc/wire_py && sudo chmod 755 /etc/wire_py && \
sudo ln -sf /usr/bin/wirepy.py /usr/local/bin/wirepy && \
@ -89,9 +89,9 @@ elif grep -i 'fedora' /etc/os-release > /dev/null 2>&1
if ! which python3-tkinter &> /dev/null
then sudo dnf install python3-tkinter -y
sudo cp -u wg_main.py start_wg.py wg_func.py wirepy.py /usr/bin/ && \
sudo cp -u wg_main.py start_wg.py wg_func.py wirepy.py run_as open_gitea.py /usr/bin/ && \
sudo mkdir -p /etc/wire_py && sudo touch /etc/wire_py/.keys && \
sudo cp -u settings theme /etc/wire_py/ && \
sudo cp -u settings.conf /etc/wire_py/ && \
sudo cp -uR wp-icons /usr/share/icons/ && sudo cp -uR TK-Themes /usr/share/ && \
sudo chown -R root:root /etc/wire_py && sudo chmod 755 /etc/wire_py && \
sudo ln -sf /usr/bin/wirepy.py /usr/local/bin/wirepy && \
@ -105,9 +105,9 @@ elif grep -i 'suse' /etc/os-release > /dev/null 2>&1
then
if ! which python311-tk &> /dev/null
then sudo zypper install python311-tk
sudo cp -u wg_main.py start_wg.py wg_func.py wirepy.py /usr/bin/ && \
sudo cp -u wg_main.py start_wg.py wg_func.py wirepy.py run_as open_gitea.py /usr/bin/ && \
sudo mkdir -p /etc/wire_py && sudo touch /etc/wire_py/.keys && \
sudo cp -u settings theme /etc/wire_py/ && \
sudo cp -u settings.conf /etc/wire_py/ && \
sudo cp -uR wp-icons /usr/share/icons/ && sudo cp -uR TK-Themes /usr/share/ && \
sudo chown -R root:root /etc/wire_py && sudo chmod 755 /etc/wire_py && \
sudo ln -sf /usr/bin/wirepy.py /usr/local/bin/wirepy && \

2
run_as Executable file
View File

@ -0,0 +1,2 @@
#!/bin/bash
/usr/bin/./open_gitea.py

View File

@ -1 +0,0 @@
Update on

View File

@ -2,11 +2,13 @@
from subprocess import check_call
from pathlib import Path
path_to_file = Path('/etc/wire_py/wg_py')
path_to_file = Path('/etc/wire_py/settings.conf')
if Path.exists(path_to_file):
a_con = Path.read_text(path_to_file)
check_call(['nmcli', 'connection', 'up', a_con])
else:
pass
with open(path_to_file, 'r') as a_con:
lines = a_con.readlines()
a_con = lines[7].strip()
if a_con != 'off':
check_call(['nmcli', 'connection', 'up', a_con])
else:
pass

1
theme
View File

@ -1 +0,0 @@
light

View File

@ -16,14 +16,11 @@ import requests
''' 1 = 1. Year, 09 = Month of the Year, 2924 = Day and Year of the Year '''
version = 'v. 1.10.2124'
path_to_file = Path('/etc/wire_py/wg_py')
path_to_file2 = Path('/etc/wire_py/settings')
path_to_file3 = Path('/etc/wire_py/theme')
path_to_file2 = Path('/etc/wire_py/settings.conf')
_u = Path.read_text(Path('/tmp/_u'))
UPDATE_API_URL = 'https://git.ilunix.de/api/v1/repos/punix/Wire-Py/releases'
tips = True
class WirePyUpdate:
@staticmethod
@ -34,7 +31,7 @@ class WirePyUpdate:
response_dict = response_dict[0]
with open(path_to_file2, 'r') as set_file:
set_file = set_file.read()
if 'Update on' in set_file:
if 'on\n' in set_file:
if version[3:] != response_dict['tag_name']:
return response_dict['tag_name']
else:
@ -78,7 +75,8 @@ class WirePyUpdate:
res = WirePyUpdate.api_down()
def msg_window(img_w, img_i, w_title, w_txt):
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.
To create messages with your own images, icons, and titles. As an alternative to Python Messagebox.
@ -95,13 +93,25 @@ def msg_window(img_w, img_i, w_title, w_txt):
msg.configure(pady=15, padx=15)
msg.img = tk.PhotoImage(file=img_w)
msg.i_window = tk.Label(msg, image=msg.img)
msg.i_window.grid(column=0, row=0)
label = tk.Label(msg, text=w_txt)
label.config(font=('Ubuntu', 11), padx=15)
label.grid(column=1, row=0)
button = ttk.Button(msg, text='OK', command=msg.destroy, padding=4)
button.config()
button.grid(column=0, columnspan=2, row=1)
if txt2 != None and com != None:
label.config(font=('Ubuntu', 11), padx=15, justify='left')
msg.i_window.grid(column=0, row=0, sticky='nw')
button2 = ttk.Button(msg, text=f'{txt2}', command=com, padding=4)
button2.grid(column=0, row=1, sticky='e', columnspan=2)
button = ttk.Button(msg, text='OK', command=msg.destroy, padding=4)
button.grid(column=0, row=1, sticky='w', columnspan=2)
else:
label.config(font=('Ubuntu', 11), padx=15)
msg.i_window.grid(column=0, row=0)
button = ttk.Button(msg, text='OK', command=msg.destroy, padding=4)
button.grid(column=0, columnspan=2, row=1)
img_i = tk.PhotoImage(file=img_i)
msg.iconphoto(True, img_i)
msg.columnconfigure(0, weight=1)
@ -128,8 +138,9 @@ class Tunnel:
self.add = None
def color(self):
with open(path_to_file3, 'r') as read_file:
if 'light' in read_file:
with open(path_to_file2, 'r') as read_file:
lines = read_file.readlines()
if 'light\n' in lines:
self.lb_tunnel = ttk.Label(self, textvariable=self.StrVar, foreground='green')
else:
@ -280,8 +291,7 @@ class Tunnel:
source = Path('/tmp/wire_py')
Path.unlink(Path(source) / 'wg_py', missing_ok=True)
Path.unlink(Path(source) / '.keys', missing_ok=True)
Path.unlink(Path(source) / 'settings', missing_ok=True)
Path.unlink(Path(source) / 'theme', missing_ok=True)
Path.unlink(Path(source) / 'settings.conf', missing_ok=True)
shutil.make_archive(wg_tar, 'zip', source)
shutil.chown(wg_tar + '.zip', 1000, 1000)
shutil.rmtree(source)
@ -316,6 +326,16 @@ class Tunnel:
except TypeError:
pass
@staticmethod
def if_tip():
with open(path_to_file2, 'r') as set_file2:
lines2 = set_file2.readlines()
if 'False\n' in lines2:
return False
else:
return True
tips = Tunnel.if_tip()
class FileHandle:
"""
@ -341,14 +361,23 @@ class FileHandle:
select_tl = self.l_box.get(select_tunnel[0])
if self.selected_option.get() == 0:
Path.unlink(path_to_file)
with open(path_to_file2, 'r') as set_file3:
lines3 = set_file3.readlines()
lines3[7] = 'off'
with open(path_to_file2, 'w') as set_file3:
set_file3.writelines(lines3)
tl = Tunnel.list()
if len(tl) == 0:
self.wg_autostart.configure(state='disabled')
if self.selected_option.get() >= 1:
Path.write_text(path_to_file, select_tl)
with open(path_to_file2, 'r') as set_file3:
lines3 = set_file3.readlines()
lines3[7] = select_tl
with open(path_to_file2, 'w') as set_file3:
set_file3.writelines(lines3)
except IndexError:
self.selected_option.set(1)
@ -373,13 +402,13 @@ class OnOff:
self.lb_frame_buttons = None
def on_off(self):
with open(path_to_file2, 'r') as set_file4:
lines4 = set_file4.readlines()
if Path.exists(path_to_file):
if lines4[7] != 'off':
self.selected_option.set(1)
self.autoconnect_var.set('')
if not Path.is_dir(Path('/etc/wire_py')):
Path.mkdir(Path('/etc/wire_py'))
self.auto_con = Path.read_text(path_to_file)
self.auto_con = lines4[7]
else:

View File

@ -8,8 +8,7 @@ from subprocess import check_call
from tkinter import *
from tkinter import filedialog, ttk
from wg_func import (Tunnel, FileHandle, OnOff, msg_window, WirePyUpdate, res, _u, version, path_to_file2,
path_to_file3, tips)
from wg_func import (Tunnel, FileHandle, OnOff, msg_window, WirePyUpdate, res, _u, version, path_to_file2, tips)
tcl_path = Path('/usr/share/TK-Themes')
@ -31,8 +30,9 @@ class MainWindow(tk.Tk):
self.style = ttk.Style(self)
self.tk.call('source', str(tcl_path) + '/water.tcl')
#self.tk.call('source', 'TK-Themes/water.tcl')
with open(path_to_file3, 'r') as read_file:
if 'light' in read_file:
with open(path_to_file2, 'r') as read_file:
lines = read_file.readlines()
if 'light\n' in lines:
self.tk.call('set_theme', 'light')
else:
self.tk.call('set_theme', 'dark')
@ -44,42 +44,77 @@ class MainWindow(tk.Tk):
self.iconphoto(True, self.wg_icon)
#Set on or off in file
def on_off():
if set_option.get() == 1:
def update():
if set_update.get() == 1:
with open(path_to_file2, 'r') as set_file2:
lines2 = set_file2.readlines()
lines2[1] = 'off\n'
with open(path_to_file2, 'w') as set_file2:
set_file2.write('Update off')
set_file2.writelines(lines2)
if set_option.get() == 0:
if set_update.get() == 0:
with open(path_to_file2, 'r') as set_file2:
lines2 = set_file2.readlines()
lines2[1] = 'on\n'
with open(path_to_file2, 'w') as set_file2:
set_file2.write('Update on')
set_file2.writelines(lines2)
#Set on or off in file
def tooltip():
if set_tip.get():
print(set_tip.get())
with open(path_to_file2, 'r') as set_file2:
lines2 = set_file2.readlines()
lines2[5] = 'False\n'
with open(path_to_file2, 'w') as set_file2:
set_file2.writelines(lines2)
else:
with open(path_to_file2, 'r') as set_file2:
lines2 = set_file2.readlines()
lines2[5] = 'True\n'
with open(path_to_file2, 'w') as set_file2:
set_file2.writelines(lines2)
# Set dark or light
def theme_change_light():
if self.tk.call("ttk::style", "theme", "use") == "water-dark":
# Set light theme
self.tk.call('set_theme', 'light')
with open(path_to_file3, 'w') as theme_set2:
theme_set2.write('light')
with open(path_to_file2, 'r') as theme_set2:
lines3 = theme_set2.readlines()
lines3[3] = 'light\n'
with open(path_to_file2, 'w') as theme_set2:
theme_set2.writelines(lines3)
def theme_change_dark():
if not self.tk.call("ttk::style", "theme", "use") == "water-dark":
# Set dark theme
self.tk.call('set_theme', 'dark')
with open(path_to_file3, 'w') as theme_set2:
theme_set2.write('dark')
with open(path_to_file2, 'r') as theme_set2:
lines4 = theme_set2.readlines()
lines4[3] = 'dark\n'
with open(path_to_file2, 'w') as theme_set2:
theme_set2.writelines(lines4)
def info():
"""img_w, img_i, w_title, w_txt hand over"""
def link_btn():
_u1 = str(_u[6:])
path_to_file = Path('/usr/bin/./run_as')
check_call(['su', _u1, path_to_file])
"""img_w, img_i, w_title, w_txt , txt2, com hand over"""
iw = r'/usr/share/icons/wp-icons/48/wg_vpn.png'
ii = r'/usr/share/icons/wp-icons/48/wg_msg.png'
wt = 'Instruction'
msg_t = ('Wire-Py: Wireguard Gui for Linux systems.\n\n'
wt = 'Info'
msg_t = ('Wire-Py a simple Wireguard Gui for Linux systems.\n\n'
'Wire-Py is open source software written in Python.\n\n'
'Email: polunga40@unity-mail.de also likes for donation.\n\n'
'https://git.ilunix.de/punix/Wire-P\n\n'
'Use without warranty!\n')
txt2 = 'Go to Wire-Py git'
com = link_btn
msg_window(iw, ii, wt, msg_t)
msg_window(iw, ii, wt, msg_t, txt2, com)
''' Frame for Menu '''
self.menu_frame = ttk.Frame(self)
@ -119,39 +154,34 @@ class MainWindow(tk.Tk):
self.options_btn.bind('<Enter>', sets_enter)
self.options_btn.bind('<Leave>', sets_leave)
set_option = tk.IntVar()
self.settings = tk.Menu(self)
set_update = tk.IntVar()
set_tip = tk.BooleanVar()
self.settings = tk.Menu(self, relief='flat')
self.options_btn.configure(menu=self.settings, style='Toolbutton')
self.settings.add_checkbutton(label='Disable updates', command=on_off, variable=set_option)
self.settings.add_checkbutton(label='Disable Updates', command=update, variable=set_update)
self.settings.add_checkbutton(label='Disable Tooltips', command=tooltip, variable=set_tip)
self.settings.add_command(label='Light', command=theme_change_light)
self.settings.add_command(label='Dark', command=theme_change_dark)
''' About BTN Menu / Label '''
self.about_btn = ttk.Menubutton(self.menu_frame, text='About')
self.about_btn = ttk.Button(self.menu_frame, text='About', style='Toolbutton', command=info)
self.about_btn.grid(column=2, row=0)
def about_enter(event):
""" The mouse moves into the entry widget """
window.my_tool_tip = MyToolTip(event.x_root, event.y_root, 'Click for Info')
def about_leave(_):
""" The mouse moves from the entry widget """
''' Remove Tool-Tip '''
window.my_tool_tip.destroy()
self.about_btn.bind('<Enter>', about_enter)
self.about_btn.bind('<Leave>', about_leave)
self.readme = tk.Menu(self)
self.about_btn.configure(menu=self.readme, style='Toolbutton')
self.readme.add_command(label='Info', command=info)
''' Update Label '''
''' Update and Tooltip Label '''
self.updates_lb = ttk.Label(self.menu_frame)
self.updates_lb.grid(column=3, row=0, padx=10)
'''View Checkbox for enable or disable Tooltip '''
if tips:
set_tip.set(value=False)
else:
set_tip.set(value=True)
'''View Checkbox for enable or disable Updates '''
if res == 'False':
set_option.set(value=1)
set_update.set(value=1)
self.updates_lb.configure(text='Update search off')
def disable_enter(event):
@ -183,11 +213,10 @@ class MainWindow(tk.Tk):
self.updates_lb.bind('<Enter>', congratulations_enter)
self.updates_lb.bind('<Leave>', congratulations_leave)
else:
set_option.set(value=0)
set_update.set(value=0)
text = f'Update {res} available!'
''' Update BTN Menu'''
self.update_btn = ttk.Menubutton(self.menu_frame, text=text)
self.update_btn.grid(column=4, row=0, padx=0)
@ -204,7 +233,7 @@ class MainWindow(tk.Tk):
self.update_btn.bind('<Enter>', download_enter)
self.update_btn.bind('<Leave>', download_leave)
self.download = tk.Menu(self)
self.download = tk.Menu(self, relief='flat')
self.update_btn.configure(menu=self.download, style='Toolbutton')
self.download.add_command(label='Download', command=WirePyUpdate.download)
@ -631,14 +660,15 @@ class FrameWidgets(ttk.Frame):
pre_key = key[3]
check_call(['nmcli', 'connection', 'delete', select_tl])
self.l_box.delete(self.select_tunnel[0])
if Path.is_file(Path('/etc/wire_py/wg_py')):
path_to_file = Path('/etc/wire_py') / 'wg_py'
a_con = Path.read_text(path_to_file)
if select_tl == a_con:
with open(path_to_file2, 'r') as set_file6:
lines6 = set_file6.readlines()
if select_tl == lines6[7].strip() and not 'off' in lines6[7].strip():
lines6[7] = 'off'
with open(path_to_file2, 'w') as set_file7:
set_file7.writelines(lines6)
self.selected_option.set(0)
self.autoconnect_var.set('no Autoconnect')
Path.unlink(path_to_file)
Path.unlink(Path('/etc/wire_py') / str(select_tl + '.conf'))
with open('/etc/wire_py/.keys', 'r') as readfile:
with open('/etc/wire_py/.keys2', 'w') as writefile:
@ -853,12 +883,13 @@ class FrameWidgets(ttk.Frame):
if self.a != '' and self.a == select_tl:
self.a = Tunnel.active()
self.StrVar.set(value=self.a)
if Path.is_file(Path('/etc/wire_py/wg_py')):
path_to_file = Path('/etc/wire_py') / 'wg_py'
a_con = Path.read_text(path_to_file)
if select_tl == a_con:
with open(path_to_file2, 'r') as set_file5:
lines5 = set_file5.readlines()
if select_tl == lines5[7].strip() and not 'off' in lines5[7].strip():
lines5[7] = new_a_connect
with open(path_to_file2, 'w') as theme_set5:
theme_set5.writelines(lines5)
self.autoconnect_var.set(value=new_a_connect)
Path.write_text(path_to_file, new_a_connect)
return select_tl