• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
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.5k 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.
    • J Offline
      jonius @aarontheissueguy
      last edited by 3 Jan 2021, 18:07

      @aarontheissueguy does it work in Desktop Mode (clickable desktop)? Could you upload the whole app and clickable config somewhere (e.g. Gitlab) and provide the link?

      A 2 Replies Last reply 3 Jan 2021, 19:25 Reply Quote 1
      • A Offline
        aarontheissueguy @jonius
        last edited by 3 Jan 2021, 19:25

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

        clickable desktop

        Ok I decided to reorganize my project and add some comments to make it more structured. Clickable desktop returns pretty much the same result as on mobile. I uploaded the updated version on GitHub https://github.com/Aarontheissueguy/WaterCount a Clickable is included in the build directory. Thanks for taking the time. I have no Idea what is causing the issue.

        A 1 Reply Last reply 3 Jan 2021, 19:52 Reply Quote 0
        • A Offline
          AppLee @aarontheissueguy
          last edited by 3 Jan 2021, 19:52

          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 3 Jan 2021, 20:36 Reply Quote 1
          • M Offline
            makeixo
            last edited by 3 Jan 2021, 20:02

            šŸ“

            1 Reply Last reply Reply Quote 1
            • A Offline
              aarontheissueguy @AppLee
              last edited by 3 Jan 2021, 20:36

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

              A 1 Reply Last reply 3 Jan 2021, 22:17 Reply Quote 0
              • A Offline
                aarontheissueguy @jonius
                last edited by 3 Jan 2021, 21:01

                @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 ...

                L 1 Reply Last reply 3 Jan 2021, 21:47 Reply Quote 0
                • L Offline
                  lduboeuf @aarontheissueguy
                  last edited by 3 Jan 2021, 21:47

                  @aarontheissueguy do you have some logs ? clickable logs

                  A 1 Reply Last reply 4 Jan 2021, 02:16 Reply Quote 1
                  • A Offline
                    AppLee @aarontheissueguy
                    last edited by 3 Jan 2021, 22:17

                    @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 4 Jan 2021, 02:16

                      @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 4 Jan 2021, 21:36

                        !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.

                        L 1 Reply Last reply 5 Jan 2021, 11:37 Reply Quote 2
                        • L Offline
                          Lakotaubp @aarontheissueguy
                          last edited by 5 Jan 2021, 11:37

                          @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 5 Jan 2021, 19:27 Reply Quote 0
                          • A Offline
                            aarontheissueguy @Lakotaubp
                            last edited by 5 Jan 2021, 19:27

                            This post is deleted!
                            1 Reply Last reply Reply Quote 0
                            • J Offline
                              jonius
                              last edited by 6 Jan 2021, 10:56

                              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 16 Jan 2021, 15:30

                                @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 20 Jan 2021, 21:07 Reply Quote 0
                                • A Offline
                                  aarontheissueguy @makeixo
                                  last edited by 20 Jan 2021, 21:07

                                  @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