jdahlin - in flumotion/trunk: . flumotion/component/producers/firewire

flumotion-commit at lists.fluendo.com flumotion-commit at lists.fluendo.com
Wed Apr 2 17:03:26 CEST 2008


Author: jdahlin
Date: Wed Apr  2 17:03:25 2008
New Revision: 6466

Log:
2008-04-02  Johan Dahlin  <jdahlin at async.com.br>

    * flumotion/component/producers/firewire/firewire-wizard.glade:
    * flumotion/component/producers/firewire/firewire_wizard.py:
    Refactor signal handles, make a method private, rename and
    merge a few others.



Modified:
   flumotion/trunk/ChangeLog
   flumotion/trunk/flumotion/component/producers/firewire/firewire-wizard.glade
   flumotion/trunk/flumotion/component/producers/firewire/firewire_wizard.py

Modified: flumotion/trunk/ChangeLog
==============================================================================
--- flumotion/trunk/ChangeLog	(original)
+++ flumotion/trunk/ChangeLog	Wed Apr  2 17:03:25 2008
@@ -1,3 +1,10 @@
+2008-04-02  Johan Dahlin  <jdahlin at async.com.br>
+
+	* flumotion/component/producers/firewire/firewire-wizard.glade:
+	* flumotion/component/producers/firewire/firewire_wizard.py:
+	Refactor signal handles, make a method private, rename and
+	merge a few others.
+
 2008-04-02  Thomas Vander Stichele  <thomas at apestaart dot org>
 
 	* flumotion.spec.in:

Modified: flumotion/trunk/flumotion/component/producers/firewire/firewire-wizard.glade
==============================================================================
--- flumotion/trunk/flumotion/component/producers/firewire/firewire-wizard.glade	(original)
+++ flumotion/trunk/flumotion/component/producers/firewire/firewire-wizard.glade	Wed Apr  2 17:03:25 2008
@@ -169,7 +169,7 @@
 			  <property name="active">False</property>
 			  <property name="inconsistent">False</property>
 			  <property name="draw_indicator">True</property>
-			  <signal name="toggled" handler="on_update_output_format" last_modification_time="Fri, 28 Jan 2005 14:12:45 GMT"/>
+			  <signal name="toggled" handler="on_checkbutton_square_pixels_toggled" last_modification_time="Fri, 28 Jan 2005 14:12:45 GMT"/>
 			</widget>
 			<packing>
 			  <property name="left_attach">0</property>
@@ -192,7 +192,7 @@
 			      <property name="visible">True</property>
 			      <property name="add_tearoffs">False</property>
 			      <property name="focus_on_click">True</property>
-			      <signal name="changed" handler="on_update_output_format" last_modification_time="Mon, 31 Jan 2005 16:10:59 GMT"/>
+			      <signal name="changed" handler="on_combobox_scaled_height_changed" last_modification_time="Mon, 31 Jan 2005 16:10:59 GMT"/>
 			    </widget>
 			    <packing>
 			      <property name="padding">0</property>
@@ -301,7 +301,7 @@
 				  <property name="active">True</property>
 				  <property name="inconsistent">False</property>
 				  <property name="draw_indicator">True</property>
-				  <signal name="toggled" handler="on_update_output_format" last_modification_time="Mon, 31 Jan 2005 17:04:10 GMT"/>
+				  <signal name="toggled" handler="on_radiobutton_width_none_toggled" last_modification_time="Mon, 31 Jan 2005 17:04:10 GMT"/>
 				</widget>
 				<packing>
 				  <property name="left_attach">0</property>
@@ -325,7 +325,7 @@
 				  <property name="inconsistent">False</property>
 				  <property name="draw_indicator">True</property>
 				  <property name="group">radiobutton_width_none</property>
-				  <signal name="toggled" handler="on_update_output_format" last_modification_time="Mon, 31 Jan 2005 17:03:56 GMT"/>
+				  <signal name="toggled" handler="on_radiobutton_width_stretch_toggled" last_modification_time="Mon, 31 Jan 2005 17:03:56 GMT"/>
 				</widget>
 				<packing>
 				  <property name="left_attach">0</property>
@@ -349,7 +349,7 @@
 				  <property name="inconsistent">False</property>
 				  <property name="draw_indicator">True</property>
 				  <property name="group">radiobutton_width_none</property>
-				  <signal name="toggled" handler="on_update_output_format" last_modification_time="Mon, 31 Jan 2005 17:04:04 GMT"/>
+				  <signal name="toggled" handler="on_radiobutton_width_pad_toggled" last_modification_time="Mon, 31 Jan 2005 17:04:04 GMT"/>
 				</widget>
 				<packing>
 				  <property name="left_attach">0</property>

Modified: flumotion/trunk/flumotion/component/producers/firewire/firewire_wizard.py
==============================================================================
--- flumotion/trunk/flumotion/component/producers/firewire/firewire_wizard.py	(original)
+++ flumotion/trunk/flumotion/component/producers/firewire/firewire_wizard.py	Wed Apr  2 17:03:25 2008
@@ -87,6 +87,48 @@
         self.wizard.block_next(not is_sensitive)
 
     def _update_output_format(self):
+        self._update_label_camera_settings()
+
+        # factor is a double
+        self._factor_i = self.combobox_scaled_height.get_selected()
+
+        self._update_width_correction()
+        self._update_label_output_format()
+
+    def _update_label_camera_settings(self):
+        # update label_camera_settings
+        standard = 'Unknown'
+        aspect = 'Unknown'
+        h = self._dims[1]
+        if h == 576:
+            standard = 'PAL'
+        elif h == 480:
+            standard = 'NTSC'
+        else:
+            self.warning('Unknown capture standard for height %d' % h)
+
+        nom = self._par[0]
+        den = self._par[1]
+        if nom == 59 or nom == 10:
+            aspect = '4:3'
+        elif nom == 118 or nom == 40:
+            aspect = '16:9'
+        else:
+            self.warning('Unknown pixel aspect ratio %d/%d' % (nom, den))
+
+        text = _('%s, %s (%d/%d pixel aspect ratio)') % (standard, aspect,
+            nom, den)
+        self.label_camera_settings.set_text(text)
+
+    def _update_width_correction(self):
+        self._width_correction = None
+        for i in type(self).width_corrections:
+            if getattr(self,'radiobutton_width_'+i).get_active():
+                self._width_correction = i
+                break
+        assert self._width_correction
+
+    def _update_label_output_format(self):
         d = self._get_width_height()
         self.model.properties.is_square = (
             self.checkbutton_square_pixels.get_active())
@@ -149,7 +191,7 @@
                 values.append(('%d pixels' % height, i))
             self.combobox_scaled_height.prefill(values)
             self._set_sensitive(True)
-            self.on_update_output_format()
+            self._update_output_format()
 
         def trapRemoteFailure(failure):
             failure.trap(errors.RemoteRunFailure)
@@ -163,41 +205,19 @@
 
     # Callbacks
 
-    def on_update_output_format(self, *args):
-        # update label_camera_settings
-        standard = 'Unknown'
-        aspect = 'Unknown'
-        h = self._dims[1]
-        if h == 576:
-            standard = 'PAL'
-        elif h == 480:
-            standard = 'NTSC'
-        else:
-            self.warning('Unknown capture standard for height %d' % h)
-
-        nom = self._par[0]
-        den = self._par[1]
-        if nom == 59 or nom == 10:
-            aspect = '4:3'
-        elif nom == 118 or nom == 40:
-            aspect = '16:9'
-        else:
-            self.warning('Unknown pixel aspect ratio %d/%d' % (nom, den))
+    def on_checkbutton_square_pixels_toggled(self, radio):
+        self._update_output_format()
 
-        text = _('%s, %s (%d/%d pixel aspect ratio)') % (standard, aspect,
-            nom, den)
-        self.label_camera_settings.set_text(text)
+    def on_combobox_scaled_height_changed(self, combo):
+        self._update_output_format()
 
-        # factor is a double
-        self._factor_i = self.combobox_scaled_height.get_selected()
+    def on_radiobutton_width_none_toggled(self, radio):
+        self._update_output_format()
 
-        self._width_correction = None
-        for i in type(self).width_corrections:
-            if getattr(self,'radiobutton_width_'+i).get_active():
-                self._width_correction = i
-                break
-        assert self._width_correction
+    def on_radiobutton_width_stretch_toggled(self, radio):
+        self._update_output_format()
 
+    def on_radiobutton_width_pad_toggled(self, radio):
         self._update_output_format()
 
 


More information about the flumotion-commit mailing list