'List Slic3r configurations and create menu'

def load_slic3r_configs(self, menus):

    orig_appname = self.app.GetAppName()
    self.app.SetAppName('Slic3r')
    configpath = wx.StandardPaths.Get().GetUserDataDir()
    self.app.SetAppName(orig_appname)
    self.slic3r_configpath = configpath
    configfile = os.path.join(configpath, 'slic3r.ini')
    config = self.read_slic3r_config(configfile)
    version = config.get('dummy', 'version')
    self.slic3r_configs = {}
    for cat in menus:
        menu = menus[cat]
        pattern = os.path.join(configpath, cat, '*.ini')
        files = sorted(glob.glob(pattern))
        try:
            preset = config.get('presets', cat)
            if (version.split('.') >= ['1', '3', '0']):
                preset += '.ini'
            self.slic3r_configs[cat] = preset
        except:
            preset = None
            self.slic3r_configs[cat] = None
        for f in files:
            name = os.path.splitext(os.path.basename(f))[0]
            item = menu.Append((-1), name, f, wx.ITEM_RADIO)
            item.Check((os.path.basename(f) == preset))
            self.Bind(wx.EVT_MENU, (lambda event, cat=cat, f=f: self.set_slic3r_config(configfile, cat, f)), item)
