#include <BALL/VIEW/WIDGETS/pyWidget.h>
Python Widget This class is a Window for a Python interpreter interface. So it is possible to access all data in the running application in realtime with the script language. PyWidget also has the capablities to run a Python script from a file at startup, or on demand from the user.
BALL::VIEW::PyWidget::PyWidget | ( | QWidget * | parent = 0 , |
|
const char * | name = 0 | |||
) |
Standard constructor. If the widget is part of a BALL MainControl widget, it inserts a menu entry Tools|Restart Python
into the menu bar.
parent | the parent widget | |
name | the widget name |
BALL::VIEW::PyWidget::PyWidget | ( | const PyWidget & | p | ) |
only needed for Pyhon Interface
BALL::VIEW::PyWidget::~PyWidget | ( | ) |
void BALL::VIEW::PyWidget::abortScript | ( | ) | [slot] |
void BALL::VIEW::PyWidget::appendText | ( | const String & | text, | |
bool | output = false , |
|||
bool | state_message = false | |||
) | [slot] |
void BALL::VIEW::PyWidget::appendToHistory_ | ( | const String & | line | ) | [protected] |
virtual void BALL::VIEW::PyWidget::applyPreferences | ( | ) | [virtual] |
Apply the preferences of the specific tab. In this method the widget can extract any changed values from its preferences tab (if required). This method is called automatically by the applyPreferencesTab from the MainControl object if the apply button in the Preferences dialog is pressed.
preferences | the Preferences dialog of the MainControl |
applyPreferencesTab
Reimplemented from BALL::VIEW::ModularWidget.
Test if this ModularWidget can handle a given file format. (Overloaded from ModularWidget)
fileform | short string with the file extension (e.g. PDB) |
Reimplemented from BALL::VIEW::ModularWidget.
void BALL::VIEW::PyWidget::checkMenu | ( | MainControl & | main_control | ) | [virtual] |
Menu checking method. This method is called MainControl::checkMenus before a popup menu is shown. It should be used to update the state of menu entries (e.g. disable or enable entries).
main_control | the MainControl object whose menus should be checked |
Reimplemented from BALL::VIEW::ModularWidget.
void BALL::VIEW::PyWidget::clear | ( | ) | [virtual, slot] |
Explicit default initialization. Currently does nothing.
Reimplemented from BALL::VIEW::ModularWidget.
virtual void BALL::VIEW::PyWidget::clearHistory_ | ( | ) | [protected, virtual, slot] |
void BALL::VIEW::PyWidget::clearScript | ( | ) | [slot] |
virtual bool BALL::VIEW::PyWidget::completionSelected_ | ( | ) | [protected, virtual, slot] |
virtual void BALL::VIEW::PyWidget::contentsDragEnterEvent | ( | QDragEnterEvent * | e | ) | [protected, virtual] |
virtual void BALL::VIEW::PyWidget::contentsDropEvent | ( | QDropEvent * | e | ) | [protected, virtual] |
void BALL::VIEW::PyWidget::createMenuHelpEntry_ | ( | QMenu * | menu, | |
QTextEdit * | text_edit, | |||
const QPoint & | point | |||
) | [protected] |
virtual void BALL::VIEW::PyWidget::createScript_ | ( | ) | [protected, virtual, slot] |
void BALL::VIEW::PyWidget::dump | ( | std::ostream & | s, | |
Size | depth | |||
) | const [virtual] |
Internal state dump. Dump the current internal state of this mainControl to the output ostream s with dumping depth depth. Calls ConnectionObject::dump.
s | output stream where to output the internal state | |
depth | the dumping depth |
Reimplemented from BALL::VIEW::ModularWidget.
void BALL::VIEW::PyWidget::execScript | ( | ) | [slot] |
void BALL::VIEW::PyWidget::exportHistory | ( | ) | [slot] |
virtual void BALL::VIEW::PyWidget::fetchPreferences | ( | INIFile & | inifile | ) | [virtual] |
Load settings from an INIFile
Reimplemented from BALL::VIEW::DockWidget.
void BALL::VIEW::PyWidget::finalizePreferencesTab | ( | Preferences & | preferences | ) | [virtual] |
Remove the preferences tab. This method can remove a preferences widget (if created in initializePreferencesTab) from the Preferences dialog of the MainControl. This method is called automatically by MainControl::aboutToExit() at the end of the application.
preferences | the Preferences dialog of the MainControl |
Reimplemented from BALL::VIEW::ModularWidget.
virtual void BALL::VIEW::PyWidget::finalizeWidget | ( | MainControl & | main_control | ) | [virtual] |
Remove menu entries.
Reimplemented from BALL::VIEW::ModularWidget.
void BALL::VIEW::PyWidget::findError_ | ( | String | result | ) | [protected] |
QComboBox* BALL::VIEW::PyWidget::getCompletionBox_ | ( | ) | [protected] |
String BALL::VIEW::PyWidget::getCurrentLine | ( | ) | const |
QString BALL::VIEW::PyWidget::getCurrentScript | ( | ) |
String BALL::VIEW::PyWidget::getCurrentWord_ | ( | QTextCursor & | text_cursor | ) | [protected] |
bool BALL::VIEW::PyWidget::getMembers | ( | const String & | classname, | |
QStringList & | sl, | |||
const String & | prefix | |||
) | [slot] |
const char* BALL::VIEW::PyWidget::getPrompt_ | ( | ) | const [protected] |
virtual void BALL::VIEW::PyWidget::hotkeyItem | ( | ) | [virtual, slot] |
void BALL::VIEW::PyWidget::initializePreferencesTab | ( | Preferences & | preferences | ) | [virtual] |
Initialize a preferences tab for the widget (if needed). This method can be used to create preferences widgets that can be inserted into the Preferences dialog with the method insertTab. This method is called automatically by MainControl::show at the start of the application.
preferences | the Preferences dialog of the MainControl |
Reimplemented from BALL::VIEW::ModularWidget.
virtual void BALL::VIEW::PyWidget::initializeWidget | ( | MainControl & | main_control | ) | [virtual] |
Setup the menu entries.
Reimplemented from BALL::VIEW::DockWidget.
void BALL::VIEW::PyWidget::insertHotkey | ( | const Hotkey & | hotkey | ) |
bool BALL::VIEW::PyWidget::isInDirectMode | ( | ) | const |
bool BALL::VIEW::PyWidget::isValid | ( | ) | const [inline, virtual] |
Is full Python support available?
Reimplemented from BALL::VIEW::ConnectionObject.
bool BALL::VIEW::PyWidget::keyPressed | ( | QKeyEvent * | e | ) | [protected] |
void BALL::VIEW::PyWidget::loadScript | ( | ) | [slot] |
Map a key to a command Modifier can be: "", Ctrl, Shift Key should be F2 - F12
virtual void BALL::VIEW::PyWidget::modifyHotkeys | ( | ) | [virtual, slot] |
void BALL::VIEW::PyWidget::newPrompt_ | ( | ) | [protected] |
Print prompt. Determine the correct type of prompt and append it to the current text. The cursor is placed after the prompt and textChanged
is emitted.
Run a Python script from a given file
is_current | states wheter this file is currently loaded in the editor |
Tell this ModularWidget to open a given file. (Overloaded from ModularWidget)
Reimplemented from BALL::VIEW::ModularWidget.
Parse a and execute a given string. If silent_ is set to true, no prompts are being printed.
virtual void BALL::VIEW::PyWidget::paste | ( | ) | [protected, virtual] |
virtual void BALL::VIEW::PyWidget::printCursorPosition_ | ( | ) | [protected, virtual, slot] |
void BALL::VIEW::PyWidget::reactTo | ( | const QKeyEvent & | e | ) |
void BALL::VIEW::PyWidget::removeHotkey | ( | const Hotkey & | hotkey | ) |
void BALL::VIEW::PyWidget::retrieveHistoryLine_ | ( | Position | index | ) | [protected] |
Replace the line the cursor is in with a line from the history. Used to display text from the history (cursor down/up). The previous content of the line is stored in current_line_
if this is the first time the history function is used for this specific line.
virtual bool BALL::VIEW::PyWidget::returnPressed | ( | ) | [protected, virtual, slot] |
bool BALL::VIEW::PyWidget::runCurrentScript | ( | ) | [slot] |
void BALL::VIEW::PyWidget::saveScript | ( | ) | [slot] |
virtual void BALL::VIEW::PyWidget::scriptDialog | ( | bool | run = false |
) | [virtual] |
Open a dialog to select a script.
void BALL::VIEW::PyWidget::setError_ | ( | bool | state | ) | [protected] |
void BALL::VIEW::PyWidget::showCompletion | ( | ) | [slot] |
void BALL::VIEW::PyWidget::showContextMenu | ( | const QPoint & | point | ) | [slot] |
void BALL::VIEW::PyWidget::showDocumentation | ( | ) | [slot] |
void BALL::VIEW::PyWidget::showEditContextMenu | ( | const QPoint & | point | ) | [slot] |
virtual void BALL::VIEW::PyWidget::showHelp_ | ( | ) | [protected, virtual, slot] |
virtual void BALL::VIEW::PyWidget::startInterpreter | ( | ) | [protected, virtual] |
Start the interpreter. This method initializes the interpreter if it is not yet running. An already running interpreter is reinitialized. This method calls PyInitialize()
to create an interpreter.
bool BALL::VIEW::PyWidget::storeScript_ | ( | ) | [protected] |
bool BALL::VIEW::PyWidget::toAbortScript | ( | ) |
virtual void BALL::VIEW::PyWidget::writePreferences | ( | INIFile & | inifile | ) | [virtual] |
Write settings to an INIFile
Reimplemented from BALL::VIEW::DockWidget.
friend class MyLineEdit [friend] |
String BALL::VIEW::PyWidget::class_ [protected] |
QComboBox* BALL::VIEW::PyWidget::combo_box_ [protected] |
Size BALL::VIEW::PyWidget::complete_prefix_ [protected] |
Position BALL::VIEW::PyWidget::current_line_ [protected] |
String BALL::VIEW::PyWidget::current_script_ [protected] |
QComboBox * BALL::VIEW::PyWidget::editor_combo_box_ [protected] |
bool BALL::VIEW::PyWidget::full_silent_ [protected] |
vector<String> BALL::VIEW::PyWidget::history_ [protected] |
Position BALL::VIEW::PyWidget::history_position_ [protected] |
List<Hotkey> BALL::VIEW::PyWidget::hotkeys_ [protected] |
Position BALL::VIEW::PyWidget::intend_ [protected] |
MyLineEdit* BALL::VIEW::PyWidget::line_edit_ [protected] |
String BALL::VIEW::PyWidget::member_ [protected] |
bool BALL::VIEW::PyWidget::multi_line_mode_ [protected] |
String BALL::VIEW::PyWidget::multi_line_text_ [protected] |
Size BALL::VIEW::PyWidget::multi_lines_ [protected] |
Preferences* BALL::VIEW::PyWidget::preferences_ [protected] |
PythonSettings* BALL::VIEW::PyWidget::python_settings_ [protected] |
vector<bool> BALL::VIEW::PyWidget::results_ [protected] |
bool BALL::VIEW::PyWidget::running_ [protected] |
MyTextEdit* BALL::VIEW::PyWidget::script_edit_ [protected] |
bool BALL::VIEW::PyWidget::script_mode_ [protected] |
QTextEdit * BALL::VIEW::PyWidget::script_output_ [protected] |
bool BALL::VIEW::PyWidget::silent_ [protected] |
bool BALL::VIEW::PyWidget::started_startup_script_ [protected] |
String BALL::VIEW::PyWidget::startup_script_ [protected] |
bool BALL::VIEW::PyWidget::stop_script_ [protected] |
QTabWidget* BALL::VIEW::PyWidget::tab_widget_ [protected] |
QTextEdit* BALL::VIEW::PyWidget::text_edit_ [protected] |
RunPythonThread* BALL::VIEW::PyWidget::thread_ [protected] |
bool BALL::VIEW::PyWidget::valid_ [protected] |
String BALL::VIEW::PyWidget::working_dir_ [protected] |