def add_controls_to_grid(self, sizer): txt = wx.StaticText(self, -1, "Output directory:") self.output_ctrl = path.PathCtrl(parent=self, style=path.WXTBX_PHIL_PATH_DIRECTORY) self.output_ctrl.SetValue(os.getcwd()) sizer.Add(txt, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) sizer.Add(self.output_ctrl, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
def __init__(self, *args, **kwds): wx.Dialog.__init__(self, *args, **kwds) outer_sizer = wx.BoxSizer(wx.VERTICAL) self.SetSizer(outer_sizer) szr = wx.BoxSizer(wx.VERTICAL) outer_sizer.Add(szr, 0, wx.ALL, 5) txt = wx.StaticText( self, label="Please select the file and/or directory " + "type(s) you want to delete. You will be prompted to confirm this " + "action once a list of targeted paths has been collected.") txt.Wrap(500) szr.Add(txt, 0, wx.ALL, 5) grid = wx.FlexGridSizer(cols=2, rows=2) szr.Add(grid, 0, wx.ALL, 5) grid.Add(wx.StaticText(self, label="Directory:"), 0, std_sizer_flags, 5) self.dir_ctrl = path.PathCtrl(parent=self, name="Directory", style=path.WXTBX_PHIL_PATH_DIRECTORY | path.WXTBX_PHIL_PATH_DEFAULT_CWD) self.dir_ctrl.SetOptional(False) grid.Add(self.dir_ctrl, 0, std_sizer_flags, 5) grid.Add(wx.StaticText(self, label="Items to remove:"), 0, std_sizer_flags, 5) self.remove_ctrl = choice_multi.MultiChoiceCtrl(parent=self, name="Items to remove") self.remove_ctrl.SetCols(2) items = [ "kin", "geo", "map", "probe", "temp", ] labels = [ "Kinemage files (.kin)", "Geometry files (.geo)", "Map files (.ccp4, .xplor)", "Probe files (probe.txt)", "Temporary folders (TEMP0)", ] for choice, label in zip(items, labels): self.remove_ctrl.AddChoice("*" + choice, label) self.remove_ctrl.Realize() grid.Add(self.remove_ctrl, 0, std_sizer_flags, 5) add_ok_cancel_buttons(self, szr) self.Fit() self.Centre(wx.BOTH)
def draw_dataset_controls(self, sizer=None, pick_frames=True): if (sizer is None): sizer = self.GetSizer() szr2 = wx.BoxSizer(wx.VERTICAL) sizer.Add(szr2, 0, wx.ALL, 5) szr3 = wx.BoxSizer(wx.HORIZONTAL) szr2.Add(szr3) bmp = wx.StaticBitmap(self, -1, icons.img_file.GetBitmap()) szr3.Add(bmp, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5) caption = "Please select a dataset to index. Most common detector " +\ "file formats are supported (ADSC, R-AXIS, MAR, Pilatus, CBF, etc.)." if (pick_frames): caption += " If you wish you may specify which frames you want to "+ \ "use; otherwise the program will attempt to pick sensible defaults." caption_txt = wx.StaticText(self, -1, caption) caption_txt.Wrap(500) szr3.Add(caption_txt, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5) grid = wx.FlexGridSizer(cols=2) sizer.Add(grid, 0, wx.ALL) txt1 = wx.StaticText(self, -1, "Directory:") grid.Add(txt1, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5) self.dir_ctrl = path.PathCtrl( parent=self, style=path.WXTBX_PHIL_PATH_DIRECTORY) grid.Add(self.dir_ctrl, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5) self.Bind(phil_controls.EVT_PHIL_CONTROL, self.OnChooseDirectory, self.dir_ctrl) txt2 = wx.StaticText(self, -1, "Image set:") grid.Add(txt2, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5) self.stack_ctrl = wx.Choice( parent=self, size=(400,-1)) grid.Add(self.stack_ctrl, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5) self.Bind(wx.EVT_CHOICE, self.OnChooseDataset, self.stack_ctrl) if (pick_frames): txt3 = wx.StaticText(self, -1, "Use frames:") grid.Add(txt3, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5) self.frame_ctrl = ints.IntsCtrl( parent=self, size=(400,-1)) self.frame_ctrl.SetMin(1) grid.Add(self.frame_ctrl, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5) else : self.frame_ctrl = None self.add_controls_to_grid(grid)
def draw_dataset_controls(self, sizer=None, pick_frames=True): if sizer is None: sizer = self.GetSizer() szr2 = wx.BoxSizer(wx.VERTICAL) sizer.Add(szr2, 0, wx.ALL, 5) szr3 = wx.BoxSizer(wx.HORIZONTAL) szr2.Add(szr3) bmp = wx.StaticBitmap(self, -1, icons.img_file.GetBitmap()) szr3.Add(bmp, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) caption = "Please select a directory of images to process." if pick_frames: caption += " If you wish you may specify which frames you want to "+ \ "use; otherwise the program will attempt to pick sensible defaults." caption_txt = wx.StaticText(self, -1, caption) caption_txt.Wrap(500) szr3.Add(caption_txt, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) grid = wx.FlexGridSizer(cols=2) sizer.Add(grid, 0, wx.ALL) txt1 = wx.StaticText(self, -1, "Directory:") grid.Add(txt1, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.dir_ctrl = path.PathCtrl(parent=self, style=path.WXTBX_PHIL_PATH_DIRECTORY) grid.Add(self.dir_ctrl, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.Bind(phil_controls.EVT_PHIL_CONTROL, self.OnChooseDirectory, self.dir_ctrl) txt2 = wx.StaticText(self, -1, "Image set:") grid.Add(txt2, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.stack_ctrl = wx.ListBox(parent=self, size=(400, -1), style=wx.LB_MULTIPLE | wx.LB_HSCROLL) grid.Add(self.stack_ctrl, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.Bind(wx.EVT_LISTBOX, self.OnChooseDataset, self.stack_ctrl) if pick_frames: txt3 = wx.StaticText(self, -1, "Use frames:") grid.Add(txt3, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.frame_ctrl = ints.IntsCtrl(parent=self, size=(400, -1)) self.frame_ctrl.SetMin(1) grid.Add(self.frame_ctrl, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) else: self.frame_ctrl = None self.add_controls_to_grid(grid)