Navigation

    UBports Robot Logo

    UBports Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Right. Can any kind, beautiful soul give me a quide that will result in a PyQt-related hello-world app?

    App Development
    2
    2
    220
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      BlandCorporation last edited by BlandCorporation

      Mar sin! I've got my 16.05 PRO5 here and I'd love to start throwing what are essentially PyQt5 Python programs at it. Not looking for perfection, just some basic functionality with a window appearing, buttons, that sort of jazz, lotsa nice Python happenings in the backgrounde. Now, much as I'd like pure Python, in the world of Ubuntu Touch I see the push towards QML and pyotherside, well ok.

      So, I've been scurrying about trying to install pyotherside (version 1.4) and finding myself meddling with qmlscene (qmlscene: could not find a Qt installation of '' blargh!). I'm happy to dive into proper QML but at this point would be happy with a simple Python "hello world" printout appearing in a window on an Ubuntu Touch device. Could someone guide me to completion on how to accomplish this?

      qtchooser -list-versions gives me the following:

      4
      5
      qt4-arm-linux-gnueabihf
      qt4
      qt5-arm-linux-gnueabhif
      qt5
      

      I have a small program like this:

      // hello.qml
      import QtQuick 2.0
      *import io.thp.pyotherside 1.4
      
      Rectangle {
          width: 640; height: 480
          color: "#E95420"
          Label { id: label; text: "Nothing here yet" }
          MouseArea {
              anchors.fill: parent
              onClicked: {
                  py.addImportPath(Qt.resolvedUrl("."));
                  py.importModule("hello", function(){
                      label.text = call_sync("hello_world");
                  });
              }
          }
      *   Python { id: py }
      }
      
      # hello.py
      
      def hello_world():
          return "Hello from Python!"
      

      When I run qmlscene hello.qml (or similar) I get a bunch of Mir-related gibberish, excerpts of which are:

      [QPA QMirClientClientIntegration: connection to Mir server failed.
      
      Mir returned "Failed to connect: not accepted by server"
      

      That sorta shite.

      So, what've ya got for me, ma expert and extremely leet boos?

      H 1 Reply Last reply Reply Quote 0
      • H
        hummlbach @BlandCorporation last edited by hummlbach

        Hi @BlandCorporation!

        Have you already seen that: https://github.com/timsueberkrueb/ubports-gettogether/blob/master/timsueberkrueb/pyotherside/presentation.md
        Maybe that can help a bit. (Meanwhile pyotherside is in the rootfs, so you can skip the part about shipping it with your app.)
        If you don't want to use clickable to properly deploy and install your app for any reason, you might be interested in the command line option --desktop_file_hint=<path to a desktop>.
        Example with enigma (qml/python app):

        phablet@ubuntu-phablet:~$ qmlscene --desktop_file_hint=./.cache/ubuntu-app-launch/desktop/enigma.hummlbach_Keylock_0.2.0.desktop /opt/click.ubuntu.com/enigma.hummlbach/current/qml/ui/Main.qml 
        

        You may want to copy the desktop file from another app and adapt it for you. (Not quite sure what else you to take care off... 😁)

        1 Reply Last reply Reply Quote 0
        • First post
          Last post