def setup_listctrl(self, list=None): if not list and not callable(self.list_generator): return selectedData = self.listctrl.GetSelectedData() if self.list_generator: list = self.list_generator() self.listctrl.DeleteAllItems() namedict = {} namelist = [] for item in list: if isinstance(item, tuple): namelist.append(item[0]) namedict[item[0]] = item[1] else: if hasattr(item,'__name__'): name = item.__name__ else: name = str(item) namelist.append(name) namedict[name] = item if self.sort: sort_case_insensitive(namelist) for key in namelist: self.listctrl.AddItem( key, namedict[key]) i = self.listctrl.FindData(selectedData) if i != -1: self.listctrl.SelectItem(i) self.data = self.listctrl.GetSelectedData() else: self.data = None self.set_tooltip()
def get_group_list(): group_list = [DEFAULT_GROUP] last_group = "" groups = group_dict.values() sort_case_insensitive(groups) for group in groups: if last_group != group: group_list.append(group) last_group = group return group_list
def object_list_generator(self): objdict = get_available_objects() if self.return_strings: objlist = objdict.keys() else: objlist = [(name, objdict[name]) for name in objdict.keys()] sort_case_insensitive(objlist) for item in self.aguidata['prepend_list']: objlist.insert(0, item) for item in self.aguidata['append_list']: objlist.append(item) return objlist
def scene_list_generator(self): scenedict = get_available_scenes( useWorking = wx.GetApp().projectObject._use_working_scene) if not self.aguidata['show_hidden']: for item in scenedict.keys(): if item.startswith("__"): scenedict.pop(item) if self.return_strings: scenelist = scenedict.keys() else: scenelist = [(name, scenedict[name]) for name in scenedict.keys()] sort_case_insensitive(scenelist) for item in self.aguidata['prepend_list']: scenelist.insert(0, item) for item in self.aguidata['append_list']: scenelist.append(item) return scenelist