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" />
|
||||
</component>
|
||||
<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$/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" />
|
||||
@ -195,7 +194,15 @@
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1724401340512</updated>
|
||||
</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 />
|
||||
</component>
|
||||
<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="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" />
|
||||
<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>
|
||||
</project>
|
13
wg_func.py
13
wg_func.py
@ -181,16 +181,17 @@ class ImportTunnel:
|
||||
if len(pathsplit1) > 17:
|
||||
pathsplit = pathsplit1[len(pathsplit1) - 17:]
|
||||
os.rename(filepath, os.environ['HOME'] + '/tester/' + str(pathsplit))
|
||||
if self.a != '':
|
||||
os.system('nmcli connection down ' + str(TunnelActiv.active()))
|
||||
os.system('nmcli connection import type wireguard file ' + os.environ['HOME'] + '/tester/' +
|
||||
str(pathsplit))
|
||||
os.system('nmcli con mod ' + str(pathsplit[:-5]) + ' connection.autoconnect no')
|
||||
else:
|
||||
subprocess.call('cp ' + str(filepath) + ' ' + os.environ['HOME'] + '/tester/', shell=True)
|
||||
if self.a != '':
|
||||
os.system('nmcli connection down ' + str(TunnelActiv.active()))
|
||||
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.l_box.insert(0, self.a)
|
||||
self.l_box.update()
|
||||
@ -201,11 +202,11 @@ class ImportTunnel:
|
||||
wg_read = os.environ['HOME'] + '/tester/' + str(self.a) + '.conf'
|
||||
file = open(wg_read, 'r')
|
||||
data = ConToDict.covert_to_dict(file)
|
||||
self.add.set('Address: ' + data[0])
|
||||
self.DNS.set(' DNS: ' + data[1])
|
||||
self.enp.set('Endpoint: ' + data[2])
|
||||
# Address Label
|
||||
ShowAddress.init_and_report(self, data)
|
||||
ShowAddress.show_data(self)
|
||||
file.close()
|
||||
os.system('nmcli con mod ' + str(self.a) + ' connection.autoconnect no')
|
||||
if "PrivateKey = " not in read:
|
||||
Message()
|
||||
except EOFError:
|
||||
|
Loading…
x
Reference in New Issue
Block a user