Software: modifications and extensions Toon

Everything about software tools, new software development and toolchains. For developers, mostly.

Moderators: marcelr, TheHogNL, Toonz

Toonz
Forum Moderator
Forum Moderator
Posts: 1873
Joined: Mon Dec 19, 2016 1:58 pm

Re: Software: modifications and extensions Toon

Post by Toonz »

hvxl wrote:One remark, editing the location variable on line 108 of BuienradarApp.qml doesn't really help much as you still have 6344 hardcoded on line 132. Obviously you intended that to be location.
Thanks for spotting :-). Is corrected now.....
hvxl wrote:In addition, through experimentation I have found out that you can access the attributes this way:
  • cNode.attributes["zin"].value
Or if you prefer:
  • cNode.attributes.zin.value
Still can't get it to work. Which software version do you have on Toon (I am running 3.1.22)?
member of the Toon Software Collective
RomMon
Starting Member
Starting Member
Posts: 44
Joined: Mon Aug 29, 2016 9:05 pm

Re: Software: modifications and extensions Toon

Post by RomMon »

I'm also interested in finding the console.log("") output, but so far have not found it.

Hooked up a serial cable to Toon, but also on there no console output.
Compiled ttylog (https://sourceforge.net/projects/ttylog) but unfortunately only causes the connection (e.g. /dev/ttymxc0) to lockup.
Toonz
Forum Moderator
Forum Moderator
Posts: 1873
Joined: Mon Dec 19, 2016 1:58 pm

Re: Software: modifications and extensions Toon

Post by Toonz »

RomMon wrote:I'm also interested in finding the console.log("") output, but so far have not found it.

Hooked up a serial cable to Toon, but also on there no console output.
Compiled ttylog (https://sourceforge.net/projects/ttylog) but unfortunately only causes the connection (e.g. /dev/ttymxc0) to lockup.
I believe having read that console.log() will show information in the log screen of QtCreator. I haven't played around with QtCreator yet... will give it a go soonish.....(not sure if it is compatible with the QT implementation on Toon).
member of the Toon Software Collective
hvxl
Senior Member
Senior Member
Posts: 1965
Joined: Sat Jun 05, 2010 11:59 am
Contact:

Re: Software: modifications and extensions Toon

Post by hvxl »

Toonz wrote:Which software version do you have on Toon (I am running 3.1.22)?
3.2.18. But I would be very surprised if this was a recent addition.

This is what I now have in BuienradarApp.qml (lines 146 - 150):

Code: Select all

        if (cNode.tagName === "icoonactueel") {
                icoonlink = cNode.firstChild.nodeValue;
                icoonid = cNode.attributes["ID"].value;
                icoonzin = cNode.attributes["zin"].value;
        }
And I added this to BuienradarTile.qml:

Code: Select all

        Text {                                                                                 
                id: buienradarTileTitleText3
                text: app.icoonzin
                anchors {
                        baseline: parent.top
                        baselineOffset: 90
                        horizontalCenter: parent.horizontalCenter
                }
                font {
                        family: qfont.regular.name
                        pixelSize: 18
                }
                color: colors.clockTileColor
        }
Resulting in a tile like this:
toon1.png
toon1.png (6.78 KiB) Viewed 14935 times
Schelte
Toonz
Forum Moderator
Forum Moderator
Posts: 1873
Joined: Mon Dec 19, 2016 1:58 pm

Re: Software: modifications and extensions Toon

Post by Toonz »

Hvxl,

thanks a lot, this does it. Looking good on the tile as well.
I must have been getting blind looking at these two lines the past week ;-).

My current WIP is the addition of the weather station selection screens (based on the original Eneco weather app).
I also want to redesign the detail screen: make the weather forecast text box scrollable and smaller to allow more room for the 5 days forecast (want to add the daily wind forecast there).

Next pipeline project will be similar: create a traffic app (there is a similar public XML feed as well for that).

Many thanks for your support, much appreciated.
member of the Toon Software Collective
marcelr
Global Moderator
Global Moderator
Posts: 1153
Joined: Thu May 10, 2012 10:58 pm
Location: Ehv

Re: Software: modifications and extensions Toon

Post by marcelr »

3.2.18. But I would be very surprised if this was a recent addition.
Correct, the qt libraries (package qt-libs - 5.3.1-06-setpos) were introduced in fw 3.0.29 and haven't been updated since.
Thanks Toonz, for your weather tile. Looks good.
RomMon
Starting Member
Starting Member
Posts: 44
Joined: Mon Aug 29, 2016 9:05 pm

Re: Software: modifications and extensions Toon

Post by RomMon »

Hvxl,

Nice find.
How did you find that?
From http://doc.qt.io/qt-4.8/qdeclarativeglobalobject.html I can see it should be supported. But how the commands structure should be is unclear to me.

Toonz,
The new version is looking nice.

I suspect that in the following lines you are missing 'var' (doesn't seem to cause issues on the Toon, but with html it did).
Also suspect that location is a reserved keyword in Qt. With html it tried to open a file "6344" each time.
location = "6344";
locationName = "Rotterdam";
And on line 132 you still have the location code hardcoded.
Toonz
Forum Moderator
Forum Moderator
Posts: 1873
Joined: Mon Dec 19, 2016 1:58 pm

Re: Software: modifications and extensions Toon

Post by Toonz »

Hi RomMon,

Thanks for the comments. Hereby the latest WIP version:
changelog:
- 'var' added to the lines above
- removed the hardcoded filter on '6344'. 'Location is now used as selection filter as it should (thanks to RomMon)
- ID and zin tags now properly populated and added to the tile (thanks to HvxL)
- added the date/time of the latest weatherforecast from your favourite weatherstation to the detailed screen
- changed the refresh cycle from 15 minutes to 10 minutes to match the XML refresh rate on the buienradar server.
- as a teaser: I added a button to the Details screen ('Weerstation') to allow selection of your favourite weatherstation in the next release (you can press it now but nothing happens yet).

thanks for all your support on this forum, to be continued.....

EDIT (marcelr): Attachment removed, stable version of the app to be found in the Downloads thread.
member of the Toon Software Collective
marcelr
Global Moderator
Global Moderator
Posts: 1153
Joined: Thu May 10, 2012 10:58 pm
Location: Ehv

Re: Software: modifications and extensions Toon

Post by marcelr »

@RomMon

All output from the code started in inittab is redirected to /dev/null:

from /etc/init.d/HCBv2:

Code: Select all

inittabwrap()
{
	cd ${PREFIX}/sbin
	# let hcb_comm restart fast
	if [ "${XTRAARG}" != "hcb_comm" ]
	then
		sleep 1 # prevent mega-rapid-hcb-comm-reconnects :P
	fi
	# replace current exec context with binary
	exec ${PREFIX}/sbin/${XTRAARG} --daemon >/dev/null 2>/dev/null
}
in this shell script, XTRAARG is the executable to be run (everything in/HCBv2/sbin, passed one by one to inittabwrap() ).

If you add an extra line with exceptional behaviour for qt-gui, you should be able to send the output to wherever you want it (to stdout and stderr in this case:).

Code: Select all

if [ "${XTRAARG}" != "qt-gui" ] 
then
  exec ${PREFIX}/sbin/${XTRAARG} --daemon >/dev/null 2>/dev/null # normal behaviour
else
  exec ${PREFIX}/sbin/${XTRAARG} --daemon                        # tweaked
fi
or something along these lines.
You should be aware of the fact that toon's executables are very talkative. I didn't test qt-gui, but e.g., happ_thermstat spits out megabytes of console output in a matter of minutes.
marcelr
Global Moderator
Global Moderator
Posts: 1153
Joined: Thu May 10, 2012 10:58 pm
Location: Ehv

Re: Software: modifications and extensions Toon

Post by marcelr »

Hmm, maybe adding the text for the weather type is not always a good idea ;-) :
(never mind the colour map, it's a frame buffer dump, converted to a jpeg in the GIMP, RGB should be reversed to BGR).
Attachments
screenshot.jpg
screenshot.jpg (40.24 KiB) Viewed 15178 times
marcelr
Global Moderator
Global Moderator
Posts: 1153
Joined: Thu May 10, 2012 10:58 pm
Location: Ehv

Re: Software: modifications and extensions Toon

Post by marcelr »

@RomMon

I tested a little more.
It's a bit more complex than the standard start-up from inittab.
qt-gui has a wrapper script in between, startqt. This script adds command line arguments and also redirects everything to /dev/null.

For now, I tested the following and found it to be working:

Code: Select all

killall qt-gui; /HCBv2/sbin/qt-gui -platform linuxfb -plugin Tslib --daemon 2>&1
Execute this command in a terminal (on a _single_ line), and watch all output fly by. By the time you can start handling the gui, output rates calm down a little and you can see what's going on, including console.log() output :-).

I tried redirection to a fifo and then grep for relevant output, but that increases resources demand to a level sufficient to hang the machine in a few minutes.
Toonz
Forum Moderator
Forum Moderator
Posts: 1873
Joined: Mon Dec 19, 2016 1:58 pm

Re: Software: modifications and extensions Toon

Post by Toonz »

marcelr wrote:Hmm, maybe adding the text for the weather type is not always a good idea ;-)
funny, it has only been 'Bewolkt' here since I started....
I now truncated the string if longer then 21 characters, your example now showing as 'heldere lucht en hier...""
Will be included in the next upload.
Thanks for flagging.
member of the Toon Software Collective
Toonz
Forum Moderator
Forum Moderator
Posts: 1873
Joined: Mon Dec 19, 2016 1:58 pm

Re: Software: modifications and extensions Toon

Post by Toonz »

Latest buienradar app:

changelog:
- weather stations now selectable via maps
- added 'Bf' to wind line on tile (thanks Marcel for the example).
- 'Zin' text is truncated when too long for the tile (thanks Marcel).
- added this app to the menu of Toon

to do:
- redesign the detail screen: make the weather forecast text box scrollable and smaller;expand the 5 days forecast with daily wind forecasts. Cosmetic improvements
- store station selection permanently

Note on selection of weather stations:
- default station at startup is entered in BuienradarApp.qml line 18/19
- weather stations which are not yet selectable via the maps (don't know why Eneco didn't include these) can be entered in line 18/19 as well:
"6308" : "Cadzand";
"6283" : "Groenlo";
"6315" : "Hansweert";
"6258" : "Houtribdijk";
"6285" : "Schiermonnikoog";
"6209" : "IJmond";
"6225" : "IJmuiden";
"6320" : "Goeree";
"6312" : "Oosterschelde";
"6316" : "Schaar";
"6324" : "Stavenisse";
"6331" : "Tholen";
"6313" : "Vlakte ad Raan";
"6215" : "Voorschoten";
"6248" : "Wijdenes";
"6257" : "Wijk aan Zee";

- if I really have time on a rainy day I might add these to the maps as well ;-)

