Skip to content

scripts/gui

scripts.gui.__init__

🧠 Docstring Summary

Section Content
Description No module description available.
Args
Returns

scripts.gui.gui

🧠 Docstring Summary

Section Content
Description gui.py
This module provides the ZephyrusLoggerGUI class, which implements a graphical user interface
for the Zephyrus Ideas Logger application using the tkinter library. It manages the GUI components,
user interactions, and integrates logging functionality.
Args
Returns

📦 Classes

ZephyrusLoggerGUI

A class to represent the Zephyrus Ideas Logger GUI. This class initializes the GUI components and handles user interactions. Attributes: controller (GUIController): The controller for managing the application's logic. logger (logging.Logger): Logger for tracking GUI events and actions. config (dict): Configuration settings loaded from the config file. category_structure (dict): Structure of categories for the GUI. root (tk.Tk): The main window of the GUI application. Parameters: ['self: Any', 'controller: GUIController'] Returns: None

🛠️ Functions

__init__

Initialize the ZephyrusLoggerGUI. Parameters: ['self: Any', 'controller: GUIController'] Returns: None

_setup_gui_logging

Set up the logging for the GUI. This method configures the logging handler to display logs in the GUI. Parameters: ['self: Any'] Returns: None

_build_widgets

Build the GUI widgets and layout. This method creates and arranges the GUI components, such as frames and buttons. Parameters: ['self: Any'] Returns: None

_update_coverage_display

Update the coverage display. This method retrieves the coverage data from the controller and updates the coverage display. Parameters: ['self: Any'] Returns: None

_populate_category_dropdown

Populate the category dropdown menu. This method retrieves the categories from the controller and populates the dropdown menu. Parameters: ['self: Any'] Returns: None

_update_main_category

Update the main category. This method updates the main category and subcategory dropdown menus. Parameters: ['self: Any', 'new_main: str'] Returns: None

_log_entry

Log a new entry. This method logs a new entry based on the user's input. Parameters: ['self: Any'] Returns: None

_manual_summarize

Manually summarize the logs. This method generates a summary of the logs based on the user's input. Parameters: ['self: Any'] Returns: None

_search_summary

Search for summaries. This method searches for summaries based on the user's input. Parameters: ['self: Any'] Returns: None

_search_raw

Search for raw logs. This method searches for raw logs based on the user's input. Parameters: ['self: Any'] Returns: None

_rebuild_tracker

Rebuild the tracker. This method rebuilds the tracker based on the user's input. Parameters: ['self: Any'] Returns: None

_show_coverage

Show the coverage. This method displays the coverage data. Parameters: ['self: Any'] Returns: None

run

Run the GUI application. This method starts the GUI event loop. Parameters: ['self: Any'] Returns: None

scripts.gui.gui_controller

🧠 Docstring Summary

Section Content
Description gui_controller.py
This module provides the GUIController class for managing the interaction between the GUI
and the logging core of the Zephyrus Logger application. It handles the initialization of
the logger core and facilitates logging entries through the GUI.
Dependencies:
- os
- logging
- scripts.core.core.ZephyrusLoggerCore
Args
Returns

📦 Classes

GUIController

GUIController manages the interaction between the GUI and the logging core. Attributes: core (ZephyrusLoggerCore): The instance of the ZephyrusLoggerCore used for logging. Parameters: ['self: Any', 'logger_core: Optional[ZephyrusLoggerCore]', 'script_dir: Optional[str]'] Returns: None

🛠️ Functions

__init__

Initializes the GUIController with the given logger core or initializes a new one. Parameters: ['self: Any', 'logger_core: Optional[ZephyrusLoggerCore]', 'script_dir: Optional[str]'] Returns: None

log_entry

Logs an entry with the specified main category, subcategory, and text. Parameters: ['self: Any', 'main: str', 'sub: str', 'text: str'] Returns: Any

force_summarize_all

Forces the summarization of all logs. Parameters: ['self: Any'] Returns: Any

search_summaries

Searches for summaries matching the given query. Parameters: ['self: Any', 'query: str'] Returns: Any

search_raw_logs

Searches for raw logs matching the given query. Parameters: ['self: Any', 'query: str'] Returns: Any

rebuild_tracker

Rebuilds the summary tracker and returns True if successful, False otherwise. Parameters: ['self: Any'] Returns: bool

get_tracker_status

Returns a user-friendly status string of the summary tracker. Parameters: ['self: Any'] Returns: str

get_coverage_data

Retrieves coverage data from the tracker for the UI heatmap. Parameters: ['self: Any'] Returns: Any

get_logs

Retrieves the contents of the plain text log file as a string. Parameters: ['self: Any'] Returns: str

scripts.gui.gui_helpers

🧠 Docstring Summary

Section Content
Description gui_helpers.py
This module provides utility functions for building and customizing the
Zephyrus Logger application's graphical user interface (GUI).
Core features include:
- Validating user input for logging and searching.
- Creating and customizing Tkinter widgets (e.g. scrolled text, buttons).
- Displaying alerts and messages using Tkinter's messagebox module.
- Utility functions for reading and writing JSON files.
Intended to provide a set of reusable functions for the GUI components of
the Zephyrus Logger application.
Args
Returns

🛠️ Functions

validate_log_input

Returns False if the input is empty, None, or just whitespace. Logs a warning if invalid. Parameters: ['content: str'] Returns: bool

get_current_date

Returns the current date as a string in 'YYYY-MM-DD' format. :return: Current date as a string. :rtype: str Returns: str

get_current_timestamp

Returns the current date and time as a formatted string (YYYY-MM-DD HH:MM:SS). Returns: str

clear_text_input

Clears all text from the given Tkinter text entry widget. Parameters: ['entry_widget: tk.Text'] Returns: None

update_status_label

Update the text and foreground color of a Tkinter label widget. Parameters: ['label: tk.Label', 'message: str', 'color: str'] Returns: None

get_selected_option

Returns the currently selected option from a Tkinter menu variable, or a default value if none is selected. Parameters: ['menu_var: tk.Variable', 'default: str'] Returns: str

append_log_entry

Appends a log entry with a timestamp and content to the specified log file, organizing entries by date, category, and subcategory. Parameters: ['log_file: str', 'date: str', 'category: str', 'subcategory: str', 'entry_text: str'] Returns: None

get_category_options

Retrieves a list of category names from a JSON file at the given path. Parameters: ['categories_json_path: str'] Returns: list

create_status_label

Create and pack a status label widget in the given root window. Parameters: ['root: tk.Tk', 'status_var: tk.StringVar'] Returns: tk.Label

create_log_frame

Creates and returns a disabled scrolled text widget within a frame for logging purposes in a Tkinter GUI. Parameters: ['root: tk.Tk'] Returns: tuple

log_message

Appends a timestamped message to the provided Tkinter text widget for logging purposes. Parameters: ['log_text_widget: tk.Text', 'message: str'] Returns: None

create_dropdown_menu

Creates a labeled dropdown menu (OptionMenu) in the given Tkinter frame. Parameters: ['frame: tk.Frame', 'label_text: str', 'variable: tk.Variable', 'options: list'] Returns: tk.OptionMenu

create_button

Creates and returns a Tkinter Button widget with customizable text, command, size, and colors. Parameters: ['frame: tk.Widget', 'text: str', 'command: callable', 'width: int', 'height: int', 'bg: str', 'fg: str'] Returns: tk.Button

show_messagebox

Displays a message box with the specified icon, title, and message using tkinter. Parameters: ['icon: str', 'title: str', 'message: str'] Returns: None

create_text_entry

Creates a text entry widget for user input. Parameters: ['root: tk.Widget', 'height: int', 'width: int'] Returns: tk.Text

format_summary_results

