Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import QtQuick 2.0
- import Sailfish.Silica 1.0
- import io.thp.pyotherside 1.3
- Page {
- id: page
- property string city
- property string mytext
- property string country
- property string uri
- property string color
- property bool loadingData
- SilicaListView {
- anchors.fill: parent
- model: ListModel {
- id: listModel
- }
- header: PageHeader {
- title: qsTr(page.mytext)
- }
- delegate: BackgroundItem {
- height: Theme.itemSizeMedium
- anchors {
- left: parent.left
- right: parent.right
- }
- // Stolen from:
- // https://github.com/mattaustin/fremantleline/blob/master/qml/silica/DepartureListPage.qml
- Rectangle {
- width: Theme.paddingSmall
- radius: Math.round(height/3)
- color: color_txt
- anchors {
- top: parent.top
- bottom: parent.bottom
- left: parent.left
- topMargin: Theme.paddingSmall/2
- bottomMargin: Theme.paddingSmall/2
- leftMargin: -width/2
- }
- }
- Column {
- id:column
- anchors {
- left: parent.left
- leftMargin: Theme.paddingLarge
- right: parent.right
- rightMargin: Theme.paddingSmall
- verticalCenter: parent.verticalCenter
- }
- Label {
- text: name
- color: highlighted ? Theme.highlightColor : Theme.primaryColor
- }
- Row {
- width: page.width
- Label {
- id: text1
- text: veg_level_description
- color: highlighted ? Theme.highlightColor : Theme.secondaryColor
- font.pixelSize: Theme.fontSizeSmall
- }
- Image
- {
- id: image1
- source: "image://theme/icon-cover-pause"
- height: Theme.fontSizeSmall
- width: Theme.fontSizeSmall
- x: page.width - width
- }
- }
- }
- }
- }
- BusyIndicator {
- anchors.centerIn: parent
- size: BusyIndicatorSize.Large
- running: loadingData
- visible: loadingData
- }
- Python {
- id: py
- Component.onCompleted: {
- addImportPath(Qt.resolvedUrl('.'));
- importModule('listmodel', function () {
- loadingData = true;
- py.call('listmodel.get_entries', [page.uri], function(result) {
- for (var i=0; i<result.length; i++) {
- listModel.append(result[i]);
- }
- loadingData = false;
- });
- });
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement