Changeset View
Changeset View
Standalone View
Standalone View
src/scripts/runaction/settingsdialog.py
Show All 9 Lines | |||||
10 | # This program is distributed in the hope that it will be useful, | 10 | # This program is distributed in the hope that it will be useful, | ||
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | # GNU General Public License for more details. | 13 | # GNU General Public License for more details. | ||
14 | # | 14 | # | ||
15 | # You should have received a copy of the GNU General Public License | 15 | # You should have received a copy of the GNU General Public License | ||
16 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | # ============================================================ | 17 | # ============================================================ | ||
18 | import Falkon | | |||
19 | import os | 18 | import os | ||
20 | from PySide2 import QtCore, QtGui, QtWidgets, QtUiTools | 19 | from PySide2 import QtCore, QtWidgets, QtUiTools | ||
21 | from runaction.i18n import i18n | 20 | from runaction.i18n import i18n | ||
22 | 21 | | |||
22 | | ||||
23 | class SettingsDialog(QtWidgets.QDialog): | 23 | class SettingsDialog(QtWidgets.QDialog): | ||
24 | def __init__(self, manager, parent=None): | 24 | def __init__(self, manager, parent=None): | ||
25 | super().__init__(parent) | 25 | super().__init__(parent) | ||
26 | 26 | | |||
27 | self.manager = manager | 27 | self.manager = manager | ||
28 | 28 | | |||
29 | file = QtCore.QFile(os.path.join(os.path.dirname(__file__), "settings.ui")) | 29 | file = QtCore.QFile(os.path.join(os.path.dirname(__file__), "settings.ui")) | ||
30 | file.open(QtCore.QFile.ReadOnly) | 30 | file.open(QtCore.QFile.ReadOnly) | ||
31 | self.ui = QtUiTools.QUiLoader().load(file, self) | 31 | self.ui = QtUiTools.QUiLoader().load(file, self) | ||
32 | file.close() | 32 | file.close() | ||
33 | 33 | | |||
34 | layout = QtWidgets.QVBoxLayout(self) | 34 | layout = QtWidgets.QVBoxLayout(self) | ||
35 | layout.addWidget(self.ui) | 35 | layout.addWidget(self.ui) | ||
36 | 36 | | |||
37 | self.setMinimumSize(400, 250) | 37 | self.setMinimumSize(400, 250) | ||
38 | self.setWindowTitle(i18n("Run Action Settings")) | 38 | self.setWindowTitle(i18n("Run Action Settings")) | ||
39 | self.ui.label.setText("<b>{}</b>".format(i18n("Available actions"))) | 39 | self.ui.label.setText(i18n("Available actions")) | ||
40 | 40 | | |||
41 | for action in self.manager.actions: | 41 | for action in self.manager.actions: | ||
42 | item = QtWidgets.QListWidgetItem(self.ui.listWidget) | 42 | item = QtWidgets.QListWidgetItem(self.ui.listWidget) | ||
43 | item.setText(action.title) | 43 | item.setText(action.title) | ||
44 | item.setIcon(action.icon) | 44 | item.setIcon(action.icon) | ||
45 | item.setData(QtCore.Qt.UserRole, action.id) | 45 | item.setData(QtCore.Qt.UserRole, action.id) | ||
46 | item.setFlags(item.flags() | QtCore.Qt.ItemIsUserCheckable) | 46 | item.setFlags(item.flags() | QtCore.Qt.ItemIsUserCheckable) | ||
47 | item.setCheckState(QtCore.Qt.Unchecked if action.id in self.manager.disabledActions else QtCore.Qt.Checked) | 47 | item.setCheckState(QtCore.Qt.Unchecked if action.id in self.manager.disabledActions else QtCore.Qt.Checked) | ||
Show All 13 Lines |