|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2024 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing the ollama Interface plug-in. |
|
8 """ |
|
9 |
|
10 from PyQt6.QtCore import QObject |
|
11 |
|
12 from eric7 import Preferences |
|
13 |
|
14 # Start-Of-Header |
|
15 __header__ = { |
|
16 "name": "ollama Interface", |
|
17 "author": "Detlev Offenbach <detlev@die-offenbachs.de>", |
|
18 "autoactivate": True, |
|
19 "deactivateable": True, |
|
20 "version": "10.0.0", |
|
21 "className": "PluginOllamaInterface", |
|
22 "packageName": "OllamaInterface", |
|
23 "shortDescription": "Grapgical 'ollama' client for eric-ide.", |
|
24 "longDescription": ( |
|
25 "Plug-in implementing an 'ollama' client and interface widgets." |
|
26 ), |
|
27 "needsRestart": False, |
|
28 "pyqtApi": 2, |
|
29 } |
|
30 # End-Of-Header |
|
31 |
|
32 error = "" # noqa: U200 |
|
33 |
|
34 |
|
35 def pageCreationFunction(configDlg): |
|
36 """ |
|
37 Function to create the Translator configuration page. |
|
38 |
|
39 @param configDlg reference to the configuration dialog |
|
40 @type ConfigurationWidget |
|
41 @return reference to the configuration page |
|
42 @rtype TranslatorPage |
|
43 """ |
|
44 # TODO: not implemented yet |
|
45 page = None # change this line to create the configuration page |
|
46 return page |
|
47 |
|
48 |
|
49 def getConfigData(): |
|
50 """ |
|
51 Function returning data as required by the configuration dialog. |
|
52 |
|
53 @return dictionary containing the relevant data |
|
54 @rtype dict |
|
55 """ |
|
56 # TODO: not implemented yet |
|
57 return { |
|
58 "<unique key>": [ |
|
59 "<display string>", |
|
60 "<pixmap filename>", |
|
61 pageCreationFunction, |
|
62 None, |
|
63 None, |
|
64 ], |
|
65 } |
|
66 |
|
67 |
|
68 def prepareUninstall(): |
|
69 """ |
|
70 Function to prepare for an un-installation. |
|
71 """ |
|
72 Preferences.getSettings().remove(PluginOllamaInterface.PreferencesKey) |
|
73 |
|
74 |
|
75 def clearPrivateData(): |
|
76 """ |
|
77 Function to clear the private data of the plug-in. |
|
78 """ |
|
79 # TODO: not implemented yet |
|
80 pass |
|
81 |
|
82 |
|
83 class PluginOllamaInterface(QObject): |
|
84 """ |
|
85 Class documentation goes here. |
|
86 """ |
|
87 |
|
88 PreferencesKey = "Ollama" |
|
89 |
|
90 def __init__(self, ui): |
|
91 """ |
|
92 Constructor |
|
93 |
|
94 @param ui reference to the user interface object |
|
95 @type UI.UserInterface |
|
96 """ |
|
97 super().__init__(ui) |
|
98 self.__ui = ui |
|
99 # TODO: not implemented yet |
|
100 |
|
101 def activate(self): |
|
102 """ |
|
103 Public method to activate this plug-in. |
|
104 |
|
105 @return tuple of None and activation status |
|
106 @rtype bool |
|
107 """ |
|
108 global error |
|
109 error = "" # clear previous error |
|
110 # TODO: not implemented yet |
|
111 |
|
112 return None, True |
|
113 |
|
114 def deactivate(self): |
|
115 """ |
|
116 Public method to deactivate this plug-in. |
|
117 """ |
|
118 # TODO: not implemented yet |
|
119 pass |
|
120 |
|
121 def getPreferences(self, key): |
|
122 """ |
|
123 Public method to retrieve the various settings values. |
|
124 |
|
125 @param key the key of the value to get |
|
126 @type str |
|
127 @return the requested setting value |
|
128 @rtype Any |
|
129 """ |
|
130 # TODO: not implemented yet |
|
131 return None |
|
132 |
|
133 def setPreferences(self, key, value): |
|
134 """ |
|
135 Public method to store the various settings values. |
|
136 |
|
137 @param key the key of the setting to be set |
|
138 @type str |
|
139 @param value the value to be set |
|
140 @type Any |
|
141 """ |
|
142 # TODO: not implemented yet |
|
143 pass |
|
144 |
|
145 |
|
146 def installDependencies(pipInstall): |
|
147 """ |
|
148 Function to install dependencies of this plug-in. |
|
149 |
|
150 @param pipInstall function to be called with a list of package names. |
|
151 @type function |
|
152 """ |
|
153 # TODO: not implemented yet |
|
154 pass |