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.db.utils import safe_locking
22 from timelinelib.wxgui.dialogs.duplicateevent.controller import DuplicateEventDialogController
23 from timelinelib.wxgui.framework import Dialog
24 from timelinelib.wxgui.utils import display_error_message
25 import timelinelib.wxgui.utils as gui_utils
26
27
29
30 """
31 <BoxSizerVertical>
32
33 <BoxSizerHorizontal border="ALL" >
34 <StaticText
35 label="$(nbr_of_duplicates_text)"
36 align="ALIGN_CENTER_VERTICAL"
37 />
38 <Spacer />
39 <SpinCtrl
40 name="sc_nbr_of_duplicates"
41 align="ALIGN_CENTER_VERTICAL"
42 />
43 </BoxSizerHorizontal>
44
45 <RadioBox
46 label="$(period_text)"
47 name="rb_periods"
48 choices="$(period_choices)"
49 border="LEFT|RIGHT|BOTTOM"
50 />
51
52 <BoxSizerHorizontal border="LEFT|RIGHT|BOTTOM" >
53 <StaticText
54 label="$(frequency_text)"
55 align="ALIGN_CENTER_VERTICAL"
56 />
57 <Spacer />
58 <SpinCtrl
59 name="sc_frequency"
60 align="ALIGN_CENTER_VERTICAL"
61 />
62 </BoxSizerHorizontal>
63
64 <RadioBox
65 label="$(direction_text)"
66 name="rb_direction"
67 choices="$(direction_choices)"
68 border="LEFT|RIGHT|BOTTOM"
69 />
70
71 <DialogButtonsOkCancelSizer
72 border="LEFT|RIGHT|BOTTOM"
73 event_EVT_BUTTON__ID_OK="on_ok"
74 />
75
76 </BoxSizerVertical>
77 """
78
80 self. move_period_config = db.get_time_type().get_duplicate_functions()
81 period_list = [label for (label, fn) in self.move_period_config]
82 Dialog.__init__(self, DuplicateEventDialogController, parent, {
83 "nbr_of_duplicates_text": _("Number of duplicates:"),
84 "period_text": _("Period"),
85 "direction_text": _("Direction"),
86 "period_choices": period_list,
87 "frequency_text": _("Frequency:"),
88 "direction_choices": [_("Forward"), _("Backward"), _("Both")],
89 }, title=_("Duplicate Event"))
90 self.controller.on_init(event)
91 self.sc_nbr_of_duplicates.SetSelection(-1, -1)
92
94 self.sc_nbr_of_duplicates.SetValue(count)
95
97 return self.sc_nbr_of_duplicates.GetValue()
98
100 self.sc_frequency.SetValue(frequency)
101
104
107
110
113
115 move_period_fns = [fn for (_, fn) in self.move_period_config]
116 return move_period_fns[self.rb_periods.GetSelection()]
117
119 self.EndModal(wx.ID_OK)
120
125
128
131
132
136
137 def edit_function():
138 dialog = create_dialog()
139 dialog.ShowModal()
140 dialog.Destroy()
141 safe_locking(edit_controller, edit_function)
142