1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 import wx
20
21 from timelinelib.wxgui.framework import Dialog
22 from timelinelib.wxgui.dialogs.milestone.controller import EditMilestoneDialogController
23 from timelinelib.db.utils import safe_locking
24
25
27
28 """
29 <BoxSizerVertical>
30 <StaticBoxSizerVertical label="$(groupbox_text)" border="ALL" >
31 <FlexGridSizer rows="0" columns="2" border="ALL">
32 <StaticText
33 label="$(when_text)"
34 align="ALIGN_CENTER_VERTICAL"
35 />
36 <TimePicker
37 time_type="$(time_type)"
38 config="$(config)"
39 name="dtp_time"
40 />
41 <StaticText
42 label="$(description_text)"
43 align="ALIGN_CENTER_VERTICAL"
44 />
45 <TextCtrl name="txt_description" />
46 <StaticText
47 label="$(description_label)"
48 align="ALIGN_CENTER_VERTICAL"
49 />
50 <TextCtrl name="txt_label" />
51 <StaticText
52 align="ALIGN_CENTER_VERTICAL"
53 label="$(category_label)"
54 />
55 <CategoryChoice
56 name="category_choice"
57 allow_add="True"
58 allow_edit="True"
59 timeline="$(db)"
60 align="ALIGN_LEFT"
61 />
62 <StaticText
63 label="$(colour_text)"
64 align="ALIGN_CENTER_VERTICAL"
65 />
66 <ColourSelect
67 name="colorpicker"
68 align="ALIGN_CENTER_VERTICAL"
69 width="60"
70 height="30"
71 />
72 </FlexGridSizer>
73 </StaticBoxSizerVertical>
74 <DialogButtonsOkCancelSizer
75 border="LEFT|BOTTOM|RIGHT"
76 event_EVT_BUTTON__ID_OK="on_ok_clicked"
77 />
78 </BoxSizerVertical>
79 """
80
81 - def __init__(self, parent, title, db, config, milestone):
82 Dialog.__init__(self, EditMilestoneDialogController, parent, {
83 "groupbox_text": _("Milestone Properties"),
84 "when_text": _("When:"),
85 "time_type": db.time_type,
86 "description_text": _("Description:"),
87 "description_label": _("Label:"),
88 "category_label": _("Category:"),
89 "colour_text": _("Colour:"),
90 "config": config,
91 "db": db,
92 }, title=title)
93 self.controller.on_init(db, milestone)
94 self._milestone = milestone
95 self.txt_label.Bind(wx.EVT_CHAR, self.handle_keypress)
96
99
102
104 return self.txt_description.GetValue()
105
111
114
117
120
123
126
129
131 self.txt_label.Clear()
132 evt.Skip()
133
134
143
144 def edit_function():
145 dialog = create_milestone_editor()
146 dialog.ShowModal()
147 dialog.Destroy()
148 safe_locking(edit_controller, edit_function)
149