Metadata-Version: 2.1
Name: guitools
Version: 2.0.2
Summary: Qt utilities built on PySide6
Home-page: UNKNOWN
Author: Samuel Semedo
License: UNKNOWN
Platform: UNKNOWN
Description-Content-Type: text/markdown
Requires-Dist: annotated-types
Requires-Dist: beautifulsoup4
Requires-Dist: Markdown
Requires-Dist: numpy
Requires-Dist: pandas
Requires-Dist: pillow
Requires-Dist: pydantic
Requires-Dist: pydantic-core
Requires-Dist: PySide6
Requires-Dist: PySide6-Addons
Requires-Dist: PySide6-Essentials
Requires-Dist: python-dateutil
Requires-Dist: pytz
Requires-Dist: shiboken6
Requires-Dist: six
Requires-Dist: soupsieve
Requires-Dist: typing-extensions
Requires-Dist: tzdata
Requires-Dist: winotify
Requires-Dist: psutil
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"

# guitools

`guitools` is a set of utilities for **PySide6**-based Qt applications, including an extended `MainWindow`, a message/notification system, styling helpers, and a project template generator.

## Installation

```bash
pip install guitools
```

## Examples

Most features are exposed directly from the package. Example:

```python
import sys

from PySide6.QtWidgets import (
    QApplication,
    QWidget,
    QVBoxLayout,
    QHBoxLayout,
    QLabel,
    QPushButton,
    QTabWidget,
)
from PySide6.QtCore import Qt

from guitools import MainWindow, Styles
from guitools.customWidgets.dockWidget import TabWidgetDock


class DemoWindow(MainWindow):
    def __init__(self) -> None:
        super().__init__()
        self.setWindowTitle("guitools demo")
        self.setWindowIcon(Styles.Resources.miniLogo.original())

        self._tab_counter = 0
        self._docks: list[TabWidgetDock] = []

        # Root content container
        content = QWidget()
        content_layout = QVBoxLayout(content)
        content_layout.setContentsMargins(16, 16, 16, 16)
        content_layout.setSpacing(12)

        self.tabWidget = QTabWidget()
        content_layout.addWidget(self.tabWidget, 1)

        # Fixed example with exactly 2 tabs.
        self.create_tab()
        self.create_tab(select_new=True)

        # Theme button (bottom-right)
        footer = QHBoxLayout()
        footer.setContentsMargins(0, 0, 0, 0)
        footer.addStretch(1)

        self.btn_theme = QPushButton()
        self.btn_theme.setMaximumSize(25, 25)
        self.btn_theme.setCursor(Qt.CursorShape.PointingHandCursor)
        Styles.setIconToggleTheme(self.btn_theme)
        self.btn_theme.clicked.connect(self.toggle_theme)

        footer.addWidget(self.btn_theme)
        content_layout.addLayout(footer)

        self.setCentralWidget(content)
        self.setStyleSheet(Styles.standard())

    def toggle_theme(self) -> None:
        Styles.load(Styles.oppositeTheme())
        self.setStyleSheet(Styles.standard())
        Styles.setIconToggleTheme(self.btn_theme)

    def _make_tab_content(self, tab_no: int) -> QWidget:
        widget = QWidget()
        layout = QVBoxLayout(widget)
        layout.setContentsMargins(12, 12, 12, 12)
        layout.setSpacing(0)

        title = QLabel("GUITools")
        title.setAlignment(Qt.AlignmentFlag.AlignCenter)
        title.setStyleSheet('font: 600 18pt "Segoe UI";')
        layout.addWidget(title, 1)

        layout.addStretch(1)
        return widget

    def create_tab(self, *, select_new: bool = False) -> None:
        self._tab_counter += 1
        tab_no = self._tab_counter

        icon_data = Styles.Resources.Data(
            callableIcon=Styles.Resources.miniLogo.original,
            hoverCallableIcon=Styles.Resources.miniLogo.original,
        )

        dock = TabWidgetDock(
            tabWidget=self.tabWidget,
            widgetCallable=lambda no=tab_no: self._make_tab_content(no),
            tabTitle=f"Tab {tab_no}",
            docTitle=f"Tab {tab_no}",
            iconData=icon_data,
            insertPosition=self.tabWidget.count(),
            actionEnabled=False,
            showLoading=False,
        )

        self._docks.append(dock)

        if select_new:
            self.tabWidget.setCurrentWidget(dock.tab)


if __name__ == "__main__":
    app = QApplication(sys.argv)

    Styles.init("dark")  # or "light"

    window = DemoWindow()
    window.resize(900, 600)
    window.show()
    sys.exit(app.exec())
```

## Generate a project template (CLI)

The package registers this command:

```bash
guitools-create <destination> [--overwrite]
```

Examples:

```bash
guitools-create my-project
guitools-create .
guitools-create my-project --overwrite
guitools-create C:\path\to\my-project
```

After creation, the template prints the standard next steps shown by the CLI: install dependencies and run `python main.py` inside the generated directory.

## License

[MIT](https://opensource.org/licenses/MIT)

---

## Author

**Samuel Semedo**


