Changeset 698

Show
Ignore:
Timestamp:
02/15/10 12:36:59 (6 months ago)
Author:
tal
Message:
Moved the private _notificationName to a new, public changeNotificationName attribute. Raise a deprecation warning if _notificationName is being set by a subclass and automatically move it to the new attribute.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • packages/defcon/trunk/Lib/defcon/objects/anchor.py

    r695 r698  
    1515    """ 
    1616 
    17     _notificationName = "Anchor.Changed" 
     17    changeNotificationName = "Anchor.Changed" 
    1818 
    1919    def __init__(self): 
  • packages/defcon/trunk/Lib/defcon/objects/base.py

    r697 r698  
    2323    """ 
    2424 
    25     _notificationName = "BaseObject.Changed" 
     25    changeNotificationName = "BaseObject.Changed" 
    2626    beginUndoNotificationName = "BaseObject.BeginUndo" 
    2727    endUndoNotificationName = "BaseObject.EndUndo" 
    2828    beginRedoNotificationName = "BaseObject.BeginRedo" 
    2929    endRedoNotificationName = "BaseObject.EndRedo" 
    30  
    3130 
    3231    def __init__(self): 
     
    3635        self._dataOnDiskTimeStamp = None 
    3736        self._undoManager = None 
     37        # handle the old _notificationName attribute 
     38        if hasattr(self, "_notificationName"): 
     39            from warnings import warn 
     40            warn( 
     41                "_notificationName has been deprecated. Use changeNotificationName instead.", 
     42                DeprecationWarning 
     43            ) 
     44            self.changeNotificationName = self._notificationName 
     45        self._notificationName = self.changeNotificationName 
    3846 
    3947    # ------ 
     
    207215        self._dirty = value 
    208216        if self._dispatcher is not None: 
    209             self.dispatcher.postNotification(notification=self._notificationName, observable=self) 
     217            self.dispatcher.postNotification(notification=self.changeNotificationName, observable=self) 
    210218 
    211219    def _get_dirty(self): 
  • packages/defcon/trunk/Lib/defcon/objects/component.py

    r695 r698  
    1717    """ 
    1818 
    19     _notificationName = "Component.Changed" 
     19    changeNotificationName = "Component.Changed" 
    2020 
    2121    def __init__(self): 
  • packages/defcon/trunk/Lib/defcon/objects/contour.py

    r697 r698  
    3434    """ 
    3535 
    36     _notificationName = "Contour.Changed" 
     36    changeNotificationName = "Contour.Changed" 
    3737 
    3838    def __init__(self, pointClass=None): 
  • packages/defcon/trunk/Lib/defcon/objects/features.py

    r695 r698  
    1616    """ 
    1717 
    18     _notificationName = "Features.Changed" 
     18    changeNotificationName = "Features.Changed" 
    1919    beginUndoNotificationName = "Features.BeginUndo" 
    2020    endUndoNotificationName = "Features.EndUndo" 
  • packages/defcon/trunk/Lib/defcon/objects/font.py

    r687 r698  
    132132    """ 
    133133 
    134     _notificationName = "Font.Changed" 
     134    changeNotificationName = "Font.Changed" 
    135135 
    136136    def __init__(self, path=None, 
     
    10671067                glyph = self._glyphs[reference] 
    10681068                glyph.destroyAllRepresentations(None) 
    1069                 glyph.dispatcher.postNotification(notification=glyph._notificationName, observable=glyph) 
     1069                glyph.dispatcher.postNotification(notification=glyph.changeNotificationName, observable=glyph) 
    10701070                referenceChanges.add(reference) 
    10711071 
  • packages/defcon/trunk/Lib/defcon/objects/glyph.py

    r697 r698  
    4646    """ 
    4747 
    48     _notificationName = "Glyph.Changed" 
     48    changeNotificationName = "Glyph.Changed" 
    4949    beginUndoNotificationName = "Glyph.BeginUndo" 
    5050    endUndoNotificationName = "Glyph.EndUndo" 
  • packages/defcon/trunk/Lib/defcon/objects/groups.py

    r695 r698  
    5757    """ 
    5858 
    59     _notificationName = "Groups.Changed" 
     59    changeNotificationName = "Groups.Changed" 
    6060    beginUndoNotificationName = "Groups.BeginUndo" 
    6161    endUndoNotificationName = "Groups.EndUndo" 
  • packages/defcon/trunk/Lib/defcon/objects/info.py

    r695 r698  
    2424    """ 
    2525 
    26     _notificationName = "Info.Changed" 
     26    changeNotificationName = "Info.Changed" 
    2727    beginUndoNotificationName = "Info.BeginUndo" 
    2828    endUndoNotificationName = "Info.EndUndo" 
  • packages/defcon/trunk/Lib/defcon/objects/kerning.py

    r695 r698  
    3737    """ 
    3838 
    39     _notificationName = "Kerning.Changed" 
     39    changeNotificationName = "Kerning.Changed" 
    4040    beginUndoNotificationName = "Kerning.BeginUndo" 
    4141    endUndoNotificationName = "Kerning.EndUndo" 
  • packages/defcon/trunk/Lib/defcon/objects/lib.py

    r695 r698  
    3636    """ 
    3737 
    38     _notificationName = "Lib.Changed" 
     38    changeNotificationName = "Lib.Changed" 
    3939    beginUndoNotificationName = "Lib.BeginUndo" 
    4040    endUndoNotificationName = "Lib.EndUndo" 
  • packages/defcon/trunk/Lib/defcon/objects/point.py

    r695 r698  
    1515    """ 
    1616 
    17     _notificationName = "Point.Changed" 
     17    changeNotificationName = "Point.Changed" 
    1818 
    1919    __slots__ = ["_x", "_y", "_segmentType", "_smooth", "_name"] 
  • packages/defcon/trunk/Lib/defcon/objects/uniData.py

    r596 r698  
    4040    """ 
    4141 
    42     _notificationName = "UnicodeData.Changed" 
     42    changeNotificationName = "UnicodeData.Changed" 
    4343 
    4444    def __init__(self): 
     
    7272            del self._forcedUnicodeToGlyphName[fourcedValue] 
    7373        if self.dispatcher is not None: 
    74             self.dispatcher.postNotification(notification=self._notificationName, observable=self) 
     74            self.dispatcher.postNotification(notification=self.changeNotificationName, observable=self) 
    7575 
    7676    def addGlyphData(self, glyphName, values): 
     
    9090            self._dict[value] = glyphList 
    9191        if self.dispatcher is not None: 
    92             self.dispatcher.postNotification(notification=self._notificationName, observable=self) 
     92            self.dispatcher.postNotification(notification=self.changeNotificationName, observable=self) 
    9393 
    9494    def __delitem__(self, value): 
     
    104104        del self._dict[value] 
    105105        if self.dispatcher is not None: 
    106             self.dispatcher.postNotification(notification=self._notificationName, observable=self) 
     106            self.dispatcher.postNotification(notification=self.changeNotificationName, observable=self) 
    107107 
    108108    def __setitem__(self, value, glyphList): 
     
    117117                del self._glyphNameToForcedUnicode[glyphName] 
    118118        if self.dispatcher is not None: 
    119             self.dispatcher.postNotification(notification=self._notificationName, observable=self) 
     119            self.dispatcher.postNotification(notification=self.changeNotificationName, observable=self) 
    120120 
    121121    def clear(self): 
     
    143143            self._dict[value] = list(glyphList) 
    144144        if self.dispatcher is not None: 
    145             self.dispatcher.postNotification(notification=self._notificationName, observable=self) 
     145            self.dispatcher.postNotification(notification=self.changeNotificationName, observable=self) 
    146146 
    147147    # -------