File indexing completed on 2024-12-22 04:16:27
0001 # SPDX-License-Identifier: CC0-1.0 0002 0003 from PyQt5.QtWidgets import QWidget, QVBoxLayout, QListView, QPushButton 0004 import krita 0005 from . import lastdocumentslistmodel 0006 0007 0008 class LastDocumentsDocker(krita.DockWidget): 0009 0010 def __init__(self): 0011 super(LastDocumentsDocker, self).__init__() 0012 0013 self.baseWidget = QWidget() 0014 self.layout = QVBoxLayout() 0015 self.listView = QListView() 0016 self.loadButton = QPushButton(i18n("Refresh")) 0017 self.listModel = lastdocumentslistmodel.LastDocumentsListModel(self.devicePixelRatioF()) 0018 0019 self.listView.setModel(self.listModel) 0020 self.listView.setFlow(QListView.LeftToRight) 0021 0022 self.layout.addWidget(self.listView) 0023 self.layout.addWidget(self.loadButton) 0024 0025 self.baseWidget.setLayout(self.layout) 0026 self.setWidget(self.baseWidget) 0027 0028 self.loadButton.clicked.connect(self.refreshRecentDocuments) 0029 self.setWindowTitle(i18n("Last Documents Docker")) 0030 0031 def canvasChanged(self, canvas): 0032 pass 0033 0034 def refreshRecentDocuments(self): 0035 self.listModel.loadRecentDocuments()