fix when Filname > 17 first copy file after rename
This commit is contained in:
parent
8d657f7c09
commit
980c5a9010
15
.idea/workspace.xml
generated
15
.idea/workspace.xml
generated
@ -4,7 +4,7 @@
|
|||||||
<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="fix label when laat Tunnel delete and fix Tuple error in delete and Start/Stop when listbox empty">
|
<list default="true" id="940e1630-c825-4d4c-be80-bc11f543c122" name="Changes" comment="remove a ',' in DNS Name">
|
||||||
<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$/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" />
|
||||||
@ -219,7 +219,15 @@
|
|||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1724495688099</updated>
|
<updated>1724495688099</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="17" />
|
<task id="LOCAL-00017" summary="remove a ',' in DNS Name">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1724576599289</created>
|
||||||
|
<option name="number" value="00017" />
|
||||||
|
<option name="presentableId" value="LOCAL-00017" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1724576599289</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="18" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="Vcs.Log.Tabs.Properties">
|
<component name="Vcs.Log.Tabs.Properties">
|
||||||
@ -262,6 +270,7 @@
|
|||||||
<MESSAGE value="add method init_and_report and label_empty to Class ShowAddress" />
|
<MESSAGE value="add method init_and_report and label_empty to Class ShowAddress" />
|
||||||
<MESSAGE value="little fixes in Class Import" />
|
<MESSAGE value="little fixes in Class Import" />
|
||||||
<MESSAGE value="fix label when laat Tunnel delete and fix Tuple error in delete and Start/Stop when listbox empty" />
|
<MESSAGE value="fix label when laat Tunnel delete and fix Tuple error in delete and Start/Stop when listbox empty" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="fix label when laat Tunnel delete and fix Tuple error in delete and Start/Stop when listbox empty" />
|
<MESSAGE value="remove a ',' in DNS Name" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="remove a ',' in DNS Name" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
4
main.py
4
main.py
@ -85,12 +85,12 @@ class FrameWidgets(ttk.Frame):
|
|||||||
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)
|
||||||
# Listbox with Scrollbar
|
# Listbox with Scrollbar
|
||||||
self.scrollbar = tk.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')
|
||||||
self.l_box.config(highlightthickness=0, relief='flat')
|
self.l_box.config(highlightthickness=0, relief='flat')
|
||||||
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)
|
||||||
# Tunnel List
|
# Tunnel List
|
||||||
self.tl = ListTunnels.tl_list()
|
self.tl = ListTunnels.tl_list()
|
||||||
for tunnels in self.tl:
|
for tunnels in self.tl:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Wireguard functions for Wire-Py
|
# Wireguard functions for Wire-Py
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import shutil
|
||||||
from tkinter import filedialog
|
from tkinter import filedialog
|
||||||
import tkinter as tk
|
import tkinter as tk
|
||||||
|
|
||||||
@ -182,14 +182,15 @@ class ImportTunnel:
|
|||||||
pathsplit1 = pathsplit[-1]
|
pathsplit1 = pathsplit[-1]
|
||||||
if "PrivateKey = " in read and "PublicKey = " in read:
|
if "PrivateKey = " in read and "PublicKey = " in read:
|
||||||
if len(pathsplit1) > 17:
|
if len(pathsplit1) > 17:
|
||||||
|
p1 = shutil.copy(filepath, os.environ['HOME'] + '/tester/')
|
||||||
pathsplit = pathsplit1[len(pathsplit1) - 17:]
|
pathsplit = pathsplit1[len(pathsplit1) - 17:]
|
||||||
os.rename(filepath, os.environ['HOME'] + '/tester/' + str(pathsplit))
|
os.rename(p1, os.environ['HOME'] + '/tester/' + str(pathsplit))
|
||||||
if self.a != '':
|
if self.a != '':
|
||||||
os.system('nmcli connection down ' + str(TunnelActiv.active()))
|
os.system('nmcli connection down ' + str(TunnelActiv.active()))
|
||||||
os.system('nmcli connection import type wireguard file ' + os.environ['HOME'] + '/tester/' +
|
os.system('nmcli connection import type wireguard file ' + os.environ['HOME'] + '/tester/' +
|
||||||
str(pathsplit))
|
str(pathsplit))
|
||||||
else:
|
else:
|
||||||
subprocess.call('cp ' + str(filepath) + ' ' + os.environ['HOME'] + '/tester/', shell=True)
|
shutil.copy(filepath, os.environ['HOME'] + '/tester/')
|
||||||
if self.a != '':
|
if self.a != '':
|
||||||
os.system('nmcli connection down ' + str(TunnelActiv.active()))
|
os.system('nmcli connection down ' + str(TunnelActiv.active()))
|
||||||
os.system('nmcli connection import type wireguard file ' + str(filepath))
|
os.system('nmcli connection import type wireguard file ' + str(filepath))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user