wire-py-reformat-14-08-2024 #10

Merged
punix merged 4 commits from wire-py-reformat-14-08-2024 into main 2024-09-04 06:26:31 +02:00
3 changed files with 40 additions and 17 deletions
Showing only changes of commit e5d86f1f90 - Show all commits

View File

@ -4,8 +4,9 @@
<option name="autoReloadType" value="SELECTIVE" /> <option name="autoReloadType" value="SELECTIVE" />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="940e1630-c825-4d4c-be80-bc11f543c122" name="Changes" comment="add export Tunnel as zip"> <list default="true" id="940e1630-c825-4d4c-be80-bc11f543c122" name="Changes" comment="import datetime for datetime in zip_name a export Tunnel">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <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" /> <change beforePath="$PROJECT_DIR$/wg_func.py" beforeDir="false" afterPath="$PROJECT_DIR$/wg_func.py" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
@ -40,16 +41,16 @@
<option name="hideEmptyMiddlePackages" value="true" /> <option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" /> <option name="showLibraryContents" value="true" />
</component> </component>
<component name="PropertiesComponent"><![CDATA[{ <component name="PropertiesComponent">{
"keyToString": { &quot;keyToString&quot;: {
"ASKED_ADD_EXTERNAL_FILES": "true", &quot;ASKED_ADD_EXTERNAL_FILES&quot;: &quot;true&quot;,
"Python.main.executor": "Run", &quot;Python.main.executor&quot;: &quot;Run&quot;,
"RunOnceActivity.ShowReadmeOnStart": "true", &quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
"git-widget-placeholder": "main", &quot;git-widget-placeholder&quot;: &quot;main&quot;,
"last_opened_file_path": "/home/punix/Pyapps/wire-py", &quot;last_opened_file_path&quot;: &quot;/home/punix/Pyapps/wire-py&quot;,
"settings.editor.selected.configurable": "preferences.lookFeel" &quot;settings.editor.selected.configurable&quot;: &quot;preferences.lookFeel&quot;
} }
}]]></component> }</component>
<component name="RunManager"> <component name="RunManager">
<configuration name="main" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true"> <configuration name="main" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true">
<module name="wire-py" /> <module name="wire-py" />

28
main.py
View File

