Advertisement
Guest User

Untitled

a guest
Mar 16th, 2015
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QML 3.06 KB | None | 0 0
  1. import QtQuick 2.0
  2. import Sailfish.Silica 1.0
  3. import io.thp.pyotherside 1.3
  4.  
  5. Page {
  6.     id: page
  7.  
  8.     property string city
  9.     property string mytext
  10.     property string country
  11.     property string uri
  12.     property string color
  13.  
  14.     property bool loadingData
  15.  
  16.  
  17.     SilicaListView {
  18.         anchors.fill: parent
  19.  
  20.         model: ListModel {
  21.             id: listModel
  22.         }
  23.         header: PageHeader {
  24.             title: qsTr(page.mytext)
  25.         }
  26.         delegate: BackgroundItem {
  27.             height: Theme.itemSizeMedium
  28.             anchors {
  29.                 left: parent.left
  30.                 right: parent.right
  31.             }
  32.             // Stolen from:
  33.             // https://github.com/mattaustin/fremantleline/blob/master/qml/silica/DepartureListPage.qml
  34.             Rectangle {
  35.                 width: Theme.paddingSmall
  36.                 radius: Math.round(height/3)
  37.                 color: color_txt
  38.                 anchors {
  39.                     top: parent.top
  40.                     bottom: parent.bottom
  41.                     left: parent.left
  42.                     topMargin: Theme.paddingSmall/2
  43.                     bottomMargin: Theme.paddingSmall/2
  44.                     leftMargin: -width/2
  45.                 }
  46.             }
  47.             Column {
  48.                 id:column
  49.                 anchors {
  50.                     left: parent.left
  51.                     leftMargin: Theme.paddingLarge
  52.                     right: parent.right
  53.                     rightMargin: Theme.paddingSmall
  54.                     verticalCenter: parent.verticalCenter
  55.                 }
  56.                 Label {
  57.                     text: name
  58.                     color: highlighted ? Theme.highlightColor : Theme.primaryColor
  59.  
  60.                 }
  61.                 Row {
  62.                     width: page.width
  63.                 Label {
  64.                     id: text1
  65.                     text: veg_level_description
  66.                     color: highlighted ? Theme.highlightColor : Theme.secondaryColor
  67.                     font.pixelSize: Theme.fontSizeSmall
  68.  
  69.                 }
  70.  
  71.  
  72.                 Image
  73.                 {
  74.             id: image1
  75.                     source: "image://theme/icon-cover-pause"
  76.                     height: Theme.fontSizeSmall
  77.                     width: Theme.fontSizeSmall
  78.                     x: page.width - width
  79.  
  80.                 }
  81.  
  82.                 }
  83.             }
  84.  
  85.         }
  86.     }
  87.  
  88.     BusyIndicator {
  89.         anchors.centerIn: parent
  90.         size: BusyIndicatorSize.Large
  91.         running: loadingData
  92.         visible: loadingData
  93.     }
  94.     Python {
  95.         id: py
  96.         Component.onCompleted: {
  97.             addImportPath(Qt.resolvedUrl('.'));
  98.             importModule('listmodel', function () {
  99.                 loadingData = true;
  100.                 py.call('listmodel.get_entries', [page.uri], function(result) {
  101.                     for (var i=0; i<result.length; i++) {
  102.                         listModel.append(result[i]);
  103.                     }
  104.                     loadingData = false;
  105.                 });
  106.             });
  107.         }
  108.     }
  109.  
  110. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement