11 Commits

26 changed files with 940 additions and 1235 deletions

5
.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
debug.log
.venv
.idea
.vscode
__pycache__

View File

@ -1,3 +0,0 @@
<component name="ProjectDictionaryState">
<dictionary name="project" />
</component>

View File

@ -1,6 +0,0 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

7
.idea/misc.xml generated
View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Black">
<option name="sdkName" value="Python 3.12 (wire-py)" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.12" project-jdk-type="Python SDK" />
</project>

8
.idea/modules.xml generated
View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/wire-py.iml" filepath="$PROJECT_DIR$/.idea/wire-py.iml" />
</modules>
</component>
</project>

File diff suppressed because one or more lines are too long

View File

@ -1,4 +0,0 @@
<changelist name="Uncommitted_changes_before_Checkout_at_19_08_24,_06_49_[Changes]" date="1724042999949" recycled="false" toDelete="true">
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Uncommitted_changes_before_Checkout_at_19_08_24,_06_49_[Changes]/shelved.patch" />
<option name="DESCRIPTION" value="Uncommitted changes before Checkout at 19.08.24, 06:49 [Changes]" />
</changelist>

6
.idea/vcs.xml generated
View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

10
.idea/wire-py.iml generated
View File

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.venv" />
</content>
<orderEntry type="jdk" jdkName="Python 3.12" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

640
.idea/workspace.xml generated
View File

