Differential D4715 Diff 11612 plugins/extensions/pykrita/plugin/plugins/scripter/ui_scripter/actions/saveaction/saveaction.py
Changeset View
Changeset View
Standalone View
Standalone View
plugins/extensions/pykrita/plugin/plugins/scripter/ui_scripter/actions/saveaction/saveaction.py
1 | from PyQt5.QtWidgets import QAction, QFileDialog, QMessageBox | 1 | from PyQt5.QtWidgets import QAction, QFileDialog, QMessageBox | ||
---|---|---|---|---|---|
2 | from PyQt5.QtGui import QKeySequence | ||||
3 | from PyQt5.QtCore import Qt | ||||
2 | 4 | | |||
3 | 5 | | |||
4 | class SaveAction(QAction): | 6 | class SaveAction(QAction): | ||
5 | 7 | | |||
6 | def __init__(self, scripter, parent=None): | 8 | def __init__(self, scripter, parent=None): | ||
7 | super(SaveAction, self).__init__(parent) | 9 | super(SaveAction, self).__init__(parent) | ||
8 | self.scripter = scripter | 10 | self.scripter = scripter | ||
9 | self.editor = self.scripter.uicontroller.editor | 11 | self.editor = self.scripter.uicontroller.editor | ||
10 | 12 | | |||
11 | self.triggered.connect(self.save) | 13 | self.triggered.connect(self.save) | ||
12 | 14 | | |||
13 | self.setText('Save') | 15 | self.setText('Save') | ||
14 | self.setObjectName('save') | 16 | self.setObjectName('save') | ||
17 | self.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_S)) | ||||
15 | 18 | | |||
16 | @property | 19 | @property | ||
17 | def parent(self): | 20 | def parent(self): | ||
18 | return 'File' | 21 | return 'File' | ||
19 | 22 | | |||
20 | def save(self): | 23 | def save(self): | ||
21 | text = self.editor.toPlainText() | 24 | text = self.editor.toPlainText() | ||
22 | fileName = '' | 25 | fileName = '' | ||
Show All 25 Lines |