eplace msg_window with MassageDialog vpn stop icon corrected new icons question and warning , info and error revised
This commit is contained in:
32
tunnel.py
32
tunnel.py
@ -9,6 +9,7 @@ from subprocess import run, CompletedProcess
|
||||
import secrets
|
||||
from shared_libs.wp_app_config import AppConfig, Msg
|
||||
from shared_libs.common_tools import LxTools, CryptoUtil
|
||||
from shared_libs.message import MessageDialog
|
||||
|
||||
# Translate
|
||||
_ = AppConfig.setup_translations()
|
||||
@ -172,12 +173,8 @@ class Tunnel:
|
||||
CryptoUtil.decrypt(getpass.getuser())
|
||||
if len([file.name for file in AppConfig.TEMP_DIR.glob("*.conf")]) == 0:
|
||||
|
||||
LxTools.msg_window(
|
||||
AppConfig.IMAGE_PATHS["icon_info"],
|
||||
AppConfig.IMAGE_PATHS["icon_msg"],
|
||||
Msg.STR["sel_tl"],
|
||||
Msg.STR["tl_first"],
|
||||
)
|
||||
MessageDialog("info", Msg.STR["tl_first"], title=Msg.STR["sel_tl"])
|
||||
|
||||
return False
|
||||
else:
|
||||
wg_tar: str = f"{AppConfig.BASE_DIR}/{now_datetime}"
|
||||
@ -186,22 +183,20 @@ class Tunnel:
|
||||
with zipfile.ZipFile(f"{wg_tar}.zip", "r") as zf:
|
||||
if zf.namelist():
|
||||
|
||||
LxTools.msg_window(
|
||||
AppConfig.IMAGE_PATHS["icon_info"],
|
||||
AppConfig.IMAGE_PATHS["icon_vpn"],
|
||||
Msg.STR["exp_succ"],
|
||||
MessageDialog(
|
||||
"info",
|
||||
Msg.STR["exp_in_home"],
|
||||
title=Msg.STR["exp_succ"],
|
||||
)
|
||||
|
||||
else:
|
||||
logging.error(
|
||||
"There was a mistake at creating the Zip file. File is empty."
|
||||
)
|
||||
LxTools.msg_window(
|
||||
AppConfig.IMAGE_PATHS["icon_error"],
|
||||
AppConfig.IMAGE_PATHS["icon_msg"],
|
||||
Msg.STR["exp_err"],
|
||||
Msg.STR["exp_zip"],
|
||||
MessageDialog(
|
||||
"error", Msg.STR["exp_zip"], title=Msg.STR["exp_err"]
|
||||
)
|
||||
|
||||
return False
|
||||
return True
|
||||
except PermissionError:
|
||||
@ -217,12 +212,7 @@ class Tunnel:
|
||||
pass
|
||||
except Exception as e:
|
||||
logging.error(f"Export failed: {str(e)}")
|
||||
LxTools.msg_window(
|
||||
AppConfig.IMAGE_PATHS["icon_error"],
|
||||
AppConfig.IMAGE_PATHS["icon_msg"],
|
||||
Msg.STR["exp_err"],
|
||||
Msg.STR["exp_try"],
|
||||
)
|
||||
MessageDialog("error", Msg.STR["exp_try"], title=Msg.STR["exp_err"])
|
||||
return False
|
||||
|
||||
finally:
|
||||
|
Reference in New Issue
Block a user