Krita Source Code Documentation
Loading...
Searching...
No Matches
debugaction.py
Go to the documentation of this file.
1"""
2SPDX-FileCopyrightText: 2017 Eliakin Costa <eliakim170@gmail.com>
3
4SPDX-License-Identifier: GPL-2.0-or-later
5"""
6try:
7 from PyQt6.QtGui import QKeySequence, QAction
8 from PyQt6.QtCore import Qt
9except:
10 from PyQt5.QtWidgets import QAction
11 from PyQt5.QtGui import QKeySequence
12 from PyQt5.QtCore import Qt
13from .... import utils
14from builtins import i18n
15
16class DebugAction(QAction):
17
18 def __init__(self, scripter, parent=None):
19 super(DebugAction, self).__init__(parent)
20 self.scripter = scripter
21
22 self.triggered.connect(self.debugdebug)
23
24 self.setText(i18n("Debug"))
25 self.setToolTip(i18n("Debug Ctrl+D"))
26 self.setIcon(utils.getThemedIcon(":/icons/debug.svg"))
27
28 self.setShortcut(QKeySequence(Qt.Modifier.CTRL | Qt.Key.Key_D))
29
30 @property
31 def parent(self):
32 return 'toolBar',
33
34 def debug(self):
35 if self.scripter.uicontroller.invokeAction('save'):
36 self.scripter.uicontroller.setActiveWidget(i18n('Debugger'))
37 self.scripter.debugcontroller.start(self.scripter.documentcontroller.activeDocument)
38 widget = self.scripter.uicontroller.findTabWidget(i18n('Debugger'))
39 widget.startDebugger()
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))