20 from ..pluginapi
import Plugin
21 from ..action
import ActionInfo, SeparatorInfo
22 from ..publish
import RideOpenSuite, RideFileNameChanged
23 from ..publish.messages
import RideNewProject, RideSaved
27 if os.path.basename(path).startswith(
'__init__.'):
28 return os.path.dirname(path)
29 return os.path.abspath(path)
33 return [f
for f
in paths
if os.path.exists(f)]
40 settings = {
'recent_files': [],
'max_number_of_files': 4}
41 Plugin.__init__(self, application, default_settings=settings)
65 if not message.old_filename:
71 index = self.
recent_filesrecent_files.index(old_filename)
84 menubar = self.get_menu_bar()
85 pos = menubar.FindMenu(
'File')
86 file_menu = menubar.GetMenu(pos)
90 model = self.
modelmodel
91 if model
and model.suite:
112 action =
ActionInfo(
'File',
'No recent files')
113 action.set_menu_position(before=
'Exit')
116 for n, path
in enumerate(self.
recent_filesrecent_files):
119 sep.set_menu_position(before=
'Exit')
139 if not self.
pluginplugin.frame.check_unsaved_modifications():
146 action_info.set_menu_position(before=
'Exit')
Used to create menu entries, keyboard shortcuts and/or toolbar buttons.
Used to create separators to menus.
Entry point to RIDE plugin API – all plugins must extend this class.
def subscribe(self, listener, *topics)
Start to listen to messages with the given topics.
def unsubscribe_all(self)
Stops to listen to all messages this plugin has subscribed to.
def register_action(self, action_info)
Registers a menu entry and optionally a shortcut and a toolbar icon.
def unregister_actions(self)
Unregisters all actions registered by this plugin.
def save_setting(self, name, value, override=True, delay=0)
Saves the specified setting into the RIDE configuration file.
def get_action_info(self)
def OnOpenRecent(self, event)
def __init__(self, index, file, plugin)
Add recently opened files to the file menu.
def OnSaved(self, message)
def enable(self)
This method is called by RIDE when the plugin is enabled.
def _save_currently_loaded_suite(self)
def disable(self)
Called by RIDE when the plugin is disabled.
def __init__(self, application=None)
def _add_file_to_menu(self, path, n)
def OnSuiteOpened(self, message)
def _save_settings_and_update_file_menu(self)
def _add_recent_files_to_menu(self)
def OnFileNameChanged(self, message)
def OnNewProjectOpened(self, message)
def _add_to_recent_files(self, path)
def remove_non_existing_paths(paths)