Skip to content

feat(windows): add Open data folder button to General tab#7

Open
tmchow wants to merge 1 commit into
aruneshvv:mainfrom
tmchow:osc/6-open-data-folder
Open

feat(windows): add Open data folder button to General tab#7
tmchow wants to merge 1 commit into
aruneshvv:mainfrom
tmchow:osc/6-open-data-folder

Conversation

@tmchow

@tmchow tmchow commented Apr 19, 2026

Copy link
Copy Markdown

Summary

Adds an Open data folder button to the General tab of the Windows settings window (#6). Clicking the button opens %APPDATA%\FreeFlow in Explorer so users can quickly grab settings.json, an audio recording, or history.sqlite when sharing troubleshooting evidence.

Why this matters

Users troubleshooting FreeFlow end up typing out the %APPDATA%\FreeFlow path into Explorer repeatedly. The issue asks for a one-click shortcut in the UI. The path is already managed internally by Config.app_data_dir() / Config._app_data_dir(), and _app_data_dir already mkdir's the folder eagerly -- so the entire feature is hooking a button in the General tab to a four-line handler.

Changes

windows/freeflow/settings_window.py only:

  1. Add import os and from .config import Config to the imports block (no new third-party deps).
  2. At the end of _build_general_tab, after the Custom Vocabulary section, add a new Data Folder LabelFrame with:
    • A short ttk.Label explaining the path (%APPDATA%\FreeFlow)
    • An Open data folder ttk.Button wired to self._open_data_folder
  3. Add _open_data_folder: os.startfile(str(Config.app_data_dir())) inside a try/except OSError that shows a messagebox.showerror with self._root as the parent, so a failure surfaces cleanly instead of crashing the app.

Acceptance (from #6)

  • Button opens Explorer at the FreeFlow data folder -- os.startfile on the path returned by Config.app_data_dir().
  • Works when the folder already exists -- Config._app_data_dir() eagerly mkdir(parents=True, exist_ok=True)s at import, so the folder is guaranteed to exist.
  • Does not block the settings window while Explorer is open -- os.startfile hands the path to the Windows shell and returns immediately, no subprocess join.

Testing

  • python -c "import ast; ast.parse(open('windows/freeflow/settings_window.py').read())" -- clean syntax.
  • No automated Windows UI tests in the repo (tests/ holds only integration artefacts). The tkinter code path mirrors the existing _build_general_tab patterns for LabelFrame / ttk.Button / messagebox.showerror(parent=self._root).
  • Platform: the feature is Windows-specific (os.startfile only exists on Windows). It lives under windows/freeflow/ so platform gating is handled by the existing module layout.

Closes #6


This contribution was developed with AI assistance (Claude Code).

Users asked for a one-click way to grab `settings.json`, audio
recordings, and the history DB out of `%APPDATA%\FreeFlow` when sharing
troubleshooting evidence with support. A new **Data Folder** section at
the bottom of the General tab (below Custom Vocabulary) has a short
label telling the reader where the files live and an *Open data folder*
button that opens the folder in Explorer.

Implementation:

- New `_open_data_folder` handler calls `os.startfile(str(Config.app_
  data_dir()))`. `Config._app_data_dir()` already mkdir's the folder at
  import time, so the path always exists by the time the button is
  clickable. `os.startfile` hands the path to the shell and returns, so
  the settings window stays responsive per the acceptance criteria.
- Failure path: if `os.startfile` raises `OSError` (e.g. shell can't
  open the path), a `messagebox.showerror` with the settings window as
  parent reports the error without crashing the app.

Acceptance criteria from aruneshvv#6:

- [x] Button opens Explorer at the FreeFlow data folder
- [x] Works when the folder already exists (always, per `_app_data_dir`)
- [x] Does not block the settings window while Explorer is open
      (`os.startfile` is non-blocking)

Closes aruneshvv#6
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.

Add "Open data folder" link in settings (Windows)

1 participant