def registerItemType(cls, itemclass, menuString=None): """Add an item type to the list of addable items. """ if menuString is None: menuString = itemclass.typeName() if itemclass.__name__ not in items.itemTypes(): items.registerItemType(itemclass) cls._addTypes[menuString] = itemclass.__name__
def registerItemType(self, itemclass, menuString=None): """Add an item type to the list of addable items. """ if menuString is None: menuString = itemclass.typeName() if itemclass.__name__ not in items.itemTypes(): items.registerItemType(itemclass) self._addTypes[menuString] = itemclass.__name__ self.addCombo.addItem(menuString)
def window(self): return self.ui class AffPyramidCanvasItem(CanvasItem): """For displaying AFF image pyramids """ _typeName = "AFF Image Pyramid" def __init__(self, handle, **kwds): from affpyramid.ui import AffImageItem kwds.pop('viewRect', None) self.affitem = AffImageItem(handle.name()) opts = {'movable': True, 'rotatable': True, 'handle': handle} opts.update(kwds) if opts.get('name') is None: opts['name'] = handle.shortName() opts['defaultUserTransform'] = {'scale': (0.36e-6, 0.36e-6)} CanvasItem.__init__(self, self.affitem, **opts) @classmethod def checkFile(cls, fh): name = fh.shortName() if name.endswith('.aff'): return 10 else: return 0 registerItemType(AffPyramidCanvasItem)
def window(self): return self.ui class AffPyramidCanvasItem(CanvasItem): """For displaying AFF image pyramids """ _typeName = "AFF Image Pyramid" def __init__(self, handle, **kwds): from affpyramid.ui import AffImageItem kwds.pop('viewRect', None) self.affitem = AffImageItem(handle.name()) opts = {'movable': True, 'rotatable': True, 'handle': handle} opts.update(kwds) if opts.get('name') is None: opts['name'] = handle.shortName() opts['defaultUserTransform'] = {'scale': (0.36e-6, 0.36e-6)} CanvasItem.__init__(self, self.affitem, **opts) @classmethod def checkFile(cls, fh): name = fh.shortName() if name.endswith('.aff'): return 10 else: return 0 registerItemType(AffPyramidCanvasItem)