Prototype package scaffold and split window - #9
Conversation
Reviewer's GuideThis PR establishes an installable Python 3.11+ TextBeside prototype, packaging it with PySide6 and a console command, implementing a safe resizable text-and-image split view with manual pair selection and unsaved-edit protection, and adding documentation plus Qt smoke tests. Sequence diagram for opening a TextBeside file pairsequenceDiagram
actor User
participant MainWindow
participant QFileDialog
participant FileSystem
participant Editor
participant ImageView
User->>MainWindow: open_pair_dialog()
MainWindow->>MainWindow: _confirm_discard_if_modified()
MainWindow->>QFileDialog: getOpenFileName()
QFileDialog-->>MainWindow: image_name
MainWindow->>QFileDialog: getOpenFileName()
QFileDialog-->>MainWindow: text_name
MainWindow->>FileSystem: read_text_file(text_path)
FileSystem-->>MainWindow: text
MainWindow->>FileSystem: load_image(image_path)
FileSystem-->>MainWindow: pixmap
MainWindow->>Editor: setPlainText(text)
MainWindow->>ImageView: setPixmap(pixmap)
MainWindow->>MainWindow: setText(path.name)
Flow diagram for safe pair replacementflowchart TD
Start[Open pair] --> Check{Unsaved edits?}
Check -->|Yes| Confirm["_confirm_discard_if_modified()"]
Confirm -->|Cancel| Keep[Keep current pair]
Confirm -->|Discard| Select[Select image and text files]
Check -->|No| Select
Select --> LoadText["read_text_file()"]
LoadText --> LoadImage["load_image()"]
LoadImage --> Replace[Replace editor and image view]
LoadText -->|Error| Error[Show open error]
LoadImage -->|Error| Error
Error --> Keep
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Linux manual testing on Python 3.14.4 / PySide6 6.11.2 found a reproducible SIGSEGV immediately after opening both sample files. The existing pytest smoke tests passed and standalone QPixmap loading succeeded. Instrumentation isolated the crash to the timed |
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/textbeside/app.py" line_range="147" />
<code_context>
+
+ self.current_text_path = text_path
+ self.current_image_path = image_path
+ self.text_path_label.setText(f"Text: {text_path.name}")
+ self.text_path_label.setToolTip(str(text_path))
+ self.image_path_label.setText(f"Image: {image_path.name}")
</code_context>
<issue_to_address>
**nitpick (bug_risk):** Long selected filenames are placed in fixed-width, non-wrapping `QLabel`s without elision or a scrollable header, so the filename is clipped rather than remaining visible in the pane.
**Triggers:** When either selected filename is longer than the available pane width.
**Suggested fix:** Use a horizontally scrollable label, enable wrapping, or display an elided filename with the complete name in an accessible tooltip.
```suggestion
self.text_path_label.setText(f"Text: {text_path.name}")
self.text_path_label.setWordWrap(True)
```
</issue_to_address>|
|
||
| self.current_text_path = text_path | ||
| self.current_image_path = image_path | ||
| self.text_path_label.setText(f"Text: {text_path.name}") |
There was a problem hiding this comment.
nitpick (bug_risk): Long selected filenames are placed in fixed-width, non-wrapping QLabels without elision or a scrollable header, so the filename is clipped rather than remaining visible in the pane.
Triggers: When either selected filename is longer than the available pane width.
Suggested fix: Use a horizontally scrollable label, enable wrapping, or display an elided filename with the complete name in an accessible tooltip.
| self.text_path_label.setText(f"Text: {text_path.name}") | |
| self.text_path_label.setText(f"Text: {text_path.name}") | |
| self.text_path_label.setWordWrap(True) |
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
Only a minor README PowerShell activation-path nit remains; no blocking issues were identified.
Review effort: Lite
Findings: None
What changed in this PR
Adds the initial installable TextBeside Qt prototype with a split editor/image view and safe manual pair loading.
Changes:
- Adds the PySide6 application and console entry point.
- Implements text/image pair loading with unsaved-edit protection.
- Adds packaging metadata, smoke tests, and setup documentation.
- Notes a minor PowerShell activation-path documentation nit.
| File | Description |
|---|---|
tests/test_app.py |
Adds Qt application smoke tests. |
tests/conftest.py |
Configures offscreen Qt testing. |
src/textbeside/app.py |
Implements the split window and safe pair loading. |
src/textbeside/__init__.py |
Defines package metadata. |
README.md |
Documents setup, usage, and prototype scope. |
pyproject.toml |
Configures packaging and dependencies. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
User-visible change
Begins checkpoint 1 by adding the installable TextBeside package and a minimal resizable split window. The left pane is an editable plain-text editor; the right pane displays a manually selected source image. File → Open pair… selects the two files without importing or converting them, and both selected filenames remain visible.
This also resolves the existing Python-version mismatch by making
pyproject.tomlmatch the documented Python 3.11 or later policy.Closes #6 when the remaining fresh-checkout development-command check is completed.
How I checked it
pytest -vv -s tests/test_app.pypassed on Linux with Python 3.14.4 / PySide6 6.11.2: 2 passed.ruff check .— all checks passed.ruff format --check .— 11 files already formatted.textbeside.During testing, a timed
QStatusBar.showMessage(..., 5000)after opening a pair caused a reproducible SIGSEGV on both Wayland and XCB. The smoke tests and standaloneQPixmaploading passed. Removing the non-essential timed status message resolved the crash.Compatibility and rights
>=3.11rather than the accidental>=3.14package requirement.Summary by Sourcery
Establish the initial installable TextBeside prototype with a resizable split editor, image viewer, and safe manual pair loading workflow.
New Features:
Bug Fixes:
Enhancements:
Build:
Documentation:
Tests: