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.dialogs.export.controller import ExportDialogController
22 from timelinelib.wxgui.dialogs.fieldselection.view import FieldSelectionDialog
23 from timelinelib.wxgui.framework import Dialog
24 from timelinelib.wxgui.utils import display_information_message
25
26
27 IGNORE = _("Ignore")
28 REPLACE = _("Replace")
29 XML_REPLACE = _("XML-Replace")
30 STRICT = _("Strict")
31 STRATEGY = {IGNORE: "ignore", REPLACE: "replace", XML_REPLACE: "xmlcharrefreplace", STRICT: "strict"}
32
33
35
36 """
37 <BoxSizerVertical>
38 <StaticBoxSizerVertical label="$(type_description_text)" border="ALL">
39 <ListBox style="LB_SINGLE" name="lb_target_types" />
40 </StaticBoxSizerVertical>
41
42 <StaticBoxSizerVertical label="$(encoding_description_text)" border="LEFT|RIGHT|BOTTOM">
43 <ListBox style="LB_SINGLE" name="lb_text_encodings" />
44 </StaticBoxSizerVertical>
45
46 <StaticBoxSizerVertical label="$(encoding_error_strategy_text)" border="LEFT|RIGHT|BOTTOM">
47 <ListBox
48 style="LB_SINGLE"
49 name="lb_error_strategies"
50 choices="$(lb_error_strategies_choices)" />
51 </StaticBoxSizerVertical>
52
53 <StaticBoxSizerVertical label="$(export_items_description_text)" border="LEFT|RIGHT|BOTTOM">
54 <FlexGridSizer rows="0" columns="2" border="ALL">
55 <CheckBox align="ALIGN_CENTER_VERTICAL" label="$(events_text)" name="cbx_events" />
56 <Button align="ALIGN_CENTER_VERTICAL" label="$(select_text)"
57 event_EVT_BUTTON="on_edit_event_fields" />
58 <CheckBox align="ALIGN_CENTER_VERTICAL" label="$(categories_text)" name="cbx_categories"/>
59 <Button align="ALIGN_CENTER_VERTICAL" label="$(select_text)"
60 event_EVT_BUTTON="on_edit_categories_fields" />
61 </FlexGridSizer>
62 </StaticBoxSizerVertical>
63
64 <DialogButtonsOkCancelSizer
65 border="LEFT|RIGHT|BOTTOM"
66 event_EVT_BUTTON__ID_OK="on_ok"
67 />
68 </BoxSizerVertical>
69 """
70
72 Dialog.__init__(self, ExportDialogController, parent, {
73 "type_description_text": _("Select Export File Type"),
74 "encoding_description_text": _("Select Text Encoding"),
75 "encoding_error_strategy_text": _("Select encoding error strategy"),
76 "export_items_description_text": _("Select Items to export"),
77 "events_text": _("Events"),
78 "categories_text": _("Categories"),
79 "select_text": _("Select Fields..."),
80 "lb_error_strategies_choices": [IGNORE, REPLACE, XML_REPLACE, STRICT],
81 }, title=_("Export Timeline"))
82 self.controller.on_init()
83 self.lb_error_strategies.Select(0)
84
86 self.lb_target_types.AppendItems(types)
87 self.lb_target_types.Select(0)
88
89 - def SetTextEncodings(self, encodings):
90 self.lb_text_encodings.AppendItems(encodings)
91 self.lb_text_encodings.Select(0)
92
95
98
105
112
115
117 return self.cbx_categories.GetValue()
118
121
123 self.EndModal(wx.ID_OK)
124
126 return self.lb_target_types.GetStringSelection()
127
128 - def GetTextEncoding(self):
129 return self.lb_text_encodings.GetStringSelection()
130
132 return STRATEGY[self.lb_error_strategies.GetStringSelection()]
133
136
139