@ -1,640 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AutoImportSettings">
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="940e1630-c825-4d4c-be80-bc11f543c122" name="Changes" comment=" - Update Translate Files">
<change afterPath="$PROJECT_DIR$/.vscode/settings.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/common_tools.py" beforeDir="false" afterPath="$PROJECT_DIR$/common_tools.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ssl_decrypt.py" beforeDir="false" afterPath="$PROJECT_DIR$/ssl_decrypt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ssl_encrypt.py" beforeDir="false" afterPath="$PROJECT_DIR$/ssl_encrypt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/wirepy.py" beforeDir="false" afterPath="$PROJECT_DIR$/wirepy.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/wp_app_config.py" beforeDir="false" afterPath="$PROJECT_DIR$/wp_app_config.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Python Script" />
</list>
</option>
</component>
<component name="Git.Settings">
<option name="RECENT_BRANCH_BY_REPOSITORY">
<map>
<entry key="$PROJECT_DIR$" value="1.11.0824" />
</map>
</option>
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
<option name="UPDATE_TYPE" value="REBASE" />
</component>
<component name="HighlightingSettingsPerFile">
<setting file="file:///usr/local/bin/ssl_decrypt.py" root0="SKIP_INSPECTION" />
</component>
<component name="ProjectColorInfo">{
&quot;associatedIndex&quot;: 3
}</component>
<component name="ProjectId" id="2kSbZdjOvr0wsVJSNcaMwSfVaxR" />
<component name="ProjectLevelVcsManager">
<ConfirmationsSetting value="2" id="Add" />
</component>
<component name="ProjectViewState">
<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.common_tools.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.testtheme.executor&quot;: &quot;Run&quot;,
&quot;Python.wg_func.executor&quot;: &quot;Run&quot;,
&quot;Python.wg_main.executor&quot;: &quot;Run&quot;,
&quot;Python.wirepy.executor&quot;: &quot;Run&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;RunOnceActivity.git.unshallow&quot;: &quot;true&quot;,
&quot;Shell Script.install.executor&quot;: &quot;Run&quot;,
&quot;Shell Script.run_as.executor&quot;: &quot;Run&quot;,
&quot;git-widget-placeholder&quot;: &quot;28-04-2025-more-methods-and-optimize-methods&quot;,
&quot;last_opened_file_path&quot;: &quot;/home/punix/Pyapps/wire-py&quot;,
&quot;settings.editor.selected.configurable&quot;: &quot;ml.llm.LLMConfigurable&quot;
}
}</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/lx-icons" />
<recent name="$PROJECT_DIR$" />
</key>
<key name="MoveFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/TK-Themes/theme" />
<recent name="$PROJECT_DIR$/TK-Themes" />
<recent name="$PROJECT_DIR$" />
<recent name="$PROJECT_DIR$/wire-py" />
</key>
</component>
<component name="RunManager" selected="Python.wirepy">
<configuration name="start_wg" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
<module name="wire-py" />
<option name="ENV_FILES" value="" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/start_wg.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="wg_main" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true">
<module name="wire-py" />
<option name="ENV_FILES" value="" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/wg_main.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="wirepy" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
<module name="wire-py" />
<option name="ENV_FILES" value="" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/wirepy.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<recent_temporary>
<list>
<item itemvalue="Python.wirepy" />
<item itemvalue="Python.start_wg" />
</list>
</recent_temporary>
</component>
<component name="SharedIndexes">
<attachedChunks>
<set>
<option value="bundled-python-sdk-348a24fa61fa-5312c7369657-com.jetbrains.pycharm.community.sharedIndexes.bundled-PC-251.23774.444" />
</set>
</attachedChunks>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="940e1630-c825-4d4c-be80-bc11f543c122" name="Changes" comment="" />
<created>1723279982210</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1723279982210</updated>
</task>
<task id="LOCAL-00029" summary="little fixes a labels when stop and start, installer first functions works">
<option name="closed" value="true" />
<created>1725991610908</created>
<option name="number" value="00029" />
<option name="presentableId" value="LOCAL-00029" />
<option name="project" value="LOCAL" />
<updated>1725991610908</updated>
</task>
<task id="LOCAL-00030" summary="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()">
<option name="closed" value="true" />
<created>1726349168248</created>
<option name="number" value="00030" />
<option name="presentableId" value="LOCAL-00030" />
<option name="project" value="LOCAL" />
<updated>1726349168248</updated>
</task>
<task id="LOCAL-00031" summary="in delete replace open with Path&#10;install fixes">
<option name="closed" value="true" />
<created>1726359012150</created>
<option name="number" value="00031" />
<option name="presentableId" value="LOCAL-00031" />
<option name="project" value="LOCAL" />
<updated>1726359012150</updated>
</task>
<task id="LOCAL-00032" summary="new format little fixes icons sort add policy add .desktop File install Part 2">
<option name="closed" value="true" />
<created>1726599446537</created>
<option name="number" value="00032" />
<option name="presentableId" value="LOCAL-00032" />
<option name="project" value="LOCAL" />
<updated>1726599446538</updated>
</task>
<task id="LOCAL-00033" summary="install fix for set dir right">
<option name="closed" value="true" />
<created>1726599588155</created>
<option name="number" value="00033" />
<option name="presentableId" value="LOCAL-00033" />
<option name="project" value="LOCAL" />
<updated>1726599588155</updated>
</task>
<task id="LOCAL-00034" summary="fix checkbox disable and policy rename main.py to wg_main.py">
<option name="closed" value="true" />
<created>1726650691719</created>
<option name="number" value="00034" />
<option name="presentableId" value="LOCAL-00034" />
<option name="project" value="LOCAL" />
<updated>1726650691719</updated>
</task>
<task id="LOCAL-00035" summary="fix rename in Messagebox warning to error">
<option name="closed" value="true" />
<created>1726652747322</created>
<option name="number" value="00035" />
<option name="presentableId" value="LOCAL-00035" />
<option name="project" value="LOCAL" />
<updated>1726652747322</updated>
</task>
<task id="LOCAL-00036" summary="set rights in install and a .conf a import Tunnel Filedialog Part 1 /home when open">
<option name="closed" value="true" />
<created>1726691611936</created>
<option name="number" value="00036" />
<option name="presentableId" value="LOCAL-00036" />
<option name="project" value="LOCAL" />
<updated>1726691611936</updated>
</task>
<task id="LOCAL-00037" summary="fix set rights in install and a .conf a import Tunnel Filedialog Part 1 /home when open">
<option name="closed" value="true" />
<created>1726734843529</created>
<option name="number" value="00037" />
<option name="presentableId" value="LOCAL-00037" />
<option name="project" value="LOCAL" />
<updated>1726734843529</updated>
</task>
<task id="LOCAL-00038" summary="fix a filedialog for hidden Files work&#10;install rollback to bash for start wirepy and wirepy rollback to bash">
<option name="closed" value="true" />
<created>1726764877546</created>
<option name="number" value="00038" />
<option name="presentableId" value="LOCAL-00038" />
<option name="project" value="LOCAL" />
<updated>1726764877546</updated>
</task>
<task id="LOCAL-00039" summary="install rollback bash to py wirepy and wirepy rollback to py">
<option name="closed" value="true" />
<created>1726770649542</created>
<option name="number" value="00039" />
<option name="presentableId" value="LOCAL-00039" />
<option name="project" value="LOCAL" />
<updated>1726770649542</updated>
</task>
<task id="LOCAL-00040" summary="fix install and .desktop File Tar works now for user home and filebrowser.askfilebrowser start now in user home">
<option name="closed" value="true" />
<created>1726777434040</created>
<option name="number" value="00040" />
<option name="presentableId" value="LOCAL-00040" />
<option name="project" value="LOCAL" />
<updated>1726777434040</updated>
</task>
<task id="LOCAL-00041" summary="replace tar with zip and Check if Zip file is empty">
<option name="closed" value="true" />
<created>1726836930251</created>
<option name="number" value="00041" />
<option name="presentableId" value="LOCAL-00041" />
<option name="project" value="LOCAL" />
<updated>1726836930251</updated>
</task>
<task id="LOCAL-00042" summary="Create your own message boxes for export">
<option name="closed" value="true" />
<created>1726841190285</created>
<option name="number" value="00042" />
<option name="presentableId" value="LOCAL-00042" />
<option name="project" value="LOCAL" />
<updated>1726841190285</updated>
</task>
<task id="LOCAL-00043" summary="chown Export File to 1000:1000">
<option name="closed" value="true" />
<created>1726860371820</created>
<option name="number" value="00043" />
<option name="presentableId" value="LOCAL-00043" />
<option name="project" value="LOCAL" />
<updated>1726860371820</updated>
</task>
<task id="LOCAL-00044" summary="add rename Label rename works">
<option name="closed" value="true" />
<created>1726915238475</created>
<option name="number" value="00044" />
<option name="presentableId" value="LOCAL-00044" />
<option name="project" value="LOCAL" />
<updated>1726915238475</updated>
</task>
<task id="LOCAL-00045" summary="add con_to_dict in import for write PreSharedKey in .key File to warning if tunnel has already been imported and delete that the key is deleted again">
<option name="closed" value="true" />
<created>1726959423800</created>
<option name="number" value="00045" />
<option name="presentableId" value="LOCAL-00045" />
<option name="project" value="LOCAL" />
<updated>1726959423800</updated>
</task>
<task id="LOCAL-00046" summary="add con_to_dict in import for write PreSharedKey in .key File to warning if tunnel has already been imported and delete that the key is deleted again&#10;now works">
<option name="closed" value="true" />
<created>1727015078922</created>
<option name="number" value="00046" />
<option name="presentableId" value="LOCAL-00046" />
<option name="project" value="LOCAL" />
<updated>1727015078922</updated>
</task>
<task id="LOCAL-00047" summary="Descriptions added in wg_func-py">
<option name="closed" value="true" />
<created>1727018233930</created>
<option name="number" value="00047" />
<option name="presentableId" value="LOCAL-00047" />
<option name="project" value="LOCAL" />
<updated>1727018233930</updated>
</task>
<task id="LOCAL-00048" summary="If tunnel is renamed and this is in the car start,&#10;is now renamed the label">
<option name="closed" value="true" />
<created>1727028762875</created>
<option name="number" value="00048" />
<option name="presentableId" value="LOCAL-00048" />
<option name="project" value="LOCAL" />
<updated>1727028762875</updated>
</task>
<task id="LOCAL-00049" summary="fix scrollbar view with set self.y_height = 330 to self.y_height = 340">
<option name="closed" value="true" />
<created>1727028915701</created>
<option name="number" value="00049" />
<option name="presentableId" value="LOCAL-00049" />
<option name="project" value="LOCAL" />
<updated>1727028915701</updated>
</task>
<task id="LOCAL-00050" summary="in msg_window two further parameters to be added to the pass, so height and wide can also be specified.&#10;In rename, messages come now if new names do not fit&#10;Fix Index Error on msg_window()">
<option name="closed" value="true" />
<created>1727118598759</created>
<option name="number" value="00050" />
<option name="presentableId" value="LOCAL-00050" />
<option name="project" value="LOCAL" />
<updated>1727118598760</updated>
</task>
<task id="LOCAL-00051" summary="ad max 12-character message, no character message and special_characters message for entry label">
<option name="closed" value="true" />
<created>1727288788988</created>
<option name="number" value="00051" />
<option name="presentableId" value="LOCAL-00051" />
<option name="project" value="LOCAL" />
<updated>1727288788988</updated>
</task>
<task id="LOCAL-00052" summary="info icon shadow fix end msg Export fix to">
<option name="closed" value="true" />
<created>1727347126769</created>
<option name="number" value="00052" />
<option name="presentableId" value="LOCAL-00052" />
<option name="project" value="LOCAL" />
<updated>1727347126769</updated>
</task>
<task id="LOCAL-00053" summary="little fixes">
<option name="closed" value="true" />
<created>1727378355274</created>
<option name="number" value="00053" />
<option name="presentableId" value="LOCAL-00053" />
<option name="project" value="LOCAL" />
<updated>1727378355275</updated>
</task>
<task id="LOCAL-00054" summary="fix msg_boxes when tunnel list = 0 a Start, Delete and Export">
<option name="closed" value="true" />
<created>1727379755537</created>
<option name="number" value="00054" />
<option name="presentableId" value="LOCAL-00054" />
<option name="project" value="LOCAL" />
<updated>1727379755537</updated>
</task>
<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>
<task id="LOCAL-00056" summary="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.&#10;Start with version number 1.4.7&#10;Message window size corrected so text is displayed better">
<option name="closed" value="true" />
<created>1727525609727</created>
<option name="number" value="00056" />
<option name="presentableId" value="LOCAL-00056" />
<option name="project" value="LOCAL" />
<updated>1727525609728</updated>
</task>
<task id="LOCAL-00057" summary="Fix msg_window and remove x , y argument&#10;Install further adapted and with colored&#10;text if user is not in group sudo or wheel.&#10;Added to install Opensuse for installation">
<option name="closed" value="true" />
<created>1728059870005</created>
<option name="number" value="00057" />
<option name="presentableId" value="LOCAL-00057" />
<option name="project" value="LOCAL" />
<updated>1728059870005</updated>
</task>
<task id="LOCAL-00058" summary=" - Menu add &#10; - New Modern Dark and Light(default) Theme">
<option name="closed" value="true" />
<created>1729103964804</created>
<option name="number" value="00058" />
<option name="presentableId" value="LOCAL-00058" />
<option name="project" value="LOCAL" />
<updated>1729103964804</updated>
</task>
<task id="LOCAL-00059" summary=" - Theme modify to water-theme&#10; - add ttk.Menubutton vor modern Menu and automatic theme and textvariable for color on font in menu">
<option name="closed" value="true" />
<created>1729283656386</created>
<option name="number" value="00059" />
<option name="presentableId" value="LOCAL-00059" />
<option name="project" value="LOCAL" />
<updated>1729283656387</updated>
</task>
<task id="LOCAL-00060" summary=" - Theme modify to water-theme&#10; - add ttk.Menubutton vor modern Menu and automatic theme and textvariable for color on font in menu">
<option name="closed" value="true" />
<created>1729283719951</created>
<option name="number" value="00060" />
<option name="presentableId" value="LOCAL-00060" />
<option name="project" value="LOCAL" />
<updated>1729283719951</updated>
</task>
<task id="LOCAL-00061" summary=" - Add Options, Help, Update Label and Update Menubutton &#10; - Theme now separate Light and Dark">
<option name="closed" value="true" />
<created>1729353898829</created>
<option name="number" value="00061" />
<option name="presentableId" value="LOCAL-00061" />
<option name="project" value="LOCAL" />
<updated>1729353898830</updated>
</task>
<task id="LOCAL-00062" summary="- Optimize Class. Move to wg_main Import Start/StopBTN and Tooltip">
<option name="closed" value="true" />
<created>1729541504291</created>
<option name="number" value="00062" />
<option name="presentableId" value="LOCAL-00062" />
<option name="project" value="LOCAL" />
<updated>1729541504292</updated>
</task>
<task id="LOCAL-00063" summary="- Optimize Class. Move to wg_main Import Start/StopBTN and Tooltip">
<option name="closed" value="true" />
<created>1729541561434</created>
<option name="number" value="00063" />
<option name="presentableId" value="LOCAL-00063" />
<option name="project" value="LOCAL" />
<updated>1729541561434</updated>
</task>
<task id="LOCAL-00064" summary="- Optimize Class. Move to wg_main Import Start/StopBTN and Tooltip">
<option name="closed" value="true" />
<created>1729593628907</created>
<option name="number" value="00064" />
<option name="presentableId" value="LOCAL-00064" />
<option name="project" value="LOCAL" />
<updated>1729593628908</updated>
</task>
<task id="LOCAL-00065" summary="- Optimize Class and Tooltip">
<option name="closed" value="true" />
<created>1729938941026</created>
<option name="number" value="00065" />
<option name="presentableId" value="LOCAL-00065" />
<option name="project" value="LOCAL" />
<updated>1729938941027</updated>
</task>
<task id="LOCAL-00066" summary="- methods from class MainWindow move to class FrameWidgets for active color_label when theme change&#10;- optimize columnconfigure, rowconfigure in class MainWindow and FrameWidgets&#10;- add new Frame for Widgets on Bottom&#10;- optimize from tkinter * to from tkinter import filedialog, ttk, TclError">
<option name="closed" value="true" />
<created>1731097309468</created>
<option name="number" value="00066" />
<option name="presentableId" value="LOCAL-00066" />
<option name="project" value="LOCAL" />
<updated>1731097309468</updated>
</task>
<task id="LOCAL-00067" summary="- methods from class MainWindow move to class FrameWidgets for active color_label when theme change&#10;- optimize columnconfigure, rowconfigure in class MainWindow and FrameWidgets&#10;- add new Frame for Widgets on Bottom&#10;- optimize from tkinter * to from tkinter import filedialog, ttk, TclError">
<option name="closed" value="true" />
<created>1731097969343</created>
<option name="number" value="00067" />
<option name="presentableId" value="LOCAL-00067" />
<option name="project" value="LOCAL" />
<updated>1731097969344</updated>
</task>
<task id="LOCAL-00068" summary="- methods from class MainWindow move to class FrameWidgets for active color_label when theme change&#10;- optimize columnconfigure, rowconfigure in class MainWindow and FrameWidgets&#10;- add new Frame for Widgets on Bottom&#10;- optimize from tkinter * to from tkinter import filedialog, ttk, TclError">
<option name="closed" value="true" />
<created>1731098372497</created>
<option name="number" value="00068" />
<option name="presentableId" value="LOCAL-00068" />
<option name="project" value="LOCAL" />
<updated>1731098372497</updated>
</task>
<task id="LOCAL-00069" summary=" - - Fix Checkbutton Autostart when first install Wire-Py">
<option name="closed" value="true" />
<created>1731690583059</created>
<option name="number" value="00069" />
<option name="presentableId" value="LOCAL-00069" />
<option name="project" value="LOCAL" />
<updated>1731690583060</updated>
</task>
<task id="LOCAL-00070" summary=" - - Fix Checkbutton Autostart when first install Wire-Py">
<option name="closed" value="true" />
<created>1731836942211</created>
<option name="number" value="00070" />
<option name="presentableId" value="LOCAL-00070" />
<option name="project" value="LOCAL" />
<updated>1731836942212</updated>
</task>
<task id="LOCAL-00071" summary=" - Update Translate Files">
<option name="closed" value="true" />
<created>1731840048762</created>
<option name="number" value="00071" />
<option name="presentableId" value="LOCAL-00071" />
<option name="project" value="LOCAL" />
<updated>1731840048763</updated>
</task>
<task id="LOCAL-00072" summary=" - Update Translate Files">
<option name="closed" value="true" />
<created>1731840089956</created>
<option name="number" value="00072" />
<option name="presentableId" value="LOCAL-00072" />
<option name="project" value="LOCAL" />
<updated>1731840089956</updated>
</task>
<task id="LOCAL-00073" summary=" - Update Translate Files">
<option name="closed" value="true" />
<created>1731840188277</created>
<option name="number" value="00073" />
<option name="presentableId" value="LOCAL-00073" />
<option name="project" value="LOCAL" />
<updated>1731840188278</updated>
</task>
<task id="LOCAL-00074" summary=" - Update Translate Files">
<option name="closed" value="true" />
<created>1731840383592</created>
<option name="number" value="00074" />
<option name="presentableId" value="LOCAL-00074" />
<option name="project" value="LOCAL" />
<updated>1731840383592</updated>
</task>
<task id="LOCAL-00075" summary=" - Update Translate Files">
<option name="closed" value="true" />
<created>1731841930614</created>
<option name="number" value="00075" />
<option name="presentableId" value="LOCAL-00075" />
<option name="project" value="LOCAL" />
<updated>1731841930615</updated>
</task>
<task id="LOCAL-00076" summary=" - Update Translate Files">
<option name="closed" value="true" />
<created>1731844213239</created>
<option name="number" value="00076" />
<option name="presentableId" value="LOCAL-00076" />
<option name="project" value="LOCAL" />
<updated>1731844213239</updated>
</task>
<task id="LOCAL-00077" summary=" - Update Translate Files">
<option name="closed" value="true" />
<created>1731844339039</created>
<option name="number" value="00077" />
<option name="presentableId" value="LOCAL-00077" />
<option name="project" value="LOCAL" />
<updated>1731844339039</updated>
</task>
<option name="localTasksCounter" value="78" />
<servers />
</component>
<component name="UnknownFeatures">
<option featureType="com.intellij.fileTypeFactory" implementationName="*.policy" />
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State>
<option name="FILTERS">
<map>
<entry key="branch">
<value>
<list>
<option value="1.11.0824" />
</list>
</value>
</entry>
</map>
</option>
</State>
</value>
</entry>
</map>
</option>
</component>
<component name="VcsManagerConfiguration">
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
<MESSAGE value="replace tar with zip and Check if Zip file is empty" />
<MESSAGE value="Create your own message boxes for export" />
<MESSAGE value="chown Export File to 1000:1000" />
<MESSAGE value="add rename Label rename works" />
<MESSAGE value="add con_to_dict in import for write PreSharedKey in .key File to warning if tunnel has already been imported and delete that the key is deleted again" />
<MESSAGE value="add con_to_dict in import for write PreSharedKey in .key File to warning if tunnel has already been imported and delete that the key is deleted again&#10;now works" />
<MESSAGE value="Descriptions added in wg_func-py" />
<MESSAGE value="If tunnel is renamed and this is in the car start,&#10;is now renamed the label" />
<MESSAGE value="fix scrollbar view with set self.y_height = 330 to self.y_height = 340" />
<MESSAGE value="in msg_window two further parameters to be added to the pass, so height and wide can also be specified.&#10;In rename, messages come now if new names do not fit&#10;Fix Index Error on msg_window()" />
<MESSAGE value="ad max 12-character message, no character message and special_characters message for entry label" />
<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" />
<MESSAGE value="fix installer add .keys file" />
<MESSAGE value="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.&#10;Start with version number 1.4.7&#10;Message window size corrected so text is displayed better" />
<MESSAGE value="Fix msg_window and remove x , y argument&#10;Install further adapted and with colored&#10;text if user is not in group sudo or wheel.&#10;Added to install Opensuse for installation" />
<MESSAGE value=" - Menu add &#10; - New Modern Dark and Light(default) Theme" />
<MESSAGE value=" - Theme modify to water-theme&#10; - add ttk.Menubutton vor modern Menu and automatic theme and textvariable for color on font in menu" />
<MESSAGE value=" - Add Options, Help, Update Label and Update Menubutton &#10; - Theme now separate Light and Dark" />
<MESSAGE value="- Optimize Class. Move to wg_main Import Start/StopBTN and Tooltip" />
<MESSAGE value="- Optimize Class and Tooltip" />
<MESSAGE value="- methods from class MainWindow move to class FrameWidgets for active color_label when theme change&#10;- optimize columnconfigure, rowconfigure in class MainWindow and FrameWidgets&#10;- add new Frame for Widgets on Bottom&#10;- optimize from tkinter * to from tkinter import filedialog, ttk, TclError" />
<MESSAGE value=" - - Fix Checkbutton Autostart when first install Wire-Py" />
<MESSAGE value=" - Update Translate Files" />
<option name="LAST_COMMIT_MESSAGE" value=" - Update Translate Files" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/wg_main.py</url>
<line>1128</line>
<option name="timeStamp" value="3" />
</line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/ssl_decrypt.py</url>
<line>3</line>
<option name="timeStamp" value="4" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
</component>
</project>

