fix a filedialog for hidden Files work

install rollback to bash for start wirepy and wirepy rollback to bash
This commit is contained in:
Désiré Werner Menrath 2024-09-19 18:54:14 +02:00
parent ad59c3ba00
commit 4e841301f7
5 changed files with 31 additions and 14 deletions

View File

@ -4,11 +4,11 @@
<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="set rights in install and a .conf a import Tunnel Filedialog Part 1 /home when open"> <list default="true" id="940e1630-c825-4d4c-be80-bc11f543c122" name="Changes" comment="fix set rights in install and a .conf a import Tunnel Filedialog Part 1 /home when open">
<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$/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$/wg_func.py" beforeDir="false" afterPath="$PROJECT_DIR$/wg_func.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/wg_func.py" beforeDir="false" afterPath="$PROJECT_DIR$/wg_func.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/wg_main.py" beforeDir="false" afterPath="$PROJECT_DIR$/wg_main.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/wirepy" beforeDir="false" afterPath="$PROJECT_DIR$/wirepy" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -55,7 +55,7 @@
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;, &quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;Shell Script.install.executor&quot;: &quot;Run&quot;, &quot;Shell Script.install.executor&quot;: &quot;Run&quot;,
&quot;git-widget-placeholder&quot;: &quot;main&quot;, &quot;git-widget-placeholder&quot;: &quot;main&quot;,
&quot;last_opened_file_path&quot;: &quot;/home/punix/Pyapps/wire-py&quot;, &quot;last_opened_file_path&quot;: &quot;/home/punix/Pyapps/filebrowserhiddenfiles&quot;,
&quot;settings.editor.selected.configurable&quot;: &quot;preferences.fileTypes&quot; &quot;settings.editor.selected.configurable&quot;: &quot;preferences.fileTypes&quot;
} }
}</component> }</component>
@ -423,7 +423,15 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1726691611936</updated> <updated>1726691611936</updated>
</task> </task>
<option name="localTasksCounter" value="37" /> <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>
<option name="localTasksCounter" value="38" />
<servers /> <servers />
</component> </component>
<component name="UnknownFeatures"> <component name="UnknownFeatures">
@ -464,7 +472,6 @@
</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="Remove open file function, add Show Address Labels with tk.StrVar when remove a not active Tunnel Labels of Active Tunnel removed!" />
<MESSAGE value="fixed error when active tunnel is deleted,&#10;now also the Address Label is emptied" /> <MESSAGE value="fixed error when active tunnel is deleted,&#10;now also the Address Label is emptied" />
<MESSAGE value="In FrameWidged Class else Block StrVar, this resorts reference and variable assignment together" /> <MESSAGE value="In FrameWidged Class else Block StrVar, this resorts reference and variable assignment together" />
<MESSAGE value="add method init_and_report and label_empty to Class ShowAddress" /> <MESSAGE value="add method init_and_report and label_empty to Class ShowAddress" />
@ -489,7 +496,8 @@
<MESSAGE value="fix checkbox disable and policy rename main.py to wg_main.py" /> <MESSAGE value="fix checkbox disable and policy rename main.py to wg_main.py" />
<MESSAGE value="fix rename in Messagebox warning to error" /> <MESSAGE value="fix rename in Messagebox warning to error" />
<MESSAGE value="set rights in install and a .conf a import Tunnel Filedialog Part 1 /home when open" /> <MESSAGE value="set rights in install and a .conf a import Tunnel Filedialog Part 1 /home when open" />
<option name="LAST_COMMIT_MESSAGE" value="set rights in install and a .conf a import Tunnel Filedialog Part 1 /home when open" /> <MESSAGE value="fix set rights in install and a .conf a import Tunnel Filedialog Part 1 /home when open" />
<option name="LAST_COMMIT_MESSAGE" value="fix set rights in install and a .conf a import Tunnel Filedialog Part 1 /home when open" />
</component> </component>
<component name="XDebuggerManager"> <component name="XDebuggerManager">
<breakpoint-manager> <breakpoint-manager>

View File

