dialogs/BrowseLocationsDialog.py
changeset 2301 5b8a7dd43f9f
parent 1881 091005ec69c4
child 2575 aee08bd135d8
equal deleted inserted replaced
2300:f19788028d99 2301:5b8a7dd43f9f
    43             (_("Input"), [LOCATION_VAR_INPUT]),
    43             (_("Input"), [LOCATION_VAR_INPUT]),
    44             (_("Output"), [LOCATION_VAR_OUTPUT]),
    44             (_("Output"), [LOCATION_VAR_OUTPUT]),
    45             (_("Memory"), [LOCATION_VAR_MEMORY])]
    45             (_("Memory"), [LOCATION_VAR_MEMORY])]
    46 
    46 
    47 
    47 
    48 DIRFILTERCHOICE_OPTIONS = dict([(_(option), filter) for option, filter in GetDirFilterChoiceOptions()])
       
    49 
       
    50 
       
    51 def GetTypeFilterChoiceOptions():
    48 def GetTypeFilterChoiceOptions():
    52     _ = NoTranslate
    49     _ = NoTranslate
    53     return [_("All"),
    50     return [_("All"),
    54             _("Type and derivated"),
    51             _("Type and derivated"),
    55             _("Type strict")]
    52             _("Type strict")]
    70 
    67 
    71     def __init__(self, parent, var_type, controller):
    68     def __init__(self, parent, var_type, controller):
    72         wx.Dialog.__init__(self, parent, title=_('Browse Locations'),
    69         wx.Dialog.__init__(self, parent, title=_('Browse Locations'),
    73                            style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
    70                            style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
    74 
    71 
       
    72         self.DIRFILTERCHOICE_OPTIONS = dict(
       
    73             [(_(option), filter) for option, filter in GetDirFilterChoiceOptions()])
    75         main_sizer = wx.FlexGridSizer(cols=1, hgap=0, rows=3, vgap=10)
    74         main_sizer = wx.FlexGridSizer(cols=1, hgap=0, rows=3, vgap=10)
    76         main_sizer.AddGrowableCol(0)
    75         main_sizer.AddGrowableCol(0)
    77         main_sizer.AddGrowableRow(1)
    76         main_sizer.AddGrowableRow(1)
    78 
    77 
    79         locations_label = wx.StaticText(self, label=_('Locations available:'))
    78         locations_label = wx.StaticText(self, label=_('Locations available:'))
   157 
   156 
   158         self.RefreshLocationsTree()
   157         self.RefreshLocationsTree()
   159         self.Fit()
   158         self.Fit()
   160 
   159 
   161     def RefreshFilters(self):
   160     def RefreshFilters(self):
   162         self.DirFilter = DIRFILTERCHOICE_OPTIONS[self.DirFilterChoice.GetStringSelection()]
   161         self.DirFilter = self.DIRFILTERCHOICE_OPTIONS[self.DirFilterChoice.GetStringSelection()]
   163         self.TypeFilter = self.TypeFilterChoice.GetSelection()
   162         self.TypeFilter = self.TypeFilterChoice.GetSelection()
   164 
   163 
   165     def RefreshLocationsTree(self):
   164     def RefreshLocationsTree(self):
   166         root = self.LocationsTree.GetRootItem()
   165         root = self.LocationsTree.GetRootItem()
   167         if not root.IsOk():
   166         if not root.IsOk():