Skip to content

Commit 9736303

Browse files
committed
Fixed bug with loading lock monitor's settings when it hasn't been used before.
Previously its Setting class could handle when self.data['import_paths'] wasn't set, but the Plugin class would get tripped up. To work around this, the default value for that key is set in Setting.__init__() now.
1 parent 7fc7828 commit 9736303

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

blacs/plugins/lock_monitor/__init__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1295,6 +1295,11 @@ def __init__(self, data):
12951295
logger.info("Setting initialized.")
12961296
self.data = data
12971297

1298+
# self.data['import_paths'] won't exist if the plugin hasn't been used
1299+
# before or if the save data was deleted. In that case set it to an
1300+
# empty list.
1301+
self.data.setdefault('import_paths', [])
1302+
12981303
# Create the page, return the page and an icon to use on the label.
12991304
def create_dialog(self, notebook):
13001305
"""Create the settings tab for this plugin.
@@ -1321,8 +1326,7 @@ def create_dialog(self, notebook):
13211326
# Fill out the table with the saved values. Do this before connecting
13221327
# the callback below to avoid it interfering.
13231328
self._pop_row(0) # Get rid of row in UI file.
1324-
import_paths = self.data.get('import_paths', [])
1325-
for import_path in import_paths:
1329+
for import_path in self.data['import_paths']:
13261330
self._append_row(import_path)
13271331
self._append_row(self._NEW_ENTRY_TEXT)
13281332

0 commit comments

Comments
 (0)