SMILX  1.01
Public Slots | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
milxQtPythonConsole Class Reference

A simple console for python scripting with some syntax highlighting. More...

#include <milxQtPythonConsole.h>

Inheritance diagram for milxQtPythonConsole:

Public Slots

void executeLine (bool storeOnly)
 execute current line
 
void keyPressEvent (QKeyEvent *e)
 derived key press event
 
void consoleMessage (const QString &message)
 output from console
 
QStringList history ()
 get history
 
void setHistory (const QStringList &h)
 set history
 
void clear ()
 clear the console
 
virtual void cut ()
 overridden to control which characters a user may delete
 
void stdOut (const QString &s)
 output redirection
 
void stdErr (const QString &s)
 output redirection
 
void insertCompletion (const QString &)
 
void appendCommandPrompt (bool storeOnly=false)
 Appends a newline and command prompt at the end of the document.
 

Public Member Functions

 milxQtPythonConsole (QWidget *parent, const PythonQtObjectPtr &context, Qt::WindowFlags i=0)
 
bool hadError ()
 returns true if python cerr had an error
 
void clearError ()
 returns true if python cerr had an error
 

Protected Member Functions

void handleTabCompletion ()
 handle the pressing of tab
 
int commandPromptPosition ()
 Returns the position of the command prompt.
 
bool verifySelectionBeforeDeletion ()
 
void setCurrentFont (const QColor &color=QColor(0, 0, 0), bool bold=false)
 Sets the current font.
 
void changeHistory ()
 change the history according to _historyPos
 
void flushStdOut ()
 flush output that was not yet printed
 
void readSettings ()
 Read settings (mainly history) More...
 
void writeSettings ()
 Write settings (mainly history) More...
 
void createActions ()
 Create all the actions for the console.
 
void createConnections ()
 Create connections for the console.
 
void contextMenuEvent (QContextMenuEvent *currentEvent)
 context menu More...
 

Protected Attributes

QAction * copyAct
 Copy action for text.
 
QAction * cutAct
 Cut action for text.
 
QAction * pasteAct
 Paste action for text.
 
QAction * clearAct
 clear action for text
 

Detailed Description

A simple console for python scripting with some syntax highlighting.

Some useful commands:

import os
os.getcwd() # print current working directory

To run a script (that takes arguments) in the interactive prompt use:

>>>import sys
>>>sys.argv = ['', 'my', 'args', 'here']
>>>execfile('myscript.py')

Definition at line 73 of file milxQtPythonConsole.h.

Member Function Documentation

◆ contextMenuEvent()

void milxQtPythonConsole::contextMenuEvent ( QContextMenuEvent *  currentEvent)
protected

context menu

< Only exists for the duration of the context selection

Definition at line 720 of file milxQtPythonConsole.cpp.

◆ readSettings()

void milxQtPythonConsole::readSettings ( )
protected

Read settings (mainly history)

Restore history

Definition at line 645 of file milxQtPythonConsole.cpp.

◆ verifySelectionBeforeDeletion()

bool milxQtPythonConsole::verifySelectionBeforeDeletion ( )
protected

Returns if deletion is allowed at the current cursor (with and without selected text)

Definition at line 556 of file milxQtPythonConsole.cpp.

◆ writeSettings()

void milxQtPythonConsole::writeSettings ( )
protected

Write settings (mainly history)

Remember history upto 100 commands

Trim list greater than 100

Definition at line 656 of file milxQtPythonConsole.cpp.


The documentation for this class was generated from the following files: