annotate getan/nodes.py @ 469:050ffdec60d9

Fix the orientation problem * Highlights the project what is open.
author Magnus Schieder <mschieder@intevation.de>
date Tue, 08 May 2018 13:29:45 +0200
parents ceb5909b106e
children 950bfe89ec3d
rev   line source
226
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
2 #
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
3 # (c) 2013 by Björn Ricks <bjoern.ricks@intevation.de>
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
4 #
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
5 # This is Free Software licensed under the terms of GPLv3 or later.
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
6 # For details see LICENSE coming with the source of 'getan'.
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
7 #
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
8
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
9 import logging
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
10
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
11 import urwid
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
12
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
13 from getan.utils import short_time, format_datetime, human_time
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
14 from getan.resources import gettext as _
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
15
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
16 logger = logging.getLogger(__name__)
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
17
304
c7f9997a5492 Fix codingstyle for pep8
Björn Ricks <bjoern.ricks@intevation.de>
parents: 273
diff changeset
18
226
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
19 class Node(urwid.WidgetWrap):
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
20
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
21 def __init__(self, item):
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
22 self.selected = False
256
bcc5951edaad Fix compatibility with urwid 1.1
Björn Ricks <bjoern.ricks@intevation.de>
parents: 242
diff changeset
23 self.has_focus = False
226
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
24 self.item = item
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
25 w = urwid.AttrMap(self.get_widget(), None)
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
26 self.__super.__init__(w)
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
27
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
28 def get_widget(self):
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
29 return urwid.Text(' %s ' % (self.get_item_text()), wrap='clip')
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
30
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
31 def get_item_text(self):
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
32 return str(self.item)
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
33
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
34 def update_w(self):
256
bcc5951edaad Fix compatibility with urwid 1.1
Björn Ricks <bjoern.ricks@intevation.de>
parents: 242
diff changeset
35 if self.has_focus:
226
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
36 if self.selected:
321
6e72a6b5e94f Update mapping for foreground and background color settings of nodes
Björn Ricks <bjoern.ricks@intevation.de>
parents: 304
diff changeset
37 self._w.set_focus_map({None: 'selected_focus_entry'})
6e72a6b5e94f Update mapping for foreground and background color settings of nodes
Björn Ricks <bjoern.ricks@intevation.de>
parents: 304
diff changeset
38 self._w.set_attr_map({None: 'selected_focus_entry'})
226
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
39 else:
321
6e72a6b5e94f Update mapping for foreground and background color settings of nodes
Björn Ricks <bjoern.ricks@intevation.de>
parents: 304
diff changeset
40 self._w.set_focus_map({None: 'focus_entry'})
6e72a6b5e94f Update mapping for foreground and background color settings of nodes
Björn Ricks <bjoern.ricks@intevation.de>
parents: 304
diff changeset
41 self._w.set_attr_map({None: 'focus_entry'})
226
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
42 else:
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
43 if self.selected:
321
6e72a6b5e94f Update mapping for foreground and background color settings of nodes
Björn Ricks <bjoern.ricks@intevation.de>
parents: 304
diff changeset
44 self._w.set_focus_map({None: 'selected_entry'})
6e72a6b5e94f Update mapping for foreground and background color settings of nodes
Björn Ricks <bjoern.ricks@intevation.de>
parents: 304
diff changeset
45 self._w.set_attr_map({None: 'selected_entry'})
226
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
46 else:
321
6e72a6b5e94f Update mapping for foreground and background color settings of nodes
Björn Ricks <bjoern.ricks@intevation.de>
parents: 304
diff changeset
47 self._w.set_focus_map({None: 'entry'})
6e72a6b5e94f Update mapping for foreground and background color settings of nodes
Björn Ricks <bjoern.ricks@intevation.de>
parents: 304
diff changeset
48 self._w.set_attr_map({None: 'entry'})
226
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
49
469
050ffdec60d9 Fix the orientation problem
Magnus Schieder <mschieder@intevation.de>
parents: 453
diff changeset
50 # Only projects can be open.
050ffdec60d9 Fix the orientation problem
Magnus Schieder <mschieder@intevation.de>
parents: 453
diff changeset
51 if self.item.open and not self.has_focus:
050ffdec60d9 Fix the orientation problem
Magnus Schieder <mschieder@intevation.de>
parents: 453
diff changeset
52 self._w.set_attr_map({None: 'open_project'})
050ffdec60d9 Fix the orientation problem
Magnus Schieder <mschieder@intevation.de>
parents: 453
diff changeset
53 else:
050ffdec60d9 Fix the orientation problem
Magnus Schieder <mschieder@intevation.de>
parents: 453
diff changeset
54 self.item.open = False
050ffdec60d9 Fix the orientation problem
Magnus Schieder <mschieder@intevation.de>
parents: 453
diff changeset
55
226
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
56 def select(self):
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
57 self.selected = not self.selected
242
81f05202f1b4 Improve debug output when selecting a node
Björn Ricks <bjoern.ricks@intevation.de>
parents: 230
diff changeset
58 logger.debug("Node: update selection of item '%s' selected %s"
81f05202f1b4 Improve debug output when selecting a node
Björn Ricks <bjoern.ricks@intevation.de>
parents: 230
diff changeset
59 % (self.item, self.selected))
226
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
60 self._invalidate()
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
61
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
62 def get_item(self):
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
63 return self.item
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
64
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
65 def selectable(self):
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
66 return True
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
67
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
68 def keypress(self, size, key):
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
69 if "enter" in key:
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
70 self.select()
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
71 return None
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
72 return key
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
73
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
74 def render(self, size, focus=False):
256
bcc5951edaad Fix compatibility with urwid 1.1
Björn Ricks <bjoern.ricks@intevation.de>
parents: 242
diff changeset
75 self.has_focus = focus
226
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
76 self.update_w()
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
77 return self._w.render(size, focus)
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
78
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
79 def update(self):
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
80 self._w = self.get_widget()
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
81
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
82
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
83 class ProjectNode(Node):
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
84
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
85 MODES = [
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
86 (0, _('Total')),
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
87 (1, _('Year')),
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
88 (2, _('Month')),
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
89 (3, _('Week')),
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
90 (4, _('Day'))
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
91 ]
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
92
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
93 def __init__(self, proj, mode=3, indent=0):
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
94 self.indent = indent
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
95 self.mode = self.MODES[mode]
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
96 super(ProjectNode, self).__init__(proj)
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
97
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
98 def get_widget(self):
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
99 time_str = self._get_formatted_time()
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
100 proj_desc = self.item.desc
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
101 if proj_desc is None:
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
102 proj_desc = ""
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
103
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
104 description = urwid.Text([' ' * self.indent,
304
c7f9997a5492 Fix codingstyle for pep8
Björn Ricks <bjoern.ricks@intevation.de>
parents: 273
diff changeset
105 ('project_key', self.item.key),
453
ceb5909b106e Backed out changeset ab3c63877862
Bernhard Reiter <bernhard@intevation.de>
parents: 452
diff changeset
106 (' '), (proj_desc)],
304
c7f9997a5492 Fix codingstyle for pep8
Björn Ricks <bjoern.ricks@intevation.de>
parents: 273
diff changeset
107 wrap="clip")
226
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
108 if self._get_time():
272
0190f1c30e3e Align time column text in Project list to the right
Björn Ricks <bjoern.ricks@intevation.de>
parents: 256
diff changeset
109 time = urwid.Text('%s (%s)' % (self.mode[1], time_str),
304
c7f9997a5492 Fix codingstyle for pep8
Björn Ricks <bjoern.ricks@intevation.de>
parents: 273
diff changeset
110 align="right")
226
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
111 else:
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
112 time = urwid.Text('')
273
a5c5675b6fa4 Give more "weight" to the description when displaying the project node entry
Björn Ricks <bjoern.ricks@intevation.de>
parents: 272
diff changeset
113 return urwid.AttrMap(urwid.Columns([("weight", 2, description), time],
304
c7f9997a5492 Fix codingstyle for pep8
Björn Ricks <bjoern.ricks@intevation.de>
parents: 273
diff changeset
114 dividechars=1), None)
226
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
115
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
116 def _get_formatted_time(self):
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
117 return human_time(self._get_time())
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
118
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
119 def _get_time(self):
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
120 if self.mode == self.MODES[0]:
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
121 return self.item.total
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
122 if self.mode == self.MODES[1]:
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
123 return self.item.year()
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
124 if self.mode == self.MODES[2]:
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
125 return self.item.month()
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
126 if self.mode == self.MODES[3]:
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
127 return self.item.week()
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
128 if self.mode == self.MODES[4]:
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
129 return self.item.day()
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
130 return self.item.week()
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
131
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
132 def switch_time_mode(self):
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
133 tmp = self.mode[0] + 1
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
134 if tmp > 4:
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
135 self.mode = self.MODES[0]
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
136 else:
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
137 self.mode = self.MODES[tmp]
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
138 self._w = self.get_widget()
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
139
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
140
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
141 class EntryNode(Node):
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
142
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
143 def __init__(self, entry):
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
144 super(EntryNode, self).__init__(entry)
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
145
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
146 def get_widget(self):
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
147 logger.debug("EntryNode: update entry '%s'." % self.item.desc)
304
c7f9997a5492 Fix codingstyle for pep8
Björn Ricks <bjoern.ricks@intevation.de>
parents: 273
diff changeset
148 row = urwid.Text(' %s [%s] %s'
c7f9997a5492 Fix codingstyle for pep8
Björn Ricks <bjoern.ricks@intevation.de>
parents: 273
diff changeset
149 % (format_datetime(self.item.start),
363
1be996254ad5 Fix: Entry.duration got renamed to Entry.get_duration
Björn Ricks <bjoern.ricks@intevation.de>
parents: 321
diff changeset
150 short_time(self.item.get_duration().seconds),
226
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
151 self.item.desc), wrap='clip')
f8571308abef Move ProjectNode and EntryNode to its own module
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
152 return urwid.AttrMap(row, None)
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)