Skip to content

Commit 7184bfc

Browse files
committed
docs: update documentation for consolidated Python project structure
- Update README files to reference bongo_cat_app instead of app/ - Add resource_path helper to tray.py for PyInstaller compatibility - Update API reference with new project structure - Add development and setup guides - Include requirements_app.txt for dependencies
1 parent 703b963 commit 7184bfc

File tree

8 files changed

+76
-99
lines changed

8 files changed

+76
-99
lines changed

README.md

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -75,18 +75,21 @@ git clone https://github.com/dentity007/bongo_cat_monitor_remix.git
7575
cd bongo_cat_monitor_remix
7676
```
7777

78-
### 2. Python Environment
78+
## Run (Python desktop app)
7979
```bash
80-
# Create virtual environment
81-
python3 -m venv venv
82-
source venv/bin/activate # On Windows: venv\Scripts\activate
83-
84-
# Install dependencies
85-
cd app
86-
pip install -r requirements.txt
80+
# from repo root
81+
python -m venv .venv
82+
source .venv/bin/activate # Windows: .venv\Scripts\activate
83+
pip install -r requirements_app.txt # or: pip install -e .
84+
python bongo_cat_app/main.py
8785
```
8886

89-
### 3. Imgflip Setup (Optional)
87+
Project layout
88+
89+
- `bongo_cat_app/` – Canonical Python desktop app (Tk/pystray)
90+
- `bongo-cat-electron/` – Optional Electron UI (not required to run the Python app)
91+
92+
### 2. Imgflip Setup (Optional)
9093
The app works without any API configuration, but for dynamic triggers:
9194

9295
1. **No authentication required!** - Imgflip API is free and doesn't need credentials
@@ -103,17 +106,17 @@ The app works without any API configuration, but for dynamic triggers:
103106
- "anakin" → Anakin Padme 4 Panel meme
104107
- And 13 more trending memes updated daily at midnight!
105108

106-
### 4. ESP32 Setup
109+
### 3. ESP32 Setup
107110
1. Open `firmware/bongo_cat_monitor.ino` in Arduino IDE
108111
2. Install required libraries (TFT_eSPI, LVGL)
109112
3. Upload to your ESP32 board
110113

111-
### 5. Hardware Monitoring Setup (Optional - Windows Only)
114+
### 4. Hardware Monitoring Setup (Optional - Windows Only)
112115
For advanced CPU/GPU temperature monitoring with privacy protection and API resilience:
113116

114117
1. **Install Python dependencies**:
115118
```bash
116-
pip install -r bongo_cat_app/requirements_app.txt
119+
pip install -r bongo_cat_app/requirements_hardware.txt
117120
```
118121

119122
2. **Enable in settings** (requires explicit consent):
@@ -149,7 +152,7 @@ For advanced CPU/GPU temperature monitoring with privacy protection and API resi
149152
- CPU monitoring requires admin rights on Windows
150153
- Check logs for circuit breaker state and cache hit/miss ratios
151154

152-
### 6. API Resilience Features
155+
### 5. API Resilience Features
153156
The application includes enterprise-grade resilience patterns to ensure reliable operation:
154157

155158
**Circuit Breaker Pattern**:
@@ -172,13 +175,7 @@ The application includes enterprise-grade resilience patterns to ensure reliable
172175
- Circuit breaker state monitoring
173176
- Debug logging for troubleshooting
174177

175-
### 7. Run the App
176-
```bash
177-
cd app
178-
python main.py --mode normal
179-
```
180-
181-
### 8. Test Triggers
178+
### 6. Test Triggers
182179
- Type "bullet" → Top Gun reference!
183180
- Type "drake" → Drake Hotline Bling meme
184181
- Type "bernie" → Bernie Sanders meme
@@ -222,17 +219,20 @@ bongo_cat_monitor_remix/
222219
└── 📄 LICENSE.txt # MIT License
223220
```
224221

222+
## Electron UI (optional)
223+
The Electron app lives in `bongo-cat-electron/` and provides an alternative user interface. It is not required for running or packaging the Python desktop app, and we keep it separate so Python-focused CI remains fast and focused.
224+
225225
## 🎮 Usage Guide
226226

227227
### Basic Operation
228-
1. **Start the app**: `python main.py --mode normal`
228+
1. **Start the app**: `python bongo_cat_app/main.py --mode normal`
229229
2. **Type normally**: Cat responds to your typing speed
230230
3. **Trigger memes**: Type special words for reactions
231231
4. **Monitor activity**: Cat shows system stats and animations
232232

