Version: 6.3.1
Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes

PyConsole_Console Class Reference

Python console widget.

#include <PyConsole_Console.h>

Inheritance diagram for PyConsole_Console:
Inheritance graph

Public Types

enum  {
  CopyId = 0x01, PasteId = 0x02, ClearId = 0x04, SelectAllId = 0x08,
  DumpCommandsId = 0x16, All = CopyId | PasteId | ClearId | SelectAllId | DumpCommandsId
}
 

Context popup menu actions flags.

More...

Public Member Functions

 PyConsole_Console (QWidget *parent, PyConsole_Interp *interp=0)
 Constructor.
virtual ~PyConsole_Console ()
 Destructor.
PyConsole_InterpgetInterp ()
 Get python interperter.
QFont font () const
 Get python console font.
virtual void setFont (const QFont &)
 Change the python console's font.
bool isSync () const
 Get synchronous mode flag value.
void setIsSync (const bool)
 Set synchronous mode flag value.
bool isSuppressOutput () const
 Get suppress output flag value.
void setIsSuppressOutput (const bool)
 Set suppress output flag value.
bool isShowBanner () const
 Get 'show banner' flag value.
void setIsShowBanner (const bool)
 Set 'show banner' flag value.
void exec (const QString &)
 Execute python command in the interpreter.
void execAndWait (const QString &)
 Execute python command in the interpreter and wait until it is finished.
virtual bool eventFilter (QObject *, QEvent *)
 Event handler.
virtual QString popupClientType () const
 Get popup client symbolic name.
virtual void contextMenuPopup (QMenu *)
 Create the context popup menu.
void setMenuActions (const int)
 Set actions to be visible in the context popup menu.
int menuActions () const
 Get menu actions which are currently visible in the context popup menu.
bool connectPopupRequest (QObject *reciever, const char *slot)
bool disconnectPopupRequest (QObject *reciever, const char *slot)

Protected Member Functions

void contextMenuRequest (QContextMenuEvent *e)

Private Member Functions

void createActions ()
 Create menu actions.
void updateActions ()
 Update menu actions.

Private Attributes

PyConsole_InterpmyInterp
 python interpreter
PyConsole_EditormyEditor
 python console editor widget
QMap< int, QAction * > myActions
 menu actions list

Member Enumeration Documentation

anonymous enum
Enumerator:
CopyId 

"Copy" menu action

PasteId 

"Paste" menu action

ClearId 

"Clear" menu action

SelectAllId 

"Select All" menu action

DumpCommandsId 

"DumpCommands" menu action

All 

all menu actions


Constructor & Destructor Documentation

PyConsole_Console::PyConsole_Console ( QWidget parent,
PyConsole_Interp interp = 0 
)

Creates new python console widget.

Parameters:
parentparent widget
interppython interpreter

References createActions(), PyInterp_Interp.initialize(), myEditor, and myInterp.

PyConsole_Console::~PyConsole_Console ( ) [virtual]

Does nothing for the moment.


Member Function Documentation

PyConsole_Interp* PyConsole_Console.getInterp ( )
QFont PyConsole_Console::font ( ) const
Returns:
current python console's font

References myEditor.

void PyConsole_Console::setFont ( const QFont &  f) [virtual]
Parameters:
fnew font

References myEditor.

bool PyConsole_Console::isSync ( ) const
See also:
setIsSync()
Returns:
True if python console works in synchronous mode

References PyConsole_Editor.isSync(), and myEditor.

void PyConsole_Console::setIsSync ( const bool  on)

In synhronous mode the Python commands are executed in the GUI thread and the GUI is blocked until the command is finished. In the asynchronous mode each Python command is executed in the separate thread that does not block the main GUI loop.

Parameters:
onsynhronous mode flag

References myEditor, and PyConsole_Editor.setIsSync().

bool PyConsole_Console::isSuppressOutput ( ) const
See also:
setIsSuppressOutput()
Returns:
True if python console output is suppressed.

References PyConsole_Editor.isSuppressOutput(), and myEditor.

void PyConsole_Console::setIsSuppressOutput ( const bool  on)

In case if suppress output flag is true, the python console output suppressed.

Parameters:
onsuppress output flag

References myEditor, and PyConsole_Editor.setIsSuppressOutput().

bool PyConsole_Console::isShowBanner ( ) const
See also:
setIsShowBanner()
Returns:
true if python console shows banner

References PyConsole_Editor.isShowBanner(), and myEditor.

void PyConsole_Console::setIsShowBanner ( const bool  on)

The banner is shown in the top of the python console window.

See also:
isShowBanner()
Parameters:
on'show banner' flag

References myEditor, and PyConsole_Editor.setIsShowBanner().

void PyConsole_Console::exec ( const QString &  command)
Parameters:
commandstring with command and arguments

References PyConsole_Editor.exec(), and myEditor.

void PyConsole_Console::execAndWait ( const QString &  command)

Block execution of main application until the python command is executed.

Parameters:
commandstring with command and arguments

References PyConsole_Editor.execAndWait(), and myEditor.

bool PyConsole_Console::eventFilter ( QObject o,
QEvent e 
) [virtual]

Handles context menu request event.

Parameters:
oobject
eevent
Returns:
True if the event is processed and further processing should be stopped

References SUIT_PopupClient.contextMenuRequest(), and myEditor.

virtual QString PyConsole_Console.popupClientType ( ) const [virtual]

Implements SUIT_PopupClient.

void PyConsole_Console::contextMenuPopup ( QMenu menu) [virtual]

Fill in the popup menu with the commands.

Parameters:
menucontext popup menu

Reimplemented from SUIT_PopupClient.

References ClearId, CopyId, DumpCommandsId, myActions, myEditor, PasteId, SelectAllId, Qtx.simplifySeparators(), and updateActions().

void PyConsole_Console::setMenuActions ( const int  flags)

Actions, which IDs are set in flags parameter, will be shown in the context popup menu. Other actions will not be shown.

Parameters:
flagsORed together actions flags

References ClearId, CopyId, DumpCommandsId, myActions, PasteId, and SelectAllId.

int PyConsole_Console::menuActions ( ) const
Returns:
ORed together actions flags
See also:
setMenuActions()

References ClearId, CopyId, DumpCommandsId, myActions, PasteId, TestSalomeApp.ret, and SelectAllId.

void PyConsole_Console::createActions ( ) [private]

Create context popup menu actions.

References test_table.a, ClearId, CopyId, DumpCommandsId, myActions, myEditor, PasteId, and SelectAllId.

void PyConsole_Console::updateActions ( ) [private]

Update context popup menu action state.

References CopyId, myActions, myEditor, PasteId, and SelectAllId.

bool SUIT_PopupClient::connectPopupRequest ( QObject reciever,
const char *  slot 
) [inherited]

Connect popup request.

References SUIT_PopupClient.contextMenuRequest(), and SUIT_PopupClient.mySignal.

bool SUIT_PopupClient::disconnectPopupRequest ( QObject reciever,
const char *  slot 
) [inherited]

Disconnect popup request.

References SUIT_PopupClient.contextMenuRequest(), and SUIT_PopupClient.mySignal.

void SUIT_PopupClient::contextMenuRequest ( QContextMenuEvent *  e) [protected, inherited]

Send signal on context menu request.

References SUIT_PopupClient.mySignal, and SUIT_PopupClient.Signal.sendSignal().


Field Documentation

QMap<int, QAction*> PyConsole_Console.myActions [private]
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS