WIP: Plasma World Map Wallpaper & World Clock Applet, powered by Marble

The core of Marble, the virtual globe and world atlas, is a library, intended for reuse. Next to exposing its native C++ interface (see API dox of development version of the Marble library), there is also the option to use it in a QtQuick variant.

The Marble code repository itself holds a few application and tools based on the library. Additionally it also has extensions & plugins for other applications & workspaces, like the KIO thumbnailer plugins for previews of KML, KMZ, GPX & GEOJSON files in KIO-using file manager or file dialogs, a Plasma Runner plugin for looking up geo coordinates or a world clock Plasma applet.

Moving to Plasma5, Marble KRunner plugin arrives first

Having extensions for external applications & workspaces in your repo requires yourself to keep up-to-date with those externals. When Plasma5 appeared with the big switch to QML-only plugin architecture, that left the Marble-based plugins a little behind for now.

Good news is that the KRunner/Plasma Runner plugin was not affected by that, and with “KDE Applications 16.08” and the new Marble release will now also be out in a version working in all locales this month.

Reviving the Marble world clock plasmoid from 2009

The Marble world clock plasmoid, introduced already in 2009 (see bottom of page), though needs a full rewrite, from C++ to QML, which is a bigger undertaking. It also needs a port from KTimeZone & KTimeZoneWidget to QTimeZone, and in that course a cleanup of the mapping between time zones to geocoordinates.

Good news here is that some initial work has been done now and is up for review. A lot of the features are still missing, and there are some glitches (e.g. vertical offset, license info displayed). But it is a start, and the current state might be even fancy enough for some users already 🙂 So it should see a first release with “KDE Applications 16.12”.

It is a small mutation from a Plasma Applet to a Plasma Wallpaper

With the applet initially working, the idea came to have the map also shown fullscreen as wallpaper. While I could not find documentation how to do a wallpaper plugin, the existing code and examples though gave enough hints, and one hour later there was the first incarnation of a Marble-powered Plasma Wallpaper plugin.

See here a screenshot with both the World Map Wallpaper and the World Clock Applet in their current state:
Plasma World Map wallpaper & world clock applet, powered by Marble

Tell what kind of world maps you want to see as wallpaper

Because the World Map wallpaper can make full use of all Marble plugins, a lot of different kind of setups are possible:

  • Plain political map view
  • Globe view with stars in the background
  • Map view of just a continent/country
  • Satellite-photos-based view with live cloud rendering

There could be also plugin variants for the Moon, Venus or Mars.

So start Marble, play around with the settings to learn what is possible. Then tell in the comments what other kind of maps (or globe views) you would like to use for a wallpaper, so we could consider them as predefined settings at least.
As with the rewrite of the World Clock applet, a first release of the World Map wallpaper(s?) should happen with “KDE Applications 16.12”.

Create your own Plasma Wallpaper quickly by a new template

BTW, if you have other fancy ideas for Plasma “Wallpapers”, as by-product I did a template for Plasma Wallpaper plugins. It is currently up for review, so hopefully will be part of future KF5 Plasma frameworks releases. With that template, your first own wallpaper plugin is just a few clicks away e.g. in KAppTemplate or KDevelop.
Update: Until it arrives in releases, for now you can download the template file plasma-wallpaper.tar.bz2 from here and manually install it by moving that file into the folder /usr/share/kdevappwizard/templates/.
When playing around with the wallpaper settings, be aware there might be at least the issue of the wallpaper config page not reading current/default settings when switching the wallpaper type. As workaround, after switching the wallpaper type, one first has to close and reopen the dialog to be able to adjust the settings of the new wallpaper type.

Plasma Weather widget: code template available to add your favorite weather data provider

Quick recap

Plasma 5.6 has finally seen the return of the Plasma Add-ons Weather widget, which had been missing the port from Plasma4.
Next, the Weather widget does not talk to any weather data providers directly, instead it talks to a weather dataengine (currently part of the Plasma Workspace module), to query for any weather stations matching the entered location search string when configuring the widget and to subscribe to the data feed for a given weather station from a given weather data provider.
That weather dataengine itself again also does not talk directly to any weather data providers. Instead it relies on an extendable set of sub-dataengines, one per weather data provider. So-called “ion”s.

Currently there are only 3 ions part of Plasma: wetter.com (private company running wetter.com), envcan (Environment Canada, by Government of Canada), noaa (USA’s National Oceanic and Atmospheric Administration). That is not enough, right.

Get quickly started with a working template

Time to add an ion for your favourite weather data provider. An ion can be independently developed by everyone, no need to do this in the plasma-workspace module (though it would be great if your ion ends up there once it is working, so it can be shared more easily).

To allow you a quick start with your own ion development, for the next version of the Plasma, 5.7, a code template (in the kapptemplate format, as supported by KAppTemplate or KDevelop) has been added. So when installing the development packages for Plasma Workspace (e.g. “plasma5-workspace-devel”), there should be also a “Plasma Weather Ion Dataengine” code template available, in the “KDE/Plasma Dataengine” folder.

Until Plasma 5.7 is released, download a snapshot of the ion code template. This snapshot also works with Plasma 5.6. You will need to have the development packages for Plasma Workspace installed, so the “plasma/weather/ion.h” header is available.
To use the template with KDevelop, select in the menu “Project”/”New From Template…” and click the button “Load Template From File” to add the template to the list. Then select the template and follow the dialog.
To use it with KAppTemplate, you need to manually install the file in “/usr/share/kdevappwizard/templates/” and (for KAppTemplate before Applications 16.04) also add a dummy PNG file to “/usr/share/kdevappwizard/template_previews/“, with the same base name as the template, “ion-dataengine.png“.
If the template does not work for you (please tell in the comments if), download this sample ion zip file, made from the template and the name “trueweather”, and start from that.

Follow the “README” in the sources and learn how to build, install and test your ion dataengine, e.g. how to query it via the Weather dataengine with the Plasma Engine Explorer:
trueweather ion dataengine in Plasma Engine Explorer

Learn more details about the Plasma Weather dataengine system in the last blog post.

Do not hesitate to ask for help on the #plasma irc channel and the plasma-devel mailinglist.

Plasma Weather widget: add your favorite weather data provider

So Plasma 5.6 has seen the revival of the Weather widget that is part of KDE Plasma Add-ons module (revival as in: ported from Plasma4 API to Plasma5 API).
(And even got the interesting honour to be mentioned as the selling item in the headline of a Plasma 5.6 release news article by a bigger German IT news site, oh well 🙂 )

This revival was concentrating for 5.6 to restore the widget in its old state, without any bugs. But that’s not where things are to end now…

And you, yes, you, are invited and even called in to help with improving the widget, and especially for connecting to more weather data providers, incl. your favourite one.

For a start, let’s list the current plans for the Weather widget when looking at the next Plasma release, 5.7:

  • Overhaul of look (IN PROGRESS)
  • Breeze-style weather state icons (IN PROGRESS)
  • also temperature displayed in compact widget variant, like on panel (TODO)
  • support for more weather data providers (YOUR? TODO)
  • privacy control which weather data providers are queried on finding weather stations (YOUR? TODO)

Overhaul of widget look

The KDE meta sprint at CERN (of groups WikiToLearn, Plasma, VDG, techbase wiki cleanup) at begin of this March, where I mainly went for techbase wiki cleanup work, of course was a great occasion to also work face-to-face with Plasma developers and VDG members on issues around the Weather widget, and so we did. Marco helped me to learn more about Plasma5 technologies which resulted in some small bugs fixed in the widget still in time for Plasma 5.6 release.
Ken presented me the drafts for the look & design and the config of the weather widget that he had prepared before the sprint, which we then discussed. Some proposals for the config could already be applied in time for Plasma 5.6 release (those without need for changed UI texts, to not mess the work of the translators). The rest of it, especially the new look & layout of the widget, is soon going to be transferred from our minds, the notes and the photos taken from the sketches on the whiteboard at CERN into real code.

Breeze-style weather state icons

Ken also did a Breeze style set of the currently used weather state icons. While touching the icons, a few icon naming issues are going to be handled as well (e.g. resolving inconsistent naming pattern or deviation from the weather state icon names actually defined in the XDG icon naming spec (see Table 12. Standard Status Icons). Should soon be done as well.

Temperature display in compact widget variant

One thing that has been missing also from the old version of the Weather widget is the display of the current temperature in the compact widget variant, where now only the current weather condition is shown (e.g. when on the panel). While some weather data providers (like wetter.com) do not provide that detail, so there is nothing to display, others do, and often it is pretty nice to know (clear sky can happen with temperatures of any kind, so it’s good information about if and then what kind of jacket to put on before stepping outside). First code is drafted.

Now, finally the things were you can improve things for yourself and others:

Supporting more weather data providers

The Weather widget does not talk to any weather data providers directly. Instead it talks to a weather dataengine (currently part of the Plasma Workspace module), to query for any weather stations matching the entered location search string when configuring the widget and to subscribe to the data feed for a given weather station from a given weather data provider.
That weather dataengine itself again also does not talk directly to any weather data providers. Instead it relies on an extendable set of sub-dataengines, one per weather data provider.

The idea here is to have by the one weather dataengine an abstraction layer (he, after all this is KDE software 😉 ) which maps all weather data services into a generic one, so any UI, like the Weather widget, only needs to talk one language to whoever delivers the data.
Which works, more or less. Because of course there are quite some weather data specifications out there, what else did we expect 😛 And possibly the spec interpretations also vary as usual.

((You might think: “Well, screw that over, there is only one user of the weather dataengine, so integrate that directly into the Weather widget!”
While that might be true right now, it does not need to stay this way. There are ideas like showing the weather forecast also with the days in Plasma calendar widgets. Having a KRunner plugin to quickly request weather in some place. Or having a wallpaper updater reflecting the current weather by showing matching images, yes, not everyone has the joy to work close to a window, enjoy if you do. And also alternative weather widgets with another UI, remember also the WeatherStation widget in kdeplasma-addons (still waiting for someone to port it), which focussed on details of the current weather state. These kind of usages might prefer a normalized model of weather data as well, instead of needing custom code for each and any provider again. Actually long-term such a model would be interesting outside of Plasma spheres, e.g. for any calendaring apps, for a plugin for Marble-based apps showing weather states over a map or whatever other fancy uses there can be. Feel free to share ideas in the comments, to improve motivation for creating such a Plasma-independent lib!))

While I only took over kind of maintainership in the last weeks, so did not design the current system myself, I still think it’s a good approach, having in mind reusable UIs and relative independence from any given weather data providers. So for now I do not plan to dump that, simply lacking a more promising alternative.

So, given you are still reading this and thus showing me and yourself your interest 🙂 let’s have a closer look:

The sub-dataengines for the different weather data providers have been named “ion”s. On the code level they are subclasses of a class IonInterface, which itself is a subclass of Plasma::DataEngine.
See here for the header defining IonInterface: https://quickgit.kde.org/?p=plasma-workspace.git&a=blob&f=dataengines%2Fweather%2Fions%2Fion.h

This header and the respective lib libweather_ion are public and should be installed with the devel packages of Plasma Workspace. Which means you should be able to develop your custom ion as 3rd-party developer without the need to checkout the plasma-workspace repository and develop it in there.

Plasma 5.6 itself installs three such ions:

  • wetter.com: adapter to service of the private company running wetter.com
  • envcan: adapter to service of Environment Canada, by Government of Canada
  • noaa: adapter to service of USA’s National Oceanic and Atmospheric Administration

Find their sources here: https://quickgit.kde.org/?p=plasma-workspace.git&a=tree&f=dataengines%2Fweather%2Fions

In that source folder you will also spot a bbcukmet ion, for the BBC weather service. While being ported to build and install at least with Plasma5, the service API of BBC as used by the code seems to have been either changed or even removed. So that ion is currently disabled from the build (uncomment the #add_subdirectory(bbcukmet) to readd it to the build). Investigations welcome.
Update: There are patches for the Plasma4 version of the bbcukmet ion to make it work again with current BBC service API. See below in the comments for detailed info. Should be easy work and a chance to contribute also for beginners.
Update2: Those patches have been used to restore the bbcukmet ion, it will be part of Plasma 5.6.2 and later. Still would be good to have someone look closer at it, there is room for improvements.

Another old ion which though already got removed during the revival was a more fun one: there used to be a Debian “weather” service (random related blog post), which reported the status of Debian-based distros by number of working packages as weather reports, and this ion connected to them. But the service died some years ago, so the ion was just dead code now (find the unported code in versions of “Plasma 5.5” and before)

Talking about funny weather reports: why not write an ion for the CI system Jenkins, e.g. with build.kde.org, which while perhaps not being able to give forecasts at least reports the current build state, with builds mapped to stations. After all the short report for a build uses the weather metaphor, see https://build.kde.org/ 🙂

For more serious weather data provider ions again, as you surely know or can guess, there are many more public & private weather data providers than those 3 currently supported. And they not only may have a better coverage of your local area, but might also provide more data or more suited ones.

Please also see the proposal for using “weather data from the open data initiatives” in a comment on the first blog post on the Weather widget.

It would be great to have a larger selection of weather data providers supported in Plasma 5.7. So while having your ion as 3rd-party plugin somewhere else is fine, consider maintaining it inside one of the Plasma repositories, either with the existing ions in the repo plasma-workspace or as part of addons in the repo kdeplasma-addons. This should ensure more users and also more co-developers.

Do a good check of the licenses for using the data services of the weather data providers. Especially public ones should be fine given their purpose, but if in doubt after reading the details, ask the providers.

Privacy control

One issue in the old and current Weather widget code is that when searching for a weather station suiting the users desire, as expressed by the location search string, all currently installed ions are queried. Which of course is a problem from a privacy point of view. And will be worse the more ions there will be.

So there needs to be a way to limit the scope of ions that would be queried. Given that dataengines by design should be used by all kind of dataengine consumers, a Weather widget-only solution might be only a short jump here. There are very possibly other Plasma modules talking to remote services as well, like geolocation services. And ideally one is able to control system-wide (so even beyond Plasma scope) which remote services are allowed and which not.

Until such a global solution exists a Weather widget-only solution is better than nothing surely. Still, it needs to be designed UI-wise, so a job to be picked up by someone 🙂

Getting started with your own ion

So while I am currently impeded these days from hacking, among other things by waiting for new development-capable hardware being delivered (disadvantage of small towns: need to use an online shop for special hardware desires, and there latency unit is days, not minutes, especially bad when wrong stuff is delivered and then also holidays get into the game. Looking on the bright side of life, my old hardware only broke right after the CERN sprint, not before 🙂 )…
… Do not hesitate to look into things already. I would have liked to provide a KAppTemplate-package with an ion sample in this post already, so you could experiment right away. But perhaps you are experienced enough to get a new ion working by looking at the existing ones. If not, in a few weeks hopefully there should be a template, so watch out.
Update: There is now such a template, see this blog post.

And do not hesitate to ask for support on #plasma on irc or on the Plasma mailinglist, I received lots of help there with the Weather widget porting, so you should when trying to write an ion 🙂

Will the Addons Weather widget be revived for Plasma 5.6?

If you are deep in coding mode and cannot afford to turn your head or even your eyes to look through the window at outside to check the current weather… or if you are deep down below ground plumbing at your black hole farming machine and now preparing your way home and are unsure whether to put on a rain jacket or the sunglasses… what is there to help you? A widget on your computer telling you about the weather, right.

Plasma5 so far was missing the port of the weather widgets which were part of the Plasma Addons package with the older Plasma. While there are nice Plasma5 weather widgets on kde-apps.org (1, 2) I wanted the weather widget back I was used to.

Time for “Scratch your itch!”. Starting myself with no clue about Plasma dataengines and also about the new Plasma5 QML-centric widget technology, there was enough material to be found and samples to copy from to port the old weather widget code over to the new Plasma5 world. Also was there great support by the Plasma developers (special thanks to Kai-Uwe and Marco) who quickly helped out with questions, gave good review or the next day fixed bugs elsewhere I hit on the way.

This week there was the feature freeze for Plasma 5.6, and of course it would be nice to share this widget already with everybody again. Did we make it in time?

Teaser: Yes 🙂

Addons Weather widget showing forecast for Geneva and Lisbon

Seems its time for rain jacket in Geneva, while sunglasses are okay in Lisbon 🙂

There is one bigger issue currently known: sometimes after configuring a new weatherstation to be used, there is no instant data update, so the widget will be blank. This blank widget should heal itself on the next weather report update interval (or on the next Plasma restart). Hopefully we soon find the reason to fix this.

There is still the Weatherstation widget left in Plasma Addons, waiting for a port as well (nothing I am interested in, so no itch to scratch here). Feel encouraged to give it a go to port it yourself and become the happy maintainer of a Plasma5 widget as well 🙂

Enter geographic coordinates in Plasma Runner …

… and have them being shown in OpenStreetMap with Marble by just the press of the Enter key. You should be able to do so with the upcoming KDE Apps 4.8, due to the just merged commits.

Recently I was offered the geographic coordinates of a place used for a meeting, because none of the involved people was too familiar with the area. “Sure” I said, sitting in front of my computer, “I will just use Marble, pass them on”. And then failed in finding a way to have Marble take these coordinates and locate them on the map for me.

Given that all things looked to be in place and to just need some connecting (and slight fixing, as I found), for any possible next time I will now be able to just open the Plasma Runner, enter the coordinates…

… and then have the place shown to me in OpenStreetMap with Marble by the press of just one more key:

And so will you 🙂
Should work with degrees given as pure decimal values, as decimal and minutes, and as decimal, minutes and seconds (small bummer: needs fixing for non-western style languages, hopefully done in time for 4.8).

But I also start to have some geographic bookmarks in Marble, adding support for them was just a few more lines. So now just drop some part of the bookmark title or description to the Plasma Runner …

… and then have Marble show you the area again:

When I initially tried to tell Marble the coordinates I basically missed that I could have entered the coordinates in the “Navigation” panel on the right into the “Search” field. Maybe I even tried, but then the old coordinates string parser is quite restrictive in what he accepts, so maybe I had some wrong space char in my input. That is fixed now.

While looking at the Marble code I also learned that besides coordinates, places/building names, and (postal) addresses one can also enter IP addresses into the “Search” field, to have the assumed location of that IP address shown in the map. Surely not often needed, but handy if.

And if you have another idea what could be translated into a geographic position, you just need to write a dedicated Marble Runner plugin.

For KDE Apps 4.9 again I plan to have finished the support of those Marble Runners directly in the Plasma Runner, so one can search for places or addresses right there. Yes, including locations of IP addresses 🙂

Bookmarks Widget for Plasma now part of kdeplasma-addons

The Bookmarks Widget for Plasma is now part of the kdeplasma-addons module, so it should be included in the KDE SC 4.5 (coming in summer 2010). It a pretty simple widget for now (thus version 0.1) which offers you quick access to your (Konqueror) bookmarks, using the plain-old-style menu-with-submenu, as can be seen here (yes, KDE is not a project, but a community, too lazy to update the example data):

You can also set another bookmarks submenu as base folder. Or start the bookmarks editor from the context menu.

More plasmoid UI alternatives, like a Kickoff-style menu navigation, yet to come.
Also hoping for a soonish movement of the bookmark system to Akonadi and Nepomuk, so integration of other bookmarks systems (delicious, Firefox, Chrome, whatever) is done at the right level. It won’t be done by this widget (code). Anybody interested to join this work?

Plasma Bookmarks widget now with custom base folders

For the Bookmarks widget for Plasma you can now select which folder to use as base menu:

So you can set up a few Bookmarks widgets for your most needed groups of bookmarks. In a row on a panel, or for your different activities, or whatever you want to do.

Also will the tooltip of the Bookmarks widget be set to the name, the icon and the description of the folder. And even better, this data will be automatically updated if you change any of these in the global bookmark editor, like fixing a typo. Even in the settings dialog above the folder data will be updated. Thanks to the nice KBookmark* classes in kdelibs this all was quickly added.

For compile instructions see the link at the begin. Compiles also against KDE DP 4.3.

BTW: If you live in or around Dresden in Germany and want to have some fun and gather some experience running the Linux-Info-Tag Dresden autumn of next year, now is your time to get up and in contact!