dgpe cocoa: adjusted to the latest developments.

--HG--
extra : convert_revision : svn%3Ac306627e-7827-47d3-bdf0-9a457c9553a1/trunk%40149
This commit is contained in:
hsoft 2009-09-28 15:31:54 +00:00
parent 355c617de4
commit 9a44956d8f
2 changed files with 10 additions and 21 deletions

View File

@ -12,7 +12,7 @@ from dupeguru_pe import app_cocoa as app_pe_cocoa
# Fix py2app imports which chokes on relative imports
from dupeguru import app, app_cocoa, data, directories, engine, export, ignore, results, scanner
from dupeguru_pe import block, cache, matchbase, data
from hsfs import auto, manual, stats, tree, utils
from hsfs import auto, stats, tree
class PyApp(NSObject):
pass #fake class

View File

@ -34,31 +34,20 @@ PictureBlocks = mainBundle.classNamed_('PictureBlocks')
assert PictureBlocks is not None
class Photo(phys.File):
cls_info_map = {
'size': fs.IT_ATTRS,
'ctime': fs.IT_ATTRS,
'mtime': fs.IT_ATTRS,
'md5': fs.IT_MD5,
'md5partial': fs.IT_MD5,
'dimensions': fs.IT_EXTRA,
}
INITIAL_INFO = phys.File.INITIAL_INFO.copy()
INITIAL_INFO.update({
'dimensions': (0,0),
})
def _initialize_info(self,section):
super(Photo, self)._initialize_info(section)
if section == fs.IT_EXTRA:
self._info.update({
'dimensions': (0,0),
})
def _read_info(self,section):
super(Photo, self)._read_info(section)
if section == fs.IT_EXTRA:
def _read_info(self, field):
super(Photo, self)._read_info(field)
if field == 'dimensions':
size = PictureBlocks.getImageSize_(unicode(self.path))
self._info['dimensions'] = (size.width, size.height)
self.dimensions = (size.width, size.height)
def get_blocks(self, block_count_per_side):
try:
blocks = PictureBlocks.getBlocksFromImagePath_blockCount_scanArea_(unicode(self.path), block_count_per_side, 0)
blocks = PictureBlocks.getBlocksFromImagePath_blockCount_(unicode(self.path), block_count_per_side)
except Exception, e:
raise IOError('The reading of "%s" failed with "%s"' % (unicode(self.path), unicode(e)))
if not blocks: