store macro information with identifier (instead of just True) for better overriding and reusing of predefined macro entries

This commit is contained in:
Helmut Merz 2011-10-09 09:53:38 +02:00
parent 1aa90f68a2
commit d3ae9f4f64

View file

@ -1,5 +1,5 @@
# #
# Copyright (c) 2010 Helmut Merz helmutm@cy55.de # Copyright (c) 2011 Helmut Merz helmutm@cy55.de
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -98,8 +98,6 @@ class Macros(dict):
# make sure a certain resource is only registered once # make sure a certain resource is only registered once
if identifier in self.identifiers: if identifier in self.identifiers:
return return
#self.identifiers.add(identifier)
self.identifiers[identifier] = True
if template is None: if template is None:
template = self.standardTemplate template = self.standardTemplate
if name is None: if name is None:
@ -107,6 +105,8 @@ class Macros(dict):
macro = Macro(template, name, priority, identifier=identifier, **kw) macro = Macro(template, name, priority, identifier=identifier, **kw)
entry = self.setdefault(slot, []) entry = self.setdefault(slot, [])
entry.append(macro) entry.append(macro)
if identifier:
self.identifiers[identifier] = macro
def hide(self, identifier): def hide(self, identifier):
self.identifiers[identifier] = False self.identifiers[identifier] = False