1 | import wx |
---|
2 | |
---|
3 | class FrameSelectDialog(wx.Dialog): |
---|
4 | |
---|
5 | def __init__(self, n_frames, is_bsl=False): |
---|
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) |
---|
15 | instructions_label.Wrap(self.GetSize().width - 10) |
---|
16 | sizer.Add(instructions_label, (y,0), (1,2), wx.ALL, 5) |
---|
17 | y += 1 |
---|
18 | |
---|
19 | first_label = wx.StaticText(self, -1, |
---|
20 | "First Frame (0-{}): ".format(n_frames-1)) |
---|
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 | |
---|
27 | last_label = wx.StaticText(self, -1, |
---|
28 | "Last Frame (0-{}): ".format(n_frames-1)) |
---|
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 | |
---|
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 |
---|
46 | |
---|
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) |
---|
51 | |
---|
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 |
---|
56 | |
---|
57 | done_btn = wx.Button(self, wx.ID_OK) |
---|
58 | sizer.Add(done_btn, (y,0), (1,1), wx.LEFT | wx.BOTTOM, 15) |
---|
59 | |
---|
60 | cancel_btn = wx.Button(self, wx.ID_CANCEL) |
---|
61 | sizer.Add(cancel_btn, (y,1), (1,1), wx.LEFT | wx.RIGHT | wx.BOTTOM, 15) |
---|
62 | |
---|
63 | self.SetSizer(sizer) |
---|
64 | |
---|
65 | size = self.GetSize() |
---|
66 | if not is_bsl: |
---|
67 | size.height += 35 |
---|
68 | self.SetSize(size) |
---|