Emdek / plasmoid-adjustable-clock

Plasmoid to show date and time in adjustable format
GNU General Public License v2.0
20 stars 5 forks source link

Verbose Mod: #13

Closed X4 closed 10 years ago

X4 commented 10 years ago

Preview:

Preview of Verbose Mod Weather doesn't work yet in $0 (=adjustable-clock), so I added yaWP. PM/AM is just a reference for me to remember what is what :)

Keep up the good work Michał, polish hackers rock (‾⌣‾)♉!

<!DOCTYPE html><html><head>
<meta charset="utf-8">
<style>
#one{ float: left; clear: both; height:50px; width: 385px; text-align: left; }

#time { float:left; font-size: 35px; }
#zone { font-size: 27px; top: 10px; left: 5px; color: #aaa; float:left; position: relative;  }

#date { float:left; font-size: 27px; }
#week { float:right; font-size: 27px; color: #aaa; }

span { font-weight: bold; text-shadow: 1px 0 0 rgba(0,0,0,0.7); }
span[component=DayOfWeek] { color: yellow; text-shadow: 1px 1px 2px rgba(0,0,0,0.7); }
span[component=Hour]   { color: #fff; }
span[component=Minute] { color: #cdcdcd; }
span[component=Second] { color: #adadad; }
span[component=TimeOfDay] { left: -10px; color: #adadad; position:relative; }
span[component=TimeZoneOffset] { letter-spacing: -4px;  }
span[component=TimeZoneName] { letter-spacing: -1px; }
</style>
</head>
<body style="color: rgb(255, 255, 255); font: normal normal normal 12px/normal 'DejaVu Sans'; opacity: 0.85; ">
<div id="one">
    <span id="time">
      <span component="Hour">12</span>:<span component="Minute">30</span>:<span component="Second">15</span>
      <span component="TimeOfDay">pm</span>
    </span>
    <span id="zone">
      GMT <span component="TimeZoneOffset">+2</span>
    </span><br> 
    <span id="date">
      <span component="DayOfWeek" options="'short': true, 'text': true">Sa</span>,
      <span component="DayOfMonth">01</span>.<span component="Month">01</span>.<span component="Year">2000</span>
    </span>
    <span id="week">
      &nbsp;Week <span component="Week">52</span>
    </span> 
</div>

<script type="text/javascript">
function setupClock()
{
    var opacity = Clock.getOption('textOpacity', 85);

    document.body.style.color = Clock.getOption('themeTextColor', Clock.getColor('text'));
    document.body.style.font = ((Clock.getOption('fontItalic', false) ? 'italic ' : '') + (Clock.getOption('fontBold', false) ? 'bold ' : '') + '12px \'' + Clock.getOption('themeFont', Clock.getFont()) + '\'');
    document.body.style.opacity = ((opacity == 100) ? '1' : ('0.' + opacity));
}
document.addEventListener('ClockThemeChanged', setupClock);
</script>
</body></html>
Emdek commented 10 years ago

;-)

Probably the best way is to wait a bit, the remaining part to add weather support isn't hard, it's just pretty tedious. Hopefully it will finally land in coming weeks (around time of KDE 4.12 release), as probably last major version for KDE 4.x (last one that will be QGV based), after finishing up enough my web browser, Otter.

BTW, it is very good idea to use component value as selector. ;-)

X4 commented 10 years ago

It's already perfect :) :+1: But yeah weather would be cool, but I think you don't need to implement everything. Maybe forking or accessing yaWP through an interface could work. I wonder what type of clock style you use. (heheh, you probably hate clocks and don't use it :v:

Emdek commented 10 years ago

Well, UI is already done for some time already, just being disabled due to bugfix releases (probably I should start using branches for that ;-)). The remaining parts are selecting weather station (this part really sucks since logic for doing that in weather data engine is kind of unpleasant - I wanted to fix that upstream for KDE 4.11 but didn't have time and enough motivation...) and converting values (there is stable library available).

There is also libplasmaweatherapplet but there are two major issues:

BTW, I'm considering adding API (but for sure no UI) to query any data engine using JS API, but still weather should have UI since it is most common use case.

I'm using slightly modified (glow) Verbose theme. ;-)

X4 commented 10 years ago

"any data engine using JS API" :hammer: Sold. That would be a crazy feature that turns the adjustable-clock to a data-consumer widget. Eagerly waiting for it :)

Emdek commented 10 years ago

;-)

Well, since QML themes can leverage Plasma APIs directly then it would be only fair to allow to do the same in HTML themes. Also, I don't like QML too much. ;-)

X4 commented 10 years ago

good point that speaks for creating a branch 2.0 of this project

Emdek commented 10 years ago

Not needed now, today last remaining issue was resolved to be unrelated. But it will be useful for KDE5 porting, for sure. ;-)