harbour-muchkin/qml/Icon.qml

81 lines
1.8 KiB
QML
Raw Normal View History

2021-05-10 18:59:52 +00:00
import QtQuick 2.0
import Sailfish.Silica 1.0
import io.thp.pyotherside 1.3
Page {
id: iconEditor
property var attrs
property var corners: [true, true, true, true]
PageHeader {
id: header
width: parent.width
title: "name: " + attrs.Name
}
SilicaGridView {
anchors.top: header.bottom
width: parent.width
height: width
cellWidth: width / 2
cellHeight: cellWidth
model: ListModel {
id: gridItems
ListElement {
idCell: 1
activated: true
}
ListElement {
idCell: 2
activated: true
}
ListElement {
idCell: 3
activated: true
}
ListElement {
idCell: 4
activated: true
}
}
delegate: GridItem {
onClicked: {
console.log("clicked " + idCell + " " + activated)
activated = !activated
iconEditor.corners[idCell] = activated
py.importModule("main", function(){
console.log(typeof icon.source);
py.call("main.sailify", [icon.source.toString(), iconEditor.corners], function(result){
icon.source = resource
})
})
}
}
}
Image {
id: icon
anchors.top: header.bottom
width: parent.width
height: width
source: attrs.Icon
}
Button {
anchors.top: icon.bottom
anchors.horizontalCenter: parent.horizontalCenter
text: "Save"
}
Python {
id: py
Component.onCompleted: {
py.addImportPath(Qt.resolvedUrl("../src"));
}
}
}