Beispiel #1
0
def main(args):
    import signal
    signal.signal(signal.SIGINT, signal.SIG_DFL)

    a = QtGui.QApplication(sys.argv)
    library = Library(Config.library_path)
    server = Server('*',
                    Config.req_rep_port,
                    Config.pub_sub_port,
                    library)
    camera = Camera()
    printer = Printer(library)
    slide_show = SlideShow(library)

    server.msg_recieved.connect(camera.process_cmd)
    server.msg_recieved.connect(printer.process_cmd)
    server.msg_recieved.connect(slide_show.process_cmd)
    printer.printing_image.connect(server.printing_image)
    camera.pic_taken.connect(library.add_image)
    camera.count_down_changed.connect(server.count_down_changed)
    camera.live_stream_activated.connect(server.live_stream_activated)
    library.image_added.connect(server.image_added_to_lib)
    
    #qrscanner = QRScanner()
    #camera.new_preview_image.connect(qrscanner.new_preview_image)

    server_thread = Server.startThread(server)
    camera_thread = Camera.startThread(camera)
    
    #camera_thread.started.connect(camera.start_preview)
    #qrscanner_thread = QRScanner.startThread(qrscanner)
    
    def exit_app():
        print 'stopping camera'
        camera.stop()
        print camera_thread.wait()
        print 'stopping server'
        server.stop()
        #print server_thread.wait()
        print 'exit'
        a.quit()
    
    if not args.no_ui:
        #w = Widget(camera,server,library,printer,slide_show)
        w = Widget(slide_show, camera, printer)
        w.grapicsView.scene().take_pic.connect(camera.take_pic)
        w.grapicsView.scene().print_pic.connect(printer.print_pic)
        w.grapicsView.exit_app.connect(exit_app)
        w.show()
        
    
    camera.count_down_started.connect(slide_show.stop)
    library.image_added.connect(slide_show.start)
    for image_name in library.get_all_images():
        slide_show.start(image_name)
        break
        
        
    sys.exit(a.exec_())
from PySide import QtGui, QtCore

from library import Library
from config import Config

if __name__ == '__main__':
    l = Library(Config.library_path)
    for image_name in l.get_all_images():
        print image_name
        i = QtGui.QImage(l.get_image_path(image_name))
        print i.width()
        print l.get_thumbnail_path(image_name)
        l.generate_thumbnail(image_name)