Skip to content

Commit

Permalink
Fixed the Preferences tab update problem, where part of the widgets w…
Browse files Browse the repository at this point in the history
…ere not created. The reason was that under some circumstances (aodb refresh) the settings areas were cleared and recreated, but unfortunately no one was recreating the additional widgets for the addon folders and UI options. This caused the "C++ part of NNN has already been destroyed" exceptions.
  • Loading branch information
skyjake committed Jan 3, 2007
1 parent 63e034f commit 9a190cf
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
12 changes: 6 additions & 6 deletions snowberry/plugins/preferences.py
Expand Up @@ -116,16 +116,16 @@ def removeAddonPath():

elif event.hasId('addon-paths-changed'):
# Insert the current custom paths into the list.
try:
pathList.clear()
for p in paths.getAddonPaths():
pathList.addItem(p)
except:
#try:
pathList.clear()
for p in paths.getAddonPaths():
pathList.addItem(p)
#except:
# Ignore errors in this operation.
# TODO: Figure out under which circumstances this notification
# is received when the pathList C++ part has already been
# destroyed.
pass
# pass


def handleCommand(event):
Expand Down
20 changes: 13 additions & 7 deletions snowberry/plugins/tab40_settings.py
Expand Up @@ -118,6 +118,9 @@ def createWidgets():
# applicable.
populateTabs()

# Request others to create additional widgets in the tabs.
requestPopulation()

# Redo the layout.
ui.getArea(SETTINGS).updateLayout()

Expand Down Expand Up @@ -145,17 +148,20 @@ def handleCommand(event):
categoryArea.selectTab('general-options')


def requestPopulation():
# Request others to create widgets in the setting tabs, if
# necessary.
for areaId, area in categoryTabs:
events.send(events.PopulateNotify(areaId, area))
area.updateLayout()


def handleNotify(event):
"""This is called when someone sends a notification event."""

if event.hasId('init-done'):
# Request others to create widgets in the setting tabs, if
# necessary.
for areaId, area in categoryTabs:
events.send(events.PopulateNotify(areaId, area))
area.updateLayout()
#if event.hasId('init-done'):

elif (event.hasId('value-changed') or
if (event.hasId('value-changed') or
event.hasId('active-profile-changed') or
event.hasId('active-profile-refreshed')):
# Update any settings with value dependencies.
Expand Down

0 comments on commit 9a190cf

Please sign in to comment.