예제 #1
0
파일: model.py 프로젝트: MilchReis/PicSort
 def __init__(self):
     self.logger = logging.getLogger('picsort')
     
     self.sourceDir = None
     self.targetDir = None
     
     self.theme = None
     
     self.images = []
     self.counter = 0
     
     self.windowWidth = None
     self.windowHeight = None
     
     self.isrunning = True
     
     self.original = None
     self.img = None
     
     self.windowapp = WindowApp(self)
     self.windowapp.start()
    
     self.inputprocessor = InputProcessor(self)
     self.renderer = ScreenRenderer(self)
     
     self.pluginmanager = PluginManager(tools.getResource("plugins"))
     self.pluginmanager.addDirectory(os.path.join(tools.getHome(), ".picsortPlugins"))
     self.pluginmanager.loadPlugins()
     
     self.showHelp = True
     self.showNumbers = True
     
     self.isRotated = False
    
     for plugin in self.pluginmanager.plugins:
         try:
             self.pluginmanager.plugins[plugin].init(self)
         except Exception, e:
             self.logger.warn("Error while init for: " + plugin)
             self.logger.warn(plugin + " -> " + str(e))
예제 #2
0
파일: main.py 프로젝트: MilchReis/PicSort
import exifread
from core.model import AppModel
from core import tools

if __name__ == '__main__':

    # Set up the logger
    # ============================================================
    logger = logging.getLogger('picsort')
    logger.setLevel(logging.DEBUG)
    
    ch = logging.StreamHandler()
    ch.setFormatter(logging.Formatter('%(asctime)s %(levelname)s %(message)s'))
    logger.addHandler(ch)
    
    fh = logging.FileHandler(tools.getResource('../logging.log'))
    fh.setFormatter(logging.Formatter('%(asctime)s %(levelname)s %(message)s'))
    logger.addHandler(fh)
    
    appModel = AppModel()
    
    # Set up the OptionParser
    # ============================================================
    parser = optparse.OptionParser('usage: PicSort [<sourceDirectory> [<targetDirectory>]]')
    (options, args) = parser.parse_args()
    
    if len(args) > 0:
        if len(args) >= 1 and os.path.exists(args[0]):
            appModel.sourceDir = args[0]
    
        if len(args) >= 2 and os.path.exists(args[1]):