little fixes in Class Import
This commit is contained in:
parent
c87ba4493d
commit
9667bf0690
16
.idea/workspace.xml
generated
16
.idea/workspace.xml
generated
@ -4,9 +4,8 @@
|
|||||||
<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="In FrameWidged Class else Block StrVar, this resorts reference and variable assignment together">
|
<list default="true" id="940e1630-c825-4d4c-be80-bc11f543c122" name="Changes" comment="add method init_and_report and label_empty to Class ShowAddress">
|
||||||
<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" />
|
||||||
@ -195,7 +194,15 @@
|
|||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1724401340512</updated>
|
<updated>1724401340512</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="14" />
|
<task id="LOCAL-00014" summary="add method init_and_report and label_empty to Class ShowAddress">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1724410630021</created>
|
||||||
|
<option name="number" value="00014" />
|
||||||
|
<option name="presentableId" value="LOCAL-00014" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1724410630021</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="15" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="Vcs.Log.Tabs.Properties">
|
<component name="Vcs.Log.Tabs.Properties">
|
||||||
@ -235,6 +242,7 @@
|
|||||||
<MESSAGE value="Remove open file function, add Show Address Labels with tk.StrVar when remove a not active Tunnel Labels of Active Tunnel removed!" />
|
<MESSAGE value="Remove open file function, add Show Address Labels with tk.StrVar when remove a not active Tunnel Labels of Active Tunnel removed!" />
|
||||||
<MESSAGE value="fixed error when active tunnel is deleted, now also the Address Label is emptied" />
|
<MESSAGE value="fixed error when active tunnel is deleted, now also the Address Label is emptied" />
|
||||||
<MESSAGE value="In FrameWidged Class else Block StrVar, this resorts reference and variable assignment together" />
|
<MESSAGE value="In FrameWidged Class else Block StrVar, this resorts reference and variable assignment together" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="In FrameWidged Class else Block StrVar, this resorts reference and variable assignment together" />
|
<MESSAGE value="add method init_and_report and label_empty to Class ShowAddress" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="add method init_and_report and label_empty to Class ShowAddress" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
17
wg_func.py
17
wg_func.py
@ -181,16 +181,17 @@ class ImportTunnel:
|
|||||||
if len(pathsplit1) > 17:
|
if len(pathsplit1) > 17:
|
||||||
pathsplit = pathsplit1[len(pathsplit1) - 17:]
|
pathsplit = pathsplit1[len(pathsplit1) - 17:]
|
||||||
os.rename(filepath, os.environ['HOME'] + '/tester/' + str(pathsplit))
|
os.rename(filepath, os.environ['HOME'] + '/tester/' + str(pathsplit))
|
||||||
os.system('nmcli connection down ' + str(TunnelActiv.active()))
|
if self.a != '':
|
||||||
|
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))
|
||||||
os.system('nmcli con mod ' + str(pathsplit[:-5]) + ' connection.autoconnect no')
|
|
||||||
else:
|
else:
|
||||||
subprocess.call('cp ' + str(filepath) + ' ' + os.environ['HOME'] + '/tester/', shell=True)
|
subprocess.call('cp ' + str(filepath) + ' ' + os.environ['HOME'] + '/tester/', shell=True)
|
||||||
os.system('nmcli connection down ' + str(TunnelActiv.active()))
|
if self.a != '':
|
||||||
|
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))
|
||||||
os.system('nmcli con mod ' + str(pathsplit1[:-5]) + ' connection.autoconnect no')
|
|
||||||
self.StrVar.set(value=' ')
|
self.StrVar.set('')
|
||||||
self.a = TunnelActiv.active()
|
self.a = TunnelActiv.active()
|
||||||
self.l_box.insert(0, self.a)
|
self.l_box.insert(0, self.a)
|
||||||
self.l_box.update()
|
self.l_box.update()
|
||||||
@ -201,11 +202,11 @@ class ImportTunnel:
|
|||||||
wg_read = os.environ['HOME'] + '/tester/' + str(self.a) + '.conf'
|
wg_read = os.environ['HOME'] + '/tester/' + str(self.a) + '.conf'
|
||||||
file = open(wg_read, 'r')
|
file = open(wg_read, 'r')
|
||||||
data = ConToDict.covert_to_dict(file)
|
data = ConToDict.covert_to_dict(file)
|
||||||
self.add.set('Address: ' + data[0])
|
# Address Label
|
||||||
self.DNS.set(' DNS: ' + data[1])
|
ShowAddress.init_and_report(self, data)
|
||||||
self.enp.set('Endpoint: ' + data[2])
|
|
||||||
ShowAddress.show_data(self)
|
ShowAddress.show_data(self)
|
||||||
file.close()
|
file.close()
|
||||||
|
os.system('nmcli con mod ' + str(self.a) + ' connection.autoconnect no')
|
||||||
if "PrivateKey = " not in read:
|
if "PrivateKey = " not in read:
|
||||||
Message()
|
Message()
|
||||||
except EOFError:
|
except EOFError:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user