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 timeline="$(db)"
59 align="ALIGN_LEFT"
60 />
61 <StaticText
62 label="$(colour_text)"
63 align="ALIGN_CENTER_VERTICAL"
64 />
65 <ColourSelect
66 name="colorpicker"
67 align="ALIGN_CENTER_VERTICAL"
68 width="60"
69 height="30"
70 />
71 </FlexGridSizer>
72 </StaticBoxSizerVertical>
73 <DialogButtonsOkCancelSizer
74 border="LEFT|BOTTOM|RIGHT"
75 event_EVT_BUTTON__ID_OK="on_ok_clicked"
76 />
77 </BoxSizerVertical>
78 """
79
80 - def __init__(self, parent, title, db, config, milestone):
81 Dialog.__init__(self, EditMilestoneDialogController, parent, {
82 "groupbox_text": _("Milestone Properties"),
83 "when_text": _("When:"),
84 "time_type": db.time_type,
85 "description_text": _("Description:"),
86 "description_label": _("Label:"),
87 "category_label": _("Category:"),
88 "colour_text": _("Colour:"),
89 "config": config,
90 "db": db,
91 }, title=title)
92 self.controller.on_init(db, milestone)
93 self._milestone = milestone
94 self.txt_label.Bind(wx.EVT_CHAR, self.handle_keypress)
95
98
101
103 return self.txt_description.GetValue()
104
110
113
116
119
122
125
128
130 self.txt_label.Clear()
131 evt.Skip()
132
133
142
143 def edit_function():
144 dialog = create_milestone_editor()
145 dialog.ShowModal()
146 dialog.Destroy()
147 safe_locking(edit_controller, edit_function)
148