MCPcopy Index your code
hub / github.com/rawpython/remi / configure_widget_for_editing

Method configure_widget_for_editing

editor/editor.py:905–944  ·  view source on GitHub ↗

A widget have to be added to the editor, it is configured here in order to be conformant to the editor

(self, widget)

Source from the content-addressed store, hash-verified

903 'properties'].set_widget(self.selectedWidget)
904
905 def configure_widget_for_editing(self, widget):
906 """ A widget have to be added to the editor, it is configured here in order to be conformant
907 to the editor
908 """
909 if not issubclass(widget.__class__, gui.Widget):
910 return
911 if widget.variable_name is None:
912 return
913
914 # for all the methods of this widget
915
916 for (setOnEventListenerFuncname, setOnEventListenerFunc) in inspect.getmembers(widget):
917 # if the member is decorated by decorate_set_on_listener
918 if hasattr(setOnEventListenerFunc, '_event_info'):
919 setOnEventListenerFunc.__class__ = editor_widgets.ClassEventConnectorEditor
920 if setOnEventListenerFunc.callback:
921 getattr(widget, setOnEventListenerFuncname).do(
922 setOnEventListenerFunc.callback)
923
924 # we force a connection, also if back_callback is None, to get the widget selectable
925 back_callback = widget.onclick.callback
926 widget.onclick.do(back_callback, js_stop_propagation=True)
927 widget.onclick.editor_listener_callback = self.on_widget_selection
928
929 # setup of the on_dropped function of the widget in order to manage the dragNdrop
930 widget.__class__.on_dropped = on_dropped
931
932 # drag properties
933 #widget.style['resize'] = 'both'
934 #widget.style['overflow'] = 'auto'
935 widget.attributes['draggable'] = 'true'
936
937 widget.attributes['tabindex'] = str(self.tabindex)
938 # if not 'position' in widget.style.keys():
939 # widget.style['position'] = 'absolute'
940 # if not 'left' in widget.style.keys():
941 # widget.style['left'] = '1px'
942 # if not 'top' in widget.style.keys():
943 # widget.style['top'] = '1px'
944 self.tabindex += 1
945
946 def add_widget_to_editor(self, widget, parent=None, root_tree_node=True):
947 if parent == None:

Callers 1

add_widget_to_editorMethod · 0.95

Calls 1

doMethod · 0.45

Tested by

no test coverage detected