""" The below results in this error message: Chandler encountered an unexpected problem while trying to start. Here are the bottom 7 frames of the stack: File "/Users/rae/work/osaf/chandler/chandler/application/schema.py", line 1277, in synchronize module = importString(moduleName) File "/Users/rae/work/osaf/chandler/chandler/application/schema.py", line 1045, in importString item = __import__('.'.join(path), globalDict, globalDict, ['__name__']) File "/Users/rae/work/osaf/chandler/chandler/parcels/osaf/app/__init__.py", line 9, in ? from osaf.framework import scripting File "/Users/rae/work/osaf/chandler/chandler/parcels/osaf/framework/scripting.py", line 11, in ? import osaf.framework.blocks.detail.Detail as Detail File "/Users/rae/work/osaf/chandler/chandler/parcels/osaf/framework/blocks/detail/__init__.py", line 2, in ? from detailblocks import ( File "/Users/rae/work/osaf/chandler/chandler/parcels/osaf/framework/blocks/detail/detailblocks.py", line 26, in ? from Detail import * File "/Users/rae/work/osaf/chandler/chandler/parcels/osaf/framework/blocks/detail/Detail.py", line 578, in ? class MarkupButton(MultiStateButton): TypeError: Error when calling the metaclass bases module.__init__() takes at most 2 arguments (3 given) """ class MarkupButton(MultiStateButton): """ Just like MultiStateButton, except that it uses wx.GetApp().GetImage as the proviider of bitmaps. """ def __init__(self, *args, **kwds): if kwds.get("bitmapProvider") is None: kwds["bitmapProvider"]=wx.GetApp().GetImage super(MarkupButton, self).__init__(parent, *args, **kwds) # DetailStampButton2 is at the bottom, and it has no __init() class CalendarStampBlock(DetailStampButton2): """ Calendar button in the Markup Bar """ def stampMixinClass(self): return Calendar.CalendarEventMixin def makeMarkupBar(parcel, oldVersion): """ Build the markup bar. """ # [[[ lots of code omitted here ]]] calendarStamp2 = \ CalendarStampBlock2.template('CalendarStamp', title=messages.STAMP_CALENDAR, multibitmaps=(isEvent, notEvent), helpString=messages.STAMP_CALENDAR_HELP, event=buttonPressed) class DetailStampButton2(DetailSynchronizer, MarkupButton): """ Common base class for the stamping buttons in the Markup Bar """ def stampMixinClass(self): # return the class of this stamp's Mixin Kind (bag of kind-specific attributes) raise NotImplementedError, "%s.stampMixinClass()" % (type(self)) def synchronizeItemDetail (self, item): # toggle this button to reflect the kind of the selected item mixinClass = self.stampMixinClass() mixinKind = mixinClass.getKind(self.itsView) shouldToggleBasedOnClass = isinstance(item, mixinClass) shouldToggleBasedOnKind = item.isItemOf(mixinKind) assert shouldToggleBasedOnClass == shouldToggleBasedOnKind, \ "Class/Kind mismatch! Item is class %s, kind %s; " \ "stamping with class %s, kind %s" % ( item.__class__.__name__, item.itsKind.itsName, mixinClass.__name__, mixinKind.itsName) if(shouldToggleBasedOnKind): self.parentBlock.widget.SetState("stamped") else: self.parentBlock.widget.SetState("unstamped") return False def onButtonPressedEvent (self, event): # Rekind the item by adding or removing the associated Mixin Kind Block.Block.finishEdits() item = self.item if not item or not self._isStampable(item): return mixinKind = self.stampMixinClass().getKind(self.itsView) if not item.itsKind.isKindOf(mixinKind): operation = 'add' else: operation = 'remove' # Now change the kind and class of this item #logger.debug("%s: stamping: %s %s to %s", debugName(self), operation, mixinKind, debugName(item)) item.StampKind(operation, mixinKind) #logger.debug("%s: done stamping: %s %s to %s", debugName(self), operation, mixinKind, debugName(item)) def onButtonPressedEventUpdateUI(self, event): item = self.item enable = item is not None and self._isStampable(item) and \ item.isAttributeModifiable('displayName') event.arguments ['Enable'] = enable def _isStampable(self, item): # for now, any ContentItem is stampable. This may change if Mixin rules/policy change return item.isItemOf(items.ContentItem.getKind(self.itsView))