@ -8,7 +8,7 @@ if [ $? -ne 0 ]
cp wg_main.py start_wg.py wg_func.py wirepy /usr/bin/ && \ cp wg_main.py start_wg.py wg_func.py wirepy /usr/bin/ && \
mkdir -p /etc/wire_py && cp -R wp-icons /usr/share/icons/ && \ mkdir -p /etc/wire_py && cp -R wp-icons /usr/share/icons/ && \
chown -R root:root /etc/wire_py && chmod 755 /etc/wire_py && \ chown -R root:root /etc/wire_py && chmod 755 /etc/wire_py && \
ln -sf /usr/bin/wirepy.py /usr/local/bin/wirepy >/dev/null && \ ln -sf /usr/bin/wirepy /usr/local/bin/wirepy >/dev/null && \
cp org.wirepy.policy /usr/share/polkit-1/actions/ && \ cp org.wirepy.policy /usr/share/polkit-1/actions/ && \
cp Wire-Py.desktop /usr/share/applications/ && \ cp Wire-Py.desktop /usr/share/applications/ && \
cp wg_start.services /lib/systemd/system/ && \ cp wg_start.services /lib/systemd/system/ && \
@ -19,7 +19,7 @@ else
sudo cp wg_main.py start_wg.py wg_func.py wirepy /usr/bin/ && \ sudo cp wg_main.py start_wg.py wg_func.py wirepy /usr/bin/ && \
sudo mkdir -p /etc/wire_py && sudo cp -R wp-icons /usr/share/icons/ && \ sudo mkdir -p /etc/wire_py && sudo cp -R wp-icons /usr/share/icons/ && \
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 /usr/local/bin/wirepy && \
sudo cp org.wirepy.policy /usr/share/polkit-1/actions/ && \ sudo cp org.wirepy.policy /usr/share/polkit-1/actions/ && \
sudo cp Wire-Py.desktop /usr/share/applications/ && \ sudo cp Wire-Py.desktop /usr/share/applications/ && \
sudo cp wg_start.service /lib/systemd/system/ && \ sudo cp wg_start.service /lib/systemd/system/ && \

View File

@ -181,8 +181,7 @@ class ImportTunnel:
def wg_import_select(self): def wg_import_select(self):
try: try:
filepath = filedialog.askopenfilename(initialdir=Path('/home/'), title='Select Wireguard config ' filepath = filedialog.askopenfilename(initialdir='/home/', title='Select Wireguard config File',
'File',
filetypes=[('WG config files', '*.conf')],) filetypes=[('WG config files', '*.conf')],)
with open(filepath, 'r') as file: with open(filepath, 'r') as file:
@ -294,12 +293,13 @@ class OnOff:
class ExportTunnels: class ExportTunnels:
@staticmethod @staticmethod
def wg_export(): def wg_export():
_u = Path.read_text(Path('/tmp/_u'))
now_time = datetime.now() now_time = datetime.now()
now_datetime = now_time.strftime('wg-exp-' + '%m-%d-%Y' + '-' + '%H:%M') now_datetime = now_time.strftime('wg-exp-' + '%m-%d-%Y' + '-' + '%H:%M')
tl = ListTunnels.tl_list() tl = ListTunnels.tl_list()
try: try:
if len(tl) != 0: if len(tl) != 0:
wg_tar = Path(f'/{home}/'), now_datetime wg_tar = _u, now_datetime
p_to_conf = Path('/etc/wire_py/') p_to_conf = Path('/etc/wire_py/')
shutil.make_archive(wg_tar, 'zip', p_to_conf) shutil.make_archive(wg_tar, 'zip', p_to_conf)
#if zip_full != 0: #if zip_full != 0:

View File

@ -1,8 +1,10 @@
#!/usr/bin/python3 #!/usr/bin/python3
import tkinter as tk import tkinter as tk
from subprocess import check_call from subprocess import check_call
from tkinter import ttk from tkinter import *
from pathlib import Path from pathlib import Path
from tkinter import ttk
from wg_func import (TunnelActiv, ListTunnels, ImportTunnel, ConToDict, GreenLabel, StartStopBTN, ShowAddress, from wg_func import (TunnelActiv, ListTunnels, ImportTunnel, ConToDict, GreenLabel, StartStopBTN, ShowAddress,
FileHandle, ExportTunnels, OnOff) FileHandle, ExportTunnels, OnOff)
@ -251,4 +253,11 @@ class FrameWidgets(ttk.Frame):
if __name__ == '__main__': if __name__ == '__main__':
window = MainWindow() window = MainWindow()
try:
window.tk.call('tk_getOpenFile', '-foobarbaz')
except TclError:
pass
window.tk.call('set', '::tk::dialog::file::showHiddenBtn', '0')
window.tk.call('set', '::tk::dialog::file::showHiddenVar', '0')
window.mainloop() window.mainloop()