mirror of
				https://github.com/arsenetar/dupeguru.git
				synced 2025-09-11 17:58:17 +00:00 
			
		
		
		
	dgpe cocoa: adjusted to the latest developments.
--HG-- extra : convert_revision : svn%3Ac306627e-7827-47d3-bdf0-9a457c9553a1/trunk%40149
This commit is contained in:
		
							parent
							
								
									355c617de4
								
							
						
					
					
						commit
						9a44956d8f
					
				@ -12,7 +12,7 @@ from dupeguru_pe import app_cocoa as app_pe_cocoa
 | 
				
			|||||||
# Fix py2app imports which chokes on relative imports
 | 
					# Fix py2app imports which chokes on relative imports
 | 
				
			||||||
from dupeguru import app, app_cocoa, data, directories, engine, export, ignore, results, scanner
 | 
					from dupeguru import app, app_cocoa, data, directories, engine, export, ignore, results, scanner
 | 
				
			||||||
from dupeguru_pe import block, cache, matchbase, data
 | 
					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):
 | 
					class PyApp(NSObject):
 | 
				
			||||||
    pass #fake class
 | 
					    pass #fake class
 | 
				
			||||||
 | 
				
			|||||||
@ -34,31 +34,20 @@ PictureBlocks = mainBundle.classNamed_('PictureBlocks')
 | 
				
			|||||||
assert PictureBlocks is not None
 | 
					assert PictureBlocks is not None
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class Photo(phys.File):
 | 
					class Photo(phys.File):
 | 
				
			||||||
    cls_info_map = {
 | 
					    INITIAL_INFO = phys.File.INITIAL_INFO.copy()
 | 
				
			||||||
        'size': fs.IT_ATTRS,
 | 
					    INITIAL_INFO.update({
 | 
				
			||||||
        'ctime': fs.IT_ATTRS,
 | 
					 | 
				
			||||||
        'mtime': fs.IT_ATTRS,
 | 
					 | 
				
			||||||
        'md5': fs.IT_MD5,
 | 
					 | 
				
			||||||
        'md5partial': fs.IT_MD5,
 | 
					 | 
				
			||||||
        'dimensions': fs.IT_EXTRA,
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    def _initialize_info(self,section):
 | 
					 | 
				
			||||||
        super(Photo, self)._initialize_info(section)
 | 
					 | 
				
			||||||
        if section == fs.IT_EXTRA:
 | 
					 | 
				
			||||||
            self._info.update({
 | 
					 | 
				
			||||||
        'dimensions': (0,0),
 | 
					        'dimensions': (0,0),
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    def _read_info(self,section):
 | 
					    def _read_info(self, field):
 | 
				
			||||||
        super(Photo, self)._read_info(section)
 | 
					        super(Photo, self)._read_info(field)
 | 
				
			||||||
        if section == fs.IT_EXTRA:
 | 
					        if field == 'dimensions':
 | 
				
			||||||
            size = PictureBlocks.getImageSize_(unicode(self.path))
 | 
					            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):
 | 
					    def get_blocks(self, block_count_per_side):
 | 
				
			||||||
        try:
 | 
					        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:
 | 
					        except Exception, e:
 | 
				
			||||||
            raise IOError('The reading of "%s" failed with "%s"' % (unicode(self.path), unicode(e)))
 | 
					            raise IOError('The reading of "%s" failed with "%s"' % (unicode(self.path), unicode(e)))
 | 
				
			||||||
        if not blocks:
 | 
					        if not blocks:
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user