Files
gnatstudio/python/src/python_module.ads
Emmanuel Briot 1e341fe667 (Override_Default_IO): new subprogram. Makes sure that changing the console
associated with the python interpreter will also display results of print to
 that console.
 In particular, this fixes the case where a filter set for an action is in
 fact raising an exception, which would be displayed in the python console if
 it exists, and would not be displayed otherwise. If the python console does
 not exist, we fall back on the Messages window, so that such error messages
 and exceptions and filters are properly displayed for the user, which helps
 debugging


git-svn-id: svn+ssh://svn.eu/Dev/importfromcvs/trunk@93488 936e1b1b-40f2-da11-902a-00137254ae57
2005-10-03 13:20:28 +00:00

51 lines
2.3 KiB
Ada
Executable File

-----------------------------------------------------------------------
-- G P S --
-- --
-- Copyright (C) 2003 --
-- ACT-Europe --
-- --
-- GPS is free software; you can redistribute it and/or modify it --
-- under the terms of the GNU General Public License as published by --
-- the Free Software Foundation; either version 2 of the License, or --
-- (at your option) any later version. --
-- --
-- This program is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
-- General Public License for more details. You should have received --
-- a copy of the GNU General Public License along with this program; --
-- if not, write to the Free Software Foundation, Inc., 59 Temple --
-- Place - Suite 330, Boston, MA 02111-1307, USA. --
-----------------------------------------------------------------------
with GPS.Kernel;
with Interactive_Consoles;
package Python_Module is
procedure Register_Module
(Kernel : access GPS.Kernel.Kernel_Handle_Record'Class);
-- Register the module into the list
procedure Initialize_IO;
-- Initialize the redirection of stdin, stdout and stderr.
procedure Override_Default_IO
(Console : Interactive_Consoles.Interactive_Console);
-- Override the console to which Python should write through "print"
procedure Load_Python_Startup_Files
(Kernel : access GPS.Kernel.Kernel_Handle_Record'Class);
-- Load all the user's startup file of the user.
-- This procedure should be called only after all standard modules
-- have been registered, so that if the user's startup files depend
-- on standard GPS functions these are already loaded.
-- This procedure does nothing if the python module hasn't been
-- registered.
--
-- ??? Ideally, we should have a hook run after all modules have been
-- registered
end Python_Module;