Adjustable Clock

Plasma 4 Extensions

Source (link to git-repo or to original if based on someone elses unmodified work): Add the source-code for this project on opencode.net

28
8 .4
Description:

Plasmoid to show date and time in adjustable format using rich text.
Developed and tested on KDE 4.11 with Qt 4.8 (Kubuntu 13.10).

Source (main repository, with more frequent updates) is located at:
https://github.com/Emdek/plasmoid-adjustable-clock

Warning!
Version 4.0 (and newer) is not backwards compatible with 3.x, all custom formats need to be exported and manually converted.

QML themes support is currently considered as experimental, behavior and available API are not yet stable and most probably will be changed with next release.

Tips:
- to change tool tip text you need to set options toolTipExpressionMain and toolTipExpressionSub in applets configuration file (usually located at ~/.kde4/share/config/plasma-desktop-appletsrc), in group containing line plugin=adjustableclock;
- you can use advanced WebKit features (all of these that work with for example rekonq should work here too), for example use CSS to create reflections:

-webkit-box-reflect:below 5px -webkit-gradient(linear, left top, left bottom, from(transparent), color-stop(0.5, transparent), to(white));

And much more. ;-)

If you created interesting theme and want to share it then post in comments!

Features:
- fully custom date and time using JavaScript API to obtain date and time components;
- multiple clock themes utilizing various designs;
- possibility to use rich text editor or edit source directly (HTML and CSS or QML) to adjust theme;
- context menu with actions to copy formatted (adjustable expressions) date and time to clipboard;
- fast copy to clipboard of adjustable date and time expression after middle mouse click on the clock or activation of keyboard shortcut;
- adjustable tool tip (hidden option, toolTipExpressionMain and toolTipExpressionSub keys);
- standard clock calendar.

If you have found bugs or have suggestions you can contact me via email, message or using comments, before you will vote bad. And remember that not everybody has enough time for fast replying. ;-)
Last changelog:

7 years ago

4.1.4 (01.11.2013):
- fixed week number not being updated;
- added missing title of "Insert Component" dialog.

4.1.3 (27.09.2013):
- ensure that component values are always up to date;
- adjust timestamp for time zone offset;
- do not allow for accidental nesting of components in editor;
- added option to hide date in Train Clock theme;
- added workaround to ensure that hands of SVG Clock have correct initial positions as soon as possible.

4.1.2 (01.06.2013):
- ensure that center of SVG Clock theme is always valid;
- improve resizing in vertical panels.

4.1.1 (25.05.2013):
- fixed WYSIWYG editor for HTML themes;
- fixed missing dialog for "Insert Component" actions.

4.1 (15.05.2013):
- added SVG Clock theme (analog clock that uses Plasma theme);
- added experimental support for QML themes (alpha state);
- added simple file templates for new themes;
- move theme editor to own dialog;
- move theme specific actions to context menu;
- added ability to install and export themes (Plasma Package ZIP);
- some other improvements and fixes.

C

Emdek

7 years ago

Uhm, that one got in accidentally, it is not ready yet.
Thanks for pointing that out, I've updated source package.

Report

9

ksolsim

7 years ago

there's a little problem with fuzzy clock..

http://postimg.org/image/kn8p0evcd/

Report

C

Emdek

7 years ago

Thanks for confirmation, stable release will be made available ASAP.

Report

9

ksolsim

7 years ago

good work every clock works... now on arch even vertical clock works...
http://postimg.org/image/65p5au7kn/

Report

9

ksolsim

7 years ago

I've a second problem, ring clock doesn't work anymore..

http://postimg.org/image/aph6n7tsl/

Report

C

Emdek

7 years ago

I've modified a bit themes to always include text-align: center; if needed so it should look at least a bit better by default (but lack of vertical alignment is very visible when background is drawn...).
But I'm afraid that Arch might require additional patch that adds vertical alignment CSS to each theme. :-/

Report

C

Emdek

7 years ago

After some testing it seems that this is upstream bug and QtWebKit ignores userStylesheetUrl() on Arch, even if it is an on disk file identified by absolute URL...
I have some ideas how to workaround that, but I don't like them since they may interfere with theme developer intentions (overwrite values).
In worst case there might be need to add some patch to Arch spec file...

Report

C

Emdek

7 years ago

Thanks for report, maybe configuration got mangled once.
Let me know if it will show up again. :-)

Report

9

ksolsim

7 years ago

today without updating the package seems to be working properly.
http://postimg.org/image/wp7asajfp/

Report

C

Emdek

7 years ago

Also that missing stylesheet issue got confirmed on Arch, I'll try to find some other method to apply that CSS since it's crucial for themes to work correctly.
I've decided to use that way since it is most transparent for theme developers, maybe injecting CSS using JS will be sufficient, or that issue could be fixed somehow (maybe it just requires to toggle some flags in QWebSettings or such).

Report

C

Emdek

7 years ago

Cannot reproduce that issue, but it seems to be exact the same as previous (the only difference is that now first theme is Analog, added yesterday, they are probably returned sorted and first one gets chosen), maybe it's something wrong with saving / reading of theme key.
When you open settings again which one is selected?

Report

9

ksolsim

7 years ago

on arch linux (both 64 and 32 bit on different machines)...
qt version: qt4 (4.8.4) and qt5(5.0.2)

qt4 used for compile plasmoid

Report

C

Emdek

7 years ago

Both issues should be fixed now, it was hard to find a reason for them but it turned out that it was due to style sheet index change (after changing method for injecting theme CSS).

Report

9

ksolsim

7 years ago

there's a little problem... some clocks always show seconds (e.g. train clock)
http://postimg.org/image/b3xmktlbl/

Report

C

Emdek

7 years ago

Should be fixed now, I've changed code to inject stylesheet as LINK element with data URL.

Report

C

Emdek

7 years ago

Thanks for detailed information, I'll investigate this issue.

For now I can only give workaround by adding this CSS snippet to theme you want to use:
html, body {margin: 0; padding: 0; height: 100%; width: 100%; vertical-align: middle;} html {display: table;} body {display: table-cell; text-align: center;}

Report

C

Emdek

7 years ago

Next version will replace current parser by JavaScript API (no more % placeholders).
Since it is big and compatibility breaking change (although it is possible to convert custom themes, even these using pre 3.0 syntax) I will need additional feedback before proceeding with new release (planned in April), to make sure that this change could go as smoothly as possible and there will be no need to break API compatibility.

Reasons for this change:
- greater flexibility (easier to extend);
- cleaner (no custom expressions, only standard JavaScript, except custom API to query date and time components);
- unbreak few things (like use of CSS transitions, since parser required to reload HTML each time...);
- ability to add support for QML themes using similar API in both "engines".

Current API (methods marked as Q_INVOKABLE), it uses CSS queries to match elements that need value substitution (you can optionally specify attribute):
https://github.com/Emdek/plasmoid-adjustable-clock/blob/master/applet/Clock.h#L59
Component identifiers are defined here:
https://github.com/Emdek/plasmoid-adjustable-clock/blob/master/applet/DataSource.h#L36
There are also events fired when values of these components change (used by for example Digital Clock theme).
Common options (all booleans) are: short, text, possessive (for months), alternative (for hour only, toggles between 24 and 12 hours format).

Report

C

Emdek

7 years ago

