add new modul MessageDialog and replace old message dialog
This commit is contained in:
38
logviewer.py
38
logviewer.py
@ -4,7 +4,10 @@ import logging
|
||||
import tkinter as tk
|
||||
from tkinter import TclError, filedialog, ttk
|
||||
from pathlib import Path
|
||||
import webbrowser
|
||||
from functools import partial
|
||||
from shared_libs.gitea import GiteaUpdate
|
||||
from shared_libs.message import MessageDialog
|
||||
from shared_libs.common_tools import (
|
||||
LogConfig,
|
||||
ConfigManager,
|
||||
@ -224,10 +227,6 @@ class LogViewer(tk.Tk):
|
||||
"""
|
||||
a tk.Toplevel window
|
||||
"""
|
||||
|
||||
def link_btn() -> None:
|
||||
webbrowser.open("https://git.ilunix.de/punix/shared_libs")
|
||||
|
||||
msg_t = _(
|
||||
"Logviewer a simple Gui for View Logfiles.\n\n"
|
||||
"Logviewer is open source software written in Python.\n\n"
|
||||
@ -235,13 +234,16 @@ class LogViewer(tk.Tk):
|
||||
"Use without warranty!\n"
|
||||
)
|
||||
|
||||
LxTools.msg_window(
|
||||
modul_name.AppConfig.IMAGE_PATHS["icon_log"],
|
||||
modul_name.AppConfig.IMAGE_PATHS["icon_log"],
|
||||
_("Info"),
|
||||
msg_t,
|
||||
_("Go to shared_libs git"),
|
||||
link_btn,
|
||||
MessageDialog(
|
||||
"info",
|
||||
text=msg_t,
|
||||
buttons=["OK", "Go to Logviewer"],
|
||||
commands=[
|
||||
None, # Default on "OK"
|
||||
partial(webbrowser.open, "https://git.ilunix.de/punix/shared_libs"),
|
||||
],
|
||||
icon=modul_name.AppConfig.IMAGE_PATHS["icon_log"],
|
||||
title="Logviewer",
|
||||
)
|
||||
|
||||
def update_setting(self, update_res, modul_name, _) -> None:
|
||||
@ -451,12 +453,7 @@ class LogViewer(tk.Tk):
|
||||
self.text_area.insert(tk.END, file.read())
|
||||
except Exception as e:
|
||||
logging.error(_(f"A mistake occurred: {str(e)}"))
|
||||
LxTools.msg_window(
|
||||
modul_name.AppConfig.IMAGE_PATHS["icon_error"],
|
||||
modul_name.AppConfig.IMAGE_PATHS["icon_log"],
|
||||
"LogViewer",
|
||||
_(f"A mistake occurred:\n{str(e)}\n"),
|
||||
)
|
||||
MessageDialog("error", _(f"A mistake occurred:\n{str(e)}\n"))
|
||||
|
||||
def directory_load(self, modul_name, _):
|
||||
|
||||
@ -474,12 +471,7 @@ class LogViewer(tk.Tk):
|
||||
print("File load: abort by user...")
|
||||
except Exception as e:
|
||||
logging.error(_(f"A mistake occurred: {e}"))
|
||||
LxTools.msg_window(
|
||||
modul_name.AppConfig.IMAGE_PATHS["icon_error"],
|
||||
modul_name.AppConfig.IMAGE_PATHS["icon_log"],
|
||||
"LogViewer",
|
||||
_(f"A mistake occurred:\n{e}\n"),
|
||||
)
|
||||
MessageDialog("error", _(f"A mistake occurred:\n{e}\n"))
|
||||
|
||||
|
||||
def main():
|
||||
|
Reference in New Issue
Block a user