Skip to content

Commit

Permalink
Adding an option for settings the application cache to address stale …
Browse files Browse the repository at this point in the history
…state in the config after updates
  • Loading branch information
pshriwise committed Nov 20, 2024
1 parent a96872c commit b3d0bbc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,19 @@ can be used to generate images from the command line without opening the plotter
```console
$ openmc-plotter -b view1.pltvw view1.pltvw view1.pltvw
```
## Troubleshooting

Updates to the plotter can result in stale references to deprecated features. For example, it's possible that something like the following may appear after an update:

```
AttributeError: 'MainWindow' object has no attribute 'shortcutOverlay'
```

To address this, the application settings can be cleared, the plotter can be started with the `--clear-config` (or `-c`) to reset the application's settings cache on startup.

```bash
$ openmc-plotter --clear-cache
```

## Features

Expand Down
6 changes: 6 additions & 0 deletions openmc_plotter/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ def main():
'XML files (default is current dir)')
ap.add_argument('-b', '--batch-mode', nargs='+', default=False,
help='View files used to generate plots in batch mode')
ap.add_argument('-c', '--clear-config', action='store_true', default=False,
help='Clear the Qt application configuration settings')

args = ap.parse_args()

Expand All @@ -45,6 +47,10 @@ def run_app(user_args):
app.setWindowIcon(QtGui.QIcon(path_icon))
app.setAttribute(QtCore.Qt.AA_DontShowIconsInMenus, True)

if user_args.clear_config:
settings = QtCore.QSettings()
settings.clear()

splash_pix = QtGui.QPixmap(path_splash)
splash = QSplashScreen(splash_pix, QtCore.Qt.WindowStaysOnTopHint)
splash.setMask(splash_pix.mask())
Expand Down

0 comments on commit b3d0bbc

Please sign in to comment.