Skip to content

Commit

Permalink
Merge pull request #179 from gkarsay/master
Browse files Browse the repository at this point in the history
3 bug fixes
  • Loading branch information
toupeira committed Sep 5, 2014
2 parents fbeb3be + b7733c5 commit 4b9bc97
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/hamster/lib/stuff.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,19 @@ def format_range(start_date, end_date):
# letter after prefixes (start_, end_) is the one of
# standard python date formatting ones- you can use all of them
# see http://docs.python.org/library/time.html#time.strftime
title = (u"%(start_B)s %(start_d)s, %(start_Y)s – %(end_B)s %(end_d)s, %(end_Y)s") % dates_dict
title = (u"%(start_B)s %(start_d)s, %(start_Y)s – %(end_B)s %(end_d)s, %(end_Y)s".encode('utf-8')) % dates_dict
elif start_date.month != end_date.month:
# label of date range if start and end month do not match
# letter after prefixes (start_, end_) is the one of
# standard python date formatting ones- you can use all of them
# see http://docs.python.org/library/time.html#time.strftime
title = (u"%(start_B)s %(start_d)s – %(end_B)s %(end_d)s, %(end_Y)s") % dates_dict
title = (u"%(start_B)s %(start_d)s – %(end_B)s %(end_d)s, %(end_Y)s".encode('utf-8')) % dates_dict
else:
# label of date range for interval in same month
# letter after prefixes (start_, end_) is the one of
# standard python date formatting ones- you can use all of them
# see http://docs.python.org/library/time.html#time.strftime
title = (u"%(start_B)s %(start_d)s – %(end_d)s, %(end_Y)s") % dates_dict
title = (u"%(start_B)s %(start_d)s – %(end_d)s, %(end_Y)s".encode('utf-8')) % dates_dict

return title

Expand Down
2 changes: 1 addition & 1 deletion src/hamster/widgets/dates.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def on_toggle(self, button):
def set_range(self, start_date, end_date=None):
end_date = end_date or start_date
self.start_date, self.end_date = start_date, end_date
self.label.set_markup('<b>%s</b>' % stuff.format_range(start_date, end_date).encode("utf-8"))
self.label.set_markup('<b>%s</b>' % stuff.format_range(start_date, end_date))

def get_range(self):
return self.start_date, self.end_date
Expand Down
14 changes: 8 additions & 6 deletions src/hamster/widgets/facttree.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def show(self, g, colors, fact, current=False):
g.translate(0, self.tag_label.height + 5)

if fact.description:
self.description_label.show(g, "<small>%s</small>" % fact.description)
self.description_label.show(g, "<small>%s</small>" % stuff.escape_pango(fact.description))
g.restore_context()

self.duration_label.show(g, stuff.format_duration(fact.delta), x=self.width - 105)
Expand Down Expand Up @@ -442,9 +442,10 @@ def set_row_heights(self):

maxy = max(y, 1)

self.vadjustment.set_lower(0)
self.vadjustment.set_upper(max(maxy, self.height))
self.vadjustment.set_page_size(self.height)
if self.vadjustment:
self.vadjustment.set_lower(0)
self.vadjustment.set_upper(max(maxy, self.height))
self.vadjustment.set_page_size(self.height)


def on_resize(self, scene, event):
Expand All @@ -467,8 +468,9 @@ def on_scroll(self, scene=None, event=None):
direction = 1

y_pos += 15 * direction
y_pos = max(0, min(self.vadjustment.get_upper() - self.height, y_pos))
self.vadjustment.set_value(y_pos)
if self.vadjustment:
y_pos = max(0, min(self.vadjustment.get_upper() - self.height, y_pos))
self.vadjustment.set_value(y_pos)
self.y = y_pos

self.move_actions()
Expand Down

0 comments on commit 4b9bc97

Please sign in to comment.