Skip to content

Commit bf47e7b

Browse files
authored
Merge 0461ed4 into 67ecd25
2 parents 67ecd25 + 0461ed4 commit bf47e7b

3 files changed

Lines changed: 16 additions & 9 deletions

File tree

source/gui/__init__.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -342,14 +342,11 @@ def onAddonStoreCommand(self, evt: wx.MenuEvent):
342342
from ._addonStoreGui import AddonStoreDialog
343343
from ._addonStoreGui.viewModels.store import AddonStoreVM
344344
_storeVM = AddonStoreVM()
345+
_storeVM.refresh()
345346
try:
346-
d = AddonStoreDialog(mainFrame, _storeVM)
347+
AddonStoreDialog(mainFrame, _storeVM).Show()
347348
except SettingsDialog.MultiInstanceErrorWithDialog as errorWithDialog:
348349
errorWithDialog.dialog.SetFocus()
349-
else:
350-
_storeVM.refresh()
351-
d.Maximize()
352-
d.Show()
353350
self.postPopup()
354351

355352
def onReloadPluginsCommand(self, evt):

source/gui/_addonStoreGui/controls/storeDialog.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ def __init__(self, parent: wx.Window, storeVM: AddonStoreVM):
5050
self._storeVM.onDisplayableError.register(self.handleDisplayableError)
5151
self._actionsContextMenu = _ActionsContextMenu(self._storeVM)
5252
super().__init__(parent, resizeable=True, buttons={wx.CLOSE})
53+
self.Maximize()
5354

5455
def _enterActivatesOk_ctrlSActivatesApply(self, evt: wx.KeyEvent):
5556
"""Disables parent behaviour which overrides behaviour for enter and ctrl+s"""
@@ -235,7 +236,13 @@ def onClose(self, evt: wx.CommandEvent):
235236
).format(len(addonDataManager._downloadsPendingInstall))
236237
)
237238
self._storeVM.installPending()
238-
wx.CallAfter(installingDialog.done)
239+
240+
def postInstall():
241+
installingDialog.done()
242+
# let the dialog exit.
243+
super().onClose(evt)
244+
245+
return wx.CallAfter(postInstall)
239246

240247
# let the dialog exit.
241248
super().onClose(evt)

source/gui/settingsDialogs.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,12 @@ def __new__(cls, *args, **kwargs):
141141
"Only one instance of SettingsDialog can exist at a time",
142142
)
143143
if state is cls.DialogState.DESTROYED and not multiInstanceAllowed:
144-
# the dialog has been destroyed by wx, but the instance is still available. This indicates there is something
145-
# keeping it alive.
146-
log.error("Opening new settings dialog while instance still exists: {!r}".format(firstMatchingInstance))
144+
# The dialog has been destroyed by wx, but the instance is still available.
145+
# This indicates there is something keeping it alive.
146+
log.debugWarning("Opening new settings dialog while instance still exists: {!r}".format(firstMatchingInstance))
147+
# Handle gracefully
148+
SettingsDialog._instances[firstMatchingInstance] = cls.DialogState.CREATED
149+
return firstMatchingInstance
147150
obj = super(SettingsDialog, cls).__new__(cls, *args, **kwargs)
148151
SettingsDialog._instances[obj] = cls.DialogState.CREATED
149152
return obj

0 commit comments

Comments
 (0)