2
2
<!doctype html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
3
3
<html><head><title>Python: module TimeLine</title>
4
</head><body bgcolor="#f0f0f8">
4
</head><body bgcolor="#ffffff">
6
6
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
8
8
<td valign=bottom> <br>
9
9
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong>TimeLine</strong></big></big></font></td
10
10
><td align=right valign=bottom
11
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/mike/src/jokosher/trunk/Jokosher/TimeLine.py">/home/mike/src/jokosher/trunk/Jokosher/TimeLine.py</a></font></td></tr></table>
11
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/david/Projects/Jokosher/trunk/Jokosher/TimeLine.py">/home/david/Projects/Jokosher/trunk/Jokosher/TimeLine.py</a></font></td></tr></table>
12
<p><tt># THIS FILE IS PART OF THE JOKOSHER PROJECT AND LICENSED UNDER THE GPL. SEE<br>
13
# THE 'COPYING' FILE FOR DETAILS<br>
15
# <a href="#TimeLine">TimeLine</a>.py<br>
16
# <br>
17
# This class handles the drawing of the timeline display.<br>
19
#-------------------------------------------------------------------------------</tt></p>
14
21
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
15
<tr bgcolor="#aa55cc">
22
<tr bgcolor="#4e9a06">
16
23
<td colspan=3 valign=bottom> <br>
17
24
<font color="#fffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
19
<tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td>
20
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="gobject.html">gobject</a><br>
21
</td><td width="25%" valign=top><a href="gst.html">gst</a><br>
22
</td><td width="25%" valign=top><a href="gtk.html">gtk</a><br>
26
<tr><td bgcolor="#4e9a06"><tt> </tt></td><td> </td>
27
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="gtk.html">gtk</a><br>
23
28
</td><td width="25%" valign=top><a href="pango.html">pango</a><br>
24
</td></tr></table></td></tr></table><p>
29
</td><td width="25%" valign=top></td><td width="25%" valign=top></td></tr></table></td></tr></table><p>
25
30
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
26
<tr bgcolor="#ee77aa">
31
<tr bgcolor="#3465a4">
27
32
<td colspan=3 valign=bottom> <br>
28
33
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
30
<tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td>
35
<tr><td bgcolor="#3465a4"><tt> </tt></td><td> </td>
31
36
<td width="100%"><dl>
32
37
<dt><font face="helvetica, arial">gobject.DrawingArea(gobject.Widget)
40
45
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
41
<tr bgcolor="#ffc8d8">
46
<tr bgcolor="#729fcf">
42
47
<td colspan=3 valign=bottom> <br>
43
48
<font color="#000000" face="helvetica, arial"><a name="TimeLine">class <strong>TimeLine</strong></a>(gobject.DrawingArea)</font></td></tr>
45
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
50
<tr bgcolor="#729fcf"><td rowspan=2><tt> </tt></td>
46
51
<td colspan=2><tt>This class handles drawing the time line display. The time line is part of the<br>
47
52
TimeLineBar. <a href="#TimeLine">TimeLine</a> displays the time in minutes/seconds (MODE_HOURS_MINS_SECS)<br>
48
53
or bars and beats (MODE_BARS_BEATS). These modes are set in project.transport.<br>
54
<br>
50
55
To improve performance, the line isn't being constructed on each call of OnDraw. It<br>
51
56
is saved into self.<strong>savedLine</strong> as a gtk.gdk.Image. A new savedLine is constructed when<br>
52
- there is no savedLine<br>
53
- or project.transport.RedrawTimeLine is True<br>
54
- or project.RedrawTimeLine is True<br>
57
- there is no savedLine<br>
58
- or project.transport.RedrawTimeLine is True<br>
59
- or project.RedrawTimeLine is True<br>
60
<br>
56
61
When the time line is constructed in MODE_HOURS_MINS_SECS, it dynamically adjusts<br>
57
62
its scale to the project.viewScale. MODE_BARS_BEATS does not support this (yet).<br> </tt></td></tr>
58
63
<tr><td> </td>
70
75
Methods defined here:<br>
71
<dl><dt><a name="TimeLine-DrawLine"><strong>DrawLine</strong></a>(self, widget)</dt><dd><tt> Draws the timeline and saves it to memory<br>
72
- Must be called initially and to redraw the timeline<br>
73
after moving the project start</tt></dd></dl>
76
<dl><dt><a name="TimeLine-DrawLine"><strong>DrawLine</strong></a>(self, widget)</dt><dd><tt>Draws the timeline and saves it to memory<br>
77
Must be called initially and to redraw the timeline<br>
78
after moving the project start.<br>
81
widget -- reserved for GTK callbacks, don't use it explicitly.</tt></dd></dl>
75
<dl><dt><a name="TimeLine-GetZoomFactor"><strong>GetZoomFactor</strong></a>(self, viewScale)</dt><dd><tt>To be used for drawing the MODE_HOURS_MINS_SECS timeline<br>
83
<dl><dt><a name="TimeLine-GetZoomFactor"><strong>GetZoomFactor</strong></a>(self, viewScale)</dt><dd><tt>To be used for drawing the MODE_HOURS_MINS_SECS timeline.<br>
86
viewScale -- the view scale in pixels per second.<br>
78
89
- an integer factor to be multiplied with the viewScale to zoom the timeline in/out<br>
79
90
- a boolean indicating if milliseconds should be displayed<br>
80
The default factor is 1000, meaning that the distance between the short lines of the timeline<br>
81
symbolizes 1000 milliseconds. The code will increase of decrease this factor to keep the<br>
82
timeline readable. The factors can be set with the zoomLevels array. This array<br>
83
contains zoom levels that support precision from 20 ms to 1 minute. More extreme zoom<br>
84
levels could be added, but will never be reached because the viewScale is limited.</tt></dd></dl>
91
The default factor is 1000, meaning that the distance between the short lines of the timeline<br>
92
symbolizes 1000 milliseconds. The code will increase of decrease this factor to keep the<br>
93
timeline readable. The factors can be set with the zoomLevels array. This array<br>
94
contains zoom levels that support precision from 20 ms to 1 minute. More extreme zoom<br>
95
levels could be added, but will never be reached because the viewScale is limited.</tt></dd></dl>
86
97
<dl><dt><a name="TimeLine-OnAllocate"><strong>OnAllocate</strong></a>(self, widget, allocation)</dt><dd><tt>From:<br>
87
98
<a href="http://www.moeraki.com/pygtkreference/pygtk2reference/class-gtkwidget.html#signal-gtkwidget--size-allocate">http://www.moeraki.com/pygtkreference/pygtk2reference/class-gtkwidget.html#signal-gtkwidget--size-allocate</a><br>
88
The "size-allocate" signal is emitted when widget is given a new space allocation.</tt></dd></dl>
90
<dl><dt><a name="TimeLine-OnDraw"><strong>OnDraw</strong></a>(self, widget, event)</dt><dd><tt>Fires off the drawing operation.</tt></dd></dl>
92
<dl><dt><a name="TimeLine-OnStateChanged"><strong>OnStateChanged</strong></a>(self, obj, change<font color="#909090">=None</font>)</dt><dd><tt>Called when there is a change of state in transport<br>
93
manager or project. Could be one of<br>
94
* Mode changed from bars/beats to minutes or vice versa<br>
95
(requires a complete redraw of timeline - flag set)<br>
96
* Change in playing position -only needs partial redraw<br>
97
* Project change e.g. a scroll or zoom change<br>
98
(requires a complete redraw of timeline - flag set)</tt></dd></dl>
100
<dl><dt><a name="TimeLine-__init__"><strong>__init__</strong></a>(self, project, timelinebar, mainview)</dt><dd><tt>project - reference to the active project<br>
101
timelinebar - reference of TimeLineBar (TimeLineBar.py)<br>
102
mainview - reference to JokosherApp (JokosherApp.py) - Not used atm.</tt></dd></dl>
104
<dl><dt><a name="TimeLine-do_size_request"><strong>do_size_request</strong></a>(self, requisition)</dt></dl>
106
<dl><dt><a name="TimeLine-moveHead"><strong>moveHead</strong></a>(self, xpos)</dt><dd><tt>Changes the project position to the time matching xpos.</tt></dd></dl>
108
<dl><dt><a name="TimeLine-onMouseDown"><strong>onMouseDown</strong></a>(self, widget, event)</dt></dl>
110
<dl><dt><a name="TimeLine-onMouseMove"><strong>onMouseMove</strong></a>(self, widget, event)</dt></dl>
112
<dl><dt><a name="TimeLine-onMouseUp"><strong>onMouseUp</strong></a>(self, widget, event)</dt></dl>
99
The "size-allocate" signal is emitted when widget is given a new space allocation.<br>
102
widget -- reserved for GTK callbacks, don't use it explicitly.<br>
103
allocation -- the position and size to be allocated to the widget.</tt></dd></dl>
105
<dl><dt><a name="TimeLine-OnDraw"><strong>OnDraw</strong></a>(self, widget, event)</dt><dd><tt>Fires off the drawing operation.<br>
108
widget -- reserved for GTK callbacks, don't use it explicitly.<br>
109
event -- reserved for GTK callbacks, don't use it explicitly.</tt></dd></dl>
111
<dl><dt><a name="TimeLine-OnStateChanged"><strong>OnStateChanged</strong></a>(self, obj, change<font color="#909090">=None</font>, *extra)</dt><dd><tt>Called when there is a change of state in transport manager or project. <br>
112
Could be one of<br>
113
* Mode changed from bars/beats to minutes or vice versa<br>
114
(requires a complete redraw of timeline - flag set)<br>
115
* Change in playing position -only needs partial redraw<br>
116
* Project change e.g. a scroll or zoom change<br>
117
(requires a complete redraw of timeline - flag set)<br>
118
<br>
120
obj -- an object to inform when this method is called.<br>
121
change -- the change which has occured.<br>
122
extra -- the extra parameters to be passed.</tt></dd></dl>
124
<dl><dt><a name="TimeLine-__init__"><strong>__init__</strong></a>(self, project, timelinebar, mainview)</dt><dd><tt>Creates a new instance of <a href="#TimeLine">TimeLine</a><br>
127
project - reference to Project (Project.py)<br>
128
timelinebar - reference of TimeLineBar (TimeLineBar.py)<br>
129
mainview - reference to JokosherApp (JokosherApp.py) - Not used atm.</tt></dd></dl>
131
<dl><dt><a name="TimeLine-do_size_request"><strong>do_size_request</strong></a>(self, requisition)</dt><dd><tt>From:<br>
132
<a href="http://www.moeraki.com/pygtkreference/pygtk2reference/class-gtkwidget.html#signal-gtkwidget--size-request">http://www.moeraki.com/pygtkreference/pygtk2reference/class-gtkwidget.html#signal-gtkwidget--size-request</a><br>
133
The "size-request" signal is emitted when a new size is<br>
134
requested for widget using the <a href="#TimeLine-set_size_request">set_size_request</a>() method.<br>
137
requisition -- the widget's requested size as a gtk.Requisition.</tt></dd></dl>
139
<dl><dt><a name="TimeLine-moveHead"><strong>moveHead</strong></a>(self, xpos)</dt><dd><tt>Changes the project position to the time matching xpos.<br>
142
xpos -- the time of the new project position.</tt></dd></dl>
144
<dl><dt><a name="TimeLine-onMouseDown"><strong>onMouseDown</strong></a>(self, widget, event)</dt><dd><tt>Called when a mouse button is clicked.<br>
147
widget -- reserved for GTK callbacks, don't use it explicitly.<br>
148
event -- reserved for GTK callbacks, don't use it explicitly.</tt></dd></dl>
150
<dl><dt><a name="TimeLine-onMouseMove"><strong>onMouseMove</strong></a>(self, widget, event)</dt><dd><tt>Called when the mouse pointer has moved.<br>
153
widget -- reserved for GTK callbacks, don't use it explicitly.<br>
154
event -- reserved for GTK callbacks, don't use it explicitly.</tt></dd></dl>
156
<dl><dt><a name="TimeLine-onMouseUp"><strong>onMouseUp</strong></a>(self, widget, event)</dt><dd><tt>Called when a mouse button is released.<br>
159
widget -- reserved for GTK callbacks, don't use it explicitly.<br>
160
event -- reserved for GTK callbacks, don't use it explicitly.</tt></dd></dl>
115
163
Data and other attributes defined here:<br>
116
<dl><dt><strong>__gtype__</strong> = <GType TimeLine (136951352)></dl>
164
<dl><dt><strong>__gtype__</strong> = <GType TimeLine (138065688)></dl>
118
166
<dl><dt><strong>__gtype_name__</strong> = 'TimeLine'</dl>