Conversation
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.
Owner
Author
|
kk |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.