comparison cagou/core/cagou_main.py @ 358:8efed1d47d9f

core: don't crash when a widget without profiles switch to default widget
author Goffi <goffi@goffi.org>
date Sat, 18 Jan 2020 23:12:52 +0100
parents 4d3a0c4f2430
children a77386b73e55
comparison
equal deleted inserted replaced
357:4d3a0c4f2430 358:8efed1d47d9f
748 """ 748 """
749 if old is None: 749 if old is None:
750 old = self.getWidgetToSwitch() 750 old = self.getWidgetToSwitch()
751 if new is None: 751 if new is None:
752 factory = self.default_wid['factory'] 752 factory = self.default_wid['factory']
753 new = factory(self.default_wid, None, profiles=old.profiles) 753 try:
754 profiles = old.profiles
755 except AttributeError:
756 profiles = None
757 new = factory(self.default_wid, None, profiles=profiles)
754 to_change = None 758 to_change = None
755 if isinstance(old, CagouWidget): 759 if isinstance(old, CagouWidget):
756 to_change = old 760 to_change = old
757 else: 761 else:
758 for w in old.walk_reverse(): 762 for w in old.walk_reverse():