OllamaInterface/OllamaRunningModelsDialog.py

changeset 8
3118d16e526e
child 9
c471738b75b3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/OllamaInterface/OllamaRunningModelsDialog.py	Sun Aug 25 19:44:24 2024 +0200
@@ -0,0 +1,47 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2024 Detlev Offenbach <detlev@die-offenbachs.de>
+#
+
+"""
+Module implementing a dialog to show details of the running models.
+"""
+
+from PyQt6.QtWidgets import QDialog, QTreeWidgetItem
+
+from eric7 import Globals
+
+from .Ui_OllamaRunningModelsDialog import Ui_OllamaRunningModelsDialog
+
+
+class OllamaRunningModelsDialog(QDialog, Ui_OllamaRunningModelsDialog):
+    """
+    Class implementing a dialog to show details of the running models.
+    """
+
+    def __init__(self, models, parent=None):
+        """
+        Constructor
+
+        @param models list of available models with details
+        @type list[dict[str: Any]]
+        @param parent reference to the parent widget (defaults to None)
+        @type QWidget (optional)
+        """
+        super().__init__(parent)
+        self.setupUi(self)
+
+        for model in models:
+            QTreeWidgetItem(
+                self.modelsList,
+                [
+                    model["name"],
+                    model["id"],
+                    Globals.dataString(model["size"]),
+                    model["processor"],
+                    model["expires"].strftime("%Y-%m-%d %H:%M:%S"),
+                ]
+            )
+
+        for column in range(self.modelsList.columnCount()):
+            self.modelsList.resizeColumnToContents(column)

eric ide

mercurial