--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OllamaInterface/OllamaDetailedModelsDialog.py Sun Aug 25 19:44:24 2024 +0200 @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- + +# Copyright (c) 2024 Detlev Offenbach <detlev@die-offenbachs.de> +# + +""" +Module implementing a dialog to show details of the available models. +""" + +from PyQt6.QtWidgets import QDialog, QTreeWidgetItem + +from eric7 import Globals + +from .Ui_OllamaDetailedModelsDialog import Ui_OllamaDetailedModelsDialog + + +class OllamaDetailedModelsDialog(QDialog, Ui_OllamaDetailedModelsDialog): + """ + Class implementing a dialog to show details of the available 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["modified"].strftime("%Y-%m-%d %H:%M:%S"), + ] + ) + + for column in range(self.modelsList.columnCount()): + self.modelsList.resizeColumnToContents(column)