4 # See COPYING file for copyrights details. |
4 # See COPYING file for copyrights details. |
5 |
5 |
6 from __future__ import absolute_import |
6 from __future__ import absolute_import |
7 import wx |
7 import wx |
8 |
8 |
9 # class RichMessageDialog is still not available in wxPython 3.0.2 |
9 |
|
10 # class RichMessageDialog is still not available in wxPython 3.0.2 |
10 class IDMergeDialog(wx.Dialog): |
11 class IDMergeDialog(wx.Dialog): |
11 def __init__(self, parent, title, question, optiontext, button_texts): |
12 def __init__(self, parent, title, question, optiontext, button_texts): |
12 wx.Dialog.__init__(self, parent, title=title) |
13 wx.Dialog.__init__(self, parent, title=title) |
13 |
14 |
14 main_sizer = wx.BoxSizer(wx.VERTICAL) |
15 main_sizer = wx.BoxSizer(wx.VERTICAL) |
15 |
16 |
16 message = wx.StaticText(self, label=question) |
17 message = wx.StaticText(self, label=question) |
17 main_sizer.AddWindow(message, border=20, |
18 main_sizer.AddWindow(message, border=20, |
18 flag = wx.ALIGN_CENTER_HORIZONTAL | wx.TOP | wx.LEFT | wx.RIGHT) |
19 flag=wx.ALIGN_CENTER_HORIZONTAL | wx.TOP | wx.LEFT | wx.RIGHT) |
19 |
20 |
20 self.check = wx.CheckBox(self, label=optiontext) |
21 self.check = wx.CheckBox(self, label=optiontext) |
21 main_sizer.AddWindow(self.check, border=20, |
22 main_sizer.AddWindow(self.check, border=20, |
22 flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.ALIGN_CENTER_HORIZONTAL) |
23 flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.ALIGN_CENTER_HORIZONTAL) |
23 |
24 |
24 buttons_sizer = wx.BoxSizer(wx.HORIZONTAL) |
25 buttons_sizer = wx.BoxSizer(wx.HORIZONTAL) |
25 for label,wxID in zip(button_texts, [wx.ID_YES, wx.ID_NO, wx.ID_CANCEL]): |
26 for label, wxID in zip(button_texts, [wx.ID_YES, wx.ID_NO, wx.ID_CANCEL]): |
26 Button = wx.Button(self, label=label) |
27 Button = wx.Button(self, label=label) |
|
28 |
27 def OnButtonFactory(_wxID): |
29 def OnButtonFactory(_wxID): |
28 return lambda event: self.EndModal(_wxID) |
30 return lambda event: self.EndModal(_wxID) |
|
31 |
29 self.Bind(wx.EVT_BUTTON, OnButtonFactory(wxID), Button) |
32 self.Bind(wx.EVT_BUTTON, OnButtonFactory(wxID), Button) |
30 buttons_sizer.AddWindow(Button) |
33 buttons_sizer.AddWindow(Button) |
31 |
34 |
32 main_sizer.AddSizer(buttons_sizer, border=20, |
35 main_sizer.AddSizer(buttons_sizer, border=20, |
33 flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.ALIGN_RIGHT) |
36 flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.ALIGN_RIGHT) |