23 class GreaseMonkeyConfigurationDialog( |
23 class GreaseMonkeyConfigurationDialog( |
24 QDialog, Ui_GreaseMonkeyConfigurationDialog): |
24 QDialog, Ui_GreaseMonkeyConfigurationDialog): |
25 """ |
25 """ |
26 Class implementing the GreaseMonkey scripts configuration dialog. |
26 Class implementing the GreaseMonkey scripts configuration dialog. |
27 """ |
27 """ |
28 ScriptVersionRole = Qt.UserRole |
28 ScriptVersionRole = Qt.ItemDataRole.UserRole |
29 ScriptDescriptionRole = Qt.UserRole + 1 |
29 ScriptDescriptionRole = Qt.ItemDataRole.UserRole + 1 |
30 ScriptRole = Qt.UserRole + 2 |
30 ScriptRole = Qt.ItemDataRole.UserRole + 2 |
31 |
31 |
32 def __init__(self, manager, parent=None): |
32 def __init__(self, manager, parent=None): |
33 """ |
33 """ |
34 Constructor |
34 Constructor |
35 |
35 |
36 @param manager reference to the manager object (GreaseMonkeyManager) |
36 @param manager reference to the manager object (GreaseMonkeyManager) |
37 @param parent reference to the parent widget (QWidget) |
37 @param parent reference to the parent widget (QWidget) |
38 """ |
38 """ |
39 super(GreaseMonkeyConfigurationDialog, self).__init__(parent) |
39 super(GreaseMonkeyConfigurationDialog, self).__init__(parent) |
40 self.setupUi(self) |
40 self.setupUi(self) |
41 self.setWindowFlags(Qt.Window) |
41 self.setWindowFlags(Qt.WindowType.Window) |
42 |
42 |
43 self.iconLabel.setPixmap( |
43 self.iconLabel.setPixmap( |
44 UI.PixmapCache.getPixmap("greaseMonkey48")) |
44 UI.PixmapCache.getPixmap("greaseMonkey48")) |
45 |
45 |
46 self.__manager = manager |
46 self.__manager = manager |
102 GreaseMonkeyConfigurationDialog.ScriptVersionRole, |
102 GreaseMonkeyConfigurationDialog.ScriptVersionRole, |
103 script.version()) |
103 script.version()) |
104 itm.setData( |
104 itm.setData( |
105 GreaseMonkeyConfigurationDialog.ScriptDescriptionRole, |
105 GreaseMonkeyConfigurationDialog.ScriptDescriptionRole, |
106 script.description()) |
106 script.description()) |
107 itm.setFlags(itm.flags() | Qt.ItemIsUserCheckable) |
107 itm.setFlags(itm.flags() | Qt.ItemFlag.ItemIsUserCheckable) |
108 if script.isEnabled(): |
108 if script.isEnabled(): |
109 itm.setCheckState(Qt.Checked) |
109 itm.setCheckState(Qt.CheckState.Checked) |
110 else: |
110 else: |
111 itm.setCheckState(Qt.Unchecked) |
111 itm.setCheckState(Qt.CheckState.Unchecked) |
112 itm.setData(GreaseMonkeyConfigurationDialog.ScriptRole, script) |
112 itm.setData(GreaseMonkeyConfigurationDialog.ScriptRole, script) |
113 self.scriptsList.addItem(itm) |
113 self.scriptsList.addItem(itm) |
114 |
114 |
115 self.scriptsList.sortItems() |
115 self.scriptsList.sortItems() |
116 |
116 |
122 bottomItem = self.scriptsList.item(row + 1) |
122 bottomItem = self.scriptsList.item(row + 1) |
123 if topItem is None or bottomItem is None: |
123 if topItem is None or bottomItem is None: |
124 continue |
124 continue |
125 |
125 |
126 if ( |
126 if ( |
127 topItem.checkState() == Qt.Unchecked and |
127 topItem.checkState() == Qt.CheckState.Unchecked and |
128 bottomItem.checkState == Qt.Checked |
128 bottomItem.checkState == Qt.CheckState.Checked |
129 ): |
129 ): |
130 itm = self.scriptsList.takeItem(row + 1) |
130 itm = self.scriptsList.takeItem(row + 1) |
131 self.scriptsList.insertItem(row, itm) |
131 self.scriptsList.insertItem(row, itm) |
132 itemMoved = True |
132 itemMoved = True |
133 |
133 |