Differential D4715 Diff 11612 plugins/extensions/pykrita/plugin/plugins/scripter/ui_scripter/actions/openaction/openaction.py
Changeset View
Changeset View
Standalone View
Standalone View
plugins/extensions/pykrita/plugin/plugins/scripter/ui_scripter/actions/openaction/openaction.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 OpenAction(QAction): | 6 | class OpenAction(QAction): | ||
5 | 7 | | |||
6 | def __init__(self, scripter, parent=None): | 8 | def __init__(self, scripter, parent=None): | ||
7 | super(OpenAction, self).__init__(parent) | 9 | super(OpenAction, self).__init__(parent) | ||
8 | self.scripter = scripter | 10 | self.scripter = scripter | ||
9 | 11 | | |||
10 | self.triggered.connect(self.open) | 12 | self.triggered.connect(self.open) | ||
11 | 13 | | |||
12 | self.setText('Open') | 14 | self.setText('Open') | ||
13 | self.setObjectName('open') | 15 | self.setObjectName('open') | ||
16 | self.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_O)) | ||||
14 | 17 | | |||
15 | @property | 18 | @property | ||
16 | def parent(self): | 19 | def parent(self): | ||
17 | return 'File' | 20 | return 'File' | ||
18 | 21 | | |||
19 | def open(self): | 22 | def open(self): | ||
20 | dialog = QFileDialog(self.scripter.uicontroller.mainWidget) | 23 | dialog = QFileDialog(self.scripter.uicontroller.mainWidget) | ||
21 | dialog.setNameFilter('Python files (*.py)') | 24 | dialog.setNameFilter('Python files (*.py)') | ||
Show All 14 Lines |