Package bosco :: Module gui
[hide private]
[frames] | no frames]

Source Code for Module bosco.gui

 1  # 
 2  #    Copyright (C) 2008  Gaudenz Steinlin <gaudenz@soziologie.ch> 
 3  # 
 4  #    This program is free software: you can redistribute it and/or modify 
 5  #    it under the terms of the GNU General Public License as published by 
 6  #    the Free Software Foundation, either version 3 of the License, or 
 7  #    (at your option) any later version. 
 8  # 
 9  #    This program is distributed in the hope that it will be useful, 
10  #    but WITHOUT ANY WARRANTY; without even the implied warranty of 
11  #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
12  #    GNU General Public License for more details. 
13  # 
14  #    You should have received a copy of the GNU General Public License 
15  #    along with this program.  If not, see <http://www.gnu.org/licenses/>. 
16  """ 
17  gui.py - classes for the graphical user interface. This is not an actual GUI 
18           application but a collection of helper classes 
19  """ 
20   
21  import wx 
22  import wx.html 
23   
24 -class UpdateableHtmlPanel(wx.html.HtmlWindow):
25 """Panel to display HTML content. This panel updates it's content on 26 calls to update(event). UpdateHtmlPanels are typically used to show rankings and 27 connected to an EventObserver to automatically update. 28 """ 29
30 - def __init__(self, parent, content = None):
31 super(type(self), self).__init__(parent) 32 33 self._content = content 34 35 # bug? call this for acceptable fonts 36 self.SetStandardFonts() 37 self.update(None)
38
39 - def update(self, event):
40 """Update the content of the panel.""" 41 if self._content is not None: 42 self.SetPage(unicode(self._content)) 43 else: 44 self.SetPage('')
45
46 - def _set_content(self, content):
47 self._content = content 48 self.update(None)
49
50 - def _get_content(self):
51 return self._content
52 53 content = property(_get_content, _set_content)
54