Commit 727e9ced authored by Daniel Garcia Moreno's avatar Daniel Garcia Moreno

Merge branch 'separate-activities' into 'master'

Add Row header to group by day

Closes #16

See merge request !10
parents ef22de04 13e65c5e
Pipeline #131973 passed with stage
in 46 seconds
......@@ -41,3 +41,10 @@ list row {
padding: 6px;
font-size: small;
}
.activity-header {
font-size: small;
background-color: @theme_selected_bg_color;
color: @theme_selected_fg_color;
padding: 4px;
}
{
"app-id": "net.danigm.timetrackDevel",
"runtime" : "org.gnome.Platform",
"runtime-version" : "master",
"runtime": "org.gnome.Platform",
"runtime-version": "master",
"separate-locales": false,
"sdk" : "org.gnome.Sdk",
"tags" : [
"sdk": "org.gnome.Sdk",
"tags": [
"devel",
"development",
"nightly"
],
"desktop-file-name-prefix": "(Development) ",
"command" : "timetrack",
"finish-args" : [
"command": "timetrack",
"finish-args": [
"--share=ipc",
"--socket=x11",
"--socket=wayland",
......@@ -22,33 +22,50 @@
"--talk-name=ca.desrt.dconf",
"--talk-name=org.freedesktop.Notifications"
],
"modules" : [
"modules": [
{
"name" : "libhandy",
"buildsystem" : "meson",
"config-opts" : [
"name": "libhandy",
"buildsystem": "meson",
"config-opts": [
"-Dintrospection=enabled",
"-Dglade_catalog=disabled",
"-Dtests=false",
"-Dexamples=false"
],
"sources" : [
"sources": [
{
"type": "git",
"url": "https://source.puri.sm/Librem5/libhandy.git"
}
]
},
{
"name": "timeago",
"buildsystem": "simple",
"ensure-writable": [
"easy-install.pth"
],
"build-commands": [
"python3 setup.py install --prefix=/app"
],
"sources": [
{
"type" : "git",
"url" : "https://source.puri.sm/Librem5/libhandy.git"
"type": "archive",
"url": "https://files.pythonhosted.org/packages/02/1f/8a5a6eff81c46a36935374aca2abf27887f2bc22934f2e9ddc2aa5b3b184/timeago-1.0.10.tar.gz",
"sha256": "1e26ed34cc1fdcdbb949a0d9603a78d9b794ec1ec2a6179a13466596cbdc2320"
}
]
},
{
"name" : "timetrack",
"buildsystem" : "meson",
"name": "timetrack",
"buildsystem": "meson",
"config-opts": [
"-Dprofile=development"
],
"sources" : [
"sources": [
{
"type" : "git",
"url" : "https://gitlab.gnome.org/danigm/timetrack.git"
"type": "git",
"url": "https://gitlab.gnome.org/danigm/timetrack.git"
}
]
}
......
......@@ -7,6 +7,7 @@ from gi.repository import GLib
from gi.repository.GdkPixbuf import Pixbuf
import os
import ntpath
import timeago
import threading
from datetime import datetime, timedelta
......@@ -124,6 +125,7 @@ class MainWindow(Gtk.ApplicationWindow):
self.activity_model = Gio.ListStore()
self.activity_list.bind_model(self.activity_model,
self.create_activity_widget)
self.activity_list.set_header_func(self.create_activity_header, None, None)
self.activity_list.connect("selected-rows-changed", self.update_actions,
None)
......@@ -597,6 +599,28 @@ class MainWindow(Gtk.ApplicationWindow):
def create_activity_widget(self, item):
return ActivityWidget(item)
def create_activity_header(self, row, before, *args):
new_day = False
text = _("today")
act = row.get_child().activity
if act.start.day != datetime.now().day:
text = timeago.format(act.start)
day_label = Gtk.Label(text)
context = day_label.get_style_context()
context.add_class("activity-header")
if before:
act_before = before.get_child().activity
new_day = act_before.start.day != act.start.day
if new_day:
row.set_header(day_label)
else:
row.set_header(None)
else:
row.set_header(day_label)
def create_activity_summary_widget(self, item):
return ActivitySummaryWidget(item)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment