rxbag: show bag file loading in titlebar, otherwise rxbag appears frozen

This commit is contained in:
Tim Field 2010-06-17 19:59:04 +00:00
parent ed686ea35a
commit 918a6f7b35
2 changed files with 23 additions and 1 deletions

View File

@ -160,12 +160,17 @@ class RxBagInitThread(threading.Thread):
def run(self):
for input_file in self.app.args:
self.timeline.loading_filename = input_file
try:
bag = rosbag.Bag(input_file)
self.timeline.add_bag(bag)
except Exception, ex:
print >> sys.stderr, 'Error loading [%s]: %s' % (input_file, str(ex))
self.timeline.loading_filename = None
self.timeline.add_bag(bag)
if self.app.options.start:
playhead = self.timeline.start_stamp + rospy.Duration.from_sec(self.app.options.start)
if playhead > self.timeline.end_stamp:

View File

@ -179,6 +179,8 @@ class Timeline(wx.Window):
self._bag_lock = threading.RLock()
self._bags = []
self._loading_filename = None
self._start_stamp = None
self._end_stamp = None
self._topics = []
@ -287,6 +289,16 @@ class Timeline(wx.Window):
@property
def frame(self): return wx.GetApp().GetTopWindow()
# property: loading_filename
def _get_loading_filename(self): return self._loading_filename
def _set_loading_filename(self, loading_filename):
self._loading_filename = loading_filename
wx.CallAfter(self._update_title)
loading_filename = property(_get_loading_filename, _set_loading_filename)
## Visual
@property
@ -950,16 +962,21 @@ class Timeline(wx.Window):
def _update_title(self):
title = 'rxbag'
if self._recorder:
if self._recorder.paused:
title += ' - %s [recording paused]' % self._bags[0].filename
else:
title += ' - %s [recording]' % self._bags[0].filename
elif len(self.bags) > 0:
if len(self.bags) == 1:
title += ' - ' + self._bags[0].filename
else:
title += ' - [%d bags]' % len(self._bags)
if self._loading_filename is not None:
title += ' - loading %s...' % self._loading_filename
self.frame.Title = title