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