Changelog create When exporting, the folder is now copied to /tmp and the non .conf files are deleted before the zip file is created. In main.py os import removed. Since os have been replaced by pathlib and shutil.

Start with version number 1.4.7
Message window size corrected so text is displayed better
This commit is contained in:
Désiré Werner Menrath 2024-09-28 14:13:07 +02:00
parent 825aa46fae
commit 438e2b9de7
4 changed files with 83 additions and 56 deletions

View File

@ -4,8 +4,11 @@
<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 msg_boxes when tunnel list = 0 a Start, Delete and Export"> <list default="true" id="940e1630-c825-4d4c-be80-bc11f543c122" name="Changes" comment="fix installer add .keys file">
<change afterPath="$PROJECT_DIR$/Changelog" afterDir="false" />
<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$/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> </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" />
@ -39,23 +42,23 @@
<option name="hideEmptyMiddlePackages" value="true" /> <option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" /> <option name="showLibraryContents" value="true" />
</component> </component>
<component name="PropertiesComponent">{ <component name="PropertiesComponent"><![CDATA[{
&quot;keyToString&quot;: { "keyToString": {
&quot;ASKED_ADD_EXTERNAL_FILES&quot;: &quot;true&quot;, "ASKED_ADD_EXTERNAL_FILES": "true",
&quot;Python.INSTALL.executor&quot;: &quot;Run&quot;, "Python.INSTALL.executor": "Run",
&quot;Python.install.executor&quot;: &quot;Run&quot;, "Python.install.executor": "Run",
&quot;Python.main.executor&quot;: &quot;Run&quot;, "Python.main.executor": "Run",
&quot;Python.messagebox.executor&quot;: &quot;Run&quot;, "Python.messagebox.executor": "Run",
&quot;Python.start_wg.executor&quot;: &quot;Run&quot;, "Python.start_wg.executor": "Run",
&quot;Python.wg_func.executor&quot;: &quot;Run&quot;, "Python.wg_func.executor": "Run",
&quot;Python.wg_main.executor&quot;: &quot;Run&quot;, "Python.wg_main.executor": "Run",
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;, "RunOnceActivity.ShowReadmeOnStart": "true",
&quot;Shell Script.install.executor&quot;: &quot;Run&quot;, "Shell Script.install.executor": "Run",
&quot;git-widget-placeholder&quot;: &quot;main&quot;, "git-widget-placeholder": "main",
&quot;last_opened_file_path&quot;: &quot;/home/punix/Pyapps/wire-py&quot;, "last_opened_file_path": "/home/punix/Pyapps/wire-py",
&quot;settings.editor.selected.configurable&quot;: &quot;preferences.lookFeel&quot; "settings.editor.selected.configurable": "preferences.lookFeel"
} }
}</component> }]]></component>
<component name="RecentsManager"> <component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS"> <key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$" /> <recent name="$PROJECT_DIR$" />
@ -132,14 +135,6 @@
<option name="presentableId" value="Default" /> <option name="presentableId" value="Default" />
<updated>1723279982210</updated> <updated>1723279982210</updated>
</task> </task>
<task id="LOCAL-00006" summary="add class ListTunnels and class ImportTunnel, and add class ExportTunnels (ExportTunnels no finish)">
<option name="closed" value="true" />
<created>1724048994613</created>
<option name="number" value="00006" />
<option name="presentableId" value="LOCAL-00006" />
<option name="project" value="LOCAL" />
<updated>1724048994613</updated>
</task>
<task id="LOCAL-00007" summary="add Label Interface and Peer to new FrameWidget one and two. when import Tunnel then add to list works and remove of list when Tunnel delete.(with Label active on and off) &#10;add to class and methods open a avtive Tunnel when Wire-Py open, when import and start a Tunnel"> <task id="LOCAL-00007" summary="add Label Interface and Peer to new FrameWidget one and two. when import Tunnel then add to list works and remove of list when Tunnel delete.(with Label active on and off) &#10;add to class and methods open a avtive Tunnel when Wire-Py open, when import and start a Tunnel">
<option name="closed" value="true" /> <option name="closed" value="true" />
<created>1724102937260</created> <created>1724102937260</created>
@ -524,7 +519,15 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1727379755537</updated> <updated>1727379755537</updated>
</task> </task>
<option name="localTasksCounter" value="55" /> <task id="LOCAL-00055" summary="fix installer add .keys file">
<option name="closed" value="true" />
<created>1727380793216</created>
<option name="number" value="00055" />
<option name="presentableId" value="LOCAL-00055" />
<option name="project" value="LOCAL" />
<updated>1727380793216</updated>
</task>
<option name="localTasksCounter" value="56" />
<servers /> <servers />
</component> </component>
<component name="UnknownFeatures"> <component name="UnknownFeatures">
@ -565,7 +568,6 @@
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" /> <option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
<MESSAGE value="little fixes, add msg_window() &#10;function for Messagebox to show a tk.Toplevel()&#10;replace var = open() with: &#10;with open() as var:&#10;and remove by classes (tk.tk) and super()" />
<MESSAGE value="in delete replace open with Path&#10;install fixes" /> <MESSAGE value="in delete replace open with Path&#10;install fixes" />
<MESSAGE value="new format little fixes icons sort add policy add .desktop File install Part 2" /> <MESSAGE value="new format little fixes icons sort add policy add .desktop File install Part 2" />
<MESSAGE value="install fix for set dir right" /> <MESSAGE value="install fix for set dir right" />
@ -590,17 +592,7 @@
<MESSAGE value="info icon shadow fix end msg Export fix to" /> <MESSAGE value="info icon shadow fix end msg Export fix to" />
<MESSAGE value="little fixes" /> <MESSAGE value="little fixes" />
<MESSAGE value="fix msg_boxes when tunnel list = 0 a Start, Delete and Export" /> <MESSAGE value="fix msg_boxes when tunnel list = 0 a Start, Delete and Export" />
<option name="LAST_COMMIT_MESSAGE" value="fix msg_boxes when tunnel list = 0 a Start, Delete and Export" /> <MESSAGE value="fix installer add .keys file" />
</component> <option name="LAST_COMMIT_MESSAGE" value="fix installer add .keys file" />
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/wg_func.py</url>
<line>182</line>
<option name="timeStamp" value="1" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
</component> </component>
</project> </project>

