Compare commits
10 Commits
28-04-2025
...
c56b42df3e
Author | SHA1 | Date | |
---|---|---|---|
c56b42df3e | |||
a62394e40e | |||
d6e9613157 | |||
786b909adc | |||
a8aba71638 | |||
742c6d0cc5 | |||
42870e2942 | |||
9a4d8b3506 | |||
dba6138aa7 | |||
d0aed9e253 |
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
debug.log
|
||||
.venv
|
||||
.idea
|
||||
.vscode
|
||||
__pycache__
|
3
.idea/dictionaries/project.xml
generated
3
.idea/dictionaries/project.xml
generated
@ -1,3 +0,0 @@
|
||||
<component name="ProjectDictionaryState">
|
||||
<dictionary name="project" />
|
||||
</component>
|
6
.idea/inspectionProfiles/profiles_settings.xml
generated
6
.idea/inspectionProfiles/profiles_settings.xml
generated
@ -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
7
.idea/misc.xml
generated
@ -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
8
.idea/modules.xml
generated
@ -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
@ -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
6
.idea/vcs.xml
generated
@ -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
10
.idea/wire-py.iml
generated
@ -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
640
.idea/workspace.xml
generated
@ -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$/cls_mth_fc.py" beforeDir="false" afterPath="$PROJECT_DIR$/cls_mth_fc.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">{
|
||||
"associatedIndex": 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">{
|
||||
"keyToString": {
|
||||
"ASKED_ADD_EXTERNAL_FILES": "true",
|
||||
"Python.INSTALL.executor": "Run",
|
||||
"Python.cls_mth_fc.executor": "Run",
|
||||
"Python.install.executor": "Run",
|
||||
"Python.main.executor": "Run",
|
||||
"Python.messagebox.executor": "Run",
|
||||
"Python.start_wg.executor": "Run",
|
||||
"Python.testtheme.executor": "Run",
|
||||
"Python.wg_func.executor": "Run",
|
||||
"Python.wg_main.executor": "Run",
|
||||
"Python.wirepy.executor": "Run",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"RunOnceActivity.git.unshallow": "true",
|
||||
"Shell Script.install.executor": "Run",
|
||||
"Shell Script.run_as.executor": "Run",
|
||||
"git-widget-placeholder": "28-04-2025-more-methods-and-optimize-methods",
|
||||
"last_opened_file_path": "/home/punix/Pyapps/wire-py",
|
||||
"settings.editor.selected.configurable": "ml.llm.LLMConfigurable"
|
||||
}
|
||||
}</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() function for Messagebox to show a tk.Toplevel() replace var = open() with: with open() as var: 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 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 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 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, 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. In rename, messages come now if new names do not fit 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. Start with version number 1.4.7 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 Install further adapted and with colored text if user is not in group sudo or wheel. 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 - 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 - 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 - 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 - 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 - optimize columnconfigure, rowconfigure in class MainWindow and FrameWidgets - add new Frame for Widgets on Bottom - 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 - optimize columnconfigure, rowconfigure in class MainWindow and FrameWidgets - add new Frame for Widgets on Bottom - 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 - optimize columnconfigure, rowconfigure in class MainWindow and FrameWidgets - add new Frame for Widgets on Bottom - 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 now works" />
|
||||
<MESSAGE value="Descriptions added in wg_func-py" />
|
||||
<MESSAGE value="If tunnel is renamed and this is in the car start, 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. In rename, messages come now if new names do not fit 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. Start with version number 1.4.7 Message window size corrected so text is displayed better" />
|
||||
<MESSAGE value="Fix msg_window and remove x , y argument Install further adapted and with colored text if user is not in group sudo or wheel. Added to install Opensuse for installation" />
|
||||
<MESSAGE value=" - Menu add - New Modern Dark and Light(default) Theme" />
|
||||
<MESSAGE value=" - Theme modify to water-theme - 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 - 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 - optimize columnconfigure, rowconfigure in class MainWindow and FrameWidgets - add new Frame for Widgets on Bottom - 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>
|
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -1,3 +0,0 @@
|
||||
{
|
||||
"workbench.settings.openDefaultSettings": true
|
||||
}
|
@ -3,7 +3,7 @@ My standard System: Linux Mint 22 Cinnamon
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
- os import in cls_mth_fc.py replaced by other methods
|
||||
- os import in common_tools.py replaced by other methods
|
||||
- If Wire-Py already runs, prevent further start
|
||||
- for loops with lists replaced by List Comprehensions
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -119,6 +119,89 @@ class LxTools(tk.Tk):
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
||||
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
|
||||
def get_file_name(path: Path, i: int = 5) -> List[str]:
|
||||
"""
|
||||
@ -169,18 +252,6 @@ class LxTools(tk.Tk):
|
||||
if file is not None:
|
||||
Path.unlink(file)
|
||||
|
||||
@staticmethod
|
||||
def if_tip(path: Path) -> bool:
|
||||
"""
|
||||
method that writes in file whether tooltip is displayed or not
|
||||
"""
|
||||
lines = Path(path).read_text(encoding="utf-8")
|
||||
if "False\n" in lines:
|
||||
tip = False
|
||||
else:
|
||||
tip = True
|
||||
return tip
|
||||
|
||||
@staticmethod
|
||||
def msg_window(image_path: Path, image_path2: Path, w_title: str, w_txt: str, txt2: Optional[str] = None,
|
||||
com: Optional[str] = None) -> None:
|
||||
@ -382,6 +453,82 @@ class Tunnel:
|
||||
pass
|
||||
|
||||
|
||||
# ConfigManager with caching
|
||||
class ConfigManager:
|
||||
"""
|
||||
Universal class for managing configuration files with caching.
|
||||
Can be reused in different projects.
|
||||
"""
|
||||
_config = None
|
||||
_config_file = None
|
||||
|
||||
@classmethod
|
||||
def init(cls, config_file):
|
||||
"""Initial the Configmanager with the given config file"""
|
||||
cls._config_file = config_file
|
||||
cls._config = None # Reset the cache
|
||||
|
||||
@classmethod
|
||||
def load(cls):
|
||||
"""Load the config file and return the config as dict"""
|
||||
if not cls._config:
|
||||
try:
|
||||
lines = Path(cls._config_file).read_text(encoding="utf-8").splitlines()
|
||||
cls._config = {
|
||||
'updates': lines[1].strip(),
|
||||
'theme': lines[3].strip(),
|
||||
'tooltips': lines[5].strip() == "True", # is converted here to boolean!!!
|
||||
'autostart': lines[7].strip() if len(lines) > 7 else 'off'
|
||||
}
|
||||
except (IndexError, FileNotFoundError):
|
||||
# DeDefault values in case of error
|
||||
cls._config = {
|
||||
'updates': 'on',
|
||||
'theme': 'light',
|
||||
'tooltips': "True", # Default Value as string !
|
||||
'autostart': 'off'
|
||||
}
|
||||
return cls._config
|
||||
|
||||
@classmethod
|
||||
def save(cls):
|
||||
"""Save the config to the config file"""
|
||||
if cls._config:
|
||||
lines = [
|
||||
'# Configuration\n',
|
||||
f"{cls._config['updates']}\n",
|
||||
'# Theme\n',
|
||||
f"{cls._config['theme']}\n",
|
||||
'# Tooltips\n',
|
||||
f"{str(cls._config['tooltips'])}\n",
|
||||
'# Autostart\n',
|
||||
f"{cls._config['autostart']}\n"
|
||||
]
|
||||
Path(cls._config_file).write_text(''.join(lines), encoding="utf-8")
|
||||
|
||||
@classmethod
|
||||
def set(cls, key, value):
|
||||
"""Sets a configuration value and saves the change"""
|
||||
cls.load()
|
||||
cls._config[key] = value
|
||||
cls.save()
|
||||
|
||||
@classmethod
|
||||
def get(cls, key, default=None):
|
||||
"""Returns a configuration value"""
|
||||
config = cls.load()
|
||||
return config.get(key, default)
|
||||
|
||||
|
||||
class ThemeManager:
|
||||
@staticmethod
|
||||
def change_theme(root, theme_in_use, theme_name=None):
|
||||
"""Change application theme centrally"""
|
||||
root.tk.call("set_theme", theme_in_use)
|
||||
if theme_in_use == theme_name:
|
||||
ConfigManager.set("theme", theme_in_use)
|
||||
|
||||
|
||||
class GiteaUpdate:
|
||||
"""
|
||||
Calling download requests the download URL of the running script,
|
||||
@ -390,35 +537,46 @@ class GiteaUpdate:
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
def api_down(update_api_url: str, version: str, file: Optional[Path] = None) -> str:
|
||||
def api_down(update_api_url: str, version: str, update_setting: str = None) -> str:
|
||||
"""
|
||||
Checks for updates via API
|
||||
|
||||
Args:
|
||||
update_api_url: Update API URL
|
||||
version: Current version
|
||||
file: Optional - Configuration file
|
||||
update_setting: Update setting from ConfigManager (on/off)
|
||||
|
||||
Returns:
|
||||
New version or status message
|
||||
"""
|
||||
# If updates are disabled, return immediately
|
||||
if update_setting != "on":
|
||||
return "False"
|
||||
|
||||
try:
|
||||
response: requests.Response = requests.get(update_api_url, timeout=10)
|
||||
response_dict: Any = response.json()
|
||||
response_dict: Dict[str, Any] = response_dict[0]
|
||||
with open(file, "r", encoding="utf-8") as set_f:
|
||||
set_f = set_f.read()
|
||||
if "on\n" in set_f:
|
||||
if version[3:] != response_dict["tag_name"]:
|
||||
req: str = response_dict["tag_name"]
|
||||
response.raise_for_status() # Raise exception for HTTP errors
|
||||
|
||||
response_data = response.json()
|
||||
if not response_data:
|
||||
return "No Updates"
|
||||
|
||||
latest_version = response_data[0].get("tag_name")
|
||||
if not latest_version:
|
||||
return "Invalid API Response"
|
||||
|
||||
# Compare versions (strip 'v. ' prefix if present)
|
||||
current_version = version[3:] if version.startswith("v. ") else version
|
||||
|
||||
if current_version != latest_version:
|
||||
return latest_version
|
||||
else:
|
||||
req: str = "No Updates"
|
||||
else:
|
||||
req: str = "False"
|
||||
return req
|
||||
return "No Updates"
|
||||
|
||||
except requests.exceptions.RequestException:
|
||||
req: str = "No Internet Connection!"
|
||||
return req
|
||||
return "No Internet Connection!"
|
||||
except (ValueError, KeyError, IndexError):
|
||||
return "Invalid API Response"
|
||||
|
||||
@staticmethod
|
||||
def download(urld: str, res: str, image_path: Path = None, image_path2: Path = None, image_path3: Path = None,
|
||||
@ -457,33 +615,48 @@ class GiteaUpdate:
|
||||
LxTools.msg_window(AppConfig.IMAGE_PATHS["icon_error"], AppConfig.IMAGE_PATHS["icon_msg"], wt, msg_t)
|
||||
|
||||
|
||||
class Tooltip:
|
||||
"""
|
||||
class for Tooltip
|
||||
|
||||
import Tooltip
|
||||
|
||||
class Tooltip():
|
||||
"""Class for Tooltip
|
||||
from common_tools.py import Tooltip
|
||||
example: Tooltip(label, "Show tooltip on label")
|
||||
example: Tooltip(button, "Show tooltip on button")
|
||||
info: label and button are parent.
|
||||
"""
|
||||
example: Tooltip(widget, "Text", state_var=tk.BooleanVar())
|
||||
example: Tooltip(widget, "Text", state_var=tk.BooleanVar(), x_offset=20, y_offset=10)
|
||||
|
||||
def __init__(self, widget: Any, text: str, tips: Optional[bool] = None) -> None:
|
||||
info: label and button are parent widgets.
|
||||
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()
|
||||
"""
|
||||
Tooltip Class
|
||||
"""
|
||||
|
||||
def __init__(self, widget: Any, text: str, state_var: Optional[tk.BooleanVar] = None,
|
||||
x_offset: int = 65, y_offset: int = 40) -> None:
|
||||
"""Tooltip Class"""
|
||||
self.widget: Any = widget
|
||||
self.text: str = text
|
||||
self.tooltip_window: Optional[Toplevel] = None
|
||||
if tips:
|
||||
self.state_var = state_var
|
||||
self.x_offset = x_offset
|
||||
self.y_offset = y_offset
|
||||
|
||||
# Initial binding based on current state
|
||||
self.update_bindings()
|
||||
|
||||
# Add trace to the state_var if provided
|
||||
if self.state_var is not None:
|
||||
self.state_var.trace_add("write", self.update_bindings)
|
||||
|
||||
def update_bindings(self, *args) -> None:
|
||||
"""Updates the bindings based on the current state"""
|
||||
# Remove existing bindings first
|
||||
self.widget.unbind("<Enter>")
|
||||
self.widget.unbind("<Leave>")
|
||||
|
||||
# Add new bindings if tooltips are enabled
|
||||
if self.state_var is None or self.state_var.get():
|
||||
self.widget.bind("<Enter>", self.show_tooltip)
|
||||
self.widget.bind("<Leave>", self.hide_tooltip)
|
||||
|
||||
def show_tooltip(self, event: Optional[Any] = None) -> None:
|
||||
"""
|
||||
Shows the tooltip
|
||||
"""
|
||||
"""Shows the tooltip"""
|
||||
if self.tooltip_window or not self.text:
|
||||
return
|
||||
|
||||
@ -491,23 +664,27 @@ class Tooltip:
|
||||
y: int
|
||||
cx: int
|
||||
cy: int
|
||||
|
||||
x, y, cx, cy = self.widget.bbox("insert")
|
||||
x += self.widget.winfo_rootx() + 65
|
||||
y += self.widget.winfo_rooty() + 40
|
||||
x += self.widget.winfo_rootx() + self.x_offset
|
||||
y += self.widget.winfo_rooty() + self.y_offset
|
||||
|
||||
self.tooltip_window = tw = tk.Toplevel(self.widget)
|
||||
tw.wm_overrideredirect(True)
|
||||
tw.wm_geometry(f"+{x}+{y}")
|
||||
|
||||
label: tk.Label = tk.Label(tw, text=self.text, background="lightgreen", foreground="black", relief="solid",
|
||||
borderwidth=1, padx=5, pady=5)
|
||||
label: tk.Label = tk.Label(
|
||||
tw, text=self.text, background="lightgreen", foreground="black",
|
||||
relief="solid", borderwidth=1, padx=5, pady=5
|
||||
)
|
||||
label.grid()
|
||||
|
||||
self.tooltip_window.after(2200, lambda: tw.destroy())
|
||||
|
||||
def hide_tooltip(self, event: Optional[Any] = None) -> None:
|
||||
"""
|
||||
Hides the tooltip
|
||||
"""
|
||||
"""Hides the tooltip"""
|
||||
if self.tooltip_window:
|
||||
self.tooltip_window.destroy()
|
||||
self.tooltip_window = None
|
||||
|
||||
|
10
install
10
install
@ -17,7 +17,7 @@ install_file_with(){
|
||||
exit 0
|
||||
else
|
||||
sudo apt install python3-tk && \
|
||||
sudo cp -fv wirepy.py start_wg.py wp_app_config.py cls_mth_fc.py ssl_encrypt.py ssl_decrypt.py /usr/local/bin/ && \
|
||||
sudo cp -fv wirepy.py start_wg.py wp_app_config.py common_tools.py ssl_encrypt.py ssl_decrypt.py /usr/local/bin/ && \
|
||||
sudo cp -uR lx-icons /usr/share/icons/ && sudo cp -uR TK-Themes /usr/share/ && \
|
||||
sudo cp -u languages/de/*.mo /usr/share/locale/de/LC_MESSAGES/ && \
|
||||
sudo cp -fv Wire-Py.desktop /usr/share/applications/ && \
|
||||
@ -43,7 +43,7 @@ install_arch_d(){
|
||||
exit 0
|
||||
else
|
||||
sudo pacman -S --noconfirm tk python3 python-requests && \
|
||||
sudo cp -fv wirepy.py start_wg.py wp_app_config.py cls_mth_fc.py ssl_encrypt.py ssl_decrypt.py /usr/local/bin/ && \
|
||||
sudo cp -fv wirepy.py start_wg.py wp_app_config.py common_tools.py ssl_encrypt.py ssl_decrypt.py /usr/local/bin/ && \
|
||||
sudo cp -uR lx-icons /usr/share/icons/ && sudo cp -uR TK-Themes /usr/share/ && \
|
||||
sudo cp -u languages/de/*.mo /usr/share/locale/de/LC_MESSAGES/ && \
|
||||
sudo cp -fv Wire-Py.desktop /usr/share/applications/ && \
|
||||
@ -120,7 +120,7 @@ install(){
|
||||
exit 0
|
||||
else
|
||||
sudo dnf install python3-tkinter -y
|
||||
sudo cp -fv wirepy.py start_wg.py wp_app_config.py cls_mth_fc.py ssl_encrypt.py ssl_decrypt.py /usr/local/bin/ && \
|
||||
sudo cp -fv wirepy.py start_wg.py wp_app_config.py common_tools.py ssl_encrypt.py ssl_decrypt.py /usr/local/bin/ && \
|
||||
sudo cp -uR lx-icons /usr/share/icons/ && sudo cp -uR TK-Themes /usr/share/ && \
|
||||
sudo cp -u languages/de/*.mo /usr/share/locale/de/LC_MESSAGES/ && \
|
||||
sudo cp -fv Wire-Py.desktop /usr/share/applications/ && \
|
||||
@ -145,7 +145,7 @@ install(){
|
||||
rm -r ~/.config/wire_py && rm -r ~/.config/systemd
|
||||
exit 0
|
||||
else
|
||||
sudo cp -fv wirepy.py start_wg.py wp_app_config.py cls_mth_fc.py ssl_encrypt.py ssl_decrypt.py /usr/local/bin/ && \
|
||||
sudo cp -fv wirepy.py start_wg.py wp_app_config.py common_tools.py ssl_encrypt.py ssl_decrypt.py /usr/local/bin/ && \
|
||||
sudo cp -uR lx-icons /usr/share/icons/ && sudo cp -uR TK-Themes /usr/share/ && \
|
||||
sudo cp -u languages/de/*.mo /usr/share/locale/de/LC_MESSAGES/ && \
|
||||
sudo cp -fv Wire-Py.desktop /usr/share/applications/ && \
|
||||
@ -181,7 +181,7 @@ install(){
|
||||
|
||||
remove(){
|
||||
sudo rm -f /usr/local/bin/wirepy /usr/local/bin/wirepy.py /usr/local/bin/start_wg.py \
|
||||
/usr/local/bin/wp_app_config.py cls_mth_fc.py /usr/local/bin/ssl_encrypt.py /usr/local/bin/ssl_decrypt.py
|
||||
/usr/local/bin/wp_app_config.py common_tools.py /usr/local/bin/ssl_encrypt.py /usr/local/bin/ssl_decrypt.py
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
exit 0
|
||||
|
@ -2,7 +2,7 @@
|
||||
from pathlib import Path
|
||||
from subprocess import check_call
|
||||
from tkinter import filedialog, ttk
|
||||
from cls_mth_fc import Create, LxTools
|
||||
from common_tools import Create, LxTools
|
||||
from wp_app_config import AppConfig, Msg
|
||||
import gettext
|
||||
import locale
|
||||
|
@ -5,7 +5,7 @@ import os
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
from subprocess import check_call
|
||||
from cls_mth_fc import LxTools
|
||||
from common_tools import LxTools
|
||||
from wp_app_config import AppConfig
|
||||
|
||||
#uname: Path = Path("/tmp/.log_user")
|
||||
|
424
wirepy.py
424
wirepy.py
@ -14,17 +14,13 @@ from pathlib import Path
|
||||
from subprocess import check_call
|
||||
from tkinter import TclError, filedialog, ttk
|
||||
|
||||
from cls_mth_fc import (Create, GiteaUpdate, Tunnel, Tooltip, LxTools)
|
||||
from common_tools import (ConfigManager, ThemeManager, Create, GiteaUpdate, Tunnel, Tooltip, LxTools)
|
||||
from wp_app_config import AppConfig, Msg
|
||||
|
||||
LxTools.uos()
|
||||
Create.dir_and_files()
|
||||
Create.make_dir()
|
||||
Create.decrypt()
|
||||
# 1 = 1. Year, 09 = Month of the Year, 2924 = Day and Year of the Year
|
||||
VERSION: str = "v. 2.04.1725"
|
||||
|
||||
res = GiteaUpdate.api_down("https://git.ilunix.de/api/v1/repos/punix/Wire-Py/releases", VERSION, AppConfig.SETTINGS_FILE)
|
||||
|
||||
class Wirepy(tk.Tk):
|
||||
"""
|
||||
@ -33,23 +29,25 @@ class Wirepy(tk.Tk):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
# Hide the window initially
|
||||
self.withdraw()
|
||||
|
||||
self.my_tool_tip = None
|
||||
self.x_width = AppConfig.UI_CONFIG["window_size"][0]
|
||||
self.y_height = AppConfig.UI_CONFIG["window_size"][1]
|
||||
self.monitor_center_x = int(self.winfo_screenwidth() / 2 - (self.x_width / 2))
|
||||
self.monitor_center_y = int(self.winfo_screenheight() / 2 - (self.y_height / 2))
|
||||
self.resizable(AppConfig.UI_CONFIG["resizable_window"][0], AppConfig.UI_CONFIG["resizable_window"][1])
|
||||
|
||||
# Set the window size
|
||||
self.geometry(f"{self.x_width}x{self.y_height}")
|
||||
self.resizable(AppConfig.UI_CONFIG["resizable_window"][0],
|
||||
AppConfig.UI_CONFIG["resizable_window"][1])
|
||||
self.title(AppConfig.UI_CONFIG["window_title"])
|
||||
self.geometry(f"{self.x_width}x{self.y_height}+{self.monitor_center_x}+{self.monitor_center_y}")
|
||||
|
||||
self.columnconfigure(0, weight=1)
|
||||
self.rowconfigure(0, weight=1)
|
||||
self.style = ttk.Style(self)
|
||||
self.tk.call("source", f"{AppConfig.SYSTEM_PATHS["tcl_path"]}/water.tcl")
|
||||
lines = AppConfig.SETTINGS_FILE.read_text()
|
||||
if "light\n" in lines:
|
||||
self.tk.call("set_theme", "light")
|
||||
else:
|
||||
self.tk.call("set_theme", "dark")
|
||||
self.tk.call("source", f"{AppConfig.SYSTEM_PATHS['tcl_path']}/water.tcl")
|
||||
ConfigManager.init(AppConfig.SETTINGS_FILE)
|
||||
theme = ConfigManager.get("theme")
|
||||
ThemeManager.change_theme(self, theme)
|
||||
|
||||
# Load the image file from the disk
|
||||
self.wg_icon = tk.PhotoImage(file=AppConfig.IMAGE_PATHS["icon_vpn"])
|
||||
@ -57,58 +55,96 @@ class Wirepy(tk.Tk):
|
||||
# Set it as the window icon
|
||||
self.iconphoto(True, self.wg_icon)
|
||||
|
||||
tips = LxTools.if_tip(AppConfig.SETTINGS_FILE)
|
||||
FrameWidgets(self, tips_enabled=tips).grid()
|
||||
# Add the widgets
|
||||
FrameWidgets(self).grid()
|
||||
|
||||
# Center the window on the primary monitor
|
||||
LxTools.center_window_cross_platform(self, self.x_width, self.y_height)
|
||||
|
||||
# Now show the window after it has been positioned
|
||||
self.after(10, self.deiconify)
|
||||
|
||||
|
||||
class FrameWidgets(ttk.Frame):
|
||||
"""
|
||||
ttk frame class for better structure
|
||||
"""
|
||||
def __init__(self, container, tips_enabled=None, **kwargs):
|
||||
def __init__(self, container, **kwargs):
|
||||
super().__init__(container, **kwargs)
|
||||
|
||||
self.tunnel = Tunnel()
|
||||
self.lb_tunnel = None
|
||||
self.btn_stst = None
|
||||
self.endpoint = None
|
||||
self.dns = None
|
||||
self.address = None
|
||||
self.auto_con = None
|
||||
self.style = ttk.Style()
|
||||
self.wg_vpn_start = tk.PhotoImage(file=AppConfig.IMAGE_PATHS["icon_start"])
|
||||
self.wg_vpn_stop = tk.PhotoImage(file=AppConfig.IMAGE_PATHS["icon_stop"])
|
||||
self.imp_pic = tk.PhotoImage(file=AppConfig.IMAGE_PATHS["icon_import"])
|
||||
self.tr_pic = tk.PhotoImage(file=AppConfig.IMAGE_PATHS["icon_trash"])
|
||||
self.exp_pic = tk.PhotoImage(file=AppConfig.IMAGE_PATHS["icon_export"])
|
||||
self.warning_pic = tk.PhotoImage(file=AppConfig.IMAGE_PATHS["icon_error"])
|
||||
self.tips_enabled = tips_enabled if tips_enabled is not None else LxTools.if_tip(AppConfig.SETTINGS_FILE)
|
||||
|
||||
# StringVar-Variables initialization
|
||||
self.tooltip_state = tk.BooleanVar()
|
||||
# Get value from configuration
|
||||
state = ConfigManager.get("tooltips")
|
||||
# NOTE: ConfigManager.get("tooltips") can return either a boolean value or a string,
|
||||
# depending on whether the value was loaded from the file (bool) or the default value is used (string).
|
||||
# The expression 'lines[5].strip() == "True"' in ConfigManager.load() converts the string to a boolean.
|
||||
# Convert to boolean and set
|
||||
if isinstance(state, bool):
|
||||
# If it's already a boolean, use directly
|
||||
self.tooltip_state.set(state)
|
||||
else:
|
||||
# If it's a string or something else
|
||||
self.tooltip_state.set(str(state) == "True")
|
||||
|
||||
self.tooltip_label = tk.StringVar() # StringVar-Variable for tooltip label for view Disabled/Enabled
|
||||
self.tooltip_update_label()
|
||||
self.update_label = tk.StringVar() # StringVar-Variable for update label
|
||||
self.update_tooltip = tk.StringVar() # StringVar-Variable for update tooltip please not remove!
|
||||
self.update_foreground = tk.StringVar(value="red")
|
||||
|
||||
|
||||
# Frame for Menu
|
||||
self.menu_frame = ttk.Frame(self)
|
||||
self.menu_frame.configure(relief="flat")
|
||||
self.menu_frame.grid(column=0, row=0, columnspan=4, sticky="w")
|
||||
|
||||
# App Menu
|
||||
self.version_lb = ttk.Label(self.menu_frame, text=VERSION)
|
||||
self.version_lb = ttk.Label(self.menu_frame, text=AppConfig.VERSION)
|
||||
self.version_lb.config(font=("Ubuntu", 11), foreground="#00c4ff")
|
||||
self.version_lb.grid(column=0, row=0, rowspan=4, padx=10)
|
||||
|
||||
Tooltip(self.version_lb, f"Version: {VERSION[2:]}", self.tips_enabled)
|
||||
Tooltip(self.version_lb, f"Version: {AppConfig.VERSION[2:]}", self.tooltip_state)
|
||||
|
||||
self.options_btn = ttk.Menubutton(self.menu_frame, text=_("Options"))
|
||||
self.options_btn.grid(column=1, columnspan=1, row=0)
|
||||
|
||||
Tooltip(self.options_btn, _("Click for Settings"), self.tips_enabled)
|
||||
Tooltip(self.options_btn, Msg.TTIP["settings"], self.tooltip_state)
|
||||
|
||||
set_update = tk.IntVar()
|
||||
set_tip = tk.BooleanVar()
|
||||
self.set_update = tk.IntVar()
|
||||
self.settings = tk.Menu(self, relief="flat")
|
||||
self.options_btn.configure(menu=self.settings, style="Toolbutton")
|
||||
self.settings.add_checkbutton(label=_("Disable Updates"),
|
||||
command=lambda: self.update_setting(set_update.get()), variable=set_update)
|
||||
self.settings.add_checkbutton(label=_("Disable Tooltips"),
|
||||
command=lambda: self.tooltip(set_tip.get()), variable=set_tip)
|
||||
self.settings.add_command(label=_("Light"), command=self.theme_change_light)
|
||||
self.settings.add_command(label=_("Dark"), command=self.theme_change_dark)
|
||||
command=lambda: self.update_setting(self.set_update.get()), variable=self.set_update)
|
||||
|
||||
self.updates_lb = ttk.Label(self.menu_frame, textvariable=self.update_label)
|
||||
self.updates_lb.grid(column=4, columnspan=3, row=0, padx=10)
|
||||
self.updates_lb.grid_remove()
|
||||
self.update_label.trace_add("write", self.update_label_display)
|
||||
self.update_foreground.trace_add("write", self.update_label_display)
|
||||
res = GiteaUpdate.api_down(AppConfig.UPDATE_URL, AppConfig.VERSION, ConfigManager.get("updates"))
|
||||
self.update_ui_for_update(res)
|
||||
|
||||
# Tooltip Menu
|
||||
self.settings.add_command(label=self.tooltip_label.get(), command=self.tooltips_toggle)
|
||||
# Label show dark or light
|
||||
self.theme_label = tk.StringVar()
|
||||
self.update_theme_label()
|
||||
self.settings.add_command(label=self.theme_label.get(), command=self.on_theme_toggle)
|
||||
|
||||
# About BTN Menu / Label
|
||||
self.about_btn = ttk.Button(
|
||||
@ -116,49 +152,6 @@ class FrameWidgets(ttk.Frame):
|
||||
self.about_btn.grid(column=2, columnspan=2, row=0)
|
||||
self.readme = tk.Menu(self)
|
||||
|
||||
# Update and Tooltip Label
|
||||
self.updates_lb = ttk.Label(self.menu_frame)
|
||||
self.updates_lb.grid(column=4, columnspan=3, row=0, padx=10)
|
||||
|
||||
# View Checkbox to enable or disable Tooltip
|
||||
if tips:
|
||||
set_tip.set(value=False)
|
||||
else:
|
||||
set_tip.set(value=True)
|
||||
|
||||
# View Checkbox for enable or disable Updates
|
||||
if res == "False":
|
||||
set_update.set(value=1)
|
||||
self.updates_lb.configure(text=_("Update search off"))
|
||||
|
||||
Tooltip(self.updates_lb, _("Updates you have disabled"), self.tips_enabled)
|
||||
|
||||
elif res == "No Internet Connection!":
|
||||
self.updates_lb.configure(text=_("No Server Connection!"), foreground="red")
|
||||
elif res == "No Updates":
|
||||
self.updates_lb.configure(text=_("No Updates"))
|
||||
|
||||
Tooltip(self.updates_lb, _("Congratulations! Wire-Py is up to date"), self.tips_enabled)
|
||||
|
||||
else:
|
||||
set_update.set(value=0)
|
||||
text = f"Update {res} {_("available!")}"
|
||||
|
||||
# Update BTN Menu
|
||||
self.update_btn = ttk.Menubutton(self.menu_frame, text=text)
|
||||
self.update_btn.grid(column=4, columnspan=3, row=0, padx=0)
|
||||
|
||||
Tooltip(self.update_btn, _("Click to download new version"), self.tips_enabled)
|
||||
|
||||
self.download = tk.Menu(self, relief="flat")
|
||||
|
||||
self.update_btn.configure(menu=self.download, style="Toolbutton")
|
||||
self.download.add_command(
|
||||
label=_("Download"),
|
||||
command=lambda: GiteaUpdate.download(f"https://git.ilunix.de/punix/Wire-Py/archive/{res}.zip",
|
||||
res, AppConfig.IMAGE_PATHS["icon_info"], AppConfig.IMAGE_PATHS["icon_vpn"], AppConfig.IMAGE_PATHS["icon_error"], AppConfig.IMAGE_PATHS["icon_msg"]))
|
||||
|
||||
# Show active Tunnel
|
||||
self.a = Tunnel.active()
|
||||
|
||||
# Label Frame 1
|
||||
@ -240,7 +233,7 @@ class FrameWidgets(ttk.Frame):
|
||||
self.btn_i = ttk.Button(self.lb_frame_btn_lbox, image=self.imp_pic, command=self.import_sl, padding=0)
|
||||
self.btn_i.grid(column=0, row=1, padx=15, pady=8)
|
||||
|
||||
Tooltip(self.btn_i, _("Click to import a Wireguard Tunnel"), self.tips_enabled)
|
||||
Tooltip(self.btn_i, Msg.TTIP["import_tl"], self.tooltip_state)
|
||||
|
||||
# Button Trash
|
||||
self.btn_tr = ttk.Button(self.lb_frame_btn_lbox, image=self.tr_pic, command=self.delete, padding=0,
|
||||
@ -248,20 +241,23 @@ class FrameWidgets(ttk.Frame):
|
||||
self.btn_tr.grid(column=0, row=2, padx=15, pady=8)
|
||||
|
||||
if self.l_box.size() == 0:
|
||||
Tooltip(self.btn_tr, _("No tunnels to delete in the list"), self.tips_enabled)
|
||||
Tooltip(self.btn_tr, Msg.TTIP["trash_tl_info"], self.tooltip_state)
|
||||
else:
|
||||
Tooltip(self.btn_tr, _("Click to delete a Wireguard Tunnel\nSelect from the list!"), self.tips_enabled)
|
||||
Tooltip(self.btn_tr, Msg.TTIP["trash_tl"], self.tooltip_state)
|
||||
|
||||
# Button Export
|
||||
self.btn_exp = ttk.Button(self.lb_frame_btn_lbox, image=self.exp_pic,
|
||||
command=lambda: Tunnel.export(AppConfig.IMAGE_PATHS["icon_info"], AppConfig.IMAGE_PATHS["icon_vpn"], AppConfig.IMAGE_PATHS["icon_error"], AppConfig.IMAGE_PATHS["icon_msg"],
|
||||
command=lambda: Tunnel.export(AppConfig.IMAGE_PATHS["icon_info"],
|
||||
AppConfig.IMAGE_PATHS["icon_vpn"], AppConfig.IMAGE_PATHS["icon_error"],
|
||||
AppConfig.IMAGE_PATHS["icon_msg"],
|
||||
Msg.STR["sel_tl"], Msg.STR["tl_first"]), padding=0)
|
||||
|
||||
self.btn_exp.grid(column=0, row=3, padx=15, pady=8)
|
||||
|
||||
if self.l_box.size() == 0:
|
||||
Tooltip(self.btn_exp, _("No Tunnels in List for Export"), self.tips_enabled)
|
||||
Tooltip(self.btn_exp, Msg.TTIP["export_tl_info"], self.tooltip_state)
|
||||
else:
|
||||
Tooltip(self.btn_exp, _("Click to export all\nWireguard Tunnel to Zipfile"), self.tips_enabled)
|
||||
Tooltip(self.btn_exp, Msg.TTIP["export_tl"], self.tooltip_state)
|
||||
|
||||
# Label Entry
|
||||
self.lb_rename = ttk.Entry(self.lb_frame4, width=20)
|
||||
@ -270,9 +266,9 @@ class FrameWidgets(ttk.Frame):
|
||||
self.lb_rename.config(state="disable")
|
||||
|
||||
if self.l_box.size() != 0:
|
||||
Tooltip(self.lb_rename, _("To rename a tunnel, you need to\nselect a tunnel from the list"), self.tips_enabled)
|
||||
Tooltip(self.lb_rename, Msg.TTIP["rename_tl"], self.tooltip_state, x_offset= -120, y_offset=-70)
|
||||
else:
|
||||
Tooltip(self.lb_rename, _("To rename a tunnel, at least one must be in the list"), self.tips_enabled)
|
||||
Tooltip(self.lb_rename, Msg.TTIP["rename_tl_info"], self.tooltip_state, x_offset=-180, y_offset=-50)
|
||||
|
||||
# Button Rename
|
||||
self.btn_rename = ttk.Button(self.lb_frame4, text=_("Rename"), state="disable", command=self.tl_rename,
|
||||
@ -293,51 +289,84 @@ class FrameWidgets(ttk.Frame):
|
||||
self.wg_autostart.grid(column=0, row=0, pady=15, padx=15, sticky="nw")
|
||||
|
||||
if self.l_box.size() >= 1 and len(self.l_box.curselection()) >= 1:
|
||||
Tooltip(self.wg_autostart, Msg.TTIP["autostart"], tself.tips_enabled)
|
||||
Tooltip(self.wg_autostart, Msg.TTIP["autostart"], self.tooltip_state, x_offset=-10, y_offset=-40)
|
||||
|
||||
if self.l_box.size() == 0:
|
||||
Tooltip(self.wg_autostart, Msg.TTIP["autostart_info"], self.tips_enabled)
|
||||
Tooltip(self.wg_autostart, Msg.TTIP["autostart_info"], self.tooltip_state, x_offset=30, y_offset=-50)
|
||||
|
||||
else:
|
||||
|
||||
Tooltip(self.wg_autostart, Msg.TTIP["autostart"], self.tips_enabled)
|
||||
Tooltip(self.wg_autostart, Msg.TTIP["autostart"], self.tooltip_state, x_offset=-10, y_offset=-40)
|
||||
|
||||
self.on_off()
|
||||
|
||||
# Method that is called when the variable changes
|
||||
def update_label_display(self, *args):
|
||||
# Set the foreground color
|
||||
self.updates_lb.configure(foreground=self.update_foreground.get())
|
||||
|
||||
@staticmethod
|
||||
def update_setting(update_res) -> None:
|
||||
"""
|
||||
write off or on in file
|
||||
Args:
|
||||
update_res (int): argument that is passed contains 0 or 1
|
||||
"""
|
||||
if update_res == 1:
|
||||
lines = Path(AppConfig.SETTINGS_FILE).read_text(encoding="utf-8").splitlines(keepends=True)
|
||||
lines[1] = 'off\n'
|
||||
Path(AppConfig.SETTINGS_FILE).write_text(''.join(lines), encoding="utf-8")
|
||||
# Show or hide the label based on whether it contains text
|
||||
if self.update_label.get():
|
||||
# Make sure the label is in the correct position every time it's shown
|
||||
self.updates_lb.grid(column=4, columnspan=3, row=0, padx=10)
|
||||
else:
|
||||
self.updates_lb.grid_remove()
|
||||
|
||||
# Update the labels based on the result
|
||||
def update_ui_for_update(self, res):
|
||||
"""Update UI elements based on update check result"""
|
||||
# First, remove the update button if it exists to avoid conflicts
|
||||
if hasattr(self, 'update_btn'):
|
||||
self.update_btn.grid_forget()
|
||||
delattr(self, 'update_btn')
|
||||
|
||||
if res == "False":
|
||||
self.set_update.set(value=1)
|
||||
self.update_label.set(_("Update search off"))
|
||||
self.update_tooltip.set(_("Updates you have disabled"))
|
||||
# Clear the foreground color as requested
|
||||
self.update_foreground.set("")
|
||||
# Set tooltip for the label
|
||||
Tooltip(self.updates_lb, self.update_tooltip.get(), self.tooltip_state)
|
||||
|
||||
elif res == "No Internet Connection!":
|
||||
self.update_label.set(_("No Server Connection!"))
|
||||
self.update_foreground.set("red")
|
||||
# Set tooltip for "No Server Connection"
|
||||
Tooltip(self.updates_lb, _("Could not connect to update server"), self.tooltip_state)
|
||||
|
||||
elif res == "No Updates":
|
||||
self.update_label.set(_("No Updates"))
|
||||
self.update_tooltip.set(_("Congratulations! Wire-Py is up to date"))
|
||||
self.update_foreground.set("")
|
||||
# Set tooltip for the label
|
||||
Tooltip(self.updates_lb, self.update_tooltip.get(), self.tooltip_state)
|
||||
|
||||
else:
|
||||
lines = Path(AppConfig.SETTINGS_FILE).read_text(encoding="utf-8").splitlines(keepends=True)
|
||||
lines[1] = 'on\n'
|
||||
Path(AppConfig.SETTINGS_FILE).write_text(''.join(lines), encoding="utf-8")
|
||||
self.set_update.set(value=0)
|
||||
update_text = f"Update {res} {_('available!')}"
|
||||
|
||||
@staticmethod
|
||||
def tooltip(tip) -> None:
|
||||
"""
|
||||
write True or False in a file
|
||||
Args:
|
||||
tip (bool): argument that is passed contains True or False
|
||||
"""
|
||||
if tip:
|
||||
lines = Path(AppConfig.SETTINGS_FILE).read_text(encoding="utf-8").splitlines(keepends=True)
|
||||
lines[5] = 'False\n'
|
||||
Path(AppConfig.SETTINGS_FILE).write_text(''.join(lines), encoding="utf-8")
|
||||
# Clear the label text since we'll show the button instead
|
||||
self.update_label.set("")
|
||||
|
||||
else:
|
||||
lines = Path(AppConfig.SETTINGS_FILE).read_text(encoding="utf-8").splitlines(keepends=True)
|
||||
lines[5] = 'True\n'
|
||||
Path(AppConfig.SETTINGS_FILE).write_text(''.join(lines), encoding="utf-8")
|
||||
# Create the update button
|
||||
self.update_btn = ttk.Menubutton(self.menu_frame, text=update_text)
|
||||
self.update_btn.grid(column=4, columnspan=3, row=0, padx=0)
|
||||
Tooltip(self.update_btn, _("Click to download new version"), self.tooltip_state)
|
||||
|
||||
self.download = tk.Menu(self, relief="flat")
|
||||
self.update_btn.configure(menu=self.download, style="Toolbutton")
|
||||
self.download.add_command(
|
||||
label=_("Download"),
|
||||
command=lambda: GiteaUpdate.download(
|
||||
f"{AppConfig.DOWNLOAD_URL}/{res}.zip",
|
||||
res,
|
||||
AppConfig.IMAGE_PATHS["icon_info"],
|
||||
AppConfig.IMAGE_PATHS["icon_vpn"],
|
||||
AppConfig.IMAGE_PATHS["icon_error"],
|
||||
AppConfig.IMAGE_PATHS["icon_msg"]
|
||||
)
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def about() -> None:
|
||||
@ -353,28 +382,80 @@ class FrameWidgets(ttk.Frame):
|
||||
"Use without warranty!\n")
|
||||
|
||||
LxTools.msg_window(AppConfig.IMAGE_PATHS["icon_vpn"], AppConfig.IMAGE_PATHS["icon_vpn"], _("Info"), msg_t, _("Go to Wire-Py git"), link_btn)
|
||||
def update_setting(self, update_res) -> None:
|
||||
"""write off or on in file
|
||||
Args:
|
||||
update_res (int): argument that is passed contains 0 or 1
|
||||
"""
|
||||
if update_res == 1:
|
||||
# Disable updates
|
||||
ConfigManager.set("updates", "off")
|
||||
# When updates are disabled, we know the result should be "False"
|
||||
self.update_ui_for_update("False")
|
||||
else:
|
||||
# Enable updates
|
||||
ConfigManager.set("updates", "on")
|
||||
# When enabling updates, we need to actually check for updates
|
||||
try:
|
||||
# Force a fresh check by passing "on" as the update setting
|
||||
res = GiteaUpdate.api_down(AppConfig.UPDATE_URL, AppConfig.VERSION, "on")
|
||||
|
||||
def theme_change_light(self) -> None:
|
||||
"""
|
||||
Set a light theme
|
||||
"""
|
||||
if self.tk.call("ttk::style", "theme", "use") == "water-dark":
|
||||
self.tk.call("set_theme", "light")
|
||||
lines = Path(AppConfig.SETTINGS_FILE).read_text(encoding="utf-8").splitlines(keepends=True) # (keepends=True) = not changed
|
||||
lines[3] = 'light\n'
|
||||
Path(AppConfig.SETTINGS_FILE).write_text(''.join(lines), encoding="utf-8")
|
||||
self.color_label()
|
||||
# Make sure UI is updated regardless of previous state
|
||||
if hasattr(self, 'update_btn'):
|
||||
self.update_btn.grid_forget()
|
||||
if hasattr(self, 'updates_lb'):
|
||||
self.updates_lb.grid_forget()
|
||||
|
||||
def theme_change_dark(self) -> None:
|
||||
"""
|
||||
Set a dark theme
|
||||
"""
|
||||
if not self.tk.call("ttk::style", "theme", "use") == "water-dark":
|
||||
self.tk.call("set_theme", "dark")
|
||||
lines = Path(AppConfig.SETTINGS_FILE).read_text(encoding="utf-8").splitlines(keepends=True)
|
||||
lines[3] = 'dark\n'
|
||||
Path(AppConfig.SETTINGS_FILE).write_text(''.join(lines), encoding="utf-8")
|
||||
# Now update the UI with the fresh result
|
||||
self.update_ui_for_update(res)
|
||||
except Exception as e:
|
||||
print(f"Error checking for updates: {e}")
|
||||
# Fallback to a default message if there's an error
|
||||
self.update_ui_for_update("No Internet Connection!")
|
||||
|
||||
def tooltip_update_label(self) -> None:
|
||||
"""Updates the tooltip menu label based on the current tooltip status"""
|
||||
# Set the menu text based on the current status
|
||||
if self.tooltip_state.get():
|
||||
# If tooltips are enabled, the menu option should be to disable them
|
||||
self.tooltip_label.set(_("Disable Tooltips"))
|
||||
else:
|
||||
# If tooltips are disabled, the menu option should be to enable them
|
||||
self.tooltip_label.set(_("Enable Tooltips"))
|
||||
|
||||
def tooltips_toggle(self):
|
||||
"""Toggles tooltips on/off and updates the menu label"""
|
||||
# Toggle the boolean state
|
||||
new_bool_state = not self.tooltip_state.get()
|
||||
# Save the converted value in the configuration
|
||||
ConfigManager.set("tooltips", str(new_bool_state))
|
||||
# Update the tooltip_state variable for immediate effect
|
||||
self.tooltip_state.set(new_bool_state)
|
||||
|
||||
# Update the menu label
|
||||
self.tooltip_update_label()
|
||||
|
||||
# Update the menu entry - find the correct index
|
||||
# This assumes it's the third item (index 2) in your menu
|
||||
self.settings.entryconfigure(1, label=self.tooltip_label.get())
|
||||
|
||||
def update_theme_label(self) -> str:
|
||||
"""Update the theme label based on current theme"""
|
||||
current_theme = ConfigManager.get("theme")
|
||||
if current_theme == "light":
|
||||
self.theme_label.set(_("Dark"))
|
||||
else:
|
||||
self.theme_label.set(_("Light"))
|
||||
|
||||
def on_theme_toggle(self) -> None:
|
||||
"""Toggle between light and dark theme"""
|
||||
current_theme = ConfigManager.get("theme")
|
||||
new_theme = "dark" if current_theme == "light" else "light"
|
||||
ThemeManager.change_theme(self, new_theme, new_theme)
|
||||
self.color_label()
|
||||
self.update_theme_label() # Update the theme label
|
||||
# Update Menulfield
|
||||
self.settings.entryconfigure(2, label=self.theme_label.get())
|
||||
|
||||
def start(self) -> None:
|
||||
"""
|
||||
@ -386,9 +467,9 @@ class FrameWidgets(ttk.Frame):
|
||||
|
||||
tl = LxTools.get_file_name(AppConfig.TEMP_DIR)
|
||||
if len(self.tl) == 0:
|
||||
Tooltip(self.btn_stst, Msg.TTIP["empty_list"], self.tips_enabled)
|
||||
Tooltip(self.btn_stst, Msg.TTIP["empty_list"], self.tooltip_state)
|
||||
else:
|
||||
Tooltip(self.btn_stst, Msg.TTIP["start_tl"], self.tips_enabled)
|
||||
Tooltip(self.btn_stst, Msg.TTIP["start_tl"], self.tooltip_state)
|
||||
|
||||
def handle_tunnel_data(self, tunnel_name: str) -> tuple[str, str, str, str | None]:
|
||||
"""_summary_
|
||||
@ -410,8 +491,8 @@ class FrameWidgets(ttk.Frame):
|
||||
"""
|
||||
View activ Tunnel in the color green or yellow
|
||||
"""
|
||||
lines = AppConfig.SETTINGS_FILE.read_text()
|
||||
if "light\n" in lines:
|
||||
if ConfigManager.get("theme") == "light":
|
||||
|
||||
self.lb_tunnel = ttk.Label(self, textvariable=self.str_var, foreground="green")
|
||||
|
||||
else:
|
||||
@ -428,7 +509,7 @@ class FrameWidgets(ttk.Frame):
|
||||
command=lambda: self.wg_switch("stop"), padding=0)
|
||||
self.btn_stst.grid(column=0, row=0, padx=5, pady=8)
|
||||
|
||||
Tooltip(self.btn_stst, Msg.TTIP["stop_tl"], self.tips_enabled)
|
||||
Tooltip(self.btn_stst, Msg.TTIP["stop_tl"], self.tooltip_state)
|
||||
|
||||
def reset_fields(self) -> None:
|
||||
"""
|
||||
@ -504,10 +585,10 @@ class FrameWidgets(ttk.Frame):
|
||||
self.l_box.update()
|
||||
self.l_box.selection_set(0)
|
||||
|
||||
Tooltip(self.wg_autostart, Msg.TTIP["autostart"], self.tips_enabled)
|
||||
Tooltip(self.btn_tr, Msg.TTIP["trash_tl"], self.tips_enabled)
|
||||
Tooltip(self.btn_exp, Msg.TTIP["export_tl"], self.tips_enabled)
|
||||
Tooltip(self.btn_rename, Msg.TTIP["rename_tl"], self.tips_enabled)
|
||||
Tooltip(self.wg_autostart, Msg.TTIP["autostart"], self.tooltip_state, x_offset=-10, y_offset=-40)
|
||||
Tooltip(self.btn_tr, Msg.TTIP["trash_tl"], self.tooltip_state)
|
||||
Tooltip(self.btn_exp, Msg.TTIP["export_tl"], self.tooltip_state)
|
||||
Tooltip(self.btn_rename, Msg.TTIP["rename_tl"], self.tooltip_state)
|
||||
|
||||
self.lb_rename.insert(0, "Max. 12 characters!")
|
||||
self.str_var = tk.StringVar()
|
||||
@ -569,12 +650,12 @@ class FrameWidgets(ttk.Frame):
|
||||
if self.l_box.size() == 0:
|
||||
self.wg_autostart.configure(state="disabled")
|
||||
self.lb_rename.configure(state="disabled")
|
||||
Tooltip(self.wg_autostart, _("You must have at least one\ntunnel in the list,to use the autostart")
|
||||
, self.tips_enabled)
|
||||
Tooltip(self.wg_autostart, Msg.TTIP["autostart_info"]
|
||||
, self.tooltip_state, x_offset=30, y_offset=-50)
|
||||
|
||||
Tooltip(self.btn_exp, _("No Tunnels in List for Export"), self.tips_enabled)
|
||||
Tooltip(self.btn_stst, _("No tunnels to start in the list"), self.tips_enabled)
|
||||
Tooltip(self.lb_rename, _("To rename a tunnel, at least one must be in the list"), tips, )
|
||||
Tooltip(self.btn_exp, Msg.TTIP["export_tl_info"], self.tooltip_state)
|
||||
Tooltip(self.btn_stst, Msg.TTIP["empty_list"], self.tooltip_state)
|
||||
Tooltip(self.lb_rename, Msg.TTIP["rename_tl_info"], self.tooltip_state)
|
||||
self.lb_rename.insert(0, _("Max. 12 characters!"))
|
||||
|
||||
if self.a != "" and self.a == select_tl:
|
||||
@ -727,54 +808,6 @@ class FrameWidgets(ttk.Frame):
|
||||
except EOFError as e:
|
||||
print(e)
|
||||
|
||||
def activate_tunnel(self, tunnel_name):
|
||||
"""Activates a tunnel after a delay"""
|
||||
try:
|
||||
# First check if the tunnel exists in NetworkManager
|
||||
nm_connections = subprocess.run(
|
||||
["nmcli", "-t", "-f", "NAME", "connection", "show"],
|
||||
check=True,
|
||||
stdout=subprocess.PIPE,
|
||||
text=True
|
||||
).stdout.strip().split('\n')
|
||||
|
||||
# Find the actual connection name (it might have been modified)
|
||||
actual_name = None
|
||||
for conn in nm_connections:
|
||||
if tunnel_name in conn:
|
||||
actual_name = conn
|
||||
break
|
||||
|
||||
if actual_name:
|
||||
# Use the actual connection name
|
||||
subprocess.run(["nmcli", "connection", "up", actual_name],
|
||||
check=True,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
else:
|
||||
# Use the original name as fallback
|
||||
subprocess.run(["nmcli", "connection", "up", tunnel_name],
|
||||
check=True,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
|
||||
# After successful activation, update the display
|
||||
self.a = Tunnel.active()
|
||||
self.str_var.set(self.a)
|
||||
self.color_label()
|
||||
|
||||
# Try to load the tunnel data
|
||||
try:
|
||||
data = self.handle_tunnel_data(self.a)
|
||||
self.init_and_report(data)
|
||||
self.show_data()
|
||||
self.stop()
|
||||
except Exception as e:
|
||||
print(f"Error loading tunnel data: {e}")
|
||||
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(f"Error activating tunnel: {e}", "hier simma")
|
||||
|
||||
def init_and_report(self, data=None) -> None:
|
||||
"""
|
||||
Displays the value address, DNS and peer in the labels
|
||||
@ -881,7 +914,6 @@ class FrameWidgets(ttk.Frame):
|
||||
if __name__ == "__main__":
|
||||
|
||||
_ = AppConfig.setup_translations()
|
||||
tips = LxTools.if_tip(AppConfig.SETTINGS_FILE)
|
||||
LxTools.sigi(AppConfig.TEMP_DIR, AppConfig.USER_FILE)
|
||||
window = Wirepy()
|
||||
"""
|
||||
|
@ -24,13 +24,12 @@ class AppConfig:
|
||||
KEYS_FILE: Path = CONFIG_DIR / "keys"
|
||||
AUTOSTART_SERVICE: Path = Path.home() / ".config/systemd/user/wg_start.service"
|
||||
|
||||
# Default settings
|
||||
DEFAULT_SETTINGS: Dict[str, Any] = {
|
||||
"updates": "on",
|
||||
"theme": "light",
|
||||
"tooltip": True,
|
||||
"autostart": "off"
|
||||
}
|
||||
# Updates
|
||||
# 1 = 1. Year, 09 = Month of the Year, 2924 = Day and Year of the Year
|
||||
VERSION: str = "v. 2.04.1725"
|
||||
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"
|
||||
|
||||
|
||||
# UI configuration
|
||||
UI_CONFIG: Dict[str, Any] = {
|
||||
@ -159,6 +158,8 @@ class Msg:
|
||||
}
|
||||
TTIP: Dict[str, str] = {
|
||||
#Strings for Tooltips
|
||||
"settings": _("Click for Settings"),
|
||||
"import_tl": _("Click to import a Wireguard Tunnel"),
|
||||
"start_tl": _("Click to start selected Wireguard Tunnel"),
|
||||
"empty_list": _("No tunnels to start in the list"),
|
||||
"stop_tl": _("Click to stop selected Wireguard Tunnel"),
|
||||
@ -172,7 +173,8 @@ class Msg:
|
||||
"start_tl_info": _("Click to start selected Wireguard Tunnel"),
|
||||
"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"),
|
||||
"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")
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user