Package flumotion :: Package admin :: Package gtk :: Module debugmarkerview
[hide private]

Source Code for Module flumotion.admin.gtk.debugmarkerview

 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,2008 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 th 
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  """dialog to display debug markers""" 
23   
24  import gettext 
25   
26  import gobject 
27   
28  from flumotion.common.pygobject import gsignal 
29  from flumotion.extern.log import log 
30  from flumotion.ui.glade import GladeWindow 
31   
32  __version__ = "$Rev: 6581 $" 
33  _ = gettext.gettext 
34   
35   
36 -class DebugMarkerDialog(GladeWindow):
37 gladeFile = 'debug-marker.glade' 38 39 gsignal('set-marker', str, int) 40
41 - def __init__(self):
42 debugLevels = log.getLevelNames() 43 GladeWindow.__init__(self) 44 pos = 0 45 self._debugLevelCode = {} 46 for level in debugLevels: 47 if level == 'ERROR': 48 continue 49 self.level_selection.get_model().insert(pos, [level]) 50 self._debugLevelCode[pos] = log.getLevelInt(level) 51 pos = pos+1
52
54 if (self.marker_entry.get_text() and 55 self.level_selection.get_active()!=-1): 56 self.ok_button.set_sensitive(True) 57 else: 58 self.ok_button.set_sensitive(False)
59
60 - def _emitMarker(self):
61 level = self._debugLevelCode[self.level_selection.get_active()] 62 self.emit('set-marker', self.marker_entry.get_text(), level)
63 64 # Callbacks 65
66 - def on_ok_button_clicked_cb(self, button):
67 self._emitMarker() 68 self.destroy()
69
70 - def on_cancel_button_clicked_cb(self, button):
71 self.destroy()
72
73 - def on_marker_entry_changed_cb(self, entry):
74 self._updateOkButtonSensitiveness()
75
76 - def on_level_selection_changed_cb(self, combo):
78 79 gobject.type_register(DebugMarkerDialog) 80