API got modified again, Clock object exposes now only toString() method and other methods were replaced by use of attributes:
- component (component identifier - https://github.com/Emdek/plasmoid-adjustable-clock/blob/master/applet/Clock.h#L34);
- options (list of options specific to given component, optional);
- attribute (attribute to substitute instead of tag contents, optional).
This should be easier to use since all "options" are in one place now and has some other benefits too.

Report

9

tsujan

7 years ago

Nice plasmoid! This is the only digital clock that can be used with vertical panels. And with wide screens, vertical panels are the best choice.

Report

nowardev

8 years ago

hi i can't use your widget in javascript


var applet = panel.addWidget("adjustableclock")
applet.writeConfig("announceInterval","0")
applet.writeConfig("calendarType","locale")
applet.writeConfig("clipboardFormats","%x,%f,%H:%M:%S,,%X,%F,,%c,%C,%Y-%m-%d %H:%M:%S,,%t")
applet.writeConfig("defaultTimezone","Local")
applet.writeConfig("displayEvents","true")
applet.writeConfig("displayHolidays","true")
applet.writeConfig("fastCopyFormat","%Y-%m-%d %H:%M:%S")
applet.writeConfig("holidaysRegions","us_en-us")
applet.writeConfig("holidaysRegionsDaysOff","us_en-us")
applet.writeConfig("timeFormat","<html><head></head><body><div style")
applet.writeConfig("timeFormatNames","Default 2,dbClock with reflection 2")
applet.writeConfig("timeFormatStrings",'<html><head></head><body><div style="text-align: center; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; margin-left: 5px; white-space: pre; font-size: 57px; "><font color="#ffffff" face="Ubuntu"><span style="font-size: 54px; "><span style="font-size: 45px; ">%d.%m</span> </span><big style="font-size: 60px; "><b>%H:%M </b></big></font></div>,<html><head></head><body><div style="height:50px; background:none;"><div style="text-align:center; white-space:pre; font-size:25px; margin:-10px 0 5px 5px; -webkit-box-reflect:below -5px -webkit-gradient(linear\\, left top\\, left bottom\\, from(transparent)\\, color-stop(0.5\\, transparent)\\, to(white));"><span style="font-family:\'Nimbus Roman No9 L\';">%H:%M<span style="font-size:30px; position:relative; left:-8px; top:4px; z-index:-1; opacity:0.5;">%S</span></span></div></div>')

Report

C

Emdek

8 years ago

You are doing it wrong. ;-)
Currently (3.1) themes are stored (only those which are not in themes XML file) in configuration subgroups (and it is not going to change anytime soon), like [Formats][Name], which have keys: background, css, html, script (I'm not sure if this key is already used in 3.1, since I'm using not released yet version ;-)), title.
Sou you shall first create such subgroup for new theme and then set key format to that name. Also I guess that manually creating some of keys like defaultTimezone is not necessary.

Report

nowardev

8 years ago

what?
i am unable to use your widget via javascript i have tried a lots nothing worked




var panel = new Panel
panel.location = 'bottom' //panel.location = 'top'



var applet = panel.addWidget("adjustableclock")

applet.currentConfigGroup = new Array('Configuration') // CONFIGURE DOCKERS HELPERS

applet.writeConfig("timeFormatStrings",'<html><head></head><body><div style="text-align:center; margin:5px; white-space:pre;"><font face="\'Nimbus Roman No9 L\'" color="#ffffff"><b><big>%x %H:%M </big></b></font></div>')

Report

C

Emdek

8 years ago

Sorry for delay but I was busy with defense of my MD thesis...

Which version of applet are you using? Your code will not work with current version, as stated before. Configuration layout is very different from old one.

Report

nowardev

8 years ago

:D no problem at all for delay for now i have made my collection of panels with standard clock but because of it lacks of options i would like use your widget so i need to use it with javascript.

anyway i have this one (debian package)

ii plasma-widget-adjustableclock 2.6.1-1

Report

C

Emdek

7 years ago

It seems that best way would be to include those themes that you need (if current are not enough) and then simply change single configuration key with identifier.
But the main issue is that you would need at least 3.0 to make it work (older versions have different configuration keys layout).

Report

7 years ago

4.1.4 (01.11.2013):
- fixed week number not being updated;
- added missing title of "Insert Component" dialog.

4.1.3 (27.09.2013):
- ensure that component values are always up to date;
- adjust timestamp for time zone offset;
- do not allow for accidental nesting of components in editor;
- added option to hide date in Train Clock theme;
- added workaround to ensure that hands of SVG Clock have correct initial positions as soon as possible.

4.1.2 (01.06.2013):
- ensure that center of SVG Clock theme is always valid;
- improve resizing in vertical panels.

4.1.1 (25.05.2013):
- fixed WYSIWYG editor for HTML themes;
- fixed missing dialog for "Insert Component" actions.

4.1 (15.05.2013):
- added SVG Clock theme (analog clock that uses Plasma theme);
- added experimental support for QML themes (alpha state);
- added simple file templates for new themes;
- move theme editor to own dialog;
- move theme specific actions to context menu;
- added ability to install and export themes (Plasma Package ZIP);
- some other improvements and fixes.

12345678910
243
product-maker thevladsoft Aug 10 2015 9 excellent
product-maker vanguard7 Sep 01 2014 9 excellent
product-maker SicoBulo Jul 27 2014 3 bad
product-maker electron222 May 08 2014 9 excellent
product-maker janet Feb 22 2014 9 excellent
product-maker garthecho Feb 09 2014 9 excellent
product-maker renjooy Jan 24 2014 9 excellent
product-maker mixalns Nov 02 2013 9 excellent
product-maker MoonBlossom Oct 10 2013 9 excellent
product-maker vatsok Sep 29 2013 9 excellent
product-maker YAFU Sep 28 2013 9 excellent
product-maker fdservices Sep 27 2013 9 excellent
product-maker Omega9 May 16 2013 9 excellent
product-maker oOSplashOo May 15 2013 9 excellent
product-maker baltolkien May 04 2013 9 excellent
product-maker FraMari Apr 21 2013 9 excellent
product-maker monga Apr 21 2013 9 excellent
product-maker frag Apr 15 2013 9 excellent
product-maker SvenArcher Apr 14 2013 9 excellent
product-maker ArthurTaborda Apr 13 2013 9 excellent
product-maker ksolsim Apr 13 2013 9 excellent
product-maker migue Apr 13 2013 9 excellent
product-maker google01103 Apr 13 2013 9 excellent
product-maker evapor Apr 13 2013 9 excellent
product-maker unikum111 Apr 08 2013 9 excellent
product-maker tsujan Jan 06 2013 9 excellent
product-maker lionhater Oct 10 2012 9 excellent
product-maker quinnuendo Oct 03 2012 9 excellent
product-maker xMaki Oct 02 2012 9 excellent
product-maker CobraDOT Aug 13 2012 9 excellent
product-maker RAIDENSUB Jun 12 2012 9 excellent
product-maker remix Apr 03 2012 9 excellent
product-maker SeaJey Feb 15 2012 9 excellent
product-maker orivej Feb 13 2012 9 excellent
product-maker 5er Feb 07 2012 9 excellent
product-maker ZaWertun Feb 03 2012 9 excellent
product-maker cyberconan Jan 15 2012 9 excellent
product-maker CatchTime Dec 02 2011 9 excellent
product-maker paran0idx Dec 02 2011 9 excellent
product-maker deabru Dec 01 2011 9 excellent
product-maker vitoubien Dec 01 2011 9 excellent
product-maker e1nste1n Dec 01 2011 9 excellent
product-maker Pafrape Oct 12 2011 9 excellent
product-maker joseexposito89 Aug 30 2011 3 bad
product-maker ZXP6 Oct 15 2010 9 excellent
Be the first to comment
UnderTheGun
May 01 2014
quinnuendo
Mar 23 2014
BishopWolf
Jan 08 2014
MoonBlossom
Oct 10 2013
fdservices
Sep 27 2013
blue-dxca93
May 08 2013
baltolkien
May 04 2013
Maecla
May 04 2013
ArthurTaborda
Apr 13 2013
ksolsim
Apr 13 2013
migue
Apr 13 2013
elboulangero
Jan 07 2013
n-k
Jan 06 2013
xMaki
Oct 02 2012
CobraDOT
Aug 13 2012
Pafrape
Jun 15 2012
remix
Apr 03 2012
ZaWertun
Feb 03 2012
CatchTime
Dec 02 2011
paran0idx
Dec 02 2011
Bert
Aug 31 2010
olenz
May 11 2010
janet
Apr 30 2010
vazoline
Nov 02 2009
Pitmairen
Jul 02 2009
ahri
May 19 2009
deabru
Mar 27 2009
Sheridan
Mar 27 2009
File (click to download) Version Description Downloads Date Filesize DL OCS-Install MD5SUM
*Needs pling-store or ocs-url to install things
Pling
0 Affiliates
Details
license
version
4.1.4 "Hello QML"
updated Nov 01 2013
added Nov 08 2008
downloads 24h
0
mediaviews 24h 0
pageviews 24h 16