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,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 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 from gettext import gettext as _ 23 24 import gtk 25 import os 26 import math 27 28 # import custom glade handler 29 from flumotion.ui import glade 30 from flumotion.component.base.effectsnode import EffectAdminGtkNode 31 32 __version__ = "$Rev$" 33 3436 logCategory = 'videoscale-admin' 37 gladeFile = os.path.join('flumotion', 'component', 'effects', 38 'videoscale', 'videoscale.glade') 39 40 uiStateHandlers = None 4113243 self.widget = self.wtree.get_widget('videoscale-vbox') 44 self._height = self.wtree.get_widget('videoscale-height') 45 self._width = self.wtree.get_widget('videoscale-width') 46 self._par_n = self.wtree.get_widget('videoscale-par_n') 47 self._par_d = self.wtree.get_widget('videoscale-par_d') 48 self._is_square = self.wtree.get_widget('videoscale-is_square') 49 self._add_borders = self.wtree.get_widget('videoscale-add_borders') 50 self._apply = self.wtree.get_widget('videoscale-apply') 51 52 # do the callbacks for the mode setting 53 self._height.connect('value-changed', self._cb_height) 54 self._width.connect('value-changed', self._cb_width) 55 self._par_n.connect('value-changed', self._cb_par) 56 self._par_d.connect('value-changed', self._cb_par) 57 self._is_square.connect('toggled', self._cb_is_square) 58 self._add_borders.connect('toggled', self._cb_add_borders) 59 self._apply.connect('clicked', self._cb_apply)6062 EffectAdminGtkNode.setUIState(self, state) 63 if not self.uiStateHandlers: 64 uiStateHandlers = {'videoscale-width': self.widthSet, 65 'videoscale-height': self.heightSet, 66 'videoscale-is-square': self.isSquareSet, 67 'videoscale-add-borders': self.addBordersSet} 68 self.uiStateHandlers = uiStateHandlers 69 70 for k, handler in self.uiStateHandlers.items(): 71 handler(state.get(k))72 77 81 8587 if width is not None: 88 self._width.handler_block_by_func(self._cb_width) 89 self._width.set_value(width) 90 self._width.handler_unblock_by_func(self._cb_width)9193 if height is not None: 94 self._height.handler_block_by_func(self._cb_height) 95 self._height.set_value(height) 96 self._height.handler_unblock_by_func(self._cb_height)9799 height = widget.get_value_as_int() 100 d = self.effectCallRemote("setHeight", height) 101 d.addErrback(self.setErrback)102104 width = widget.get_value_as_int() 105 d = self.effectCallRemote("setWidth", width) 106 d.addErrback(self.setErrback)107109 par_n = self._par_n.get_value_as_int() 110 par_d = self._par_d.get_value_as_int() 111 d = self.effectCallRemote("setPAR", (par_n, par_d)) 112 d.addErrback(self.setErrback)113115 is_square = self._is_square.get_active() 116 d = self.effectCallRemote("setIsSquare", is_square) 117 d.addErrback(self.setErrback)118120 add_borders = self._add_borders.get_active() 121 d = self.effectCallRemote("setAddBorders", add_borders) 122 d.addErrback(self.setErrback)123 127
Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Fri Apr 29 18:38:16 2011 | http://epydoc.sourceforge.net |