dialogs/BrowseLocationsDialog.py
changeset 1768 691083b5682a
parent 1766 c1e5b9f19483
child 1782 5b6ad7a7fd9d
equal deleted inserted replaced
1767:c74815729afd 1768:691083b5682a
    68 
    68 
    69 class BrowseLocationsDialog(wx.Dialog):
    69 class BrowseLocationsDialog(wx.Dialog):
    70 
    70 
    71     def __init__(self, parent, var_type, controller):
    71     def __init__(self, parent, var_type, controller):
    72         wx.Dialog.__init__(self, parent, title=_('Browse Locations'),
    72         wx.Dialog.__init__(self, parent, title=_('Browse Locations'),
    73               style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
    73                            style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
    74 
    74 
    75         main_sizer = wx.FlexGridSizer(cols=1, hgap=0, rows=3, vgap=10)
    75         main_sizer = wx.FlexGridSizer(cols=1, hgap=0, rows=3, vgap=10)
    76         main_sizer.AddGrowableCol(0)
    76         main_sizer.AddGrowableCol(0)
    77         main_sizer.AddGrowableRow(1)
    77         main_sizer.AddGrowableRow(1)
    78 
    78 
    79         locations_label = wx.StaticText(self, label=_('Locations available:'))
    79         locations_label = wx.StaticText(self, label=_('Locations available:'))
    80         main_sizer.AddWindow(locations_label, border=20,
    80         main_sizer.AddWindow(locations_label, border=20,
    81               flag=wx.TOP | wx.LEFT | wx.RIGHT | wx.GROW)
    81                              flag=wx.TOP | wx.LEFT | wx.RIGHT | wx.GROW)
    82 
    82 
    83         self.LocationsTree = wx.TreeCtrl(self,
    83         self.LocationsTree = wx.TreeCtrl(self,
    84               style=wx.TR_HAS_BUTTONS | wx.TR_SINGLE | wx.SUNKEN_BORDER | wx.TR_HIDE_ROOT | wx.TR_LINES_AT_ROOT)
    84                                          style=(wx.TR_HAS_BUTTONS |
       
    85                                                 wx.TR_SINGLE |
       
    86                                                 wx.SUNKEN_BORDER |
       
    87                                                 wx.TR_HIDE_ROOT |
       
    88                                                 wx.TR_LINES_AT_ROOT))
    85         self.LocationsTree.SetInitialSize(wx.Size(-1, 300))
    89         self.LocationsTree.SetInitialSize(wx.Size(-1, 300))
    86         self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnLocationsTreeItemActivated,
    90         self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnLocationsTreeItemActivated,
    87                   self.LocationsTree)
    91                   self.LocationsTree)
    88         main_sizer.AddWindow(self.LocationsTree, border=20,
    92         main_sizer.AddWindow(self.LocationsTree, border=20,
    89               flag=wx.LEFT | wx.RIGHT | wx.GROW)
    93                              flag=wx.LEFT | wx.RIGHT | wx.GROW)
    90 
    94 
    91         button_gridsizer = wx.FlexGridSizer(cols=5, hgap=5, rows=1, vgap=0)
    95         button_gridsizer = wx.FlexGridSizer(cols=5, hgap=5, rows=1, vgap=0)
    92         button_gridsizer.AddGrowableCol(1)
    96         button_gridsizer.AddGrowableCol(1)
    93         button_gridsizer.AddGrowableCol(3)
    97         button_gridsizer.AddGrowableCol(3)
    94         button_gridsizer.AddGrowableRow(0)
    98         button_gridsizer.AddGrowableRow(0)
    95         main_sizer.AddSizer(button_gridsizer, border=20,
    99         main_sizer.AddSizer(button_gridsizer, border=20,
    96               flag=wx.BOTTOM | wx.LEFT | wx.RIGHT | wx.GROW)
   100                             flag=wx.BOTTOM | wx.LEFT | wx.RIGHT | wx.GROW)
    97 
   101 
    98         direction_label = wx.StaticText(self, label=_('Direction:'))
   102         direction_label = wx.StaticText(self, label=_('Direction:'))
    99         button_gridsizer.AddWindow(direction_label,
   103         button_gridsizer.AddWindow(direction_label,
   100               flag=wx.ALIGN_CENTER_VERTICAL)
   104                                    flag=wx.ALIGN_CENTER_VERTICAL)
   101 
   105 
   102         self.DirFilterChoice = wx.ComboBox(self, style=wx.CB_READONLY)
   106         self.DirFilterChoice = wx.ComboBox(self, style=wx.CB_READONLY)
   103         self.Bind(wx.EVT_COMBOBOX, self.OnFilterChoice, self.DirFilterChoice)
   107         self.Bind(wx.EVT_COMBOBOX, self.OnFilterChoice, self.DirFilterChoice)
   104         button_gridsizer.AddWindow(self.DirFilterChoice,
   108         button_gridsizer.AddWindow(self.DirFilterChoice,
   105               flag=wx.GROW | wx.ALIGN_CENTER_VERTICAL)
   109                                    flag=wx.GROW | wx.ALIGN_CENTER_VERTICAL)
   106 
   110 
   107         filter_label = wx.StaticText(self, label=_('Type:'))
   111         filter_label = wx.StaticText(self, label=_('Type:'))
   108         button_gridsizer.AddWindow(filter_label,
   112         button_gridsizer.AddWindow(filter_label,
   109               flag=wx.ALIGN_CENTER_VERTICAL)
   113                                    flag=wx.ALIGN_CENTER_VERTICAL)
   110 
   114 
   111         self.TypeFilterChoice = wx.ComboBox(self, style=wx.CB_READONLY)
   115         self.TypeFilterChoice = wx.ComboBox(self, style=wx.CB_READONLY)
   112         self.Bind(wx.EVT_COMBOBOX, self.OnFilterChoice, self.TypeFilterChoice)
   116         self.Bind(wx.EVT_COMBOBOX, self.OnFilterChoice, self.TypeFilterChoice)
   113         button_gridsizer.AddWindow(self.TypeFilterChoice,
   117         button_gridsizer.AddWindow(self.TypeFilterChoice,
   114               flag=wx.GROW | wx.ALIGN_CENTER_VERTICAL)
   118                                    flag=wx.GROW | wx.ALIGN_CENTER_VERTICAL)
   115 
   119 
   116         button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL | wx.CENTRE)
   120         button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL | wx.CENTRE)
   117         self.Bind(wx.EVT_BUTTON, self.OnOK, button_sizer.GetAffirmativeButton())
   121         self.Bind(wx.EVT_BUTTON, self.OnOK, button_sizer.GetAffirmativeButton())
   118         button_gridsizer.AddSizer(button_sizer, flag=wx.ALIGN_RIGHT)
   122         button_gridsizer.AddSizer(button_sizer, flag=wx.ALIGN_RIGHT)
   119 
   123