source: sasview/src/sas/sasgui/perspectives/file_converter/frame_select_dialog.py @ ba65aff

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since ba65aff was ba65aff, checked in by lewis, 5 years ago

Add docstrings & comments, and rename old bsl_loader to otoko_loader

  • Property mode set to 100644
File size: 2.5 KB
Line 
1import wx
2
3class 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)
Note: See TracBrowser for help on using the repository browser.