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" />
</component>
<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$/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>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -39,23 +42,23 @@
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">{
&quot;keyToString&quot;: {
&quot;ASKED_ADD_EXTERNAL_FILES&quot;: &quot;true&quot;,
&quot;Python.INSTALL.executor&quot;: &quot;Run&quot;,
&quot;Python.install.executor&quot;: &quot;Run&quot;,
&quot;Python.main.executor&quot;: &quot;Run&quot;,
&quot;Python.messagebox.executor&quot;: &quot;Run&quot;,
&quot;Python.start_wg.executor&quot;: &quot;Run&quot;,
&quot;Python.wg_func.executor&quot;: &quot;Run&quot;,
&quot;Python.wg_main.executor&quot;: &quot;Run&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;Shell Script.install.executor&quot;: &quot;Run&quot;,
&quot;git-widget-placeholder&quot;: &quot;main&quot;,
&quot;last_opened_file_path&quot;: &quot;/home/punix/Pyapps/wire-py&quot;,
&quot;settings.editor.selected.configurable&quot;: &quot;preferences.lookFeel&quot;
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"ASKED_ADD_EXTERNAL_FILES": "true",
"Python.INSTALL.executor": "Run",
"Python.install.executor": "Run",
"Python.main.executor": "Run",
"Python.messagebox.executor": "Run",
"Python.start_wg.executor": "Run",
"Python.wg_func.executor": "Run",
"Python.wg_main.executor": "Run",
"RunOnceActivity.ShowReadmeOnStart": "true",
"Shell Script.install.executor": "Run",
"git-widget-placeholder": "main",
"last_opened_file_path": "/home/punix/Pyapps/wire-py",
"settings.editor.selected.configurable": "preferences.lookFeel"
}
}</component>
}]]></component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$" />
@ -132,14 +135,6 @@
<option name="presentableId" value="Default" />
<updated>1723279982210</updated>
</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">
<option name="closed" value="true" />
<created>1724102937260</created>
@ -524,7 +519,15 @@
<option name="project" value="LOCAL" />
<updated>1727379755537</updated>
</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 />
</component>
<component name="UnknownFeatures">
@ -565,7 +568,6 @@
</component>
<component name="VcsManagerConfiguration">
<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="new format little fixes icons sort add policy add .desktop File install Part 2" />
<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="little fixes" />
<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" />
</component>
<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>
<MESSAGE value="fix installer add .keys file" />
<option name="LAST_COMMIT_MESSAGE" value="fix installer add .keys file" />
</component>
</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 shutil
import subprocess
import tkinter as tk
import zipfile
from datetime import datetime
from tkinter import filedialog, ttk
import tkinter as tk
from pathlib import Path
from subprocess import check_call
from tkinter import filedialog
font_color = '#4011a7'
dk_theme = '#2e2e2e'
@ -300,7 +300,7 @@ class ImportTunnel:
ShowAddress.init_and_report(self, data)
ShowAddress.show_data(self)
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:
"""img_w, img_i, w_title, w_txt x, y hand over"""
@ -404,9 +404,13 @@ class ExportTunnels:
try:
if len(tl) != 0:
wg_tar = str(_u) + '/' + now_datetime
p_to_conf = Path('/etc/wire_py/')
shutil.make_archive(wg_tar, 'zip', p_to_conf)
os.chown(wg_tar + '.zip', 1000, 1000)
shutil.copytree('/etc/wire_py', '/tmp/wire_py', dirs_exist_ok=True)
source = Path('/tmp/wire_py')
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:
if len(zf.namelist()) != 0:
"""img_w, img_i, w_title, w_txt hand over"""
@ -431,9 +435,9 @@ class ExportTunnels:
iw = r'/usr/share/icons/wp-icons/64/info.png'
ii = r'/usr/share/icons/wp-icons/48/wg_msg.png'
wt = 'Select tunnel'
msg_t = 'Please first import tunnel. '
x = 340 # width
y = 140 # height
msg_t = 'Please first import tunnel.'
x = 280 # width
y = 130 # height
msg_window(iw, ii, wt, msg_t, x, y)
except TypeError:

View File

@ -1,5 +1,5 @@
#!/usr/bin/python3
import os
import tkinter as tk
from subprocess import check_call
from tkinter import *
@ -40,6 +40,8 @@ class MainWindow(tk.Tk):
self.app_menu = tk.Menu(self, borderwidth=0)
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='?')
FrameWidgets(self).grid()
@ -177,7 +179,9 @@ class FrameWidgets(ttk.Frame):
for line in readfile:
if pre_key not in line.strip("\n"):
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
tl = ListTunnels.tl_list()
if len(tl) == 0:
@ -207,9 +211,9 @@ class FrameWidgets(ttk.Frame):
iw = r'/usr/share/icons/wp-icons/64/info.png'
ii = r'/usr/share/icons/wp-icons/48/wg_msg.png'
wt = 'Select tunnel'
msg_t = 'Please first import tunnel. '
x = 340 # width
y = 140 # height
msg_t = 'Please first import tunnel.'
x = 280 # width
y = 130 # height
msg_window(iw, ii, wt, msg_t, x, y)
# Button Trash
@ -365,9 +369,9 @@ class FrameWidgets(ttk.Frame):
iw = r'/usr/share/icons/wp-icons/64/info.png'
ii = r'/usr/share/icons/wp-icons/48/wg_msg.png'
wt = 'Select tunnel'
msg_t = 'Please first import tunnel. '
x = 340 # width
y = 140 # height
msg_t = 'Please first import tunnel.'
x = 280 # width
y = 130 # height
msg_window(iw, ii, wt, msg_t, x, y)