-
Notifications
You must be signed in to change notification settings - Fork 0
Fork of http://heat-meteo.sf.net with support for NOAA as a weather source
smammy/heat-meteo
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
{\rtf1\ansi\ansicpg1252\cocoartf1671\cocoasubrtf600 {\fonttbl\f0\fswiss\fcharset0 Helvetica-Bold;\f1\fswiss\fcharset0 Helvetica;\f2\fswiss\fcharset0 Helvetica-BoldOblique; } {\colortbl;\red255\green255\blue255;\red38\green38\blue38;\red38\green71\blue75;\red14\green14\blue255; } {\*\expandedcolortbl;;\csgenericrgb\c14902\c14902\c14902;\csgenericrgb\c14902\c27843\c29412;\csgenericrgb\c5490\c5490\c100000; } \margl1440\margr1440\vieww17720\viewh14020\viewkind0 \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 \f0\b\fs28 \cf0 ToDo/Bug List \f1\b0\fs24 \ * Now requires 10.10 or newer (some features require even newer OS\'92s)\ * What works and what doesn\'92t on older OS\'92s?\ \ * localization started - French only for now\ * localize weather forecast (partially complete)\ \ * display location (\strike \strikec0 Menubar\strike0\striked0 vs. Dock vs. Both) - does anybody use Dock view?\ \ * watch out for missing weather icons - look in log for message\ \ * animate refreshing weather icon?\ \ * dynamic city name list (not limited to 8?)\ * There is some sort of memory link - possibly with NSTimer?\ * Give API key only once for a given weather source\ * Paid version with keys provided? Mac App Store?\strike \strikec0 \ \strike0\striked0 \ \pard\pardeftab720\partightenfactor0 \fs28 \cf2 \expnd0\expndtw0\kerning0 \ \f0\b\fs30 Flow Logic \f1\b0\fs28 \ \ Version 2 of Meteorologist is initially based on the menuBar app by Brad at {\field{\*\fldinst{HYPERLINK "http://footle.org/WeatherBar/"}}{\fldrslt http://footle.org/WeatherBar/}}.\ The use of NSXMLParser came as a result of not getting a working copy of curl handle working with the original Meteorologist.\ \ AppDelegate.swift is the starting point but never really used.\ It contains a list of websites where I gathered and learn how to do all of this in Swift (2).\ \ The main driver is \f2\i\b AppDelegate.swift \f1\i0\b0 . We have a structure, WeatherFields, that contains all of the pieces of weather information that will ultimately be display. When AppDelegate wakes up, it starts building a menu bar app. \ If the preferences don\'92t exist or they aren\'92t same same version as the current version\ the Preference menu is displayed (see PreferencesWindow)\ else\ the weatherSource preference is read along with the 8 possible cities\ If the weatherSource is Yahoo! (the only choice right now)\ YahooWeatherAPI.beginParsing is called with each City name\ then YahooWeatherAPI.\cf3 \kerning1\expnd0\expndtw0 \CocoaLigature0 updateMenuWithPrimaryLocation is called\ then \cf2 \expnd0\expndtw0\kerning0 \CocoaLigature1 YahooWeatherAPI.\cf3 \kerning1\expnd0\expndtw0 \CocoaLigature0 updateMenuWithSecondaryLocation is called\ endif\ endif\ An NSTimer is setup that when pops, will call updateWeather to refresh everything\ updateWeather is also called each time the PreferencesWindow is closed\ \ In PreferencesWindow\cf2 \expnd0\expndtw0\kerning0 \CocoaLigature1 .swift\cf3 \kerning1\expnd0\expndtw0 \CocoaLigature0 \ * the xib is updated with the proper localized (international) text\ * the Window is updated with the current preferences (default are used if they don\'92t already exist)\ * when the Window is closed, the preferences are saved\ \ In RadarWindow\cf2 \expnd0\expndtw0\kerning0 \CocoaLigature1 .swift\cf3 \kerning1\expnd0\expndtw0 \CocoaLigature0 \ * the generic weather.com URL is setup\ * the weather.com tag from Yahoo is saved to the URL\ * a WebView page is displayed with the current combined URL\ \ In YahooWeatherAPI (this logic should eventually get repeated for each weather source)\ * a bunch of support/formatting routines exist that should exist for each weather source. It\'92s possible some can be shared.\ \f0\b beginParsing \f1\b0 initializes the WeatherFields structure\ NSXMLParser is called based on the Yahoo! XML address for this particular city\ see {\field{\*\fldinst{HYPERLINK "https://developer.yahoo.com/weather/"}}{\fldrslt \cf4 https://developer.yahoo.com/weather/}}\ \f0\b setImage \f1\b0 will pick the weather icon based on the current or forecast conditions for a given city\ \f0\b formatTemp \f1\b0 will format a temp is the proper unit and appoint F or C as required\ \f0\b formatWindSpeed \f1\b0 will format the wind speed based on the requested unit\ \f0\b formatPressure \f1\b0 will format the barometric pressure based the requested unit\ \f0\b formatVisibility \f1\b0 will format the visibility based on the requested unit\ \f0\b extendedWeatherIcon \f1\b0 will return the weather icon/image or nil, depending on the preference\ \f0\b currentConditions \f1\b0 will format the current weather information\ \f0\b extendedForecasts \f1\b0 will format the forecasted weather information\ \f0\b \cf0 setRadarWind \f1\b0 plays a game with RadarWindow so proper dispatching control is maintained. I really wish there was a better way.\ \f0\b updateMenuWithSecondaryLocation \f1\b0 displays secondary cities as a submenu in the display. This can exist from 0 to 7 times.\ \f0\b updateMenuWithPrimaryLocation \f1\b0 display the primary city in the requested menu. There can only be 1 primary.\ XMLParser methods\ didStartElement\ didEndElement\ foundCharacters\ \f0\b dummy \f1\b0 a dummy procedure so the menu items will display without being gray\'92d out\ \f0\b openWeatherURL \f1\b0 is a procedure to display the Yahoo! weather page for the selected city using an external call to Safari\ \f0\b showRadar \f1\b0 will display the radar for the selected city by calling RadarWindow\ }
About
Fork of http://heat-meteo.sf.net with support for NOAA as a weather source
Topics
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published