dialogs/BrowseLocationsDialog.py
branchwxPython4
changeset 3303 0ffb41625592
parent 2575 aee08bd135d8
child 3750 f62625418bff
equal deleted inserted replaced
3302:c89fc366bebd 3303:0ffb41625592
    74         main_sizer = wx.FlexGridSizer(cols=1, hgap=0, rows=4, vgap=10)
    74         main_sizer = wx.FlexGridSizer(cols=1, hgap=0, rows=4, vgap=10)
    75         main_sizer.AddGrowableCol(0)
    75         main_sizer.AddGrowableCol(0)
    76         main_sizer.AddGrowableRow(1)
    76         main_sizer.AddGrowableRow(1)
    77 
    77 
    78         locations_label = wx.StaticText(self, label=_('Locations available:'))
    78         locations_label = wx.StaticText(self, label=_('Locations available:'))
    79         main_sizer.AddWindow(locations_label, border=20,
    79         main_sizer.Add(locations_label, border=20,
    80                              flag=wx.TOP | wx.LEFT | wx.RIGHT | wx.GROW)
    80                              flag=wx.TOP | wx.LEFT | wx.RIGHT | wx.GROW)
    81 
    81 
    82         self.LocationsTree = wx.TreeCtrl(self,
    82         self.LocationsTree = wx.TreeCtrl(self,
    83                                          style=(wx.TR_HAS_BUTTONS |
    83                                          style=(wx.TR_HAS_BUTTONS |
    84                                                 wx.TR_SINGLE |
    84                                                 wx.TR_SINGLE |
    86                                                 wx.TR_HIDE_ROOT |
    86                                                 wx.TR_HIDE_ROOT |
    87                                                 wx.TR_LINES_AT_ROOT))
    87                                                 wx.TR_LINES_AT_ROOT))
    88         self.LocationsTree.SetInitialSize(wx.Size(-1, 300))
    88         self.LocationsTree.SetInitialSize(wx.Size(-1, 300))
    89         self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnLocationsTreeItemActivated,
    89         self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnLocationsTreeItemActivated,
    90                   self.LocationsTree)
    90                   self.LocationsTree)
    91         main_sizer.AddWindow(self.LocationsTree, border=20,
    91         main_sizer.Add(self.LocationsTree, border=20,
    92                              flag=wx.LEFT | wx.RIGHT | wx.GROW)
    92                              flag=wx.LEFT | wx.RIGHT | wx.GROW)
    93 
    93 
    94         self.RenameCheckBox = wx.CheckBox(self, label=_("Rename variable to signal name"))
    94         self.RenameCheckBox = wx.CheckBox(self, label=_("Rename variable to signal name"))
    95         self.Config = wx.ConfigBase.Get()
    95         self.Config = wx.ConfigBase.Get()
    96         default_checked = self.Config.Read("RenameVariableOnLocationChange") == "True"
    96         default_checked = self.Config.Read("RenameVariableOnLocationChange") == "True"
    97         self.RenameCheckBox.SetValue(default_checked)
    97         self.RenameCheckBox.SetValue(default_checked)
    98         self.do_rename = default_checked
    98         self.do_rename = default_checked
    99 
    99 
   100         main_sizer.AddWindow(self.RenameCheckBox, border=20,
   100         main_sizer.Add(self.RenameCheckBox, border=20,
   101                              flag=wx.LEFT | wx.RIGHT | wx.GROW)
   101                              flag=wx.LEFT | wx.RIGHT | wx.GROW)
   102 
   102 
   103         button_gridsizer = wx.FlexGridSizer(cols=5, hgap=5, rows=1, vgap=0)
   103         button_gridsizer = wx.FlexGridSizer(cols=5, hgap=5, rows=1, vgap=0)
   104         button_gridsizer.AddGrowableCol(1)
   104         button_gridsizer.AddGrowableCol(1)
   105         button_gridsizer.AddGrowableCol(3)
   105         button_gridsizer.AddGrowableCol(3)
   106         button_gridsizer.AddGrowableRow(0)
   106         button_gridsizer.AddGrowableRow(0)
   107         main_sizer.AddSizer(button_gridsizer, border=20,
   107         main_sizer.Add(button_gridsizer, border=20,
   108                             flag=wx.BOTTOM | wx.LEFT | wx.RIGHT | wx.GROW)
   108                             flag=wx.BOTTOM | wx.LEFT | wx.RIGHT | wx.GROW)
   109 
   109 
   110         direction_label = wx.StaticText(self, label=_('Direction:'))
   110         direction_label = wx.StaticText(self, label=_('Direction:'))
   111         button_gridsizer.AddWindow(direction_label,
   111         button_gridsizer.Add(direction_label,
   112                                    flag=wx.ALIGN_CENTER_VERTICAL)
   112                                    flag=wx.ALIGN_CENTER_VERTICAL)
   113 
   113 
   114         self.DirFilterChoice = wx.ComboBox(self, style=wx.CB_READONLY)
   114         self.DirFilterChoice = wx.ComboBox(self, style=wx.CB_READONLY)
   115         self.Bind(wx.EVT_COMBOBOX, self.OnFilterChoice, self.DirFilterChoice)
   115         self.Bind(wx.EVT_COMBOBOX, self.OnFilterChoice, self.DirFilterChoice)
   116         button_gridsizer.AddWindow(self.DirFilterChoice,
   116         button_gridsizer.Add(self.DirFilterChoice,
   117                                    flag=wx.GROW | wx.ALIGN_CENTER_VERTICAL)
   117                                    flag=wx.GROW | wx.ALIGN_CENTER_VERTICAL)
   118 
   118 
   119         filter_label = wx.StaticText(self, label=_('Type:'))
   119         filter_label = wx.StaticText(self, label=_('Type:'))
   120         button_gridsizer.AddWindow(filter_label,
   120         button_gridsizer.Add(filter_label,
   121                                    flag=wx.ALIGN_CENTER_VERTICAL)
   121                                    flag=wx.ALIGN_CENTER_VERTICAL)
   122 
   122 
   123         self.TypeFilterChoice = wx.ComboBox(self, style=wx.CB_READONLY)
   123         self.TypeFilterChoice = wx.ComboBox(self, style=wx.CB_READONLY)
   124         self.Bind(wx.EVT_COMBOBOX, self.OnFilterChoice, self.TypeFilterChoice)
   124         self.Bind(wx.EVT_COMBOBOX, self.OnFilterChoice, self.TypeFilterChoice)
   125         button_gridsizer.AddWindow(self.TypeFilterChoice,
   125         button_gridsizer.Add(self.TypeFilterChoice,
   126                                    flag=wx.GROW | wx.ALIGN_CENTER_VERTICAL)
   126                                    flag=wx.GROW | wx.ALIGN_CENTER_VERTICAL)
   127 
   127 
   128         button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL | wx.CENTRE)
   128         button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL | wx.CENTRE)
   129         self.Bind(wx.EVT_BUTTON, self.OnOK, button_sizer.GetAffirmativeButton())
   129         self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.GetAffirmativeId())
   130         button_gridsizer.AddSizer(button_sizer, flag=wx.ALIGN_RIGHT)
   130         button_gridsizer.Add(button_sizer, flag=wx.ALIGN_RIGHT)
   131 
   131 
   132         self.SetSizer(main_sizer)
   132         self.SetSizer(main_sizer)
   133 
   133 
   134         self.Controller = controller
   134         self.Controller = controller
   135         self.VarType = var_type
   135         self.VarType = var_type