Skip to content

feat: add --ip/--si CLI flags to skip the EnergyPlus units dialog#197

Open
Ski90Moo wants to merge 1 commit into
NatLabRockies:developfrom
Ski90Moo:feat/ip-units-cli-flag
Open

feat: add --ip/--si CLI flags to skip the EnergyPlus units dialog#197
Ski90Moo wants to merge 1 commit into
NatLabRockies:developfrom
Ski90Moo:feat/ip-units-cli-flag

Conversation

@Ski90Moo
Copy link
Copy Markdown

Summary

  • Adds --ip and --si long switches to the dview command-line tool
  • When either flag is present, DView skips the interactive "Would you like to display your Energy+ data in IP units?" dialog and uses the supplied preference directly
  • When neither flag is given, the existing dialog behaviour is preserved (fully backward-compatible)

Motivation

OpenStudio Application PR #873 adds comprehensive i18n/translation support to the OpenStudio GUI. One outstanding gap is the DView Units Conversion dialog — it is rendered by the dviewx64.exe binary (wxWidgets) and therefore cannot be translated through Qt's .ts system.

The proposed solution is for OpenStudio to show its own translated Qt dialog asking the user about units, then forward the answer to DView via CLI flag, bypassing DView's English-only prompt entirely.

Changes

File Change
include/wex/dview/dvfilereader.h Added int ipUnits = -1 parameter to FastRead and ReadSQLFile declarations
src/dview/dvfilereader.cpp ReadSQLFile: shows dialog only when ipUnits < 0; otherwise maps 1→wxYES, 0→wxNO. FastRead: passes ipUnits through to ReadSQLFile.
tools/dview/dview.cpp Added m_arg_ipUnits member; registered --ip / --si switches in OnInitCmdLine; parsed in OnCmdLineParsed; forwarded via frame->Load(filenames, ipUnits)

Backward compatibility

All new parameters default to -1 (ask via dialog), so existing callers that do not pass the argument get identical behaviour to today.

Test plan

  • dview file.sql — dialog still appears as before
  • dview --ip file.sql — no dialog, data loads in IP units
  • dview --si file.sql — no dialog, data loads in SI units
  • Passing both --ip and --si--ip wins (first match wins in OnCmdLineParsed)

🤖 Generated with Claude Code

Add --ip and --si command-line switches to DView so callers (e.g.
OpenStudio Application) can pre-answer the 'Would you like to display
your Energy+ data in IP units?' dialog rather than showing it to the
user twice. When neither flag is supplied DView behaviour is unchanged
(dialog is shown as before).

- dvfilereader.h/cpp: ReadSQLFile and FastRead accept ipUnits (-1=ask,
  0=SI, 1=IP); dialog is skipped when ipUnits >= 0
- dview.cpp: DViewFrame::Load forwards ipUnits; DViewApp parses --ip
  and --si switches and passes the result to Load

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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