Trees | Indices | Help |
---|
|
1 # -*- Mode: Python -*- 2 # vi:si:et:sw=4:sts=4:ts=4 3 # 4 # Flumotion - a streaming media server 5 # Copyright (C) 2004,2005,2006,2007 Fluendo, S.L. (www.fluendo.com). 6 # All rights reserved. 7 8 # This file may be distributed and/or modified under the terms of 9 # the GNU General Public License version 2 as published by 10 # the Free Software Foundation. 11 # This file is distributed without any warranty; without even the implied 12 # warranty of merchantability or fitness for a particular purpose. 13 # See "LICENSE.GPL" in the source distribution for more information. 14 15 # Licensees having purchased or holding a valid Flumotion Advanced 16 # Streaming Server license may use this file in accordance with the 17 # Flumotion Advanced Streaming Server Commercial License Agreement. 18 # See "LICENSE.Flumotion" in the source distribution for more information. 19 20 # Headers in this file shall remain intact. 21 22 import os 23 import gtk 24 25 from gettext import gettext as _ 26 27 from flumotion.common import common 28 from flumotion.component.base.admin_gtk import BaseAdminGtk, BaseAdminGtkNode 2931 glade_file = os.path.join('flumotion', 'component', 'misc', 32 'httpfile', 'httpfile.glade') 33 389740 # Set _stats regardless of if condition 41 # Used to be a race where _stats was 42 # not set if widget tree was gotten before 43 # ui state 44 self._stats = stats 45 if not hasattr(self, 'statistics'): 46 # widget tree not created yet 47 return 48 49 self.updateLabels(stats) 50 51 if not self.shown: 52 # widget tree created but not yet shown 53 self.shown = True 54 self.statistics.show_all()5557 #widgetname = name.replace('-', '_') 58 #FIXME: make object member directly 59 widget = self.wtree.get_widget('label-' + name) 60 if widget: 61 self.labels[name] = widget 62 else: 63 self.warning("FIXME: no widget %s" % name)64 6870 if not hasattr(self, 'labels'): 71 return 72 73 for name in self.labels.keys(): 74 text = state.get(name) 75 if text is not None: 76 if name == 'bytes-transferred': 77 text = common.formatStorage(int(text)) + _('Byte') 78 self.labels[name].set_text(str(text))7981 self.labels = {} 82 self.statistics = self.wtree.get_widget('statistics-widget') 83 self.widget = self.statistics 84 for type in ('bytes-transferred', 'connected-clients'): 85 self.registerLabel(type) 86 87 self.updateLabels({ 88 'bytes-transferred': 0, 89 'connected-clients': 0, 90 }) 91 if self._stats: 92 self.shown = True 93 self.updateLabels(self._stats) 94 self.statistics.show_all() 95 96 return self.statistics108 109 GUIClass = HTTPFileAdminGtk 110100 statistics = StatisticsAdminGtkNode(self.state, self.admin, 101 _("Statistics")) 102 self.nodes['Statistics'] = statistics 103 # FIXME: maybe make a protocol instead of overriding 104 return BaseAdminGtk.setup(self)105
Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Thu Aug 7 15:45:55 2008 | http://epydoc.sourceforge.net |