diff --git a/systray_world_clock/README.rst b/systray_world_clock/README.rst new file mode 100644 index 000000000..8979a7d85 --- /dev/null +++ b/systray_world_clock/README.rst @@ -0,0 +1,50 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: https://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +Systray World Clock +=================== +Module enables user to add world clocks of selected timezones in the systray +dropdown. + +Configuration +============= +The desired timezone and title for the clocks can be configured in the settings +page. + +Company +------- +* `Cybrosys Techno Solutions `__ + +License +------- +GNU AFFERO GENERAL PUBLIC LICENSE, Version 3 (AGPLv3) +(http://www.gnu.org/licenses/agpl-3.0-standalone.html) + +Credits +------- +* Developer: (V15) Abhijith PG, Contact: odoo@cybrosys.com + +Contacts +-------- +* Mail Contact : odoo@cybrosys.com +* Website : https://cybrosys.com + +Bug Tracker +----------- +Bugs are tracked on GitHub Issues. In case of trouble, please check there if +your issue has already been reported. + +Maintainer +========== +.. image:: https://cybrosys.com/images/logo.png + :target: https://cybrosys.com + +This module is maintained by Cybrosys Technologies. + +For support and more information, please visit +`Our Website `__ + +Further information +=================== +HTML Description: ``__ diff --git a/systray_world_clock/__init__.py b/systray_world_clock/__init__.py new file mode 100644 index 000000000..476b2f42d --- /dev/null +++ b/systray_world_clock/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Abhijith PG (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import models diff --git a/systray_world_clock/__manifest__.py b/systray_world_clock/__manifest__.py new file mode 100644 index 000000000..162d1c929 --- /dev/null +++ b/systray_world_clock/__manifest__.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Abhijith PG (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +{ + 'name': "Systray World Clock", + 'version': '15.0.1.0.0', + 'category': 'Productivity', + 'summary': """Keep track of the time in different countries around the + world.""", + 'description': """This module adds a world clock in the systray which + displays the time in different countries around the world. The time zone + can be customized in the settings""", + 'author': "Cybrosys Techno Solutions", + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': "https://www.cybrosys.com", + 'depends': ['base'], + 'data': [ + 'security/ir.model.access.csv', + 'views/systray_world_clock_config_views.xml', + ], + 'assets': { + 'web.assets_backend': [ + 'systray_world_clock/static/src/js/systray_world_clock.js', + 'systray_world_clock/static/src/scss/systray_world_clock.scss' + ], + 'web.assets_qweb': [ + 'systray_world_clock/static/src/xml/systray_world_clock.xml' + ], + }, + 'images': ['static/description/banner.jpg'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': True, +} diff --git a/systray_world_clock/doc/RELEASE_NOTES.md b/systray_world_clock/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..2cea31561 --- /dev/null +++ b/systray_world_clock/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 01.08.2023 +#### Version 15.0.1.0.0 +#### ADD +- Initial commit for Systray World Clock diff --git a/systray_world_clock/models/__init__.py b/systray_world_clock/models/__init__.py new file mode 100644 index 000000000..04b6ee99d --- /dev/null +++ b/systray_world_clock/models/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Abhijith PG (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import systray_world_clock_config diff --git a/systray_world_clock/models/systray_world_clock_config.py b/systray_world_clock/models/systray_world_clock_config.py new file mode 100644 index 000000000..44c421644 --- /dev/null +++ b/systray_world_clock/models/systray_world_clock_config.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Abhijith PG (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +import pytz +from datetime import datetime +from odoo import api, fields, models +from odoo.addons.base.models.res_partner import _tz_get + + +class SystrayWorldClockConfig(models.Model): + """A model representing the configuration of a world clock in the systray. + """ + _name = 'systray.world.clock.config' + _description = 'Systray World Clock Configuration' + + name = fields.Char(string='Location', required=True, + help='Location associated with this clock.') + tz = fields.Selection(_tz_get, required=True, string='Timezone', + help='Timezone of the clock.') + offset = fields.Float(string="Offset", + help='The time difference between the timezone and ' + 'UTC, in hours.') + + @api.onchange('tz') + def _onchange_tz(self): + """Calculate the time offset between the selected timezone and UTC. + This method is called automatically whenever the timezone field is + changed. + """ + if self.tz: + utc_dt = pytz.utc.localize(datetime.utcnow()) + tz = pytz.timezone(self.tz) + local_dt = utc_dt.astimezone(tz) + self.offset = local_dt.utcoffset().total_seconds() / 3600 diff --git a/systray_world_clock/security/ir.model.access.csv b/systray_world_clock/security/ir.model.access.csv new file mode 100644 index 000000000..d7e3a33a0 --- /dev/null +++ b/systray_world_clock/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_systray_world_clock_config_user,access.systray.world.clock.config.user,model_systray_world_clock_config,base.group_user,1,1,1,1 diff --git a/systray_world_clock/static/description/assets/icons/check.png b/systray_world_clock/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/systray_world_clock/static/description/assets/icons/check.png differ diff --git a/systray_world_clock/static/description/assets/icons/chevron.png b/systray_world_clock/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/systray_world_clock/static/description/assets/icons/chevron.png differ diff --git a/systray_world_clock/static/description/assets/icons/cogs.png b/systray_world_clock/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/systray_world_clock/static/description/assets/icons/cogs.png differ diff --git a/systray_world_clock/static/description/assets/icons/consultation.png b/systray_world_clock/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/systray_world_clock/static/description/assets/icons/consultation.png differ diff --git a/systray_world_clock/static/description/assets/icons/ecom-black.png b/systray_world_clock/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/systray_world_clock/static/description/assets/icons/ecom-black.png differ diff --git a/systray_world_clock/static/description/assets/icons/education-black.png b/systray_world_clock/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/systray_world_clock/static/description/assets/icons/education-black.png differ diff --git a/systray_world_clock/static/description/assets/icons/hotel-black.png b/systray_world_clock/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/systray_world_clock/static/description/assets/icons/hotel-black.png differ diff --git a/systray_world_clock/static/description/assets/icons/license.png b/systray_world_clock/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/systray_world_clock/static/description/assets/icons/license.png differ diff --git a/systray_world_clock/static/description/assets/icons/lifebuoy.png b/systray_world_clock/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/systray_world_clock/static/description/assets/icons/lifebuoy.png differ diff --git a/systray_world_clock/static/description/assets/icons/logo.png b/systray_world_clock/static/description/assets/icons/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/systray_world_clock/static/description/assets/icons/logo.png differ diff --git a/systray_world_clock/static/description/assets/icons/manufacturing-black.png b/systray_world_clock/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/systray_world_clock/static/description/assets/icons/manufacturing-black.png differ diff --git a/systray_world_clock/static/description/assets/icons/pos-black.png b/systray_world_clock/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/systray_world_clock/static/description/assets/icons/pos-black.png differ diff --git a/systray_world_clock/static/description/assets/icons/puzzle.png b/systray_world_clock/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/systray_world_clock/static/description/assets/icons/puzzle.png differ diff --git a/systray_world_clock/static/description/assets/icons/restaurant-black.png b/systray_world_clock/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/systray_world_clock/static/description/assets/icons/restaurant-black.png differ diff --git a/systray_world_clock/static/description/assets/icons/service-black.png b/systray_world_clock/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/systray_world_clock/static/description/assets/icons/service-black.png differ diff --git a/systray_world_clock/static/description/assets/icons/trading-black.png b/systray_world_clock/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/systray_world_clock/static/description/assets/icons/trading-black.png differ diff --git a/systray_world_clock/static/description/assets/icons/training.png b/systray_world_clock/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/systray_world_clock/static/description/assets/icons/training.png differ diff --git a/systray_world_clock/static/description/assets/icons/update.png b/systray_world_clock/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/systray_world_clock/static/description/assets/icons/update.png differ diff --git a/systray_world_clock/static/description/assets/icons/user.png b/systray_world_clock/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/systray_world_clock/static/description/assets/icons/user.png differ diff --git a/systray_world_clock/static/description/assets/icons/wrench.png b/systray_world_clock/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/systray_world_clock/static/description/assets/icons/wrench.png differ diff --git a/systray_world_clock/static/description/assets/modules/budget_image.png b/systray_world_clock/static/description/assets/modules/budget_image.png new file mode 100644 index 000000000..b50130c7d Binary files /dev/null and b/systray_world_clock/static/description/assets/modules/budget_image.png differ diff --git a/systray_world_clock/static/description/assets/modules/credit_image.png b/systray_world_clock/static/description/assets/modules/credit_image.png new file mode 100644 index 000000000..3ad04ecfd Binary files /dev/null and b/systray_world_clock/static/description/assets/modules/credit_image.png differ diff --git a/systray_world_clock/static/description/assets/modules/employee_image.png b/systray_world_clock/static/description/assets/modules/employee_image.png new file mode 100644 index 000000000..30ad58232 Binary files /dev/null and b/systray_world_clock/static/description/assets/modules/employee_image.png differ diff --git a/systray_world_clock/static/description/assets/modules/export_image.png b/systray_world_clock/static/description/assets/modules/export_image.png new file mode 100644 index 000000000..492980ad0 Binary files /dev/null and b/systray_world_clock/static/description/assets/modules/export_image.png differ diff --git a/systray_world_clock/static/description/assets/modules/gantt_image.png b/systray_world_clock/static/description/assets/modules/gantt_image.png new file mode 100644 index 000000000..1ae7cfe3b Binary files /dev/null and b/systray_world_clock/static/description/assets/modules/gantt_image.png differ diff --git a/systray_world_clock/static/description/assets/modules/quotation_image.png b/systray_world_clock/static/description/assets/modules/quotation_image.png new file mode 100644 index 000000000..499b1a72f Binary files /dev/null and b/systray_world_clock/static/description/assets/modules/quotation_image.png differ diff --git a/systray_world_clock/static/description/assets/screenshots/clocks.png b/systray_world_clock/static/description/assets/screenshots/clocks.png new file mode 100644 index 000000000..8c8f07e38 Binary files /dev/null and b/systray_world_clock/static/description/assets/screenshots/clocks.png differ diff --git a/systray_world_clock/static/description/assets/screenshots/hero.gif b/systray_world_clock/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..d0d0159d7 Binary files /dev/null and b/systray_world_clock/static/description/assets/screenshots/hero.gif differ diff --git a/systray_world_clock/static/description/assets/screenshots/settings.png b/systray_world_clock/static/description/assets/screenshots/settings.png new file mode 100644 index 000000000..dc70f195a Binary files /dev/null and b/systray_world_clock/static/description/assets/screenshots/settings.png differ diff --git a/systray_world_clock/static/description/banner.jpg b/systray_world_clock/static/description/banner.jpg new file mode 100644 index 000000000..960808f42 Binary files /dev/null and b/systray_world_clock/static/description/banner.jpg differ diff --git a/systray_world_clock/static/description/icon.png b/systray_world_clock/static/description/icon.png new file mode 100644 index 000000000..c1f85eb13 Binary files /dev/null and b/systray_world_clock/static/description/icon.png differ diff --git a/systray_world_clock/static/description/index.html b/systray_world_clock/static/description/index.html new file mode 100644 index 000000000..52e1e8838 --- /dev/null +++ b/systray_world_clock/static/description/index.html @@ -0,0 +1,575 @@ +
+
+
+
+ +
+
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+ +
+
+
+
+ +
+
+
+

+ Systray World Clock

+

+ The World Clock in the Systray. +

+ +
+
+ + + + +
+
+

+ Overview +

+
+ +
+

+ + This module provides users with a systray world clock feature + that allows them to track time zones for different cities + around the world.

+ +
+
+ + +
+
+

+ Features +

+
+ +
+
+ +
+
+

+ Can add different timezones. +

+
+
+
+
+ +
+
+

+ Displays the digital and analogue time.

+
+
+ +
+
+ +
+
+

+ Clock faces changes color at nighttime.

+
+
+ +
+ +
+
+

+ Screenshots +

+
+
+

+ The Clocks will appear like this.

+

+ + The globe icon in systray opens the interface with all the clocks configured in the settings. The settings button opens the configuration page.

+ +
+
+

+ Settings.

+

+ + Configure the Location and Timezone here.

+ +
+ +
+ + +
+
+

Suggested Products

+
+ + +
+
+ + + +
+
+
+

Our Services

+
+
+ +
+
+ +
+
+ Odoo + Customization
+
+ +
+
+ +
+
+ Odoo + Implementation
+
+ +
+
+ +
+
+ Odoo + Support
+
+ + +
+
+ +
+
+ Hire + Odoo + Developer
+
+ +
+
+ +
+
+ Odoo + Integration
+
+ +
+
+ +
+
+ Odoo + Migration
+
+ + +
+
+ +
+
+ Odoo + Consultancy
+
+ +
+
+ +
+
+ Odoo + Implementation
+
+ +
+
+ +
+
+ Odoo + Licensing Consultancy
+
+
+
+ + + +
+
+
+

