UBports Robot Logo UBports Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Porting my Qml + Python app to Ubports(Beginner)

    Scheduled Pinned Locked Moved Solved App Development
    16 Posts 6 Posters 1.6k Views 3 Watching
    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.
      • AppLeeA Offline
        AppLee @aarontheissueguy
        last edited by

        Hi @aarontheissueguy

        Did you create a click package ?
        I think you can achieve your goal with copying the correct file at the right location, but it's easier to create a click file and install it after pushing it to your device.

        A 1 Reply Last reply Reply Quote 1
        • M Offline
          makeixo
          last edited by

          šŸ“

          1 Reply Last reply Reply Quote 1
          • A Offline
            aarontheissueguy @AppLee
            last edited by

            @applee Yes, you can find it in the build directory of the projekt or make it yourself with clickable.

            AppLeeA 1 Reply Last reply Reply Quote 0
            • A Offline
              aarontheissueguy @jonius
              last edited by

              @jonius A small update:
              I managed to get

              clickable desktop
              

              working! by putting the files that were stored in the data directory into the src directory. It still does not work on mobile though šŸ˜ž . Small steps ...

              lduboeufL 1 Reply Last reply Reply Quote 0
              • lduboeufL Offline
                lduboeuf @aarontheissueguy
                last edited by

                @aarontheissueguy do you have some logs ? clickable logs

                A 1 Reply Last reply Reply Quote 1
                • AppLeeA Offline
                  AppLee @aarontheissueguy
                  last edited by

                  @aarontheissueguy
                  Oh, yes I see.
                  Sorry it was a quick answer, I didn't look at the github.
                  Another wild guess, but maybe some apparmor rights for the data files. But I don't remember any requirements for internal data organization or right management...

                  1 Reply Last reply Reply Quote 1
                  • A Offline
                    aarontheissueguy @lduboeuf
                    last edited by

                    @lduboeuf Here are the logs for the code in the reposetory on mobile:

                    Pseudo-terminal will not be allocated because stdin is not a terminal.
                    Welcome to Ubuntu 16.04.7 LTS (GNU/Linux 4.4.146+ aarch64)
                    
                     * Documentation:  https://help.ubuntu.com
                     * Management:     https://landscape.canonical.com
                     * Support:        https://ubuntu.com/advantage
                    "PyOtherSide error: Traceback (most recent call last):\n\n  File \"<string>\", line 1, in <module>\n\nNameError: name 'main' is not defined\n"
                    Unhandled PyOtherSide error: Function not found: 'main.progressImage' (Traceback (most recent call last):
                    
                      File "<string>", line 1, in <module>
                    
                    NameError: name 'main' is not defined
                    )
                    qml: after call of progressImage
                    Unhandled PyOtherSide error: file:///opt/click.ubuntu.com/watercount.aaron/1.0.0/qml/Main.qml:196: Error: Cannot assign [undefined] to QUrl
                    QObject::startTimer: Timers cannot be started from another thread
                    "PyOtherSide error: Traceback (most recent call last):\n\n  File \"<string>\", line 1, in <module>\n\nNameError: name 'main' is not defined\n"
                    Unhandled PyOtherSide error: Function not found: 'main.addWater' (Traceback (most recent call last):
                    
                      File "<string>", line 1, in <module>
                    
                    NameError: name 'main' is not defined
                    )
                    qml: after call of addWater
                    "PyOtherSide error: Traceback (most recent call last):\n\n  File \"<string>\", line 1, in <module>\n\nNameError: name 'main' is not defined\n"
                    Unhandled PyOtherSide error: Function not found: 'main.progressImage' (Traceback (most recent call last):
                    
                      File "<string>", line 1, in <module>
                    
                    NameError: name 'main' is not defined
                    )
                    qml: after call of progressImage
                    Unhandled PyOtherSide error: file:///opt/click.ubuntu.com/watercount.aaron/1.0.0/qml/Main.qml:63: Error: Cannot assign [undefined] to QUrl
                    "PyOtherSide error: Traceback (most recent call last):\n\n  File \"<string>\", line 1, in <module>\n\nNameError: name 'main' is not defined\n"
                    Unhandled PyOtherSide error: Function not found: 'main.progressPercent' (Traceback (most recent call last):
                    
                      File "<string>", line 1, in <module>
                    
                    NameError: name 'main' is not defined
                    )
                    qml: after call of progressPercent
                    
                    
                    
                    

                    Here are the logs for the same code on desktop(Working)

                    Mounting device home to /home/aaron/.clickable/home
                    QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-aaron'
                    QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-aaron'
                    Failed to create /home/aaron/.cache for shader cache (Permission denied)---disabling.
                    "/home/aaron/projects/WaterCountClickableDesktop/WaterCount/build/all/app/install/%U" does not exist.
                    Got library name:  "/usr/lib/x86_64-linux-gnu/qt5/qml/io/thp/pyotherside/libpyothersideplugin.so"
                    qml: PyOtherSide version: 1.5.3
                    qml: Python version: 3.5.2
                    qml: after importModule
                    qml: after call of progressImage
                    qml: after call of returnGoal
                    qml: after call of returnUnit
                    qml: after call of progressPercent
                    
                    
                    
                    1 Reply Last reply Reply Quote 0
                    • A Offline
                      aarontheissueguy
                      last edited by

                      !Solved (does this work here?) I was able to find a solution by making several changes to my code and reading many.. many.. logs and documentations. If you want to have a closer look at them I recommend taking a look at GitHub but ill try to break it down here anyways:

                      1. Read and write permissions. This gives enough information.
                      2. Non existent directories need to be created manually I added a python function to do that.
                      3. You cant have anything outside of your functions except import stuff because it will cause an error.
                      4. Some smaller formatting problems.

                      I might create an UpToDate beginners guide on this topic because there werent many detailed all in one guides about this topic.

                      LakotaubpL 1 Reply Last reply Reply Quote 2
                      • LakotaubpL Offline
                        Lakotaubp @aarontheissueguy
                        last edited by

                        @aarontheissueguy Ifb you nwant to mark this as solved use Topic Tools (cog wheel top right) ask as question, then mark as solved.

                        A 1 Reply Last reply Reply Quote 0
                        • A Offline
                          aarontheissueguy @Lakotaubp
                          last edited by

                          This post is deleted!
                          1 Reply Last reply Reply Quote 0
                          • joniusJ Offline
                            jonius
                            last edited by

                            Great you solved it. Improved documentation is always a big help! šŸ™‚

                            1 Reply Last reply Reply Quote 0
                            • M Offline
                              makeixo @aarontheissueguy
                              last edited by

                              @aarontheissueguy said in Porting my Qml + Python app to Ubports(Beginner):

                              I have recently started learning Qml and thought it would be fun to make a small App that counts the amount of water you drink per day with a simple GUI.

                              Hi Aaron,

                              can I ask you a question? How did you start with qml? I am learning Python as well. I have written a small and very simple mental arithmetic app. Before I go on I think it may be good to write a simple gui for further development. In the book I use for learning python there is a chapter how you write a gui with ktinker, which you can run at your desktop. I wonder if there is a simple guide for beginners about qml as well.

                              A 1 Reply Last reply Reply Quote 0
                              • A Offline
                                aarontheissueguy @makeixo
                                last edited by

                                @makeixo I used the first episodes of the qml guide on Yputube made by KDAB. Its intendet for c++ but you dont need it to learn the basics. Python + qml is a different topic though. Ubports uses pyotherside for the communication between the two. You can take a look at my app if you want to see how to do it. (its pretty basic) https://github.com/Aarontheissueguy/WaterCount
                                There are some other resources on this forum aswell.

                                With that being said If Python is your first language, I recomend that you concentrate on learning it first. GUI's are'nt really that important for many fun personal projects. You can still come back to this project one or two months down the road of learning python. Feel free to ask again if you have a question.

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