Porting my Qml + Python app to Ubports(Beginner)
-
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. -
-
@applee Yes, you can find it in the build directory of the projekt or make it yourself with clickable.
-
@jonius A small update:
I managed to getclickable 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 ...
-
@aarontheissueguy do you have some logs ?
clickable logs
-
@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... -
@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
-
!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:
- Read and write permissions. This gives enough information.
- Non existent directories need to be created manually I added a python function to do that.
- You cant have anything outside of your functions except import stuff because it will cause an error.
- 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.
-
@aarontheissueguy Ifb you nwant to mark this as solved use Topic Tools (cog wheel top right) ask as question, then mark as solved.
-
This post is deleted! -
Great you solved it. Improved documentation is always a big help!
-
@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.
-
@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.