1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 from timelinelib.calendar.gregorian.gregorian import GregorianDateTime
20 from timelinelib.calendar.gregorian.time import GregorianDelta
21 from timelinelib.calendar.num.time import NumDelta
22 from timelinelib.canvas.data.db import MemoryDB
23 from timelinelib.canvas.data import TimePeriod
24
25
27 """
28 Creates a Gregorian calender, tutorial timeline.
29
30 This function is called if the timeline application is started with:
31 python3 timeline.py :tutorial:
32 or if the menu Help -> Getting started tutorial is selected.
33 """
34 return create_in_memory_tutorial_db(GregorianTutorialTimelineCreator())
35
36
45
46
48 """Base class for creation of a tutorial timeline."""
49
56
57 - def add_category(self, name, color, font_color, make_last_added_parent=False):
69
75
76 - def add_era(self, start_add, end_add, name):
80
81 - def add_event(self, text, description, start_add, end_add=None, hyperlink=None):
90
91 - def add_container(self, text, description, start_add, end_add=None):
95
96 - def add_subevent(self, container, text, description, start_add, end_add=None, hyperlink=None):
107
111
118
119
121 """A Gregorian calendar, tutorial timeline."""
122
126
139
142
143
145 """A numeric tutorial timeline."""
146
150
155
158
159
161 tutcreator.add_milestone(
162 1,
163 _("Start"),
164 "<",
165 )
166 tutcreator.add_milestone(
167 29,
168 _("End"),
169 ">",
170 )
171 tutcreator.add_era(
172 20, 28,
173 _("Example era"),
174 )
175 tutcreator.add_category(
176 _("Welcome"), (255, 80, 80), (0, 0, 0)
177 )
178 tutcreator.add_event(
179 _("Welcome to Timeline"), "", 4
180 )
181 tutcreator.add_category(
182 _("Intro"), (250, 250, 20), (0, 0, 0)
183 )
184 tutcreator.add_event(
185 _("This event has hyperlinks"),
186 _("Right-click for context menu where the hyperlinks can be accessed."),
187 11,
188 19,
189 "https://sourceforge.net/projects/thetimelineproj/;http://thetimelineproj.sourceforge.net/"
190 )
191 tutcreator.add_event(
192 _("Hover me!"),
193 _("Hovering events with a triangle shows the event description."),
194 5
195 )
196 tutcreator.add_category(
197 _("Features"), (100, 100, 250), (250, 250, 20)
198 )
199 tutcreator.add_event(
200 _("Scroll"),
201 _("Left click somewhere on the timeline and start dragging."
202 "\n\n"
203 "You can also use the mouse wheel."
204 "\n\n"
205 "You can also middle click with the mouse to center around that point."),
206 5,
207 10
208 )
209 container = tutcreator.add_container(
210 _("Container"),
211 _("?"),
212 5,
213 10
214 )
215 tutcreator.add_subevent(
216 container,
217 _("Resize me"),
218 _("Container Subevent 1\nClick on the event to get the resize handles"),
219 5,
220 10
221 )
222 tutcreator.add_subevent(
223 container,
224 _("Drag me"),
225 _("Container Subevent 2\n\n"
226 "Click on the event to get the drag handle and drag it.\n\n"
227 "To drag the whole container, click on it while holding down the Alt key. "
228 "Keep the Alt key down and find the drag point at the center of the container and drag it."),
229 12,
230 18
231 )
232 tutcreator.add_subevent(
233 container,
234 _("View Container demo video"),
235 _("Container Subevent 3\n\n"
236 "Select hyperlink to show demo video.\n\n"
237 "Right-click in the event and select 'Goto URL' in the popup menu and select the first (and only) link"),
238 19,
239 24,
240 "http://www.youtube.com/watch?v=dBwEQ3vqB_I"
241 )
242 tutcreator.add_event(
243 _("Zoom"),
244 _("Hold down Ctrl while scrolling the mouse wheel."
245 "\n\n"
246 "Hold down Shift while dragging with the mouse."),
247 6,
248 11
249 )
250 tutcreator.add_event(
251 _("Create event"),
252 _("Double click somewhere on the timeline."
253 "\n\n"
254 "Hold down Ctrl while dragging the mouse to select a period."),
255 12,
256 18
257 )
258 tutcreator.add_event(
259 _("Edit event"),
260 _("Double click on an event."),
261 12,
262 18
263 )
264 tutcreator.add_event(
265 _("Select event"),
266 _("Click on it."
267 "\n\n"
268 "Hold down Ctrl while clicking events to select multiple."),
269 20,
270 25
271 )
272 tutcreator.add_event(
273 _("Delete event"),
274 _("Select events to be deleted and press the Del key."),
275 19,
276 24
277 )
278 tutcreator.add_event(
279 _("Resize and move me!"),
280 _("First select me and then drag the handles."),
281 11,
282 19
283 )
284 tutcreator.add_category(
285 _("Saving"), (50, 200, 50), (0, 0, 0)
286 )
287 tutcreator.add_event(
288 _("Saving"),
289 _("This timeline is stored in memory and modifications to it will not "
290 "be persisted between sessions."
291 "\n\n"
292 "Choose File/New/File Timeline to create a timeline that is saved on "
293 "disk."),
294 23
295 )
296 return tutcreator.get_db()
297