Display timeline by default

This commit is contained in:
René Stadler 2007-11-22 10:29:23 +02:00 committed by Stefan Sauer
parent 41eaf0eb5e
commit cda1eb0131
3 changed files with 30 additions and 7 deletions

View file

@ -1040,6 +1040,7 @@ class Window (object):
self.dispatcher.cancel () self.dispatcher.cancel ()
self.dispatcher = None self.dispatcher = None
self.log_file = None self.log_file = None
self.have_log_file_changed ()
else: else:
self.logger.debug ("setting log file %r", filename) self.logger.debug ("setting log file %r", filename)
@ -1048,6 +1049,11 @@ class Window (object):
self.log_file.consumers.append (self) self.log_file.consumers.append (self)
self.log_file.start_loading () self.log_file.start_loading ()
def have_log_file_changed (self):
for feature in self.features:
feature.handle_log_file_changed ()
def handle_log_view_button_press_event (self, view, event): def handle_log_view_button_press_event (self, view, event):
if event.button != 3: if event.button != 3:
@ -1110,6 +1116,7 @@ class Window (object):
def idle_set (): def idle_set ():
##self.log_view.props.model = self.log_model ##self.log_view.props.model = self.log_model
self.log_view.props.model = self.log_filter self.log_view.props.model = self.log_filter
self.have_log_file_changed ()
return False return False
gobject.idle_add (idle_set) gobject.idle_add (idle_set)

View file

@ -268,6 +268,16 @@ class TimelineWidget (gtk.DrawingArea):
gc = gtk.gdk.GC (self.window) gc = gtk.gdk.GC (self.window)
self.window.draw_drawable (gc, self.__offscreen, 0, 0, 0, 0, -1, -1) self.window.draw_drawable (gc, self.__offscreen, 0, 0, 0, 0, -1, -1)
def update (self):
width = self.get_allocation ()[2]
self.process.abort ()
self.freq_sentinel.clear ()
self.dist_sentinel.clear ()
self.freq_sentinel.run_for (width)
self.process.run ()
def update_position (self, start_ts, end_ts): def update_position (self, start_ts, end_ts):
if not self.freq_sentinel.data: if not self.freq_sentinel.data:
@ -411,11 +421,7 @@ class TimelineWidget (gtk.DrawingArea):
if event.width < 16: if event.width < 16:
return False return False
self.process.abort () self.update ()
self.freq_sentinel.clear ()
self.dist_sentinel.clear ()
self.freq_sentinel.run_for (event.width)
self.process.run ()
return False return False
@ -432,7 +438,7 @@ class TimelineFeature (FeatureBase):
self.action_group = gtk.ActionGroup ("TimelineActions") self.action_group = gtk.ActionGroup ("TimelineActions")
self.action_group.add_toggle_actions ([("show-timeline", self.action_group.add_toggle_actions ([("show-timeline",
None, _("_Timeline"))]) None, _("_Timeline"),)])
def attach (self, window): def attach (self, window):
@ -462,7 +468,9 @@ class TimelineFeature (FeatureBase):
self.handle_log_view_adjustment_value_changed) self.handle_log_view_adjustment_value_changed)
handler = self.handle_show_action_toggled handler = self.handle_show_action_toggled
self.action_group.get_action ("show-timeline").connect ("toggled", handler) action = self.action_group.get_action ("show-timeline")
action.connect ("toggled", handler)
action.activate ()
def detach (self, window): def detach (self, window):
@ -474,6 +482,10 @@ class TimelineFeature (FeatureBase):
self.timeline.destroy () self.timeline.destroy ()
self.timeline = None self.timeline = None
def handle_log_file_changed (self):
self.timeline.update ()
def handle_log_view_adjustment_value_changed (self, adj): def handle_log_view_adjustment_value_changed (self, adj):
# FIXME: If not visible, disconnect this handler! # FIXME: If not visible, disconnect this handler!

View file

@ -29,6 +29,10 @@ class FeatureBase (object):
state_section_name = None state_section_name = None
def handle_log_file_changed (self):
pass
def register_lazy_sentinel (self, sentinel): def register_lazy_sentinel (self, sentinel):
pass pass