61 |
61 |
62 def showConfigurationDialog(self, parent=None): |
62 def showConfigurationDialog(self, parent=None): |
63 """ |
63 """ |
64 Public method to show the configuration dialog. |
64 Public method to show the configuration dialog. |
65 |
65 |
66 @param parent reference to the parent widget (QWidget) |
66 @param parent reference to the parent widget |
|
67 @type QWidget |
67 """ |
68 """ |
68 from .GreaseMonkeyConfiguration import GreaseMonkeyConfigurationDialog |
69 from .GreaseMonkeyConfiguration import GreaseMonkeyConfigurationDialog |
69 |
70 |
70 self.__configDiaolg = ( |
71 self.__configDiaolg = ( |
71 GreaseMonkeyConfigurationDialog.GreaseMonkeyConfigurationDialog( |
72 GreaseMonkeyConfigurationDialog.GreaseMonkeyConfigurationDialog( |
115 @param fileName name of the downloaded script |
116 @param fileName name of the downloaded script |
116 @type str |
117 @type str |
117 @param downloader reference to the downloader object |
118 @param downloader reference to the downloader object |
118 @type GreaseMonkeyDownloader |
119 @type GreaseMonkeyDownloader |
119 """ |
120 """ |
|
121 from .GreaseMonkeyAddScriptDialog import GreaseMonkeyAddScriptDialog |
|
122 from .GreaseMonkeyScript import GreaseMonkeyScript |
|
123 |
120 if downloader in self.__downloaders: |
124 if downloader in self.__downloaders: |
121 self.__downloaders.remove(downloader) |
125 self.__downloaders.remove(downloader) |
122 |
126 |
123 deleteScript = True |
127 deleteScript = True |
124 from .GreaseMonkeyScript import GreaseMonkeyScript |
|
125 |
|
126 script = GreaseMonkeyScript(self, fileName) |
128 script = GreaseMonkeyScript(self, fileName) |
127 if script.isValid(): |
129 if script.isValid(): |
128 if not self.containsScript(script.fullName()): |
130 if not self.containsScript(script.fullName()): |
129 from .GreaseMonkeyAddScriptDialog import GreaseMonkeyAddScriptDialog |
|
130 |
|
131 dlg = GreaseMonkeyAddScriptDialog(self, script) |
131 dlg = GreaseMonkeyAddScriptDialog(self, script) |
132 deleteScript = dlg.exec() != QDialog.DialogCode.Accepted |
132 deleteScript = dlg.exec() != QDialog.DialogCode.Accepted |
133 else: |
133 else: |
134 EricMessageBox.information( |
134 EricMessageBox.information( |
135 None, |
135 None, |
308 |
308 |
309 def __load(self): |
309 def __load(self): |
310 """ |
310 """ |
311 Private slot to load the available scripts into the manager. |
311 Private slot to load the available scripts into the manager. |
312 """ |
312 """ |
|
313 from .GreaseMonkeyScript import GreaseMonkeyScript |
|
314 |
313 scriptsDir = QDir(self.scriptsDirectory()) |
315 scriptsDir = QDir(self.scriptsDirectory()) |
314 if not scriptsDir.exists(): |
316 if not scriptsDir.exists(): |
315 scriptsDir.mkpath(self.scriptsDirectory()) |
317 scriptsDir.mkpath(self.scriptsDirectory()) |
316 |
318 |
317 if not scriptsDir.exists("requires"): |
319 if not scriptsDir.exists("requires"): |
318 scriptsDir.mkdir("requires") |
320 scriptsDir.mkdir("requires") |
319 |
321 |
320 self.__disabledScripts = Preferences.getWebBrowser( |
322 self.__disabledScripts = Preferences.getWebBrowser( |
321 "GreaseMonkeyDisabledScripts" |
323 "GreaseMonkeyDisabledScripts" |
322 ) |
324 ) |
323 |
|
324 from .GreaseMonkeyScript import GreaseMonkeyScript |
|
325 |
325 |
326 for fileName in scriptsDir.entryList(["*.js"], QDir.Filter.Files): |
326 for fileName in scriptsDir.entryList(["*.js"], QDir.Filter.Files): |
327 absolutePath = scriptsDir.absoluteFilePath(fileName) |
327 absolutePath = scriptsDir.absoluteFilePath(fileName) |
328 script = GreaseMonkeyScript(self, absolutePath) |
328 script = GreaseMonkeyScript(self, absolutePath) |
329 |
329 |