Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/TamTamEdit.activity/Edit/rm/PositionIndicator.py
diff options
context:
space:
mode:
authorNat <natcl@hotmail.com>2007-09-13 15:55:52 (GMT)
committer Nat <natcl@hotmail.com>2007-09-13 15:55:52 (GMT)
commite12dbff4dda5aafbaac98f75f0467ef00dc06c32 (patch)
tree52f74f5a699ca1a2827b333e76a7225b7d768256 /TamTamEdit.activity/Edit/rm/PositionIndicator.py
parentb94ccdfd2329ed2d1128a4392e2f67b1e6b704da (diff)
Activity split
Diffstat (limited to 'TamTamEdit.activity/Edit/rm/PositionIndicator.py')
-rw-r--r--TamTamEdit.activity/Edit/rm/PositionIndicator.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/TamTamEdit.activity/Edit/rm/PositionIndicator.py b/TamTamEdit.activity/Edit/rm/PositionIndicator.py
new file mode 100644
index 0000000..aadc4f4
--- /dev/null
+++ b/TamTamEdit.activity/Edit/rm/PositionIndicator.py
@@ -0,0 +1,47 @@
+import pygtk
+pygtk.require( '2.0' )
+import gtk
+
+#----------------------------------------------------------------------
+# A verical bar used to show the current point in time on a page
+# TODO: modify this class to change the current point in time
+# on click and drag
+#----------------------------------------------------------------------
+class PositionIndicator( gtk.DrawingArea ):
+ #-----------------------------------
+ # initialization
+ #-----------------------------------
+ def __init__( self, trackIDs, selectedTrackIDs, mutedTrackIDs ):
+ gtk.DrawingArea.__init__( self )
+
+ self.trackIDs = trackIDs
+ self.selectedTrackIDs = selectedTrackIDs
+ self.mutedTrackIDs = mutedTrackIDs
+
+ self.connect( "expose-event", self.draw )
+
+ def draw( self, drawingArea, event ):
+ indicatorSize = self.get_allocation()
+ trackHeight = indicatorSize.height / len( self.trackIDs )
+
+ context = drawingArea.window.cairo_create()
+
+ trackIndex = 0
+ for trackID in self.trackIDs:
+ height = trackIndex * trackHeight
+
+ context.move_to( 0, height )
+ context.rel_line_to( indicatorSize.width, 0 )
+ context.rel_line_to( 0, height + trackHeight )
+ context.rel_line_to( -indicatorSize.width, 0 )
+ context.close_path()
+
+ if trackID not in self.mutedTrackIDs:
+ context.set_source_rgb( 0, 0, 0 ) #black
+ else:
+ context.set_source_rgb( 0.6, 0.6, 0.6 ) #grey
+
+ context.fill_preserve()
+ context.stroke()
+
+ trackIndex += 1 \ No newline at end of file