Metadata-Version: 2.4
Name: si-ui
Version: 1.0.0
Summary: Reusable dark-themed PyQt5 components for Scientific Instruments tools
License-Expression: MIT
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: PyQt5>=5.15
Requires-Dist: matplotlib>=3.5
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"

# si-ui

Reusable dark-themed PyQt5 components for **Scientific Instruments** desktop tools.

Built on a [Catppuccin Mocha](https://github.com/catppuccin/catppuccin)-inspired colour palette, `si-ui` gives every SI app a consistent, modern look out of the box.

---

## Features

| Component | Description |
|---|---|
| `apply_dark_theme(app)` | Apply the Fusion dark palette to any `QApplication` |
| `SI_DARK_STYLE` | Comprehensive QSS stylesheet (buttons, inputs, tables, scrollbars, …) |
| `COLORS` | Dict of named Catppuccin Mocha hex values |
| `SplashScreen` | Animated GIF (or text-fallback) splash window |
| `PlotCanvas` | Dark-themed matplotlib `FigureCanvas` with scatter-point tracking |
| `SIBaseApp` | Three-panel `QMainWindow` base class with convenience helpers |

## Installation

### From GitHub (recommended)

```bash
pip install git+https://github.com/<your-org>/si_ui.git
```

### Local / editable install

```bash
git clone https://github.com/<your-org>/si_ui.git
cd si_ui
pip install -e .
```

## Quick Start

```python
import sys
from PyQt5.QtWidgets import QApplication, QWidget, QLabel
from si_ui import apply_dark_theme, SI_DARK_STYLE, SIBaseApp

class MyTool(SIBaseApp):
    def create_left_panel(self) -> QWidget:
        panel, layout = self.make_panel()
        layout.addWidget(QLabel("Inputs go here"))
        layout.addStretch()
        return panel

    def create_center_panel(self) -> QWidget:
        panel, layout = self.make_panel()
        layout.addWidget(QLabel("Main content"))
        layout.addStretch()
        return panel

    def create_right_panel(self) -> QWidget:
        panel, layout = self.make_panel()
        layout.addWidget(QLabel("Results"))
        layout.addStretch()
        return panel

app = QApplication(sys.argv)
apply_dark_theme(app)
window = MyTool(title="My SI Tool", min_size=(1000, 550))
window.show()
sys.exit(app.exec_())
```

### Splash Screen

```python
from si_ui import SplashScreen

splash = SplashScreen(
    title="MY APP",
    subtitle="Loading…",
    gif_data=base64_gif_string,   # or None for text fallback
)
splash.finished.connect(show_main_window)
splash.show()
```

### Plot Canvas

```python
from si_ui import PlotCanvas

canvas = PlotCanvas(parent=self, width=6, height=4,
                    xlabel="Frequency (Hz)", ylabel="Impedance (Ω)")
canvas.axes.plot(x_data, y_data, color=canvas.line_color)
canvas.add_point(x, y)        # highlighted scatter point
canvas.draw()
```

## Requirements

- Python ≥ 3.10
- PyQt5 ≥ 5.15
- matplotlib ≥ 3.5

## License

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