add method init_and_report and label_empty to Class ShowAddress
This commit is contained in:
parent
101a2167b6
commit
c87ba4493d
16
.idea/workspace.xml
generated
16
.idea/workspace.xml
generated
@ -4,9 +4,10 @@
|
|||||||
<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="fixed error when active tunnel is deleted, now also the Address Label is emptied">
|
<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">
|
||||||
<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" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@ -186,7 +187,15 @@
|
|||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1724400463791</updated>
|
<updated>1724400463791</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="13" />
|
<task id="LOCAL-00013" summary="In FrameWidged Class else Block StrVar, this resorts reference and variable assignment together">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1724401340512</created>
|
||||||
|
<option name="number" value="00013" />
|
||||||
|
<option name="presentableId" value="LOCAL-00013" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1724401340512</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="14" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="Vcs.Log.Tabs.Properties">
|
<component name="Vcs.Log.Tabs.Properties">
|
||||||
@ -225,6 +234,7 @@
|
|||||||
<MESSAGE value="Set Style to Clam Improved layout of widgets" />
|
<MESSAGE value="Set Style to Clam Improved layout of widgets" />
|
||||||
<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" />
|
||||||
<option name="LAST_COMMIT_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" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
27
main.py
27
main.py
@ -103,12 +103,7 @@ class FrameWidgets(ttk.Frame):
|
|||||||
file = open(wg_read, 'r')
|
file = open(wg_read, 'r')
|
||||||
data = ConToDict.covert_to_dict(file)
|
data = ConToDict.covert_to_dict(file)
|
||||||
# Address Label
|
# Address Label
|
||||||
self.add = tk.StringVar()
|
ShowAddress.init_and_report(self, data)
|
||||||
self.add.set('Address: ' + data[0])
|
|
||||||
self.DNS = tk.StringVar()
|
|
||||||
self.DNS.set(' DNS: ' + data[1])
|
|
||||||
self.enp = tk.StringVar()
|
|
||||||
self.enp.set('Endpoint: ' + data[2])
|
|
||||||
ShowAddress.show_data(self)
|
ShowAddress.show_data(self)
|
||||||
file.close()
|
file.close()
|
||||||
else:
|
else:
|
||||||
@ -117,9 +112,7 @@ class FrameWidgets(ttk.Frame):
|
|||||||
self.add = tk.StringVar()
|
self.add = tk.StringVar()
|
||||||
self.DNS = tk.StringVar()
|
self.DNS = tk.StringVar()
|
||||||
self.enp = tk.StringVar()
|
self.enp = tk.StringVar()
|
||||||
self.add.set('')
|
ShowAddress.label_empty(self)
|
||||||
self.DNS.set('')
|
|
||||||
self.enp.set('')
|
|
||||||
ShowAddress.show_data(self)
|
ShowAddress.show_data(self)
|
||||||
# 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))
|
||||||
@ -136,11 +129,8 @@ class FrameWidgets(ttk.Frame):
|
|||||||
StartStopBTN.button_start(self)
|
StartStopBTN.button_start(self)
|
||||||
self.l_box.update()
|
self.l_box.update()
|
||||||
# Address Label
|
# Address Label
|
||||||
self.add.set('')
|
ShowAddress.label_empty(self)
|
||||||
self.DNS.set('')
|
|
||||||
self.enp.set('')
|
|
||||||
ShowAddress.show_data(self)
|
ShowAddress.show_data(self)
|
||||||
|
|
||||||
# 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)
|
||||||
@ -164,12 +154,7 @@ class FrameWidgets(ttk.Frame):
|
|||||||
file = open(wg_read, 'r')
|
file = open(wg_read, 'r')
|
||||||
data = ConToDict.covert_to_dict(file)
|
data = ConToDict.covert_to_dict(file)
|
||||||
# Address Label
|
# Address Label
|
||||||
self.add = tk.StringVar()
|
ShowAddress.init_and_report(self, data)
|
||||||
self.add.set('Address: ' + data[0])
|
|
||||||
self.DNS = tk.StringVar()
|
|
||||||
self.DNS.set(' DNS: ' + data[1])
|
|
||||||
self.enp = tk.StringVar()
|
|
||||||
self.enp.set('Endpoint: ' + data[2])
|
|
||||||
ShowAddress.show_data(self)
|
ShowAddress.show_data(self)
|
||||||
file.close()
|
file.close()
|
||||||
# Button Start/Stop
|
# Button Start/Stop
|
||||||
@ -188,9 +173,7 @@ class FrameWidgets(ttk.Frame):
|
|||||||
self.StrVar.set('')
|
self.StrVar.set('')
|
||||||
GreenLabel.green_show_label(self)
|
GreenLabel.green_show_label(self)
|
||||||
# Address Label
|
# Address Label
|
||||||
self.add.set('')
|
ShowAddress.label_empty(self)
|
||||||
self.DNS.set('')
|
|
||||||
self.enp.set('')
|
|
||||||
ShowAddress.show_data(self)
|
ShowAddress.show_data(self)
|
||||||
|
|
||||||
|
|
||||||
|
16
wg_func.py
16
wg_func.py
@ -74,7 +74,7 @@ class ConToDict:
|
|||||||
for items in dictlist:
|
for items in dictlist:
|
||||||
if items == '=':
|
if items == '=':
|
||||||
dictlist.remove(items)
|
dictlist.remove(items)
|
||||||
for i in dictlist: # Here is the beginning (Loop) of convert List to Dictionary
|
for i in dictlist: # Here is the beginning (Loop) of convert List to Dictionary
|
||||||
a = [dictlist[0], dictlist[1]]
|
a = [dictlist[0], dictlist[1]]
|
||||||
b = [dictlist[2], dictlist[3]]
|
b = [dictlist[2], dictlist[3]]
|
||||||
c = [dictlist[4], dictlist[5]]
|
c = [dictlist[4], dictlist[5]]
|
||||||
@ -118,6 +118,20 @@ class ShowAddress(tk.Tk):
|
|||||||
self.DNS = None
|
self.DNS = None
|
||||||
self.add = None
|
self.add = None
|
||||||
|
|
||||||
|
def init_and_report(self, data=None):
|
||||||
|
# Address Label
|
||||||
|
self.add = tk.StringVar()
|
||||||
|
self.add.set('Address: ' + data[0])
|
||||||
|
self.DNS = tk.StringVar()
|
||||||
|
self.DNS.set(' DNS: ' + data[1])
|
||||||
|
self.enp = tk.StringVar()
|
||||||
|
self.enp.set('Endpoint: ' + data[2])
|
||||||
|
|
||||||
|
def label_empty(self):
|
||||||
|
self.add.set('')
|
||||||
|
self.DNS.set('')
|
||||||
|
self.enp.set('')
|
||||||
|
|
||||||
def show_data(self):
|
def show_data(self):
|
||||||
# Address Label
|
# Address Label
|
||||||
self.address = tk.Label(self.lb_frame, textvariable=self.add, fg='blue')
|
self.address = tk.Label(self.lb_frame, textvariable=self.add, fg='blue')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user