@ -23,7 +23,7 @@ class MainWindow(tk.Tk):
self.title('Wire-Py') self.title('Wire-Py')
self.configure() self.configure()
self.geometry('%dx%d+%d+%d' % (self.x_width, self.y_height, self.monitor_center_x, self.monitor_center_y)) self.geometry('%dx%d+%d+%d' % (self.x_width, self.y_height, self.monitor_center_x, self.monitor_center_y))
self.columnconfigure(2, weight=1) self.columnconfigure(0, weight=1)
self.rowconfigure(0, weight=1) self.rowconfigure(0, weight=1)
self.style = ttk.Style(self) self.style = ttk.Style(self)
self.style.theme_use('clam') self.style.theme_use('clam')
@ -60,19 +60,21 @@ class FrameWidgets(ttk.Frame):
self.lb_frame = ttk.Frame(self) self.lb_frame = ttk.Frame(self)
self.lb_frame.configure(relief='solid') self.lb_frame.configure(relief='solid')
self.lb_frame.grid(column=2, row=2, sticky='snew', padx=20, pady=5) self.lb_frame.grid(column=2, row=2, sticky='snew', padx=20, pady=5)
self.columnconfigure(0, weight=1) self.columnconfigure(2, weight=1)
self.rowconfigure(0, weight=1) self.rowconfigure(2, weight=1)
# Label Frame 2 # Label Frame 2
self.lb_frame2 = ttk.Frame(self) self.lb_frame2 = ttk.Frame(self)
self.lb_frame2.configure(relief='solid') self.lb_frame2.configure(relief='solid')
self.lb_frame2.grid(column=2, row=3, sticky='snew', padx=20, pady=5) self.lb_frame2.grid(column=2, row=3, sticky='snew', padx=20, pady=5)
self.columnconfigure(0, weight=1) self.columnconfigure(2, weight=1)
self.rowconfigure(0, weight=1) self.rowconfigure(3, weight=1)
# Show active Label # Show active Label
self.select_tunnel = None self.select_tunnel = None
self.lb = tk.Label(self, text='Active: ') self.lb = tk.Label(self, text='Active: ')
self.lb.config(font=("Ubuntu", 11, "bold")) self.lb.config(font=("Ubuntu", 11, "bold"))
self.lb.grid(column=2, row=1, padx=15, sticky="w") self.lb.grid(column=2, row=1, padx=15, sticky="w")
self.columnconfigure(2, weight=1)
self.rowconfigure(1, weight=1)
# Label to Show active Tunnel # Label to Show active Tunnel
self.StrVar = tk.StringVar(value=self.a) self.StrVar = tk.StringVar(value=self.a)
GreenLabel.green_show_label(self) GreenLabel.green_show_label(self)
@ -80,10 +82,14 @@ class FrameWidgets(ttk.Frame):
self.interface = tk.Label(self.lb_frame, text='Interface', fg=fontcolor) self.interface = tk.Label(self.lb_frame, text='Interface', fg=fontcolor)
self.interface.grid(column=0, row=4, sticky="we", padx=120) self.interface.grid(column=0, row=4, sticky="we", padx=120)
self.interface.config(font=("Ubuntu", 9)) self.interface.config(font=("Ubuntu", 9))
self.columnconfigure(0, weight=1)
self.rowconfigure(4, weight=1)
# Peer Label # Peer Label
self.peer = tk.Label(self.lb_frame2, text='Peer', fg=fontcolor) self.peer = tk.Label(self.lb_frame2, text='Peer', fg=fontcolor)
self.peer.config(font=("Ubuntu", 9)) self.peer.config(font=("Ubuntu", 9))
self.peer.grid(column=0, row=7, sticky="we", padx=130) self.peer.grid(column=0, row=7, sticky="we", padx=130)
self.columnconfigure(0, weight=1)
self.rowconfigure(7, weight=1)
# Listbox with Scrollbar # Listbox with Scrollbar
self.scrollbar = ttk.Scrollbar(self) self.scrollbar = ttk.Scrollbar(self)
self.l_box = tk.Listbox(self, fg='#606060', selectmode='single') self.l_box = tk.Listbox(self, fg='#606060', selectmode='single')
@ -91,6 +97,8 @@ class FrameWidgets(ttk.Frame):
self.scrollbar.config(command=self.l_box.yview) self.scrollbar.config(command=self.l_box.yview)
self.l_box.config(font=("Ubuntu", 12, "bold")) self.l_box.config(font=("Ubuntu", 12, "bold"))
self.l_box.grid(column=1, rowspan=3, row=1) self.l_box.grid(column=1, rowspan=3, row=1)
self.columnconfigure(1, weight=1)
self.rowconfigure(1, weight=1)
# Tunnel List # Tunnel List
self.tl = ListTunnels.tl_list() self.tl = ListTunnels.tl_list()
for tunnels in self.tl: for tunnels in self.tl:
@ -117,6 +125,8 @@ class FrameWidgets(ttk.Frame):
# Button Import # Button Import
self.btn_i = tk.Button(self, image=self.imp_pic, bd=0, command=lambda: ImportTunnel.wg_import_select(self)) self.btn_i = tk.Button(self, image=self.imp_pic, bd=0, command=lambda: ImportTunnel.wg_import_select(self))
self.btn_i.grid(column=0, row=2, padx=15, pady=15) self.btn_i.grid(column=0, row=2, padx=15, pady=15)
self.columnconfigure(0, weight=1)
self.rowconfigure(2, weight=1)
def delete(): def delete():
try: try:
@ -137,14 +147,22 @@ class FrameWidgets(ttk.Frame):
# Button Trash # Button Trash
self.btn_tr = tk.Button(self, image=self.tr_pic, bd=0, command=delete) self.btn_tr = tk.Button(self, image=self.tr_pic, bd=0, command=delete)
self.btn_tr.grid(column=0, row=3, padx=15, pady=15) self.btn_tr.grid(column=0, row=3, padx=15, pady=15)
self.columnconfigure(0, weight=1)
self.rowconfigure(3, weight=1)
# Button Export # Button Export
self.btn_exp = tk.Button(self, image=self.exp_pic, bd=0, command=ExportTunnels.wg_export) self.btn_exp = tk.Button(self, image=self.exp_pic, bd=0, command=ExportTunnels.wg_export)
self.btn_exp.grid(column=0, row=4, padx=15, pady=15) self.btn_exp.grid(column=0, row=4, padx=15, pady=15)
self.columnconfigure(0, weight=1)
self.rowconfigure(4, weight=1)
# Check Buttons # Check Buttons
self.wg_autostart = tk.Checkbutton(self, text='Autoconnect on PC Start') self.wg_autostart = tk.Checkbutton(self, text='Autoconnect on PC Start')
self.wg_autostart.grid(column=1, rowspan=3, row=3) self.wg_autostart.grid(column=1, rowspan=3, row=3)
self.columnconfigure(1, weight=1)
self.rowconfigure(3, weight=1)
self.wg_update = tk.Checkbutton(self, text='Search automatically for\nWire-Py updates') self.wg_update = tk.Checkbutton(self, text='Search automatically for\nWire-Py updates')
self.wg_update.grid(column=1, rowspan=3, row=4) self.wg_update.grid(column=1, rowspan=3, row=4)
self.columnconfigure(1, weight=1)
self.rowconfigure(4, weight=1)
def wg_switch(self): def wg_switch(self):
self.a = TunnelActiv.active() self.a = TunnelActiv.active()

