19 from .settingeditors
import (
20 DocumentationEditor, SettingEditor, TagsEditor,
21 ImportSettingListEditor, VariablesListEditor, MetadataListEditor)
22 from ..
import robotapi, context
23 from ..controller.settingcontrollers
import (
24 DocumentationController, VariableController, TagsController)
25 from ..publish
import (
26 RideItemSettingsChanged, RideInitFileRemoved, RideFileNameChanged)
27 from ..usages.UsageRunner
import ResourceFileUsages
28 from ..widgets
import (
29 ButtonWithHandler, Label, HeaderLabel, HorizontalSizer, HtmlWindow)
33 undo = cut = copy = paste = delete = comment = uncomment = save \
34 = show_content_assist = tree_item_selected =
lambda *args:
None
37 HtmlWindow.__init__(self, parent, text=context.ABOUT_RIDE)
52 undo = cut = copy = paste = delete = comment = uncomment = save \
53 = show_content_assist =
lambda self:
None
55 def __init__(self, plugin, parent, controller, tree):
56 wx.Panel.__init__(self, parent)
57 from ..preferences
import RideSettings
61 _settings = RideSettings()
81 class _RobotTableEditor(EditorPanel):
87 _settings_open_id =
'robot table settings open'
89 def __init__(self, plugin, parent, controller, tree):
90 EditorPanel.__init__(self, plugin, parent, controller, tree)
91 self.
sizersizer = wx.BoxSizer(wx.VERTICAL)
92 self.Bind(wx.EVT_IDLE, self.
OnIdleOnIdle)
93 self.SetSizer(self.
sizersizer)
96 0, wx.EXPAND | wx.ALL, 5)
114 for editor
in self.
_editors_editors:
115 editor.update_value()
123 mx, my = wx.GetMousePosition()
126 return (mx < tx
or mx > tx+dx)
or (my < ty
or my > ty+dy)
129 if wx.GetMouseState().ControlDown()
or \
139 self.
pluginplugin.unsubscribe(
141 self.Unbind(wx.EVT_MOTION)
150 text +=
' (READ ONLY)'
158 self.
sizersizer.Add(self.
_settings_settings, 0, wx.ALL | wx.EXPAND, 2)
172 self.GetSizer().Layout()
174 self.Parent.GetSizer().Layout()
175 self.Parent.Refresh()
179 self.GetSizer().Layout()
186 if isinstance(obj, robotapi.Setting):
188 if setting_editor
and hasattr(setting_editor,
"highlight"):
189 setting_editor.highlight(column)
190 elif row >= 0
and column >= 0:
191 self.kweditor.select(row, column)
197 for child
in self.GetChildren():
198 if isinstance(child, SettingEditor):
199 if child._item == setting:
204 for editor
in self.
_editors_editors:
205 editor.highlight(text, expand=expand)
212 wx.CollapsiblePane.__init__(
213 self, parent, wx.ID_ANY,
'Settings',
214 style=wx.CP_DEFAULT_STYLE | wx.CP_NO_TLW_RESIZE)
215 from ..preferences
import RideSettings
219 _settings = RideSettings()
231 self.
_sizer_sizer = wx.BoxSizer(wx.VERTICAL)
236 wx.CollapsiblePane.Expand(self)
239 pane = wx.CollapsiblePane.GetPane(self)
241 pane.SetBackgroundColour(Colour(200, 222, 40))
242 pane.SetOwnBackgroundColour(Colour(200, 222, 40))
243 pane.SetForegroundColour(Colour(7, 0, 70))
244 pane.SetOwnForegroundColour(Colour(7, 0, 70))
246 pane.tooltip_allowed = self.GetParent().tooltip_allowed
250 for editor
in self.
_editors_editors:
254 for editor
in self.
_editors_editors:
255 editor.update_value()
259 return editor_cls(self.
GetPaneGetPane(), controller, plugin, tree)
262 if isinstance(controller, DocumentationController):
263 return DocumentationEditor
264 if isinstance(controller, TagsController):
268 def build(self, settings, plugin, tree):
269 for setting
in settings:
272 editor.SetBackgroundColour(Colour(200, 222, 40))
273 editor.SetOwnBackgroundColour(Colour(200, 222, 40))
274 editor.SetForegroundColour(Colour(7, 0, 70))
275 editor.SetOwnForegroundColour(Colour(7, 0, 70))
277 self.
_sizer_sizer.Add(editor, 0, wx.ALL | wx.EXPAND, self.
BORDERBORDER)
278 self.
_editors_editors.append(editor)
283 expand_button_height = 34
285 if self.IsExpanded():
286 for editor
in self.
_editors_editors:
287 total_height += editor.BestSize[1]
288 total_height += 2 * self.
BORDERBORDER + 1
289 self.SetSizeHints(-1, total_height + expand_button_height)
295 for editor
in self.
_editors_editors:
296 if editor.contains(text):
297 editor.highlight(text)
300 editor.clear_highlight()
303 self.Parent.GetSizer().Layout()
309 _RobotTableEditor.__init__(self, *args)
310 self.
pluginplugin.subscribe(
321 if isinstance(item, VariableController):
327 datafile.name,
not self.
controllercontroller.is_modifiable())
328 self.
sizersizer.Add(header, 0, wx.EXPAND | wx.ALL, 5)
330 self.
sizersizer.Add((0, 10))
336 sizer = wx.BoxSizer(wx.HORIZONTAL)
338 sizer.Add(Label(self, label=
'Source', size=(context.SETTING_LABEL_WIDTH,
339 context.SETTING_ROW_HEIGHT)))
340 self.
_source_source = wx.TextCtrl(self, style=wx.TE_READONLY | wx.NO_BORDER)
344 self.
_source_source.SetValue(source)
345 self.
_source_source.SetMaxSize(wx.Size(-1, context.SETTING_ROW_HEIGHT))
346 sizer.Add(self.
_source_source, 1, wx.EXPAND)
351 self.
sizersizer.Add(import_editor, 1, wx.EXPAND)
364 _RobotTableEditor.close(self)
367 delete_rows = insert_rows =
lambda s:
None
372 def __init__(self, parent, header, usages_callback, color_foreground, color_background):
373 HorizontalSizer.__init__(self)
374 self.
_header_header = HeaderLabel(parent, header)
375 self.add_expanding(self.
_header_header)
376 self.add(ButtonWithHandler(parent,
'Find Usages', usages_callback, color_secondary_foreground=color_foreground,
377 color_secondary_background=color_background))
387 _settings_open_id =
'resource file settings open'
391 text +=
' (READ ONLY)'
404 _settings_open_id =
'test case file settings open'
407 _FileEditor._populate(self)
408 self.
sizersizer.Add((0, 10))
413 self.
sizersizer.Add(metadata_editor, 1, wx.EXPAND)
421 _settings_open_id =
'init file settings open'
424 TestCaseFileEditor._populate(self)
429 editor.refresh(setting)
Base class for all editor panels.
color_secondary_foreground
def tree_item_selected(self, item)
color_secondary_background
def __init__(self, plugin, parent, controller, tree)
def _init_file_removed(self, message)
def _create_header(self, text, readonly=False)
def build(self, settings, plugin, tree)
def _get_editor_class(self, controller)
def create_editor_for(self, controller, plugin, tree)
color_secondary_background
def __init__(self, parent)
def _recalc_size(self, event=None)
color_secondary_foreground
def highlight(self, text, expand=True)
def __init__(self, parent)
def _update_source_and_name(self, message)
def tree_item_selected(self, item)
def _update_source(self, message=None)
def _add_variable_table(self)
def _add_import_settings(self)
def __init__(self, *args)
def _create_source_label(self, source)
def _restore_settings_open_status(self)
def __init__(self, plugin, parent, controller, tree)
def _create_settings(self)
def highlight(self, text, expand=True)
def _settings_changed(self, message)
def _should_settings_be_open(self)
def _reset_last_show_tooltip(self)
def _create_header(self, text, readonly=False)
def _mouse_outside_tooltip(self)
def tooltip_allowed(self, tooltip)
def _get_settings_editor(self, setting)
Return the settings editor for the given setting object.
def highlight_cell(self, obj, row, column)
Highlight the given object at the given row and column.
def _collabsible_changed(self, event=None)
def _store_settings_open_status(self)