home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2011 February / maximum-cd-2011-02.iso / DiscContents / digsby_setup85.exe / lib / gui / native / mac / maciconeditor.pyo (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2010-11-24  |  2.1 KB  |  69 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.6)
  3.  
  4. import os
  5. import wx
  6. import objc
  7. from AppKit import *
  8. from Foundation import *
  9. from Quartz import *
  10. from machelpers import *
  11. NSApplicationLoad()
  12.  
  13. class IconEditor(object):
  14.     
  15.     def __init__(self, parent, icon = ''):
  16.         self.image_changed = False
  17.         nspool().__enter__()
  18.         
  19.         try:
  20.             self.picTaker = IKPictureTaker.alloc().init()
  21.             
  22.             try:
  23.                 if not icon == '':
  24.                     data = NSData.dataWithBytes_length_(icon, len(icon))
  25.                     image = NSImage.alloc().initWithData_(data)
  26.                     if image:
  27.                         self.picTaker.setInputImage_(image)
  28.                     
  29.             except:
  30.                 nspool().__exit__
  31.                 nspool()
  32.                 raise 
  33.  
  34.         finally:
  35.             pass
  36.  
  37.  
  38.     
  39.     def RaiseExisting(cls):
  40.         return False
  41.  
  42.     RaiseExisting = classmethod(RaiseExisting)
  43.     
  44.     def Prompt(self, callback):
  45.         result = self.picTaker.runModal()
  46.         if result == NSOKButton:
  47.             self.image_changed = True
  48.             self.output = self.picTaker.outputImage()
  49.             callback()
  50.         
  51.  
  52.     
  53.     def Bytes(self):
  54.         rep = None
  55.         for arep in self.output.representations():
  56.             if isinstance(arep, NSBitmapImageRep):
  57.                 rep = arep
  58.                 continue
  59.         
  60.         return str(rep.representationUsingType_properties_(NSPNGFileType, None).bytes())
  61.  
  62.     Bytes = property(Bytes)
  63.     
  64.     def ImageChanged(self):
  65.         return self.image_changed
  66.  
  67.     ImageChanged = property(ImageChanged)
  68.  
  69.