[pitivi: 2/4] User Interface: remove double-underscore identifie



commit f0a8e27f03dc6c7d31a81c1b653272d55f89431b
Author: Brandon Lewis <brandon_lewis berkeley edu>
Date:   Sun Mar 8 23:02:49 2009 -0700

    User Interface: remove double-underscore identifiers
    
    defaultpropertyeditor: remove double-underscore identifiers
    
    ui.timelinecanvas: remove double-underscore identifiers
    
    mainwindow: remove double-underscore identifiers
    
    webcam_managerdialog: remove double-underscore identifiers
    
    ui.timeline: remove double-underscore identifiers
    
    zoominterface: remove double-underscore identifiers
    
    ui.preview: remove double-underscore identifiers
    
    ui.projecttabs: remove double-underscore identifiers
    
    ui.propertyeditor: remove double-underscore identifiers
    
    previewer: remove double-underscore identifiers
---
 pitivi/previewer.py                |   22 ++++----
 pitivi/ui/defaultpropertyeditor.py |   14 ++--
 pitivi/ui/mainwindow.py            |   12 ++--
 pitivi/ui/preview.py               |   18 +++---
 pitivi/ui/projecttabs.py           |   12 ++--
 pitivi/ui/propertyeditor.py        |   50 ++++++++--------
 pitivi/ui/timeline.py              |   68 +++++++++++-----------
 pitivi/ui/timelinecanvas.py        |  110 ++++++++++++++++++------------------
 pitivi/ui/webcam_managerdialog.py  |   66 +++++++++++-----------
 pitivi/ui/zoominterface.py         |   26 ++++----
 10 files changed, 199 insertions(+), 199 deletions(-)

diff --git a/pitivi/previewer.py b/pitivi/previewer.py
index f4c4e5c..6e04386 100644
--- a/pitivi/previewer.py
+++ b/pitivi/previewer.py
@@ -334,17 +334,17 @@ class RandomAccessAudioPreviewer(RandomAccessPreviewer):
             conv : self.audioSink,
             self.audioSink : None})
         bus = self.audioPipeline.get_bus()
-        bus.set_sync_handler(self.__bus_message)
-        self.__audio_cur = None
+        bus.set_sync_handler(self._bus_message)
+        self._audio_cur = None
         self.audioPipeline.set_state(gst.STATE_PAUSED)
 
     def _segment_for_time(self, time):
         # for audio files, we need to know the duration the segment spans
         return time, Zoomable.pixelToNs(self.twidth)
 
-    def __bus_message(self, bus, message):
+    def _bus_message(self, bus, message):
         if message.type == gst.MESSAGE_SEGMENT_DONE:
-            self.__finishWaveform()
+            self._finishWaveform()
 
         elif message.type == gst.MESSAGE_ERROR:
             error, debug = message.parse_error()
@@ -355,7 +355,7 @@ class RandomAccessAudioPreviewer(RandomAccessPreviewer):
 
     def _startThumbnail(self, (timestamp, duration)):
         RandomAccessPreviewer._startThumbnail(self, (timestamp, duration))
-        self.__audio_cur = timestamp, duration
+        self._audio_cur = timestamp, duration
         self.audioPipeline.seek(1.0,
             gst.FORMAT_TIME,
             gst.SEEK_FLAG_FLUSH | gst.SEEK_FLAG_ACCURATE | gst.SEEK_FLAG_SEGMENT,
@@ -363,15 +363,15 @@ class RandomAccessAudioPreviewer(RandomAccessPreviewer):
             gst.SEEK_TYPE_SET, timestamp + duration)
         self.audioPipeline.set_state(gst.STATE_PLAYING)
 
-    def __finishWaveform(self):
+    def _finishWaveform(self):
         surface = cairo.ImageSurface(cairo.FORMAT_A8,
             int(self.twidth) + 2, self.theight)
         cr = cairo.Context(surface)
-        self.__plotWaveform(cr, self.audioSink.samples)
+        self._plotWaveform(cr, self.audioSink.samples)
         self.audioSink.reset()
-        gobject.idle_add(self._finishThumbnail, surface, self.__audio_cur)
+        gobject.idle_add(self._finishThumbnail, surface, self._audio_cur)
 
-    def __plotWaveform(self, cr, samples):
+    def _plotWaveform(self, cr, samples):
         hscale = 25
         if not samples:
             cr.move_to(0, hscale)
@@ -394,10 +394,10 @@ class RandomAccessAudioPreviewer(RandomAccessPreviewer):
         cr.set_source_rgba(0, 0, 0, 1.0)
         points = ((x * scale, hscale - (y * hscale)) for x, y in enumerate(samples))
 
-        self.__plot_points(cr, 0, hscale, points)
+        self._plot_points(cr, 0, hscale, points)
         cr.stroke()
 
-    def __plot_points(self, cr, x0, y0, points):
+    def _plot_points(self, cr, x0, y0, points):
         cr.move_to(x0, y0)
         for x, y in points:
             cr.line_to(x, y)
diff --git a/pitivi/ui/defaultpropertyeditor.py b/pitivi/ui/defaultpropertyeditor.py
index 59f240d..4040a75 100644
--- a/pitivi/ui/defaultpropertyeditor.py
+++ b/pitivi/ui/defaultpropertyeditor.py
@@ -87,10 +87,10 @@ class DefaultPropertyEditor(gtk.Viewport):
 
     def __init__(self, *args, **kwargs):
         gtk.Viewport.__init__(self, *args, **kwargs)
-        self.__properties = {}
-        self.__createUi()
+        self._properties = {}
+        self._createUi()
 
-    def __createUi(self):
+    def _createUi(self):
         self.text = gtk.Label()
         self.table = gtk.Table(rows=1, columns=2)
         self.table.attach(self.text, 0, 2, 0, 1)
@@ -112,12 +112,12 @@ class DefaultPropertyEditor(gtk.Viewport):
         properties = set(i.next().__editable_properties__)
         for obj in i:
             properties &= set(obj.__editable_properties__)
-        self.__addWidgets(properties)
+        self._addWidgets(properties)
 
-    def __addWidgets(self, props):
+    def _addWidgets(self, props):
         if not props:
             self.text.set_text(_("No properties..."))
-        for widget in self.__properties.values():
+        for widget in self._properties.values():
             self.table.remove(widget)
         self.table.resize(len(props) + 1, 2)
         y = 1
@@ -127,5 +127,5 @@ class DefaultPropertyEditor(gtk.Viewport):
             widget = make_property_widget(type)
             self.table.attach(label, 0, 1, y, y+1, xoptions=gtk.FILL, yoptions=gtk.FILL)
             self.table.attach(widget, 1, 2, y, y+1, yoptions=gtk.FILL)
-            self.__properties[name] = widget
+            self._properties[name] = widget
         self.show_all()
diff --git a/pitivi/ui/mainwindow.py b/pitivi/ui/mainwindow.py
index 882538b..823cc19 100644
--- a/pitivi/ui/mainwindow.py
+++ b/pitivi/ui/mainwindow.py
@@ -159,8 +159,8 @@ class PitiviMainWindow(gtk.Window, Loggable):
                 self._projectMissingPluginsCb)
 
         # if no webcams available, hide the webcam action
-        self.app.deviceprobe.connect("device-added", self.__deviceChangeCb)
-        self.app.deviceprobe.connect("device-removed", self.__deviceChangeCb)
+        self.app.deviceprobe.connect("device-added", self._deviceChangeCb)
+        self.app.deviceprobe.connect("device-removed", self._deviceChangeCb)
         if len(self.app.deviceprobe.getVideoSourceDevices()) < 1:
             self.webcam_button.set_sensitive(False)
 
@@ -356,16 +356,16 @@ class PitiviMainWindow(gtk.Window, Loggable):
 
 ## PlayGround callback
 
-    def __windowizeViewer(self, button, pane):
+    def _windowizeViewer(self, button, pane):
         # FIXME: the viewer can't seem to handle being unparented/reparented
         pane.remove(self.viewer)
         window = gtk.Window()
         window.add(self.viewer)
-        window.connect("destroy", self.__reparentViewer, pane)
+        window.connect("destroy", self._reparentViewer, pane)
         window.resize(200, 200)
         window.show_all()
 
-    def __reparentViewer(self, window, pane):
+    def _reparentViewer(self, window, pane):
         window.remove(self.viewer)
         pane.pack2(self.viewer, resize=False, shrink=False)
         self.viewer.show()
@@ -545,7 +545,7 @@ class PitiviMainWindow(gtk.Window, Loggable):
         ScreencastManagerDialog(self.app)
 
     ## Devices changed
-    def __deviceChangeCb(self, probe, unused_device):
+    def _deviceChangeCb(self, probe, unused_device):
         if len(probe.getVideoSourceDevices()) < 1:
             self.webcam_button.set_sensitive(False)
         else:
diff --git a/pitivi/ui/preview.py b/pitivi/ui/preview.py
index 687a70d..1b9330b 100644
--- a/pitivi/ui/preview.py
+++ b/pitivi/ui/preview.py
@@ -51,22 +51,22 @@ class Preview(goocanvas.ItemSimple, goocanvas.Item, Zoomable):
 
 ## properties
 
-    def __get_height(self):
-        return self.__height
-    def __set_height (self, value):
-        self.__height = value
+    def _get_height(self):
+        return self._height
+    def _set_height (self, value):
+        self._height = value
         self.changed(True)
-    height = gobject.property(__get_height, __set_height, type=float)
+    height = gobject.property(_get_height, _set_height, type=float)
 
 ## element callbacks
 
-    def __set_element(self):
+    def _set_element(self):
         self.previewer = previewer.get_preview_for_object(self.element)
-    element = receiver(setter=__set_element)
+    element = receiver(setter=_set_element)
 
     @handler(element, "in-point-changed")
     @handler(element, "media-duration-changed")
-    def __media_props_changed(self, obj, unused_start_duration):
+    def _media_props_changed(self, obj, unused_start_duration):
         self.changed(True)
 
 ## previewer callbacks
@@ -74,7 +74,7 @@ class Preview(goocanvas.ItemSimple, goocanvas.Item, Zoomable):
     previewer = receiver()
 
     @handler(previewer, "update")
-    def __update_preview(self, previewer, segment):
+    def _update_preview(self, previewer, segment):
         self.changed(False)
 
 ## Zoomable interface overries
diff --git a/pitivi/ui/projecttabs.py b/pitivi/ui/projecttabs.py
index 5c66a41..81130e5 100644
--- a/pitivi/ui/projecttabs.py
+++ b/pitivi/ui/projecttabs.py
@@ -42,7 +42,7 @@ class DetachLabel(gtk.HBox):
         image.set_from_stock(gtk.STOCK_LEAVE_FULLSCREEN,
             gtk.ICON_SIZE_SMALL_TOOLBAR)
         self.button.set_image(image)
-        self.button.connect("clicked", self.__windowize)
+        self.button.connect("clicked", self._windowize)
         self.pack_start(self.button, False, False)
         self.pack_start(self.label)
         self.show_all()
@@ -53,7 +53,7 @@ class DetachLabel(gtk.HBox):
     def deselect(self):
         self.button.set_sensitive(False)
 
-    def __windowize(self, unused_button):
+    def _windowize(self, unused_button):
         self.parent.windowizeComponent(self.child, self)
 
 class ProjectTabs(gtk.Notebook):
@@ -74,7 +74,7 @@ class ProjectTabs(gtk.Notebook):
         gtk.Notebook.__init__(self)
         self.app = instance
         self._full_list = []
-        self.connect("switch-page", self.__switchPage)
+        self.connect("switch-page", self._switchPage)
         self._createUi()
 
     def _createUi(self):
@@ -92,18 +92,18 @@ class ProjectTabs(gtk.Notebook):
         window = gtk.Window()
         window.add(component)
         window.show_all()
-        window.connect("destroy", self.__replaceComponent, component, label)
+        window.connect("destroy", self._replaceComponent, component, label)
         window.resize(200, 200)
         if not self.get_n_pages():
             self.hide()
 
-    def __replaceComponent(self, window, component, label):
+    def _replaceComponent(self, window, component, label):
         window.remove(component)
         self.set_current_page(self.insert_page(component, label,
             self._full_list.index(component)))
         self.show()
 
-    def __switchPage(self, unused_widget, unused_page, num):
+    def _switchPage(self, unused_widget, unused_page, num):
         for child in (self.get_nth_page(i) for i in xrange(self.get_n_pages())):
             self.get_tab_label(child).deselect()
         cur = self.get_tab_label(self.get_nth_page(num))
diff --git a/pitivi/ui/propertyeditor.py b/pitivi/ui/propertyeditor.py
index 9adeca1..e35e73a 100644
--- a/pitivi/ui/propertyeditor.py
+++ b/pitivi/ui/propertyeditor.py
@@ -39,21 +39,21 @@ class PropertyEditor(gtk.ScrolledWindow):
         gtk.ScrolledWindow.__init__(self, *args, **kwargs)
         self.instance = instance
         self.timeline = instance.current.timeline
-        self.__createUi()
-        self.__selectionChangedCb(self.timeline)
-        self.__module_instances = {}
-        self.__default_editor = DefaultPropertyEditor()
+        self._createUi()
+        self._selectionChangedCb(self.timeline)
+        self._module_instances = {}
+        self._default_editor = DefaultPropertyEditor()
 
-    def __createUi(self):
+    def _createUi(self):
         # basic initialization
         self.set_border_width(5)
 
         # scrolled window
         self.set_shadow_type(gtk.SHADOW_ETCHED_IN)
-        self.__no_objs = gtk.Viewport()
-        self.__no_objs.add(gtk.Label(_("No Objects Selected")))
-        self.__contents = self.__no_objs
-        self.add(self.__no_objs)
+        self._no_objs = gtk.Viewport()
+        self._no_objs.add(gtk.Label(_("No Objects Selected")))
+        self._contents = self._no_objs
+        self.add(self._no_objs)
 
 ## Public API
 
@@ -67,19 +67,19 @@ class PropertyEditor(gtk.ScrolledWindow):
 
 ## Internal Methods
 
-    def __get_widget_for_type(self, t):
-        w = self.__default_editor
-        if t in self.__module_instances:
-            w = self.__module_instances[t]
+    def _get_widget_for_type(self, t):
+        w = self._default_editor
+        if t in self._module_instances:
+            w = self._module_instances[t]
         elif t in self.__MODULES__:
-            w = self.__MODULES[t]()
-            self.__module_instances[t] = w
+            w = self.__MODULES__[t]()
+            self._module_instances[t] = w
         return w
 
-    def __set_contents(self, widget):
-        if widget != self.__contents:
-            self.remove(self.__contents)
-            self.__contents = widget
+    def _set_contents(self, widget):
+        if widget != self._contents:
+            self.remove(self._contents)
+            self._contents = widget
             self.add(widget)
             self.show_all()
 
@@ -88,11 +88,11 @@ class PropertyEditor(gtk.ScrolledWindow):
     instance = receiver()
 
     @handler(instance, "new-project-loading")
-    def __newProjectLoading(self, unused_inst, project):
+    def _newProjectLoading(self, unused_inst, project):
         self.timeline = project.timeline
 
     @handler(instance, "new-project-failed")
-    def __newProjectFailed(self, unused_inst, unused_reason, unused_uri):
+    def _newProjectFailed(self, unused_inst, unused_reason, unused_uri):
         self.timeline = None
 
 ## Timeline Callbacks
@@ -100,17 +100,17 @@ class PropertyEditor(gtk.ScrolledWindow):
     timeline = receiver()
 
     @handler(timeline, "selection-changed")
-    def __selectionChangedCb(self, timeline):
+    def _selectionChangedCb(self, timeline):
         if not self.timeline:
             return
         objs = self.timeline.getSelection()
         if objs:
             t = same((type(obj.factory) for obj in objs))
             if t:
-                widget = self.__get_widget_for_type(t)
+                widget = self._get_widget_for_type(t)
             else:
                 widget = DefaultPropertyEditor(objs)
             widget.setObjects(objs)
         else:
-            widget = self.__no_objs
-        self.__set_contents(widget)
+            widget = self._no_objs
+        self._set_contents(widget)
diff --git a/pitivi/ui/timeline.py b/pitivi/ui/timeline.py
index 2508516..1152ba2 100644
--- a/pitivi/ui/timeline.py
+++ b/pitivi/ui/timeline.py
@@ -104,10 +104,10 @@ class Timeline(gtk.VBox, Loggable, Zoomable):
         self.project = None
         self.timeline = None
         self.ui_manager = ui_manager
-        self.__temp_objects = None
-        self.__factories = None
-        self.__finish_drag = False
-        self.__position = 0
+        self._temp_objects = None
+        self._factories = None
+        self._finish_drag = False
+        self._position = 0
 
         self._createUI()
 
@@ -120,11 +120,11 @@ class Timeline(gtk.VBox, Loggable, Zoomable):
         self.pack_start(self.ruler, expand=False, fill=True)
 
         # List of TimelineCanvas
-        self.__canvas = TimelineCanvas(self.timeline)
+        self._canvas = TimelineCanvas(self.timeline)
 
         self.scrolledWindow = gtk.ScrolledWindow(self.hadj)
         self.scrolledWindow.set_policy(gtk.POLICY_ALWAYS, gtk.POLICY_AUTOMATIC)
-        self.scrolledWindow.add(self.__canvas)
+        self.scrolledWindow.add(self._canvas)
         #FIXME: remove padding between scrollbar and scrolled window
         self.pack_start(self.scrolledWindow, expand=True)
 
@@ -167,31 +167,31 @@ class Timeline(gtk.VBox, Loggable, Zoomable):
 ## Drag and Drop callbacks
 
     def _dragMotionCb(self, unused, context, x, y, timestamp):
-        if not self.__factories:
+        if not self._factories:
             atom = gtk.gdk.atom_intern(dnd.FILESOURCE_TUPLE[0])
             self.drag_get_data(context, atom, timestamp)
             self.drag_highlight()
         else:
-            if not self.__temp_objects:
-                self.__add_temp_source()
-            self.__move_temp_source(x, y)
+            if not self._temp_objects:
+                self._add_temp_source()
+            self._move_temp_source(x, y)
         return True
 
     def _dragLeaveCb(self, unused_layout, unused_context, unused_tstamp):
-        if self.__temp_objects:
+        if self._temp_objects:
             try:
-                for obj in self.__temp_objects:
+                for obj in self._temp_objects:
                     self.timeline.removeTimelineObject(obj, deep=True)
             finally:
-                self.__temp_objects = None
+                self._temp_objects = None
         self.drag_unhighlight()
 
     def _dragDropCb(self, widget, context, x, y, timestamp):
-        self.__add_temp_source()
-        self.__move_temp_source(x, y)
+        self._add_temp_source()
+        self._move_temp_source(x, y)
         context.drop_finish(True, timestamp)
-        self.__factories = None
-        self.__temp_objects = None
+        self._factories = None
+        self._temp_objects = None
         return True
 
     def _dragDataReceivedCb(self, unused_layout, context, x, y,
@@ -209,26 +209,26 @@ class Timeline(gtk.VBox, Loggable, Zoomable):
             uris = selection.data.split("\n")
         else:
             context.finish(False, False, timestamp)
-        self.__factories = [self.project.sources[uri] for uri in uris]
+        self._factories = [self.project.sources[uri] for uri in uris]
         context.drag_status(gtk.gdk.ACTION_COPY, timestamp)
         return True
 
-    def __add_temp_source(self):
-        self.__temp_objects = [self.timeline.addSourceFactory(factory)
-            for factory in self.__factories]
+    def _add_temp_source(self):
+        self._temp_objects = [self.timeline.addSourceFactory(factory)
+            for factory in self._factories]
 
-    def __move_temp_source(self, x, y):
-        x, y = self.__canvas.convert_from_pixels(x - 10, y)
+    def _move_temp_source(self, x, y):
+        x, y = self._canvas.convert_from_pixels(x - 10, y)
         delta = Zoomable.pixelToNs(x)
-        for obj in self.__temp_objects:
+        for obj in self._temp_objects:
             obj.setStart(max(0, delta), snap=True)
             delta += obj.duration
 
     def setProject(self, project):
         self.project = project
         self.timeline = project.timeline
-        self.__canvas.timeline = self.timeline
-        self.__canvas.zoomChanged()
+        self._canvas.timeline = self.timeline
+        self._canvas.zoomChanged()
 
 ## Zooming and Scrolling
 
@@ -238,13 +238,13 @@ class Timeline(gtk.VBox, Loggable, Zoomable):
         gobject.idle_add(self.scrollToPlayhead)
 
     def timelinePositionChanged(self, position):
-        self.__position = position
+        self._position = position
         self.ruler.timelinePositionChanged(position)
         self.scrollToPlayhead()
 
     def scrollToPlayhead(self):
         width = self.get_allocation().width
-        new_pos = Zoomable.nsToPixel(self.__position)
+        new_pos = Zoomable.nsToPixel(self._position)
         scroll_pos = self.hadj.get_value()
         if (new_pos < scroll_pos) or (new_pos > scroll_pos + width):
             self.scrollToPosition(new_pos - width / 2)
@@ -254,11 +254,11 @@ class Timeline(gtk.VBox, Loggable, Zoomable):
         if position > self.hadj.upper:
             # we can't perform the scroll because the canvas needs to be
             # updated
-            gobject.idle_add(self.__scrollToPosition, position)
+            gobject.idle_add(self._scrollToPosition, position)
         else:
-            self.__scrollToPosition(position)
+            self._scrollToPosition(position)
 
-    def __scrollToPosition(self, position):
+    def _scrollToPosition(self, position):
         self.hadj.set_value(position)
         return False
 
@@ -270,7 +270,7 @@ class Timeline(gtk.VBox, Loggable, Zoomable):
     @handler(timeline, "duration-changed")
     def _timelineStartDurationChanged(self, unused_timeline, duration):
         self.ruler.setMaxDuration(duration)
-        self.__canvas.setMaxDuration(duration)
+        self._canvas.setMaxDuration(duration)
         self.ruler.setShadedDuration(duration)
 
 ## ToolBar callbacks
@@ -319,6 +319,6 @@ class Timeline(gtk.VBox, Loggable, Zoomable):
 
     def toggleRazor(self, action):
         if action.props.active:
-            self.__canvas.activateRazor(action)
+            self._canvas.activateRazor(action)
         else:
-            self.__canvas.deactivateRazor()
+            self._canvas.deactivateRazor()
diff --git a/pitivi/ui/timelinecanvas.py b/pitivi/ui/timelinecanvas.py
index 92982db..b42894d 100644
--- a/pitivi/ui/timelinecanvas.py
+++ b/pitivi/ui/timelinecanvas.py
@@ -38,13 +38,13 @@ DEADBAND = 5
 
 class TimelineCanvas(goocanvas.Canvas, Zoomable):
 
-    __tracks = None
+    _tracks = None
 
     def __init__(self, timeline):
         goocanvas.Canvas.__init__(self)
         Zoomable.__init__(self)
         self._selected_sources = []
-        self.__tracks = []
+        self._tracks = []
 
         self._block_size_request = False
         self.props.integer_layout = True
@@ -58,20 +58,20 @@ class TimelineCanvas(goocanvas.Canvas, Zoomable):
         root = self.get_root_item()
         self.tracks = goocanvas.Group()
         root.add_child(self.tracks)
-        self.__marquee = goocanvas.Rect(
+        self._marquee = goocanvas.Rect(
             stroke_color_rgba=0x33CCFF66,
             fill_color_rgba=0x33CCFF66,
             visibility = goocanvas.ITEM_INVISIBLE)
-        self.__razor = goocanvas.Rect(
+        self._razor = goocanvas.Rect(
             line_width=0,
             fill_color="orange",
             width=1,
             visibility=goocanvas.ITEM_INVISIBLE)
-        root.add_child(self.__marquee)
-        root.add_child(self.__razor)
-        root.connect("motion-notify-event", self.__selectionDrag)
-        root.connect("button-press-event", self.__selectionStart)
-        root.connect("button-release-event", self.__selectionEnd)
+        root.add_child(self._marquee)
+        root.add_child(self._razor)
+        root.connect("motion-notify-event", self._selectionDrag)
+        root.connect("button-press-event", self._selectionStart)
+        root.connect("button-release-event", self._selectionEnd)
 
     def from_event(self, event):
         return Point(*self.convert_from_pixels(event.x, event.y))
@@ -84,11 +84,11 @@ class TimelineCanvas(goocanvas.Canvas, Zoomable):
 
 ## implements selection marquee
 
-    __selecting = False
-    __mousedown = None
-    __marquee = None
+    _selecting = False
+    _mousedown = None
+    _marquee = None
 
-    def __normalize(self, p1, p2):
+    def _normalize(self, p1, p2):
         w, h = p2 - p1
         x, y = p1
         if w < 0:
@@ -100,40 +100,40 @@ class TimelineCanvas(goocanvas.Canvas, Zoomable):
         return (x, y), (w, h)
 
 
-    def __selectionDrag(self, item, target, event):
-        if self.__selecting:
+    def _selectionDrag(self, item, target, event):
+        if self._selecting:
             cur = self.from_event(event)
-            pos, size = self.__normalize(self.__mousedown, cur)
-            m = self.__marquee
+            pos, size = self._normalize(self._mousedown, cur)
+            m = self._marquee
             m.props.x, m.props.y = pos
             m.props.width, m.props.height = size
             return True
         return False
 
-    def __selectionStart(self, item, target, event):
-        self.__selecting = True
-        self.__marquee.props.visibility = goocanvas.ITEM_VISIBLE
-        self.__mousedown = self.from_event(event)
-        self.__marquee.props.width = 0
-        self.__marquee.props.height = 0
+    def _selectionStart(self, item, target, event):
+        self._selecting = True
+        self._marquee.props.visibility = goocanvas.ITEM_VISIBLE
+        self._mousedown = self.from_event(event)
+        self._marquee.props.width = 0
+        self._marquee.props.height = 0
         self.pointer_grab(self.get_root_item(), gtk.gdk.POINTER_MOTION_MASK |
             gtk.gdk.BUTTON_RELEASE_MASK, self._cursor, event.time)
         return True
 
-    def __selectionEnd(self, item, target, event):
+    def _selectionEnd(self, item, target, event):
         self.pointer_ungrab(self.get_root_item(), event.time)
-        self.__selecting = False
-        self.__marquee.props.visibility = goocanvas.ITEM_INVISIBLE
+        self._selecting = False
+        self._marquee.props.visibility = goocanvas.ITEM_INVISIBLE
         mode = 0
         if event.get_state() & gtk.gdk.SHIFT_MASK:
             mode = 1
         if event.get_state() & gtk.gdk.CONTROL_MASK:
             mode = 2
-        self.timeline.setSelectionTo(self.__objectsUnderMarquee(), mode)
+        self.timeline.setSelectionTo(self._objectsUnderMarquee(), mode)
         return True
 
-    def __objectsUnderMarquee(self):
-        items = self.get_items_in_area(self.__marquee.get_bounds(), True, True,
+    def _objectsUnderMarquee(self):
+        items = self.get_items_in_area(self._marquee.get_bounds(), True, True,
             True)
         if items:
             return set((item.element for item in items if isinstance(item,
@@ -143,29 +143,29 @@ class TimelineCanvas(goocanvas.Canvas, Zoomable):
 ## Razor Tool Implementation
 
     def activateRazor(self, action):
-        self.__razor_sigid = self.connect("button_press_event",
-            self.__razorClickedCb)
-        self.__razor_release_sigid = self.connect("button_release_event",
-            self.__razorReleasedCb)
-        self.__razor_motion_sigid = self.connect("motion_notify_event",
-            self.__razorMovedCb)
-        self.__razor.props.visibility = goocanvas.ITEM_VISIBLE
-        self.__action = action
+        self._razor_sigid = self.connect("button_press_event",
+            self._razorClickedCb)
+        self._razor_release_sigid = self.connect("button_release_event",
+            self._razorReleasedCb)
+        self._razor_motion_sigid = self.connect("motion_notify_event",
+            self._razorMovedCb)
+        self._razor.props.visibility = goocanvas.ITEM_VISIBLE
+        self._action = action
         return True
 
     def deactivateRazor(self):
-        self.disconnect(self.__razor_sigid)
-        self.disconnect(self.__razor_motion_sigid)
-        self.disconnect(self.__razor_release_sigid)
-        self.__razor.props.visibility = goocanvas.ITEM_INVISIBLE
+        self.disconnect(self._razor_sigid)
+        self.disconnect(self._razor_motion_sigid)
+        self.disconnect(self._razor_release_sigid)
+        self._razor.props.visibility = goocanvas.ITEM_INVISIBLE
 
-    def __razorMovedCb(self, canvas, event):
+    def _razorMovedCb(self, canvas, event):
         x, y = self.convert_from_pixels(event.x, event.y)
-        self.__razor.props.x = self.nsToPixel(self.pixelToNs(x))
+        self._razor.props.x = self.nsToPixel(self.pixelToNs(x))
         return True
 
-    def __razorReleasedCb(self, unused_canvas, event):
-        self.__action.props.active = False
+    def _razorReleasedCb(self, unused_canvas, event):
+        self._action.props.active = False
 
         x, y = self.convert_from_pixels(event.x, event.y)
         bounds = goocanvas.Bounds(x, y, x, y)
@@ -177,7 +177,7 @@ class TimelineCanvas(goocanvas.Canvas, Zoomable):
 
         return True
 
-    def __razorClickedCb(self, unused_canvas, unused_event):
+    def _razorClickedCb(self, unused_canvas, unused_event):
         return True
 
     max_duration = 0
@@ -188,9 +188,9 @@ class TimelineCanvas(goocanvas.Canvas, Zoomable):
 
     def _request_size(self):
         w = Zoomable.nsToPixel(self.max_duration)
-        h = 60 * len(self.__tracks)
+        h = 60 * len(self._tracks)
         self.set_bounds(0, 0, w, h)
-        self.__razor.props.height = h
+        self._razor.props.height = h
         self.get_root_item().changed(True)
 
 ## Zoomable Override
@@ -202,32 +202,32 @@ class TimelineCanvas(goocanvas.Canvas, Zoomable):
 
 ## Timeline callbacks
 
-    def __set_timeline(self):
-        while self.__tracks:
+    def _set_timeline(self):
+        while self._tracks:
             self._trackRemoved(None, 0)
         if self.timeline:
             for track in self.timeline.tracks:
                 self._trackAdded(None, track)
 
-    timeline = receiver(__set_timeline)
+    timeline = receiver(_set_timeline)
 
     @handler(timeline, "track-added")
     def _trackAdded(self, timeline, track):
         track = Track(track, self.timeline)
-        self.__tracks.append(track)
+        self._tracks.append(track)
         track.set_canvas(self)
         self.tracks.add_child(track)
         self._regroup_tracks()
 
     @handler(timeline, "track-removed")
     def _trackRemoved(self, unused_timeline, position):
-        track = self.__tracks[position]
-        del self.__tracks[position]
+        track = self._tracks[position]
+        del self._tracks[position]
         track.remove()
         self._regroup_tracks()
 
     def _regroup_tracks(self):
-        for i, track in enumerate(self.__tracks):
+        for i, track in enumerate(self._tracks):
             # FIXME: hard-coding track height, because this won't be updated
             # later
             height = 50
diff --git a/pitivi/ui/webcam_managerdialog.py b/pitivi/ui/webcam_managerdialog.py
index 46493ab..697ef02 100644
--- a/pitivi/ui/webcam_managerdialog.py
+++ b/pitivi/ui/webcam_managerdialog.py
@@ -69,13 +69,13 @@ class WebcamManagerDialog(GladeWindow):
         self._adevcombo.set_model(gtk.ListStore(str, object))
         self._adevcombo.set_attributes(self._adevcombo.child.get_cell_renderers()[0],
                                        text=0)
-        self.__updateVideoCombo()
-        self.__updateAudioCombo()
+        self._updateVideoCombo()
+        self._updateAudioCombo()
 
         self.filepath = None
 
         self.sink = SinkBin()
-        CallbackThread(self.__setupPlayer).start()
+        CallbackThread(self._setupPlayer).start()
 
     def show_all(self):
         self.window.show_all()
@@ -133,7 +133,7 @@ class WebcamManagerDialog(GladeWindow):
             except:
                 gst.warning("Couldn't set the XID on our video sink !")
 
-    def __setupPlayer(self):
+    def _setupPlayer(self):
         gst.debug("Creating initial SmartCaptureBin")
         # figure out adev
         probe = self.pitivi.deviceprobe
@@ -141,16 +141,16 @@ class WebcamManagerDialog(GladeWindow):
             adev = probe.getAudioSourceDevices()[0]
         else:
             adev = None
-        self.__changeSelectedAudio(adev)
+        self._changeSelectedAudio(adev)
 
         if len(probe.getVideoSourceDevices()):
             vdev = probe.getVideoSourceDevices()[0]
         else:
             vdev = None
-        self.__changeSelectedVideo(vdev)
+        self._changeSelectedVideo(vdev)
 
-        probe.connect("device-added", self.__deviceAddedCb)
-        probe.connect("device-removed", self.__deviceRemovedCb)
+        probe.connect("device-added", self._deviceAddedCb)
+        probe.connect("device-removed", self._deviceRemovedCb)
 
         if hasattr(self, "player"):
             self.player.set_state(gst.STATE_NULL)
@@ -160,7 +160,7 @@ class WebcamManagerDialog(GladeWindow):
         # FIXME : check for state change failures
         self.player.set_state(gst.STATE_PLAYING)
 
-    def __resetPlayer(self):
+    def _resetPlayer(self):
         ## call me in another thread !
         gst.debug("Setting previous to NULL")
         self.player.set_state(gst.STATE_NULL)
@@ -173,7 +173,7 @@ class WebcamManagerDialog(GladeWindow):
         res = self.player.set_state(gst.STATE_PLAYING)
         gst.debug("... which returned %r" % res)
 
-    def __changeSelectedCombo(self, combo, device):
+    def _changeSelectedCombo(self, combo, device):
         gst.debug("device %r" % device)
         model = combo.get_model()
         idx = 0
@@ -183,37 +183,37 @@ class WebcamManagerDialog(GladeWindow):
             idx += 1
         combo.set_active(idx)
 
-    def __changeSelectedAudio(self, device):
+    def _changeSelectedAudio(self, device):
         self._audiodev = device
-        self.__changeSelectedCombo(self._adevcombo, device)
+        self._changeSelectedCombo(self._adevcombo, device)
 
-    def __changeSelectedVideo(self, device):
+    def _changeSelectedVideo(self, device):
         self._videodev = device
-        self.__changeSelectedCombo(self._vdevcombo, device)
+        self._changeSelectedCombo(self._vdevcombo, device)
 
-    def __deviceAddedCb(self, probe, device):
+    def _deviceAddedCb(self, probe, device):
         gst.debug("device %r appeared" % device)
-        self.__updateAudioCombo()
-        self.__updateVideoCombo()
+        self._updateAudioCombo()
+        self._updateVideoCombo()
 
-    def __deviceRemovedCb(self, probe, device):
+    def _deviceRemovedCb(self, probe, device):
         gst.debug("device %r went away" % device)
         if self._audiodev == device:
             devs = self.pitivi.deviceprobe.getAudioSourceDevices()
             if len(devs):
-                self.__changeSelectedAudio(devs[0])
+                self._changeSelectedAudio(devs[0])
             else:
                 self._audiodev = None
         elif self._videodev == device:
             devs = self.pitivi.deviceprobe.getVideoSourceDevices()
             if len(devs):
-                self.__changeSelectedVideo(devs[0])
+                self._changeSelectedVideo(devs[0])
             else:
                 self._videodev = None
-        self.__updateAudioCombo()
-        self.__updateVideoCombo()
+        self._updateAudioCombo()
+        self._updateVideoCombo()
 
-    def __updateCombo(self, combo, devices):
+    def _updateCombo(self, combo, devices):
         model = combo.get_model()
         if len(devices) == len(model):
             # nothing changed
@@ -222,15 +222,15 @@ class WebcamManagerDialog(GladeWindow):
         for dev in devices:
             model.append([dev.displayname, dev])
 
-    def __updateAudioCombo(self):
-        self.__updateCombo(self._adevcombo,
+    def _updateAudioCombo(self):
+        self._updateCombo(self._adevcombo,
                            self.pitivi.deviceprobe.getAudioSourceDevices())
-        self.__changeSelectedAudio(self._audiodev)
+        self._changeSelectedAudio(self._audiodev)
 
-    def __updateVideoCombo(self):
-        self.__updateCombo(self._vdevcombo,
+    def _updateVideoCombo(self):
+        self._updateCombo(self._vdevcombo,
                            self.pitivi.deviceprobe.getVideoSourceDevices())
-        self.__changeSelectedVideo(self._videodev)
+        self._changeSelectedVideo(self._videodev)
 
     def _adevComboChangedCb(self, widget):
         # get the active device
@@ -241,10 +241,10 @@ class WebcamManagerDialog(GladeWindow):
         gst.debug("device %r" % dev)
         if dev == self._audiodev:
             return
-        self.__changeSelectedAudio(dev)
+        self._changeSelectedAudio(dev)
         if not hasattr(self, "player"):
             return
-        CallbackThread(self.__resetPlayer).start()
+        CallbackThread(self._resetPlayer).start()
 
     def _vdevComboChangedCb(self, widget):
         row = widget.get_model()[widget.get_active()]
@@ -254,7 +254,7 @@ class WebcamManagerDialog(GladeWindow):
         gst.debug("device %r" % dev)
         if dev == self._videodev:
             return
-        self.__changeSelectedVideo(dev)
+        self._changeSelectedVideo(dev)
         if not hasattr(self, "player"):
             return
-        CallbackThread(self.__resetPlayer).start()
+        CallbackThread(self._resetPlayer).start()
diff --git a/pitivi/ui/zoominterface.py b/pitivi/ui/zoominterface.py
index e3e6713..521f1e3 100644
--- a/pitivi/ui/zoominterface.py
+++ b/pitivi/ui/zoominterface.py
@@ -51,9 +51,9 @@ class Zoomable(object):
 
     zoomratio = 10
     sigid = None
-    __instances = []
+    _instances = []
     zoom_levels = range(1, 150, 10)
-    __cur_zoom = 2
+    _cur_zoom = 2
 
 
     def __init__(self):
@@ -61,32 +61,32 @@ class Zoomable(object):
         Zoomable.addInstance(self)
 
     def __del__(self):
-        if self in Zoomable.__instances:
+        if self in Zoomable._instances:
             # FIXME: ideally we should deprecate this and spit a warning here
-            self.__instances.remove(self)
+            self._instances.remove(self)
 
     @classmethod
     def addInstance(cls, instance):
-        cls.__instances.append(instance)
+        cls._instances.append(instance)
 
     @classmethod
     def removeInstance(cls, instance):
-        cls.__instances.remove(instance)
+        cls._instances.remove(instance)
 
     @classmethod
     def setZoomRatio(cls, ratio):
         cls.zoomratio = ratio
-        cls.__zoomChanged()
+        cls._zoomChanged()
 
     @classmethod
     def zoomIn(cls):
-        cls.__cur_zoom = min(len(cls.zoom_levels) - 1, cls.__cur_zoom + 1)
-        cls.setZoomRatio(cls._computeZoomRatio(cls.__cur_zoom))
+        cls._cur_zoom = min(len(cls.zoom_levels) - 1, cls._cur_zoom + 1)
+        cls.setZoomRatio(cls._computeZoomRatio(cls._cur_zoom))
 
     @classmethod
     def zoomOut(cls):
-        cls.__cur_zoom = max(0, cls.__cur_zoom - 1)
-        cls.setZoomRatio(cls._computeZoomRatio(cls.__cur_zoom))
+        cls._cur_zoom = max(0, cls._cur_zoom - 1)
+        cls.setZoomRatio(cls._computeZoomRatio(cls._cur_zoom))
 
     @classmethod
     def _computeZoomRatio(cls, index):
@@ -110,8 +110,8 @@ class Zoomable(object):
         return int((float(duration) / gst.SECOND) * cls.zoomratio)
 
     @classmethod
-    def __zoomChanged(cls):
-        for inst in cls.__instances:
+    def _zoomChanged(cls):
+        for inst in cls._instances:
             inst.zoomChanged()
 
     def zoomChanged(self):



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]