Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# widget initialization
assert isinstance(state, WidgetManager.Delayed)
if state in self.__init_queue:
self.__init_queue.remove(state)
node = state.node
widget = self.create_widget_instance(node)
self.__widgets.append(widget)
self.__widget_for_node[node] = widget
self.__node_for_widget[widget] = node
self.__initialize_widget_state(node, widget)
state = WidgetManager.Materialized(node, widget)
self.__initstate_for_node[node] = state
self.widget_for_node_added.emit(node, widget)
return state
widget.__init__()
except Exception:
sys.excepthook(*sys.exc_info())
msg = traceback.format_exc()
msg = "Could not create {0!r}\n\n{1}".format(node.description.name, msg)
# remove state tracking for widget ...
del self.__widget_for_node[node]
del self.__node_for_widget[widget]
del self.__widget_processing_state[widget]
# ... and substitute it with a mock error widget.
widget = mock_error_owwidget(node, msg)
self.__widget_for_node[node] = widget
self.__node_for_widget[widget] = node
self.__widget_processing_state[widget] = 0
self.__initstate_for_node[node] = WidgetManager.Materialized(
node, widget
)
self.__initstate_for_node[node] = WidgetManager.Materialized(node, widget)
# Clear Initializing flag
self.__widget_processing_state[widget] &= ~WidgetManager.Initializing
node.title_changed.connect(widget.setCaption)
# Widget's info/warning/error messages.
widget.messageActivated.connect(self.__on_widget_state_changed)
widget.messageDeactivated.connect(self.__on_widget_state_changed)
# Widget's statusTip
node.set_status_message(widget.statusMessage())
widget.statusMessageChanged.connect(node.set_status_message)
msg = "Could not create {0!r}\n\n{1}".format(node.description.name, msg)
# remove state tracking for widget ...
del self.__widget_for_node[node]
del self.__node_for_widget[widget]
del self.__widget_processing_state[widget]
# ... and substitute it with a mock error widget.
widget = mock_error_owwidget(node, msg)
self.__widget_for_node[node] = widget
self.__node_for_widget[widget] = node
self.__widget_processing_state[widget] = 0
self.__initstate_for_node[node] = WidgetManager.Materialized(
node, widget
)
self.__initstate_for_node[node] = WidgetManager.Materialized(node, widget)
# Clear Initializing flag
self.__widget_processing_state[widget] &= ~WidgetManager.Initializing
node.title_changed.connect(widget.setCaption)
# Widget's info/warning/error messages.
widget.messageActivated.connect(self.__on_widget_state_changed)
widget.messageDeactivated.connect(self.__on_widget_state_changed)
# Widget's statusTip
node.set_status_message(widget.statusMessage())
widget.statusMessageChanged.connect(node.set_status_message)
# Widget's progress bar value state.
widget.progressBarValueChanged.connect(node.set_progress)