Hello, I want to create a "Tools" plugin for gedit, but first I want to discuss this with you, read the following "spec" and tell me what you think. <<<<< start Tools Plugin ------------ - Provide a mechanism to call external programs from a menuitem/shortcut-key. - Capture and parse the output of an external program to show a error/warning list. - We can also have filter tools, this ones are feed with some document text and return/replace the selection or create a new document. - Group several tools in a group, so we can have a fast access to the tools needed for a specific task, say, a simple tool chain for coding C programs. These tools will be automatically associated with Ctrl+<N> shortcuts. OTOH if a tool is not associated with a specific group it will be always available. Each tool --------- - The tool name and a icon that appears on menus. - Command line (to be passed to user shell) with expansions format: $() and escape $$. - filename - basename - uri - line - column - selection (selected text) - totallines (?) - stdin to pass to command line - current selection - all document - a string - none pass as a locale or utf8 encoded text. - Capture output to: - replace current selection - replace all document - a new document - insert at cursor position - insert in a new line above/bellow current line - append to document - output window - output window with error/warning parsing, this needs a list with output filters to apply - each output filter is applied in order, this iteration ends when one of them matches a filename:linum pair. - A flag that says if we should: save all files, save the current file, or not save at all. - Working directory. - Environment for the command? (or the user can use the env command) NOTE: While the tool is running no other tool can run, neither the user can modify the document. This only applies to a tool that uses output window or modifies the document. Output Filters -------------- - operate at line basis. - each filter has a type: warning or error. - each return: - filename - line - column (optional) NOTE: a regex lib that can name groups is needed. pcre can do this with, (?P<filename>.+) (?P<linenum>[0-9]+). (Python syntax). Or, we can simulate this using gnuregex by counting `()'. - a unique name. - a description. (humm, really?) Changes to gedit ---------------- I need a way of connecting mouse double-click and space/enter key signals; needed to open the file:line with the error/warning. How about a "action" signal? I also need a output-cleared and destroyed signal in output window; needed for releasing resources allocated by the tool. <<<<< end You will find a GUI mockup of all this in the attachment, the most "crude" one is the tool-editor-advanced dialog. I'm looking forward for your comments! Regards, Rui Lopes
Attachment:
tools.glade.bz2
Description: application/bzip