second page, timezone selection :)
parent
3327f5c606
commit
0ce2e83acd
@ -1 +1,2 @@
|
||||
/subprojects/blueprint-compiler
|
||||
build/
|
||||
|
@ -0,0 +1,8 @@
|
||||
pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name())
|
||||
widgetsdir = join_paths(pkgdatadir, 'jade_gui/widgets')
|
||||
|
||||
jade_gui_sources = [
|
||||
'__init__.py',
|
||||
'timezone.py',
|
||||
]
|
||||
install_data(jade_gui_sources, install_dir: widgetsdir)
|
@ -0,0 +1,15 @@
|
||||
using Gtk 4.0;
|
||||
using Adw 1;
|
||||
|
||||
template TimezoneEntry : Adw.ActionRow {
|
||||
title: "region/location";
|
||||
subtitle: "timezone UTC +XX:XX";
|
||||
Gtk.Box {
|
||||
spacing: 6;
|
||||
Gtk.Label time_label {
|
||||
valign: center;
|
||||
label: "Current time";
|
||||
styles ["tag", "caption"]
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
# timezone-entry.py
|
||||
|
||||
#
|
||||
# Copyright 2022 user
|
||||
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# 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 General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from datetime import datetime
|
||||
import pytz
|
||||
from gi.repository import Gtk, GLib, Adw
|
||||
from gettext import gettext as _
|
||||
|
||||
@Gtk.Template(resource_path='/al/getcyrst/jadegui/widgets/timezone.ui')
|
||||
class TimezoneEntry(Adw.ActionRow):
|
||||
__gtype_name__ = 'TimezoneEntry'
|
||||
|
||||
time_label = Gtk.Template.Child()
|
||||
|
||||
def __init__(self, window, location, region, locale, timezone, application, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
|
||||
self.set_title(region+"/"+location)
|
||||
self.set_subtitle(timezone)
|
||||
|
||||
self.time_label.set_text(self.calculate_time(location, region))
|
||||
|
||||
def calculate_time(widget, location, region):
|
||||
timezone = pytz.timezone(location+"/"+region)
|
||||
datetime_timezone = datetime.now(timezone)
|
||||
return datetime_timezone.strftime('%H:%M')
|
Loading…
Reference in New Issue