We have moved to a new Sailfish OS Forum. Please start new discussions there.

Revision history [back]

click to hide/show revision 1
initial version

posted 2014-02-09 08:51:31 +0200

I can't get pyotherside right

Hi, I can't get even the simpliest application to work with Sailfish and PyOtherSide. What i'm doing wrong? Is it with addImportPath? Here is the code:

pressbutton.qml

import QtQuick 2.0
import Sailfish.Silica 1.0
import io.thp.pyotherside 1.0

ApplicationWindow
{
    initialPage: Page {
        id: page

        Button {
            id: mybtn
            text: "press"
            anchors.centerIn: page
            onClicked: {
                py.call('pressbutton.pressme', function() {});
            }
        }

        Python {
            id: py
            Component.onCompleted: {
                addImportPath(Qt.resolvedUrl('/usr/share/pressbutton/qml'));
                importModule('pressbutton', function() {});
            }
        }
    }

    cover: Qt.resolvedUrl("cover/CoverPage.qml")
}

and pressbutton.py

#!/usr/bin/env python
# -*- coding: utf-8 -*-

def pressme():
    f = open("/home/nemo/Documents/file.txt","a")
    f.write("this is example text")
    f.close()

I can't get pyotherside right

Hi, I can't get even the simpliest application to work with Sailfish and PyOtherSide. What i'm doing wrong? Is it with addImportPath? Here is the code:

pressbutton.qml

import QtQuick 2.0
import Sailfish.Silica 1.0
import io.thp.pyotherside 1.0

ApplicationWindow
{
    initialPage: Page {
        id: page

        Button {
            id: mybtn
            text: "press"
            anchors.centerIn: page
            onClicked: {
                py.call('pressbutton.pressme', function() {});
            }
        }

        Python {
            id: py
            Component.onCompleted: {
                addImportPath(Qt.resolvedUrl('/usr/share/pressbutton/qml'));
                importModule('pressbutton', function() {});
            }
        }
    }

    cover: Qt.resolvedUrl("cover/CoverPage.qml")
}

and pressbutton.py

#!/usr/bin/env python
# -*- coding: utf-8 -*-

def pressme():
    f = open("/home/nemo/Documents/file.txt","a")
    f.write("this is example text")
    f.close()

I can't get pyotherside right

I can't get even the simpliest application to work with Sailfish and PyOtherSide. What i'm doing wrong? Is it with addImportPath? Here is the code:

pressbutton.qml

import QtQuick 2.0
import Sailfish.Silica 1.0
import io.thp.pyotherside 1.0

ApplicationWindow
{
    initialPage: Page {
        id: page

        Button {
            id: mybtn
            text: "press"
            anchors.centerIn: page
            onClicked: {
                py.call('pressbutton.pressme', function() {});
            }
        }

        Python {
            id: py
            Component.onCompleted: {
                addImportPath(Qt.resolvedUrl('/usr/share/pressbutton/qml'));
                importModule('pressbutton', function() {});
            }
        }
    }

    cover: Qt.resolvedUrl("cover/CoverPage.qml")
}

and pressbutton.py

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import pyotherside

def pressme():
    f = open("/home/nemo/Documents/file.txt","a")
    f.write("this is example text")
    f.close()