Skip to content

Feat/pyside6 desktop app#1

Open
chintu4 wants to merge 3 commits intomasterfrom
feat/pyside6-desktop-app
Open

Feat/pyside6 desktop app#1
chintu4 wants to merge 3 commits intomasterfrom
feat/pyside6-desktop-app

Conversation

@chintu4
Copy link
Copy Markdown
Owner

@chintu4 chintu4 commented Jul 10, 2025

No description provided.

google-labs-jules bot and others added 3 commits July 10, 2025 09:49
This change introduces a PySide6 application (`app.py`) that embeds a QWebEngineView to display your existing Flask web interface.

The PySide6 app manages the Flask server lifecycle, starting it in a separate thread when the app launches and terminating it gracefully on exit.

Key changes:
- Added `PySide6` to `requirements.txt`.
- Created `app.py` with the PySide6 application, main window, web view, and Flask server management logic.
- Modified `main.py` to prevent the Flask development server from auto-starting when the module is imported, allowing `app.py` to control it.
- Updated `README.md` with instructions on how to install dependencies and run the new PySide6 desktop application, as well as clarifying existing Flask run instructions.
This commit introduces a feature to save and manage code history using an SQLite database.

Key changes:
- Added SQLAlchemy to `requirements.txt`.
- Created `database.py`:
    - Defines `CodeHistory` model (id, language, code, title, timestamp).
    - Sets up SQLite database in a user-specific directory (`~/.local/share/OfflineCompiler` or `APPDATA\OfflineCompiler`).
    - Provides helper functions for CRUD operations (add, get_all, get_by_id, delete_by_id).
- Modified `app.py` (PySide6):
    - Initializes database and creates tables on startup.
    - Adds a `QDockWidget` for displaying code history.
    - Implements `populate_history_list` to fetch and display history.
    - Allows loading code from history via double-click or context menu.
    - Allows deleting code from history via context menu.
    - Includes `window.setCodeFromHost` JavaScript bridge function.
- Modified `main.py` (Flask):
    - Added API endpoints:
        - `POST /api/save_code`: Saves code snippet to the database.
        - `GET /api/history`: Retrieves all history entries.
        - `GET /api/history/<id>`: Retrieves a specific history entry.
        - `DELETE /api/history/<id>`: Deletes a specific history entry.
    - Manages database sessions per request for these API routes.
- Modified `templates/index.html`:
    - Added a 'Save Code' button to the editor toolbar (Ctrl+S shortcut).
    - Added JavaScript functions (`saveCurrentCode`, `fetchHistory`, `loadHistoryItem`, `deleteHistoryItem`) to interact with the new API endpoints.
    - Included a basic HTML structure for a history panel (intended to be managed by PySide6 dock or shown for direct web use).
    - Improved CSS for layout to accommodate the history panel and provide a more responsive UI.
- Updated `README.md`: Added a section detailing the code history feature, including database location.
@chintu4
Copy link
Copy Markdown
Owner Author

chintu4 commented Jul 10, 2025

kk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant