[eb8da5f] | 1 | import wx |
---|
| 2 | |
---|
| 3 | class FrameSelectDialog(wx.Dialog): |
---|
| 4 | |
---|
[05595c4] | 5 | def __init__(self, n_frames, is_bsl=False): |
---|
[eb8da5f] | 6 | wx.Dialog.__init__(self, None, title="Select Frames") |
---|
| 7 | |
---|
| 8 | sizer = wx.GridBagSizer(10, 10) |
---|
| 9 | |
---|
| 10 | y = 0 |
---|
| 11 | instructions = ("The file you've selected has {} frames. " |
---|
| 12 | "Please select a subset of frames to convert to CanSAS " |
---|
| 13 | "format").format(n_frames) |
---|
| 14 | instructions_label = wx.StaticText(self, -1, instructions) |
---|
[94f4518] | 15 | instructions_label.Wrap(self.GetSize().width - 10) |
---|
[eb8da5f] | 16 | sizer.Add(instructions_label, (y,0), (1,2), wx.ALL, 5) |
---|
| 17 | y += 1 |
---|
| 18 | |
---|
[94f4518] | 19 | first_label = wx.StaticText(self, -1, |
---|
| 20 | "First Frame (0-{}): ".format(n_frames-1)) |
---|
[eb8da5f] | 21 | sizer.Add(first_label, (y,0), (1,1), wx.ALL, 5) |
---|
| 22 | |
---|
| 23 | self.first_input = wx.TextCtrl(self, -1) |
---|
| 24 | sizer.Add(self.first_input, (y,1), (1,1)) |
---|
| 25 | y += 1 |
---|
| 26 | |
---|
[94f4518] | 27 | last_label = wx.StaticText(self, -1, |
---|
| 28 | "Last Frame (0-{}): ".format(n_frames-1)) |
---|
[eb8da5f] | 29 | sizer.Add(last_label, (y,0), (1,1), wx.ALL, 5) |
---|
| 30 | |
---|
| 31 | self.last_input = wx.TextCtrl(self, -1) |
---|
| 32 | sizer.Add(self.last_input, (y,1), (1,1)) |
---|
| 33 | y += 1 |
---|
| 34 | |
---|
| 35 | increment_label = wx.StaticText(self, -1, "Increment: ") |
---|
| 36 | sizer.Add(increment_label, (y,0), (1,1), wx.ALL, 5) |
---|
| 37 | |
---|
| 38 | self.increment_input = wx.TextCtrl(self, -1) |
---|
| 39 | sizer.Add(self.increment_input, (y,1), (1,1)) |
---|
| 40 | y += 1 |
---|
| 41 | |
---|
[05595c4] | 42 | if not is_bsl: |
---|
| 43 | export_label = wx.StaticText(self, -1, "Export each frame to:") |
---|
| 44 | sizer.Add(export_label, (y,0), (1,1), wx.LEFT | wx.RIGHT | wx.TOP, 5) |
---|
| 45 | y += 1 |
---|
[94f4518] | 46 | |
---|
[05595c4] | 47 | self.single_btn = wx.RadioButton(self, -1, label="The same file", |
---|
| 48 | style=wx.RB_GROUP) |
---|
| 49 | sizer.Add(self.single_btn, (y,0), (1,1), |
---|
| 50 | wx.LEFT | wx.RIGHT | wx.BOTTOM, 5) |
---|
[94f4518] | 51 | |
---|
[05595c4] | 52 | multiple_btn = wx.RadioButton(self, -1, label="Multiple files") |
---|
| 53 | sizer.Add(multiple_btn, (y,1), (1,1), |
---|
| 54 | wx.LEFT | wx.RIGHT | wx.BOTTOM, 5) |
---|
| 55 | y += 1 |
---|
[94f4518] | 56 | |
---|
[eb8da5f] | 57 | done_btn = wx.Button(self, wx.ID_OK) |
---|
[94f4518] | 58 | sizer.Add(done_btn, (y,0), (1,1), wx.LEFT | wx.BOTTOM, 15) |
---|
[eb8da5f] | 59 | |
---|
| 60 | cancel_btn = wx.Button(self, wx.ID_CANCEL) |
---|
[94f4518] | 61 | sizer.Add(cancel_btn, (y,1), (1,1), wx.LEFT | wx.RIGHT | wx.BOTTOM, 15) |
---|
[eb8da5f] | 62 | |
---|
| 63 | self.SetSizer(sizer) |
---|
[94f4518] | 64 | |
---|
| 65 | size = self.GetSize() |
---|
[05595c4] | 66 | if not is_bsl: |
---|
| 67 | size.height += 35 |
---|
[94f4518] | 68 | self.SetSize(size) |
---|