Commit 0519b0c6 authored by Edward Hervey's avatar Edward Hervey

* docs/HACKING:

More precision on coding style
* pitivi/ui/complexinterface.py:
* pitivi/ui/complexlayer.py:
* pitivi/ui/complexsource.py:
* pitivi/ui/complextimeline.py:
* pitivi/ui/encodingdialog.glade:
* pitivi/ui/exportsettingswidget.glade:
* pitivi/ui/exportsettingswidget.py:
* pitivi/ui/gstwidget.py:
* pitivi/ui/infolayer.py:
* pitivi/ui/layerwidgets.py:
* pitivi/ui/mainwindow.py:
* pitivi/ui/projectsettings.glade:
* pitivi/ui/projectsettings.py:
* pitivi/ui/ruler.py:
* pitivi/ui/sourcefactories.py:
* pitivi/ui/timeline.py:
* pitivi/ui/timelineobjects.py:
* pitivi/ui/tracklayer.py:
* pitivi/ui/viewer.py:
Update all UI section to proper coding style, still have to do the
non-ui part.


git-svn-id: svn+ssh://svn.gnome.org/svn/pitivi/trunk@710 d3729300-e425-0410-8a4c-d956edccc248
parent 357f304d
2006-03-16 Edward Hervey <edward@fluendo.com>
* docs/HACKING:
More precision on coding style
* pitivi/ui/complexinterface.py:
* pitivi/ui/complexlayer.py:
* pitivi/ui/complexsource.py:
* pitivi/ui/complextimeline.py:
* pitivi/ui/encodingdialog.glade:
* pitivi/ui/exportsettingswidget.glade:
* pitivi/ui/exportsettingswidget.py:
* pitivi/ui/gstwidget.py:
* pitivi/ui/infolayer.py:
* pitivi/ui/layerwidgets.py:
* pitivi/ui/mainwindow.py:
* pitivi/ui/projectsettings.glade:
* pitivi/ui/projectsettings.py:
* pitivi/ui/ruler.py:
* pitivi/ui/sourcefactories.py:
* pitivi/ui/timeline.py:
* pitivi/ui/timelineobjects.py:
* pitivi/ui/tracklayer.py:
* pitivi/ui/viewer.py:
Update all UI section to proper coding style, still have to do the
non-ui part.
2006-03-16 Edward Hervey <edward@fluendo.com>
* docs/HACKING
......
Hacking on PiTiVi
* Coding Style Guide
--------------------
- We rely on the Python Style Guide PEP-8
(http://www.python.org/doc/peps/pep-0008/)
- for method names we use the mixedCase style
Ex :
class MyClass:
def aReallyImportantMethod(self):
self.doSomething()
- for callbacks, the name of the methods used should:
- follow same conventions as normal method names
- be prepended with an underscore
- be appended with Cb
Ex :
class MyClass:
def someMethod(self):
self.someobject.connect('event', self._someObjectEventCb)
def _someObjectEventCb(self, object, arg):
print "our callback was called"
* Debugging
-----------
- All debug output should be done through the gstreamer debugging system:
ex : gst.debug("wow")
- Whenever appliable, the debugging should be used on gstreamer objects
\ No newline at end of file
......@@ -67,51 +67,51 @@ import gst
class ZoomableWidgetInterface:
def get_pixel_width(self):
def getPixelWidth(self):
"""
Returns the width in pixels corresponding to the duration of the object
"""
dur = self.get_duration()
width = self.ns_to_pixel(dur)
dur = self.getDuration()
width = self.nsToPixel(dur)
gst.log("Got time %s, returning width : %d" % (gst.TIME_ARGS(dur), width))
return width
def get_pixel_position(self):
def getPixelPosition(self):
"""
Returns the pixel offset of the widget in it's container, according to:
_ the start position of the object in it's timeline container,
_ and the set zoom ratio
"""
start = self.get_start_time()
pos = self.ns_to_pixel(start)
start = self.getStartTime()
pos = self.nsToPixel(start)
gst.log("Got start time %s, returning offset %d" % (gst.TIME_ARGS(start), pos))
return pos
def pixel_to_ns(self, pixel):
def pixelToNs(self, pixel):
"""
Returns the pixel equivalent in nanoseconds according to the zoomratio
"""
return int(pixel * gst.SECOND / self.get_zoom_ratio())
return int(pixel * gst.SECOND / self.getZoomRatio())
def ns_to_pixel(self, duration):
def nsToPixel(self, duration):
"""
Returns the pixel equivalent of the given duration, according to the
set zoom ratio
"""
if duration == gst.CLOCK_TIME_NONE:
return 0
return int((float(duration) / gst.SECOND) * self.get_zoom_ratio())
return int((float(duration) / gst.SECOND) * self.getZoomRatio())
## Methods to implement in subclasses
def get_duration(self):
def getDuration(self):
"""
Return the duration in nanoseconds of the object
To be implemented by subclasses
"""
raise NotImplementedError
def get_start_time(self):
def getStartTime(self):
"""
Return the start time in nanosecond of the object
To be implemented by subclasses
......@@ -121,27 +121,27 @@ class ZoomableWidgetInterface:
def zoomChanged(self):
raise NotImplementedError
def duration_changed(self):
def durationChanged(self):
self.queue_resize()
def start_changed(self):
def startChanged(self):
self.queue_resize()
def start_duration_changed(self):
def startDurationChanged(self):
gst.info("start/duration changed")
self.queue_resize()
def get_zoom_ratio(self):
def getZoomRatio(self):
# either the current object is the top-level object that contains the zoomratio
if hasattr(self, 'zoomratio'):
return self.zoomratio
# chain up to the parent
parent = self.parent
while not hasattr(parent, 'get_zoom_ratio'):
while not hasattr(parent, 'getZoomRatio'):
parent = parent.parent
return parent.get_zoom_ratio()
return parent.getZoomRatio()
def set_zoom_ratio(self, zoomratio):
def setZoomRatio(self, zoomratio):
if hasattr(self, 'zoomratio'):
if self.zoomratio == zoomratio:
return
......@@ -149,7 +149,7 @@ class ZoomableWidgetInterface:
self.zoomratio = zoomratio
self.zoomChanged()
else:
self.parent.set_zoom_ratio(zoomratio)
self.parent.setZoomRatio(zoomratio)
class LayeredWidgetInterface:
......@@ -193,16 +193,16 @@ class LayeredWidgetInterface:
""" set the layer at the given position to the requested height """
self.layerinfolist.changeLayerHeight(layerposition, height)
def __expanded_cb(self, list, layerposition, expanded):
def _expandedCb(self, list, layerposition, expanded):
self.layerExpanded(layerposition, expanded)
def __layer_height_changed_cb(self, list, layerposition):
def _layerHeightChangedCb(self, list, layerposition):
self.layerHeightChanged(layerposition)
def __layer_added_cb(self, list, position):
def _layerAddedCb(self, list, position):
self.layerAdded(position)
def __layer_removed_cb(self, list, position):
def _layerRemovedCb(self, list, position):
self.layerRemoved(position)
def layerExpanded(self, layerposition, expanded):
......
......@@ -75,9 +75,9 @@ class LayerInfoList(gobject.GObject):
gobject.GObject.__init__(self)
self.timeline = timeline
self._list = []
self.__fillList()
self._fillList()
def __fillList(self):
def _fillList(self):
gst.debug("filling up LayerInfoList")
self.addComposition(self.timeline.videocomp)
self.addComposition(self.timeline.audiocomp)
......
......@@ -42,11 +42,11 @@ class ComplexTimelineSource(gtk.Image, ZoomableWidgetInterface):
gtk.Image.__init__(self)
self.layerInfo = layerInfo
self.source = source
self.source.connect("start-duration-changed", self._start_duration_changed_cb)
self.source.connect("start-duration-changed", self._startDurationChangedCb)
self.thumbnailsurface = cairo.ImageSurface.create_from_png(self.source.factory.thumbnail)
self.pixmap = None
def get_height(self):
def getHeight(self):
# TODO, maybe this should be zoomable too ?
return 50
......@@ -60,7 +60,7 @@ class ComplexTimelineSource(gtk.Image, ZoomableWidgetInterface):
def do_size_request(self, requisition):
gst.debug("source, requisition:%s" % list(requisition))
requisition.width=self.get_pixel_width()
requisition.width=self.getPixelWidth()
## Drawing methods
......@@ -76,15 +76,15 @@ class ComplexTimelineSource(gtk.Image, ZoomableWidgetInterface):
self.pixmap = gtk.gdk.Pixmap(self.window, rect.width, rect.height)
context = self.pixmap.cairo_create()
self.draw_background(context, rect)
self.drawBackground(context, rect)
if self.source.media_type == MEDIA_TYPE_VIDEO:
self.draw_thumbnail(context, rect)
self.drawThumbnail(context, rect)
self.draw_decoration_border(context, rect)
self.drawDecorationBorder(context, rect)
self.set_from_pixmap(self.pixmap, None)
def draw_background(self, context, allocation):
def drawBackground(self, context, allocation):
context.save()
context.set_source_rgb(1.0, 0.9, 0.9)
context.rectangle(0, 0, allocation.width, allocation.height)
......@@ -92,13 +92,13 @@ class ComplexTimelineSource(gtk.Image, ZoomableWidgetInterface):
context.stroke()
context.restore()
def draw_decoration_border(self, context, rect):
def drawDecorationBorder(self, context, rect):
context.set_source_rgb(1, 0, 0)
context.rectangle(0, 0, rect.width, rect.height)
context.stroke()
def draw_thumbnail(self, context, alloc):
def drawThumbnail(self, context, alloc):
context.save()
# figure out the scaleratio
surfwidth = self.thumbnailsurface.get_width()
......@@ -118,11 +118,11 @@ class ComplexTimelineSource(gtk.Image, ZoomableWidgetInterface):
## ZoomableWidgetInterface methods
def get_duration(self):
def getDuration(self):
return self.source.duration
def get_start_time(self):
def getStartTime(self):
return self.source.start
def _start_duration_changed_cb(self, source, start, duration):
self.start_duration_changed()
def _startDurationChangedCb(self, source, start, duration):
self.startDurationChanged()
......@@ -37,8 +37,8 @@ class CompositionLayers(gtk.VBox, ZoomableWidgetInterface):
self.leftSizeGroup = leftsizegroup
self.hadj = hadj
self.layerInfoList = layerinfolist
self.layerInfoList.connect('layer-added', self.__layerAddedCb)
self.layerInfoList.connect('layer-removed', self.__layerRemovedCb)
self.layerInfoList.connect('layer-added', self._layerAddedCb)
self.layerInfoList.connect('layer-removed', self._layerRemovedCb)
self._createUI()
def _createUI(self):
......@@ -54,10 +54,10 @@ class CompositionLayers(gtk.VBox, ZoomableWidgetInterface):
## ZoomableWidgetInterface overrides
def get_duration(self):
return max([layer.get_duration() for layer in self.layers])
def getDuration(self):
return max([layer.getDuration() for layer in self.layers])
def get_start_time(self):
def getStartTime(self):
# the start time is always 0 (for display reason)
return 0
......@@ -67,14 +67,14 @@ class CompositionLayers(gtk.VBox, ZoomableWidgetInterface):
## LayerInfoList callbacks
def __layerAddedCb(self, layerInfoList, position):
def _layerAddedCb(self, layerInfoList, position):
complayer = CompositionLayer(self.leftSizeGroup, self.hadj,
layerInfoList[position])
self.layers.insert(position, complayer)
self.pack_start(complayer, expand=False)
self.reorder_child(complayer, position)
def __layerRemovedCb(self, layerInfoList, position):
def _layerRemovedCb(self, layerInfoList, position):
# find the proper child
child = self.layers[position]
# remove it
......@@ -132,8 +132,8 @@ class ComplexTimelineWidget(gtk.VBox, ZoomableWidgetInterface):
# top layer (TopLayer)
self.topLayer = TopLayer(self.leftSizeGroup, self.hadj)
# overriding topLayer's ZoomableWidgetInterface methods
self.topLayer.get_duration = self.get_duration
self.topLayer.get_start_time = self.get_start_time
self.topLayer.getDuration = self.getDuration
self.topLayer.getStartTime = self.getStartTime
self.topLayer.overrideZoomableWidgetInterfaceMethods()
self.pack_start(self.topLayer, expand=False)
......@@ -149,17 +149,17 @@ class ComplexTimelineWidget(gtk.VBox, ZoomableWidgetInterface):
def _layerStartDurationChangedCb(self, composition, start, duration):
# Force resize of ruler
self.topLayer.start_duration_changed()
self.topLayer.startDurationChanged()
## ZoomableWidgetInterface overrides
## * we send everything to self.compositionLayers
## * topLayer's function calls will also go there
def get_duration(self):
return self.compositionLayers.get_duration()
def getDuration(self):
return self.compositionLayers.getDuration()
def get_start_time(self):
return self.compositionLayers.get_start_time()
def getStartTime(self):
return self.compositionLayers.getStartTime()
def zoomChanged(self):
self.topLayer.rightWidget.zoomChanged()
......@@ -169,7 +169,7 @@ class ComplexTimelineWidget(gtk.VBox, ZoomableWidgetInterface):
## ToolBar callbacks
def toolBarZoomChangedCb(self, toolbar, zoomratio):
self.set_zoom_ratio(self, zoomratio)
self.setZoomRatio(self, zoomratio)
## timeline position callback
......
......@@ -41,7 +41,7 @@
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-5</property>
<signal name="clicked" handler="recordbutton_clicked" last_modification_time="Tue, 24 May 2005 21:41:00 GMT"/>
<signal name="clicked" handler="_recordButtonClickedCb" last_modification_time="Tue, 24 May 2005 21:41:00 GMT"/>
</widget>
</child>
......@@ -55,7 +55,7 @@
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-6</property>
<signal name="clicked" handler="cancelbutton_clicked" last_modification_time="Tue, 24 May 2005 21:41:09 GMT"/>
<signal name="clicked" handler="_cancelButtonClickedCb" last_modification_time="Tue, 24 May 2005 21:41:09 GMT"/>
</widget>
</child>
</widget>
......@@ -113,7 +113,7 @@
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="filebutton_clicked" last_modification_time="Tue, 24 May 2005 21:28:02 GMT"/>
<signal name="clicked" handler="_fileButtonClickedCb" last_modification_time="Tue, 24 May 2005 21:28:02 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
......@@ -168,7 +168,7 @@
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="settingsbutton_clicked" last_modification_time="Thu, 23 Jun 2005 15:31:45 GMT"/>
<signal name="clicked" handler="_settingsButtonClickedCb" last_modification_time="Thu, 23 Jun 2005 15:31:45 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
......
......@@ -60,7 +60,7 @@
<property name="items" translatable="yes">Video Preset</property>
<property name="add_tearoffs">False</property>
<property name="focus_on_click">True</property>
<signal name="changed" handler="videocombobox_changed" last_modification_time="Tue, 24 May 2005 13:42:43 GMT"/>
<signal name="changed" handler="_videoComboboxChangedCb" last_modification_time="Tue, 24 May 2005 13:42:43 GMT"/>
</widget>
<packing>
<property name="left_attach">0</property>
......@@ -289,7 +289,7 @@
<property name="items" translatable="yes">Audio Preset</property>
<property name="add_tearoffs">False</property>
<property name="focus_on_click">True</property>
<signal name="changed" handler="audiocombobox_changed" last_modification_time="Tue, 24 May 2005 13:42:37 GMT"/>
<signal name="changed" handler="_audioComboboxChangedCb" last_modification_time="Tue, 24 May 2005 13:42:37 GMT"/>
</widget>
<packing>
<property name="left_attach">0</property>
......@@ -627,7 +627,7 @@ Stereo (2)</property>
<property name="items" translatable="yes">Muxer</property>
<property name="add_tearoffs">False</property>
<property name="focus_on_click">True</property>
<signal name="changed" handler="muxercombobox_changed" last_modification_time="Tue, 24 May 2005 19:18:10 GMT"/>
<signal name="changed" handler="_muxerComboboxChangedCb" last_modification_time="Tue, 24 May 2005 19:18:10 GMT"/>
</widget>
<packing>
<property name="left_attach">1</property>
......@@ -647,7 +647,7 @@ Stereo (2)</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_muxersettingsbutton_clicked" last_modification_time="Sat, 18 Jun 2005 17:45:50 GMT"/>
<signal name="clicked" handler="_muxerSettingsButtonClickedCb" last_modification_time="Sat, 18 Jun 2005 17:45:50 GMT"/>
</widget>
<packing>
<property name="left_attach">2</property>
......@@ -667,7 +667,7 @@ Stereo (2)</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_acodecsettingsbutton_clicked" last_modification_time="Sat, 18 Jun 2005 17:45:55 GMT"/>
<signal name="clicked" handler="_acodecSettingsButtonClickedCb" last_modification_time="Sat, 18 Jun 2005 17:45:55 GMT"/>
</widget>
<packing>
<property name="left_attach">2</property>
......@@ -687,7 +687,7 @@ Stereo (2)</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_vcodecsettingsbutton_clicked" last_modification_time="Sat, 18 Jun 2005 17:46:55 GMT"/>
<signal name="clicked" handler="_vcodecSettingsButtonClickedCb" last_modification_time="Sat, 18 Jun 2005 17:46:55 GMT"/>
</widget>
<packing>
<property name="left_attach">2</property>
......
......@@ -58,11 +58,11 @@ class ExportSettingsWidget(GladeWidget):
self.vcodecsettings = {}
self.acodecsettings = {}
def set_settings(self, settings):
def setSettings(self, settings):
self.settings = settings
self._fill_settings()
self._fillSettings()
def _fill_settings(self):
def _fillSettings(self):
# Video settings
self.videowidthspin.set_value(self.settings.videowidth)
self.videoheightspin.set_value(self.settings.videoheight)
......@@ -102,13 +102,13 @@ class ExportSettingsWidget(GladeWidget):
audiolist.clear()
for rate in self.audio_rates:
audiolist.append([rate[0]])
self._put_good_audiorate(self.settings.audiorate)
self._putGoodAudiorate(self.settings.audiorate)
audiolist = self.audiodepthcbox.get_model()
audiolist.clear()
for depth in self.audio_depths:
audiolist.append([depth[0]])
self._put_good_audiodepth(self.settings.audiodepth)
self._putGoodAudiodepth(self.settings.audiodepth)
audiolist = self.audiocombobox.get_model()
audiolist.clear()
......@@ -167,7 +167,7 @@ class ExportSettingsWidget(GladeWidget):
self.acodecsettings = self.settings.acodecsettings
self.vcodecsettings = self.settings.vcodecsettings
def _put_good_videorate(self, value):
def _putGoodVideorate(self, value):
idx = 0
for rate in self.video_rates:
if value == rate[1]:
......@@ -175,7 +175,7 @@ class ExportSettingsWidget(GladeWidget):
return
idx = idx + 1
def _put_good_audiorate(self, value):
def _putGoodAudiorate(self, value):
idx = 0
for rate in self.audio_rates:
if value == rate[1]:
......@@ -183,7 +183,7 @@ class ExportSettingsWidget(GladeWidget):
return
idx = idx + 1
def _put_good_audiodepth(self, value):
def _putGoodAudiodepth(self, value):
idx = 0
for depth in self.audio_depths:
if value == depth[1]:
......@@ -191,7 +191,7 @@ class ExportSettingsWidget(GladeWidget):
return
idx = idx + 1
def videocombobox_changed(self, widget):
def _videoComboboxChangedCb(self, widget):
idx = widget.get_active()
if idx == len(self.video_presets):
activate = True
......@@ -199,25 +199,25 @@ class ExportSettingsWidget(GladeWidget):
activate = False
self.videowidthspin.set_value(self.video_presets[idx][1])
self.videoheightspin.set_value(self.video_presets[idx][2])
self._put_good_videorate(self.video_presets[idx][3])
self._putGoodVideorate(self.video_presets[idx][3])
self.videowidthspin.set_sensitive(activate)
self.videoheightspin.set_sensitive(activate)
self.videoratecbox.set_sensitive(activate)
def audiocombobox_changed(self, widget):
def _audioComboboxChangedCb(self, widget):
idx = widget.get_active()
if idx == len(self.audio_presets):
activate = True
else:
activate = False
self.audiochanncbox.set_active(self.audio_presets[idx][1] - 1)
self._put_good_audiorate(self.audio_presets[idx][2])
self._put_good_audiodepth(self.audio_presets[idx][3])
self._putGoodAudiorate(self.audio_presets[idx][2])
self._putGoodAudiodepth(self.audio_presets[idx][3])
self.audiochanncbox.set_sensitive(activate)
self.audioratecbox.set_sensitive(activate)
self.audiodepthcbox.set_sensitive(activate)
def muxercombobox_changed(self, widget):
def _muxerComboboxChangedCb(self, widget):
if self.validvencoders:
prevvenc = self.validvencoders[self.vcodeccbox.get_active()].get_name()
else:
......@@ -227,8 +227,10 @@ class ExportSettingsWidget(GladeWidget):
else:
prevaenc = self.settings.aencoder
# find the valid audio/video codec with the given muxer
self.validaencoders = encoders_muxer_compatible(self.settings.aencoders, self.muxers[widget.get_active()])
self.validvencoders = encoders_muxer_compatible(self.settings.vencoders, self.muxers[widget.get_active()])
self.validaencoders = encoders_muxer_compatible(self.settings.aencoders,
self.muxers[widget.get_active()])
self.validvencoders = encoders_muxer_compatible(self.settings.vencoders,
self.muxers[widget.get_active()])
venclist = self.vcodeccbox.get_model()
venclist.clear()
......@@ -252,7 +254,7 @@ class ExportSettingsWidget(GladeWidget):
idx = idx + 1
self.acodeccbox.set_active(selected)
def run_settings_dialog(self, factory, settings):
def runSettingsDialog(self, factory, settings):
dialog = GstElementSettingsDialog(factory, settings)
if dialog.run() == gtk.RESPONSE_OK:
dialog.hide()
......@@ -262,32 +264,32 @@ class ExportSettingsWidget(GladeWidget):
dialog.destroy()
return settings
def on_muxersettingsbutton_clicked(self, button):
def _muxerSettingsButtonClickedCb(self, button):
factory = self.settings.muxers[self.muxercombobox.get_active()]
if not factory:
return
set = self.run_settings_dialog(factory, self.containersettings)
set = self.runSettingsDialog(factory, self.containersettings)
if set:
self.containersettings = set
def on_acodecsettingsbutton_clicked(self, button):
def _acodecSettingsButtonClickedCb(self, button):
factory = self.validaencoders[self.acodeccbox.get_active()]
if not factory:
return
set = self.run_settings_dialog(factory, self.acodecsettings)
set = self.runSettingsDialog(factory, self.acodecsettings)
if set:
self.acodecsettings = set
def on_vcodecsettingsbutton_clicked(self, button):
def _vcodecSettingsButtonClickedCb(self, button):
factory = self.validvencoders[self.vcodeccbox.get_active()]
if not factory:
return
set = self.run_settings_dialog(factory, self.vcodecsettings)
set = self.runSettingsDialog(factory, self.vcodecsettings)
if set:
self.vcodecsettings = set
def _update_settings(self):
def updateSettings(self):
# Video Settings
width = self.videowidthspin.get_value()
height = self.videoheightspin.get_value()
......@@ -322,10 +324,10 @@ class ExportSettingsDialog(gtk.Dialog):
gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT))
self.setwidget = ExportSettingsWidget()
self.vbox.pack_start(self.setwidget)
self.setwidget.set_settings(settings)
self.setwidget.setSettings(settings)
self.setwidget.show_all()
def get_settings(self):
self.setwidget._update_settings()
def getSettings(self):
self.setwidget.updateSettings()
return self.setwidget.settings
......@@ -77,14 +77,14 @@ class GstElementSettingsWidget(gtk.VBox):
def __init__(self):
gtk.VBox.__init__(self)
def set_element(self, element, properties={}, ignore=['name']):
def setElement(self, element, properties={}, ignore=['name']):
gst.info("element:%s, properties:%s" % (element, properties))
self.element = element
self.ignore = ignore
self.properties = {} #key:name, value:widget
self._add_widgets(properties)
self._addWidgets(properties)
def _add_widgets(self, properties):
def _addWidgets(self, properties):
props = [x for x in gobject.list_properties(self.element) if not x.name in self.ignore]
if not props:
self.pack_start(gtk.Label("No properties..."))
......@@ -106,7 +106,7 @@ class GstElementSettingsWidget(gtk.VBox):
self.pack_start(table)
self.show_all()
def get_settings(self):
def getSettings(self):
""" returns the dictionnary of propertyname/propertyvalue """
d = {}
for property, widget in self.properties.iteritems():
......@@ -132,18 +132,18 @@ class GstElementSettingsDialog(GladeWindow):
self.desclabel = self.widgets["descriptionlabel"]
self.authlabel = self.widgets["authorlabel"]
self.properties = properties
self._fill_window()
self._fillWindow()
def _fill_window(self):
def _fillWindow(self):
# set title and frame label
self.window.set_title("Properties for " + self.factory.get_longname())
self.widgets["infolabel"].set_markup("<b>" + self.factory.get_longname() + "</b>")
self.desclabel.set_text(self.factory.get_description())
self.authlabel.set_text(string.join(self.factory.get_author().split(","), "\n"))
self.authlabel.set_justify(gtk.JUSTIFY_RIGHT)
self.widgets["elementsettings"].set_element(self.element, self.properties)
self.widgets["elementsettings"].setElement(self.element, self.properties)
def get_settings(self):
def getSettings(self):
""" returns the property/value dictionnary of the selected settings """
return self.widgets["elementsettings"].get_settings()
return self.widgets["elementsettings"].getSettings()
......@@ -42,19 +42,19 @@ class InfoLayer(gtk.Expander):
self.set_border_width(5)
self.set_expanded(self.layerInfo.expanded)
self.label = gtk.Label(self.get_duration_string())
self.label = gtk.Label(self.getDurationString())
self.add(self.label)
self.layerInfo.composition.connect('start-duration-changed',
self.compositionStartDurationChangedCb)
self._compositionStartDurationChangedCb)
# TODO :
# . put content
## signal from composition
def compositionStartDurationChangedCb(self, composition, start, duration):
self.label.set_text(self.get_duration_string())
def _compositionStartDurationChangedCb(self, composition, start, duration):
self.label.set_text(self.getDurationString())
## Gtk.Expander override
......@@ -74,7 +74,7 @@ class InfoLayer(gtk.Expander):
## utils
def get_duration_string(self):
def getDurationString(self):
if self.layerInfo.composition.duration > 0:
return time_to_string(self.layerInfo.composition.duration)
return "Empty"
......@@ -39,24 +39,24 @@ class TimelineToolBar(gtk.HBox):
gtk.ICON_SIZE_SMALL_TOOLBAR)
self.zoomInButton.set_image(image)
self.pack_start(self.zoomInButton, expand=False)
self.zoomInButton.connect('clicked', self.zoomClickedCb)
self.zoomInButton.connect('clicked', self._zoomClickedCb)
self.zoomOutButton = gtk.Button(label="")
self.zoomOutButton.set_image(gtk.image_new_from_stock(gtk.STOCK_ZOOM_OUT,
gtk.ICON_SIZE_SMALL_TOOLBAR))
self.pack_start(self.zoomOutButton, expand=False)
self.zoomOutButton.connect('clicked', self.zoomClickedCb)
self.zoomOutButton.connect('clicked', self._zoomClickedCb)