Exemplo n.º 1
0
 def open(self, data):
     # print(f"DEBUG: Textedit enter open")
     self.reset()
     self._data = data
     # print(f"DEBUG: Textedit in open before getting SuggestionSource {self._data._data}\n Type data is {type(self._data._data)}")
     try:
         if isinstance(self._data._data, ResourceFileController):
             # from robotide.namespace import Namespace
             # self._namespace = Namespace(self._editor._settings)
             # self._namespace.get_resource(self._data._data.source)
             self._controller_for_context = DummyController(
                 self._data._data, self._data._data)
             # print(f"DEBUG: Textedit in before getting to RESOURCE")
             self._suggestions = SuggestionSource(
                 None, self._controller_for_context)
         else:
             self._suggestions = SuggestionSource(None,
                                                  self._data._data.tests[0])
         # print(f"DEBUG: Textedit in open After getting SuggestionSource")
     except IndexError:  # It is a new project, no content yet
         # print(f"DEBUG: Textedit in open Exception SuggestionSource")
         self._controller_for_context = DummyController(
             self._data._data, self._data._data)
         self._suggestions = SuggestionSource(None,
                                              self._controller_for_context)
         # self._suggestions = SuggestionSource(None, BuiltInLibrariesSuggester())
     if not self._editor:
         self._stored_text = self._data.content
     else:
         self._editor.set_text(self._data.content)
         self.set_editor_caret_position()
Exemplo n.º 2
0
 def open(self, data):
     self.reset()
     self._data = data
     try:
         self._suggestions = SuggestionSource(None, data._data.tests[0])
     except IndexError:  # It is a new project, no content yet
         self._suggestions = SuggestionSource(None,
                                              BuiltInLibrariesSuggester())
     if not self._editor:
         self._stored_text = self._data.content
     else:
         self._editor.set_text(self._data.content)
         self.set_editor_caret_position()
Exemplo n.º 3
0
 def __init__(self, parent, plugin, controller):
     ExpandoTextCtrl.__init__(self,
                              parent,
                              size=wx.DefaultSize,
                              style=wx.WANTS_CHARS)
     _ContentAssistTextCtrlBase.__init__(
         self, SuggestionSource(plugin, controller))
Exemplo n.º 4
0
 def __init__(self, parent, value, label, controller, validator=None,
              settings=None, suggestion_source=None):
     self._suggestion_source = suggestion_source or SuggestionSource(
         parent.plugin, None)
     self._controller = controller
     self._label = label
     self._parent = parent
     ValueEditor.__init__(self, parent, value, label, validator, settings)
Exemplo n.º 5
0
 def __init__(self,
              parent,
              value,
              label=None,
              validator=None,
              settings=None,
              suggestion_source=None):
     self._suggestion_source = suggestion_source or SuggestionSource(
         parent.plugin, None)
     ValueEditor.__init__(self, parent, value, label, validator, settings)
Exemplo n.º 6
0
    def __init__(self, parent, plugin, controller):
        """ According to class MRO, super().__init__ in  _ContentAssistTextCtrlBase will init ExpandoTextCtrl
        instance """

        _ContentAssistTextCtrlBase.__init__(
            self,
            SuggestionSource(plugin, controller),
            parent=parent,
            size=wx.DefaultSize,
            style=wx.WANTS_CHARS | wx.TE_NOHIDESEL)
Exemplo n.º 7
0
 def test_suggestion_source_when_controller_and_row(self):
     suggestion_source = SuggestionSource(plugin=None, controller=self._controller_mock('foo'))
     suggestions = suggestion_source.get_suggestions('foo', 1)
     self.assertEqual(1, len(suggestions))
     self.assertEqual('foobar', suggestions[0].name)
Exemplo n.º 8
0
 def test_suggestion_source_when_no_controller(self):
     suggestion_source = SuggestionSource(plugin=self._plugin_mock('bar'), controller=None)
     suggestions = suggestion_source.get_suggestions('foo', 1)
     self.assertEqual(1, len(suggestions))
     self.assertEqual('barfoo', suggestions[0].name)
Exemplo n.º 9
0
 def test_suggestion_source_when_no_controller(self):
     suggestion_source = SuggestionSource(plugin=self._plugin_mock('bar'),
                                          controller=None)
     suggestions = suggestion_source.get_suggestions('foo', 1)
     self.assertEqual(1, len(suggestions))
     self.assertEqual('barfoo', suggestions[0].name)
Exemplo n.º 10
0
 def test_suggestion_source_when_controller_and_row(self):
     suggestion_source = SuggestionSource(
         plugin=None, controller=self._controller_mock('foo'))
     suggestions = suggestion_source.get_suggestions('foo', 1)
     self.assertEqual(1, len(suggestions))
     self.assertEqual('foobar', suggestions[0].name)