1.11.1024 #24

Merged
punix merged 13 commits from 1.11.1024 into main 2024-11-10 17:57:58 +01:00
15 changed files with 213 additions and 201 deletions
Showing only changes of commit e9814f2b60 - Show all commits

View File

@ -4,15 +4,20 @@
<option name="autoReloadType" value="SELECTIVE" /> <option name="autoReloadType" value="SELECTIVE" />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="940e1630-c825-4d4c-be80-bc11f543c122" name="Changes" comment="- Optimize Class and Tooltip"> <list default="true" id="940e1630-c825-4d4c-be80-bc11f543c122" name="Changes" comment="- 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">
<change afterPath="$PROJECT_DIR$/run_as" afterDir="false" /> <change afterPath="$PROJECT_DIR$/lx-icons/128/error.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/lx-icons/128/info.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/lx-icons/256/error.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/lx-icons/256/info.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/lx-icons/32/error.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/lx-icons/32/info.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/lx-icons/48/error.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/lx-icons/48/info.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/lx-icons/64/error.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/lx-icons/64/info.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Changelog" beforeDir="false" afterPath="$PROJECT_DIR$/Changelog" afterDir="false" />
<change beforePath="$PROJECT_DIR$/install" beforeDir="false" afterPath="$PROJECT_DIR$/install" afterDir="false" /> <change beforePath="$PROJECT_DIR$/install" beforeDir="false" afterPath="$PROJECT_DIR$/install" afterDir="false" />
<change beforePath="$PROJECT_DIR$/settings" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/wg_func.py" beforeDir="false" afterPath="$PROJECT_DIR$/cls_mth_fc.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/start_wg.py" beforeDir="false" afterPath="$PROJECT_DIR$/start_wg.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/theme" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/wg_func.py" beforeDir="false" afterPath="$PROJECT_DIR$/wg_func.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/wg_main.py" beforeDir="false" afterPath="$PROJECT_DIR$/wg_main.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/wg_main.py" beforeDir="false" afterPath="$PROJECT_DIR$/wg_main.py" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
@ -30,7 +35,7 @@
<component name="Git.Settings"> <component name="Git.Settings">
<option name="RECENT_BRANCH_BY_REPOSITORY"> <option name="RECENT_BRANCH_BY_REPOSITORY">
<map> <map>
<entry key="$PROJECT_DIR$" value="main" /> <entry key="$PROJECT_DIR$" value="1.11.0824" />
</map> </map>
</option> </option>
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
@ -51,27 +56,28 @@
<option name="hideEmptyMiddlePackages" value="true" /> <option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" /> <option name="showLibraryContents" value="true" />
</component> </component>
<component name="PropertiesComponent">{ <component name="PropertiesComponent"><![CDATA[{
&quot;keyToString&quot;: { "keyToString": {
&quot;ASKED_ADD_EXTERNAL_FILES&quot;: &quot;true&quot;, "ASKED_ADD_EXTERNAL_FILES": "true",
&quot;Python.INSTALL.executor&quot;: &quot;Run&quot;, "Python.INSTALL.executor": "Run",
&quot;Python.install.executor&quot;: &quot;Run&quot;, "Python.install.executor": "Run",
&quot;Python.main.executor&quot;: &quot;Run&quot;, "Python.main.executor": "Run",
&quot;Python.messagebox.executor&quot;: &quot;Run&quot;, "Python.messagebox.executor": "Run",
&quot;Python.start_wg.executor&quot;: &quot;Run&quot;, "Python.start_wg.executor": "Run",
&quot;Python.testtheme.executor&quot;: &quot;Run&quot;, "Python.testtheme.executor": "Run",
&quot;Python.wg_func.executor&quot;: &quot;Run&quot;, "Python.wg_func.executor": "Run",
&quot;Python.wg_main.executor&quot;: &quot;Run&quot;, "Python.wg_main.executor": "Run",
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;, "RunOnceActivity.ShowReadmeOnStart": "true",
&quot;Shell Script.install.executor&quot;: &quot;Run&quot;, "Shell Script.install.executor": "Run",
&quot;Shell Script.run_as.executor&quot;: &quot;Run&quot;, "Shell Script.run_as.executor": "Run",
&quot;git-widget-placeholder&quot;: &quot;main&quot;, "git-widget-placeholder": "1.11.0824",
&quot;last_opened_file_path&quot;: &quot;/home/punix/Pyapps/wire-py&quot;, "last_opened_file_path": "/home/punix/Pyapps/wire-py/lx-icons",
&quot;settings.editor.selected.configurable&quot;: &quot;reference.settingsdialog.IDE.editor.colors&quot; "settings.editor.selected.configurable": "reference.settingsdialog.IDE.editor.colors"
} }
}</component> }]]></component>
<component name="RecentsManager"> <component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS"> <key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/lx-icons" />
<recent name="$PROJECT_DIR$" /> <recent name="$PROJECT_DIR$" />
</key> </key>
<key name="MoveFile.RECENT_KEYS"> <key name="MoveFile.RECENT_KEYS">
@ -135,7 +141,7 @@
<component name="SharedIndexes"> <component name="SharedIndexes">
<attachedChunks> <attachedChunks>
<set> <set>
<option value="bundled-python-sdk-0e3be3396995-c546a90a8094-com.jetbrains.pycharm.community.sharedIndexes.bundled-PC-242.23339.19" /> <option value="bundled-python-sdk-8336bb23522e-31b6be0877a2-com.jetbrains.pycharm.community.sharedIndexes.bundled-PC-241.19072.16" />
</set> </set>
</attachedChunks> </attachedChunks>
</component> </component>
@ -148,30 +154,6 @@
<option name="presentableId" value="Default" /> <option name="presentableId" value="Default" />
<updated>1723279982210</updated> <updated>1723279982210</updated>
</task> </task>
<task id="LOCAL-00017" summary="remove a ',' in DNS Name">
<option name="closed" value="true" />
<created>1724576599289</created>
<option name="number" value="00017" />
<option name="presentableId" value="LOCAL-00017" />
<option name="project" value="LOCAL" />
<updated>1724576599289</updated>
</task>
<task id="LOCAL-00018" summary="fix when Filname &gt; 17 first copy file after rename">
<option name="closed" value="true" />
<created>1724593165879</created>
<option name="number" value="00018" />
<option name="presentableId" value="LOCAL-00018" />
<option name="project" value="LOCAL" />
<updated>1724593165879</updated>
</task>
<task id="LOCAL-00019" summary="add export Tunnel as zip">
<option name="closed" value="true" />
<created>1724610514657</created>
<option name="number" value="00019" />
<option name="presentableId" value="LOCAL-00019" />
<option name="project" value="LOCAL" />
<updated>1724610514658</updated>
</task>
<task id="LOCAL-00020" summary="columnconfigure on all widgets set"> <task id="LOCAL-00020" summary="columnconfigure on all widgets set">
<option name="closed" value="true" /> <option name="closed" value="true" />
<created>1724778892233</created> <created>1724778892233</created>
@ -540,18 +522,37 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1729938941027</updated> <updated>1729938941027</updated>
</task> </task>
<option name="localTasksCounter" value="66" /> <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>
<option name="localTasksCounter" value="69" />
<servers /> <servers />
</component> </component>
<component name="UnknownFeatures"> <component name="UnknownFeatures">
<option featureType="com.intellij.fileTypeFactory" implementationName="*.policy" /> <option featureType="com.intellij.fileTypeFactory" implementationName="*.policy" />
</component> </component>
<component name="Vcs.Log.Tabs.Properties"> <component name="Vcs.Log.Tabs.Properties">
<option name="OPEN_GENERIC_TABS">
<map>
<entry key="f9756e7d-0c5c-4b84-84e4-660314c46ea4" value="TOOL_WINDOW" />
</map>
</option>
<option name="TAB_STATES"> <option name="TAB_STATES">
<map> <map>
<entry key="MAIN"> <entry key="MAIN">
@ -562,7 +563,7 @@
<entry key="branch"> <entry key="branch">
<value> <value>
<list> <list>
<option value="origin/wire-py-reformat-14-08-2024" /> <option value="1.11.0824" />
</list> </list>
</value> </value>
</entry> </entry>
@ -571,17 +572,11 @@
</State> </State>
</value> </value>
</entry> </entry>
<entry key="f9756e7d-0c5c-4b84-84e4-660314c46ea4">
<value>
<State />
</value>
</entry>
</map> </map>
</option> </option>
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" /> <option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
<MESSAGE value="fix a filedialog for hidden Files work&#10;install rollback to bash for start wirepy and wirepy rollback to bash" />
<MESSAGE value="install rollback bash to py wirepy and wirepy rollback to py" /> <MESSAGE value="install rollback bash to py wirepy and wirepy rollback to py" />
<MESSAGE value="fix install and .desktop File Tar works now for user home and filebrowser.askfilebrowser start now in user home" /> <MESSAGE value="fix install and .desktop File Tar works now for user home and filebrowser.askfilebrowser start now in user home" />
<MESSAGE value="replace tar with zip and Check if Zip file is empty" /> <MESSAGE value="replace tar with zip and Check if Zip file is empty" />
@ -606,7 +601,8 @@
<MESSAGE value=" - Add Options, Help, Update Label and Update Menubutton &#10; - Theme now separate Light and Dark" /> <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. Move to wg_main Import Start/StopBTN and Tooltip" />
<MESSAGE value="- Optimize Class and Tooltip" /> <MESSAGE value="- Optimize Class and Tooltip" />
<option name="LAST_COMMIT_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" />
<option name="LAST_COMMIT_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" />
</component> </component>
<component name="XDebuggerManager"> <component name="XDebuggerManager">
<breakpoint-manager> <breakpoint-manager>

