Ticket #2972: 0001-Icons-for-the-toolbar-that-replace-strings-timer-and.patch
File 0001-Icons-for-the-toolbar-that-replace-strings-timer-and.patch, 21.2 KB (added by manuq, 12 years ago) |
---|
-
new file iconcombobox.py
From 1aa7ed96567245a79e9734b55db714af420c0626 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Qui=C3=B1ones?= <manuq@laptop.org> Date: Mon, 11 Jul 2011 06:02:23 -0300 Subject: [PATCH] Icons for the toolbar that replace strings "timer" and "duration" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Manuel Quiñones <manuq@laptop.org> --- iconcombobox.py | 41 +++++++++++ icons/duration.svg | 193 ++++++++++++++++++++++++++++++++++++++++++++++++++++ icons/timer.svg | 192 +++++++++++++++++++++++++++++++++++++++++++++++++++ record.py | 35 +++++----- 4 files changed, 444 insertions(+), 17 deletions(-) create mode 100644 iconcombobox.py create mode 100644 icons/duration.svg create mode 100644 icons/timer.svg diff --git a/iconcombobox.py b/iconcombobox.py new file mode 100644 index 0000000..0651ea7
- + 1 #Copyright (c) 2008, Media Modifications Ltd. 2 3 #Permission is hereby granted, free of charge, to any person obtaining a copy 4 #of this software and associated documentation files (the "Software"), to deal 5 #in the Software without restriction, including without limitation the rights 6 #to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 #copies of the Software, and to permit persons to whom the Software is 8 #furnished to do so, subject to the following conditions: 9 10 #The above copyright notice and this permission notice shall be included in 11 #all copies or substantial portions of the Software. 12 13 #THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 #IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 #FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 #AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 #LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 #OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 #THE SOFTWARE. 20 21 import gtk 22 import gobject 23 24 from sugar.graphics.combobox import ComboBox 25 from sugar.graphics import style 26 27 28 class IconComboBox(gtk.ToolItem): 29 def __init__(self, icon_filename, **kwargs): 30 gobject.GObject.__init__(self, **kwargs) 31 32 self.icon_filename = icon_filename 33 self.set_border_width(style.DEFAULT_PADDING) 34 35 self.combo = ComboBox() 36 self.combo.show() 37 38 self.add(self.combo) 39 40 def append_item(self, i, text): 41 self.combo.append_item(i, text, file_name=self.icon_filename) -
new file icons/duration.svg
diff --git a/icons/duration.svg b/icons/duration.svg new file mode 100644 index 0000000..43cd335
- + 1 <?xml version="1.0" encoding="UTF-8" standalone="no"?> 2 <svg 3 xmlns:dc="http://purl.org/dc/elements/1.1/" 4 xmlns:cc="http://creativecommons.org/ns#" 5 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 6 xmlns:svg="http://www.w3.org/2000/svg" 7 xmlns="http://www.w3.org/2000/svg" 8 xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" 9 xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" 10 contentScriptType="text/ecmascript" 11 width="55px" 12 zoomAndPan="magnify" 13 contentStyleType="text/css" 14 height="55px" 15 preserveAspectRatio="xMidYMid meet" 16 version="1.1" 17 id="svg2" 18 inkscape:version="0.48.1 r9760" 19 sodipodi:docname="timer.svg"> 20 <metadata 21 id="metadata23"> 22 <rdf:RDF> 23 <cc:Work 24 rdf:about=""> 25 <dc:format>image/svg+xml</dc:format> 26 <dc:type 27 rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> 28 <dc:title></dc:title> 29 </cc:Work> 30 </rdf:RDF> 31 </metadata> 32 <defs 33 id="defs21" /> 34 <sodipodi:namedview 35 pagecolor="#ffffff" 36 bordercolor="#666666" 37 borderopacity="1" 38 objecttolerance="10" 39 gridtolerance="10" 40 guidetolerance="10" 41 inkscape:pageopacity="0" 42 inkscape:pageshadow="2" 43 inkscape:window-width="1024" 44 inkscape:window-height="525" 45 id="namedview19" 46 showgrid="false" 47 inkscape:zoom="5.6568542" 48 inkscape:cx="36.253557" 49 inkscape:cy="28.65546" 50 inkscape:window-x="0" 51 inkscape:window-y="25" 52 inkscape:window-maximized="1" 53 inkscape:current-layer="layer2" /> 54 <g 55 inkscape:groupmode="layer" 56 id="layer2" 57 inkscape:label="all" 58 style="display:inline"> 59 <path 60 sodipodi:type="arc" 61 style="fill:#ffffff;fill-opacity:1;stroke:none" 62 id="path3791" 63 sodipodi:cx="24.629629" 64 sodipodi:cy="24.25926" 65 sodipodi:rx="21.296297" 66 sodipodi:ry="21.296297" 67 d="m 45.925926,24.25926 a 21.296297,21.296297 0 1 1 -42.5925939,0 21.296297,21.296297 0 1 1 42.5925939,0 z" 68 transform="matrix(0.89950544,0,0,0.89950544,5.3455146,7.678664)" /> 69 </g> 70 <g 71 inkscape:groupmode="layer" 72 id="layer1" 73 inkscape:label="timer" 74 style="display:none" 75 sodipodi:insensitive="true"> 76 <path 77 style="fill:none;stroke:#000000;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" 78 d="m 27.605804,29.867439 8.04512,-11.042322" 79 id="path3897" 80 inkscape:connector-curvature="0" /> 81 </g> 82 <g 83 inkscape:groupmode="layer" 84 id="layer3" 85 inkscape:label="duration" 86 style="display:inline"> 87 <path 88 style="fill:#808080;fill-opacity:1;stroke:none" 89 d="m 36.539789,13.013087 c 9.161862,4.992537 12.541772,16.466949 7.549234,25.628815 L 27.5,29.602112 z" 90 id="path4311" 91 inkscape:connector-curvature="0" 92 sodipodi:nodetypes="cccc" 93 inkscape:transform-center-x="-9.4478671" 94 inkscape:transform-center-y="-3.7746184" /> 95 <path 96 inkscape:connector-curvature="0" 97 id="path4283" 98 d="M 27.571522,30.159444 39.546676,36.73611" 99 style="fill:none;stroke:#000000;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" 100 inkscape:transform-center-x="-6.1363368" 101 inkscape:transform-center-y="3.4538125" /> 102 </g> 103 <g 104 inkscape:groupmode="layer" 105 id="layer4" 106 inkscape:label="Capa" 107 style="display:inline" 108 sodipodi:insensitive="true"> 109 <g 110 style="display:inline" 111 id="g4315"> 112 <path 113 inkscape:connector-curvature="0" 114 id="path3811" 115 d="m 27.5,15.555556 0,3.888889" 116 style="fill:none;stroke:#000000;stroke-width:3.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> 117 <path 118 style="fill:none;stroke:#000000;stroke-width:3.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" 119 d="m 41.444444,29.5 -3.888889,0" 120 id="path3823" 121 inkscape:connector-curvature="0" /> 122 <path 123 inkscape:connector-curvature="0" 124 id="path3829" 125 d="m 13.555556,29.5 3.888889,0" 126 style="fill:none;stroke:#000000;stroke-width:3.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> 127 <path 128 style="fill:none;stroke:#000000;stroke-width:3.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" 129 d="m 27.5,43.444444 0,-3.888889" 130 id="path3854" 131 inkscape:connector-curvature="0" /> 132 <path 133 inkscape:connector-curvature="0" 134 id="path4076" 135 d="m 22.873381,5.940543 9.622594,0" 136 style="fill:none;stroke:#000000;stroke-width:3.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> 137 <path 138 sodipodi:nodetypes="cc" 139 style="fill:none;stroke:#000000;stroke-width:3.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" 140 d="m 38.96491,8.681773 5.209549,3.91786" 141 id="path4080" 142 inkscape:connector-curvature="0" /> 143 <path 144 inkscape:connector-curvature="0" 145 id="path4107" 146 d="m 16.03509,8.681773 -5.209549,3.91786" 147 style="fill:none;stroke:#000000;stroke-width:3.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" 148 sodipodi:nodetypes="cc" /> 149 </g> 150 <path 151 transform="matrix(0.89950544,0,0,0.89950544,5.3455146,7.6786635)" 152 d="m 45.925926,24.25926 a 21.296297,21.296297 0 1 1 -42.5925939,0 21.296297,21.296297 0 1 1 42.5925939,0 z" 153 sodipodi:ry="21.296297" 154 sodipodi:rx="21.296297" 155 sodipodi:cy="24.25926" 156 sodipodi:cx="24.629629" 157 id="path4380" 158 style="fill:none;stroke:#000000;stroke-width:3.89102697;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline" 159 sodipodi:type="arc" /> 160 </g> 161 <g 162 inkscape:groupmode="layer" 163 id="layer5" 164 inkscape:label="timer2" 165 style="display:none" 166 sodipodi:insensitive="true"> 167 <g 168 id="g4198" 169 style="stroke-width:1.69182169;stroke-miterlimit:4;stroke-dasharray:none;display:inline" 170 transform="matrix(0.88661828,0,0,0.88661828,43.331119,7.0338455)"> 171 <path 172 inkscape:connector-curvature="0" 173 id="path4190" 174 d="m 3.6632464,51.336754 0,-12.532159" 175 style="fill:#ffffff;stroke:#ffffff;stroke-width:1.69182169;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> 176 <path 177 style="fill:#ffffff;stroke:#ffffff;stroke-width:1.69182169;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" 178 d="m 9.9293259,45.070674 -12.532159,0" 179 id="path4192" 180 inkscape:connector-curvature="0" /> 181 <path 182 inkscape:connector-curvature="0" 183 id="path4194" 184 d="M 8.0940337,49.501461 -0.76754091,40.639887" 185 style="fill:#ffffff;stroke:#ffffff;stroke-width:1.69182169;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> 186 <path 187 style="fill:#ffffff;stroke:#ffffff;stroke-width:1.69182169;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" 188 d="m 8.0940334,40.639887 -8.86157401,8.861574" 189 id="path4196" 190 inkscape:connector-curvature="0" /> 191 </g> 192 </g> 193 </svg> -
new file icons/timer.svg
diff --git a/icons/timer.svg b/icons/timer.svg new file mode 100644 index 0000000..134a0a1
- + 1 <?xml version="1.0" encoding="UTF-8" standalone="no"?> 2 <svg 3 xmlns:dc="http://purl.org/dc/elements/1.1/" 4 xmlns:cc="http://creativecommons.org/ns#" 5 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 6 xmlns:svg="http://www.w3.org/2000/svg" 7 xmlns="http://www.w3.org/2000/svg" 8 xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" 9 xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" 10 contentScriptType="text/ecmascript" 11 width="55px" 12 zoomAndPan="magnify" 13 contentStyleType="text/css" 14 height="55px" 15 preserveAspectRatio="xMidYMid meet" 16 version="1.1" 17 id="svg2" 18 inkscape:version="0.48.1 r9760" 19 sodipodi:docname="record_timer-duration.svg"> 20 <metadata 21 id="metadata23"> 22 <rdf:RDF> 23 <cc:Work 24 rdf:about=""> 25 <dc:format>image/svg+xml</dc:format> 26 <dc:type 27 rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> 28 <dc:title></dc:title> 29 </cc:Work> 30 </rdf:RDF> 31 </metadata> 32 <defs 33 id="defs21" /> 34 <sodipodi:namedview 35 pagecolor="#ffffff" 36 bordercolor="#666666" 37 borderopacity="1" 38 objecttolerance="10" 39 gridtolerance="10" 40 guidetolerance="10" 41 inkscape:pageopacity="0" 42 inkscape:pageshadow="2" 43 inkscape:window-width="1024" 44 inkscape:window-height="525" 45 id="namedview19" 46 showgrid="false" 47 inkscape:zoom="5.6568542" 48 inkscape:cx="36.253557" 49 inkscape:cy="28.65546" 50 inkscape:window-x="0" 51 inkscape:window-y="25" 52 inkscape:window-maximized="1" 53 inkscape:current-layer="layer2" /> 54 <g 55 inkscape:groupmode="layer" 56 id="layer2" 57 inkscape:label="all" 58 style="display:inline"> 59 <path 60 sodipodi:type="arc" 61 style="fill:#ffffff;fill-opacity:1;stroke:none" 62 id="path3791" 63 sodipodi:cx="24.629629" 64 sodipodi:cy="24.25926" 65 sodipodi:rx="21.296297" 66 sodipodi:ry="21.296297" 67 d="m 45.925926,24.25926 a 21.296297,21.296297 0 1 1 -42.5925939,0 21.296297,21.296297 0 1 1 42.5925939,0 z" 68 transform="matrix(0.89950544,0,0,0.89950544,5.3455146,7.678664)" /> 69 </g> 70 <g 71 inkscape:groupmode="layer" 72 id="layer1" 73 inkscape:label="timer" 74 style="display:inline"> 75 <path 76 style="fill:none;stroke:#000000;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" 77 d="m 27.605804,29.867439 8.04512,-11.042322" 78 id="path3897" 79 inkscape:connector-curvature="0" /> 80 </g> 81 <g 82 inkscape:groupmode="layer" 83 id="layer3" 84 inkscape:label="duration" 85 style="display:none" 86 sodipodi:insensitive="true"> 87 <path 88 style="fill:#808080;fill-opacity:1;stroke:none" 89 d="m 36.539789,13.013087 c 9.161862,4.992537 12.541772,16.466949 7.549234,25.628815 L 27.5,29.602112 z" 90 id="path4311" 91 inkscape:connector-curvature="0" 92 sodipodi:nodetypes="cccc" 93 inkscape:transform-center-x="-9.4478671" 94 inkscape:transform-center-y="-3.7746184" /> 95 <path 96 inkscape:connector-curvature="0" 97 id="path4283" 98 d="M 27.571522,30.159444 39.546676,36.73611" 99 style="fill:none;stroke:#000000;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" 100 inkscape:transform-center-x="-6.1363368" 101 inkscape:transform-center-y="3.4538125" /> 102 </g> 103 <g 104 inkscape:groupmode="layer" 105 id="layer4" 106 inkscape:label="Capa" 107 style="display:inline" 108 sodipodi:insensitive="true"> 109 <g 110 style="display:inline" 111 id="g4315"> 112 <path 113 inkscape:connector-curvature="0" 114 id="path3811" 115 d="m 27.5,15.555556 0,3.888889" 116 style="fill:none;stroke:#000000;stroke-width:3.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> 117 <path 118 style="fill:none;stroke:#000000;stroke-width:3.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" 119 d="m 41.444444,29.5 -3.888889,0" 120 id="path3823" 121 inkscape:connector-curvature="0" /> 122 <path 123 inkscape:connector-curvature="0" 124 id="path3829" 125 d="m 13.555556,29.5 3.888889,0" 126 style="fill:none;stroke:#000000;stroke-width:3.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> 127 <path 128 style="fill:none;stroke:#000000;stroke-width:3.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" 129 d="m 27.5,43.444444 0,-3.888889" 130 id="path3854" 131 inkscape:connector-curvature="0" /> 132 <path 133 inkscape:connector-curvature="0" 134 id="path4076" 135 d="m 22.873381,5.940543 9.622594,0" 136 style="fill:none;stroke:#000000;stroke-width:3.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> 137 <path 138 sodipodi:nodetypes="cc" 139 style="fill:none;stroke:#000000;stroke-width:3.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" 140 d="m 38.96491,8.681773 5.209549,3.91786" 141 id="path4080" 142 inkscape:connector-curvature="0" /> 143 <path 144 inkscape:connector-curvature="0" 145 id="path4107" 146 d="m 16.03509,8.681773 -5.209549,3.91786" 147 style="fill:none;stroke:#000000;stroke-width:3.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" 148 sodipodi:nodetypes="cc" /> 149 </g> 150 <path 151 transform="matrix(0.89950544,0,0,0.89950544,5.3455146,7.6786635)" 152 d="m 45.925926,24.25926 a 21.296297,21.296297 0 1 1 -42.5925939,0 21.296297,21.296297 0 1 1 42.5925939,0 z" 153 sodipodi:ry="21.296297" 154 sodipodi:rx="21.296297" 155 sodipodi:cy="24.25926" 156 sodipodi:cx="24.629629" 157 id="path4380" 158 style="fill:none;stroke:#000000;stroke-width:3.89102697;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline" 159 sodipodi:type="arc" /> 160 </g> 161 <g 162 inkscape:groupmode="layer" 163 id="layer5" 164 inkscape:label="timer2" 165 style="display:inline"> 166 <g 167 id="g4198" 168 style="stroke-width:1.69182165;stroke-miterlimit:4;stroke-dasharray:none;display:inline" 169 transform="matrix(0.88661828,0,0,0.88661828,43.331119,7.0338455)"> 170 <path 171 inkscape:connector-curvature="0" 172 id="path4190" 173 d="m 3.6632464,51.336754 0,-12.532159" 174 style="fill:#ffffff;stroke:#ffffff;stroke-width:1.69182165;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> 175 <path 176 style="fill:#ffffff;stroke:#ffffff;stroke-width:1.69182165;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" 177 d="m 9.9293259,45.070674 -12.532159,0" 178 id="path4192" 179 inkscape:connector-curvature="0" /> 180 <path 181 inkscape:connector-curvature="0" 182 id="path4194" 183 d="M 8.0940337,49.501461 -0.76754091,40.639887" 184 style="fill:#ffffff;stroke:#ffffff;stroke-width:1.69182165;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> 185 <path 186 style="fill:#ffffff;stroke:#ffffff;stroke-width:1.69182165;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" 187 d="m 8.0940334,40.639887 -8.86157401,8.861574" 188 id="path4196" 189 inkscape:connector-curvature="0" /> 190 </g> 191 </g> 192 </svg> -
record.py
diff --git a/record.py b/record.py index 11da096..0030f76 100644
a b import utils 49 49 from tray import HTray 50 50 from mediaview import MediaView 51 51 import hw 52 from iconcombobox import IconComboBox 52 53 53 54 logger = logging.getLogger('record.py') 54 55 COLOR_BLACK = gdk.color_parse('#000000') … … class RecordControl(): 880 881 self.quality.combo.set_active(idx) 881 882 882 883 883 class TimerCombo( ToolComboBox):884 class TimerCombo(IconComboBox): 884 885 TIMERS = (0, 5, 10) 885 886 886 887 def __init__(self): 887 self._combo_box_text = gtk.combo_box_new_text()888 super(TimerCombo, self).__init__( combo=self._combo_box_text, label_text=_('Timer:'))888 icon_filename = os.path.join('icons', 'timer.svg') 889 super(TimerCombo, self).__init__(icon_filename) 889 890 890 891 for i in self.TIMERS: 891 892 if i == 0: 892 self. _combo_box_text.append_text(_('Immediate'))893 self.append_item(i, _('Immediate')) 893 894 else: 894 895 string = TimerCombo._seconds_string(i) 895 self. _combo_box_text.append_text(string)896 self. _combo_box_text.set_active(0)896 self.append_item(i, string) 897 self.combo.set_active(0) 897 898 898 899 def get_value(self): 899 return TimerCombo.TIMERS[self. _combo_box_text.get_active()]900 return TimerCombo.TIMERS[self.combo.get_active()] 900 901 901 902 def get_value_idx(self): 902 return self. _combo_box_text.get_active()903 return self.combo.get_active() 903 904 904 905 def set_value_idx(self, idx): 905 self. _combo_box_text.set_active(idx)906 self.combo.set_active(idx) 906 907 907 908 @staticmethod 908 909 def _seconds_string(x): 909 910 return ngettext('%s second', '%s seconds', x) % x 910 911 911 912 912 class DurationCombo( ToolComboBox):913 class DurationCombo(IconComboBox): 913 914 DURATIONS = (2, 4, 6) 914 915 915 916 def __init__(self): 916 self._combo_box_text = gtk.combo_box_new_text()917 super(DurationCombo, self).__init__( combo=self._combo_box_text, label_text=_('Duration:'))917 icon_filename = os.path.join('icons', 'duration.svg') 918 super(DurationCombo, self).__init__(icon_filename) 918 919 919 920 for i in self.DURATIONS: 920 921 string = DurationCombo._minutes_string(i) 921 self. _combo_box_text.append_text(string)922 self. _combo_box_text.set_active(0)922 self.append_item(i, string) 923 self.combo.set_active(0) 923 924 924 925 def get_value(self): 925 return 60 * self.DURATIONS[self. _combo_box_text.get_active()]926 return 60 * self.DURATIONS[self.combo.get_active()] 926 927 927 928 def get_value_idx(self): 928 return self. _combo_box_text.get_active()929 return self.combo.get_active() 929 930 930 931 def set_value_idx(self, idx): 931 self. _combo_box_text.set_active(idx)932 self.combo.set_active(idx) 932 933 933 934 @staticmethod 934 935 def _minutes_string(x):