1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import wx
23 from i18n import ChandlerMessageFactory as _
24 import logging
25 from application import schema
26 from osaf.pim import *
27 from osaf.pim.mail import MailStamp, getCurrentMeEmailAddresses
28
29 logger = logging.getLogger(__name__)
30
40
42
43
44 parent.AddWindow(self.questionText, 1, border=10,
45 flag=wx.ADJUST_MINSIZE | wx.ALIGN_LEFT | wx.ALL)
46 parent.AddSizer(self.buttonSizer, 0, border=10,
47 flag=wx.ALIGN_CENTER_HORIZONTAL | wx.LEFT | wx.RIGHT | wx.BOTTOM)
48
50
51 self.verticalSizer = wx.BoxSizer(orient=wx.VERTICAL)
52
53 self.buttonSizer = wx.FlexGridSizer(cols=0, hgap=0, rows=1, vgap=0)
54
55 self._init_coll_verticalSizer_Items(self.verticalSizer)
56 self._init_coll_buttonSizer_Items(self.buttonSizer)
57
58 self.SetSizer(self.verticalSizer)
59 self.SetAutoLayout(True)
60 self.verticalSizer.Fit(self)
61
63
64 wx.Dialog.__init__(self, id=-1,
65 name=u'RecurrenceDialog', parent=None, pos=wx.Point(533, 294),
66 size=wx.Size(443, 121),
67 style=wx.DIALOG_MODAL | wx.DEFAULT_DIALOG_STYLE,
68 title=_(u'Recurring event change'))
69 self.SetMinSize(wx.Size(400, 100))
70 self.SetClientSize(wx.Size(435, 87))
71 self.Bind(wx.EVT_CLOSE, self.onCancel)
72
73 self.cancelButton = wx.Button(id=wx.ID_CANCEL,
74 name=u'cancelButton', parent=self)
75 self.cancelButton.Bind(wx.EVT_BUTTON, self.onCancel)
76
77 self.allButton = wx.Button(id=-1, label=u'',
78 name=u'allButton', parent=self)
79 self.allButton.Bind(wx.EVT_BUTTON, self.onAll,
80 id=-1)
81
82 self.futureButton = wx.Button(id=-1, label=u'',
83 name=u'futureButton', parent=self)
84 self.futureButton.Bind(wx.EVT_BUTTON, self.onFuture,
85 id=-1)
86
87 self.thisButton = wx.Button(id=-1,
88 label=u'', name=u'thisButton', parent=self)
89 self.thisButton.Bind(wx.EVT_BUTTON, self.onThis,
90 id=-1)
91
92 self.questionText = wx.StaticText(id=-1,
93 label=u'', name=u'questionText', parent=self)
94
95 labels = {self.allButton : _(u'All events'),
96 self.futureButton : _(u'Future events'),
97 self.thisButton : _(u'Just this event')}
98
99 for item, label in labels.iteritems():
100 item.SetLabel(label)
101
102
103 self._init_sizers()
104
105 - def __init__(self, proxy, question, disabledButtons=()):
106 self.proxy = proxy
107 self._init_ctrls()
108
109
110 self.questionText.SetLabel(question)
111 self.questionText.Wrap(sum(self.buttonSizer.GetColWidths()))
112 self.SetTitle(_(u'Recurring event change'))
113
114 for buttonName in disabledButtons:
115 button = getattr(self, buttonName + 'Button')
116 button.Enable(False)
117
118 self.Fit()
119 self.Layout()
120 self.CenterOnScreen()
121 self.Show()
122
124 for method, args, kwargs in self.proxy.acceptCallbacks:
125 method(*args, **kwargs)
126 self.proxy.acceptCallbacks = []
127 self._end()
128
139
141 self.proxy.cancel()
142 for method in self.proxy.cancelCallbacks:
143 method()
144 self.proxy.acceptCallbacks = []
145 self._end()
146
152
158
164