add rename Label rename works
This commit is contained in:
parent
217a73182a
commit
53f1d4e8f4
@ -4,9 +4,10 @@
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="940e1630-c825-4d4c-be80-bc11f543c122" name="Changes" comment="Create your own message boxes for export">
|
||||
<list default="true" id="940e1630-c825-4d4c-be80-bc11f543c122" name="Changes" comment="chown Export File to 1000:1000">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="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>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@ -469,7 +470,15 @@
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1726841190285</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="43" />
|
||||
<task id="LOCAL-00043" summary="chown Export File to 1000:1000">
|
||||
<option name="closed" value="true" />
|
||||
<created>1726860371820</created>
|
||||
<option name="number" value="00043" />
|
||||
<option name="presentableId" value="LOCAL-00043" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1726860371820</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="44" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="UnknownFeatures">
|
||||
@ -510,7 +519,6 @@
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
|
||||
<MESSAGE value="remove a ',' in DNS Name" />
|
||||
<MESSAGE value="fix when Filname > 17 first copy file after rename" />
|
||||
<MESSAGE value="add export Tunnel as zip" />
|
||||
<MESSAGE value="columnconfigure on all widgets set" />
|
||||
@ -535,6 +543,7 @@
|
||||
<MESSAGE value="fix install and .desktop File Tar works now for user home and filebrowser.askfilebrowser start now in user home" />
|
||||
<MESSAGE value="replace tar with zip and Check if Zip file is empty" />
|
||||
<MESSAGE value="Create your own message boxes for export" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Create your own message boxes for export" />
|
||||
<MESSAGE value="chown Export File to 1000:1000" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="chown Export File to 1000:1000" />
|
||||
</component>
|
||||
</project>
|
@ -3,7 +3,7 @@ import os
|
||||
import shutil
|
||||
import zipfile
|
||||
from datetime import datetime
|
||||
from tkinter import filedialog
|
||||
from tkinter import filedialog, ttk
|
||||
import tkinter as tk
|
||||
from pathlib import Path
|
||||
from subprocess import check_call
|
||||
@ -363,3 +363,6 @@ class ExportTunnels:
|
||||
|
||||
except TypeError:
|
||||
pass
|
||||
|
||||
|
||||
|
||||
|
32
wg_main.py
32
wg_main.py
@ -108,6 +108,9 @@ class FrameWidgets(ttk.Frame):
|
||||
tl = ListTunnels.tl_list()
|
||||
if len(tl) != 0:
|
||||
self.wg_autostart.configure(state='normal')
|
||||
self.lb_rename.config(state='normal')
|
||||
self.lb_rename.delete(0, tk.END)
|
||||
self.btn_rename.config(state='normal')
|
||||
|
||||
self.l_box = tk.Listbox(self.lb_frame_btn_lbox, fg='#606060', selectmode='single')
|
||||
self.l_box.config(highlightthickness=0, relief='ridge')
|
||||
@ -190,8 +193,35 @@ class FrameWidgets(ttk.Frame):
|
||||
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)
|
||||
|
||||
# Label Entry
|
||||
self.lb_rename = ttk.Entry(self, width=45)
|
||||
self.lb_rename.grid(column=2, row=4, padx=30, pady=15, sticky='snw')
|
||||
self.lb_rename.insert(0, 'Max. 12 characters without blanks!')
|
||||
self.lb_rename.config(state='disable')
|
||||
|
||||
def tl_rename():
|
||||
try:
|
||||
self.select_tunnel = self.l_box.curselection()
|
||||
select_tl = self.l_box.get(self.select_tunnel[0])
|
||||
# nmcli connection modify old connection.id iphone
|
||||
check_call(['nmcli', 'connection', 'modify', select_tl, 'connection.id', self.lb_rename.get()])
|
||||
source = Path('/etc/wire_py') / str(select_tl + '.conf')
|
||||
destination = source.with_name(str(self.lb_rename.get() + '.conf'))
|
||||
source.replace(destination)
|
||||
self.l_box.delete(self.select_tunnel[0])
|
||||
self.l_box.insert("end", self.lb_rename.get())
|
||||
self.l_box.update()
|
||||
self.lb_rename.delete(0, tk.END)
|
||||
if self.a != '' and self.a == select_tl:
|
||||
self.a = TunnelActiv.active()
|
||||
self.StrVar.set(value=self.a)
|
||||
|
||||
return select_tl
|
||||
except IndexError:
|
||||
pass
|
||||
|
||||
# Button Rename
|
||||
self.btn_rename = ttk.Button(self, text='Rename')
|
||||
self.btn_rename = ttk.Button(self, text='Rename', state='disable', command=tl_rename)
|
||||
self.btn_rename.grid(column=2, row=4, padx=20, pady=15, sticky='e')
|
||||
|
||||
# Check Buttons
|
||||
|
Loading…
Reference in New Issue
Block a user