thomasvs - in flumotion/trunk: . flumotion/component flumotion/component/base

flumotion-commit at lists.fluendo.com flumotion-commit at lists.fluendo.com
Tue Mar 6 15:38:35 CET 2007


Author: thomasvs
Date: Tue Mar  6 15:38:32 2007
New Revision: 4588

Modified:
   flumotion/trunk/ChangeLog
   flumotion/trunk/flumotion/component/base/admin_gtk.py
   flumotion/trunk/flumotion/component/feedcomponent010.py
Log:
	* flumotion/component/base/admin_gtk.py:
	* flumotion/component/feedcomponent010.py:
	  Use None for uiState values to indicate "component has no support
	  for reporting this" so we can show "Unknown" in the UI



Modified: flumotion/trunk/ChangeLog
==============================================================================
--- flumotion/trunk/ChangeLog	(original)
+++ flumotion/trunk/ChangeLog	Tue Mar  6 15:38:32 2007
@@ -1,3 +1,10 @@
+2007-03-06  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+	* flumotion/component/base/admin_gtk.py:
+	* flumotion/component/feedcomponent010.py:
+	  Use None for uiState values to indicate "component has no support
+	  for reporting this" so we can show "Unknown" in the UI
+
 2007-03-05  Thomas Vander Stichele  <thomas at apestaart dot org>
 
 	* conf/Makefile.am:

Modified: flumotion/trunk/flumotion/component/base/admin_gtk.py
==============================================================================
--- flumotion/trunk/flumotion/component/base/admin_gtk.py	(original)
+++ flumotion/trunk/flumotion/component/base/admin_gtk.py	Tue Mar  6 15:38:32 2007
@@ -471,6 +471,9 @@
         self.updateDisconnectionTime()
 
     def setFeederClientBuffersDroppedCurrent(self, state, value):
+        if value is None:
+            # no support for counting dropped buffers
+            value = _("Unknown")
         self.labels['buffers-dropped-current'].set_text(str(value))
         self.updateConnectionTime()
         self.updateDisconnectionTime()
@@ -480,6 +483,9 @@
         self.labels['bytes-read-total'].set_text(txt)
 
     def setFeederClientBuffersDroppedTotal(self, state, value):
+        if value is None:
+            # no support for counting dropped buffers
+            value = _("Unknown")
         self.labels['buffers-dropped-total'].set_text(str(value))
 
     def setFeederClientReconnects(self, state, value):

Modified: flumotion/trunk/flumotion/component/feedcomponent010.py
==============================================================================
--- flumotion/trunk/flumotion/component/feedcomponent010.py	(original)
+++ flumotion/trunk/flumotion/component/feedcomponent010.py	Tue Mar  6 15:38:32 2007
@@ -108,6 +108,8 @@
         self.fd = None
         self.uiState.addKey('fd', None)
 
+        # these values can be set to None, which would mean
+        # Unknown, not supported
         for key in (
             'bytesReadCurrent',      # bytes dropped over current connection
             'buffersDroppedCurrent', # buffers dropped over current connection
@@ -118,8 +120,7 @@
             'lastDisconnect',        # last client disconnect, in epoch seconds
             'lastActivity',          # last time client read or connected
             ):
-            self.uiState.addKey(key)
-            self.uiState.set(key, 0)
+            self.uiState.addKey(key, None)
 
         # internal state allowing us to track global numbers
         self._buffersDroppedBefore = 0
@@ -146,8 +147,9 @@
         self.uiState.set('buffersDroppedCurrent', buffersDropped)
         self.uiState.set('bytesReadTotal', self._bytesReadBefore + bytesSent)
         self.uiState.set('lastActivity', timeLastActivity)
-        self.uiState.set('buffersDroppedTotal',
-            self._buffersDroppedBefore + buffersDropped)
+        if buffersDropped is not None:
+            self.uiState.set('buffersDroppedTotal',
+                self._buffersDroppedBefore + buffersDropped)
 
     def connected(self, fd, when=None):
         """
@@ -172,13 +174,13 @@
         self.uiState.set('fd', None)
         self.uiState.set('lastDisconnect', when)
 
-        # update our internal counters
+        # update our internal counters and reset current counters to 0
         self._bytesReadBefore += self.uiState.get('bytesReadCurrent')
-        self._buffersDroppedBefore += self.uiState.get('buffersDroppedCurrent')
-
-        # reset the current ones to zero
         self.uiState.set('bytesReadCurrent', 0)
-        self.uiState.set('buffersDroppedCurrent', 0)
+        if self.uiState.get('buffersDroppedCurrent') is not None:
+            self._buffersDroppedBefore += self.uiState.get(
+                'buffersDroppedCurrent')
+            self.uiState.set('buffersDroppedCurrent', 0)
 
 class FeedComponent(basecomponent.BaseComponent):
     """


More information about the flumotion-commit mailing list