Request for help: I want to write the selected weather station to a local text file to use as startup value after a reboot. Reading values from a text file is easy in QML. However, in QML (using FileIO) it is not possible to write local files I believe. It might require c++ programming to create a plugin but that is beyond my skills.

P.S. Marcel, your solution to watch the console.log output has been invaluable the last days, finally proper error messages when loading the apps. Many thanks for that!

EDIT (marcelr): Attachment removed, stable version of the app to be found in the Downloads thread.
member of the Toon Software Collective
marcelr
Global Moderator
Global Moderator
Posts: 1153
Joined: Thu May 10, 2012 10:58 pm
Location: Ehv

Re: Software: modifications and extensions Toon

Post by marcelr »

@Toonz,

For my toon, I added air pressure and changed the layout of the tile a little. See attached zip file. Mind you, it's a set of patched files only, so you still need the original from Toonz.
Need to squeeze in relative humidity and then it starts to look like an old school weather station (temperature, atmospheric pressure, relative humidity ;-) ).
Line truncation works, see attached tile.

This application helps me to finally learn some qml and javascript (learned to program when algol60 was still fashionable ...). I'm a complete newbie when it comes to those scripting languages, so thanks again for your efforts.

According to some guys at stackoverflow it is possible to do file IO in qml (5.6, not sure if 5.3.1 already has it, and then need to check toon's qt libraries):

http://stackoverflow.com/questions/1788 ... -in-qml-qt

EDIT: removed download file. You can find stable versions of the buienradar app in the Downloads thread.
Attachments
tile.jpg
tile.jpg (9.44 KiB) Viewed 15042 times
Toonz
Forum Moderator
Forum Moderator
Posts: 1873
Joined: Mon Dec 19, 2016 1:58 pm

Re: Software: modifications and extensions Toon

Post by Toonz »

Next release....buienradar.

changelog:
- added airpressure (luchtdruk) to tile (thanks Marcel)
- added chill temperature (gevoelstemperatuur) to tile.
- added relative humidity (relatieve luchtvochtigheid) to tile
- reformatted tile (main temp in bold, changed relative positions)
- details screen weather forecast text is now smaller and scrollable (swipe like on your phone)

todo:
- add 5-day wind forecast to details screen

EDIT (marcelr): Attachment removed, stable version of the app to be found in the Downloads thread.
member of the Toon Software Collective
Post Reply

Return to “Toon software development”