Short: Show weather infos in screenbar Uploader: Thomas@Igracki.de (Thomas Igracki) Author: Thomas@Igracki.de (Thomas Igracki) Type: comm/misc Version: 1.21 Architecture: ppc-morphos Distribution: Aminet Kurz: Zeige Wetterinfos in der Screenbar This sbar module, shows the current weather informations for a selected location. Here is a preview, how it looks like http://igracki.de/previews/yWeather.png You will see a small image representing the current weather condition, the temperature and a text. I use the weather information from OpenWeatherMap.org. If you move the mouse over the sbar and wait some seconds, a bubble pops up, showing all available weather informations. If you click with the left mousebutton on it, a popup menu will be opened to manually get new weather infos or checking for an update. Since v1.19, yWeather will check 30 secs after the first sucessfull weather update, if there is an update available. You can change the location in the Screenbar-Settings (right click on the screen-depth gadget, then choose "Settings"). Then click in the City-ID string gadget and enter your location, f.e. "Berlin,DE". After a successfull retrieving of weather infos, the ID is used! The default location is Berlin. You can also change the unit of the temperature to Celsius, Fahrenheit or Kelvin, if you want the wind speed in m/s, the text color, the text format and the update rate how often the weather informations should be trieved (in seconds). Note: The all-info-bubble does not pop up if you didn't have "Mouse actions on inactive windows" checked in Prefs/IControl! Thanks to Nicolas Sallin for finding this. !!! Important !!! Important !!! Important !!! Important !!! Important !!! Since v1.13 yWeather needs its weather-icons in "Sys:Data/Screenbar/yWeather/" instead of "Sys:Data/yWeather/" like in previous versions! !!! Important !!! Important !!! Important !!! Important !!! Important !!! New in v1.21: 05-Mär-2019 Fix: Added a workaround for a ParseDate() bug with single day number, f.e "Mon Mar 4 14:02:22 2019" can only be parsed if I remove the double spaces before the "4"! Chg: Displaying of "precipitation" in the All-Info-Bubble wasn't correct, because it seems to be not fully supported/available, its now " [mm] [<1h|3h|...>]" Fix: the sunrise, sunset and lastupdate date/times are now converted to your local date/time Chg: sunrise and sunset times are now displayed in one line instead of two lines (in the all-info-bubble) Chg: Now a popup-menu will be opened if you press the left mousebutton over its sbar There you can choose to get the weather infos, open the weather forecast (not yet) or check for an update Chg: My sbar was drawn every second, instead only if needed Chg: Check for an update after downloading of weather infos failed 5 times and the sbar was deactivated before it only checked for an update if getting of weather infos succeeded New in v1.20: 10-Jan-2019, v1.20, released Rem: Removed the forecast, will be added later New: Added a Language cycle gadget in the prefs to get the weather data in a specific language Chg: Setting up your location in the prefs changed Chg: Changed the layout of the all-info-bubble a bit, f.e. the titles are now bold 07-Jan-2019 New: added precipitation and cloudiness to the All-Info-Bubble New: Convert the WindName, CondText and Cloudiness from UTF8 to system charset 06-Jan-2019 New: Added Kelvin as temperature unit in prefs/misc Rem: Distance unit is now always meter Rem: Removed WindChill, because OpenWeatherMap doesn't have support for it Rem: Removed support for country name, because OpenWeatherMap doesn't have support the country name, only an abbreviation Rem: Removed "Atmospere/State" value, because OpenWeatherMap doesn't have support for it Chg: "%w" was Wind Chill and is now "Wind name" 05-Jan-2019 Chg: Changed name of the sbar to Your!Weather because I'm now using a different weather providing service (currently OpenWeatherMap) Chg: Changed some msgs which contained "Yahoo" to "WeatherService" prefsMsgSendingQuery, prefsMsgFailedToConnect, msgWeatherServiceError (prev. msgYahooError) New in v1.19: 25-Dez-2016, v1.19, released Fix: If yWeather failed to retrieve the weather informations, after it once was successfull, the error informations weren't shown in the bubble, instead the "old" weather data were shown 18-Dez-2016 Chg: Reverted the feature to additionally display the clock I will write a new sbar (xInfo.sbar) which will be able to display misc system infos: like clock, sensors (like CPU temp etc), number of windows/screens etc Chg: If yWeather failed to retrieve the weather informations, because you are offline, or because of a connection problem with yahoo, the all-info-bubble contains information about the error codes Fix: If the first weather update failed (after 5 retries), new opened screen showed "Updating..." forever Fix: The all-info-bubble could show "old" weather data New: The "New Version" bubble now appears on all opened screens! 06-Dez-2016 Fix: The UpdateCheck requester doesn't blocks the PublicScreenManager anymore Fix: Ensure that the weather-update isn't called too often Chg: Changed the UpdateCheck at startup, now there will be only a bubble displayed, and a short notice in the instant bubble Fix: It could happen that the weather data were redownloaded if a new screen opens 30-Nov-2016 New: There is now a format string for the complete string (with %w = weather info, %c = clock) and an own format string for the weather info and the clock New: You can have different colors for the weather info and the clock 28-Nov-2016: New: Added the possibility to display date and time, just specify a "%Z" in the "Text Format:" setting New: Added a "Clock Format:" setting Fix: The All-Info-Bubble could stay opened, if you deactivate yWeather.sbar while its displayed 20-Nov-2016: Chg: Changed the UpdateCheck method, I'm now using a php script to check for an update New: 30secs after the first successfull weather update, an UpdateCheck will be performed -- New in v1.18: Fix: Fixed a bug in ECX's library generation code, which causes a crash if my sbar fails to open on first opening Fix: Fixed some warning messages Chg: Removed the bsdsocket.library check, it shouldn't be needed 14-Sep-2016: Fix: Clicking on "Visit homepage" in the UpdateCheck requester, could produce hits, because I used SystemTagList() with SYS_Asynch,TRUE but without specifying SYS_Input/SYS_Output, shame on me;) But for an sbar obj this didn't causes hit, because Input/Output were NIL 05-Sep-16: v1.17, internal Chg: Before first weather-info-download of the first sbar instance, I check if the bsdsocket.library can be opened, if not (means network is not ready) I delay the download call by 1 second, seems to help on boot if the network availability is delayed [reported by cyfm, 03-Sep-16] -- New in v1.16 Fix: The saved temperature unit wasn't used at startup, if it was set to F (Fahrenheit) [reported by redrumloa, 17-Apr-16] -- New in v1.15: Chg: The temp. in Celsius are now displayed with 1 digit after the comma Yahoo sends them in Fahrenheit, so I can display them more precisely;) Fix: Changing temp. unit (and color) in the sbar prefs, crashes the sbar Fix: If using multiple screens, the text wasn't always the same Chg: added a countdown for the failing msgs Chg: due to the countdown: msgUpdatingFailed, msgOffline, msgYahooError changed Fix: If you remove my sbar while I'm waiting for yahoo, the whole sbar could crash (hopefully fixed...) -- New in v1.14: Fix: Wind-speed was always 0.00 [reported by jPV, 29-Mar-16] Fix: the units for wind speed, chill, visibility and pressure were missing New: added the version of yWeather.sbar in the all-info-bubble -- New in v1.13: Chg: Display "Update check..." in the sbar, if you press middle mouse button Chg: The required icons are now located in Sys:Data/Screenbar/yWeather/ instead of Sys:Data/yWeather/ New: Added a simple installation script -- New in v1.12: Chg: Don't eat RMB over my sbar Fix: Crash if you remove the sbar while trying to download weather infos Chg: add the inputhandler after first successful download Chg: if downloading of weather infos failed, try again after 10 seconds, if it fails 5 times in a row, deactivate auto-update! You have to left click on the sbar to activate it again! Offline will be recognized and displayed New: Recognize if yahoo sends no weather data, then "Yahoo error!" will be displayed Fix: don't show the all-info-bubble, if there was no successful download! Chg: If the conversion of the yahoo date failed, display the original date instead the localized22 in the bubble Dates like this "Mon, 28 Mar 2016 12:00 AM CEST" fail, because of the "12:xx AM" New: New strings to localize: msgDeactivated, msgOffline, msgYahooError -- Installation: 1) copy contents of "SYS" to SYS: These are the icons for the weather conditions. I used VClouds from http://vclouds.deviantart.com/ and resized them to 16 pixels height with ShowGirls. You can replace them with your own images. 2) if you want to have localized text, copy the appropriate catalog f.e for german text: copy catalogs/deutsch/yWeather.catalog to SYS:Locale/Catalogs/deutsch/ 3) Now you have to update the displayed sbars: - right click on the screen-depth icon (upper right corner of the screen) - choose 'Update List' - then select the new entry "Yahoo!Weather" in this screen-depth-menu