View File

@ -1,6 +0,0 @@
{
"workbench.settings.openDefaultSettings": true
"workbench.startupEditor": "none"
"update.showReleaseNotes": false
"terminal.integrated.fontSize": 18
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,7 +1,5 @@
""" Classes Method and Functions for lx Apps """ """ Classes Method and Functions for lx Apps """
import gettext
import locale
import os import os
import shutil import shutil
import signal import signal
@ -20,6 +18,7 @@ import requests
# Translate # Translate
_ = AppConfig.setup_translations() _ = AppConfig.setup_translations()
class Create: class Create:
""" """
This class is for the creation of the folders and files This class is for the creation of the folders and files
@ -43,7 +42,9 @@ class Create:
else: else:
sett.touch() sett.touch()
sett.write_text("[UPDATES]\non\n[THEME]\nlight\n[TOOLTIP]\nTrue\n[AUTOSTART ON]\noff\n") sett.write_text(
"[UPDATES]\non\n[THEME]\nlight\n[TOOLTIP]\nTrue\n[AUTOSTART ON]\noff\n"
)
if AppConfig.KEYS_FILE.exists(): if AppConfig.KEYS_FILE.exists():
pass pass
@ -66,9 +67,11 @@ class Create:
else: else:
wg_ser.touch() wg_ser.touch()
wg_ser.write_text("[Unit]\nDescription=Automatic Tunnel Start\nAfter=network-online.target\n\n[Service]\n" wg_ser.write_text(
"Type=oneshot\nExecStartPre=/bin/sleep 5\nExecStart=/usr/local/bin/start_wg.py\n[Install]" "[Unit]\nDescription=Automatic Tunnel Start\nAfter=network-online.target\n\n[Service]\n"
"\nWantedBy=default.target") "Type=oneshot\nExecStartPre=/bin/sleep 5\nExecStart=/usr/local/bin/start_wg.py\n[Install]"
"\nWantedBy=default.target"
)
check_call(["systemctl", "--user", "enable", "wg_start.service"]) check_call(["systemctl", "--user", "enable", "wg_start.service"])
@staticmethod @staticmethod
@ -85,13 +88,18 @@ class Create:
""" """
Starts SSL dencrypt Starts SSL dencrypt
""" """
process: CompletedProcess[str] = subprocess.run(["pkexec", "/usr/local/bin/ssl_decrypt.py"], process: CompletedProcess[str] = subprocess.run(
stdout=subprocess.PIPE, text=True, check=True) ["pkexec", "/usr/local/bin/ssl_decrypt.py"],
stdout=subprocess.PIPE,
text=True,
check=True,
)
path: Path = Path.home() / ".config/wire_py/" path: Path = Path.home() / ".config/wire_py/"
file_in_path: list[Path] = list(path.rglob("*.dat")) file_in_path: list[Path] = list(path.rglob("*.dat"))
if file_in_path: if file_in_path:
if process.returncode == 0: if process.returncode == 0:
print("File successfully decrypted...") print("File successfully decrypted...")
else: else:
print(f"Error with the following code... {process.returncode}") print(f"Error with the following code... {process.returncode}")
else: else:
@ -102,8 +110,12 @@ class Create:
""" """
Starts SSL encryption Starts SSL encryption
""" """
process: CompletedProcess[str] = subprocess.run(["pkexec", "/usr/local/bin/ssl_encrypt.py"], process: CompletedProcess[str] = subprocess.run(
stdout=subprocess.PIPE, text=True, check=True) ["pkexec", "/usr/local/bin/ssl_encrypt.py"],
stdout=subprocess.PIPE,
text=True,
check=True,
)
print(process.stdout) print(process.stdout)
if process.returncode == 0: if process.returncode == 0:
print("All Files successfully encrypted...") print("All Files successfully encrypted...")
@ -119,6 +131,94 @@ class LxTools(tk.Tk):
def __init__(self, *args: Any, **kwargs: Any) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
@staticmethod
def center_window_cross_platform(window, width, height):
"""
Centers a window on the primary monitor in a way that works on both X11 and Wayland
Args:
window: The tkinter window to center
width: Window width
height: Window height
"""
# Calculate the position before showing the window
# First attempt: Try to use GDK if available (works on both X11 and Wayland)
try:
import gi
gi.require_version("Gdk", "3.0")
from gi.repository import Gdk
display = Gdk.Display.get_default()
monitor = display.get_primary_monitor() or display.get_monitor(0)
geometry = monitor.get_geometry()
scale_factor = monitor.get_scale_factor()
# Calculate center position on primary monitor
x = geometry.x + (geometry.width - width // scale_factor) // 2
y = geometry.y + (geometry.height - height // scale_factor) // 2
# Set window geometry
window.geometry(f"{width}x{height}+{x}+{y}")
return
except (ImportError, AttributeError):
pass
# Second attempt: Try xrandr for X11
try:
import subprocess
output = subprocess.check_output(
["xrandr", "--query"], universal_newlines=True
)
# Parse the output to find the primary monitor
primary_info = None
for line in output.splitlines():
if "primary" in line:
parts = line.split()
for part in parts:
if "x" in part and "+" in part:
primary_info = part
break
break
if primary_info:
# Parse the geometry: WIDTHxHEIGHT+X+Y
geometry = primary_info.split("+")
dimensions = geometry[0].split("x")
primary_width = int(dimensions[0])
primary_height = int(dimensions[1])
primary_x = int(geometry[1])
primary_y = int(geometry[2])
# Calculate center position on primary monitor
x = primary_x + (primary_width - width) // 2
y = primary_y + (primary_height - height) // 2
# Set window geometry
window.geometry(f"{width}x{height}+{x}+{y}")
return
except (subprocess.SubprocessError, ImportError, IndexError, ValueError):
pass
# Final fallback: Use standard Tkinter method
screen_width = window.winfo_screenwidth()
screen_height = window.winfo_screenheight()
# Try to make an educated guess for multi-monitor setups
# If screen width is much larger than height, assume multiple monitors side by side
if (
screen_width > screen_height * 1.8
): # Heuristic for detecting multiple monitors
# Assume primary monitor is on the left half
screen_width = screen_width // 2
x = (screen_width - width) // 2
y = (screen_height - height) // 2
window.geometry(f"{width}x{height}+{x}+{y}")
@staticmethod @staticmethod
def get_file_name(path: Path, i: int = 5) -> List[str]: def get_file_name(path: Path, i: int = 5) -> List[str]:
""" """
@ -145,16 +245,26 @@ class LxTools(tk.Tk):
return lists_file return lists_file
@staticmethod @staticmethod
def uos() -> None: def get_username() -> str:
""" """
uos = LOGIN USERNAME Returns the username of the logged-in user,
even if the script is running with root privileges.
"""
try:
result = subprocess.run(
["logname"],
stdout=subprocess.PIPE,
text=True,
check=True,
)
if result.returncode != 0:
exit(1)
else:
print(result.stdout.strip())
return result.stdout.strip()
This method displays the username of the logged-in user, except subprocess.CalledProcessError:
even if you are rooted in a shell pass
"""
log_name: str = f"{Path.home()}"[6:]
file: Path = Path.home() / "/tmp/.log_user"
Path(file).write_text(log_name, encoding="utf-8")
@staticmethod @staticmethod
def clean_files(TEMP_DIR: Path = None, file: Path = None) -> None: def clean_files(TEMP_DIR: Path = None, file: Path = None) -> None:
@ -166,12 +276,22 @@ class LxTools(tk.Tk):
""" """
if AppConfig.TEMP_DIR is not None: if AppConfig.TEMP_DIR is not None:
shutil.rmtree(AppConfig.TEMP_DIR) shutil.rmtree(AppConfig.TEMP_DIR)
if file is not None: try:
Path.unlink(file) if file is not None:
Path.unlink(file)
except FileNotFoundError:
pass
@staticmethod @staticmethod
def msg_window(image_path: Path, image_path2: Path, w_title: str, w_txt: str, txt2: Optional[str] = None, def msg_window(
com: Optional[str] = None) -> None: image_path: Path,
image_path2: Path,
w_title: str,
w_txt: str,
txt2: Optional[str] = None,
com: Optional[str] = None,
) -> None:
""" """
Creates message windows Creates message windows
@ -186,29 +306,44 @@ class LxTools(tk.Tk):
msg.resizable(width=False, height=False) msg.resizable(width=False, height=False)
msg.title(w_title) msg.title(w_title)
msg.configure(pady=15, padx=15) msg.configure(pady=15, padx=15)
msg.img = tk.PhotoImage(file=AppConfig.IMAGE_PATHS["icon_info"])
msg.i_window = tk.Label(msg, image=msg.img) # Lade das erste Bild für das Fenster
try:
msg.img = tk.PhotoImage(file=image_path)
msg.i_window = tk.Label(msg, image=msg.img)
except Exception as e:
print(f"Fehler beim Laden des Fensterbildes: {e}")
msg.i_window = tk.Label(msg, text="Bild nicht gefunden")
label: tk.Label = tk.Label(msg, text=w_txt) label: tk.Label = tk.Label(msg, text=w_txt)
label.grid(column=1, row=0) label.grid(column=1, row=0)
if txt2 is not None and com is not None: if txt2 is not None and com is not None:
label.config(font=("Ubuntu", 11), padx=15, justify="left") label.config(font=("Ubuntu", 11), padx=15, justify="left")
msg.i_window.grid(column=0, row=0, sticky="nw") msg.i_window.grid(column=0, row=0, sticky="nw")
button2: ttk.Button = ttk.Button(msg, text=f"{txt2}", command=com, padding=4) button2: ttk.Button = ttk.Button(
msg, text=f"{txt2}", command=com, padding=4
)
button2.grid(column=0, row=1, sticky="e", columnspan=2) button2.grid(column=0, row=1, sticky="e", columnspan=2)
button: ttk.Button = ttk.Button(msg, text="OK", command=msg.destroy, padding=4) button: ttk.Button = ttk.Button(
msg, text="OK", command=msg.destroy, padding=4
)
button.grid(column=0, row=1, sticky="w", columnspan=2) button.grid(column=0, row=1, sticky="w", columnspan=2)
else: else:
label.config(font=("Ubuntu", 11), padx=15) label.config(font=("Ubuntu", 11), padx=15)
msg.i_window.grid(column=0, row=0) msg.i_window.grid(column=0, row=0)
button: ttk.Button = ttk.Button(msg, text="OK", command=msg.destroy, padding=4) button: ttk.Button = ttk.Button(
msg, text="OK", command=msg.destroy, padding=4
)
button.grid(column=0, columnspan=2, row=1) button.grid(column=0, columnspan=2, row=1)
AppConfig.IMAGE_PATHS["icon_vpn"]: tk.PhotoImage = tk.PhotoImage(file=AppConfig.IMAGE_PATHS["icon_vpn"]) # Lade das Icon für das Fenster
msg.iconphoto(True, AppConfig.IMAGE_PATHS["icon_vpn"]) try:
icon = tk.PhotoImage(file=image_path2)
msg.iconphoto(True, icon)
except Exception as e:
print(f"Fehler beim Laden des Fenstericons: {e}")
msg.columnconfigure(0, weight=1) msg.columnconfigure(0, weight=1)
msg.rowconfigure(0, weight=1) msg.rowconfigure(0, weight=1)
msg.winfo_toplevel() msg.winfo_toplevel()
@ -234,15 +369,22 @@ class LxTools(tk.Tk):
NoReturn since the function either exits the program or continues execution NoReturn since the function either exits the program or continues execution
""" """
signals_to_names_dict: Dict[int, str] = dict((getattr(signal, n), n) for n in dir(signal) signals_to_names_dict: Dict[int, str] = dict(
if n.startswith("SIG") and "_" not in n) (getattr(signal, n), n)
for n in dir(signal)
if n.startswith("SIG") and "_" not in n
)
signal_name: str = signals_to_names_dict.get(signum, f"Unnamed signal: {signum}") signal_name: str = signals_to_names_dict.get(
signum, f"Unnamed signal: {signum}"
)
# End program for certain signals, report to others only reception # End program for certain signals, report to others only reception
if signum in (signal.SIGINT, signal.SIGTERM): if signum in (signal.SIGINT, signal.SIGTERM):
exit_code: int = 1 exit_code: int = 1
print(f"\nSignal {signal_name} {signum} received. => Aborting with exit code {exit_code}.") print(
f"\nSignal {signal_name} {signum} received. => Aborting with exit code {exit_code}."
)
LxTools.clean_files(file_path, file) LxTools.clean_files(file_path, file)
print("Breakdown by user...") print("Breakdown by user...")
sys.exit(exit_code) sys.exit(exit_code)
@ -260,7 +402,57 @@ class LxTools(tk.Tk):
class Tunnel: class Tunnel:
""" """
Class of Methods for Wire-Py Class of Methods for Wire-Py
""" """
@staticmethod
def parse_files_to_dictionary() -> Dict[str, List[str]]:
data = {}
if not AppConfig.TEMP_DIR.exists() or not AppConfig.TEMP_DIR.is_dir():
pass
# Get a list of all files in the directorys
files = [file for file in AppConfig.TEMP_DIR.iterdir() if file.is_file()]
if not files:
pass
# Search for the string in the files
for file in files:
try:
with open(file, "r") as f:
content = f.read()
# Hier parsen wir die relevanten Zeilen aus dem Inhalt
address_line = next(
line
for line in content.splitlines()
if line.startswith("Address")
)
dns_line = next(
line for line in content.splitlines() if line.startswith("DNS")
)
endpoint_line = next(
line
for line in content.splitlines()
if line.startswith("Endpoint")
)
# Extrahiere die Werte
address = address_line.split("=")[1].strip()
dns = dns_line.split("=")[1].strip()
endpoint = endpoint_line.split("=")[1].strip()
# Speichere im Dictionary
data[file.stem] = {
"Address": address,
"DNS": dns,
"Endpoint": endpoint,
}
except Exception:
# Ignore errors and continue to the next file
continue
return data
@classmethod @classmethod
def con_to_dict(cls, file: TextIO) -> Tuple[str, str, str, Optional[str]]: def con_to_dict(cls, file: TextIO) -> Tuple[str, str, str, Optional[str]]:
""" """
@ -311,7 +503,11 @@ class Tunnel:
""" """
Shows the Active Tunnel Shows the Active Tunnel
""" """
active = (os.popen('nmcli con show --active | grep -iPo "(.*)(wireguard)"').read().split()) active = (
os.popen('nmcli con show --active | grep -iPo "(.*)(wireguard)"')
.read()
.split()
)
if not active: if not active:
active = "" active = ""
else: else:
@ -330,8 +526,14 @@ class Tunnel:
return wg_s return wg_s
@staticmethod @staticmethod
def export(image_path: Path = None, image_path2: Path = None, image_path3: Path = None, image_path4: Path = None, def export(
title: Dict = None, window_msg: Dict = None) -> None: image_path: Path = None,
image_path2: Path = None,
image_path3: Path = None,
image_path4: Path = None,
title: Dict = None,
window_msg: Dict = None,
) -> None:
""" """
This will export the tunnels. This will export the tunnels.
A zipfile with the current date and time is created A zipfile with the current date and time is created
@ -356,15 +558,30 @@ class Tunnel:
with zipfile.ZipFile(f"{wg_tar}.zip", "r") as zf: with zipfile.ZipFile(f"{wg_tar}.zip", "r") as zf:
if len(zf.namelist()) != 0: if len(zf.namelist()) != 0:
LxTools.msg_window(AppConfig.IMAGE_PATHS["icon_info"], AppConfig.IMAGE_PATHS["icon_vpn"], Msg.STR["exp_succ"], Msg.STR["exp_in_home"]) LxTools.msg_window(
AppConfig.IMAGE_PATHS["icon_info"],
AppConfig.IMAGE_PATHS["icon_vpn"],
Msg.STR["exp_succ"],
Msg.STR["exp_in_home"],
)
else: else:
LxTools.msg_window(AppConfig.IMAGE_PATHS["icon_error"], AppConfig.IMAGE_PATHS["icon_msg"], Msg.STR["exp_err"], Msg.STR["exp_try"]) LxTools.msg_window(
AppConfig.IMAGE_PATHS["icon_error"],
AppConfig.IMAGE_PATHS["icon_msg"],
Msg.STR["exp_err"],
Msg.STR["exp_try"],
)
else: else:
LxTools.msg_window(AppConfig.IMAGE_PATHS["icon_info"], AppConfig.IMAGE_PATHS["icon_msg"], Msg.STR["sel_tl"], Msg.STR["tl_first"]) LxTools.msg_window(
AppConfig.IMAGE_PATHS["icon_info"],
AppConfig.IMAGE_PATHS["icon_msg"],
Msg.STR["sel_tl"],
Msg.STR["tl_first"],
)
except TypeError: except TypeError:
pass pass
@ -376,15 +593,16 @@ class ConfigManager:
Universal class for managing configuration files with caching. Universal class for managing configuration files with caching.
Can be reused in different projects. Can be reused in different projects.
""" """
_config = None _config = None
_config_file = None _config_file = None
@classmethod @classmethod
def init(cls, config_file): def init(cls, config_file):
"""Initial the Configmanager with the given config file""" """Initial the Configmanager with the given config file"""
cls._config_file = config_file cls._config_file = config_file
cls._config = None # Reset the cache cls._config = None # Reset the cache
@classmethod @classmethod
def load(cls): def load(cls):
"""Load the config file and return the config as dict""" """Load the config file and return the config as dict"""
@ -392,44 +610,45 @@ class ConfigManager:
try: try:
lines = Path(cls._config_file).read_text(encoding="utf-8").splitlines() lines = Path(cls._config_file).read_text(encoding="utf-8").splitlines()
cls._config = { cls._config = {
'updates': lines[1].strip(), "updates": lines[1].strip(),
'theme': lines[3].strip(), "theme": lines[3].strip(),
'tooltips': lines[5].strip() == "True", # is converted here to boolean!!! "tooltips": lines[5].strip()
'autostart': lines[7].strip() if len(lines) > 7 else 'off' == "True", # is converted here to boolean!!!
"autostart": lines[7].strip() if len(lines) > 7 else "off",
} }
except (IndexError, FileNotFoundError): except (IndexError, FileNotFoundError):
# DeDefault values in case of error # DeDefault values in case of error
cls._config = { cls._config = {
'updates': 'on', "updates": "on",
'theme': 'light', "theme": "light",
'tooltips': "True", # Default Value as string ! "tooltips": "True", # Default Value as string !
'autostart': 'off' "autostart": "off",
} }
return cls._config return cls._config
@classmethod @classmethod
def save(cls): def save(cls):
"""Save the config to the config file""" """Save the config to the config file"""
if cls._config: if cls._config:
lines = [ lines = [
'# Configuration\n', "# Configuration\n",
f"{cls._config['updates']}\n", f"{cls._config['updates']}\n",
'# Theme\n', "# Theme\n",
f"{cls._config['theme']}\n", f"{cls._config['theme']}\n",
'# Tooltips\n', "# Tooltips\n",
f"{str(cls._config['tooltips'])}\n", f"{str(cls._config['tooltips'])}\n",
'# Autostart\n', "# Autostart\n",
f"{cls._config['autostart']}\n" f"{cls._config['autostart']}\n",
] ]
Path(cls._config_file).write_text(''.join(lines), encoding="utf-8") Path(cls._config_file).write_text("".join(lines), encoding="utf-8")
@classmethod @classmethod
def set(cls, key, value): def set(cls, key, value):
"""Sets a configuration value and saves the change""" """Sets a configuration value and saves the change"""
cls.load() cls.load()
cls._config[key] = value cls._config[key] = value
cls.save() cls.save()
@classmethod @classmethod
def get(cls, key, default=None): def get(cls, key, default=None):
"""Returns a configuration value""" """Returns a configuration value"""
@ -462,42 +681,48 @@ class GiteaUpdate:
update_api_url: Update API URL update_api_url: Update API URL
version: Current version version: Current version
update_setting: Update setting from ConfigManager (on/off) update_setting: Update setting from ConfigManager (on/off)
Returns: Returns:
New version or status message New version or status message
""" """
# If updates are disabled, return immediately # If updates are disabled, return immediately
if update_setting != "on": if update_setting != "on":
return "False" return "False"
try: try:
response: requests.Response = requests.get(update_api_url, timeout=10) response: requests.Response = requests.get(update_api_url, timeout=10)
response.raise_for_status() # Raise exception for HTTP errors response.raise_for_status() # Raise exception for HTTP errors
response_data = response.json() response_data = response.json()
if not response_data: if not response_data:
return "No Updates" return "No Updates"
latest_version = response_data[0].get("tag_name") latest_version = response_data[0].get("tag_name")
if not latest_version: if not latest_version:
return "Invalid API Response" return "Invalid API Response"
# Compare versions (strip 'v. ' prefix if present) # Compare versions (strip 'v. ' prefix if present)
current_version = version[3:] if version.startswith("v. ") else version current_version = version[3:] if version.startswith("v. ") else version
if current_version != latest_version: if current_version != latest_version:
return latest_version return latest_version
else: else:
return "No Updates" return "No Updates"
except requests.exceptions.RequestException: except requests.exceptions.RequestException:
return "No Internet Connection!" return "No Internet Connection!"
except (ValueError, KeyError, IndexError): except (ValueError, KeyError, IndexError):
return "Invalid API Response" return "Invalid API Response"
@staticmethod @staticmethod
def download(urld: str, res: str, image_path: Path = None, image_path2: Path = None, image_path3: Path = None, def download(
image_path4: Path = None) -> None: urld: str,
res: str,
image_path: Path = None,
image_path2: Path = None,
image_path3: Path = None,
image_path4: Path = None,
) -> None:
""" """
Downloads new version of wirepy Downloads new version of wirepy
@ -517,87 +742,117 @@ class GiteaUpdate:
wt: str = _("Download Successful") wt: str = _("Download Successful")
msg_t: str = _("Your zip file is in home directory") msg_t: str = _("Your zip file is in home directory")
LxTools.msg_window(AppConfig.IMAGE_PATHS["icon_info"], AppConfig.IMAGE_PATHS["icon_vpn"], wt, msg_t) LxTools.msg_window(
AppConfig.IMAGE_PATHS["icon_info"],
AppConfig.IMAGE_PATHS["icon_vpn"],
wt,
msg_t,
)
else: else:
wt: str = _("Download error") wt: str = _("Download error")
msg_t: str = _("Download failed! Please try again") msg_t: str = _("Download failed! Please try again")
LxTools.msg_window(AppConfig.IMAGE_PATHS["icon_error"], AppConfig.IMAGE_PATHS["icon_msg"], wt, msg_t) LxTools.msg_window(
AppConfig.IMAGE_PATHS["icon_error"],
AppConfig.IMAGE_PATHS["icon_msg"],
wt,
msg_t,
)
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
wt: str = _("Download error") wt: str = _("Download error")
msg_t: str = _("Download failed! No internet connection!") msg_t: str = _("Download failed! No internet connection!")
LxTools.msg_window(AppConfig.IMAGE_PATHS["icon_error"], AppConfig.IMAGE_PATHS["icon_msg"], wt, msg_t) LxTools.msg_window(
AppConfig.IMAGE_PATHS["icon_error"],
AppConfig.IMAGE_PATHS["icon_msg"],
wt,
msg_t,
)
class Tooltip(): class Tooltip:
"""Class for Tooltip """Class for Tooltip
from common_tools.py import Tooltip from common_tools.py import Tooltip
example: Tooltip(label, "Show tooltip on label") example: Tooltip(label, "Show tooltip on label")
example: Tooltip(button, "Show tooltip on button") example: Tooltip(button, "Show tooltip on button")
example: Tooltip(widget, "Text", state_var=tk.BooleanVar()) example: Tooltip(widget, "Text", state_var=tk.BooleanVar())
example: Tooltip(widget, "Text", state_var=tk.BooleanVar(), x_offset=20, y_offset=10)
info: label and button are parent widgets. info: label and button are parent widgets.
NOTE: When using with state_var, pass the tk.BooleanVar object directly, NOTE: When using with state_var, pass the tk.BooleanVar object directly,
NOT its value. For example: use state_var=my_bool_var, NOT state_var=my_bool_var.get() NOT its value. For example: use state_var=my_bool_var, NOT state_var=my_bool_var.get()
""" """
def __init__(self, widget: Any, text: str, state_var: Optional[tk.BooleanVar] = None) -> None:
def __init__(
self,
widget: Any,
text: str,
state_var: Optional[tk.BooleanVar] = None,
x_offset: int = 65,
y_offset: int = 40,
) -> None:
"""Tooltip Class""" """Tooltip Class"""
self.widget: Any = widget self.widget: Any = widget
self.text: str = text self.text: str = text
self.tooltip_window: Optional[Toplevel] = None self.tooltip_window: Optional[Toplevel] = None
self.state_var = state_var self.state_var = state_var
self.x_offset = x_offset
self.y_offset = y_offset
# Initial binding based on current state # Initial binding based on current state
self.update_bindings() self.update_bindings()
# Add trace to the state_var if provided # Add trace to the state_var if provided
if self.state_var is not None: if self.state_var is not None:
self.state_var.trace_add("write", self.update_bindings) self.state_var.trace_add("write", self.update_bindings)
def update_bindings(self, *args) -> None: def update_bindings(self, *args) -> None:
"""Updates the bindings based on the current state""" """Updates the bindings based on the current state"""
# Remove existing bindings first # Remove existing bindings first
self.widget.unbind("<Enter>") self.widget.unbind("<Enter>")
self.widget.unbind("<Leave>") self.widget.unbind("<Leave>")
# Add new bindings if tooltips are enabled # Add new bindings if tooltips are enabled
if self.state_var is None or self.state_var.get(): if self.state_var is None or self.state_var.get():
self.widget.bind("<Enter>", self.show_tooltip) self.widget.bind("<Enter>", self.show_tooltip)
self.widget.bind("<Leave>", self.hide_tooltip) self.widget.bind("<Leave>", self.hide_tooltip)
def show_tooltip(self, event: Optional[Any] = None) -> None: def show_tooltip(self, event: Optional[Any] = None) -> None:
"""Shows the tooltip""" """Shows the tooltip"""
if self.tooltip_window or not self.text: if self.tooltip_window or not self.text:
return return
x: int x: int
y: int y: int
cx: int cx: int
cy: int cy: int
x, y, cx, cy = self.widget.bbox("insert") x, y, cx, cy = self.widget.bbox("insert")
x += self.widget.winfo_rootx() + 65 x += self.widget.winfo_rootx() + self.x_offset
y += self.widget.winfo_rooty() + 40 y += self.widget.winfo_rooty() + self.y_offset
self.tooltip_window = tw = tk.Toplevel(self.widget) self.tooltip_window = tw = tk.Toplevel(self.widget)
tw.wm_overrideredirect(True) tw.wm_overrideredirect(True)
tw.wm_geometry(f"+{x}+{y}") tw.wm_geometry(f"+{x}+{y}")
label: tk.Label = tk.Label( label: tk.Label = tk.Label(
tw, text=self.text, background="lightgreen", foreground="black", tw,
relief="solid", borderwidth=1, padx=5, pady=5 text=self.text,
background="lightgreen",
foreground="black",
relief="solid",
borderwidth=1,
padx=5,
pady=5,
) )
label.grid() label.grid()
self.tooltip_window.after(2200, lambda: tw.destroy()) self.tooltip_window.after(2200, lambda: tw.destroy())
def hide_tooltip(self, event: Optional[Any] = None) -> None: def hide_tooltip(self, event: Optional[Any] = None) -> None:
"""Hides the tooltip""" """Hides the tooltip"""
if self.tooltip_window: if self.tooltip_window:
self.tooltip_window.destroy() self.tooltip_window.destroy()
self.tooltip_window = None self.tooltip_window = None

View File

@ -1,15 +0,0 @@
#!/usr/bin/python3
from pathlib import Path
from subprocess import check_call
from tkinter import filedialog, ttk
from common_tools import Create, LxTools
from wp_app_config import AppConfig, Msg
import gettext
import locale
import os
import shutil
import subprocess
from typing import Optional, Dict, Any, NoReturn, TextIO, Tuple, List
# Translate
_ = AppConfig.setup_translations()

View File

@ -6,17 +6,33 @@ import shutil
from pathlib import Path from pathlib import Path
from subprocess import check_call from subprocess import check_call
from wp_app_config import AppConfig from wp_app_config import AppConfig
import getpass
uname: Path = Path("/tmp/.log_user") log_name: str = getpass.getuser()
if log_name == "root":
log_name = Path(uname).read_text(encoding="utf-8") from common_tools import LxTools
log_name: str = LxTools.get_username()
print("replacement method applied")
keyfile: Path = Path(f"/home/{log_name}/.config/wire_py/pbwgk.pem") keyfile: Path = Path(f"/home/{log_name}/.config/wire_py/pbwgk.pem")
#PKEYFILE: Path = "/usr/local/etc/ssl/pwgk.pem"
if not keyfile.is_file(): if not keyfile.is_file():
check_call(["openssl", "rsa", "-in", AppConfig.SYSTEM_PATHS["pkey_path"], "-out", keyfile, "-outform", "PEM", "-pubout"]) check_call(
[
"openssl",
"rsa",
"-in",
AppConfig.SYSTEM_PATHS["pkey_path"],
"-out",
keyfile,
"-outform",
"PEM",
"-pubout",
]
)
shutil.chown(keyfile, 1000, 1000) shutil.chown(keyfile, 1000, 1000)
AppConfig.TEMP_DIR2 = f"/home/{log_name}/.config/wire_py/" AppConfig.TEMP_DIR2 = f"/home/{log_name}/.config/wire_py/"
@ -29,6 +45,17 @@ if os.path.exists(f"{AppConfig.TEMP_DIR2}pbwgk.pem"):
for detunnels in detl: for detunnels in detl:
tlname2 = f"{detunnels[:-4]}.conf" tlname2 = f"{detunnels[:-4]}.conf"
extpath = f"{AppConfig.TEMP_DIR}/{tlname2}" extpath = f"{AppConfig.TEMP_DIR}/{tlname2}"
check_call(["openssl", "pkeyutl", "-decrypt", "-inkey", AppConfig.SYSTEM_PATHS["pkey_path"], "-in", detunnels, check_call(
"-out", extpath]) [
"openssl",
"pkeyutl",
"-decrypt",
"-inkey",
AppConfig.SYSTEM_PATHS["pkey_path"],
"-in",
detunnels,
"-out",
extpath,
]
)
shutil.chown(extpath, 1000, 1000) shutil.chown(extpath, 1000, 1000)

View File

@ -5,18 +5,26 @@ import os
import shutil import shutil
from pathlib import Path from pathlib import Path
from subprocess import check_call from subprocess import check_call
from common_tools import LxTools
from wp_app_config import AppConfig from wp_app_config import AppConfig
from common_tools import LxTools
#uname: Path = Path("/tmp/.log_user") keyfile: Path = AppConfig.PUBLICKEY
#log_name = AppConfig.USER_FILE.read_text(encoding="utf-8")
keyfile: Path = Path(f"/home/{AppConfig.USER_FILE.read_text(encoding="utf-8")}/.config/wire_py/pbwgk.pem")
if not keyfile.is_file(): if not keyfile.is_file():
check_call(["openssl", "rsa", "-in", AppConfig.SYSTEM_PATHS["pkey_path"], "-out", keyfile, "-outform", "PEM", "-pubout"]) check_call(
[
"openssl",
"rsa",
"-in",
AppConfig.SYSTEM_PATHS["pkey_path"],
"-out",
keyfile,
"-outform",
"PEM",
"-pubout",
]
)
shutil.chown(keyfile, 1000, 1000) shutil.chown(keyfile, 1000, 1000)
if AppConfig.TEMP_DIR.exists(): if AppConfig.TEMP_DIR.exists():
@ -28,8 +36,20 @@ if not keyfile.is_file():
for tunnels in tl: for tunnels in tl:
sourcetl: str = f"{AppConfig.TEMP_DIR}/{tunnels}" sourcetl: str = f"{AppConfig.TEMP_DIR}/{tunnels}"
tlname: str = f"{CRYPTFILES}{tunnels[:-5]}.dat" tlname: str = f"{CRYPTFILES}{tunnels[:-5]}.dat"
check_call(["openssl", "pkeyutl", "-encrypt", "-inkey", keyfile, "-pubin", "-in", sourcetl, "-out", check_call(
tlname,]) [
"openssl",
"pkeyutl",
"-encrypt",
"-inkey",
keyfile,
"-pubin",
"-in",
sourcetl,
"-out",
tlname,
]
)
else: else:
@ -42,5 +62,17 @@ else:
for tunnels in tl: for tunnels in tl:
sourcetl: str = f"{AppConfig.TEMP_DIR}/{tunnels}" sourcetl: str = f"{AppConfig.TEMP_DIR}/{tunnels}"
tlname: str = f"{CRYPTFILES}{tunnels[:-5]}.dat" tlname: str = f"{CRYPTFILES}{tunnels[:-5]}.dat"
check_call(["openssl", "pkeyutl", "-encrypt", "-inkey", keyfile, "-pubin", "-in", sourcetl, "-out", check_call(
tlname]) [
"openssl",
"pkeyutl",
"-encrypt",
"-inkey",
keyfile,
"-pubin",
"-in",
sourcetl,
"-out",
tlname,
]
)

View File

@ -1,7 +1,8 @@
#!/usr/bin/python3 #!/usr/bin/python3
""" """
This script belongs to wirepy and is for the auto start of the tunnel This script belongs to wirepy and is for the auto start of the tunnel
""" """
from pathlib import Path from pathlib import Path
from subprocess import check_call from subprocess import check_call

768
wirepy.py

File diff suppressed because it is too large Load Diff

View File

@ -6,9 +6,10 @@ import locale
from pathlib import Path from pathlib import Path
from typing import Dict, Any from typing import Dict, Any
class AppConfig: class AppConfig:
"""Central configuration class for Wire-Py application""" """Central configuration class for Wire-Py application"""
# Localization # Localization
APP_NAME: str = "wirepy" APP_NAME: str = "wirepy"
LOCALE_DIR: Path = Path("/usr/share/locale/") LOCALE_DIR: Path = Path("/usr/share/locale/")
@ -18,37 +19,36 @@ class AppConfig:
CONFIG_DIR: Path = BASE_DIR / ".config/wire_py" CONFIG_DIR: Path = BASE_DIR / ".config/wire_py"
TEMP_DIR: Path = Path("/tmp/tlecdcwg") TEMP_DIR: Path = Path("/tmp/tlecdcwg")
USER_FILE: Path = Path("/tmp/.log_user") USER_FILE: Path = Path("/tmp/.log_user")
PUBLICKEY: Path = CONFIG_DIR / "pbwgk.pem"
# Configuration files # Configuration files
SETTINGS_FILE: Path = CONFIG_DIR / "settings" SETTINGS_FILE: Path = CONFIG_DIR / "settings"
KEYS_FILE: Path = CONFIG_DIR / "keys" KEYS_FILE: Path = CONFIG_DIR / "keys"
AUTOSTART_SERVICE: Path = Path.home() / ".config/systemd/user/wg_start.service" AUTOSTART_SERVICE: Path = Path.home() / ".config/systemd/user/wg_start.service"
# Updates # Updates
# 1 = 1. Year, 09 = Month of the Year, 2924 = Day and Year of the Year # 1 = 1. Year, 09 = Month of the Year, 2924 = Day and Year of the Year
VERSION: str = "v. 2.04.1725" VERSION: str = "v. 2.04.1725"
UPDATE_URL: str = "https://git.ilunix.de/api/v1/repos/punix/Wire-Py/releases" UPDATE_URL: str = "https://git.ilunix.de/api/v1/repos/punix/Wire-Py/releases"
DOWNLOAD_URL: str = "https://git.ilunix.de/punix/Wire-Py/archive" DOWNLOAD_URL: str = "https://git.ilunix.de/punix/Wire-Py/archive"
# UI configuration # UI configuration
UI_CONFIG: Dict[str, Any] = { UI_CONFIG: Dict[str, Any] = {
"window_title": "Wire-Py", "window_title": "Wire-Py",
"window_size": (600, 383), "window_size": (600, 383),
"font_family": "Ubuntu", "font_family": "Ubuntu",
"font_size": 11, "font_size": 11,
"resizable_window": (False, False) "resizable_window": (False, False),
} }
# System-dependent paths # System-dependent paths
SYSTEM_PATHS: Dict[str, str]= { SYSTEM_PATHS: Dict[str, str] = {
"ssl_decrypt": "/usr/local/bin/ssl_decrypt.py", "ssl_decrypt": "/usr/local/bin/ssl_decrypt.py",
"ssl_encrypt": "/usr/local/bin/ssl_encrypt.py", "ssl_encrypt": "/usr/local/bin/ssl_encrypt.py",
"tcl_path": "/usr/share/TK-Themes", "tcl_path": "/usr/share/TK-Themes",
"pkey_path": "/usr/local/etc/ssl/pwgk.pem" "pkey_path": "/usr/local/etc/ssl/pwgk.pem",
} }
# Images and icons paths # Images and icons paths
IMAGE_PATHS: Dict[str, str] = { IMAGE_PATHS: Dict[str, str] = {
"icon_vpn": "/usr/share/icons/lx-icons/48/wg_vpn.png", "icon_vpn": "/usr/share/icons/lx-icons/48/wg_vpn.png",
@ -59,16 +59,15 @@ class AppConfig:
"icon_start": "/usr/share/icons/lx-icons/48/wg_vpn-start.png", "icon_start": "/usr/share/icons/lx-icons/48/wg_vpn-start.png",
"icon_stop": "/usr/share/icons/lx-icons/48/wg_vpn-stop.png", "icon_stop": "/usr/share/icons/lx-icons/48/wg_vpn-stop.png",
"icon_info": "/usr/share/icons/lx-icons/64/info.png", "icon_info": "/usr/share/icons/lx-icons/64/info.png",
"icon_error": "/usr/share/icons/lx-icons/64/error.png" "icon_error": "/usr/share/icons/lx-icons/64/error.png",
}
}
@staticmethod @staticmethod
def setup_translations() -> gettext.gettext: def setup_translations() -> gettext.gettext:
""" """
Initialize translations and set the translation function Initialize translations and set the translation function
Special method for translating strings in this file Special method for translating strings in this file
Returns: Returns:
The gettext translation function The gettext translation function
""" """
@ -82,14 +81,16 @@ class AppConfig:
"""Ensures that all required directories exist""" """Ensures that all required directories exist"""
cls.CONFIG_DIR.mkdir(parents=True, exist_ok=True) cls.CONFIG_DIR.mkdir(parents=True, exist_ok=True)
cls.TEMP_DIR.mkdir(parents=True, exist_ok=True) cls.TEMP_DIR.mkdir(parents=True, exist_ok=True)
@classmethod @classmethod
def create_default_settings(cls) -> None: def create_default_settings(cls) -> None:
"""Creates default settings if they don't exist""" """Creates default settings if they don't exist"""
if not cls.SETTINGS_FILE.exists(): if not cls.SETTINGS_FILE.exists():
content = "\n".join(f"[{k.upper()}]\n{v}" for k, v in cls.DEFAULT_SETTINGS.items()) content = "\n".join(
f"[{k.upper()}]\n{v}" for k, v in cls.DEFAULT_SETTINGS.items()
)
cls.SETTINGS_FILE.write_text(content) cls.SETTINGS_FILE.write_text(content)
@classmethod @classmethod
def get_image_paths(cls) -> Dict[str, Path]: def get_image_paths(cls) -> Dict[str, Path]:
"""Returns paths to UI images""" """Returns paths to UI images"""
@ -97,14 +98,14 @@ class AppConfig:
"main_icon": cls.SYSTEM_PATHS["image_path"] / "48/wg_vpn.png", "main_icon": cls.SYSTEM_PATHS["image_path"] / "48/wg_vpn.png",
"warning": cls.CONFIG_DIR / "images/warning.png", "warning": cls.CONFIG_DIR / "images/warning.png",
"success": cls.CONFIG_DIR / "images/success.png", "success": cls.CONFIG_DIR / "images/success.png",
"error": cls.CONFIG_DIR / "images/error.png" "error": cls.CONFIG_DIR / "images/error.png",
} }
@classmethod @classmethod
def get_autostart_content(cls) -> str: def get_autostart_content(cls) -> str:
"""Returns the content for the autostart service file""" """Returns the content for the autostart service file"""
return """[Unit]
Description=Automatic Tunnel Start return """[Unit]Description=Automatic Tunnel Start
After=network-online.target After=network-online.target
[Service] [Service]
@ -114,29 +115,32 @@ ExecStart=/usr/local/bin/start_wg.py
[Install] [Install]
WantedBy=default.target""" WantedBy=default.target"""
# here is inizialize the class for translate strrings # here is inizialize the class for translate strrings
_ = AppConfig.setup_translations() _ = AppConfig.setup_translations()
class Msg: class Msg:
""" """
A utility class that provides centralized access to translated message strings. A utility class that provides centralized access to translated message strings.
This class contains a dictionary of message strings used throughout the Wire-Py application. This class contains a dictionary of message strings used throughout the Wire-Py application.
All strings are prepared for translation using gettext. The short key names make the code All strings are prepared for translation using gettext. The short key names make the code
more concise while maintaining readability. more concise while maintaining readability.
Attributes: Attributes:
STR (dict): A dictionary mapping short keys to translated message strings. STR (dict): A dictionary mapping short keys to translated message strings.
Keys are abbreviated for brevity but remain descriptive. Keys are abbreviated for brevity but remain descriptive.
Usage: Usage:
Import this class and access messages using the dictionary: Import this class and access messages using the dictionary:
`Msg.STR["sel_tl"]` returns the translated "Select tunnel" message. `Msg.STR["sel_tl"]` returns the translated "Select tunnel" message.
Note: Note:
Ensure that gettext translation is properly initialized before Ensure that gettext translation is properly initialized before
accessing these strings to ensure correct localization. accessing these strings to ensure correct localization.
""" """
STR: Dict[str, str] = { STR: Dict[str, str] = {
# Strings for messages # Strings for messages
"sel_tl": _("Select tunnel"), "sel_tl": _("Select tunnel"),
@ -150,28 +154,38 @@ class Msg:
"sel_list": _("Please select a tunnel from the list"), "sel_list": _("Please select a tunnel from the list"),
"sign_len": _("The new name may contain only 12 characters"), "sign_len": _("The new name may contain only 12 characters"),
"zero_signs": _("At least one character must be entered"), "zero_signs": _("At least one character must be entered"),
"false signs": _("No valid sign. These must not be used.\nBlank, Slash, Backslash and { }\n"), "false signs": _(
"No valid sign. These must not be used.\nBlank, Slash, Backslash and { }\n"
),
"is_in_use": _("The tunnel is already in use"), "is_in_use": _("The tunnel is already in use"),
"no_valid_file": _("Oh... no valid Wireguard File!\nPlease select a valid Wireguard File"), "no_valid_file": _(
"tl_exist": _("Tunnel already available!\nPlease use another file for import") "Oh... no valid Wireguard File!\nPlease select a valid Wireguard File"
),
} "tl_exist": _("Tunnel already available!\nPlease use another file for import"),
}
TTIP: Dict[str, str] = { TTIP: Dict[str, str] = {
#Strings for Tooltips # Strings for Tooltips
"settings": _("Click for Settings"),
"import_tl": _("Click to import a Wireguard Tunnel"),
"start_tl": _("Click to start selected Wireguard Tunnel"), "start_tl": _("Click to start selected Wireguard Tunnel"),
"empty_list": _("No tunnels to start in the list"), "empty_list": _("No tunnels to start in the list"),
"stop_tl": _("Click to stop selected Wireguard Tunnel"), "stop_tl": _("Click to stop selected Wireguard Tunnel"),
"del_tl": _("Click to delete selected Wireguard Tunnel"), "del_tl": _("Click to delete selected Wireguard Tunnel"),
"rename_tl": _("To rename a tunnel, you need to\nselect a tunnel from the list"), "rename_tl": _(
"To rename a tunnel, you need to\nselect a tunnel from the list"
),
"export_tl": _(" Click to export all\nWireguard Tunnel to Zipfile"), "export_tl": _(" Click to export all\nWireguard Tunnel to Zipfile"),
"trash_tl": _("Click to delete a Wireguard Tunnel\nSelect from the list!"), "trash_tl": _("Click to delete a Wireguard Tunnel\nSelect from the list!"),
"autostart": _("To use the autostart, enable this Checkbox"), "autostart": _("To use the autostart, enable this Checkbox"),
"autostart_info": _("You must have at least one\ntunnel in the list,to use the autostart"), "autostart_info": _(
"You must have at least one\ntunnel in the list,to use the autostart"
),
"export_tl_info": _("No Tunnels in List for Export"), "export_tl_info": _("No Tunnels in List for Export"),
"start_tl_info": _("Click to start selected Wireguard Tunnel"), "start_tl_info": _("Click to start selected Wireguard Tunnel"),
"rename_tl_info": _("To rename a tunnel, at least one must be in the list"), "rename_tl_info": _("To rename a tunnel, at least one must be in the list"),
"trash_tl_info": _("No tunnels to delete in the list"), "trash_tl_info": _("No tunnels to delete in the list"),
"list_auto_info": _("To use the autostart, a tunnel must be selected from the list") "list_auto_info": _(
"To use the autostart, a tunnel must be selected from the list"
),
"download": _("Click to download new version"),
} }