Ran update_copyright.py.
[hooke.git] / hooke / ui / gui / statusbar.py
1 # Copyright (C) 2010-2011 W. Trevor King <wking@drexel.edu>
2 #
3 # This file is part of Hooke.
4 #
5 # Hooke is free software: you can redistribute it and/or modify it
6 # under the terms of the GNU Lesser General Public License as
7 # published by the Free Software Foundation, either version 3 of the
8 # License, or (at your option) any later version.
9 #
10 # Hooke is distributed in the hope that it will be useful, but WITHOUT
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 # or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General
13 # Public License for more details.
14 #
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with Hooke.  If not, see
17 # <http://www.gnu.org/licenses/>.
18
19 """Status bar for Hooke.
20 """
21
22 import wx
23
24 from ... import version
25
26
27 class StatusBar (wx.StatusBar):
28     def __init__(self, *args, **kwargs):
29         super(StatusBar, self).__init__(*args, **kwargs)
30         self.SetFieldsCount(2)
31         self.SetStatusWidths([-2, -3])
32         self.SetStatusText('Ready', 0)
33         self.SetStatusText(u'Welcome to Hooke (version %s)' % version(), 1)
34
35     def set_playlist(self, playlist):
36         self.SetStatusText(self._playlist_status(playlist), 0)
37
38     def set_curve(self, curve):
39         pass
40
41     def set_plot_text(self, text):
42         self.SetStatusText(text, 1)
43
44     def _playlist_status(self, playlist):
45         fields = [
46             playlist.name,
47             '(%d/%d)' % (playlist.index(), len(playlist)),
48             ]
49         curve = playlist.current()
50         if curve != None:
51             fields.append(curve.name)
52         return ' '.join(fields)