Open python console without dialog

View: New views
3 Messages — Rating Filter:   Alert me  

Open python console without dialog

by vincent lapointe :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


 
Hi,
 
I'm using the following code (extract from the PydevConsoleFactory) to open programmatically a python console. When the createInteractiveLaunch method is called, the application prompt for the type of dialog I want to open. Is there a way to open the console without showing the dialog and to automatically select the Python Console type?
 
 
private void function() {
  ScriptConsoleManager manager = ScriptConsoleManager.getInstance();
  try {
    PydevConsoleInterpreter interpreter = createDefaultPydevInterpreter();
    if(interpreter != null){
      PydevConsole console = new PydevConsole(interpreter);
      manager.add(console, true);
    }
  } catch (Exception e) {
    PydevPlugin.log(e);
  }
}
 
private PydevConsoleInterpreter createDefaultPydevInterpreter() throws Exception, UserCanceledException {
        IProcessFactory iprocessFactory = new IProcessFactory();
        Tuple3<Launch, Process, Integer> launchAndProcess = iprocessFactory.createInteractiveLaunch();
               
        if(launchAndProcess == null){
            return null;
        }
        final ILaunch launch = launchAndProcess.o1;
        if(launch == null){
            return null;
        }
        PydevConsoleInterpreter consoleInterpreter = new PydevConsoleInterpreter();
        int port = Integer.parseInt(launch.getAttribute(IProcessFactory.INTERACTIVE_LAUNCH_PORT));
        consoleInterpreter.setConsoleCommunication(new PydevConsoleCommunication(port, launchAndProcess.o2, launchAndProcess.o3));
        consoleInterpreter.setNaturesUsed(iprocessFactory.getNaturesUsed());
       
        PydevDebugPlugin.getDefault().addConsoleLaunch(launch);
       
        consoleInterpreter.addCloseOperation(new Runnable() {
            public void run() {
                PydevDebugPlugin.getDefault().removeConsoleLaunch(launch);
            }
        });
        return consoleInterpreter;
}
 
Thank
 
Vincent
 
     
_________________________________________________________________
Windows Live: Keep your friends up to date with what you do online.
http://go.microsoft.com/?linkid=9691815
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
pydev-code mailing list
pydev-code@...
https://lists.sourceforge.net/lists/listinfo/pydev-code

Re: Open python console without dialog

by Fabio Zadrozny :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Not right now, but if you want, you can create an
createInteractiveLaunch() with receiving parameters instead of opening
the dialog (whith the current createInteractiveLaunch() calling it)
and submit that as a patch -- and I'll apply it for the next release.

Cheers,

Fabio

On Wed, Nov 4, 2009 at 3:40 PM, vincent lapointe
<lapointe_vincent_1975@...> wrote:

>
>
> Hi,
>
> I'm using the following code (extract from the PydevConsoleFactory) to open programmatically a python console. When the createInteractiveLaunch method is called, the application prompt for the type of dialog I want to open. Is there a way to open the console without showing the dialog and to automatically select the Python Console type?
>
>
> private void function() {
>  ScriptConsoleManager manager = ScriptConsoleManager.getInstance();
>  try {
>    PydevConsoleInterpreter interpreter = createDefaultPydevInterpreter();
>    if(interpreter != null){
>      PydevConsole console = new PydevConsole(interpreter);
>      manager.add(console, true);
>    }
>  } catch (Exception e) {
>    PydevPlugin.log(e);
>  }
> }
>
> private PydevConsoleInterpreter createDefaultPydevInterpreter() throws Exception, UserCanceledException {
>        IProcessFactory iprocessFactory = new IProcessFactory();
>        Tuple3<Launch, Process, Integer> launchAndProcess = iprocessFactory.createInteractiveLaunch();
>
>        if(launchAndProcess == null){
>            return null;
>        }
>        final ILaunch launch = launchAndProcess.o1;
>        if(launch == null){
>            return null;
>        }
>        PydevConsoleInterpreter consoleInterpreter = new PydevConsoleInterpreter();
>        int port = Integer.parseInt(launch.getAttribute(IProcessFactory.INTERACTIVE_LAUNCH_PORT));
>        consoleInterpreter.setConsoleCommunication(new PydevConsoleCommunication(port, launchAndProcess.o2, launchAndProcess.o3));
>        consoleInterpreter.setNaturesUsed(iprocessFactory.getNaturesUsed());
>
>        PydevDebugPlugin.getDefault().addConsoleLaunch(launch);
>
>        consoleInterpreter.addCloseOperation(new Runnable() {
>            public void run() {
>                PydevDebugPlugin.getDefault().removeConsoleLaunch(launch);
>            }
>        });
>        return consoleInterpreter;
> }
>
> Thank
>
> Vincent
>
>
> _________________________________________________________________
> Windows Live: Keep your friends up to date with what you do online.
> http://go.microsoft.com/?linkid=9691815
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> pydev-code mailing list
> pydev-code@...
> https://lists.sourceforge.net/lists/listinfo/pydev-code
>

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
pydev-code mailing list
pydev-code@...
https://lists.sourceforge.net/lists/listinfo/pydev-code

