44 self.__manager = manager |
44 self.__manager = manager |
45 |
45 |
46 self.__loadScripts() |
46 self.__loadScripts() |
47 |
47 |
48 self.scriptsList.removeItemRequested.connect(self.__removeItem) |
48 self.scriptsList.removeItemRequested.connect(self.__removeItem) |
|
49 self.scriptsList.itemChanged.connect(self.__itemChanged) |
49 |
50 |
50 @pyqtSlot() |
51 @pyqtSlot() |
51 def on_openDirectoryButton_clicked(self): |
52 def on_openDirectoryButton_clicked(self): |
52 """ |
53 """ |
53 Private slot to open the GreaseMonkey scripts directory. |
54 Private slot to open the GreaseMonkey scripts directory. |
75 |
76 |
76 def __loadScripts(self): |
77 def __loadScripts(self): |
77 """ |
78 """ |
78 Private method to load all the available scripts. |
79 Private method to load all the available scripts. |
79 """ |
80 """ |
80 try: |
|
81 self.scriptsList.itemChanged.disconnect(self.__itemChanged) |
|
82 except TypeError: |
|
83 # it isn't connected yet |
|
84 pass |
|
85 |
|
86 for script in self.__manager.allScripts(): |
81 for script in self.__manager.allScripts(): |
87 itm = QListWidgetItem(UI.PixmapCache.getIcon("greaseMonkeyScript.png"), |
82 itm = QListWidgetItem(UI.PixmapCache.getIcon("greaseMonkeyScript.png"), |
88 script.name(), self.scriptsList) |
83 script.name(), self.scriptsList) |
89 itm.setData(GreaseMonkeyConfigurationDialog.ScriptVersionRole, |
84 itm.setData(GreaseMonkeyConfigurationDialog.ScriptVersionRole, |
90 script.version()) |
85 script.version()) |
112 if topItem.checkState() == Qt.Unchecked and \ |
107 if topItem.checkState() == Qt.Unchecked and \ |
113 bottomItem.checkState == Qt.Checked: |
108 bottomItem.checkState == Qt.Checked: |
114 itm = self.scriptsList.takeItem(row + 1) |
109 itm = self.scriptsList.takeItem(row + 1) |
115 self.scriptsList.insertItem(row, itm) |
110 self.scriptsList.insertItem(row, itm) |
116 itemMoved = True |
111 itemMoved = True |
117 |
|
118 self.scriptsList.itemChanged.connect(self.__itemChanged) |
|
119 |
112 |
120 def __getScript(self, itm): |
113 def __getScript(self, itm): |
121 """ |
114 """ |
122 Private method to get the script for the given item. |
115 Private method to get the script for the given item. |
123 |
116 |