9 |
9 |
10 import os |
10 import os |
11 |
11 |
12 from PyQt6.QtCore import QCoreApplication, QObject, QTranslator |
12 from PyQt6.QtCore import QCoreApplication, QObject, QTranslator |
13 |
13 |
14 from AssistantEric.Assistant import AcsAPIs, AcsProject |
14 from AssistantEric.Assistant import AcsAPIs, AcsProject, Assistant |
15 from eric7 import Preferences |
15 from eric7 import Preferences |
16 from eric7.EricWidgets.EricApplication import ericApp |
16 from eric7.EricWidgets.EricApplication import ericApp |
17 |
17 |
18 # Start-Of-Header |
18 # Start-Of-Header |
19 name = "Assistant Eric Plugin" |
19 name = "Assistant Eric Plugin" |
20 author = "Detlev Offenbach <detlev@die-offenbachs.de>" |
20 author = "Detlev Offenbach <detlev@die-offenbachs.de>" |
21 autoactivate = True |
21 autoactivate = True |
22 deactivateable = True |
22 deactivateable = True |
23 version = "10.2.4" |
23 version = "10.3.0" |
24 className = "AssistantEricPlugin" |
24 className = "AssistantEricPlugin" |
25 packageName = "AssistantEric" |
25 packageName = "AssistantEric" |
26 shortDescription = "Alternative autocompletion and calltips provider." |
26 shortDescription = "Alternative autocompletion and calltips provider." |
27 longDescription = ( |
27 longDescription = ( |
28 """This plugin implements an alternative autocompletion and""" |
28 """This plugin implements an alternative autocompletion and""" |
35 error = "" |
35 error = "" |
36 |
36 |
37 assistantEricPluginObject = None |
37 assistantEricPluginObject = None |
38 |
38 |
39 |
39 |
40 def createAutoCompletionPage(configDlg): |
40 def createAutoCompletionPage( |
|
41 configDlg, # noqa: U100 |
|
42 ): |
41 """ |
43 """ |
42 Module function to create the autocompletion configuration page. |
44 Module function to create the autocompletion configuration page. |
43 |
45 |
44 @param configDlg reference to the configuration dialog |
46 @param configDlg reference to the configuration dialog |
45 @type ConfigurationWidget |
47 @type ConfigurationWidget |
46 @return reference to the configuration page |
48 @return reference to the configuration page |
47 @rtype QWidget |
49 @rtype QWidget |
48 """ |
50 """ |
49 global assistantEricPluginObject |
51 global assistantEricPluginObject |
50 from AssistantEric.ConfigurationPages.AutoCompletionEricPage import ( |
52 from AssistantEric.ConfigurationPages.AutoCompletionEricPage import ( # noqa: I101 |
51 AutoCompletionEricPage, |
53 AutoCompletionEricPage, |
52 ) |
54 ) |
53 |
55 |
54 return AutoCompletionEricPage(assistantEricPluginObject) |
56 return AutoCompletionEricPage(assistantEricPluginObject) |
55 |
57 |
56 |
58 |
57 def createCallTipsPage(configDlg): |
59 def createCallTipsPage( |
|
60 configDlg, # noqa: U100 |
|
61 ): |
58 """ |
62 """ |
59 Module function to create the calltips configuration page. |
63 Module function to create the calltips configuration page. |
60 |
64 |
61 @param configDlg reference to the configuration dialog |
65 @param configDlg reference to the configuration dialog |
62 @type ConfigurationWidget |
66 @type ConfigurationWidget |
63 @return reference to the configuration page |
67 @return reference to the configuration page |
64 @rtype QWidget |
68 @rtype QWidget |
65 """ |
69 """ |
66 global assistantEricPluginObject |
70 global assistantEricPluginObject |
67 from AssistantEric.ConfigurationPages.CallTipsEricPage import CallTipsEricPage |
71 from AssistantEric.ConfigurationPages.CallTipsEricPage import ( # noqa: I101 |
|
72 CallTipsEricPage, |
|
73 ) |
68 |
74 |
69 return CallTipsEricPage(assistantEricPluginObject) |
75 return CallTipsEricPage(assistantEricPluginObject) |
70 |
76 |
71 |
77 |
72 def getConfigData(): |
78 def getConfigData(): |
77 @rtype dict |
83 @rtype dict |
78 """ |
84 """ |
79 try: |
85 try: |
80 usesDarkPalette = ericApp().usesDarkPalette() |
86 usesDarkPalette = ericApp().usesDarkPalette() |
81 except AttributeError: |
87 except AttributeError: |
82 from PyQt6.QtGui import QPalette |
88 from PyQt6.QtGui import QPalette # noqa: I101, I102 |
83 |
89 |
84 palette = ericApp().palette() |
90 palette = ericApp().palette() |
85 lightness = palette.color(QPalette.ColorRole.Window).lightness() |
91 lightness = palette.color(QPalette.ColorRole.Window).lightness() |
86 usesDarkPalette = lightness <= 128 |
92 usesDarkPalette = lightness <= 128 |
87 iconSuffix = "dark" if usesDarkPalette else "light" |
93 iconSuffix = "dark" if usesDarkPalette else "light" |
186 if not self.__checkQSql(): |
192 if not self.__checkQSql(): |
187 return None, False |
193 return None, False |
188 |
194 |
189 global assistantEricPluginObject |
195 global assistantEricPluginObject |
190 assistantEricPluginObject = self |
196 assistantEricPluginObject = self |
191 |
|
192 from AssistantEric.Assistant import Assistant |
|
193 |
197 |
194 self.__object = Assistant(self, self.__ui) |
198 self.__object = Assistant(self, self.__ui) |
195 ericApp().registerPluginObject("AssistantEric", self.__object) |
199 ericApp().registerPluginObject("AssistantEric", self.__object) |
196 |
200 |
197 self.__object.activate() |
201 self.__object.activate() |