From 7e9775c358b70cfaa60305993ff52a9a43afc66c Mon Sep 17 00:00:00 2001 From: Ivan Date: Sat, 20 Sep 2025 13:56:39 -0500 Subject: [PATCH] Add detailed docstrings for the TabsManager class and its methods in tabs.py, enhancing code documentation and clarity. --- ren_browser/tabs/tabs.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/ren_browser/tabs/tabs.py b/ren_browser/tabs/tabs.py index e701bc5..f86c0b9 100644 --- a/ren_browser/tabs/tabs.py +++ b/ren_browser/tabs/tabs.py @@ -1,3 +1,8 @@ +"""Tab management system for Ren Browser. + +Provides tab creation, switching, and content management functionality +for the browser interface. +""" from types import SimpleNamespace import flet as ft @@ -7,7 +12,18 @@ from ren_browser.renderer.plaintext import render_plaintext class TabsManager: + """Manages browser tabs and their content. + + Handles tab creation, switching, closing, and content rendering. + """ + def __init__(self, page: ft.Page): + """Initialize the tab manager. + + Args: + page: Flet page instance for UI updates. + + """ import ren_browser.app as app_module self.page = page self.manager = SimpleNamespace(tabs=[], index=0) @@ -76,6 +92,12 @@ class TabsManager: self.page.update() def select_tab(self, idx: int): + """Select and display the tab at the given index. + + Args: + idx: Index of the tab to select. + + """ self.manager.index = idx for i, control in enumerate(self.tab_bar.controls[:-2]): if i == idx: