gnome-zeitgeist team mailing list archive
-
gnome-zeitgeist team
-
Mailing list archive
-
Message #00784
[Merge] lp:~tinchester/gnome-activity-journal/today-button-tweaks into lp:gnome-activity-journal
Tin Tvrtkovic has proposed merging lp:~tinchester/gnome-activity-journal/today-button-tweaks into lp:gnome-activity-journal.
Requested reviews:
GNOME Zeitgeist Team (gnome-zeitgeist)
This branch contains the today button tweak proposed on the mailing list.
--
https://code.launchpad.net/~tinchester/gnome-activity-journal/today-button-tweaks/+merge/44258
Your team GNOME Zeitgeist Team is requested to review the proposed merge of lp:~tinchester/gnome-activity-journal/today-button-tweaks into lp:gnome-activity-journal.
=== modified file 'src/main.py'
--- src/main.py 2010-12-20 09:15:36 +0000
+++ src/main.py 2010-12-20 18:47:11 +0000
@@ -134,10 +134,10 @@
self.backward_button, ev_backward_button = DayButton.new(0)
self.forward_button, ev_forward_button = DayButton.new(1, sensitive=False)
# Widget placement
- vbox = gtk.VBox(); hbox = gtk.HBox(); histogramhbox = gtk.HBox(); tvbox = gtk.VBox()
+ vbox = gtk.VBox(); hbox = gtk.HBox(); histogramhbox = gtk.HBox();
hbox.pack_start(ev_backward_button, False, False); hbox.pack_start(self.view, True, True, 6)
- hbox.pack_end(ev_forward_button, False, False); tvbox.pack_start(hbox, True, True, 3)
- vbox.pack_start(self.toolbar, False, False); vbox.pack_start(tvbox, True, True, 2)
+ hbox.pack_end(ev_forward_button, False, False);
+ vbox.pack_start(self.toolbar, False, False); vbox.pack_start(hbox, True, True, 5)
histogramhbox.pack_end(self.histogram, True, True, 32); vbox.pack_end(histogramhbox, False, False)
self.add(vbox); self.show_all()
#Tray Icon
@@ -228,12 +228,10 @@
def handle_button_sensitivity(self, date):
today = datetime.date.today()
if date == today:
- return self.forward_button.set_sensitive(False)
- elif date == today + tdelta(-1):
+ self.forward_button.set_sensitive(False)
+ else:
self.forward_button.set_leading(True)
- else:
- self.forward_button.set_leading(False)
- self.forward_button.set_sensitive(True)
+ self.forward_button.set_sensitive(True)
def on_view_button_click(self, w, button, i):
self.view.set_view_page(i)
=== modified file 'src/supporting_widgets.py'
--- src/supporting_widgets.py 2010-12-20 09:15:36 +0000
+++ src/supporting_widgets.py 2010-12-20 18:47:11 +0000
@@ -150,6 +150,7 @@
class DayButton(gtk.DrawingArea):
leading = False
pressed = False
+ today_pressed = False
sensitive = True
today_hover = False
hover = False
@@ -158,7 +159,7 @@
header_color = (1, 1, 1, 1)
leading_header_color = (1, 1, 1, 1)
internal_color = (0, 1, 0, 1)
- arrow_color = (1,1,1,1)
+ arrow_color = (1, 1, 1, 1)
arrow_color_selected = (1, 1, 1, 1)
__gsignals__ = {
@@ -236,7 +237,9 @@
def on_press(self, widget, event):
if event.y > self.header_size:
self.pressed = True
- self.queue_draw()
+ else:
+ self.today_pressed = True
+ self.queue_draw()
def keyboard_clicked_sender(self, widget, event):
if event.keyval in (gtk.keysyms.Return, gtk.keysyms.space):
@@ -254,6 +257,7 @@
elif event.y < self.header_size:
self.emit("jump-to-today")
self.pressed = False
+ self.today_pressed = False;
self.queue_draw()
return True
@@ -291,7 +295,8 @@
context.curve_to(x,y+h,x,y+h,x,y+h-r)
context.line_to(x,y+r)
context.curve_to(x,y,x,y,x+r,y)
- context.set_source_rgba(*(self.leading_header_color if self.leading else self.header_color))
+ # What's this for, exactly? Appears to have been already set.
+ #context.set_source_rgba(*(self.leading_header_color if self.leading else self.header_color))
context.close_path()
context.rectangle(0, r, w, self.header_size)
context.fill()
@@ -323,14 +328,33 @@
self, "arrow", arrow, True,
w/2-size/2, h/2 + size/2, size, size)
size = 7
+
+ # Paint today button arrows.
if self.sensitive and self.side > 0:
- self.style.paint_arrow(widget.window, state, gtk.SHADOW_NONE, None,
- self, "arrow", arrow, True,
- w/2, self.header_size/2 - size/2, size, size)
- self.style.paint_arrow(widget.window, state, gtk.SHADOW_OUT, None,
- self, "arrow", arrow, True,
- w/2-size/2, self.header_size/2 - size/2, size, size)
- return
+ if self.today_hover:
+ if self.today_pressed:
+ self.style.paint_arrow(widget.window, gtk.STATE_SELECTED, gtk.SHADOW_NONE, None,
+ self, "arrow", arrow, True,
+ w/2, self.header_size/2 - size/2, size, size)
+ self.style.paint_arrow(widget.window, gtk.STATE_SELECTED, gtk.SHADOW_OUT, None,
+ self, "arrow", arrow, True,
+ w/2-size/2, self.header_size/2 - size/2, size, size)
+
+ else:
+ self.style.paint_arrow(widget.window, state, gtk.SHADOW_NONE, None,
+ self, "arrow", arrow, True,
+ w/2, self.header_size/2 - size/2, size, size)
+ self.style.paint_arrow(widget.window, state, gtk.SHADOW_OUT, None,
+ self, "arrow", arrow, True,
+ w/2-size/2, self.header_size/2 - size/2, size, size)
+ else:
+ self.style.paint_arrow(widget.window, gtk.STATE_SELECTED, gtk.SHADOW_NONE, None,
+ self, "arrow", arrow, True,
+ w/2, self.header_size/2 - size/2, size, size)
+ self.style.paint_arrow(widget.window, gtk.STATE_SELECTED, gtk.SHADOW_OUT, None,
+ self, "arrow", arrow, True,
+ w/2-size/2, self.header_size/2 - size/2, size, size)
+ #return
class SearchBox(gtk.ToolItem):