Our Industries

+
+
+ +
+
+ +
+ Trading +
+

+ Easily procure + and + sell your products

+
+
+ +
+
+ +
+ POS +
+

+ Easy + configuration + and convivial experience

+
+
+ +
+
+ +
+ Education +
+

+ A platform for + educational management

+
+
+ +
+
+ +
+ Manufacturing +
+

+ Plan, track and + schedule your operations

+
+
+ +
+
+ +
+ E-commerce & Website +
+

+ Mobile + friendly, + awe-inspiring product pages

+
+
+ +
+
+ +
+ Service Management +
+

+ Keep track of + services and invoice

+
+
+ +
+
+ +
+ Restaurant +
+

+ Run your bar or + restaurant methodically

+
+
+ +
+
+ +
+ Hotel Management +
+

+ An + all-inclusive + hotel management application

+
+
+ +
+
+ + + + + +
+
+
+

Need Help?

+
+
+
+ + +
+ +
+ + +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+
+
+ + +
\ No newline at end of file diff --git a/systray_world_clock/static/src/js/systray_world_clock.js b/systray_world_clock/static/src/js/systray_world_clock.js new file mode 100644 index 000000000..708f27a91 --- /dev/null +++ b/systray_world_clock/static/src/js/systray_world_clock.js @@ -0,0 +1,168 @@ +/** @odoo-module **/ +import core from 'web.core'; +import SystrayMenu from 'web.SystrayMenu'; +import Widget from 'web.Widget'; +var QWeb = core.qweb; +var ClockWidget = Widget.extend({ + template: 'Systray_clock', + events: { + 'show.bs.dropdown': 'onClickWorldClock', + 'hide.bs.dropdown': 'stopTimer', + 'click .settings': 'onClickSettings' + }, + /** + * Fetch data from the server to display the world clocks. Uses the RPC + * method to search and read data from the 'systray.world.clock.config' + * model with an empty domain and retrieves the 'name', 'tz', and + * 'offset' fields. The function then assigns the retrieved clock + * configurations to the ClockWidget instance's 'ClockConfigIds' property. + * + * @returns {Promise} A promise that resolves with the clock + * configurations retrieved from the server. + */ + willStart: function () { + var self = this; + return self._rpc({ + model: 'systray.world.clock.config', + method: 'search_read', + domain: [], + fields: ['name', 'tz', 'offset'] + }).then(function (ClockConfigs) { + self.ClockConfigIds = ClockConfigs; + }); + }, + /** + * This function is called when the icon is clicked on the systray menu. + * Selects the clock container from the DOM, and then renders the clock + * interface and starts the interval timer to keep the clock updated. + */ + onClickWorldClock: function (ev) { + ev.stopPropagation(); + this.clocksContainer = this.el.querySelector('#clocks_container'); + this.renderClock(); + this.intrvl = setInterval(() => { + this.renderClock(); + }, 1000); + }, + // Calculating time based on the offset + calcTime: function (offset) { + const d = new Date(), + utc = d.getTime() + (d.getTimezoneOffset() * 60000); + const nd = new Date(utc + (3600000 * offset)); + const options = { + year: 'numeric', + month: 'numeric', + day: 'numeric', + hour: 'numeric', + minute: 'numeric', + hour12: true + }; + return [nd, nd.toLocaleString('en-US', options)]; + }, + // Rendering the clock interface + renderClock: function () { + var interfaceTemplate; + // checks if no clocks are displayed. + if (!this.el.querySelector('.time-info')) { + if (this.ClockConfigIds.length > 0) { + this.clocksContainer.innerHTML = ''; + } + this.clockRendered = false; + } + //calculates the time for each clock and updates the + // corresponding analogue clock display and digital time information. + for (let clock of this.ClockConfigIds) { + let offsetStr = clock.offset.toString().replace('.', '_'); + let currentClockClass = 'clock' + offsetStr; + + if (!this.clockRendered) { + interfaceTemplate = QWeb.render("AnalogueInterface", { + currentClockClass: currentClockClass, + country: clock.name + }); + } + if (interfaceTemplate) { + this.clocksContainer.innerHTML += interfaceTemplate; + } + /** + * Updates the analogue time of a clock based on its time zone + * offset and renders it on the webpage. + * + * Behavior: + * + * *Uses calcTime function to calculate the current time of the + * clock based on its time zone offset. + * + * *Calculates the angle for each of the clock hands (hour, + * minute, and second) based on the current time. + * + * *Rotates each clock hand to the calculated + * angle using CSS transform: rotate() property. + * + * *Updates the digital time of the clock in the webpage by + * setting the HTML of #digital-info element with localestring. + * + * *Checks the current time and adds/removes night-clock class + * to the clock container based on whether it is daytime or + * nighttime. + */ + this.updateAnalogueTime = function () { + const [nd, localestring] = this.calcTime(clock.offset); + var hoursArr = this.el.querySelectorAll('.' + currentClockClass + ' .hours'); + var minutesArr = this.el.querySelectorAll('.' + currentClockClass + ' .minutes'); + var secondsArr = this.el.querySelectorAll('.' + currentClockClass + ' .seconds'); + let h = (nd.getHours() % 12) + nd.getMinutes() / 59; + let m = nd.getMinutes(); + let s = nd.getSeconds(); + h *= 30; + m *= 6; + s *= 6; + /** + * This function takes in a target element and a value, and + * sets the rotation style of the target element to the + * given value. + * @param target + * @param val + */ + const rotation = (target, val) => { + target.style.transform = `rotate(${val}deg)`; + }; + hoursArr.forEach(hours => rotation(hours, h)); + minutesArr.forEach(minutes => rotation(minutes, m)); + secondsArr.forEach(seconds => rotation(seconds, s)); + $('#clocks_container .' + currentClockClass + '#digital-info').html(localestring); + if (18 <= nd.getHours() || nd.getHours() < 6) { + $('#clocks_container .clock.' + currentClockClass).addClass('night-clock'); + } + else { + $('#clocks_container .' + currentClockClass).removeClass('night-clock'); + } + }; + // to update time in the clocks_container + this.updateTime = function () { + this.updateAnalogueTime(); + }; + this.updateTime(); + } + this.clockRendered = true; + }, + /** + * Stops the interval timer that updates the clocks when the dropdown is + * hidden. It clears the interval timer using the clearInterval method. + */ + stopTimer: function () { + clearInterval(this.intrvl); + }, + // opens settings + onClickSettings: function (ev) { + ev.stopPropagation(); + this.do_action({ + type: 'ir.actions.act_window', + name: 'Clock Settings', + res_model: 'systray.world.clock.config', + view_mode: 'list, form', + views: [[false, 'list'], [false, 'form']] + }); + } +}); +SystrayMenu.Items.push(ClockWidget); diff --git a/systray_world_clock/static/src/scss/systray_world_clock.scss b/systray_world_clock/static/src/scss/systray_world_clock.scss new file mode 100644 index 000000000..5757dc1b7 --- /dev/null +++ b/systray_world_clock/static/src/scss/systray_world_clock.scss @@ -0,0 +1,129 @@ +.systray_clock_dropdown { + padding: 2em; + width: 1100px; + .settings { + position: absolute; + color: #fff; + left: 80em; + background-color: #71639e; + border: solid #71639e; + } +} +#clocks_container { + display: flex; + justify-content: space-evenly; + flex-wrap: wrap; + .time-info { + padding: 10px 30px; + margin: 2em 0; + min-height: 50px; + border: 1px solid #dddddd; + border-radius: 10px; + background-color: transparent; + } +} +.clocks_container:not(:last-child) { + padding: 10px; + min-height: 50px; + border-bottom: 1px solid #9DA1AA; + background-color: transparent; +} +.clocks_container > p { + font-size: 20px; +} + +//button +:root { + --primary-light: #8abdff; + --primary: #6d5dfc; + --primary-dark: #5b0eeb; + --white: #FFFFFF; + --greyLight-1: #E4EBF5; + --greyLight-2: #c8d0e7; + --greyLight-3: #bec8e4; + --greyDark: #9baacf; +} +$shadow: .3rem .3rem .6rem var(--greyLight-2), +-.2rem -.2rem .5rem var(--white); +$inner-shadow: inset .2rem .2rem .5rem var(--greyLight-2), +inset -.2rem -.2rem .5rem var(--white); + +/* CLOCK */ +.clock { + grid-column: 2 / 3; + grid-row: 1 / 3; + width: 12rem; + height: 12rem; + justify-self: center; + box-shadow: $shadow; + border-radius: 50%; + display: flex; + justify-content: center; + align-items: center; + position: relative; + .hand { + position: absolute; + transform-origin: bottom; + bottom: 6rem; + border-radius: .2rem; + z-index: 200; + } + .hours { + width: .4rem; + height: 3.2rem; + background: var(--greyLight-3); + } + .minutes { + width: .4rem; + height: 4.6rem; + background: var(--greyDark); + } + .seconds { + width: .2rem; + height: 5.2rem; + background: var(--primary); + } + .point { + position: absolute; + width: .8rem; + height: .8rem; + border-radius: 50%; + background: var(--primary); + z-index: 300; + } + .in-border { + width: 95%; + height: 95%; + border-radius: 50%; + display: flex; + position: relative; + box-shadow: $inner-shadow; + .center { + width: 60%; + height: 60%; + position: absolute; + box-shadow: inset 1px 1px 1px var(--greyLight-2), + inset -1px -1px 1px var(--white); + border-radius: 50%; + top: 20%; + left: 20%; + filter: blur(1px); + } + div.digit { + position: absolute; + inset: 1px; + text-align: center; + transform: rotate(calc(var(--i) * (360deg / 12))); + span { + display: inline-block; + font-size: 80%; + font-weight: 600; + transform: rotate(calc(var(--i) * (-360deg / 12))); + } + } + } +} +.night-clock { + background-color: black; + color: white; +} diff --git a/systray_world_clock/static/src/xml/systray_world_clock.xml b/systray_world_clock/static/src/xml/systray_world_clock.xml new file mode 100644 index 000000000..e41705ebe --- /dev/null +++ b/systray_world_clock/static/src/xml/systray_world_clock.xml @@ -0,0 +1,90 @@ + + + + + + + + +
+
+ +

+ + +
+ +

+ +
+
+ + + + +
+
+ 1 +
+
+ 2 +
+
+ 3 +
+
+ 4 +
+
+ 5 +
+
+ 6 +
+
+ 7 +
+
+ 8 +
+
+ 9 +
+
+ 10 +
+
+ 11 +
+
+ 12 +
+
+
+
+
+
+ + diff --git a/systray_world_clock/views/systray_world_clock_config_views.xml b/systray_world_clock/views/systray_world_clock_config_views.xml new file mode 100644 index 000000000..e6b7f3b0a --- /dev/null +++ b/systray_world_clock/views/systray_world_clock_config_views.xml @@ -0,0 +1,15 @@ + + + + + systray.world.clock.config.view.tree + systray.world.clock.config + + + + + + + + +