class YamlProfileAliasProvider(MemoryProfileAliasProvider): def __init__(self, subject): self.cache = DiskCache('alias_cache_v1.yaml', format='yaml', compression = 'gzip', validator=alias_cache_validator) self.store = self.cache.safe_load(dict) super(YamlProfileAliasProvider, self).__init__(subject, self.store) def set_alias(self, name, service, protocol, alias): if alias is None or alias == name: return if super(YamlProfileAliasProvider, self).find_alias(name, service, protocol) != alias: super(YamlProfileAliasProvider, self).set_alias(name, service, protocol, alias) self.cache.save(self.store)
def __init__(self, conn_accts): Observable.__init__(self) self.dirty = False self.sorting_paused = True #self._listen_for_pref_load() self.rebuild_timer = wx.PyTimer(self.rebuild_later) self.rebuild_timer.StartRepeating(500) # Holds the final view that goes into the TreeList. self.view = DGroup('__root__', [], []) self.info = {} # Rootgroups are the "protocol" rootgroups with the original, # unmodified versions of the buddy list structure for each account self.rootgroups = [] self.base_attrs = frozenset([None, 'alias', 'status', 'status_message', 'icon', 'icon_hash', 'entering', 'leaving', 'idle', 'away','mobile']) self.attrs = set(self.base_attrs) # conn_accts must be an observable list of connected accounts conn_accts.add_observer(self.on_connections_changed) self.metacontacts = MetaContactManager(self) self._init_order() self.contact_info_changed = Delegate() self.dispatch = ContactDispatcher() self.caches = dict(tofrom = DiskCache('im_history.dat', validator = validate_tofrom)) self.load_local_data() # save local to/from data on exit hooks.register('digsby.app.exit', self.save_local_data) self._search_by = u'' self._search_results = (0, 0) # number of contacts found in last two searches #todo: make then_bys based on a pref self.sort_models = sort_model.build_models( then_bys = 1, obj = self) self.sbw = sort_model.SortByWatcher(self.sort_models)
def __init__(self, subject): self.cache = DiskCache('alias_cache_v1.yaml', format='yaml', compression = 'gzip', validator=alias_cache_validator) self.store = self.cache.safe_load(dict) super(YamlProfileAliasProvider, self).__init__(subject, self.store)