Formats a list of result items into a readable summary string. Each result can be a dict with 'score' and 'text' keys, a tuple/list with score and text, or any other type, which will be converted to string with a default score of 0.0. Handles exceptions gracefully and includes error information in the output. Parameters: ['results: list'] Returns: str

format_raw_results

Formats a list of raw result items into a readable string. Each result is processed based on its type (dict, list/tuple, or other), and formatted with a '[RAW LOG MATCH]' prefix. Handles exceptions by including error details in the output. Parameters: ['results: list'] Returns: str

display_message

Displays an informational message box. Parameters: ['title: str', 'message: str'] Returns: None

display_error

Displays an error message box. Parameters: ['title: str', 'message: str'] Returns: None

format_coverage_data

Formats the structured coverage data into a readable string grouped by main category. Parameters: ['data: list[dict]'] Returns: str

scripts.gui.gui_logging

🧠 Docstring Summary

Section Content
Description gui_logging.py
This module provides a logging handler that appends log messages to a Tkinter Text widget.
Args
Returns

📦 Classes

GUILogHandler

A logging handler that appends log messages to a Tkinter Text widget. Parameters: ['self: Any', 'text_widget: tk.Text'] Returns: None

🛠️ Functions

__init__

:param text_widget: The Text widget where log messages should be appended. Parameters: ['self: Any', 'text_widget: tk.Text'] Returns: None

emit

Emits a log message to the associated Text widget. :param record: logging.LogRecord Parameters: ['self: Any', 'record: logging.LogRecord'] Returns: None

append_message

Appends a log message to the associated Text widget. This method is designed to be called from the main thread, and will block until the message is appended. Parameters: ['self: Any', 'msg: str'] Returns: None

scripts.gui.style_manager

🧠 Docstring Summary

Section Content
Description style_manager.py
This module defines the StyleManager class for managing application-wide styles for tkinter and ttk.
Core features include:
- Managing application-wide styles for tkinter and ttk.
- Defining default colors and fonts.
- Configuring ttk styles.
- Updating specific styles with new options.
Args
Returns

📦 Classes

StyleManager

Manages application-wide styles for tkinter and ttk. This class can be extended to handle dynamic theme changes. Attributes: root (Tk): The root Tkinter window. style (ttk.Style): The ttk style manager instance. Parameters: ['self: Any', 'root: Tk.Tk'] Returns: None

🛠️ Functions

__init__

Initializes the StyleManager with the specified root window. Parameters: ['self: Any', 'root: Tk.Tk'] Returns: None

initialize_styles

Defines default colors and fonts and configures ttk styles. Parameters: ['self: Any'] Returns: None

update_style

Update a specific style with new options. Parameters: ['self: Any', 'style_name: str', 'options: Dict[str, Any]'] Returns: None

scripts.gui.widget_factory

🧠 Docstring Summary

Section Content
Description widget_factory.py
This module defines the WidgetFactory class for creating common widgets with standardized styling.
Core features include:
- Creating styled buttons, labels, entries, frames, and notebooks for Tkinter applications.
- Providing a consistent look and feel across the application.
Args
Returns

📦 Classes

WidgetFactory

Factory for creating common widgets with standardized styling. This class provides static methods to create buttons, labels, entries, frames, and notebooks with consistent styles. Returns: None

🛠️ Functions

create_button

Create and return a styled ttk Button. Parameters: ['parent: tk.Widget', 'text: str', 'command: callable', 'style: str', 'options'] Returns:** ttk.Button

create_label

Create and return a styled ttk Label. Parameters: ['parent: tk.Widget', 'text: str', 'style: str', 'options'] Returns:** ttk.Label

create_entry

Create and return a ttk Entry widget. Parameters: ['parent: tk.Widget', 'textvariable: Any', 'options'] Returns:** ttk.Entry

create_frame

Create and return a ttk Frame widget. Parameters: ['parent: tk.Widget', 'style: str', 'options'] Returns:** ttk.Frame

create_notebook

Create and return a ttk Notebook widget. Parameters: ['parent: tk.Widget', 'options'] Returns:** ttk.Notebook