Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an CML option to clear the application cache #160

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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