def __init__(self, *args, **kwargs): styles = kwargs.get('styles', {}) self.update_draw_bullets_methods(styles) global map_types_item self.map_types_item = setup_map_types_item(item_types_map) Tree.__init__(self, *args, **kwargs) for t in self.item_types: if 'create_%s'%t.__name__ in globals().keys(): setattr(self, 'create_%s'%t.__name__, globals()['create_%s'%t.__name__])
def __init__(self, *args, **kwargs): if config.nbtTreeSettings.useBulletStyles.get() and bullet_styles.get( TAG_Compound, [''] * 4)[2] != '': self.draw_opened_bullet = self.draw_closed_bullet = self.draw_TAG_bullet styles = kwargs.get('styles', {}) for key in styles.keys(): if hasattr(key, '__name__'): name = key.__name__ elif type(key) in (str, unicode): name = key else: name = repr(key) setattr(self, 'draw_%s_bullet' % name, self.draw_TAG_bullet) Tree.__init__(self, *args, **kwargs)
def add_child(self, types_item=None): if types_item is None: parent = self.selected_item p_type = parent[7] if p_type == TAG_List: k = parent[9].list_type v = None for key, value in item_types_map.items(): if globals().get(key.__name__.upper(), -1) == k: v = value break if v is None: return types_item = {v[0]: (key, v[1], v[2])} Tree.add_child(self, types_item)
def click_item(self, *args, **kwargs): Tree.click_item(self, *args, **kwargs) if self._parent and self.selected_item: self._parent.update_side_panel(self.selected_item)
def _draw_closed_bullet(self, *args, **kwargs): return Tree.draw_closed_bullet(self, *args, **kwargs)
def _draw_opened_bullet(self, *args, **kwargs): return Tree.draw_opened_bullet(self, *args, **kwargs)