# BEdit Qt starter A small desktop application scaffold using Python and PySide6 (the official Qt bindings). Its interface is maintained in Qt Designer and it includes a main window, menu bar, blank central workspace, common keyboard shortcuts, and persisted window geometry. The application forces Qt's light Fusion palette, so it remains light even when the operating-system theme is dark. ## Run it Python 3.10 or newer is required. From this directory: ```bash python -m venv .venv ``` Activate the environment: - Windows PowerShell: `.venv\Scripts\Activate.ps1` - Windows Command Prompt: `.venv\Scripts\activate.bat` - Linux/macOS: `source .venv/bin/activate` Then install and launch: ```bash python -m pip install --upgrade pip python -m pip install -e ".[dev]" python -m bedit ``` After installation, the `bedit` command also launches the application. ## Project layout ```text . ├── pyproject.toml dependencies, package metadata, and `bedit` command ├── README.md ├── ui/main_window.ui editable Qt Designer source └── src/bedit ├── __main__.py supports `python -m bedit` ├── app.py starts Qt and applies the forced light palette ├── main_window.py behavior and signal connections └── ui_main_window.py generated from the Designer file; do not hand-edit ``` ## Designing the UI further The project now uses Qt Designer. It is included with PySide6 on most installations. Open the existing form with: ```bash pyside6-designer ui/main_window.ui ``` In Designer, use the Widget Box to add controls, the Object Inspector to select them, and the Property Editor to name and configure them. Always put widgets in a layout (horizontal, vertical, grid, or form) so the window resizes correctly. Save the form, close the running application if necessary, then regenerate its Python wrapper: ```bash pyside6-uic ui/main_window.ui -o src/bedit/ui_main_window.py ``` Do not hand-edit the generated Python file; change the `.ui` file and regenerate it. Add behavior and signal connections in `main_window.py`. Widget names from Designer are available there through `self.ui`, such as `self.ui.editor`. In VS Code, the same commands are available through **Terminal → Run Task**: - **Qt: Open Main Window in Designer** opens the form for visual editing. - **Qt: Build Designer Files** compiles resources and then regenerates the UI wrapper. It is the default build task, available with `Ctrl+Shift+B`. - The separate resource and UI compilation tasks remain available when only one generated file needs rebuilding. ## A sensible next design pass 1. Sketch the main tasks and screens before choosing widgets. 2. Turn each major area into its own widget class in `src/bedit/widgets/`. 3. Use a `QStackedWidget` for page-like navigation, or `QDockWidget` for movable tool panels in an editor-style application. 4. Use reusable `QAction` objects for menu commands and any future toolbars. 5. Keep file/data operations outside widget classes as the application grows. 6. Add icons through a Qt resource file (`.qrc`) so packaging is reliable. 7. Test on Windows regularly; fonts, scaling, and native dialogs vary by platform. ## Optional tools You do not need another GUI framework. Useful additions are: - **Qt Designer** for drag-and-drop form layout. - **Ruff** for formatting/linting (`ruff check .`). - **pytest-qt** later for GUI interaction tests. - **PyInstaller** or **Nuitka** later to produce a Windows `.exe`. The light colors are defined in `apply_light_theme()` in `src/bedit/app.py`. Adjust that palette if you want different light colors. Avoid a large stylesheet unless the application needs highly customized controls; palettes preserve more of Qt's standard behavior.