kweather in metric - KDE

This is a discussion on kweather in metric - KDE ; I live in Canada and thus very interested in the weather. I like to have the weather icon on the panel. I'm not interested in having it in imperial units. Unfortunately, either I have this in Fahrenheit or I have ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: kweather in metric

  1. kweather in metric

    I live in Canada and thus very interested in the weather. I like to have
    the weather icon on the panel. I'm not interested in having it in imperial
    units. Unfortunately, either I have this in Fahrenheit or I have my page
    dimensions in the word processors in centimetres.
    I fixed this. I made a small change to kweather so it always reports in
    metric units.
    For all you Canadians and others who use both imperial and metric, here's
    what I did:
    # Get the source package for kdetoys; for me this was
    rpm -i kdetoys-3.5.1-3.fc5.src.rpm
    # Copy the following into /usr/src/redhat/SOURCES/kdetoys-metrication.patch:
    cat > /usr/src/redhat/SOURCES/kdetoys-metrication.patch <
    --- kdetoys-3.5.1/kweather/weatherlib.cpp 2005-09-10 02:21:23.000000000 -0600
    +++ kdetoys-3.5.1/kweather/weatherlib.cpp2 2006-04-22 01:36:09.000000000 -0600
    @@ -135,7 +135,7 @@
    if ( !s.isEmpty() )
    {
    kdDebug( 12006 ) << "Parse: " << s << endl;
    - MetarParser parser(m_StationDb, KGlobal::locale()->measureSystem());
    + MetarParser parser(m_StationDb, KLocale::Metric);
    d->wi = parser.processData(d->wi.reportLocation, s);
    d->age = QDateTime::currentDateTime().addSecs(1800);
    emit fileUpdate(d->wi.reportLocation);
    EOF

    # Then change the spec file to include this patch:
    edit /usr/src/redhat/SPECS/kdetoys.spec

    # Change release version
    Release: 3%{?dist}
    # to
    Release: 3.1%{?dist}

    # Add a patch line between Source0 and BuildRoot lines in first section:
    Patch1: %{name}-metrication.patch

    # Added last line in %prep section
    %patch1 -p1 -b .metric

    # Then I rebuilt the package:
    rpmbuild -bb kdetoys.spec

    # And installed the package from the RPMS directory:
    rpm -ivh /usr/src/redhat/RPMS/athlon/kdetoys-3.5.1-3.1.athlon.rpm
    # You may find your version in the i386 directory.

    There's probably a better way, but I wanted something fast and I'm
    never going to change units so it works for me.

    Hope this is useful to someone else.
    Duane Evenson



  2. Re: kweather in metric

    Duane Evenson wrote:
    > I live in Canada and thus very interested in the weather. I like to have
    > the weather icon on the panel. I'm not interested in having it in imperial
    > units. Unfortunately, either I have this in Fahrenheit or I have my page
    > dimensions in the word processors in centimetres.
    > I fixed this. I made a small change to kweather so it always reports in
    > metric units.


    I thought that default in Canada was metric units when using LC_ALL=en_CA.

    One problem I have with metric units in kweather is the wind speed, KM/H don't
    tell me at all how the wind is, I always have to recalculate it manually to
    M/S which is the way we have wind speeds here in Scandinavia.

    I have tried to "fix" this by transforming KM/H to M/S, but it's kind of a
    mystery to know what values needs to be "fixed" and this far I have just got
    bad results where the wind has really odd values all the time. Next, it's not
    just to "switch" the binaries to try the new update to see what it reports,
    you need to turn off the whole KDE, switch the files and start it again, whcih
    results in all to much work.


    //Aho

  3. Re: kweather in metric

    On Sat, 22 Apr 2006 16:38:46 +0200, J.O. Aho wrote:

    > Duane Evenson wrote:
    >> I live in Canada and thus very interested in the weather. I like to have
    >> the weather icon on the panel. I'm not interested in having it in imperial
    >> units. Unfortunately, either I have this in Fahrenheit or I have my page
    >> dimensions in the word processors in centimetres.
    >> I fixed this. I made a small change to kweather so it always reports in
    >> metric units.

    >
    > I thought that default in Canada was metric units when using LC_ALL=en_CA.
    >
    > One problem I have with metric units in kweather is the wind speed, KM/H don't
    > tell me at all how the wind is, I always have to recalculate it manually to
    > M/S which is the way we have wind speeds here in Scandinavia.
    >
    > I have tried to "fix" this by transforming KM/H to M/S, but it's kind of a
    > mystery to know what values needs to be "fixed" and this far I have just got
    > bad results where the wind has really odd values all the time. Next, it's not
    > just to "switch" the binaries to try the new update to see what it reports,
    > you need to turn off the whole KDE, switch the files and start it again, whcih
    > results in all to much work.
    >
    >
    > //Aho


    Canada did a gradual switch over to metric and then stopped. Anywhere
    we share ties to the US, we've stayed imperial. We use kilometres,
    Celsius, kiloPascals of pressure, wind speed is in km/h. Rain
    falls in mm, and snow in cm. However, we use the letter sized paper
    (8.5"x11"), and imperial measurements for margins, tabs, etc. Construction
    is about 80% imperial. We use 1/2" and 3/4" plumbing pipe. Our studs are
    2x4's and plywood is in 4'x8' sheets. Most bolts are imperial, but we
    encounter metric enough that most people need metric and imperial tools.
    Fitness equipment is usually set to imperial. Weights come as 10 and 25
    lbs. We run at 6mph rather than 10km/h. Most people measure themselves in
    feet and inches and weigh themselves in pounds although all government
    documents, like the driver's license, are in metric. Fresh fruit and
    vegetables are usually priced by the pound, although all other groceries
    are measured in metric. One thing I noticed when I was in Norway this
    summer, they priced per hectagram. In Canada we usually say 100g and only
    use hecta when talking about hectares. As you can see, when we use
    imperial or metric depends on the application. We can't even say we use
    only metric for temperature and imperial for distance.

    Back to your problem, if you want to customize some things metric and
    others imperial in the application, you'll have to edit metar_parser.cpp.
    You'll find procedures like parseCover, calcTemperatureVariables,
    parseVisibility, parsePressure, parseWindSpeed, and calcWindChill. Each
    procedure has a "if (m_units == KLocale::Metric)... else..." command.
    You can either just change the argument to "true" or "false" as you need,
    or cut out the if-else and the unneeded code.
    I found rebuilding, extracting and installing the rpm's took more
    time than restarting KDE. I'd just log out the session, log back
    in, and add the applet to the panel.

    Regardless, KDE and whoever is in charge of this needs to reconfigure
    locale settings for us folk who use both metric and imperial measurements.

    Good luck,
    Duane


  4. Re: kweather in metric

    Duane Evenson wrote:
    > On Sat, 22 Apr 2006 16:38:46 +0200, J.O. Aho wrote:


    >> I have tried to "fix" this by transforming KM/H to M/S, but it's kind of a
    >> mystery to know what values needs to be "fixed" and this far I have just got
    >> bad results where the wind has really odd values all the time. Next, it's not
    >> just to "switch" the binaries to try the new update to see what it reports,
    >> you need to turn off the whole KDE, switch the files and start it again, whcih
    >> results in all to much work.


    > Back to your problem, if you want to customize some things metric and
    > others imperial in the application, you'll have to edit metar_parser.cpp.
    > You'll find procedures like parseCover, calcTemperatureVariables,
    > parseVisibility, parsePressure, parseWindSpeed, and calcWindChill. Each
    > procedure has a "if (m_units == KLocale::Metric)... else..." command.
    > You can either just change the argument to "true" or "false" as you need,
    > or cut out the if-else and the unneeded code.
    > I found rebuilding, extracting and installing the rpm's took more
    > time than restarting KDE. I'd just log out the session, log back
    > in, and add the applet to the panel.


    I'm all to lazy to rebuild the whole ebuild (as Gentoo uses), so I just
    extract the source and only build the kweather with my fix for the
    sunraise/sunset times for remote locations (sadly this don't work for the icon
    itself, I get a night icon more often than a day icon).


    I'll try to do that with messing with the parsers and see if that goes as I
    wish or not. Not sure which file i was fiddling with last time, but it didn't
    go well.


    > Regardless, KDE and whoever is in charge of this needs to reconfigure
    > locale settings for us folk who use both metric and imperial measurements.


    I think it had been good if KDE used the local defaults, buyt had a
    configuration page in the control-center where you could adjust locale
    settings and use a "custom" local instead of those defaults.


    //Aho

+ Reply to Thread