Re: Open python console without dialog

by vincent lapointe :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


 <cfb578b20911050432l6c314c87g79596bba37143e03@...>
Content-Type: text/plain; charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0


Hi Fabio=2C
=20
I will check the difficulty... :-)=20
=20
Thanks

----------------------------------------

> Date: Thu=2C 5 Nov 2009 10:32:40 -0200
> From: fabioz@...
> To: pydev-code@...
> Subject: Re: [Pydev-code] Open python console without dialog
>
> Not right now=2C but if you want=2C you can create an
> createInteractiveLaunch() with receiving parameters instead of opening
> the dialog (whith the current createInteractiveLaunch() calling it)
> and submit that as a patch -- and I'll apply it for the next release.
>
> Cheers=2C
>
> Fabio
>
> On Wed=2C Nov 4=2C 2009 at 3:40 PM=2C vincent lapointe
> wrote:
>>
>>
>> Hi=2C
>>
>> I'm using the following code (extract from the PydevConsoleFactory) to o=
pen programmatically a python console. When the createInteractiveLaunch met=
hod is called=2C the application prompt for the type of dialog I want to op=
en. Is there a way to open the console without showing the dialog and to au=
tomatically select the Python Console type?
>>
>>
>> private void function() {
>> ScriptConsoleManager manager =3D ScriptConsoleManager.getInstance()=3B
>> try {
>> PydevConsoleInterpreter interpreter =3D createDefaultPydevInterpreter()=
=3B

>> if(interpreter !=3D null){
>> PydevConsole console =3D new PydevConsole(interpreter)=3B
>> manager.add(console=2C true)=3B
>> }
>> } catch (Exception e) {
>> PydevPlugin.log(e)=3B
>> }
>> }
>>
>> private PydevConsoleInterpreter createDefaultPydevInterpreter() throws E=
xception=2C UserCanceledException {

>> IProcessFactory iprocessFactory =3D new IProcessFactory()=3B
>> Tuple3 launchAndProcess =3D iprocessFactory.createInteractiveLaunch()=3B
>>
>> if(launchAndProcess =3D=3D null){
>> return null=3B
>> }
>> final ILaunch launch =3D launchAndProcess.o1=3B
>> if(launch =3D=3D null){
>> return null=3B
>> }
>> PydevConsoleInterpreter consoleInterpreter =3D new PydevConsoleInterpret=
er()=3B
>> int port =3D Integer.parseInt(launch.getAttribute(IProcessFactory.INTERA=
CTIVE_LAUNCH_PORT))=3B
>> consoleInterpreter.setConsoleCommunication(new PydevConsoleCommunication=
(port=2C launchAndProcess.o2=2C launchAndProcess.o3))=3B

>> consoleInterpreter.setNaturesUsed(iprocessFactory.getNaturesUsed())=3B
>>
>> PydevDebugPlugin.getDefault().addConsoleLaunch(launch)=3B
>>
>> consoleInterpreter.addCloseOperation(new Runnable() {
>> public void run() {
>> PydevDebugPlugin.getDefault().removeConsoleLaunch(launch)=3B
>> }
>> })=3B
>> return consoleInterpreter=3B
>> }
>>
>> Thank
>>
>> Vincent
>>
>>
>> _________________________________________________________________
>> Windows Live: Keep your friends up to date with what you do online.
>> http://go.microsoft.com/?linkid=3D9691815
>> ------------------------------------------------------------------------=
------
>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-=
Day
>> trial. Simplify your report design=2C integration and deployment - and f=
ocus on
>> what you do best=2C core application coding. Discover what's new with
>> Crystal Reports now. http://p.sf.net/sfu/bobj-july
>> _______________________________________________
>> pydev-code mailing list
>> pydev-code@...
>> https://lists.sourceforge.net/lists/listinfo/pydev-code
>>
>
> -------------------------------------------------------------------------=
-----
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-D=
ay
> trial. Simplify your report design=2C integration and deployment - and fo=
cus on
> what you do best=2C core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> _______________________________________________
> pydev-code mailing list
> pydev-code@...
> https://lists.sourceforge.net/lists/listinfo/pydev-code    =20
_________________________________________________________________
Windows Live: Make it easier for your friends to see what you=92re up to on=
 Facebook.
http://go.microsoft.com/?linkid=3D9691816=

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
pydev-code mailing list
pydev-code@...
https://lists.sourceforge.net/lists/listinfo/pydev-code