def __init__(self): super(LastDocumentsDocker, self).__init__() self.baseWidget = QWidget() self.layout = QVBoxLayout() self.listView = QListView() self.loadButton = QPushButton("Refresh") self.listModel = lastdocumentslistmodel.LastDocumentsListModel() self.listView.setModel(self.listModel) self.listView.setFlow(QListView.LeftToRight) self.layout.addWidget(self.listView) self.layout.addWidget(self.loadButton) self.baseWidget.setLayout(self.layout) self.setWidget(self.baseWidget) self.loadButton.clicked.connect(self.refreshRecentDocuments) self.setWindowTitle("Last Documents Docker") def canvasChanged(self, canvas): pass def refreshRecentDocuments(self): self.listModel.loadRecentDocuments() Application.addDockWidgetFactory(krita.DockWidgetFactory("lastdocumentsdocker", krita.DockWidgetFactoryBase.DockRight, LastDocumentsDocker))
directoryTextField = QLineEdit() directoryDialogButton = QPushButton("...") directoryDialogButton.clicked.connect(self.test) directorySelectorLayout.addWidget(directoryTextField) directorySelectorLayout.addWidget(directoryDialogButton) self.scriptsLayout.addRow( "Script {0}".format(self.scriptsLayout.rowCount() + 1), directorySelectorLayout) def test(self): obj = self.sender() print('button', obj) def loadActions(self): pass def readSettings(self): pass def writeSettings(self): pass Application.addDockWidgetFactory( krita.DockWidgetFactory("scriptdocker", krita.DockWidgetFactoryBase.DockRight, ScriptDocker))
import krita from .lastdocumentsdocker import LastDocumentsDocker Application.addDockWidgetFactory( krita.DockWidgetFactory("lastdocumentsdocker", krita.DockWidgetFactoryBase.DockRight, LastDocumentsDocker))
def canvasChanged(self, canvas): pass def addNewRow(self): directorySelectorLayout = QHBoxLayout() directoryTextField = QLineEdit() directoryDialogButton = QPushButton(i18n("...")) directoryDialogButton.clicked.connect(self.test) directorySelectorLayout.addWidget(directoryTextField) directorySelectorLayout.addWidget(directoryDialogButton) self.scriptsLayout.addRow(str(i18n("Script {0}")).format(self.scriptsLayout.rowCount() + 1), directorySelectorLayout) def test(self): obj = self.sender() print('button', obj) def loadActions(self): pass def readSettings(self): pass def writeSettings(self): pass Application.addDockWidgetFactory(krita.DockWidgetFactory("scriptdocker", krita.DockWidgetFactoryBase.DockRight, ScriptDocker))