Skip to content

Commit

Permalink
Add an CML option to clear the application cache (#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
pshriwise authored Nov 22, 2024
1 parent a96872c commit 80086ba
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 80086ba

Please sign in to comment.