1 | import wx |
---|
2 | |
---|
3 | class FrameSelectDialog(wx.Dialog): |
---|
4 | """ |
---|
5 | This class provides a wx.Dialog subclass for selecting which frames of a |
---|
6 | multi-frame file to export |
---|
7 | """ |
---|
8 | |
---|
9 | def __init__(self, n_frames, is_bsl=False): |
---|
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) |
---|
19 | instructions_label.Wrap(self.GetSize().width - 10) |
---|
20 | sizer.Add(instructions_label, (y,0), (1,2), wx.ALL, 5) |
---|
21 | y += 1 |
---|
22 | |
---|
23 | first_label = wx.StaticText(self, -1, |
---|
24 | "First Frame (0-{}): ".format(n_frames-1)) |
---|
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 | |
---|
31 | last_label = wx.StaticText(self, -1, |
---|
32 | "Last Frame (0-{}): ".format(n_frames-1)) |
---|
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 | |
---|
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 |
---|
50 | |
---|
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) |
---|
55 | |
---|
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 |
---|
60 | |
---|
61 | done_btn = wx.Button(self, wx.ID_OK) |
---|
62 | sizer.Add(done_btn, (y,0), (1,1), wx.LEFT | wx.BOTTOM, 15) |
---|
63 | |
---|
64 | cancel_btn = wx.Button(self, wx.ID_CANCEL) |
---|
65 | sizer.Add(cancel_btn, (y,1), (1,1), wx.LEFT | wx.RIGHT | wx.BOTTOM, 15) |
---|
66 | |
---|
67 | self.SetSizer(sizer) |
---|
68 | |
---|
69 | size = self.GetSize() |
---|
70 | if not is_bsl: |
---|
71 | size.height += 35 |
---|
72 | self.SetSize(size) |
---|