27
Changelog Normal file
View File

@ -0,0 +1,27 @@
Changelog for Wire-Py
## [Unreleased]
- os import in wg_func replaced by other methods
- Autoupdate in Options
- Guide to menu '?' with pictures
- Create file for settings (Autoupdate)
- UID and GID for another Systems (Fedora, Arch, ect.)
- installer optimize for another Systems
- In Gitea Readme enter text, images
- Dark Theme for Wire-Py
- Own filedialog for import
### Added
28-09-2024
- Changelog create
- When exporting, the folder is now copied to /tmp and the non .conf
files are deleted before the zip file is created.
- In main.py os import removed. Since os have been replaced by pathlib and shutil.
- Start with version number 1.4.7
- Message window size corrected so text is displayed better

View File

@ -2,12 +2,12 @@
import os import os
import shutil import shutil
import subprocess import subprocess
import tkinter as tk
import zipfile import zipfile
from datetime import datetime from datetime import datetime
from tkinter import filedialog, ttk
import tkinter as tk
from pathlib import Path from pathlib import Path
from subprocess import check_call from subprocess import check_call
from tkinter import filedialog
font_color = '#4011a7' font_color = '#4011a7'
dk_theme = '#2e2e2e' dk_theme = '#2e2e2e'
@ -300,7 +300,7 @@ class ImportTunnel:
ShowAddress.init_and_report(self, data) ShowAddress.init_and_report(self, data)
ShowAddress.show_data(self) ShowAddress.show_data(self)
check_call(['nmcli', 'con', 'mod', self.a, 'connection.autoconnect', 'no']) check_call(['nmcli', 'con', 'mod', self.a, 'connection.autoconnect', 'no'])
os.chmod(str(wg_read), 0o600) Path.chmod(wg_read, 0o600)
if 'PrivateKey = ' not in read: if 'PrivateKey = ' not in read:
"""img_w, img_i, w_title, w_txt x, y hand over""" """img_w, img_i, w_title, w_txt x, y hand over"""
@ -404,9 +404,13 @@ class ExportTunnels:
try: try:
if len(tl) != 0: if len(tl) != 0:
wg_tar = str(_u) + '/' + now_datetime wg_tar = str(_u) + '/' + now_datetime
p_to_conf = Path('/etc/wire_py/') shutil.copytree('/etc/wire_py', '/tmp/wire_py', dirs_exist_ok=True)
shutil.make_archive(wg_tar, 'zip', p_to_conf) source = Path('/tmp/wire_py')
os.chown(wg_tar + '.zip', 1000, 1000) Path.unlink(Path(source) / 'wg_py', missing_ok=True)
Path.unlink(Path(source) / '.keys', missing_ok=True)
shutil.make_archive(wg_tar, 'zip', source)
shutil.chown(wg_tar + '.zip', 1000, 1000)
shutil.rmtree(source)
with zipfile.ZipFile((wg_tar + '.zip'), 'r') as zf: with zipfile.ZipFile((wg_tar + '.zip'), 'r') as zf:
if len(zf.namelist()) != 0: if len(zf.namelist()) != 0:
"""img_w, img_i, w_title, w_txt hand over""" """img_w, img_i, w_title, w_txt hand over"""
@ -432,8 +436,8 @@ class ExportTunnels:
ii = r'/usr/share/icons/wp-icons/48/wg_msg.png' ii = r'/usr/share/icons/wp-icons/48/wg_msg.png'
wt = 'Select tunnel' wt = 'Select tunnel'
msg_t = 'Please first import tunnel.' msg_t = 'Please first import tunnel.'
x = 340 # width x = 280 # width
y = 140 # height y = 130 # height
msg_window(iw, ii, wt, msg_t, x, y) msg_window(iw, ii, wt, msg_t, x, y)
except TypeError: except TypeError:

View File

@ -1,5 +1,5 @@
#!/usr/bin/python3 #!/usr/bin/python3
import os
import tkinter as tk import tkinter as tk
from subprocess import check_call from subprocess import check_call
from tkinter import * from tkinter import *
@ -40,6 +40,8 @@ class MainWindow(tk.Tk):
self.app_menu = tk.Menu(self, borderwidth=0) self.app_menu = tk.Menu(self, borderwidth=0)
self.configure(menu=self.app_menu) self.configure(menu=self.app_menu)
self.app_menu.add_cascade(label='v. 1.4.7')
self.app_menu.add_cascade(label='Options')
self.app_menu.add_cascade(label='?') self.app_menu.add_cascade(label='?')
FrameWidgets(self).grid() FrameWidgets(self).grid()
@ -177,7 +179,9 @@ class FrameWidgets(ttk.Frame):
for line in readfile: for line in readfile:
if pre_key not in line.strip("\n"): if pre_key not in line.strip("\n"):
writefile.write(line) writefile.write(line)
os.replace('/etc/wire_py/.keys2', '/etc/wire_py/.keys') file_one = Path('/etc/wire_py/.keys2')
file_two = file_one.with_name('.keys')
file_one.replace(file_two)
# for disable checkbox when Listbox empty # for disable checkbox when Listbox empty
tl = ListTunnels.tl_list() tl = ListTunnels.tl_list()
if len(tl) == 0: if len(tl) == 0:
@ -208,8 +212,8 @@ class FrameWidgets(ttk.Frame):
ii = r'/usr/share/icons/wp-icons/48/wg_msg.png' ii = r'/usr/share/icons/wp-icons/48/wg_msg.png'
wt = 'Select tunnel' wt = 'Select tunnel'
msg_t = 'Please first import tunnel.' msg_t = 'Please first import tunnel.'
x = 340 # width x = 280 # width
y = 140 # height y = 130 # height
msg_window(iw, ii, wt, msg_t, x, y) msg_window(iw, ii, wt, msg_t, x, y)
# Button Trash # Button Trash
@ -366,8 +370,8 @@ class FrameWidgets(ttk.Frame):
ii = r'/usr/share/icons/wp-icons/48/wg_msg.png' ii = r'/usr/share/icons/wp-icons/48/wg_msg.png'
wt = 'Select tunnel' wt = 'Select tunnel'
msg_t = 'Please first import tunnel.' msg_t = 'Please first import tunnel.'
x = 340 # width x = 280 # width
y = 140 # height y = 130 # height
msg_window(iw, ii, wt, msg_t, x, y) msg_window(iw, ii, wt, msg_t, x, y)