View File

@ -42,6 +42,8 @@ class GreenLabel(tk.Tk):
self.lb_tunnel = tk.Label(self, textvariable=self.StrVar, fg='green') self.lb_tunnel = tk.Label(self, textvariable=self.StrVar, fg='green')
self.lb_tunnel.config(font=("Ubuntu", 11, "bold")) self.lb_tunnel.config(font=("Ubuntu", 11, "bold"))
self.lb_tunnel.grid(column=2, padx=10, row=1) self.lb_tunnel.grid(column=2, padx=10, row=1)
self.columnconfigure(2, weight=1)
self.rowconfigure(1, weight=1)
class StartStopBTN(tk.Tk): class StartStopBTN(tk.Tk):
@ -55,12 +57,14 @@ class StartStopBTN(tk.Tk):
def button_stop(self): def button_stop(self):
self.btn_stst = tk.Button(self, image=self.wg_vpn_stop, bd=0, command=self.wg_switch) self.btn_stst = tk.Button(self, image=self.wg_vpn_stop, bd=0, command=self.wg_switch)
self.btn_stst.grid(column=0, row=1, padx=15, pady=10, sticky="s") self.btn_stst.grid(column=0, row=1, padx=15, pady=10, sticky="s")
self.rowconfigure(0, weight=1) self.columnconfigure(0, weight=1)
self.rowconfigure(1, weight=1)
def button_start(self): def button_start(self):
self.btn_stst = tk.Button(self, image=self.wg_vpn_start, bd=0, command=self.wg_switch) self.btn_stst = tk.Button(self, image=self.wg_vpn_start, bd=0, command=self.wg_switch)
self.btn_stst.grid(column=0, row=1, padx=15, pady=10, sticky="s") self.btn_stst.grid(column=0, row=1, padx=15, pady=10, sticky="s")
self.rowconfigure(0, weight=1) self.columnconfigure(0, weight=1)
self.rowconfigure(1, weight=1)
class ConToDict: class ConToDict: