Differential D4715 Diff 11612 plugins/extensions/pykrita/plugin/plugins/scripter/ui_scripter/actions/runaction/runaction.py
Changeset View
Changeset View
Standalone View
Standalone View
plugins/extensions/pykrita/plugin/plugins/scripter/ui_scripter/actions/runaction/runaction.py
1 | from PyQt5.QtWidgets import QAction, QMessageBox | 1 | from PyQt5.QtWidgets import QAction, QMessageBox | ||
---|---|---|---|---|---|
2 | from PyQt5.QtGui import QIcon | 2 | from PyQt5.QtGui import QIcon, QKeySequence | ||
3 | from PyQt5.QtCore import Qt | ||||
3 | import sys | 4 | import sys | ||
4 | from . import docwrapper | 5 | from . import docwrapper | ||
5 | import os | 6 | import os | ||
6 | from scripter import resources_rc | 7 | from scripter import resources_rc | ||
7 | 8 | | |||
8 | 9 | | |||
9 | class RunAction(QAction): | 10 | class RunAction(QAction): | ||
10 | 11 | | |||
11 | def __init__(self, scripter, parent=None): | 12 | def __init__(self, scripter, parent=None): | ||
12 | super(RunAction, self).__init__(parent) | 13 | super(RunAction, self).__init__(parent) | ||
13 | self.scripter = scripter | 14 | self.scripter = scripter | ||
14 | 15 | | |||
15 | self.editor = self.scripter.uicontroller.editor | 16 | self.editor = self.scripter.uicontroller.editor | ||
16 | self.output = self.scripter.uicontroller.findStackWidget('OutPut') | 17 | self.output = self.scripter.uicontroller.findStackWidget('OutPut') | ||
17 | 18 | | |||
18 | self.triggered.connect(self.run) | 19 | self.triggered.connect(self.run) | ||
19 | 20 | | |||
20 | self.setText('Run') | 21 | self.setText('Run') | ||
22 | self.setToolTip('Run Ctrl+R') | ||||
21 | self.setIcon(QIcon(':/icons/run.svg')) | 23 | self.setIcon(QIcon(':/icons/run.svg')) | ||
24 | self.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_R)) | ||||
22 | 25 | | |||
23 | @property | 26 | @property | ||
24 | def parent(self): | 27 | def parent(self): | ||
25 | return 'toolBar' | 28 | return 'toolBar' | ||
26 | 29 | | |||
27 | def run(self): | 30 | def run(self): | ||
28 | stdout = sys.stdout | 31 | stdout = sys.stdout | ||
29 | stderr = sys.stderr | 32 | stderr = sys.stderr | ||
Show All 11 Lines |