View File

@ -3,11 +3,17 @@ My standard System: Linux Mint 22 Cinnamon
## [Unreleased] ## [Unreleased]
- os import in wg_func replaced by other methods - os import in cls_mth_fc.py replaced by other methods
- If Wire-Py already runs, prevent further start - If Wire-Py already runs, prevent further start
- for loops with lists replaced by List Comprehensions - for loops with lists replaced by List Comprehensions
- Update search after start of Wire-Py - Update search after start of Wire-Py
### Added
08-11-2024
- Preparation for language translation part 1
- separate folder for general icons
- install edit for new dir lx-icons
### Added ### Added
08-11-2024 08-11-2024

View File

@ -6,25 +6,31 @@ import subprocess
import time import time
import tkinter as tk import tkinter as tk
import zipfile import zipfile
import gettext
import locale
from datetime import datetime from datetime import datetime
from pathlib import Path from pathlib import Path
from subprocess import check_call from subprocess import check_call
from tkinter import ttk from tkinter import ttk
import requests import requests
APP = 'cls_mth_fc'
LOCALE_DIR = "/usr/share/locale/"
locale.bindtextdomain(APP, LOCALE_DIR)
gettext.bindtextdomain(APP, LOCALE_DIR)
gettext.textdomain(APP)
_ = gettext.gettext
''' 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 = 'v. 1.11.0824' version = 'v. 1.11.0824'
path_to_file2 = Path('/etc/wire_py/settings.conf') path_to_file2 = Path('/etc/wire_py/settings.conf')
_u = Path.read_text(Path('/tmp/_u')) _u = Path.read_text(Path('/tmp/_u'))
UPDATE_API_URL = 'https://git.ilunix.de/api/v1/repos/punix/Wire-Py/releases'
class WirePyUpdate: class GiteaUpdate:
@staticmethod @staticmethod
def api_down(): def api_down(UPDATE_API_URL):
try: try:
response = requests.get(UPDATE_API_URL) response = requests.get(UPDATE_API_URL)
response_dict = response.json() response_dict = response.json()
@ -35,44 +41,43 @@ class WirePyUpdate:
if version[3:] != response_dict['tag_name']: if version[3:] != response_dict['tag_name']:
return response_dict['tag_name'] return response_dict['tag_name']
else: else:
return 'No Updates' return _('No Updates')
else: else:
return 'False' return _('False')
except requests.exceptions.ConnectionError: except requests.exceptions.ConnectionError:
return 'No Internet Connection!' return 'No Internet Connection!'
@staticmethod @staticmethod
def download(): def download(URLD):
try: try:
url = f'https://git.ilunix.de/punix/Wire-Py/archive/{res}.zip' to_down = 'wget -qP ' + str(_u) + ' ' + URLD
to_down = 'wget -qP ' + str(_u) + ' ' + url
result = subprocess.call(to_down, shell=True) result = subprocess.call(to_down, shell=True)
if result == 0: if result == 0:
shutil.chown(str(_u) + f'/{res}.zip', 1000, 1000) shutil.chown(str(_u) + f'/{res}.zip', 1000, 1000)
"""img_w, img_i, w_title, w_txt hand over""" """img_w, img_i, w_title, w_txt hand over"""
iw = r'/usr/share/icons/wp-icons/64/info.png' iw = r'/usr/share/icons/lx-icons/64/info.png'
ii = r'/usr/share/icons/wp-icons/48/wg_vpn.png' ii = r'/usr/share/icons/wp-icons/48/wg_vpn.png'
wt = 'Download Successful' wt = _('Download Successful')
msg_t = 'Your zip file is in home directory' msg_t = _('Your zip file is in home directory')
msg_window(iw, ii, wt, msg_t) msg_window(iw, ii, wt, msg_t)
else: else:
"""img_w, img_i, w_title, w_txt hand over""" """img_w, img_i, w_title, w_txt hand over"""
iw = r'/usr/share/icons/wp-icons/64/error.png' iw = r'/usr/share/icons/lx-icons/64/error.png'
ii = r'/usr/share/icons/wp-icons/48/wg_msg.png' ii = r'/usr/share/icons/wp-icons/48/wg_msg.png'
wt = 'Download error' wt = _('Download error')
msg_t = 'Download failed! Please try again' msg_t = _('Download failed! Please try again')
msg_window(iw, ii, wt, msg_t) msg_window(iw, ii, wt, msg_t)
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
"""img_w, img_i, w_title, w_txt hand over""" """img_w, img_i, w_title, w_txt hand over"""
iw = r'/usr/share/icons/wp-icons/64/error.png' iw = r'/usr/share/icons/lx-icons/64/error.png'
ii = r'/usr/share/icons/wp-icons/48/wg_msg.png' ii = r'/usr/share/icons/wg-icons/48/wg_msg.png'
wt = 'Download error' wt = _('Download error')
msg_t = 'Download failed! No internet connection!' msg_t = _('Download failed! No internet connection!')
msg_window(iw, ii, wt, msg_t) msg_window(iw, ii, wt, msg_t)
res = WirePyUpdate.api_down() res = GiteaUpdate.api_down('https://git.ilunix.de/api/v1/repos/punix/Wire-Py/releases')
@ -80,7 +85,7 @@ def msg_window(img_w, img_i, w_title, w_txt, txt2=None, com=None):
""" """
Function for different message windows for the user. with 4 arguments to be passed. Function for different message windows for the user. with 4 arguments to be passed.
To create messages with your own images, icons, and titles. As an alternative to Python Messagebox. To create messages with your own images, icons, and titles. As an alternative to Python Messagebox.
Paths to images must be specified: r'/usr/share/icons/wp-icons/64/info.png' Paths to images must be specified: r'/usr/share/icons/lx-icons/64/info.png'
img_w = Image for Tk Window img_w = Image for Tk Window
img_i = Image for Icon img_i = Image for Icon
w_title = Windows Title w_title = Windows Title
@ -228,28 +233,28 @@ class Tunnel:
if len(zf.namelist()) != 0: if len(zf.namelist()) != 0:
"""img_w, img_i, w_title, w_txt hand over""" """img_w, img_i, w_title, w_txt hand over"""
iw = r'/usr/share/icons/wp-icons/64/info.png' iw = r'/usr/share/icons/lx-icons/64/info.png'
ii = r'/usr/share/icons/wp-icons/48/wg_vpn.png' ii = r'/usr/share/icons/wp-icons/48/wg_vpn.png'
wt = 'Export Successful' wt = _('Export Successful')
msg_t = 'Your zip file is in home directory' msg_t = _('Your zip file is in home directory')
msg_window(iw, ii, wt, msg_t) msg_window(iw, ii, wt, msg_t)
else: else:
"""img_w, img_i, w_title, w_txt hand over""" """img_w, img_i, w_title, w_txt hand over"""
iw = r'/usr/share/icons/wp-icons/64/error.png' iw = r'/usr/share/icons/lx-icons/64/error.png'
ii = r'/usr/share/icons/wp-icons/48/wg_msg.png' ii = r'/usr/share/icons/wp-icons/48/wg_msg.png'
wt = 'Export error' wt = _('Export error')
msg_t = 'Export failed! Please try again' msg_t = _('Export failed! Please try again')
msg_window(iw, ii, wt, msg_t) msg_window(iw, ii, wt, msg_t)
else: else:
"""img_w, img_i, w_title, w_txt hand over""" """img_w, img_i, w_title, w_txt hand over"""
iw = r'/usr/share/icons/wp-icons/64/info.png' iw = r'/usr/share/icons/lx-icons/64/info.png'
ii = r'/usr/share/icons/wp-icons/48/wg_msg.png' ii = r'/usr/share/icons/wp-icons/48/wg_msg.png'
wt = 'Select tunnel' wt = _('Select tunnel')
msg_t = 'Please first import tunnel.' msg_t = _('Please first import tunnel.')
msg_window(iw, ii, wt, msg_t) msg_window(iw, ii, wt, msg_t)
except TypeError: except TypeError:

16
install
View File

@ -7,9 +7,9 @@ BLUE='\033[30;1;34m'
install_file_with(){ install_file_with(){
clear clear
sudo apt install python3-tk && \ sudo apt install python3-tk && \
sudo cp -u wg_main.py start_wg.py wg_func.py wirepy.py run_as open_gitea.py /usr/bin/ && \ sudo cp -u wg_main.py start_wg.py cls_mth_fc.py wirepy.py run_as open_gitea.py /usr/bin/ && \
sudo mkdir -p /etc/wire_py && sudo touch /etc/wire_py/.keys && sudo cp -u settings.conf /etc/wire_py/ && \ sudo mkdir -p /etc/wire_py && sudo touch /etc/wire_py/.keys && sudo cp -u settings.conf /etc/wire_py/ && \
sudo cp -uR wp-icons /usr/share/icons/ && sudo cp -uR TK-Themes /usr/share/ && \ sudo cp -uR wp-icons lx-icons /usr/share/icons/ && sudo cp -uR TK-Themes /usr/share/ && \
sudo chown -R root:root /etc/wire_py && sudo chmod 755 /etc/wire_py && \ sudo chown -R root:root /etc/wire_py && sudo chmod 755 /etc/wire_py && \
sudo ln -sf /usr/bin/wirepy.py /usr/local/bin/wirepy && \ sudo ln -sf /usr/bin/wirepy.py /usr/local/bin/wirepy && \
sudo cp -u org.wirepy.policy /usr/share/polkit-1/actions/ && \ sudo cp -u org.wirepy.policy /usr/share/polkit-1/actions/ && \
@ -21,9 +21,9 @@ install_file_with(){
install_arch_d(){ install_arch_d(){
clear clear
sudo pacman -S --noconfirm tk python3 python-requests && \ sudo pacman -S --noconfirm tk python3 python-requests && \
sudo cp -u wg_main.py start_wg.py wg_func.py wirepy.py run_as open_gitea.py /usr/bin/ && \ sudo cp -u wg_main.py start_wg.py cls_mth_fc.py wirepy.py run_as open_gitea.py /usr/bin/ && \
sudo mkdir -p /etc/wire_py && sudo touch /etc/wire_py/.keys && sudo cp -u settings.conf /etc/wire_py/ && \ sudo mkdir -p /etc/wire_py && sudo touch /etc/wire_py/.keys && sudo cp -u settings.conf /etc/wire_py/ && \
sudo cp -uR wp-icons /usr/share/icons/ && sudo cp -uR TK-Themes /usr/share/ && \ sudo cp -uR wp-icons lx-icons /usr/share/icons/ && sudo cp -uR TK-Themes /usr/share/ && \
sudo chown -R root:root /etc/wire_py && sudo chmod 755 /etc/wire_py && \ sudo chown -R root:root /etc/wire_py && sudo chmod 755 /etc/wire_py && \
sudo ln -sf /usr/bin/wirepy.py /usr/local/bin/wirepy && \ sudo ln -sf /usr/bin/wirepy.py /usr/local/bin/wirepy && \
sudo cp -u org.wirepy.policy /usr/share/polkit-1/actions/ && \ sudo cp -u org.wirepy.policy /usr/share/polkit-1/actions/ && \
@ -89,10 +89,10 @@ elif grep -i 'fedora' /etc/os-release > /dev/null 2>&1
if ! which python3-tkinter &> /dev/null if ! which python3-tkinter &> /dev/null
then sudo dnf install python3-tkinter -y then sudo dnf install python3-tkinter -y
sudo cp -u wg_main.py start_wg.py wg_func.py wirepy.py run_as open_gitea.py /usr/bin/ && \ sudo cp -u wg_main.py start_wg.py cls_mth_fc.py wirepy.py run_as open_gitea.py /usr/bin/ && \
sudo mkdir -p /etc/wire_py && sudo touch /etc/wire_py/.keys && \ sudo mkdir -p /etc/wire_py && sudo touch /etc/wire_py/.keys && \
sudo cp -u settings.conf /etc/wire_py/ && \ sudo cp -u settings.conf /etc/wire_py/ && \
sudo cp -uR wp-icons /usr/share/icons/ && sudo cp -uR TK-Themes /usr/share/ && \ sudo cp -uR wp-icons lx-icons /usr/share/icons/ && sudo cp -uR TK-Themes /usr/share/ && \
sudo chown -R root:root /etc/wire_py && sudo chmod 755 /etc/wire_py && \ sudo chown -R root:root /etc/wire_py && sudo chmod 755 /etc/wire_py && \
sudo ln -sf /usr/bin/wirepy.py /usr/local/bin/wirepy && \ sudo ln -sf /usr/bin/wirepy.py /usr/local/bin/wirepy && \
sudo cp -u org.wirepy.policy /usr/share/polkit-1/actions/ && \ sudo cp -u org.wirepy.policy /usr/share/polkit-1/actions/ && \
@ -105,10 +105,10 @@ elif grep -i 'suse' /etc/os-release > /dev/null 2>&1
then then
if ! which python311-tk &> /dev/null if ! which python311-tk &> /dev/null
then sudo zypper install python311-tk then sudo zypper install python311-tk
sudo cp -u wg_main.py start_wg.py wg_func.py wirepy.py run_as open_gitea.py /usr/bin/ && \ sudo cp -u wg_main.py start_wg.py cls_mth_fc.py wirepy.py run_as open_gitea.py /usr/bin/ && \
sudo mkdir -p /etc/wire_py && sudo touch /etc/wire_py/.keys && \ sudo mkdir -p /etc/wire_py && sudo touch /etc/wire_py/.keys && \
sudo cp -u settings.conf /etc/wire_py/ && \ sudo cp -u settings.conf /etc/wire_py/ && \
sudo cp -uR wp-icons /usr/share/icons/ && sudo cp -uR TK-Themes /usr/share/ && \ sudo cp -uR wp-icons lx-icons /usr/share/icons/ && sudo cp -uR TK-Themes /usr/share/ && \
sudo chown -R root:root /etc/wire_py && sudo chmod 755 /etc/wire_py && \ sudo chown -R root:root /etc/wire_py && sudo chmod 755 /etc/wire_py && \
sudo ln -sf /usr/bin/wirepy.py /usr/local/bin/wirepy && \ sudo ln -sf /usr/bin/wirepy.py /usr/local/bin/wirepy && \
sudo cp -u org.wirepy.policy /usr/share/polkit-1/actions/ && \ sudo cp -u org.wirepy.policy /usr/share/polkit-1/actions/ && \

BIN
lx-icons/128/error.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

BIN
lx-icons/128/info.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

BIN
lx-icons/256/error.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
lx-icons/256/info.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
lx-icons/32/error.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

BIN
lx-icons/32/info.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
lx-icons/48/error.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

BIN
lx-icons/48/info.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
lx-icons/64/error.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
lx-icons/64/info.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -1,4 +1,6 @@
#!/usr/bin/python3 #!/usr/bin/python3
import gettext
import locale
import os import os
import shutil import shutil
import subprocess import subprocess
@ -7,10 +9,17 @@ from pathlib import Path
from subprocess import check_call from subprocess import check_call
from tkinter import filedialog, ttk, TclError from tkinter import filedialog, ttk, TclError
from wg_func import (Tunnel, msg_window, WirePyUpdate, res, _u, version, path_to_file2, tips) from cls_mth_fc import (Tunnel, msg_window, GiteaUpdate, res, _u, version, path_to_file2, tips)
tcl_path = Path('/usr/share/TK-Themes') tcl_path = Path('/usr/share/TK-Themes')
APP = 'wg_main'
LOCALE_DIR = "/usr/share/locale/"
locale.bindtextdomain(APP, LOCALE_DIR)
gettext.bindtextdomain(APP, LOCALE_DIR)
gettext.textdomain(APP)
_ = gettext.gettext
class MainWindow(tk.Tk): class MainWindow(tk.Tk):
@ -62,7 +71,7 @@ class FrameWidgets(ttk.Frame):
self.imp_pic = tk.PhotoImage(file=r'/usr/share/icons/wp-icons/48/wg_import.png') self.imp_pic = tk.PhotoImage(file=r'/usr/share/icons/wp-icons/48/wg_import.png')
self.tr_pic = tk.PhotoImage(file=r'/usr/share/icons/wp-icons/48/wg_trash.png') self.tr_pic = tk.PhotoImage(file=r'/usr/share/icons/wp-icons/48/wg_trash.png')
self.exp_pic = tk.PhotoImage(file=r'/usr/share/icons/wp-icons/48/wg_export.png') self.exp_pic = tk.PhotoImage(file=r'/usr/share/icons/wp-icons/48/wg_export.png')
self.warning_pic = tk.PhotoImage(file=r'/usr/share/icons/wp-icons/64/error.png') self.warning_pic = tk.PhotoImage(file=r'/usr/share/icons/lx-icons/64/error.png')
self.wg_vpn_start = tk.PhotoImage(file=r'/usr/share/icons/wp-icons/48/wg_vpn-start.png') self.wg_vpn_start = tk.PhotoImage(file=r'/usr/share/icons/wp-icons/48/wg_vpn-start.png')
self.wg_vpn_stop = tk.PhotoImage(file=r'/usr/share/icons/wp-icons/48/wg_vpn-stop.png') self.wg_vpn_stop = tk.PhotoImage(file=r'/usr/share/icons/wp-icons/48/wg_vpn-stop.png')
@ -133,12 +142,12 @@ class FrameWidgets(ttk.Frame):
"""img_w, img_i, w_title, w_txt , txt2, com hand over""" """img_w, img_i, w_title, w_txt , txt2, com hand over"""
iw = r'/usr/share/icons/wp-icons/48/wg_vpn.png' iw = r'/usr/share/icons/wp-icons/48/wg_vpn.png'
ii = r'/usr/share/icons/wp-icons/48/wg_msg.png' ii = r'/usr/share/icons/wp-icons/48/wg_msg.png'
wt = 'Info' wt = _('Info')
msg_t = ('Wire-Py a simple Wireguard Gui for Linux systems.\n\n' msg_t = (_('Wire-Py a simple Wireguard Gui for Linux systems.\n\n'
'Wire-Py is open source software written in Python.\n\n' 'Wire-Py is open source software written in Python.\n\n'
'Email: polunga40@unity-mail.de also likes for donation.\n\n' 'Email: polunga40@unity-mail.de also likes for donation.\n\n'
'Use without warranty!\n') 'Use without warranty!\n'))
txt2 = 'Go to Wire-Py git' txt2 = _('Go to Wire-Py git')
com = link_btn com = link_btn
msg_window(iw, ii, wt, msg_t, txt2, com) msg_window(iw, ii, wt, msg_t, txt2, com)
@ -162,12 +171,12 @@ class FrameWidgets(ttk.Frame):
''' Remove Tool-Tip ''' ''' Remove Tool-Tip '''
window.my_tool_tip.destroy() window.my_tool_tip.destroy()
self.options_btn = ttk.Menubutton(self.menu_frame, text='Options') self.options_btn = ttk.Menubutton(self.menu_frame, text=_('Options'))
self.options_btn.grid(column=1, row=0) self.options_btn.grid(column=1, row=0)
def sets_enter(event): def sets_enter(event):
""" The mouse moves into the entry widget """ """ The mouse moves into the entry widget """
window.my_tool_tip = MyToolTip(event.x_root, event.y_root, 'Click for Settings') window.my_tool_tip = MyToolTip(event.x_root, event.y_root, _('Click for Settings'))
def sets_leave(_): def sets_leave(_):
""" The mouse moves from the entry widget """ """ The mouse moves from the entry widget """
@ -183,13 +192,13 @@ class FrameWidgets(ttk.Frame):
set_tip = tk.BooleanVar() set_tip = tk.BooleanVar()
self.settings = tk.Menu(self, relief='flat') self.settings = tk.Menu(self, relief='flat')
self.options_btn.configure(menu=self.settings, style='Toolbutton') self.options_btn.configure(menu=self.settings, style='Toolbutton')
self.settings.add_checkbutton(label='Disable Updates', command=update, variable=set_update) self.settings.add_checkbutton(label=_('Disable Updates'), command=update, variable=set_update)
self.settings.add_checkbutton(label='Disable Tooltips', command=tooltip, variable=set_tip) self.settings.add_checkbutton(label=_('Disable Tooltips'), command=tooltip, variable=set_tip)
self.settings.add_command(label='Light', command=theme_change_light) self.settings.add_command(label=_('Light'), command=theme_change_light)
self.settings.add_command(label='Dark', command=theme_change_dark) self.settings.add_command(label=_('Dark'), command=theme_change_dark)
''' About BTN Menu / Label ''' ''' About BTN Menu / Label '''
self.about_btn = ttk.Button(self.menu_frame, text='About', style='Toolbutton', command=info) self.about_btn = ttk.Button(self.menu_frame, text=_('About'), style='Toolbutton', command=info)
self.about_btn.grid(column=2, row=0) self.about_btn.grid(column=2, row=0)
self.readme = tk.Menu(self) self.readme = tk.Menu(self)
@ -205,11 +214,11 @@ class FrameWidgets(ttk.Frame):
'''View Checkbox for enable or disable Updates ''' '''View Checkbox for enable or disable Updates '''
if res == 'False': if res == 'False':
set_update.set(value=1) set_update.set(value=1)
self.updates_lb.configure(text='Update search off') self.updates_lb.configure(text=_('Update search off'))
def disable_enter(event): def disable_enter(event):
""" The mouse moves into the entry widget """ """ The mouse moves into the entry widget """
window.my_tool_tip = MyToolTip(event.x_root, event.y_root, 'Updates you have disabled') window.my_tool_tip = MyToolTip(event.x_root, event.y_root, _('Updates you have disabled'))
def disable_leave(_): def disable_leave(_):
""" The mouse moves from the entry widget """ """ The mouse moves from the entry widget """
@ -219,14 +228,13 @@ class FrameWidgets(ttk.Frame):
self.updates_lb.bind('<Enter>', disable_enter) self.updates_lb.bind('<Enter>', disable_enter)
self.updates_lb.bind('<Leave>', disable_leave) self.updates_lb.bind('<Leave>', disable_leave)
elif res == 'No Internet Connection!': elif res == 'No Internet Connection!':
self.updates_lb.configure(text='No Server Connection!', foreground='red') self.updates_lb.configure(text=_('No Server Connection!'), foreground='red')
elif res == 'No Updates': elif res == 'No Updates':
self.updates_lb.configure(text='No Updates') self.updates_lb.configure(text=_('No Updates'))
def congratulations_enter(event): def congratulations_enter(event):
""" The mouse moves into the entry widget """ """ The mouse moves into the entry widget """
window.my_tool_tip = MyToolTip(event.x_root, event.y_root, window.my_tool_tip = MyToolTip(event.x_root, event.y_root, _('Congratulations! Wire-Py is up to date'))
'Congratulations! Wire-Py is up to date')
def congratulations_leave(_): def congratulations_leave(_):
""" The mouse moves from the entry widget """ """ The mouse moves from the entry widget """
@ -237,7 +245,7 @@ class FrameWidgets(ttk.Frame):
self.updates_lb.bind('<Leave>', congratulations_leave) self.updates_lb.bind('<Leave>', congratulations_leave)
else: else:
set_update.set(value=0) set_update.set(value=0)
text = f'Update {res} available!' text = _(f'Update {res} available!')
''' Update BTN Menu''' ''' Update BTN Menu'''
self.update_btn = ttk.Menubutton(self.menu_frame, text=text) self.update_btn = ttk.Menubutton(self.menu_frame, text=text)
@ -245,7 +253,7 @@ class FrameWidgets(ttk.Frame):
def download_enter(event): def download_enter(event):
""" The mouse moves into the entry widget """ """ The mouse moves into the entry widget """
window.my_tool_tip = MyToolTip(event.x_root, event.y_root, 'Click to download new version') window.my_tool_tip = MyToolTip(event.x_root, event.y_root, _('Click to download new version'))
def download_leave(_): def download_leave(_):
""" The mouse moves from the entry widget """ """ The mouse moves from the entry widget """
@ -258,7 +266,8 @@ class FrameWidgets(ttk.Frame):
self.download = tk.Menu(self, relief='flat') self.download = tk.Menu(self, relief='flat')
self.update_btn.configure(menu=self.download, style='Toolbutton') self.update_btn.configure(menu=self.download, style='Toolbutton')
self.download.add_command(label='Download', command=WirePyUpdate.download) self.download.add_command(label=_('Download'), command=GiteaUpdate.download(f'https://git.ilunix.de/punix'
f'/Wire-Py/archive/{res}.zip'))
''' Show active Tunnel ''' ''' Show active Tunnel '''
self.a = Tunnel.active() self.a = Tunnel.active()
@ -284,7 +293,7 @@ class FrameWidgets(ttk.Frame):
''' Show active Label ''' ''' Show active Label '''
self.select_tunnel = None self.select_tunnel = None
self.lb = ttk.Label(self, text='Active: ') self.lb = ttk.Label(self, text=_('Active: '))
self.lb.config(font=('Ubuntu', 11, 'bold')) self.lb.config(font=('Ubuntu', 11, 'bold'))
self.lb.grid(column=2, row=1, padx=15, pady=4, sticky='w') self.lb.grid(column=2, row=1, padx=15, pady=4, sticky='w')
@ -293,12 +302,12 @@ class FrameWidgets(ttk.Frame):
self.color_label() self.color_label()
''' Interface Label ''' ''' Interface Label '''
self.interface = ttk.Label(self.lb_frame, text='Interface') self.interface = ttk.Label(self.lb_frame, text=_('Interface'))
self.interface.grid(column=0, row=3, sticky='we', padx=120) self.interface.grid(column=0, row=3, sticky='we', padx=120)
self.interface.config(font=('Ubuntu', 9)) self.interface.config(font=('Ubuntu', 9))
''' Peer Label ''' ''' Peer Label '''
self.peer = ttk.Label(self.lb_frame2, text='Peer') self.peer = ttk.Label(self.lb_frame2, text=_('Peer'))
self.peer.config(font=('Ubuntu', 9)) self.peer.config(font=('Ubuntu', 9))
self.peer.grid(column=0, row=4, sticky='we', padx=130) self.peer.grid(column=0, row=4, sticky='we', padx=130)
@ -329,8 +338,7 @@ class FrameWidgets(ttk.Frame):
def list_empty_enter(event): def list_empty_enter(event):
""" The mouse moves into the entry widget """ """ The mouse moves into the entry widget """
window.my_tool_tip = MyToolTip(event.x_root, event.y_root, window.my_tool_tip = MyToolTip(event.x_root, event.y_root, _('You must first import\na Wireguard tunnel'))
'You must first import\na Wireguard tunnel')
def list_empty_leave(_): def list_empty_leave(_):
""" The mouse moves from the entry widget """ """ The mouse moves from the entry widget """
@ -339,7 +347,7 @@ class FrameWidgets(ttk.Frame):
def list_not_empty_enter(event): def list_not_empty_enter(event):
""" The mouse moves into the entry widget """ """ The mouse moves into the entry widget """
window.my_tool_tip = MyToolTip(event.x_root, event.y_root, 'Select a Tunnel') window.my_tool_tip = MyToolTip(event.x_root, event.y_root, _('Select a Tunnel'))
def list_not_empty_leave(_): def list_not_empty_leave(_):
""" The mouse moves from the entry widget """ """ The mouse moves from the entry widget """
@ -379,7 +387,7 @@ class FrameWidgets(ttk.Frame):
def imp_enter(event): def imp_enter(event):
""" The mouse moves into the entry widget """ """ The mouse moves into the entry widget """
window.my_tool_tip = MyToolTip(event.x_root, event.y_root, 'Click to import a Wireguard Tunnel') window.my_tool_tip = MyToolTip(event.x_root, event.y_root, _('Click to import a Wireguard Tunnel'))
def imp_leave(_): def imp_leave(_):
""" The mouse moves from the entry widget """ """ The mouse moves from the entry widget """
@ -406,7 +414,7 @@ class FrameWidgets(ttk.Frame):
with open(path_to_file2, 'w') as set_file7: with open(path_to_file2, 'w') as set_file7:
set_file7.writelines(lines6) set_file7.writelines(lines6)
self.selected_option.set(0) self.selected_option.set(0)
self.autoconnect_var.set('no Autoconnect') self.autoconnect_var.set(_('no Autoconnect'))
Path.unlink(Path('/etc/wire_py') / str(select_tl + '.conf')) Path.unlink(Path('/etc/wire_py') / str(select_tl + '.conf'))
with open('/etc/wire_py/.keys', 'r') as readfile: with open('/etc/wire_py/.keys', 'r') as readfile:
@ -423,8 +431,7 @@ class FrameWidgets(ttk.Frame):
def empty_list_start_enter(event): def empty_list_start_enter(event):
""" The mouse moves into the entry widget """ """ The mouse moves into the entry widget """
window.my_tool_tip = MyToolTip(event.x_root, event.y_root, window.my_tool_tip = MyToolTip(event.x_root, event.y_root, _('No tunnels to start in the list'))
'No tunnels to start in the list')
def empty_list_start_leave(_): def empty_list_start_leave(_):
""" The mouse moves from the entry widget """ """ The mouse moves from the entry widget """
@ -446,7 +453,7 @@ class FrameWidgets(ttk.Frame):
self.btn_stst.bind('<Leave>', empty_list_start_leave) self.btn_stst.bind('<Leave>', empty_list_start_leave)
self.lb_rename.bind('<Enter>', rename_no_active_enter) self.lb_rename.bind('<Enter>', rename_no_active_enter)
self.lb_rename.bind('<Leave>', rename_no_active_leave) self.lb_rename.bind('<Leave>', rename_no_active_leave)
self.lb_rename.insert(0, 'Max. 12 characters!') self.lb_rename.insert(0, _('Max. 12 characters!'))
if self.a != '' and self.a == select_tl: if self.a != '' and self.a == select_tl:
self.StrVar.set(value='') self.StrVar.set(value='')
@ -464,19 +471,19 @@ class FrameWidgets(ttk.Frame):
if self.l_box.size() != 0: if self.l_box.size() != 0:
"""img_w, img_i, w_title, w_txt hand over""" """img_w, img_i, w_title, w_txt hand over"""
iw = r'/usr/share/icons/wp-icons/64/info.png' iw = r'/usr/share/icons/lx-icons/64/info.png'
ii = r'/usr/share/icons/wp-icons/48/wg_msg.png' ii = r'/usr/share/icons/wp-icons/48/wg_msg.png'
wt = 'Select tunnel' wt = _('Select tunnel')
msg_t = 'Please select a tunnel from the list.' msg_t = _('Please select a tunnel from the list.')
msg_window(iw, ii, wt, msg_t) msg_window(iw, ii, wt, msg_t)
else: else:
"""img_w, img_i, w_title, w_txt hand over""" """img_w, img_i, w_title, w_txt hand over"""
iw = r'/usr/share/icons/wp-icons/64/info.png' iw = r'/usr/share/icons/lx-icons/64/info.png'
ii = r'/usr/share/icons/wp-icons/48/wg_msg.png' ii = r'/usr/share/icons/wp-icons/48/wg_msg.png'
wt = 'Select tunnel' wt = _('Select tunnel')
msg_t = 'Please first import tunnel.' msg_t = _('Please first import tunnel.')
msg_window(iw, ii, wt, msg_t) msg_window(iw, ii, wt, msg_t)
''' Button Trash ''' ''' Button Trash '''
@ -486,7 +493,7 @@ class FrameWidgets(ttk.Frame):
def empty_list_enter(event): def empty_list_enter(event):
""" The mouse moves into the entry widget """ """ The mouse moves into the entry widget """
window.my_tool_tip = MyToolTip(event.x_root, event.y_root, 'No tunnels to delete in the list') window.my_tool_tip = MyToolTip(event.x_root, event.y_root, _('No tunnels to delete in the list'))
def empty_list_leave(_): def empty_list_leave(_):
""" The mouse moves from the entry widget """ """ The mouse moves from the entry widget """
@ -496,7 +503,7 @@ class FrameWidgets(ttk.Frame):
def del_enter(event): def del_enter(event):
""" The mouse moves into the entry widget """ """ The mouse moves into the entry widget """
window.my_tool_tip = MyToolTip(event.x_root, event.y_root, window.my_tool_tip = MyToolTip(event.x_root, event.y_root,
'Click to delete a Wireguard Tunnel\nSelect from the list!') _('Click to delete a Wireguard Tunnel\nSelect from the list!'))
def del_leave(_): def del_leave(_):
""" The mouse moves from the entry widget """ """ The mouse moves from the entry widget """
@ -516,7 +523,7 @@ class FrameWidgets(ttk.Frame):
def empty_list_enter(event): def empty_list_enter(event):
""" The mouse moves into the entry widget """ """ The mouse moves into the entry widget """
window.my_tool_tip = MyToolTip(event.x_root, event.y_root, 'No Tunnels in List for Export') window.my_tool_tip = MyToolTip(event.x_root, event.y_root, _('No Tunnels in List for Export'))
def empty_list_leave(_): def empty_list_leave(_):
""" The mouse moves from the entry widget """ """ The mouse moves from the entry widget """
@ -526,7 +533,7 @@ class FrameWidgets(ttk.Frame):
def exp_enter(event): def exp_enter(event):
""" The mouse moves into the entry widget """ """ The mouse moves into the entry widget """
window.my_tool_tip = MyToolTip(event.x_root, event.y_root, window.my_tool_tip = MyToolTip(event.x_root, event.y_root,
' Click to export all\nWireguard Tunnel to Zipfile') _(' Click to export all\nWireguard Tunnel to Zipfile'))
def exp_leave(_): def exp_leave(_):
""" The mouse moves from the entry widget """ """ The mouse moves from the entry widget """
@ -543,7 +550,7 @@ class FrameWidgets(ttk.Frame):
''' Label Entry ''' ''' Label Entry '''
self.lb_rename = ttk.Entry(self.lb_frame3, width=20) self.lb_rename = ttk.Entry(self.lb_frame3, width=20)
self.lb_rename.grid(column=2, row=0, padx=8, pady=10, sticky='ne') self.lb_rename.grid(column=2, row=0, padx=8, pady=10, sticky='ne')
self.lb_rename.insert(0, 'Max. 12 characters!') self.lb_rename.insert(0, _('Max. 12 characters!'))
self.lb_rename.config(state='disable') self.lb_rename.config(state='disable')
def rename_no_active_leave(_): def rename_no_active_leave(_):
@ -554,12 +561,12 @@ class FrameWidgets(ttk.Frame):
def rename_no_active_enter(event): def rename_no_active_enter(event):
""" The mouse moves into the entry widget """ """ The mouse moves into the entry widget """
window.my_tool_tip = MyToolTip(event.x_root, event.y_root, window.my_tool_tip = MyToolTip(event.x_root, event.y_root,
'To rename a tunnel, at least one must be in the list') _('To rename a tunnel, at least one must be in the list'))
def rename_enter(event): def rename_enter(event):
""" The mouse moves into the entry widget """ """ The mouse moves into the entry widget """
window.my_tool_tip = MyToolTip(event.x_root, event.y_root, window.my_tool_tip = MyToolTip(event.x_root, event.y_root,
'To rename a tunnel, you need to\nselect a tunnel from the list') _('To rename a tunnel, you need to\nselect a tunnel from the list'))
def rename_leave(_): def rename_leave(_):
""" The mouse moves from the entry widget """ """ The mouse moves from the entry widget """
@ -579,28 +586,28 @@ class FrameWidgets(ttk.Frame):
if len(self.lb_rename.get()) > 12: if len(self.lb_rename.get()) > 12:
"""img_w, img_i, w_title, w_txt hand over""" """img_w, img_i, w_title, w_txt hand over"""
iw = r'/usr/share/icons/wp-icons/64/info.png' iw = r'/usr/share/icons/lx-icons/64/info.png'
ii = r'/usr/share/icons/wp-icons/48/wg_msg.png' ii = r'/usr/share/icons/wp-icons/48/wg_msg.png'
wt = 'Renaming not possible' wt = _('Renaming not possible')
msg_t = 'The new name may contain only 12 characters.' msg_t = _('The new name may contain only 12 characters.')
msg_window(iw, ii, wt, msg_t) msg_window(iw, ii, wt, msg_t)
elif len(self.lb_rename.get()) == 0: elif len(self.lb_rename.get()) == 0:
"""img_w, img_i, w_title, w_txt hand over""" """img_w, img_i, w_title, w_txt hand over"""
iw = r'/usr/share/icons/wp-icons/64/info.png' iw = r'/usr/share/icons/lx-icons/64/info.png'
ii = r'/usr/share/icons/wp-icons/48/wg_msg.png' ii = r'/usr/share/icons/wp-icons/48/wg_msg.png'
wt = 'Renaming not possible' wt = _('Renaming not possible')
msg_t = 'At least one character must be entered.' msg_t = _('At least one character must be entered.')
msg_window(iw, ii, wt, msg_t) msg_window(iw, ii, wt, msg_t)
elif any(ch in special_characters for ch in self.lb_rename.get()): elif any(ch in special_characters for ch in self.lb_rename.get()):
"""img_w, img_i, w_title, w_txt hand over""" """img_w, img_i, w_title, w_txt hand over"""
iw = r'/usr/share/icons/wp-icons/64/info.png' iw = r'/usr/share/icons/lx-icons/64/info.png'
ii = r'/usr/share/icons/wp-icons/48/wg_msg.png' ii = r'/usr/share/icons/wp-icons/48/wg_msg.png'
wt = 'Renaming not possible' wt = _('Renaming not possible')
msg_t = 'No valid sign. These must not be used.\nBlank, Slash, Backslash and { }\n' msg_t = _('No valid sign. These must not be used.\nBlank, Slash, Backslash and { }\n')
msg_window(iw, ii, wt, msg_t) msg_window(iw, ii, wt, msg_t)
else: else:
@ -635,14 +642,14 @@ class FrameWidgets(ttk.Frame):
except IndexError: except IndexError:
"""img_w, img_i, w_title, w_txt hand over""" """img_w, img_i, w_title, w_txt hand over"""
iw = r'/usr/share/icons/wp-icons/64/info.png' iw = r'/usr/share/icons/lx-icons/64/info.png'
ii = r'/usr/share/icons/wp-icons/48/wg_msg.png' ii = r'/usr/share/icons/wp-icons/48/wg_msg.png'
wt = 'Renaming not possible' wt = _('Renaming not possible')
msg_t = 'Please select a tunnel from the list.' msg_t = _('Please select a tunnel from the list.')
msg_window(iw, ii, wt, msg_t) msg_window(iw, ii, wt, msg_t)
''' Button Rename ''' ''' Button Rename '''
self.btn_rename = ttk.Button(self.lb_frame3, text='Rename', state='disable', command=tl_rename, padding=4, self.btn_rename = ttk.Button(self.lb_frame3, text=_('Rename'), state='disable', command=tl_rename, padding=4,
style='RnButton.TButton') style='RnButton.TButton')
self.btn_rename.grid(column=3, row=0, padx=5, pady=10, sticky='ne') self.btn_rename.grid(column=3, row=0, padx=5, pady=10, sticky='ne')
@ -654,15 +661,15 @@ class FrameWidgets(ttk.Frame):
self.autoconnect = ttk.Label(self.lb_frame3, textvariable=self.autoconnect_var, width=15) self.autoconnect = ttk.Label(self.lb_frame3, textvariable=self.autoconnect_var, width=15)
self.autoconnect.config(font=('Ubuntu', 11)) self.autoconnect.config(font=('Ubuntu', 11))
self.autoconnect.grid(column=1, row=0, sticky='e', pady=19) self.autoconnect.grid(column=1, row=0, sticky='e', pady=19)
self.wg_autostart = ttk.Checkbutton(self.lb_frame3, text='Autoconnect on:', variable=self.selected_option, self.wg_autostart = ttk.Checkbutton(self.lb_frame3, text=_('Autoconnect on:'), variable=self.selected_option,
command=self.box_set) command=self.box_set)
self.wg_autostart.grid(column=0, row=0, pady=15, padx=15, sticky='nw') self.wg_autostart.grid(column=0, row=0, pady=15, padx=15, sticky='nw')
def chk_enter(event): def chk_enter(event):
""" The mouse moves into the entry widget """ """ The mouse moves into the entry widget """
window.my_tool_tip = MyToolTip(event.x_root, event.y_root, window.my_tool_tip = MyToolTip(event.x_root, event.y_root,
'You must have at least one\n' _('You must have at least one\n'
'tunnel in the list,to use the autostart') 'tunnel in the list,to use the autostart'))
def chk_leave(_): def chk_leave(_):
""" The mouse moves from the entry widget """ """ The mouse moves from the entry widget """
@ -673,7 +680,7 @@ class FrameWidgets(ttk.Frame):
def chk_a_enter(event): def chk_a_enter(event):
""" The mouse moves into the entry widget """ """ The mouse moves into the entry widget """
window.my_tool_tip = MyToolTip(event.x_root, event.y_root, window.my_tool_tip = MyToolTip(event.x_root, event.y_root,
'To use the autostart, enable this Checkbox') _('To use the autostart, enable this Checkbox'))
def chk_a_leave(_): def chk_a_leave(_):
""" The mouse moves from the entry widget """ """ The mouse moves from the entry widget """
@ -690,7 +697,7 @@ class FrameWidgets(ttk.Frame):
def chk_a_enter(event): def chk_a_enter(event):
""" The mouse moves into the entry widget """ """ The mouse moves into the entry widget """
window.my_tool_tip = MyToolTip(event.x_root, event.y_root, window.my_tool_tip = MyToolTip(event.x_root, event.y_root,
'To use the autostart, a tunnel must be selected from the list') _('To use the autostart, a tunnel must be selected from the list'))
def chk_a_leave(_): def chk_a_leave(_):
""" The mouse moves from the entry widget """ """ The mouse moves from the entry widget """
@ -714,8 +721,8 @@ class FrameWidgets(ttk.Frame):
If in each case false comes out, a corresponding window comes to inform the user that something is wrong. If in each case false comes out, a corresponding window comes to inform the user that something is wrong.
""" """
try: try:
filepath = filedialog.askopenfilename(initialdir=str(_u), title='Select Wireguard config File', filepath = filedialog.askopenfilename(initialdir=str(_u), title=_('Select Wireguard config File'),
filetypes=[('WG config files', '*.conf')], ) filetypes=[(_('WG config files'), '*.conf')], )
with open(filepath, 'r') as file: with open(filepath, 'r') as file:
read = file.read() read = file.read()
@ -732,10 +739,10 @@ class FrameWidgets(ttk.Frame):
p_key = readfile.readlines() p_key = readfile.readlines()
if pre_key in p_key or pre_key + '\n' in p_key: if pre_key in p_key or pre_key + '\n' in p_key:
"""img_w, img_i, w_title, w_txt hand over""" """img_w, img_i, w_title, w_txt hand over"""
iw = r'/usr/share/icons/wp-icons/64/error.png' iw = r'/usr/share/icons/lx-icons/64/error.png'
ii = r'/usr/share/icons/wp-icons/48/wg_msg.png' ii = r'/usr/share/icons/wp-icons/48/wg_msg.png'
wt = 'Import Error' wt = _('Import Error')
msg_t = 'Tunnel already available!\nPlease use another file for import' msg_t = _('Tunnel already available!\nPlease use another file for import')
msg_window(iw, ii, wt, msg_t) msg_window(iw, ii, wt, msg_t)
else: else:
@ -774,8 +781,8 @@ class FrameWidgets(ttk.Frame):
def chk_a_enter(event): def chk_a_enter(event):
""" The mouse moves into the entry widget """ """ The mouse moves into the entry widget """
window.my_tool_tip = MyToolTip(event.x_root, event.y_root, window.my_tool_tip = MyToolTip(event.x_root, event.y_root,
'To use the autostart, enable this ' _('To use the autostart, enable this '
'Checkbox') 'Checkbox'))
def chk_a_leave(_): def chk_a_leave(_):
""" The mouse moves from the entry widget """ """ The mouse moves from the entry widget """
@ -785,7 +792,7 @@ class FrameWidgets(ttk.Frame):
def list_info_enter(event): def list_info_enter(event):
""" The mouse moves into the entry widget """ """ The mouse moves into the entry widget """
window.my_tool_tip = MyToolTip(event.x_root, event.y_root, window.my_tool_tip = MyToolTip(event.x_root, event.y_root,
'List of available tunnels') _('List of available tunnels'))
def list_info_leave(_): def list_info_leave(_):
""" The mouse moves from the entry widget """ """ The mouse moves from the entry widget """
@ -795,8 +802,8 @@ class FrameWidgets(ttk.Frame):
def del_enter(event): def del_enter(event):
""" The mouse moves into the entry widget """ """ The mouse moves into the entry widget """
window.my_tool_tip = MyToolTip(event.x_root, event.y_root, window.my_tool_tip = MyToolTip(event.x_root, event.y_root,
'Click to delete a Wireguard ' _('Click to delete a Wireguard '
'Tunnel\nSelect from the list!') 'Tunnel\nSelect from the list!'))
def del_leave(_): def del_leave(_):
""" The mouse moves from the entry widget """ """ The mouse moves from the entry widget """
@ -806,8 +813,8 @@ class FrameWidgets(ttk.Frame):
def exp_enter(event): def exp_enter(event):
""" The mouse moves into the entry widget """ """ The mouse moves into the entry widget """
window.my_tool_tip = MyToolTip(event.x_root, event.y_root, window.my_tool_tip = MyToolTip(event.x_root, event.y_root,
' Click to export ' _(' Click to export '
'all\nWireguard Tunnel to Zipfile') 'all\nWireguard Tunnel to Zipfile'))
def exp_leave(_): def exp_leave(_):
""" The mouse moves from the entry widget """ """ The mouse moves from the entry widget """
@ -817,8 +824,8 @@ class FrameWidgets(ttk.Frame):
def rename_enter(event): def rename_enter(event):
""" The mouse moves into the entry widget """ """ The mouse moves into the entry widget """
window.my_tool_tip = MyToolTip(event.x_root, event.y_root, window.my_tool_tip = MyToolTip(event.x_root, event.y_root,
'To rename a tunnel, you need to\n' _('To rename a tunnel, you need to\n'
'select a tunnel from the list') 'select a tunnel from the list'))
def rename_leave(_): def rename_leave(_):
""" The mouse moves from the entry widget """ """ The mouse moves from the entry widget """
@ -852,10 +859,10 @@ class FrameWidgets(ttk.Frame):
if 'PrivateKey = ' and 'Endpoint = ' not in read: if 'PrivateKey = ' and 'Endpoint = ' not in read:
"""img_w, img_i, w_title, w_txt hand over""" """img_w, img_i, w_title, w_txt hand over"""
iw = r'/usr/share/icons/wp-icons/64/error.png' iw = r'/usr/share/icons/lx-icons/64/error.png'
ii = r'/usr/share/icons/wp-icons/48/wg_msg.png' ii = r'/usr/share/icons/wp-icons/48/wg_msg.png'
wt = 'Import Error' wt = _('Import Error')
msg_t = 'Oh... no valid Wireguard File!\nPlease select a valid Wireguard File' msg_t = _('Oh... no valid Wireguard File!\nPlease select a valid Wireguard File')
msg_window(iw, ii, wt, msg_t) msg_window(iw, ii, wt, msg_t)
except EOFError: except EOFError:
@ -919,7 +926,7 @@ class FrameWidgets(ttk.Frame):
else: else:
self.wg_autostart.configure(state='disabled') self.wg_autostart.configure(state='disabled')
self.auto_con = 'no Autoconnect' self.auto_con = _('no Autoconnect')
self.autoconnect_var.set('') self.autoconnect_var.set('')
self.autoconnect_var = tk.StringVar() self.autoconnect_var = tk.StringVar()
self.autoconnect_var.set(self.auto_con) self.autoconnect_var.set(self.auto_con)
@ -936,11 +943,11 @@ class FrameWidgets(ttk.Frame):
""" Address Label """ """ Address Label """
self.add = tk.StringVar() self.add = tk.StringVar()
self.add.set('Address: ' + data[0]) self.add.set(_('Address: ') + data[0])
self.DNS = tk.StringVar() self.DNS = tk.StringVar()
self.DNS.set(' DNS: ' + data[1]) self.DNS.set(' DNS: ' + data[1])
self.enp = tk.StringVar() self.enp = tk.StringVar()
self.enp.set('Endpoint: ' + data[2]) self.enp.set(_('Endpoint: ') + data[2])
def label_empty(self): def label_empty(self):
self.add.set('') self.add.set('')
@ -970,8 +977,7 @@ class FrameWidgets(ttk.Frame):
def stop_enter(event): def stop_enter(event):
""" The mouse moves into the entry widget """ """ The mouse moves into the entry widget """
window.my_tool_tip = MyToolTip(event.x_root, event.y_root, window.my_tool_tip = MyToolTip(event.x_root, event.y_root, _('Click to stop selected Wireguard Tunnel'))
'Click to stop selected Wireguard Tunnel')
def stop_leave(_): def stop_leave(_):
""" The mouse moves from the entry widget """ """ The mouse moves from the entry widget """
@ -988,7 +994,7 @@ class FrameWidgets(ttk.Frame):
def empty_list_start_enter(event): def empty_list_start_enter(event):
""" The mouse moves into the entry widget """ """ The mouse moves into the entry widget """
window.my_tool_tip = MyToolTip(event.x_root, event.y_root, 'No tunnels to start in the list') window.my_tool_tip = MyToolTip(event.x_root, event.y_root, _('No tunnels to start in the list'))
def empty_list_start_leave(_): def empty_list_start_leave(_):
""" The mouse moves from the entry widget """ """ The mouse moves from the entry widget """
@ -997,8 +1003,7 @@ class FrameWidgets(ttk.Frame):
def start_enter(event): def start_enter(event):
""" The mouse moves into the entry widget """ """ The mouse moves into the entry widget """
window.my_tool_tip = MyToolTip(event.x_root, event.y_root, window.my_tool_tip = MyToolTip(event.x_root, event.y_root, _('Click to start selected Wireguard Tunnel'))
'Click to start selected Wireguard Tunnel')
def start_leave(_): def start_leave(_):
""" The mouse moves from the entry widget """ """ The mouse moves from the entry widget """
@ -1075,19 +1080,19 @@ class FrameWidgets(ttk.Frame):
if self.l_box.size() != 0: if self.l_box.size() != 0:
"""img_w, img_i, w_title, w_txt hand over""" """img_w, img_i, w_title, w_txt hand over"""
iw = r'/usr/share/icons/wp-icons/64/info.png' iw = r'/usr/share/icons/lx-icons/64/info.png'
ii = r'/usr/share/icons/wp-icons/48/wg_msg.png' ii = r'/usr/share/icons/wp-icons/48/wg_msg.png'
wt = 'Select tunnel' wt = _('Select tunnel')
msg_t = 'Please select a tunnel from the list.' msg_t = _('Please select a tunnel from the list.')
msg_window(iw, ii, wt, msg_t) msg_window(iw, ii, wt, msg_t)
else: else:
"""img_w, img_i, w_title, w_txt hand over""" """img_w, img_i, w_title, w_txt hand over"""
iw = r'/usr/share/icons/wp-icons/64/info.png' iw = r'/usr/share/icons/lx-icons/64/info.png'
ii = r'/usr/share/icons/wp-icons/48/wg_msg.png' ii = r'/usr/share/icons/wp-icons/48/wg_msg.png'
wt = 'Select tunnel' wt = _('Select tunnel')
msg_t = 'Please first import tunnel.' msg_t = _('Please first import tunnel.')
msg_window(iw, ii, wt, msg_t) msg_window(iw, ii, wt, msg_t)