itom
Loading...
Searching...
No Matches
ito::ScriptDockWidget Class Reference

widget containing one or multiple script editors (tabbed). This widget can either be a docking widget, docked in a docking area in the main window or it can be a floatable window which has a standard window behaviour. More...

Inheritance diagram for ito::ScriptDockWidget:
ito::AbstractDockWidget

Public Slots

void editorMarginChanged ()
 
void updateCodeNavigation (ScriptEditorWidget *editor, QSharedPointer< OutlineItem > rootItem)
 
void tabChangedRequest ()
 
void mnuFindSymbolsShow ()
 
- Public Slots inherited from ito::AbstractDockWidget
void setEnabled (bool)
 
virtual void setVisible (bool visible)
 
virtual void pythonStateChanged (tPythonTransitions pyTransition)
 slot invoked if python state changed. Sets the specific member variables according to the python transition.
 
void raiseAndActivate ()
 activates this dock widget or window and raises it on top of all opened windows
 
void mini ()
 
void setDockSize (int newWidth, int newHeight)
 
void dockWidget ()
 docks this dockWidget.
 
void undockWidget (bool show_it=true)
 undocks this dockWidget.
 
RetVal setAdvancedWindowTitle (QString newCompleteTitle=QString(), bool appendToBasicTitle=true)
 changes the title of widget
 

Signals

void removeAndDeleteScriptDockWidget (ScriptDockWidget *widget)
 
void openScriptRequest (const QString &filename, ScriptDockWidget *scriptDockWidget)
 
void dockScriptTab (ScriptDockWidget *widget, int index, bool closeDockIfEmpty=false)
 
void undockScriptTab (ScriptDockWidget *widget, int index, bool undockToNewScriptWindow=false, bool closeDockIfEmpty=false)
 
void pythonRunFileRequest (QString filename)
 
void pythonDebugFileRequest (QString filename)
 
void pythonInterruptExecution ()
 
void pythonDebugCommand (tPythonDbgCmd cmd)
 
void pythonRunSelection (QString selectionText)
 
void addGoBackNavigationItem (const GoBackNavigationItem &item)
 
void statusBarInformationChanged (const QPointer< ScriptDockWidget > sourceDockWidget, const QString &encoding, int line, int column)
 
- Signals inherited from ito::AbstractDockWidget
void dockStateChanged (bool docked)
 emitted if the widget is either docked or undocked from the main window
 

Public Member Functions

 ScriptDockWidget (const QString &title, const QString &objName, bool docked, bool isDockAvailable, const ScriptEditorActions &commonActions, BookmarkModel *bookmarkModel, QWidget *parent=0, Qt::WindowFlags flags=Qt::WindowFlags())
 constructor
 
 ~ScriptDockWidget ()
 destructor
 
QStringList getModifiedFilenames (bool ignoreNewScripts=false, int excludeIndex=-1) const
 returns a list of filenames, which have been modified in this ScriptDockWidget
 
QStringList getAllFilenames () const
 returns a list of all filenames of all opened scripts (besides new scripts)
 
void getAllCanonicalFilenamesWithModificationState (QStringList &filenames, QList< bool > &modified) const
 
RetVal newScript ()
 creates new instance of ScriptEditorWidget and appends it to the tab-widget
 
RetVal openScript ()
 method to open an existing script which can be indicated by the user by a getOpenFileName-dialog.
 
RetVal openScript (QString filename, bool silent=false)
 opens a given filename as new tab in this ScriptDockWidget
 
RetVal saveAllScripts (bool askFirst=true, bool ignoreNewScripts=false, int excludeIndex=-1)
 tries to save all opened scripts in this ScriptDockWidget
 
RetVal closeAllScripts (bool saveFirst=true, bool askFirst=true, bool ignoreNewScripts=false, int excludeIndex=-1, bool closeScriptWidgetIfLastTabClosed=true)
 closes all opened scripts in this ScriptDockWidget
 
bool isTabIndexValid (int tabIndex) const
 
int getTabCount () const
 
int getCurrentIndex () const
 
void setCurrentIndex (int index)
 
bool containsNewScripts () const
 checks whether any editor in this ScriptDockWidget has no filename
 
RetVal appendEditor (ScriptEditorWidget *editorWidget)
 append given ScriptEditorWidget as new tab
 
ScriptEditorWidgetremoveEditor (int index)
 removes ScriptEditorWidget at given tab position from tab-widget and returns its reference
 
ScriptEditorWidgetgetCurrentEditor () const
 returns reference to current ScriptEditorWidget
 
bool activateTabByFilename (const QString &filename, int currentDebugLine=-1, int UID=-1)
 activates tab with script whose filename corresponds to the filename parameter (or the UID, if >= 0 for scripts without current filename).
 
bool activeTabEnsureLineVisible (const int lineNr, bool errorMessageClick=false, bool showSelectedCallstackLine=false)
 
void activeTabShowLineAndHighlightWord (const int line, const QString &highlightedText, Qt::CaseSensitivity caseSensitivity=Qt::CaseInsensitive)
 
const QTabWidget * tabWidget () const
 
QList< ito::ScriptEditorStoragesaveScriptState () const
 
RetVal restoreScriptState (const QList< ito::ScriptEditorStorage > &states)
 return all outlines in the tabs of this script dock widget
 
QList< OutlineSelectorWidget::EditorOutlinegetAllOutlines (int &activeIndex) const
 
ScriptEditorWidgetgetEditorByCanonicalFilepath (const QString &filepath) const
 
- Public Member Functions inherited from ito::AbstractDockWidget
 AbstractDockWidget (bool docked, bool isDockAvailable, tFloatingStyle floatingStyle, tMovingStyle movingStyle, const QString &title=QString(), const QString &objName=QString(), QWidget *parent=0)
 constructor
 
virtual ~AbstractDockWidget ()
 destructor
 
bool docked () const
 
RetVal setTopLevel (tTopLevelStyle topLevel, bool showWindow=true)
 
void setParent (QWidget *parent)
 
QWidget * getActiveInstance ()
 
QRect frameGeometry () const
 
const QRect & geometry () const
 
QRect normalGeometry () const
 
int x () const
 
int y () const
 
QPoint pos () const
 
QSize frameSize () const
 
QSize size () const
 
int width () const
 
int height () const
 
QRect rect () const
 
QRect childrenRect () const
 
QRegion childrenRegion () const
 
void move (int x, int y)
 
void move (const QPoint &)
 
void resize (int w, int h)
 
void resize (const QSize &)
 
void setGeometry (int x, int y, int w, int h)
 
void setGeometry (const QRect &)
 
void setMinimumSize (const QSize &size)
 
QString windowTitle ()
 
void setWindowTitle (const QString &title)
 
bool isEnabled () const
 
bool isVisible () const
 
void saveState (const QString &iniName) const
 
void restoreState (const QString &iniName)
 
void synchronizeTopLevelState ()
 synchronizes the top level state of the dock widget with the floating settings of this abstract dock widget
 
virtual QSize sizeHint () const
 
virtual QSize minimumSizeHint () const
 

Protected Member Functions

ScriptEditorWidgetgetEditorByIndex (int index) const
 returns ScriptEditorWidget by given tab-index
 
int getIndexByEditor (const ScriptEditorWidget *sew) const
 returns tab-index by given reference to ScriptEditorWidget
 
void tabFilenameOrModificationChanged (int index)
 
void createActions ()
 creates actions
 
void createMenus ()
 create menus
 
void createToolBars ()
 create toolbars
 
void createStatusBar ()
 init status bar
 
void closeEvent (QCloseEvent *event)
 this method is invoked if this ScriptDockWidget should be closed.
 
virtual void windowStateChanged (bool windowNotToolbox)
 
RetVal closeTab (int index, bool saveFirst=true, bool closeScriptWidgetIfLastTabClosed=true)
 public method to close any specific tab with or without saving its script first
 
RetVal saveTab (int index, bool forceSaveAs=false, bool askFirst=true)
 saves tab
 
- Protected Member Functions inherited from ito::AbstractDockWidget
bool eventFilter (QObject *obj, QEvent *event)
 eventFilter for m_pWindow
 
void init ()
 init method, called by constructor
 
virtual void updateActions ()
 
virtual void updatePythonActions ()=0
 
Qt::WindowFlags modifyFlags (const Qt::WindowFlags &flags, const Qt::WindowFlags &setFlags, const Qt::WindowFlags &unsetFlags)
 
void setContentWidget (QWidget *widget)
 sets any given QWidget as central widget of QMainWindow and inversely sets this QWidget's parent to the instance of QMainWindget
 
QWidget * getContentWidget () const
 
QMainWindow * getCanvas ()
 
bool pythonBusy () const
 
bool pythonDebugMode () const
 
bool pythonInWaitingMode () const
 
QToolBar * getToolBar (QString key) const
 returns reference to toolbar with given key-value
 
QMenuBar * getMenuBar () const
 
RetVal addToolBar (QToolBar *tb, const QString &key, Qt::ToolBarArea area=Qt::TopToolBarArea, int section=1)
 
RetVal removeToolBar (const QString &key)
 

Private Slots

void tabContextMenuEvent (QContextMenuEvent *event)
 method is invoked, if a context menu is requested
 
void findTextExpr (QString expr, bool regExpr, bool caseSensitive, bool wholeWord, bool wrap, bool forward, bool isQuickSeach)
 
void replaceTextExpr (QString expr, QString replace)
 
void replaceAllExpr (QString expr, QString replace, bool regExpr, bool caseSensitive, bool wholeWord, bool findInSel)
 
void insertIconBrowserText (QString iconLink)
 
void currentTabChanged (int index)
 slot invoked by tab-widget if current tab changed
 
void tabCloseRequested (int index)
 slot invoked if close button of any tab of m_tab (QTabWidgetItom) has been pressed
 
void tabCloseRequested (ScriptEditorWidget *sew, bool ignoreModifications)
 
void scriptModificationChanged (bool changed)
 slot connected to each ScriptEditorWidget instance. Invoked if any content in any script changed.
 
void updateEditorActions ()
 updates actions which deal with editor commands but are not dependent on the state of python.
 
void updatePythonActions ()
 
void updateTabContextActions ()
 updates actions before context menu of tabs is shown
 
void mnuOpenIconBrowser ()
 Open the icon browser.
 
void mnuTabMoveLeft ()
 moves active tab by one position to the left
 
void mnuTabMoveRight ()
 moves active tab by one position to the right
 
void mnuTabMoveFirst ()
 moves active tab to the first position
 
void mnuTabMoveLast ()
 moves active tab to the last position
 
void mnuTabClose ()
 closes active tab
 
void mnuTabCloseOthers ()
 closes every tab besides active one (asks for saving tabs, which should be closed)
 
void mnuTabCloseAll ()
 closes every tab, asks for saving first
 
void mnuTabDock ()
 dock the active tab and closes this ScriptDockWidget, if it is not docked and empty after docking
 
void mnuTabUndock ()
 undock the active tab and closes this ScriptDockWidget, if it is not docked and empty after docking
 
void mnuNewScript ()
 slot invoked by action to open a new script
 
void mnuOpenScript ()
 slot invoked by action to open an existing script
 
void mnuSaveScript ()
 slot invoked by action to save active script
 
void mnuSaveScriptAs ()
 slot invoked by action to save active script with new filename (save as)
 
void mnuSaveAllScripts ()
 slot invoked by action to save all opened scripts
 
void mnuPrint ()
 
void mnuCut ()
 slot invoked to execute a cut command in active script editor
 
void mnuCopy ()
 slot invoked to execute a copy command in active script editor
 
void mnuPaste ()
 slot invoked to execute a paste command in active script editor
 
void mnuUndo ()
 slot invoked to execute an undo command in active script editor
 
void mnuRedo ()
 slot invoked to execute a redo command in active script editor
 
void mnuComment ()
 slot invoked to execute a comment command in active script editor
 
void mnuUncomment ()
 slot invoked to execute an uncomment command in active script editor
 
void mnuIndent ()
 slot invoked to execute an indentation command in active script editor
 
void mnuUnindent ()
 slot invoked to execute an unindentation command in active script editor
 
void mnuScriptRun ()
 slot invoked to run the active script in python engine
 
void mnuScriptRunSelection ()
 
void mnuScriptDebug ()
 slot invoked to debug the active script in python engine
 
void mnuScriptStop ()
 slot invoked to stop python script execution
 
void mnuScriptContinue ()
 slot invoked to continue debugging process if actually waiting at breakpoint
 
void mnuScriptStep ()
 slot invoked to execute a python debugging step
 
void mnuScriptStepOver ()
 slot invoked to execute a python debugging step over
 
void mnuScriptStepOut ()
 slot invoked to execute a python debugging step out
 
void mnuFindTextExpr ()
 
void mnuReplaceTextExpr ()
 
void mnuGoto ()
 
void mnuToggleBookmark ()
 
void mnuInsertCodec ()
 
void mnuCopyFilename ()
 slot invoked by action to copy the filename to clipboard
 
void mnuPyCodeFormatting ()
 
void mnuPyReferenceRenaming ()
 
void mnuPyDocstringGenerator ()
 
void menuLastFilesAboutToShow ()
 
void lastFileOpen (const QString &path)
 
void navigatorClassSelected (int row)
 
void navigatorMethodSelected (int row)
 
void loadSettings ()
 
void findWordWidgetFinished ()
 
void currentScriptCursorPositionChanged ()
 

Private Member Functions

void fillNavigationClassComboBox (const QSharedPointer< OutlineItem > &parent, const QString &prefix)
 
void fillNavigationMethodComboBox (const QSharedPointer< OutlineItem > &parent, const QString &prefix)
 
void showOutlineNavigationBar (bool show)
 < displays or hides the entire outline navigation bar (class and method combo box)
 

Private Attributes

QWidget * m_pCenterWidget
 
QVBoxLayout * m_pVBox
 
QTabWidgetItomm_tab
 
WidgetFindWordm_pWidgetFindWord
 
DialogReplacem_pDialogReplace
 
BookmarkModelm_pBookmarkModel
 
QLabel * m_pStatusBarWidget
 
int m_actTabIndex
 indices of the tabs. The most recently activated tab index is at the front.
 
QList< int > m_stackHistory
 
QSharedPointer< TabSwitcherWidgetm_tabSwitcherWidget
 
QSharedPointer< OutlineSelectorWidgetm_outlineSelectorWidget
 
ShortcutActionm_tabMoveLeftAction
 
ShortcutActionm_tabMoveRightAction
 
ShortcutActionm_tabMoveFirstAction
 
ShortcutActionm_tabMoveLastAction
 
ShortcutActionm_tabCloseAction
 
ShortcutActionm_tabCloseOthersAction
 
ShortcutActionm_tabCloseAllAction
 
ShortcutActionm_tabDockAction
 
ShortcutActionm_tabUndockAction
 
ShortcutActionm_newScriptAction
 
ShortcutActionm_openScriptAction
 
ShortcutActionm_saveScriptAction
 
ShortcutActionm_saveScriptAsAction
 
ShortcutActionm_saveAllScriptsAction
 
ShortcutActionm_printAction
 
ShortcutActionm_cutAction
 
ShortcutActionm_copyAction
 
ShortcutActionm_pasteAction
 
ShortcutActionm_undoAction
 
ShortcutActionm_redoAction
 
ShortcutActionm_commentAction
 
ShortcutActionm_uncommentAction
 
ShortcutActionm_indentAction
 
ShortcutActionm_unindentAction
 
ShortcutActionm_autoCodeFormatAction
 
ShortcutActionm_referenceRenameAction
 
ShortcutActionm_pyDocstringGeneratorAction
 
ShortcutActionm_scriptRunAction
 
ShortcutActionm_scriptRunSelectionAction
 
ShortcutActionm_scriptDebugAction
 
ShortcutActionm_scriptStopAction
 
ShortcutActionm_scriptContinueAction
 
ShortcutActionm_scriptStepAction
 
ShortcutActionm_scriptStepOverAction
 
ShortcutActionm_scriptStepOutAction
 
ShortcutActionm_findTextExprAction
 
ShortcutActionm_findTextExprActionSC
 
ShortcutActionm_replaceTextExprAction
 
ShortcutActionm_gotoAction
 
ShortcutActionm_openIconBrowser
 
ShortcutActionm_bookmarkToggle
 
ShortcutActionm_insertCodecAct
 
ShortcutActionm_copyFilename
 
ShortcutActionm_findSymbols
 
ScriptEditorActions m_commonActions
 
QMenu * m_tabContextMenu
 
QMenu * m_fileMenu
 
QMenu * m_lastFilesMenu
 
QMenu * m_editMenu
 
QMenu * m_scriptMenu
 
QMenu * m_winMenu
 
QMenu * m_bookmark
 
QToolBar * m_fileToolBar
 
QToolBar * m_editToolBar
 
QToolBar * m_scriptToolBar
 
QToolBar * m_bookmarkToolBar
 
QString m_autoCodeFormatCmd
 
QWidget * m_classMenuBar
 
QComboBox * m_classBox
 
QComboBox * m_methodBox
 
bool m_outlineShowNavigation
 

Static Private Attributes

static const char * statusBarStatePropertyName = "_statusBarState"
 
static QPointer< ScriptEditorWidgetcurrentSelectedCallstackLineEditor = QPointer<ScriptEditorWidget>()
 

Additional Inherited Members

- Public Types inherited from ito::AbstractDockWidget
enum  tFloatingStyle { floatingNone , floatingStandard , floatingWindow }
 The floating style of a widget, derived from AbstractDockWidget. More...
 
enum  tMovingStyle { movingDisabled , movingEnabled }
 The configuration if a docked AbstractDockWidget can be moved from one docking area to another one. More...
 
enum  tTopLevelStyle { topLevelOverall , topLevelParentOnly , topLevelNothing }
 The top level style of a widget, derived from AbstractDockWidget. More...
 
- Protected Attributes inherited from ito::AbstractDockWidget
QAction * m_actStayOnTop
 
QAction * m_actStayOnTopOfApp
 
- Properties inherited from ito::AbstractDockWidget
bool visible
 
bool enabled
 
QRect geometry
 
QRect frameGeometry
 
QRect normalGeometry
 
int x
 
int y
 
QPoint pos
 
QSize frameSize
 
QSize size
 
int width
 
int height
 
QRect rect
 
QRect childrenRect
 
QRegion childrenRegion
 
QString windowTitle
 

Detailed Description

widget containing one or multiple script editors (tabbed). This widget can either be a docking widget, docked in a docking area in the main window or it can be a floatable window which has a standard window behaviour.

Todo
right now, the floatable window does not have an single icon in the windows taskbar and is always on top of the main window. This behavior can be changed e.g. by defining an own titleWidget of the dockWidget.

Constructor & Destructor Documentation

◆ ScriptDockWidget()

ito::ScriptDockWidget::ScriptDockWidget ( const QString & title,
const QString & objName,
bool docked,
bool isDockAvailable,
const ScriptEditorActions & commonActions,
BookmarkModel * bookmarkModel,
QWidget * parent = 0,
Qt::WindowFlags flags = Qt::WindowFlags() )

constructor

creates a tab widget (QTabWidgetItom), which contains multiple instances of ScriptEditorWidget. Creates actions, menus, toolbars and sets some other settings.

Parameters
titleTitle of the DockWidget
dockedtrue: this widget should be docked at creating time, else: false
isDockAvailableindicates whether docking functionality is available, if not, docked is always set to false
commonActionsis a collection of common actions, managed and created by the ScriptEditorOrganizer. These actions can be used in the dock widget or its child editors.
See also
AbstractDockWidget::AbstractDockWidget

< tab-settings

◆ ~ScriptDockWidget()

ito::ScriptDockWidget::~ScriptDockWidget ( )

destructor

cancels connections and closes every tab.

Member Function Documentation

◆ activateTabByFilename()

bool ito::ScriptDockWidget::activateTabByFilename ( const QString & filename,
int currentDebugLine = -1,
int UID = -1 )

activates tab with script whose filename corresponds to the filename parameter (or the UID, if >= 0 for scripts without current filename).

Parameters
filenameFilename of the script which should be activated
lineis the marked debugging line (default: -1, no arrow)
UIDif >= 0 and if a script has no filename, its UID is compared to the given one
Returns
true if filename has been found and activated, else false.

◆ appendEditor()

RetVal ito::ScriptDockWidget::appendEditor ( ScriptEditorWidget * editorWidget)

append given ScriptEditorWidget as new tab

appends widget, without creating it (for drag&drop, (un)-docking...)

Parameters
editorWidgetScriptEditorWidget to append
Returns
retOk

< activate appended tab

◆ closeAllScripts()

RetVal ito::ScriptDockWidget::closeAllScripts ( bool saveFirst = true,
bool askFirst = true,
bool ignoreNewScripts = false,
int excludeIndex = -1,
bool closeScriptWidgetIfLastTabClosed = true )

closes all opened scripts in this ScriptDockWidget

if indicated, scripts will be saved first. Methods returns if saving process fails, else scripts will be closed.

Parameters
saveFirstif true, unsaved scripts are tried to be saved first
askFirstif true, user will be asked about script saving
ignoreNewScriptsif true, new scripts which do not have any filename are not considered in the saving method
excludeIndextab with given index will not be considered in saving method, default: -1 (consider all scripts)
Returns
retOk if every script could be closed, else retError
See also
saveAllScripts

◆ closeEvent()

void ito::ScriptDockWidget::closeEvent ( QCloseEvent * event)
protectedvirtual

this method is invoked if this ScriptDockWidget should be closed.

First, tries to save every script. If this process is successfully executed, the close event is accepted in order to close this instance, else the event is ignored. If event is accepted, the signal removeAndDeleteScriptDockWidget is emitted, such that the ScriptEditorOrganizer can manage the deletion of this instance.

Parameters
eventEvent of type QCloseEvent
See also
removeAndDeleteScriptDockWidget

Reimplemented from ito::AbstractDockWidget.

◆ closeTab()

RetVal ito::ScriptDockWidget::closeTab ( int index,
bool saveFirst = true,
bool closeScriptWidgetIfLastTabClosed = true )
protected

public method to close any specific tab with or without saving its script first

Parameters
indextab-index of tab in question
saveFirstsave changes in editor first (true) or ignore changes (false)
Returns
retOk if tab has been saved (or not) and closed, retError if saving failed
See also
saveTab, removeEditor

◆ containsNewScripts()

bool ito::ScriptDockWidget::containsNewScripts ( ) const

checks whether any editor in this ScriptDockWidget has no filename

Returns
true if any script has no filename, else false < new means unsaved (without filename)

◆ createActions()

void ito::ScriptDockWidget::createActions ( )
protectedvirtual

creates actions

Implements ito::AbstractDockWidget.

◆ createMenus()

void ito::ScriptDockWidget::createMenus ( )
protectedvirtual

create menus

Implements ito::AbstractDockWidget.

◆ createStatusBar()

void ito::ScriptDockWidget::createStatusBar ( )
protectedvirtual

init status bar

Todo
right now, this is an empty method

Implements ito::AbstractDockWidget.

◆ createToolBars()

void ito::ScriptDockWidget::createToolBars ( )
protectedvirtual

create toolbars

Implements ito::AbstractDockWidget.

◆ currentTabChanged

void ito::ScriptDockWidget::currentTabChanged ( int index)
privateslot

slot invoked by tab-widget if current tab changed

modifies title of this ScriptDockWidget instance, depending on the active tab.

Gives the focus to the new tab.

Parameters
indextab-index of changed editor

◆ dockScriptTab

void ito::ScriptDockWidget::dockScriptTab ( ScriptDockWidget * widget,
int index,
bool closeDockIfEmpty = false )
signal

signal emitted if tab with given index of given ScriptDockWidget should be docked in a docked ScriptDockWidget

◆ getAllFilenames()

QStringList ito::ScriptDockWidget::getAllFilenames ( ) const

returns a list of all filenames of all opened scripts (besides new scripts)

Returns
string list

◆ getCurrentEditor()

ScriptEditorWidget * ito::ScriptDockWidget::getCurrentEditor ( ) const

returns reference to current ScriptEditorWidget

Returns
reference to current ScriptEditorWidget or nullptr

◆ getEditorByIndex()

ScriptEditorWidget * ito::ScriptDockWidget::getEditorByIndex ( int index) const
protected

returns ScriptEditorWidget by given tab-index

long description

Parameters
indextab-index
Returns
reference to ScriptEditorWidget or NULL, if index has been out of boundaries

◆ getIndexByEditor()

int ito::ScriptDockWidget::getIndexByEditor ( const ScriptEditorWidget * sew) const
protected

returns tab-index by given reference to ScriptEditorWidget

Parameters
sewreference to ScriptEditorWidget
Returns
tab-index of given ScriptEditorWidget or -1 if this widget could not be found

◆ getModifiedFilenames()

QStringList ito::ScriptDockWidget::getModifiedFilenames ( bool ignoreUnsavedFiles = false,
int excludeIndex = -1 ) const

returns a list of filenames, which have been modified in this ScriptDockWidget

long description

Parameters
ignoreUnsavedFilesif true, ignores scripts, which do not have any filename yet
exludeIndextab-index which should be ignored, set to -1 in order to consider every tab
Returns
string list

◆ getTabCount()

int ito::ScriptDockWidget::getTabCount ( ) const
inline

returns number of tabs

◆ isTabIndexValid()

bool ito::ScriptDockWidget::isTabIndexValid ( int tabIndex) const
inline

checks whether given tab-index is valid (true) or not (false)

◆ newScript()

RetVal ito::ScriptDockWidget::newScript ( )

creates new instance of ScriptEditorWidget and appends it to the tab-widget

Returns
result of method appendEditor
See also
appendEditor

◆ openScript() [1/2]

RetVal ito::ScriptDockWidget::openScript ( )

method to open an existing script which can be indicated by the user by a getOpenFileName-dialog.

the script is not directly opened by this method, but the signal openScriptRequest is emitted which invokes a slot in the scriptEditorOrganizer. Then the organizer can check, if that filename is already opened in another tab and activate it instead of opening a new editor.

Returns
retOk, if filename has been chosen, else retError (also in case of user cancellation)
See also
(see also) keywords (comma-separated)

◆ openScript() [2/2]

RetVal ito::ScriptDockWidget::openScript ( QString filename,
bool silent = false )

opens a given filename as new tab in this ScriptDockWidget

Opens new ScriptEditorWidget, appends it to the tab widget and opens filename in the newly created instance.

Parameters
silentif true, no warning about invalid filename or invalid file format is shown
Returns
retOk if file has been opened, else retError

◆ openScriptRequest

void ito::ScriptDockWidget::openScriptRequest ( const QString & filename,
ScriptDockWidget * scriptDockWidget )
signal

signal emitted if script with given filename should be opened in scriptDockWidget

◆ pythonDebugCommand

void ito::ScriptDockWidget::pythonDebugCommand ( tPythonDbgCmd cmd)
signal

will be received by PythonThread, directly

◆ pythonDebugFileRequest

void ito::ScriptDockWidget::pythonDebugFileRequest ( QString filename)
signal

will be received by scriptEditorOrganizer, in order to save all unsaved changes first

◆ pythonInterruptExecution

void ito::ScriptDockWidget::pythonInterruptExecution ( )
signal

will be received by PythonThread, directly

◆ pythonRunFileRequest

void ito::ScriptDockWidget::pythonRunFileRequest ( QString filename)
signal

will be received by scriptEditorOrganizer, in order to save all unsaved changes first

◆ pythonRunSelection

void ito::ScriptDockWidget::pythonRunSelection ( QString selectionText)
signal

will be received by consoleWidget, directly

◆ removeAndDeleteScriptDockWidget

void ito::ScriptDockWidget::removeAndDeleteScriptDockWidget ( ScriptDockWidget * widget)
signal

signal emitted if given ScriptDockWidget should be closed and removed by ScriptEditorOrganizer

◆ removeEditor()

ScriptEditorWidget * ito::ScriptDockWidget::removeEditor ( int index)

removes ScriptEditorWidget at given tab position from tab-widget and returns its reference

removes widget, without deleting it (for drag&drop, (un)-docking...)

Parameters
indextab index of editor, which should be removed
Returns
instance to recently removed ScriptEditorWidget, NULL if index exceeds limits

◆ saveAllScripts()

RetVal ito::ScriptDockWidget::saveAllScripts ( bool askFirst = true,
bool ignoreNewScripts = false,
int excludeIndex = -1 )

tries to save all opened scripts in this ScriptDockWidget

First, all unsaved and modified scripts are identified and listed. Then the user is asked for confirmation of saving these modified documents. Then these scripts will be saved, if desired.

Parameters
askFirstif true, the user is asked for confirmation, else all scripts are silently saved
ignoreNewScriptsif true do not consider new scripts, which does not have any filename yet
excludeIndexignore tab with this index, set it to -1 in order to consider every tab (default: -1)
Returns
retOk if all identified scripts could be saved or have been discarded, else retError (in order to cancel the execution)

◆ saveTab()

RetVal ito::ScriptDockWidget::saveTab ( int index,
bool forceSaveAs = false,
bool askFirst = true )
protected

saves tab

Parameters
indextab-index of tab in question
forceSaveAstrue if script should be saved with new filename, else false
askFirsttrue if user must confirm that script will be saved
Returns
retOk if script in tab could be successfully saved, else retError

◆ scriptModificationChanged

void ito::ScriptDockWidget::scriptModificationChanged ( bool changed)
privateslot

slot connected to each ScriptEditorWidget instance. Invoked if any content in any script changed.

calls slot currentTabChanged with tab index of scriptEditorWidget that sent the signal or the active tab index if no sender is available.

See also
currentTabChanged

◆ tabCloseRequested

void ito::ScriptDockWidget::tabCloseRequested ( int index)
privateslot

slot invoked if close button of any tab of m_tab (QTabWidgetItom) has been pressed

tries to close the tab in question

Parameters
indextab-index of tab in question

◆ tabContextMenuEvent

void ito::ScriptDockWidget::tabContextMenuEvent ( QContextMenuEvent * event)
privateslot

method is invoked, if a context menu is requested

checks if mouse click directly has been located at any tab and if yes actualizes the member m_actTabIndex.

◆ undockScriptTab

void ito::ScriptDockWidget::undockScriptTab ( ScriptDockWidget * widget,
int index,
bool undockToNewScriptWindow = false,
bool closeDockIfEmpty = false )
signal

signal emitted if tab with given index of given ScriptDockWidget should be undocked in an undocked ScriptDockWidget

◆ updatePythonActions

void ito::ScriptDockWidget::updatePythonActions ( )
privateslot

updates actions which deal with python commands or which are dependent on the python state Read-only is also python-dependent.

◆ windowStateChanged()

void ito::ScriptDockWidget::windowStateChanged ( bool windowNotToolbox)
protectedvirtual

Reimplemented from ito::AbstractDockWidget.

Member Data Documentation

◆ m_actTabIndex

int ito::ScriptDockWidget::m_actTabIndex
private

indices of the tabs. The most recently activated tab index is at the front.

member indicating the tab-index of the active script editor

◆ m_pStatusBarWidget

QLabel* ito::ScriptDockWidget::m_pStatusBarWidget
private

borrowed reference to the bookmark model. This model is owned by the script editor organizer.

◆ m_tab

QTabWidgetItom* ito::ScriptDockWidget::m_tab
private

reference to QTabWidgetItom instance


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