1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 from datetime import datetime
20 from datetime import timedelta
21
22 from timelinelib.db.objects import Category
23 from timelinelib.db.objects import Event
24 from timelinelib.db.objects import TimePeriod
25 from timelinelib.db.backends.memory import MemoryDB
26
27
29 tutcreator = TutorialTimelineCreator()
30 tutcreator.add_category(_("Welcome"), (255, 80, 80), (0, 0, 0))
31 tutcreator.add_event(
32 _("Welcome to Timeline"),
33 "",
34 timedelta(days=4))
35 tutcreator.add_category(_("Intro"), (250, 250, 20), (0, 0, 0))
36 tutcreator.add_event(
37 _("Hover me!"),
38 _("Hovering events with a triangle shows the event description."),
39 timedelta(days=5))
40 tutcreator.add_category(_("Features"), (100, 100, 250), (250, 250, 20))
41 tutcreator.add_event(
42 _("Scroll"),
43 _("Left click somewhere on the timeline and start dragging."
44 "\n\n"
45 "You can also use the mouse wheel."
46 "\n\n"
47 "You can also middle click with the mouse to center around that point."),
48 timedelta(days=5),
49 timedelta(days=10))
50 tutcreator.add_event(
51 _("Zoom"),
52 _("Hold down Ctrl while scrolling the mouse wheel."
53 "\n\n"
54 "Hold down Shift while dragging with the mouse."),
55 timedelta(days=6),
56 timedelta(days=11))
57 tutcreator.add_event(
58 _("Create event"),
59 _("Double click somewhere on the timeline."
60 "\n\n"
61 "Hold down Ctrl while dragging the mouse to select a period."),
62 timedelta(days=12),
63 timedelta(days=18))
64 tutcreator.add_event(
65 _("Edit event"),
66 _("Double click on an event."),
67 timedelta(days=12),
68 timedelta(days=18))
69 tutcreator.add_event(
70 _("Select event"),
71 _("Click on it."
72 "\n\n"
73 "Hold down Ctrl while clicking events to select multiple."),
74 timedelta(days=20),
75 timedelta(days=25))
76 tutcreator.add_event(
77 _("Delete event"),
78 _("Select events to be deleted and press the Del key."),
79 timedelta(days=19),
80 timedelta(days=24))
81 tutcreator.add_event(
82 _("Resize and move me!"),
83 _("First select me and then drag the handles."),
84 timedelta(days=11),
85 timedelta(days=19))
86 tutcreator.add_category(_("Saving"), (50, 200, 50), (0, 0, 0))
87 tutcreator.add_event(
88 _("Saving"),
89 _("This timeline is stored in memory and modifications to it will not "
90 "be persisted between sessions."
91 "\n\n"
92 "Choose File/New/File Timeline to create a timeline that is saved on "
93 "disk."),
94 timedelta(days=23))
95 return tutcreator.get_db()
96
97
99
108
109 - def add_category(self, name, color, font_color, make_last_added_parent=False):
110 if make_last_added_parent:
111 parent = self.last_cat
112 else:
113 parent = None
114 self.last_cat = Category(name, color, font_color, True, parent)
115 self.db.save_category(self.last_cat)
116
117 - def add_event(self, text, description, start_add, end_add=None):
126
129