233233
### Command Line Options
234234
```bash
235-
python main.py [options]
235+
python bongo_cat_app/main.py [options]
236236

237237
Options:
238238
--mode {normal,messenger,tutor} Operation mode (default: normal)
@@ -270,7 +270,7 @@ Triggers are stored in JSON format with support for static and dynamic types:
270270
```
271271
272272
### Environment Variables
273-
**No environment variables required!** The Imgflip API works without authentication. However, you can still create `app/.env` for future extensibility:
273+
**No environment variables required!** The Imgflip API works without authentication. However, you can still create `bongo_cat_app/.env` for future extensibility:
274274
275275
```env
276276
# Optional: For future API integrations
@@ -310,9 +310,9 @@ Type these words to trigger viral memes:
310310
## 🛠️ Development
311311
312312
### Adding New Triggers
313-
1. Edit `app/triggers.json`
314-
2. Add trigger object with `trigger`, `response`, and `animation` fields
315-
3. Restart the app or it will auto-reload on next cycle
313+
1. Update `_local_fallback()` inside `bongo_cat_app/triggers_external.py` with your custom templates, or point the helper at your own API.
314+
2. Add trigger metadata (IDs, names, URLs) that match what the firmware expects.
315+
3. Restart the app or let the daily cache refresh pick up the new data.
316316
317317
### Custom Animations
318318
1. Add animation files to `animations/` directory
@@ -408,7 +408,7 @@ No ports found—plug in ESP32!
408408
```
409409
ModuleNotFoundError: No module named 'praw'
410410
```
411-
**Solution**: Run `pip install -r requirements.txt` in activated virtual environment
411+
**Solution**: Run `pip install -e .` in your activated virtual environment
412412
413413
**Virtual Environment Issues**
414414
```
@@ -442,5 +442,3 @@ python3: command not found
442442
**Made with ❤️ for the Bongo Cat community**
443443
444444
![Demo](https://via.placeholder.com/400x200?text=CatJAM+Demo)
445-
446-

bongo_cat_app/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,7 @@ pip install -r requirements_app.txt
8484

8585
### Running from Source
8686
```bash
87-
cd bongo_cat_app
88-
python main.py
87+
python bongo_cat_app/main.py
8988
```
9089

9190
### Building Executable
@@ -203,4 +202,4 @@ Contributions welcome! Areas for improvement:
203202

204203
---
205204

206-
*Keep your Bongo Cat happy with real-time data!* 🐱💻
205+
*Keep your Bongo Cat happy with real-time data!* 🐱💻

bongo_cat_app/tray.py

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@
1212
import os
1313
from typing import Optional, Callable
1414

15+
16+
def resource_path(rel_path: str) -> str:
17+
"""Return an absolute path for bundled resources (PyInstaller-safe)."""
18+
base = getattr(sys, "_MEIPASS", os.path.abspath(os.path.dirname(__file__)))
19+
return os.path.join(base, rel_path)
20+
1521
class BongoCatSystemTray:
1622
"""System tray integration for Bongo Cat application"""
1723

@@ -52,24 +58,13 @@ def start_detached(self):
5258
def create_icon(self):
5359
"""Create the system tray icon"""
5460
try:
55-
# Try to load icon from file first - check multiple formats
56-
# Support both development and exe paths
57-
import sys
58-
if getattr(sys, 'frozen', False):
59-
# Running as exe - assets are in the same directory
60-
base_path = sys._MEIPASS if hasattr(sys, '_MEIPASS') else os.path.dirname(sys.executable)
61-
else:
62-
# Running as script - look in bongo_cat_app/assets
63-
base_path = os.path.dirname(__file__)
64-
6561
possible_paths = [
66-
os.path.join(base_path, "assets", "tray_icon.ico"),
67-
os.path.join(base_path, "assets", "tray_icon.png"),
68-
os.path.join(base_path, "assets", "tray_icon.jpg"),
69-
os.path.join(base_path, "assets", "tray_icon.jpeg"),
70-
# Fallback paths for development
71-
"assets/tray_icon.png",
72-
"bongo_cat_app/assets/tray_icon.png"
62+
resource_path(os.path.join("assets", "tray_icon.ico")),
63+
resource_path(os.path.join("assets", "tray_icon.png")),
64+
resource_path(os.path.join("assets", "tray_icon.jpg")),
65+
resource_path(os.path.join("assets", "tray_icon.jpeg")),
66+
os.path.join("assets", "tray_icon.png"),
67+
os.path.join("bongo_cat_app", "assets", "tray_icon.png"),
7368
]
7469

7570
icon_image = None
@@ -440,4 +435,4 @@ def main():
440435
print("✅ System tray test completed")
441436

442437
if __name__ == "__main__":
443-
main()
438+
main()

docs/api_reference.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Main application orchestrator with resilient initialization.
1414

1515
**Command Line Arguments:**
1616
```bash
17-
python main.py [options]
17+
python bongo_cat_app/main.py [options]
1818

1919
Options:
2020
--mode {normal,messenger,tutor} Operation mode (default: normal)
@@ -461,4 +461,4 @@ DISPLAY_HEIGHT=320
461461
462462
---
463463
464-
*API Version: 1.1.0 | Last Updated: September 17, 2025*
464+
*API Version: 1.1.0 | Last Updated: September 17, 2025*

docs/development_guide.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,9 @@ git checkout -b feature/your-feature-name
136136

137137
3. **Setup Python Environment**
138138
```bash
139-
python3 -m venv venv
140-
source venv/bin/activate
141-
cd app && pip install -r requirements.txt
139+
python3 -m venv .venv
140+
source .venv/bin/activate
141+
pip install -r requirements_app.txt # or: pip install -e .
142142
```
143143

144144
4. **Install Development Dependencies**
@@ -296,7 +296,7 @@ debugPrint("Processing command: " + command);
296296
screen /dev/ttyUSB0 115200
297297
298298
# Monitor Python app output
299-
python main.py --mode normal 2>&1 | tee debug.log
299+
python bongo_cat_app/main.py --mode normal 2>&1 | tee debug.log
300300
```
301301

302302
### Performance Optimization
@@ -318,11 +318,10 @@ python main.py --mode normal 2>&1 | tee debug.log
318318
#### Python Application
319319
```bash
320320
# Create distribution
321-
cd app
322-
pyinstaller --onefile --name catjam main.py
321+
pyinstaller packaging/app.spec --noconfirm
323322

324-
# Install system-wide
325-
sudo cp dist/catjam /usr/local/bin/
323+
# Install system-wide (optional Linux example)
324+
sudo cp dist/BongoCatMonitor /usr/local/bin/BongoCatMonitor
326325
```
327326

328327
#### ESP32 Firmware
@@ -366,4 +365,4 @@ arduino-cli upload --fqbn esp32:esp32:esp32 --port /dev/ttyUSB0 firmware/
366365

367366
---
368367

369-
*Development Guide Version: 1.0.0 | Last Updated: September 17, 2025*
368+
*Development Guide Version: 1.0.0 | Last Updated: September 17, 2025*

docs/setup_guide.md

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,15 @@ cd bongo_cat_monitor_remix
3232
### Step 2: Python Environment Setup
3333
```bash
3434
# Create virtual environment
35-
python3 -m venv venv
35+
python3 -m venv .venv
3636

3737
# Activate virtual environment
38-
source venv/bin/activate # macOS/Linux
38+
source .venv/bin/activate # macOS/Linux
3939
# OR
40-
venv\Scripts\activate # Windows
40+
.venv\Scripts\activate # Windows
4141

4242
# Install dependencies
43-
cd app
44-
pip install -r requirements.txt
43+
pip install -r requirements_app.txt # or: pip install -e .
4544
```
4645

4746
### Step 3: ESP32 Firmware Setup
@@ -108,14 +107,14 @@ Once running, you'll have access to **20 trending memes** that update **daily at
108107
109108
#### Test Python Environment
110109
```bash
111-
cd app
110+
# from repo root
112111
python --version # Should show Python 3.9+
113112
python -c "import requests, pynput, serial; print('✅ All imports successful')"
114113
```
115114

116115
#### Test ESP32 Connection
117116
```bash
118-
python main.py --mode normal
117+
python bongo_cat_app/main.py --mode normal
119118
# Should show "Running in normal mode. Type away!"
120119
# If ESP32 not connected: "No ports found—plug in ESP32!"
121120
```
@@ -132,27 +131,14 @@ python main.py --mode normal
132131
## Configuration Options
133132

134133
### Trigger Configuration
135-
Edit `app/triggers.json` to customize triggers:
136-
137-
```json
138-
{
139-
"static": [
140-
{
141-
"trigger": "your_word",
142-
"response": "Your custom response",
143-
"animation": "meme_surprise"
144-
}
145-
],
146-
"dynamic": []
147-
}
148-
```
134+
Update the fallback templates in `_local_fallback()` inside `bongo_cat_app/triggers_external.py`, or point that helper at your own API endpoint. Restart the desktop app (or let the daily cache refresh) to pick up new templates.
149135

150136
### Serial Port Configuration
151137
If auto-detection fails, specify port manually:
152138
```bash
153-
python main.py --port /dev/ttyUSB0 # Linux
154-
python main.py --port COM3 # Windows
155-
python main.py --port /dev/tty.usbserial-0001 # macOS
139+
python bongo_cat_app/main.py --port /dev/ttyUSB0 # Linux
140+
python bongo_cat_app/main.py --port COM3 # Windows
141+
python bongo_cat_app/main.py --port /dev/tty.usbserial-0001 # macOS
156142
```
157143

158144
## Troubleshooting
@@ -229,7 +215,7 @@ pip install -r requirements.txt
229215
### Getting Help
230216
- Check [Issues](https://github.com/dentity007/bongo_cat_monitor_remix/issues) for common problems
231217
- Review [README.md](README.md) for detailed documentation
232-
- Test with `python main.py --mode normal` to verify Imgflip integration
218+
- Test with `python bongo_cat_app/main.py --mode normal` to verify Imgflip integration
233219

234220
## Next Steps
235221
1. **Customize Triggers**: Add your favorite meme triggers
@@ -239,4 +225,4 @@ pip install -r requirements.txt
239225

240226
---
241227

242-
*Last updated: September 17, 2025*
228+
*Last updated: September 17, 2025*

0 commit comments

Comments
 (0)