Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
timetrack
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
12
Issues
12
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Daniel Garcia Moreno
timetrack
Commits
13678f87
Commit
13678f87
authored
Feb 01, 2019
by
Daniel Garcia Moreno
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'diegogangl/timetrack-wip/comments'
parents
fc8215be
b3bf2964
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
175 additions
and
32 deletions
+175
-32
data/edit_dialog.ui
data/edit_dialog.ui
+65
-17
data/main_window.ui
data/main_window.ui
+49
-1
data/timetrack.css
data/timetrack.css
+9
-0
timetrack/activity.py
timetrack/activity.py
+12
-1
timetrack/db.py
timetrack/db.py
+16
-8
timetrack/edit.py
timetrack/edit.py
+9
-1
timetrack/main_window.py
timetrack/main_window.py
+15
-4
No files found.
data/edit_dialog.ui
View file @
13678f87
...
@@ -2,17 +2,6 @@
...
@@ -2,17 +2,6 @@
<!-- Generated with glade 3.22.1 -->
<!-- Generated with glade 3.22.1 -->
<interface>
<interface>
<requires
lib=
"gtk+"
version=
"3.20"
/>
<requires
lib=
"gtk+"
version=
"3.20"
/>
<object
class=
"GtkAdjustment"
id=
"hour"
>
<property
name=
"upper"
>
100
</property>
<property
name=
"value"
>
1
</property>
<property
name=
"step_increment"
>
2
</property>
<property
name=
"page_increment"
>
10
</property>
</object>
<object
class=
"GtkAdjustment"
id=
"minute"
>
<property
name=
"upper"
>
60
</property>
<property
name=
"step_increment"
>
10
</property>
<property
name=
"page_increment"
>
30
</property>
</object>
<object
class=
"GtkAdjustment"
id=
"edit-hour-adj"
>
<object
class=
"GtkAdjustment"
id=
"edit-hour-adj"
>
<property
name=
"upper"
>
24
</property>
<property
name=
"upper"
>
24
</property>
<property
name=
"value"
>
12
</property>
<property
name=
"value"
>
12
</property>
...
@@ -24,10 +13,24 @@
...
@@ -24,10 +13,24 @@
<property
name=
"step_increment"
>
10
</property>
<property
name=
"step_increment"
>
10
</property>
<property
name=
"page_increment"
>
30
</property>
<property
name=
"page_increment"
>
30
</property>
</object>
</object>
<object
class=
"GtkAdjustment"
id=
"hour"
>
<property
name=
"upper"
>
100
</property>
<property
name=
"value"
>
1
</property>
<property
name=
"step_increment"
>
2
</property>
<property
name=
"page_increment"
>
10
</property>
</object>
<object
class=
"GtkAdjustment"
id=
"minute"
>
<property
name=
"upper"
>
60
</property>
<property
name=
"step_increment"
>
10
</property>
<property
name=
"page_increment"
>
30
</property>
</object>
<object
class=
"GtkBox"
id=
"edit-box"
>
<object
class=
"GtkBox"
id=
"edit-box"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"margin_left"
>
12
</property>
<property
name=
"margin_right"
>
12
</property>
<property
name=
"margin_top"
>
12
</property>
<property
name=
"margin_bottom"
>
12
</property>
<property
name=
"orientation"
>
vertical
</property>
<property
name=
"orientation"
>
vertical
</property>
<property
name=
"spacing"
>
6
</property>
<property
name=
"spacing"
>
6
</property>
<child>
<child>
...
@@ -52,7 +55,7 @@
...
@@ -52,7 +55,7 @@
<packing>
<packing>
<property
name=
"expand"
>
False
</property>
<property
name=
"expand"
>
False
</property>
<property
name=
"fill"
>
True
</property>
<property
name=
"fill"
>
True
</property>
<property
name=
"position"
>
1
</property>
<property
name=
"position"
>
2
</property>
</packing>
</packing>
</child>
</child>
<child>
<child>
...
@@ -65,7 +68,7 @@
...
@@ -65,7 +68,7 @@
<packing>
<packing>
<property
name=
"expand"
>
False
</property>
<property
name=
"expand"
>
False
</property>
<property
name=
"fill"
>
True
</property>
<property
name=
"fill"
>
True
</property>
<property
name=
"position"
>
2
</property>
<property
name=
"position"
>
3
</property>
</packing>
</packing>
</child>
</child>
<child>
<child>
...
@@ -102,7 +105,7 @@
...
@@ -102,7 +105,7 @@
<packing>
<packing>
<property
name=
"expand"
>
False
</property>
<property
name=
"expand"
>
False
</property>
<property
name=
"fill"
>
True
</property>
<property
name=
"fill"
>
True
</property>
<property
name=
"position"
>
3
</property>
<property
name=
"position"
>
4
</property>
</packing>
</packing>
</child>
</child>
<child>
<child>
...
@@ -115,7 +118,7 @@
...
@@ -115,7 +118,7 @@
<packing>
<packing>
<property
name=
"expand"
>
False
</property>
<property
name=
"expand"
>
False
</property>
<property
name=
"fill"
>
True
</property>
<property
name=
"fill"
>
True
</property>
<property
name=
"position"
>
4
</property>
<property
name=
"position"
>
5
</property>
</packing>
</packing>
</child>
</child>
<child>
<child>
...
@@ -155,7 +158,52 @@
...
@@ -155,7 +158,52 @@
<packing>
<packing>
<property
name=
"expand"
>
False
</property>
<property
name=
"expand"
>
False
</property>
<property
name=
"fill"
>
True
</property>
<property
name=
"fill"
>
True
</property>
<property
name=
"position"
>
5
</property>
<property
name=
"position"
>
6
</property>
</packing>
</child>
<child>
<object
class=
"GtkFrame"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"label_xalign"
>
0
</property>
<property
name=
"shadow_type"
>
none
</property>
<child>
<object
class=
"GtkScrolledWindow"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
<property
name=
"shadow_type"
>
in
</property>
<style>
<class
name=
"comments-frame"
/>
</style>
<child>
<object
class=
"GtkTextView"
id=
"comments"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
<property
name=
"tooltip_text"
translatable=
"yes"
>
Comments about this activity
</property>
<property
name=
"left_margin"
>
5
</property>
<property
name=
"right_margin"
>
5
</property>
<property
name=
"top_margin"
>
5
</property>
<property
name=
"bottom_margin"
>
5
</property>
<property
name=
"input_hints"
>
GTK_INPUT_HINT_SPELLCHECK | GTK_INPUT_HINT_NONE
</property>
<style>
<class
name=
"comments"
/>
</style>
</object>
</child>
</object>
</child>
<child
type=
"label"
>
<object
class=
"GtkLabel"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"label"
translatable=
"yes"
>
Comments
</property>
</object>
</child>
</object>
<packing>
<property
name=
"expand"
>
False
</property>
<property
name=
"fill"
>
True
</property>
<property
name=
"position"
>
8
</property>
</packing>
</packing>
</child>
</child>
</object>
</object>
...
...
data/main_window.ui
View file @
13678f87
...
@@ -539,6 +539,54 @@
...
@@ -539,6 +539,54 @@
<property
name=
"position"
>
3
</property>
<property
name=
"position"
>
3
</property>
</packing>
</packing>
</child>
</child>
<child>
<object
class=
"GtkFrame"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"label_xalign"
>
0
</property>
<property
name=
"shadow_type"
>
none
</property>
<child>
<object
class=
"GtkScrolledWindow"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
<property
name=
"shadow_type"
>
in
</property>
<style>
<class
name=
"comments-frame"
/>
</style>
<child>
<object
class=
"GtkTextView"
id=
"current-comments"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
<property
name=
"tooltip_text"
translatable=
"yes"
>
Comments about this activity
</property>
<property
name=
"left_margin"
>
5
</property>
<property
name=
"right_margin"
>
5
</property>
<property
name=
"top_margin"
>
5
</property>
<property
name=
"bottom_margin"
>
5
</property>
<property
name=
"input_hints"
>
GTK_INPUT_HINT_SPELLCHECK | GTK_INPUT_HINT_NONE
</property>
<style>
<class
name=
"comments"
/>
</style>
</object>
</child>
</object>
</child>
<child
type=
"label"
>
<object
class=
"GtkLabel"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"label"
translatable=
"yes"
>
Comments
</property>
</object>
</child>
</object>
<packing>
<property
name=
"expand"
>
False
</property>
<property
name=
"fill"
>
True
</property>
<property
name=
"position"
>
4
</property>
</packing>
</child>
<child>
<child>
<object
class=
"GtkLabel"
id=
"current-timer"
>
<object
class=
"GtkLabel"
id=
"current-timer"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"visible"
>
True
</property>
...
@@ -551,7 +599,7 @@
...
@@ -551,7 +599,7 @@
<packing>
<packing>
<property
name=
"expand"
>
False
</property>
<property
name=
"expand"
>
False
</property>
<property
name=
"fill"
>
True
</property>
<property
name=
"fill"
>
True
</property>
<property
name=
"position"
>
4
</property>
<property
name=
"position"
>
5
</property>
</packing>
</packing>
</child>
</child>
</object>
</object>
...
...
data/timetrack.css
View file @
13678f87
...
@@ -32,3 +32,12 @@ list row {
...
@@ -32,3 +32,12 @@ list row {
background-image
:
none
;
background-image
:
none
;
text-shadow
:
none
;
text-shadow
:
none
;
}
}
.comments-frame
{
border
:
1px
solid
@
borders
;
}
.activity-comment
{
padding
:
6px
;
font-size
:
small
;
}
timetrack/activity.py
View file @
13678f87
...
@@ -54,14 +54,16 @@ class Activity(GObject.Object):
...
@@ -54,14 +54,16 @@ class Activity(GObject.Object):
start
:
datetime
=
datetime
.
now
()
start
:
datetime
=
datetime
.
now
()
stop
:
Optional
[
datetime
]
=
None
stop
:
Optional
[
datetime
]
=
None
id
:
Optional
[
int
]
=
None
id
:
Optional
[
int
]
=
None
comments
:
Optional
[
str
]
=
None
def
__init__
(
self
,
name
=
"activity"
,
start
=
datetime
.
now
(),
def
__init__
(
self
,
name
=
"activity"
,
start
=
datetime
.
now
(),
stop
=
None
,
id
=
None
):
stop
=
None
,
id
=
None
,
comments
=
None
):
super
().
__init__
()
super
().
__init__
()
self
.
name
=
name
self
.
name
=
name
self
.
start
=
start
self
.
start
=
start
self
.
stop
=
stop
self
.
stop
=
stop
self
.
id
=
id
self
.
id
=
id
self
.
comments
=
comments
or
""
@
property
@
property
def
seconds
(
self
):
def
seconds
(
self
):
...
@@ -86,6 +88,7 @@ class ActivityWidget(Gtk.Box):
...
@@ -86,6 +88,7 @@ class ActivityWidget(Gtk.Box):
label
=
NotImplemented
label
=
NotImplemented
time_label
=
NotImplemented
time_label
=
NotImplemented
start_label
=
NotImplemented
start_label
=
NotImplemented
comments
=
NotImplemented
activity
=
NotImplemented
activity
=
NotImplemented
activity_id
=
None
activity_id
=
None
...
@@ -118,8 +121,16 @@ class ActivityWidget(Gtk.Box):
...
@@ -118,8 +121,16 @@ class ActivityWidget(Gtk.Box):
box2
.
pack_start
(
self
.
start_label
,
True
,
True
,
6
)
box2
.
pack_start
(
self
.
start_label
,
True
,
True
,
6
)
self
.
comments
=
Gtk
.
Label
(
label
=
act
.
comments
)
self
.
comments
.
set_xalign
(
0.0
)
self
.
comments
.
set_line_wrap
(
True
)
context
=
self
.
comments
.
get_style_context
()
context
.
add_class
(
"dim-label"
)
context
.
add_class
(
"activity-comment"
)
self
.
pack_start
(
box2
,
False
,
False
,
6
)
self
.
pack_start
(
box2
,
False
,
False
,
6
)
self
.
add
(
box1
)
self
.
add
(
box1
)
self
.
add
(
self
.
comments
)
self
.
show_all
()
self
.
show_all
()
...
...
timetrack/db.py
View file @
13678f87
...
@@ -63,11 +63,13 @@ class DB:
...
@@ -63,11 +63,13 @@ class DB:
query
=
'''
query
=
'''
UPDATE activities
UPDATE activities
SET activity = ?, start_date = ?, stop_date = ?, seconds = ?
SET activity = ?, start_date = ?, stop_date = ?, seconds = ?,
comments= ?
WHERE id = ?
WHERE id = ?
'''
'''
c
.
execute
(
query
,
(
act
.
name
,
act
.
start
,
act
.
stop
,
act
.
seconds
,
act
.
id
))
c
.
execute
(
query
,
(
act
.
name
,
act
.
start
,
act
.
stop
,
act
.
seconds
,
act
.
comments
,
act
.
id
))
self
.
connection
.
commit
()
self
.
connection
.
commit
()
return
act
.
id
return
act
.
id
...
@@ -91,7 +93,8 @@ class DB:
...
@@ -91,7 +93,8 @@ class DB:
id,
id,
activity,
activity,
start_date as "d1 [datetime]",
start_date as "d1 [datetime]",
stop_date as "d2 [datetime]"
stop_date as "d2 [datetime]",
comments
FROM activities
FROM activities
WHERE id = ?
WHERE id = ?
'''
'''
...
@@ -100,7 +103,8 @@ class DB:
...
@@ -100,7 +103,8 @@ class DB:
if
not
rows
:
if
not
rows
:
return
None
return
None
row
=
rows
[
0
]
row
=
rows
[
0
]
return
Activity
(
id
=
row
[
0
],
name
=
row
[
1
],
start
=
row
[
2
],
stop
=
row
[
3
])
return
Activity
(
id
=
row
[
0
],
name
=
row
[
1
],
start
=
row
[
2
],
stop
=
row
[
3
],
comments
=
row
[
4
])
def
get_last
(
self
,
limit
=
10
,
offset
=
0
):
def
get_last
(
self
,
limit
=
10
,
offset
=
0
):
c
=
self
.
connection
.
cursor
()
c
=
self
.
connection
.
cursor
()
...
@@ -110,14 +114,16 @@ class DB:
...
@@ -110,14 +114,16 @@ class DB:
id,
id,
activity,
activity,
start_date as "d1 [datetime]",
start_date as "d1 [datetime]",
stop_date as "d2 [datetime]"
stop_date as "d2 [datetime]",
comments
FROM activities
FROM activities
ORDER BY start_date desc
ORDER BY start_date desc
LIMIT {} OFFSET {}
LIMIT {} OFFSET {}
'''
.
format
(
limit
,
offset
)
'''
.
format
(
limit
,
offset
)
for
row
in
c
.
execute
(
query
):
for
row
in
c
.
execute
(
query
):
yield
Activity
(
id
=
row
[
0
],
name
=
row
[
1
],
start
=
row
[
2
],
stop
=
row
[
3
])
yield
Activity
(
id
=
row
[
0
],
name
=
row
[
1
],
start
=
row
[
2
],
stop
=
row
[
3
],
comments
=
row
[
4
])
def
get_by_name
(
self
,
name
,
limit
=
10
,
offset
=
0
):
def
get_by_name
(
self
,
name
,
limit
=
10
,
offset
=
0
):
c
=
self
.
connection
.
cursor
()
c
=
self
.
connection
.
cursor
()
...
@@ -127,7 +133,8 @@ class DB:
...
@@ -127,7 +133,8 @@ class DB:
id,
id,
activity,
activity,
start_date as "d1 [datetime]",
start_date as "d1 [datetime]",
stop_date as "d2 [datetime]"
stop_date as "d2 [datetime]",
comments
FROM activities
FROM activities
WHERE activity = ?
WHERE activity = ?
ORDER BY start_date desc
ORDER BY start_date desc
...
@@ -135,7 +142,8 @@ class DB:
...
@@ -135,7 +142,8 @@ class DB:
'''
.
format
(
limit
,
offset
)
'''
.
format
(
limit
,
offset
)
for
row
in
c
.
execute
(
query
,
(
name
,
)):
for
row
in
c
.
execute
(
query
,
(
name
,
)):
yield
Activity
(
id
=
row
[
0
],
name
=
row
[
1
],
start
=
row
[
2
],
stop
=
row
[
3
])
yield
Activity
(
id
=
row
[
0
],
name
=
row
[
1
],
start
=
row
[
2
],
stop
=
row
[
3
],
comments
=
row
[
4
])
def
report
(
self
,
start
=
None
,
end
=
None
,
activity
=
None
):
def
report
(
self
,
start
=
None
,
end
=
None
,
activity
=
None
):
c
=
self
.
connection
.
cursor
()
c
=
self
.
connection
.
cursor
()
...
...
timetrack/edit.py
View file @
13678f87
...
@@ -30,6 +30,7 @@ class EditDialog(Gtk.Dialog):
...
@@ -30,6 +30,7 @@ class EditDialog(Gtk.Dialog):
self
.
start_date
=
builder
.
get_object
(
"edit-calendar"
)
self
.
start_date
=
builder
.
get_object
(
"edit-calendar"
)
self
.
start_hour
=
builder
.
get_object
(
"edit-hour"
)
self
.
start_hour
=
builder
.
get_object
(
"edit-hour"
)
self
.
start_minute
=
builder
.
get_object
(
"edit-minute"
)
self
.
start_minute
=
builder
.
get_object
(
"edit-minute"
)
self
.
comments
=
builder
.
get_object
(
"comments"
)
self
.
working_hour
=
builder
.
get_object
(
"edit-working-hour"
)
self
.
working_hour
=
builder
.
get_object
(
"edit-working-hour"
)
self
.
working_minute
=
builder
.
get_object
(
"edit-working-minute"
)
self
.
working_minute
=
builder
.
get_object
(
"edit-working-minute"
)
...
@@ -61,6 +62,7 @@ class EditDialog(Gtk.Dialog):
...
@@ -61,6 +62,7 @@ class EditDialog(Gtk.Dialog):
act
=
self
.
db
.
get
(
self
.
activity_id
)
act
=
self
.
db
.
get
(
self
.
activity_id
)
self
.
activity_name
.
set_text
(
act
.
name
)
self
.
activity_name
.
set_text
(
act
.
name
)
self
.
comments
.
get_buffer
().
set_text
(
act
.
comments
)
self
.
start_date
.
set_property
(
"day"
,
act
.
start
.
day
)
self
.
start_date
.
set_property
(
"day"
,
act
.
start
.
day
)
self
.
start_date
.
set_property
(
"month"
,
act
.
start
.
month
-
1
)
self
.
start_date
.
set_property
(
"month"
,
act
.
start
.
month
-
1
)
self
.
start_date
.
set_property
(
"year"
,
act
.
start
.
year
)
self
.
start_date
.
set_property
(
"year"
,
act
.
start
.
year
)
...
@@ -96,6 +98,11 @@ class EditDialog(Gtk.Dialog):
...
@@ -96,6 +98,11 @@ class EditDialog(Gtk.Dialog):
name
=
self
.
activity_name
.
get_text
()
name
=
self
.
activity_name
.
get_text
()
date
=
self
.
start_date
.
get_date
()
date
=
self
.
start_date
.
get_date
()
comments_buf
=
self
.
comments
.
get_buffer
()
comments_start
=
comments_buf
.
get_start_iter
()
comments_end
=
comments_buf
.
get_end_iter
()
comments
=
comments_buf
.
get_text
(
comments_start
,
comments_end
,
False
)
start_h
=
self
.
start_hour
.
get_value
()
start_h
=
self
.
start_hour
.
get_value
()
start_m
=
self
.
start_minute
.
get_value
()
start_m
=
self
.
start_minute
.
get_value
()
...
@@ -110,7 +117,8 @@ class EditDialog(Gtk.Dialog):
...
@@ -110,7 +117,8 @@ class EditDialog(Gtk.Dialog):
activity
=
Activity
(
id
=
self
.
activity_id
,
activity
=
Activity
(
id
=
self
.
activity_id
,
name
=
name
,
name
=
name
,
start
=
start_date
,
start
=
start_date
,
stop
=
stop_date
)
stop
=
stop_date
,
comments
=
comments
)
aid
=
self
.
db
.
update
(
activity
)
aid
=
self
.
db
.
update
(
activity
)
activity
.
id
=
aid
activity
.
id
=
aid
...
...
timetrack/main_window.py
View file @
13678f87
...
@@ -130,6 +130,7 @@ class MainWindow(Gtk.ApplicationWindow):
...
@@ -130,6 +130,7 @@ class MainWindow(Gtk.ApplicationWindow):
self
.
current_minute
=
self
.
builder
.
get_object
(
'current-minute'
)
self
.
current_minute
=
self
.
builder
.
get_object
(
'current-minute'
)
self
.
current_day
=
self
.
builder
.
get_object
(
'current-day'
)
self
.
current_day
=
self
.
builder
.
get_object
(
'current-day'
)
self
.
current_timer
=
self
.
builder
.
get_object
(
'current-timer'
)
self
.
current_timer
=
self
.
builder
.
get_object
(
'current-timer'
)
self
.
current_comments
=
self
.
builder
.
get_object
(
'current-comments'
)
self
.
current_name
.
bind_property
(
'text'
,
self
.
activity_label
,
'label'
)
self
.
current_name
.
bind_property
(
'text'
,
self
.
activity_label
,
'label'
)
self
.
timer
.
bind_property
(
'label'
,
self
.
current_timer
,
'label'
)
self
.
timer
.
bind_property
(
'label'
,
self
.
current_timer
,
'label'
)
...
@@ -138,6 +139,7 @@ class MainWindow(Gtk.ApplicationWindow):
...
@@ -138,6 +139,7 @@ class MainWindow(Gtk.ApplicationWindow):
self
.
current_hour
.
connect
(
'changed'
,
self
.
change_current
)
self
.
current_hour
.
connect
(
'changed'
,
self
.
change_current
)
self
.
current_minute
.
connect
(
'changed'
,
self
.
change_current
)
self
.
current_minute
.
connect
(
'changed'
,
self
.
change_current
)
self
.
current_day
.
connect
(
'day-selected'
,
self
.
change_current
)
self
.
current_day
.
connect
(
'day-selected'
,
self
.
change_current
)
self
.
current_comments
.
get_buffer
().
connect
(
'changed'
,
self
.
change_current
)
def
create_report
(
self
):
def
create_report
(
self
):
self
.
report_stack
=
self
.
builder
.
get_object
(
'report-stack'
)
self
.
report_stack
=
self
.
builder
.
get_object
(
'report-stack'
)
...
@@ -550,9 +552,11 @@ class MainWindow(Gtk.ApplicationWindow):
...
@@ -550,9 +552,11 @@ class MainWindow(Gtk.ApplicationWindow):
self
.
current_name
.
set_text
(
activity
.
name
)
self
.
current_name
.
set_text
(
activity
.
name
)
self
.
current_hour
.
set_value
(
activity
.
start
.
hour
)
self
.
current_hour
.
set_value
(
activity
.
start
.
hour
)
self
.
current_minute
.
set_value
(
activity
.
start
.
minute
)
self
.
current_minute
.
set_value
(
activity
.
start
.
minute
)
self
.
current_day
.
year
=
activity
.
start
.
year
self
.
current_day
.
select_month
(
activity
.
start
.
month
-
1
,
self
.
current_day
.
month
=
activity
.
start
.
month
-
1
activity
.
start
.
year
)
self
.
current_day
.
day
=
activity
.
start
.
day
self
.
current_day
.
select_day
(
activity
.
start
.
day
)
self
.
current_comments
.
get_buffer
().
set_text
(
activity
.
comments
)
def
change_current
(
self
,
*
args
,
**
kwargs
):
def
change_current
(
self
,
*
args
,
**
kwargs
):
if
not
self
.
activity_id
or
not
self
.
start_date
:
if
not
self
.
activity_id
or
not
self
.
start_date
:
...
@@ -561,6 +565,11 @@ class MainWindow(Gtk.ApplicationWindow):
...
@@ -561,6 +565,11 @@ class MainWindow(Gtk.ApplicationWindow):
new_date
=
self
.
current_day
.
get_date
()
new_date
=
self
.
current_day
.
get_date
()
name
=
self
.
current_name
.
get_text
()
name
=
self
.
current_name
.
get_text
()
comments_buf
=
self
.
current_comments
.
get_buffer
()
comments_start
=
comments_buf
.
get_start_iter
()
comments_end
=
comments_buf
.
get_end_iter
()
comments
=
comments_buf
.
get_text
(
comments_start
,
comments_end
,
False
)
self
.
start_date
=
datetime
(
new_date
.
year
,
self
.
start_date
=
datetime
(
new_date
.
year
,
new_date
.
month
+
1
,
new_date
.
month
+
1
,
new_date
.
day
,
new_date
.
day
,
...
@@ -569,5 +578,7 @@ class MainWindow(Gtk.ApplicationWindow):
...
@@ -569,5 +578,7 @@ class MainWindow(Gtk.ApplicationWindow):
activity
=
Activity
(
id
=
self
.
activity_id
,
activity
=
Activity
(
id
=
self
.
activity_id
,
name
=
name
,
name
=
name
,
start
=
self
.
start_date
,
stop
=
None
)
start
=
self
.
start_date
,
stop
=
None
,
comments
=
comments
)
self
.
application
.
db
.
update
(
activity
)
self
.
application
.
db
.
update
(
activity
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment