wire-py-reformat-14-08-2024 #10

Merged
punix merged 4 commits from wire-py-reformat-14-08-2024 into main 2024-09-04 06:26:31 +02:00
2 changed files with 35 additions and 17 deletions
Showing only changes of commit 6173a653f9 - Show all commits

View File

@ -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="fix when Filname &gt; 17 first copy file after rename"> <list default="true" id="940e1630-c825-4d4c-be80-bc11f543c122" name="Changes" comment="add export Tunnel as zip">
<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" />
@ -41,16 +40,16 @@
<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.main.executor&quot;: &quot;Run&quot;, "Python.main.executor": "Run",
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;, "RunOnceActivity.ShowReadmeOnStart": "true",
&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="RunManager"> <component name="RunManager">
<configuration name="main" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true"> <configuration name="main" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true">
<module name="wire-py" /> <module name="wire-py" />
@ -235,7 +234,15 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1724593165879</updated> <updated>1724593165879</updated>
</task> </task>
<option name="localTasksCounter" value="19" /> <task id="LOCAL-00019" summary="add export Tunnel as zip">
<option name="closed" value="true" />
<created>1724610514657</created>
<option name="number" value="00019" />
<option name="presentableId" value="LOCAL-00019" />
<option name="project" value="LOCAL" />
<updated>1724610514658</updated>
</task>
<option name="localTasksCounter" value="20" />
<servers /> <servers />
</component> </component>
<component name="Vcs.Log.Tabs.Properties"> <component name="Vcs.Log.Tabs.Properties">
@ -280,6 +287,7 @@
<MESSAGE value="fix label when laat Tunnel delete and fix Tuple error in delete and Start/Stop when listbox empty" /> <MESSAGE value="fix label when laat Tunnel delete and fix Tuple error in delete and Start/Stop when listbox empty" />
<MESSAGE value="remove a ',' in DNS Name" /> <MESSAGE value="remove a ',' in DNS Name" />
<MESSAGE value="fix when Filname &gt; 17 first copy file after rename" /> <MESSAGE value="fix when Filname &gt; 17 first copy file after rename" />
<option name="LAST_COMMIT_MESSAGE" value="fix when Filname &gt; 17 first copy file after rename" /> <MESSAGE value="add export Tunnel as zip" />
<option name="LAST_COMMIT_MESSAGE" value="add export Tunnel as zip" />
</component> </component>
</project> </project>

View File

@ -1,7 +1,7 @@
# Wireguard functions for Wire-Py # Wireguard functions for Wire-Py
import os import os
import shutil import shutil
import tarfile from datetime import datetime
from tkinter import filedialog from tkinter import filedialog
import tkinter as tk import tkinter as tk
@ -225,9 +225,19 @@ class ImportTunnel:
class ExportTunnels: class ExportTunnels:
@staticmethod @staticmethod
def wg_export(): def wg_export():
now_time = datetime.now()
now_datetime = now_time.strftime('/wg-exp-' + "%m-%d-%Y" + '-' + "%H:%M")
tl = ListTunnels.tl_list()
try: try:
wg_tar = os.environ['HOME'] + '/datetime' if len(tl) != 0:
p_to_conf = os.environ['HOME'] + '/tester' wg_tar = os.environ['HOME'] + now_datetime
shutil.make_archive(wg_tar, 'zip', p_to_conf) p_to_conf = os.environ['HOME'] + '/tester'
shutil.make_archive(wg_tar, 'zip', p_to_conf)
#if zip_full != 0:
#print('Export erfolgraeich')
#else:
#print('ups etwwas ging schief bitte Export wiederholen')
else:
print('No Tunnel for Export')
except TypeError: except TypeError:
pass pass