def __init__ (self, parent, title, label, value=None, caption=None) : style = wx.CAPTION|wx.CLOSE_BOX|wx.RAISED_BORDER| \ wx.WS_EX_VALIDATE_RECURSIVELY | wx.RESIZE_BORDER wx.Dialog.__init__(self, parent=parent, title=title, style=style) self.sizer = wx.BoxSizer(wx.VERTICAL) self.SetSizer(self.sizer) self.inner_sizer = wx.BoxSizer(wx.VERTICAL) self.sizer.Add(self.inner_sizer, 1, wx.EXPAND|wx.ALL, 5) if (caption is not None) : caption_txt = wx.StaticText(self, -1, caption) caption_txt.Wrap(480) self.inner_sizer.Add(caption_txt, 0, wx.ALL, 5) input_szr = wx.BoxSizer(wx.HORIZONTAL) self.inner_sizer.Add(input_szr, 0, wx.ALIGN_CENTER) label_txt = wx.StaticText(self, -1, label + ":") input_szr.Add(label_txt, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5) self.phil_ctrl = self.CreatePhilControl(value) input_szr.Add(self.phil_ctrl, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5) add_ok_cancel_buttons(self, self.sizer) self.Fit() self.Centre(wx.BOTH)
def __init__ (self, *args, **kwds) : kwds = dict(kwds) style = kwds.get('style', 0) style |= wx.CAPTION|wx.CLOSE_BOX|wx.RAISED_BORDER| \ wx.WS_EX_VALIDATE_RECURSIVELY kwds['style'] = style extra_style = kwds.pop("wxtbxStyle", 0) wx.Dialog.__init__(self, *args, **kwds) szr = wx.BoxSizer(wx.VERTICAL) self.SetSizer(szr) self._r_ctrls = [] self._t_ctrls = [] txt = wx.StaticText(self, -1, "Please enter rotation and translation operations to apply. All "+ "values must be defined.") szr.Add(txt, 0, wx.ALL, 5) grid = wx.FlexGridSizer(rows=4, cols=4) szr.Add(grid, 0, wx.ALL, 5) label1 = wx.StaticText(self, -1, "Rotation:") grid.Add(label1, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5) for i in range(3) : if (i > 0) : grid.Add((1,1)) for j in range(3) : _value = 0.0 if (j == i) : _value = 1.0 ctrl = floatctrl.FloatCtrl( parent=self, name="Rotation", value=_value) ctrl.SetOptional(False) grid.Add(ctrl, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5) self._r_ctrls.append(ctrl) label2 = wx.StaticText(self, -1, "Translation:") grid.Add(label2, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5) for i in range(3) : ctrl = floatctrl.FloatCtrl( parent=self, name="Translation", value=0) ctrl.SetOptional(False) grid.Add(ctrl, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5) self._t_ctrls.append(ctrl) self.frac_box = None if (extra_style & RT_DIALOG_ENABLE_FRACTIONAL) : self.frac_box = wx.CheckBox(self, -1, "Use fractional coordinates") szr.Add(self.frac_box, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5) add_ok_cancel_buttons(self, szr) self.Fit() self.Centre(wx.BOTH)
def __init__(self, *args, **kwds): kwds = dict(kwds) style = kwds.get('style', 0) style |= wx.CAPTION|wx.CLOSE_BOX|wx.RAISED_BORDER| \ wx.WS_EX_VALIDATE_RECURSIVELY kwds['style'] = style extra_style = kwds.pop("wxtbxStyle", 0) wx.Dialog.__init__(self, *args, **kwds) szr = wx.BoxSizer(wx.VERTICAL) self.SetSizer(szr) self._r_ctrls = [] self._t_ctrls = [] txt = wx.StaticText( self, -1, "Please enter rotation and translation operations to apply. All " + "values must be defined.") szr.Add(txt, 0, wx.ALL, 5) grid = wx.FlexGridSizer(rows=4, cols=4) szr.Add(grid, 0, wx.ALL, 5) label1 = wx.StaticText(self, -1, "Rotation:") grid.Add(label1, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) for i in range(3): if (i > 0): grid.Add((1, 1)) for j in range(3): _value = 0.0 if (j == i): _value = 1.0 ctrl = floatctrl.FloatCtrl(parent=self, name="Rotation", value=_value) ctrl.SetOptional(False) grid.Add(ctrl, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self._r_ctrls.append(ctrl) label2 = wx.StaticText(self, -1, "Translation:") grid.Add(label2, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) for i in range(3): ctrl = floatctrl.FloatCtrl(parent=self, name="Translation", value=0) ctrl.SetOptional(False) grid.Add(ctrl, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self._t_ctrls.append(ctrl) self.frac_box = None if (extra_style & RT_DIALOG_ENABLE_FRACTIONAL): self.frac_box = wx.CheckBox(self, -1, "Use fractional coordinates") szr.Add(self.frac_box, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) add_ok_cancel_buttons(self, szr) self.Fit() self.Centre(wx.BOTH)
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 __init__(self, *args, **kwds): wx.Dialog.__init__(self, *args, **kwds) szr = wx.BoxSizer(wx.VERTICAL) self.SetSizer(szr) szr2 = wx.BoxSizer(wx.VERTICAL) szr.Add(szr2, 0, wx.ALL | wx.ALIGN_CENTER, 10) txt = wx.StaticText( parent=self, label= "Please enter the information required by your HTTP proxy. The " + "authentication information may not be needed at all sites.", size=(400, -1)) txt.Wrap(400) szr2.Add(txt) grid = wx.FlexGridSizer(cols=2) szr2.Add(grid) grid.Add(wx.StaticText(self, label="HTTP proxy server:"), 0, std_sizer_flags, 5) self.server_ctrl = strctrl.StrCtrl(parent=self, size=(300, -1), name="HTTP proxy server") self.server_ctrl.SetOptional(False) grid.Add(self.server_ctrl, 0, std_sizer_flags, 5) grid.Add(wx.StaticText(self, label="Proxy port:"), 0, std_sizer_flags, 5) self.port_ctrl = intctrl.IntCtrl(parent=self, size=(100, -1), name="Proxy port") self.port_ctrl.SetOptional(False) grid.Add(self.port_ctrl, 0, std_sizer_flags, 5) grid.Add(wx.StaticText(self, label="User name:"), 0, std_sizer_flags, 5) self.user_ctrl = strctrl.StrCtrl(parent=self, size=(100, -1), name="User name") self.user_ctrl.SetOptional(False) grid.Add(self.user_ctrl, 0, std_sizer_flags, 5) grid.Add(wx.StaticText(self, label="Password:"******"Password", style=wx.TE_PASSWORD) self.password_ctrl.SetOptional(False) grid.Add(self.password_ctrl, 0, std_sizer_flags, 5) add_ok_cancel_buttons(self, szr) szr.Layout() self.Fit() self.Centre(wx.BOTH)
def __init__(self, *args, **kwds): caption = kwds.get("caption", "Missing or incomplete symmetry information. Please enter a space "+ "group and unit cell.") if ("caption" in kwds): del kwds['caption'] super(SymmetryDialog, self).__init__(*args, **kwds) style = self.GetWindowStyle() style |= wx.WS_EX_VALIDATE_RECURSIVELY|wx.RAISED_BORDER|wx.CAPTION self.SetWindowStyle(style) szr = wx.BoxSizer(wx.VERTICAL) self.SetSizer(szr) szr2 = wx.BoxSizer(wx.VERTICAL) szr.Add(szr2, 0, wx.ALL|wx.EXPAND, 10) caption_sizer = wx.BoxSizer(wx.HORIZONTAL) bmp = wx.StaticBitmap(self, -1, wxtbx.icons.symmetry.GetBitmap()) caption_sizer.Add(bmp, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) txt = wx.StaticText(self, -1, caption) txt.Wrap(480) caption_sizer.Add(txt, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) szr2.Add(caption_sizer, 0, wx.ALL, 0) szr3 = wx.FlexGridSizer(rows=3, cols=2) szr2.Add(szr3, 0, wx.ALL, 0) txt2 = wx.StaticText(self, -1, "Unit cell:") self.unit_cell_ctrl = unit_cell.UnitCellCtrl( parent=self, id=-1, size=(300,-1), name="Unit cell") txt3 = wx.StaticText(self, -1, "Space group:") self.space_group_ctrl = space_group.SpaceGroupCtrl( parent=self, id=-1, name="Space group") szr3.Add(txt2, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5) szr3.Add(self.unit_cell_ctrl, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5) szr3.Add(txt3, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5) szr3.Add(self.space_group_ctrl, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5) szr3.Add((1,1), 0, wx.ALL, 5) load_btn = wx.Button(self, -1, "Load symmetry from file...") szr3.Add(load_btn, 0, wx.ALL, 5) self.Bind(wx.EVT_BUTTON, self.OnLoadSymmetry, load_btn) add_ok_cancel_buttons(self, szr2) szr.Layout() self.Fit() self.Centre(wx.BOTH)
def __init__ (self, *args, **kwds) : caption = kwds.get("caption", "Missing or incomplete symmetry information. Please enter a space "+ "group and unit cell.") if ("caption" in kwds) : del kwds['caption'] super(SymmetryDialog, self).__init__(*args, **kwds) style = self.GetWindowStyle() style |= wx.WS_EX_VALIDATE_RECURSIVELY|wx.RAISED_BORDER|wx.CAPTION self.SetWindowStyle(style) szr = wx.BoxSizer(wx.VERTICAL) self.SetSizer(szr) szr2 = wx.BoxSizer(wx.VERTICAL) szr.Add(szr2, 0, wx.ALL|wx.EXPAND, 10) caption_sizer = wx.BoxSizer(wx.HORIZONTAL) bmp = wx.StaticBitmap(self, -1, wxtbx.icons.symmetry.GetBitmap()) caption_sizer.Add(bmp, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) txt = wx.StaticText(self, -1, caption) txt.Wrap(480) caption_sizer.Add(txt, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) szr2.Add(caption_sizer, 0, wx.ALL, 0) szr3 = wx.FlexGridSizer(rows=3, cols=2) szr2.Add(szr3, 0, wx.ALL, 0) txt2 = wx.StaticText(self, -1, "Unit cell:") self.unit_cell_ctrl = unit_cell.UnitCellCtrl( parent=self, id=-1, size=(300,-1), name="Unit cell") txt3 = wx.StaticText(self, -1, "Space group:") self.space_group_ctrl = space_group.SpaceGroupCtrl( parent=self, id=-1, name="Space group") szr3.Add(txt2, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5) szr3.Add(self.unit_cell_ctrl, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5) szr3.Add(txt3, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5) szr3.Add(self.space_group_ctrl, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5) szr3.Add((1,1), 0, wx.ALL, 5) load_btn = wx.Button(self, -1, "Load symmetry from file...") szr3.Add(load_btn, 0, wx.ALL, 5) self.Bind(wx.EVT_BUTTON, self.OnLoadSymmetry, load_btn) add_ok_cancel_buttons(self, szr2) szr.Layout() self.Fit() self.Centre(wx.BOTH)
def __init__(self, parent, cleanup_obj): wx.Dialog.__init__(self, parent=parent, title="Confirm delete") 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= ("%d file(s) and %d directories have " + "been found matching the specified criteria; this will save %s of " + "disk space. Their paths are listed below. Click OK to " + "confirm, or Cancel to abort. You will not be able to recover these " + "paths once they have been deleted!") % (cleanup_obj.n_files, cleanup_obj.n_dirs, cleanup_obj.get_freed_space())) txt.Wrap(480) szr.Add(txt, 0, std_sizer_flags, 5) list_font = wx.Font(10, wx.FONTFAMILY_MODERN, wx.NORMAL, wx.NORMAL) if (cleanup_obj.n_dirs > 0): szr.Add(wx.StaticText(self, label="Directories to remove:"), 0, std_sizer_flags, 5) dir_box = wx.TextCtrl(self, style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_DONTWRAP, size=(480, 200)) dir_box.SetFont(list_font) szr.Add(dir_box, 0, std_sizer_flags, 5) for dir_name in cleanup_obj.dir_paths: dir_box.AppendText(dir_name + "\n") if (cleanup_obj.n_files > 0): szr.Add(wx.StaticText(self, label="Files to remove:"), 0, std_sizer_flags, 5) file_box = wx.TextCtrl(self, style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_DONTWRAP, size=(480, 200)) file_box.SetFont(list_font) szr.Add(file_box, 0, std_sizer_flags, 5) for file_name in cleanup_obj.file_paths: file_box.AppendText(file_name + "\n") add_ok_cancel_buttons(self, szr) self.Fit() self.Centre(wx.BOTH)
def __init__(self, *args, **kwds): default_caption = "The input data specify multiple unique symmetry "+ \ "and/or unit cell parameters. Please select the consensus settings "+\ "from the menus below." caption = kwds.pop("caption", default_caption) if (caption is None): caption = default_caption super(SymmetryChoiceDialog, self).__init__(*args, **kwds) style = self.GetWindowStyle() style |= wx.WS_EX_VALIDATE_RECURSIVELY | wx.RAISED_BORDER | wx.CAPTION self.SetWindowStyle(style) szr = wx.BoxSizer(wx.VERTICAL) self.SetSizer(szr) szr2 = wx.BoxSizer(wx.VERTICAL) szr.Add(szr2, 1, wx.ALL | wx.EXPAND, 10) caption_sizer = wx.BoxSizer(wx.HORIZONTAL) bmp = wx.StaticBitmap(self, -1, wxtbx.icons.symmetry.GetBitmap()) caption_sizer.Add(bmp, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) txt = wx.StaticText(self, -1, caption) txt.Wrap(480) caption_sizer.Add(txt, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) szr2.Add(caption_sizer, 0, wx.ALL, 0) szr3 = wx.BoxSizer(wx.HORIZONTAL) txt2 = wx.StaticText(self, -1, "Space group:") szr3.Add(txt2, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.space_group_chooser = wx.Choice(self, -1, size=(200, -1)) szr3.Add(self.space_group_chooser, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) szr2.Add(szr3, 0, wx.ALL, 5) szr4 = wx.BoxSizer(wx.HORIZONTAL) txt3 = wx.StaticText(self, -1, "Unit cell:") szr4.Add(txt3, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.unit_cell_chooser = wx.Choice(self, -1, size=(400, -1)) szr4.Add(self.unit_cell_chooser, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) szr2.Add(szr4, 0, wx.ALL, 5) add_ok_cancel_buttons(self, szr2) szr.Layout() self.Fit() self.Centre(wx.BOTH) self.unit_cells = [] self.space_groups = []
def __init__(self, parent, title, label, value=None, caption=None): style = wx.CAPTION|wx.CLOSE_BOX|wx.RAISED_BORDER| \ wx.WS_EX_VALIDATE_RECURSIVELY | wx.RESIZE_BORDER wx.Dialog.__init__(self, parent=parent, title=title, style=style) self.sizer = wx.BoxSizer(wx.VERTICAL) self.SetSizer(self.sizer) self.inner_sizer = wx.BoxSizer(wx.VERTICAL) self.sizer.Add(self.inner_sizer, 1, wx.EXPAND | wx.ALL, 5) if (caption is not None): caption_txt = wx.StaticText(self, -1, caption) caption_txt.Wrap(480) self.inner_sizer.Add(caption_txt, 0, wx.ALL, 5) input_szr = wx.BoxSizer(wx.HORIZONTAL) self.inner_sizer.Add(input_szr, 0, wx.ALIGN_CENTER) label_txt = wx.StaticText(self, -1, label + ":") input_szr.Add(label_txt, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.phil_ctrl = self.CreatePhilControl(value) input_szr.Add(self.phil_ctrl, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) add_ok_cancel_buttons(self, self.sizer) self.Fit() self.Centre(wx.BOTH)
def __init__ (self, *args, **kwds) : default_caption = "The input data specify multiple unique symmetry "+ \ "and/or unit cell parameters. Please select the consensus settings "+\ "from the menus below." caption = kwds.pop("caption", default_caption) if (caption is None) : caption = default_caption super(SymmetryChoiceDialog, self).__init__(*args, **kwds) style = self.GetWindowStyle() style |= wx.WS_EX_VALIDATE_RECURSIVELY|wx.RAISED_BORDER|wx.CAPTION self.SetWindowStyle(style) szr = wx.BoxSizer(wx.VERTICAL) self.SetSizer(szr) szr2 = wx.BoxSizer(wx.VERTICAL) szr.Add(szr2, 1, wx.ALL|wx.EXPAND, 10) caption_sizer = wx.BoxSizer(wx.HORIZONTAL) bmp = wx.StaticBitmap(self, -1, wxtbx.icons.symmetry.GetBitmap()) caption_sizer.Add(bmp, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) txt = wx.StaticText(self, -1, caption) txt.Wrap(480) caption_sizer.Add(txt, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) szr2.Add(caption_sizer, 0, wx.ALL, 0) szr3 = wx.BoxSizer(wx.HORIZONTAL) txt2 = wx.StaticText(self, -1, "Space group:") szr3.Add(txt2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) self.space_group_chooser = wx.Choice(self, -1, size=(200,-1)) szr3.Add(self.space_group_chooser, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) szr2.Add(szr3, 0, wx.ALL, 5) szr4 = wx.BoxSizer(wx.HORIZONTAL) txt3 = wx.StaticText(self, -1, "Unit cell:") szr4.Add(txt3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) self.unit_cell_chooser = wx.Choice(self, -1, size=(400,-1)) szr4.Add(self.unit_cell_chooser, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) szr2.Add(szr4, 0, wx.ALL, 5) add_ok_cancel_buttons(self, szr2) szr.Layout() self.Fit() self.Centre(wx.BOTH) self.unit_cells = [] self.space_groups = []
def __init__ (self, *args, **kwds) : wx.Dialog.__init__(self, *args, **kwds) szr = wx.BoxSizer(wx.VERTICAL) self.SetSizer(szr) szr2 = wx.BoxSizer(wx.VERTICAL) szr.Add(szr2, 0, wx.ALL|wx.ALIGN_CENTER, 10) txt = wx.StaticText(parent=self, label="Please enter the information required by your HTTP proxy. The "+ "authentication information may not be needed at all sites.", size=(400,-1)) txt.Wrap(400) szr2.Add(txt) grid = wx.FlexGridSizer(cols=2) szr2.Add(grid) grid.Add(wx.StaticText(self, label="HTTP proxy server:"), 0, std_sizer_flags, 5) self.server_ctrl = strctrl.StrCtrl(parent=self, size=(300,-1), name="HTTP proxy server") self.server_ctrl.SetOptional(False) grid.Add(self.server_ctrl, 0, std_sizer_flags, 5) grid.Add(wx.StaticText(self, label="Proxy port:"), 0, std_sizer_flags, 5) self.port_ctrl = intctrl.IntCtrl(parent=self, size=(100,-1), name="Proxy port") self.port_ctrl.SetOptional(False) grid.Add(self.port_ctrl, 0, std_sizer_flags, 5) grid.Add(wx.StaticText(self, label="User name:"), 0, std_sizer_flags, 5) self.user_ctrl = strctrl.StrCtrl(parent=self, size=(100,-1), name="User name") self.user_ctrl.SetOptional(False) grid.Add(self.user_ctrl, 0, std_sizer_flags, 5) grid.Add(wx.StaticText(self, label="Password:"******"Password", style=wx.TE_PASSWORD) self.password_ctrl.SetOptional(False) grid.Add(self.password_ctrl, 0, std_sizer_flags, 5) add_ok_cancel_buttons(self, szr) szr.Layout() self.Fit() self.Centre(wx.BOTH)
def __init__( self, title, message, choices, parent=None, choiceLabel=None, defaultChoice=-1, captionImage=None, showDefaultButton=False, ): super(ChoiceDialog, self).__init__(parent=parent, title=title) outer_sizer = wx.BoxSizer(wx.VERTICAL) self.SetSizer(outer_sizer) szr = wx.BoxSizer(wx.VERTICAL) outer_sizer.Add(szr, 1, wx.EXPAND | wx.ALL, 5) if captionImage is not None: assert 0 else: caption = wx.StaticText(parent=self, label=message) caption.Wrap(480) szr.Add(caption, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) choice_box = wx.BoxSizer(wx.HORIZONTAL) szr.Add(choice_box) if choiceLabel is not None: label = wx.StaticText(parent=self, label=choiceLabel) choice_box.Add(label, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.chooser = wx.Choice(parent=self, choices=choices) self.chooser.SetMinSize((200, -1)) choice_box.Add(self.chooser, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) if defaultChoice >= 0: self.chooser.SetSelection(defaultChoice) self.default_btn = None if showDefaultButton: self.default_btn = wx.CheckBox(parent=self, label="Always do this in the future") szr.Add(self.default_btn, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) add_ok_cancel_buttons(self, szr) self.Centre(wx.BOTH) outer_sizer.Fit(self)
def __init__ (self, parent, cleanup_obj) : wx.Dialog.__init__(self, parent=parent, title="Confirm delete") 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=("%d file(s) and %d directories have "+ "been found matching the specified criteria; this will save %s of "+ "disk space. Their paths are listed below. Click OK to "+ "confirm, or Cancel to abort. You will not be able to recover these "+ "paths once they have been deleted!") % (cleanup_obj.n_files, cleanup_obj.n_dirs, cleanup_obj.get_freed_space())) txt.Wrap(480) szr.Add(txt, 0, std_sizer_flags, 5) list_font = wx.Font(10, wx.FONTFAMILY_MODERN, wx.NORMAL, wx.NORMAL) if (cleanup_obj.n_dirs > 0) : szr.Add(wx.StaticText(self, label="Directories to remove:"), 0, std_sizer_flags, 5) dir_box = wx.TextCtrl(self, style=wx.TE_MULTILINE|wx.TE_READONLY|wx.TE_DONTWRAP, size=(480, 200)) dir_box.SetFont(list_font) szr.Add(dir_box, 0, std_sizer_flags, 5) for dir_name in cleanup_obj.dir_paths : dir_box.AppendText(dir_name + "\n") if (cleanup_obj.n_files > 0) : szr.Add(wx.StaticText(self, label="Files to remove:"), 0, std_sizer_flags, 5) file_box = wx.TextCtrl(self, style=wx.TE_MULTILINE|wx.TE_READONLY|wx.TE_DONTWRAP, size=(480, 200)) file_box.SetFont(list_font) szr.Add(file_box, 0, std_sizer_flags, 5) for file_name in cleanup_obj.file_paths : file_box.AppendText(file_name + "\n") add_ok_cancel_buttons(self, szr) self.Fit() self.Centre(wx.BOTH)
def __init__(self, title, message, choices, parent=None, choiceLabel=None, defaultChoice=-1, captionImage=None, showDefaultButton=False): super(ChoiceDialog, self).__init__(parent=parent, title=title) outer_sizer = wx.BoxSizer(wx.VERTICAL) self.SetSizer(outer_sizer) szr = wx.BoxSizer(wx.VERTICAL) outer_sizer.Add(szr, 1, wx.EXPAND | wx.ALL, 5) if (captionImage is not None): assert 0 else: caption = wx.StaticText(parent=self, label=message) caption.Wrap(480) szr.Add(caption, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) choice_box = wx.BoxSizer(wx.HORIZONTAL) szr.Add(choice_box) if (choiceLabel is not None): label = wx.StaticText(parent=self, label=choiceLabel) choice_box.Add(label, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.chooser = wx.Choice(parent=self, choices=choices) self.chooser.SetMinSize((200, -1)) choice_box.Add(self.chooser, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) if (defaultChoice >= 0): self.chooser.SetSelection(defaultChoice) self.default_btn = None if (showDefaultButton): self.default_btn = wx.CheckBox( parent=self, label="Always do this in the future") szr.Add(self.default_btn, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) add_ok_cancel_buttons(self, szr) self.Centre(wx.BOTH) outer_sizer.Fit(self)
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)