From 6162e04028ccde6645bf58b24e368f5ac9a9f8ae Mon Sep 17 00:00:00 2001 From: Thomas Liebetraut Date: Fri, 1 Nov 2013 22:26:41 +0100 Subject: [PATCH 1/3] hg graft commit "Added temporary custom timer entry to the menu" --- src/extension.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/extension.js b/src/extension.js index 682e8c7..4e2483e 100644 --- a/src/extension.js +++ b/src/extension.js @@ -162,6 +162,37 @@ const TeaTime = new Lang.Class({ })); this.menu.addMenuItem(menuItem); } + let bottom = new PopupMenu.PopupMenuSection(); + this._customEntry = new St.Entry({ style_class: 'teatime-custom-entry', + track_hover: true, + hint_text: "Custom..." }); + this._customEntry.get_clutter_text().set_max_length(10); + this._customEntry.get_clutter_text().connect("key-press-event", Lang.bind(this, this._createCustomTimer)); + bottom.box.add(this._customEntry); + bottom.actor.set_style("padding: 0px 20px;") + this.menu.addMenuItem(bottom); + }, + _createCustomTimer: function(text, event) { + if (event.get_key_symbol() == Clutter.KEY_Enter || + event.get_key_symbol() == Clutter.KEY_Return) { + + let customTime = text.get_text(); + let seconds = 0; + let match = customTime.match(/^(?:(\d+)(?::(\d{0,2}))?|:(\d+))$/) + if (match) { + if (match[3]) + seconds = parseInt(match[3]); + else { + if (match[1]) + seconds += parseInt(match[1]) * 60; + if (match[2]) + seconds += parseInt(match[2]); + } + this._initCountdown(seconds); + this.menu.close(); + } + this._customEntry.set_text(""); + } }, _showNotification : function(subject, text) { let source = new MessageTray.Source(_("TeaTime applet"), 'utilities-teatime'); From c37ec5f71fcb7aec2a6da0334179a22cbc88f322 Mon Sep 17 00:00:00 2001 From: Thomas Liebetraut Date: Fri, 1 Nov 2013 22:27:31 +0100 Subject: [PATCH 2/3] hg graft commit "Cleaner menu structure, nicer custom entry field" --- src/extension.js | 28 +++++++++++++++++----------- src/stylesheet.css | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 11 deletions(-) create mode 100644 src/stylesheet.css diff --git a/src/extension.js b/src/extension.js index 4e2483e..77b83be 100644 --- a/src/extension.js +++ b/src/extension.js @@ -145,11 +145,26 @@ const TeaTime = new Lang.Class({ this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem()); this._settings.connect("changed::" + Utils.TEATIME_STEEP_TIMES_KEY, Lang.bind(this, this._updateTeaList)); + + this.teaItemCont = new PopupMenu.PopupMenuSection(); + this.menu.addMenuItem(this.teaItemCont); + + let bottom = new PopupMenu.PopupMenuSection(); + this._customEntry = new St.Entry({ style_class: 'teatime-custom-entry', + track_hover: true, + hint_text: "Custom..." }); + this._customEntry.get_clutter_text().set_max_length(10); + this._customEntry.get_clutter_text().connect("key-press-event", Lang.bind(this, this._createCustomTimer)); + bottom.box.add(this._customEntry); + bottom.actor.set_style("padding: 0px 18px;") + + this.menu.addMenuItem(bottom); + this._updateTeaList(); }, _updateTeaList : function(config, output) { // make sure the menu is empty - this.menu.removeAll(); + this.teaItemCont.removeAll(); // fill with new teas let list = this._settings.get_value(Utils.TEATIME_STEEP_TIMES_KEY).unpack(); @@ -160,17 +175,8 @@ const TeaTime = new Lang.Class({ menuItem.connect('activate', Lang.bind(this, function() { this._initCountdown(time); })); - this.menu.addMenuItem(menuItem); + this.teaItemCont.addMenuItem(menuItem); } - let bottom = new PopupMenu.PopupMenuSection(); - this._customEntry = new St.Entry({ style_class: 'teatime-custom-entry', - track_hover: true, - hint_text: "Custom..." }); - this._customEntry.get_clutter_text().set_max_length(10); - this._customEntry.get_clutter_text().connect("key-press-event", Lang.bind(this, this._createCustomTimer)); - bottom.box.add(this._customEntry); - bottom.actor.set_style("padding: 0px 20px;") - this.menu.addMenuItem(bottom); }, _createCustomTimer: function(text, event) { if (event.get_key_symbol() == Clutter.KEY_Enter || diff --git a/src/stylesheet.css b/src/stylesheet.css new file mode 100644 index 0000000..ae478f8 --- /dev/null +++ b/src/stylesheet.css @@ -0,0 +1,34 @@ +.teatime-custom-entry { + color: rgb(128, 128, 128); + caret-color: rgb(128, 128, 128); + font-size: 12pt; + caret-size: 1px; + selected-color: white; + padding: 4px 4px; + + border: 2px solid rgba(245,245,245,0.2); + background-gradient-start: rgba(5,5,6,0.1); + background-gradient-end: rgba(254,254,254,0.1); + background-gradient-direction: vertical; + transition-duration: 300; + box-shadow: inset 0px 2px 4px rgba(0,0,0,0.6); + border-radius: 5px; +} + +.teatime-custom-entry:hover, +.teatime-custom-entry:focus + { + color: rgb(64, 64, 64); + caret-color: rgb(64, 64, 64); + border: 2px solid rgb(136,138,133); + background-gradient-start: rgb(200,200,200); + background-gradient-end: white; + background-gradient-direction: vertical; + box-shadow: inset 0px 2px 4px rgba(0,0,0,0.6); + transition-duration: 300; +} + +.teatime-custom-entry:focus { + font-weight: bold; + transition-duration: 0; +} From 2af944a2a354e5a9dedb7bfa5ad0581410cbb53f Mon Sep 17 00:00:00 2001 From: Olaf Leidinger Date: Sun, 3 Nov 2013 16:02:26 +0100 Subject: [PATCH 3/3] update translations --- po/TeaTime.pot | 16 ++++++++++------ po/de.po | 20 ++++++++++++-------- src/extension.js | 2 +- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/po/TeaTime.pot b/po/TeaTime.pot index bf12683..9f3f3de 100644 --- a/po/TeaTime.pot +++ b/po/TeaTime.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-11-03 13:48+0100\n" +"POT-Creation-Date: 2013-11-03 16:00+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,24 +17,28 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: ../src/extension.js:82 ../src/extension.js:203 +#: ../src/extension.js:82 ../src/extension.js:240 msgid "Your tea is ready!" msgstr "" -#: ../src/extension.js:167 +#: ../src/extension.js:155 +msgid "Direct input..." +msgstr "" + +#: ../src/extension.js:204 msgid "TeaTime applet" msgstr "" -#: ../src/extension.js:184 +#: ../src/extension.js:221 msgid "Timer set!" msgstr "" -#: ../src/extension.js:184 +#: ../src/extension.js:221 #, javascript-format msgid "%ss to go" msgstr "" -#: ../src/extension.js:204 +#: ../src/extension.js:241 msgid "Drink it, while it is hot!" msgstr "" diff --git a/po/de.po b/po/de.po index bd4dd57..f03a5cb 100644 --- a/po/de.po +++ b/po/de.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: TeaTime 7\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-11-03 13:48+0100\n" +"POT-Creation-Date: 2013-11-03 16:00+0100\n" "PO-Revision-Date: 2013-10-31 09:38+0100\n" "Last-Translator: Olaf Leidinger \n" "Language-Team: German\n" @@ -19,24 +19,28 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Generator: Poedit 1.5.7\n" -#: ../src/extension.js:82 ../src/extension.js:203 +#: ../src/extension.js:82 ../src/extension.js:240 msgid "Your tea is ready!" msgstr "Dein Tee ist fertig!" -#: ../src/extension.js:167 +#: ../src/extension.js:155 +msgid "Direct input..." +msgstr "Direkteingabe" + +#: ../src/extension.js:204 msgid "TeaTime applet" msgstr "TeaTime applet" -#: ../src/extension.js:184 +#: ../src/extension.js:221 msgid "Timer set!" msgstr "Die Zeit läuft!" -#: ../src/extension.js:184 -#, fuzzy, javascript-format +#: ../src/extension.js:221 +#, javascript-format msgid "%ss to go" -msgstr "ss verbleiben" +msgstr "%ss verbleiben" -#: ../src/extension.js:204 +#: ../src/extension.js:241 msgid "Drink it, while it is hot!" msgstr "Trink ihn, solange er noch heiß ist!" diff --git a/src/extension.js b/src/extension.js index 77b83be..4ab7a9b 100644 --- a/src/extension.js +++ b/src/extension.js @@ -152,7 +152,7 @@ const TeaTime = new Lang.Class({ let bottom = new PopupMenu.PopupMenuSection(); this._customEntry = new St.Entry({ style_class: 'teatime-custom-entry', track_hover: true, - hint_text: "Custom..." }); + hint_text: _("Direct input...") }); this._customEntry.get_clutter_text().set_max_length(10); this._customEntry.get_clutter_text().connect("key-press-event", Lang.bind(this, this._createCustomTimer)); bottom.box.add(this._customEntry);