PluginAiOllama.py

Sat, 03 Aug 2024 18:30:37 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 03 Aug 2024 18:30:37 +0200
changeset 1
124e1b8f276b
parent 0
a71629325eb5
child 2
fee250704d3d
permissions
-rw-r--r--

Created the plug-in skeleton.

# -*- coding: utf-8 -*-

# Copyright (c) 2024 Detlev Offenbach <detlev@die-offenbachs.de>
#

"""
Module implementing the ollama Interface plug-in.
"""

from PyQt6.QtCore import QObject

from eric7 import Preferences

# Start-Of-Header
__header__ = {
    "name": "ollama Interface",
    "author": "Detlev Offenbach <detlev@die-offenbachs.de>",
    "autoactivate": True,
    "deactivateable": True,
    "version": "10.0.0",
    "className": "PluginOllamaInterface",
    "packageName": "OllamaInterface",
    "shortDescription": "Grapgical 'ollama' client for eric-ide.",
    "longDescription": (
        "Plug-in implementing an 'ollama' client and interface widgets."
    ),
    "needsRestart": False,
    "pyqtApi": 2,
}
# End-Of-Header

error = ""  # noqa: U200


def pageCreationFunction(configDlg):
    """
    Function to create the Translator configuration page.

    @param configDlg reference to the configuration dialog
    @type ConfigurationWidget
    @return reference to the configuration page
    @rtype TranslatorPage
    """
    # TODO: not implemented yet
    page = None  # change this line to create the configuration page
    return page


def getConfigData():
    """
    Function returning data as required by the configuration dialog.

    @return dictionary containing the relevant data
    @rtype dict
    """
    # TODO: not implemented yet
    return {
        "<unique key>": [
            "<display string>",
            "<pixmap filename>",
            pageCreationFunction,
            None,
            None,
        ],
    }


def prepareUninstall():
    """
    Function to prepare for an un-installation.
    """
    Preferences.getSettings().remove(PluginOllamaInterface.PreferencesKey)


def clearPrivateData():
    """
    Function to clear the private data of the plug-in.
    """
    # TODO: not implemented yet
    pass


class PluginOllamaInterface(QObject):
    """
    Class documentation goes here.
    """

    PreferencesKey = "Ollama"

    def __init__(self, ui):
        """
        Constructor

        @param ui reference to the user interface object
        @type UI.UserInterface
        """
        super().__init__(ui)
        self.__ui = ui
        # TODO: not implemented yet

    def activate(self):
        """
        Public method to activate this plug-in.

        @return tuple of None and activation status
        @rtype bool
        """
        global error
        error = ""  # clear previous error
        # TODO: not implemented yet

        return None, True

    def deactivate(self):
        """
        Public method to deactivate this plug-in.
        """
        # TODO: not implemented yet
        pass

    def getPreferences(self, key):
        """
        Public method to retrieve the various settings values.

        @param key the key of the value to get
        @type str
        @return the requested setting value
        @rtype Any
        """
        # TODO: not implemented yet
        return None

    def setPreferences(self, key, value):
        """
        Public method to store the various settings values.

        @param key the key of the setting to be set
        @type str
        @param value the value to be set
        @type Any
        """
        # TODO: not implemented yet
        pass


def installDependencies(pipInstall):
    """
    Function to install dependencies of this plug-in.

    @param pipInstall function to be called with a list of package names.
    @type function
    """
    # TODO: not implemented yet
    pass

eric ide

mercurial