wire-py-reformat-14-09-2024 #14

Merged
punix merged 5 commits from wire-py-reformat-14-09-2024 into main 2024-09-14 23:31:00 +02:00
3 changed files with 27 additions and 21 deletions
Showing only changes of commit 858e9f07fe - Show all commits

View File

@ -4,7 +4,11 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="940e1630-c825-4d4c-be80-bc11f543c122" name="Changes" comment="add Frame widget 3&#10;for Buttons and Listbox with Scrollbar.&#10;all Widgets new format&#10;delete works now of disable checkbox when Listbox empty (part two)" />
<list default="true" id="940e1630-c825-4d4c-be80-bc11f543c122" name="Changes" comment="add Options in">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/wg_func.py" beforeDir="false" afterPath="$PROJECT_DIR$/wg_func.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />

32
main.py
View File

@ -47,6 +47,7 @@ class FrameWidgets(ttk.Frame):
def __init__(self, container, **kwargs):
super().__init__(container, **kwargs)
self.auto_con = None
self.enp = None
self.DNS = None
self.add = None
@ -64,23 +65,24 @@ class FrameWidgets(ttk.Frame):
# Show active Tunnel
self.a = TunnelActiv.active()
# Label Frame 1
self.lb_frame_btn_lbox = ttk.Frame(self)
self.lb_frame_btn_lbox.configure(relief='flat')
self.lb_frame_btn_lbox.grid(column=0, rowspan=4, row=0)
self.columnconfigure(0, weight=1)
self.rowconfigure(0, weight=1)
# Label Frame 2
self.lb_frame = ttk.Frame(self)
self.lb_frame.configure(relief='solid')
self.lb_frame.grid(column=2, row=1, sticky='snew', padx=20, pady=5)
self.columnconfigure(2, weight=1)
self.rowconfigure(1, weight=1)
# Label Frame 2
# Label Frame 3
self.lb_frame2 = ttk.Frame(self)
self.lb_frame2.configure(relief='solid')
self.lb_frame2.grid(column=2, row=2, sticky='snew', padx=20, pady=5)
self.columnconfigure(2, weight=1)
self.rowconfigure(2, weight=1)
# Label Frame 3
self.lb_frame_buttons = ttk.Frame(self)
self.lb_frame_buttons.configure(relief='flat')
self.lb_frame_buttons.grid(column=0, rowspan=4, row=0)
self.columnconfigure(0, weight=1)
self.rowconfigure(0, weight=1)
# Show active Label
self.select_tunnel = None
self.lb = tk.Label(self, text='Active: ')
@ -108,13 +110,13 @@ class FrameWidgets(ttk.Frame):
if len(tl) != 0:
self.wg_autostart.configure(state='normal')
self.l_box = tk.Listbox(self.lb_frame_buttons, fg='#606060', selectmode='single')
self.l_box = tk.Listbox(self.lb_frame_btn_lbox, fg='#606060', selectmode='single')
self.l_box.config(highlightthickness=0, relief='ridge')
self.l_box.config(font=('Ubuntu', 12, 'bold'))
self.l_box.grid(column=1, rowspan=4, row=0, sticky='ns')
self.l_box.event_add('<<ClickEvent>>', '<Button-1>')
self.l_box.bind('<<ClickEvent>>', enable_check_box)
self.scrollbar = ttk.Scrollbar(self.lb_frame_buttons, orient='vertical', command=self.l_box.yview)
self.scrollbar = ttk.Scrollbar(self.lb_frame_btn_lbox, orient='vertical', command=self.l_box.yview)
self.scrollbar.grid(column=1, rowspan=4, row=0, sticky='nse')
self.l_box.configure(yscrollcommand=self.scrollbar.set)
self.rowconfigure(0, weight=1)
@ -143,7 +145,7 @@ class FrameWidgets(ttk.Frame):
ShowAddress.label_empty(self)
ShowAddress.show_data(self)
# Button Import
self.btn_i = tk.Button(self.lb_frame_buttons,
self.btn_i = tk.Button(self.lb_frame_btn_lbox,
image=self.imp_pic, bd=0,
command=lambda: ImportTunnel.wg_import_select(self))
self.btn_i.grid(column=0, row=1, padx=15, pady=8)
@ -190,11 +192,11 @@ class FrameWidgets(ttk.Frame):
pass
# Button Trash
self.btn_tr = tk.Button(self.lb_frame_buttons, image=self.tr_pic, bd=0, command=delete)
self.btn_tr = tk.Button(self.lb_frame_btn_lbox, image=self.tr_pic, bd=0, command=delete)
self.btn_tr.grid(column=0, row=2, padx=15, pady=8)
# Button Export
self.btn_exp = tk.Button(self.lb_frame_buttons, image=self.exp_pic, bd=0, command=ExportTunnels.wg_export)
self.btn_exp = tk.Button(self.lb_frame_btn_lbox, image=self.exp_pic, bd=0, command=ExportTunnels.wg_export)
self.btn_exp.grid(column=0, row=3, padx=15, pady=8)
# Button Rename
@ -203,7 +205,11 @@ class FrameWidgets(ttk.Frame):
# Check Buttons
self.selected_option = tk.IntVar()
self.autoconnect_var = tk.StringVar()
self.autoconnect_var.set(self.auto_con)
self.autoconnect = tk.Label(self, textvariable=self.autoconnect_var, fg='blue', padx=5)
self.autoconnect.config(font=('Ubuntu', 11))
self.autoconnect.grid(column=0, row=4, sticky='ne', pady=20)
self.wg_autostart = tk.Checkbutton(self,
text='Autoconnect on:',
variable=self.selected_option,

View File

@ -49,23 +49,19 @@ class GreenLabel(tk.Tk):
class StartStopBTN(tk.Tk):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.lb_frame_buttons = None
self.lb_frame_btn_lbox = None
self.wg_switch = None
self.btn_stst = None
self.wg_vpn_start = tk.PhotoImage(file=r'icons/wg-vpn-start-48.png')
self.wg_vpn_stop = tk.PhotoImage(file=r'icons/wg-vpn-stop-48.png')
def button_stop(self):
self.btn_stst = tk.Button(self.lb_frame_buttons, image=self.wg_vpn_stop, bd=0, command=self.wg_switch)
self.btn_stst = tk.Button(self.lb_frame_btn_lbox, image=self.wg_vpn_stop, bd=0, command=self.wg_switch)
self.btn_stst.grid(column=0, row=0, padx=15, pady=8)
#self.columnconfigure(0, weight=1)
#self.rowconfigure(0, weight=1)
def button_start(self):
self.btn_stst = tk.Button(self.lb_frame_buttons, image=self.wg_vpn_start, bd=0, command=self.wg_switch)
self.btn_stst = tk.Button(self.lb_frame_btn_lbox, image=self.wg_vpn_start, bd=0, command=self.wg_switch)
self.btn_stst.grid(column=0, row=0, padx=15, pady=8)
#self.columnconfigure(0, weight=1)
#self.rowconfigure(0, weight=1)
class ConToDict: