21 from ..action.actioninfo
import ActionInfo
22 from ..publish
import PUBLISHER
51 tree = property(
lambda self: self.
__frame__frame.tree,
52 doc=
'Provides access to the suite and resource tree')
53 filemgr = property(
lambda self: self.
__frame__frame.filemgr,
54 doc=
'Provides access to the files and folders explorer')
55 menubar = property(
lambda self: self.
__frame__frame.GetMenuBar(),
56 doc=
'Provides access to the application menubar')
57 toolbar = property(
lambda self: self.
__frame__frame.GetToolBar(),
58 doc=
'Provides access to the application toolbar')
59 notebook = property(
lambda self: self.
__frame__frame.notebook,
60 doc=
'Provides access to the tabbed notebook')
61 model = property(
lambda self: self.
__app__app.model,
62 doc=
'Provides access to the data model')
63 frame = property(
lambda self: self.
__frame__frame,
64 doc=
'Reference to the RIDE main frame')
66 doc=
'Currently selected datafile')
67 global_settings = property(
lambda self: self.
__app__app.settings,
68 doc=
'Settings read from settings.cfg')
108 def __init__(self, application, name=None, doc=None, metadata=None,
109 default_settings=None, initially_enabled=True):
110 self.
namename = name
or utils.name_from_class(self, drop=
'Plugin')
118 self.
__settings__settings = application.settings[
'Plugins'].add_section(self.
namename)
119 self.
__settings__settings.set_defaults(default_settings)
127 return inspect.getdoc(self)
or ''
135 if '__settings' not in name
and self.
__settings__settings.has_setting(name):
137 raise AttributeError(
"No attribute or settings with name '%s' found" % name)
149 self.
__settings__settings.set(name, value, autosave=delay == 0, override=override)
206 action = self.
__frame__frame.actions.register_action(action_info)
211 action_info =
ActionInfo(
None,
None, action=callback, shortcut=shortcut)
212 action = self.
__frame__frame.actions.register_shortcut(action_info)
224 return [self.
register_actionregister_action(info)
for info
in action_infos]
227 self.
__frame__frame.toolbar.register_search_handler(description, handler, icon, default=default)
240 def add_tab(self, tab, title, allow_closing=True):
253 self.
notebooknotebook.allow_closing(tab)
257 self.
notebooknotebook.disallow_closing(tab)
269 return self.
__app__app.ok_to_open_new()
287 if not self.
treetree:
297 self.
__frame__frame.save(self.
treetree.get_selected_datafile_controller())
301 return self.
__frame__frame.has_unsaved_changes()
316 if not self.
treetree:
327 return keyword_info.item
if keyword_info
else None
331 if not self.
treetree:
386 PUBLISHER.publish(topic, data)
398 PUBLISHER.subscribe(listener, topic)
408 PUBLISHER.unsubscribe(listener, topic)
412 PUBLISHER.unsubscribe_all(self)
431 self.
__app__app.activate_editor(item_class, editor_class)
446 if not self.
treetree:
448 self.
treetree.select_node_by_data(tcuk)
449 self.
__app__app.editor.highlight_cell(obj, row, column)
453 if not self.
treetree:
Used to create menu entries, keyboard shortcuts and/or toolbar buttons.
Entry point to RIDE plugin API – all plugins must extend this class.
def all_testcases(self)
Returns all test cases from all suites in one, unsorted list.
def register_content_assist_hook(self, hook)
Allows plugin to insert values in content assist dialog.
def save_all_unsaved_changes(self)
Saves all the data files that are modified.
def highlight_cell(self, tcuk, obj=None, row=-1, column=-1)
Highlight a specific row/column of a test case or user keyword.
def new_suite_can_be_opened(self)
Checks are there modified files and asks user what to do if there are.
def delete_tab(self, tab)
Deletes the tab added using add_tab.
def is_user_keyword(self, name)
Returns whether name is a user keyword of current datafile.
def get_editors(self, item_class)
Return all registered editors for the given model item class.
def get_selected_datafile(self)
Returns the data file that is currently selected in the tree.
def add_tab(self, tab, title, allow_closing=True)
Adds the tab with the title to the tabbed notebook and shows it.
def save_selected_datafile(self)
Saves the data file that is currently selected in the tree.
def subscribe(self, listener, *topics)
Start to listen to messages with the given topics.
def select_user_keyword_node(self, uk)
Selects node containing the given uk in the tree.
def disable(self)
Called by RIDE when the plugin is disabled.
def get_keyword_details(self, name)
Returns details (documentation, source) of keyword with name name.
def register_editor(self, item_class, editor_class, activate=True)
Register editor_class as an editor class for model items of type item_class
def register_actions(self, action_infos)
Registers multiple menu entries and shortcuts/icons.
def _get_doc(self, given_doc)
def unsubscribe_all(self)
Stops to listen to all messages this plugin has subscribed to.
def set_active_editor(self, item_class, editor_class)
Activates the specified editor to be used with the specified model item.
def get_keyword(self, name)
Returns the keyword object with the given name or None.
def allow_tab_closing(self, tab)
Allows closing a tab that has been created using allow_closing=False.
def is_library_keyword(self, name)
Returns whether name is a keyword imported by current datafile.
def get_user_keyword(self, name)
Returns user keyword instance whose name is name or None.
def register_action(self, action_info)
Registers a menu entry and optionally a shortcut and a toolbar icon.
def _delay_saving(self, delay)
def content_assist_values(self, value='')
Returns content assist values for currently selected item.
def config_panel(self, parent)
Called by RIDE to get the plugin configuration panel.
def disallow_tab_closing(self, tab)
Disallows closing a tab by use.
def unregister_editor(self, item_class, editor_class)
Unregisters editor_class as an editor class for model items of type item_class
def unregister_actions(self)
Unregisters all actions registered by this plugin.
def get_selected_item(self)
Returns the item that is currently selected in the tree.
def show_tab(self, tab)
Makes the tab added using add_tab visible.
def save_setting(self, name, value, override=True, delay=0)
Saves the specified setting into the RIDE configuration file.
def get_editor(self, item_class)
Return the current editor class for the given model item class.
def register_search_action(self, description, handler, icon, default=False)
def _save_setting_after_delay(self)
def __init__(self, application, name=None, doc=None, metadata=None, default_settings=None, initially_enabled=True)
Initialize the plugin with the provided data.
def highlight(self, data, text)
Highlight a specific text of a given data's edito.
def open_suite(self, path)
Opens a test suite specified by the path.
def __getattr__(self, name)
Provides convenient attribute access to saved settings.
def publish(self, topic, data)
Publishes a message with given topic and client data.
def unsubscribe(self, listener, *topics)
Stops listening to messages with the given topics.
def enable(self)
This method is called by RIDE when the plugin is enabled.
def register_shortcut(self, shortcut, callback)
def get_plugins(self)
Returns list containing plugin wrapper for every loaded plugin.
def tab_is_visible(self, tab)
Returns is the tab added using add_tab visible or not.
def is_unsaved_changes(self)
Returns True if there is any unsaved changes, otherwise False.