10 from PyQt4.QtCore import pyqtSlot, Qt, QUrl |
10 from PyQt4.QtCore import pyqtSlot, Qt, QUrl |
11 from PyQt4.QtGui import QDialog, QListWidgetItem, QDesktopServices |
11 from PyQt4.QtGui import QDialog, QListWidgetItem, QDesktopServices |
12 |
12 |
13 from E5Gui import E5MessageBox |
13 from E5Gui import E5MessageBox |
14 |
14 |
15 from .Ui_GreaseMonkeyConfigurationDialog import Ui_GreaseMonkeyConfigurationDialog |
15 from .Ui_GreaseMonkeyConfigurationDialog import \ |
|
16 Ui_GreaseMonkeyConfigurationDialog |
16 |
17 |
17 import UI.PixmapCache |
18 import UI.PixmapCache |
18 |
19 |
19 |
20 |
20 class GreaseMonkeyConfigurationDialog(QDialog, Ui_GreaseMonkeyConfigurationDialog): |
21 class GreaseMonkeyConfigurationDialog( |
|
22 QDialog, Ui_GreaseMonkeyConfigurationDialog): |
21 """ |
23 """ |
22 Class implementing the GreaseMonkey scripts configuration dialog. |
24 Class implementing the GreaseMonkey scripts configuration dialog. |
23 """ |
25 """ |
24 ScriptVersionRole = Qt.UserRole |
26 ScriptVersionRole = Qt.UserRole |
25 ScriptDescriptionRole = Qt.UserRole + 1 |
27 ScriptDescriptionRole = Qt.UserRole + 1 |
47 @pyqtSlot() |
50 @pyqtSlot() |
48 def on_openDirectoryButton_clicked(self): |
51 def on_openDirectoryButton_clicked(self): |
49 """ |
52 """ |
50 Private slot to open the GreaseMonkey scripts directory. |
53 Private slot to open the GreaseMonkey scripts directory. |
51 """ |
54 """ |
52 QDesktopServices.openUrl(QUrl.fromLocalFile(self.__manager.scriptsDirectory())) |
55 QDesktopServices.openUrl( |
|
56 QUrl.fromLocalFile(self.__manager.scriptsDirectory())) |
53 |
57 |
54 @pyqtSlot(str) |
58 @pyqtSlot(str) |
55 def on_downloadLabel_linkActivated(self, link): |
59 def on_downloadLabel_linkActivated(self, link): |
56 """ |
60 """ |
57 Private slot to open the userscript.org web site. |
61 Private slot to open the userscript.org web site. |
137 if script is None: |
141 if script is None: |
138 return |
142 return |
139 |
143 |
140 removeIt = E5MessageBox.yesNo(self, |
144 removeIt = E5MessageBox.yesNo(self, |
141 self.trUtf8("Remove Script"), |
145 self.trUtf8("Remove Script"), |
142 self.trUtf8("""<p>Are you sure you want to remove <b>{0}</b>?</p>""") |
146 self.trUtf8( |
|
147 """<p>Are you sure you want to remove <b>{0}</b>?</p>""") |
143 .format(script.name())) |
148 .format(script.name())) |
144 if removeIt and self.__manager.removeScript(script): |
149 if removeIt and self.__manager.removeScript(script): |
145 self.scriptsList.takeItem(self.scriptsList.row(itm)) |
150 self.scriptsList.takeItem(self.scriptsList.row(itm)) |
146 del itm |
151 del itm |
147 |
152 |