def main():
    app = QApplication(sys.argv)
    app.setWindowIcon(QIcon('bbproject.png'))

    main_window = MainUI()
    main_window.setWindowTitle("BBFlight Client V0.0000001")
    main_window.show()
    sys.exit(app.exec_())
Esempio n. 2
0
kpath = "C:/Users/kosakae256/Documents/Kosakae-Deployment/EmoFace/data/image/pushphoto.png"
tpath = "C:/Users/takara2314/OneDrive/EmoFace/data/image/pushphoto.png"
path = os.path.dirname(os.path.abspath(__file__))


def function(filepath):
    print(filepath)
    os.chdir(f"{path}/models/")
    print(filepath)
    data = get_face_attribute(filepath)
    os.chdir(f"{path}/")
    emoticon = rSimilarEmoticon(data)
    textpath = texttoimage(emoticon)

    return textpath, emoticon


if __name__ == '__main__':
    Ui = MainUI(function)
    Ui.root.resizable(width=False, height=False)
    Ui.root.mainloop()

#os.chdir("models")
# models フォルダからみたファイルパスを指定
#data = get_face_attribute("../data/image/sample.png")
#os.chdir("/")

# 後は焼くなり煮るなり好きにしやがれください
#print(data)
Esempio n. 3
0
def main():
    # Set ERROR level for PyQt4 logger
    qtlogger = logging.getLogger('PyQt4')
    qtlogger.setLevel(logging.ERROR)

    parser = argparse.ArgumentParser(
        description='cfclient - Crazyflie graphical control client')
    parser.add_argument(
        '--debug',
        '-d',
        nargs=1,
        default='info',
        type=str,
        help='set debug level [minimal, info, debug, debugfile]')
    args = parser.parse_args()
    globals().update(vars(args))

    cflogger = logging.getLogger('')

    # Set correct logging fuctionality according to commandline
    if ("debugfile" in debug):
        logging.basicConfig(level=logging.DEBUG)
        # Add extra format options for file logger (thread and time)
        formatter = logging.Formatter(
            '%(asctime)s:%(threadName)s:%(name)s:%(levelname)s:%(message)s')
        filename = "debug-%s.log" % datetime.datetime.now()
        filehandler = logging.FileHandler(filename)
        filehandler.setLevel(logging.DEBUG)
        filehandler.setFormatter(formatter)
        cflogger.addHandler(filehandler)
    elif ("debug" in debug):
        logging.basicConfig(level=logging.DEBUG)
    elif ("minimal" in debug):
        logging.basicConfig(level=logging.WARNING)
    elif ("info" in debug):
        logging.basicConfig(level=logging.INFO)

    logger = logging.getLogger(__name__)

    # Try all the imports used in the project here to control what happens....
    try:
        import usb
    except:
        logger.critical("No pyusb installation found, exiting!")
        sys.exit(1)

    try:
        import pygame
    except:
        logger.critical("No pygame installation found, exiting!")
        sys.exit(1)

    try:
        import PyQt4
    except:
        logger.critical("No PyQT4 installation found, exiting!")
        sys.exit(1)

    # Disable printouts from STL
    if os.name == 'posix':
        stdout = os.dup(1)
        os.dup2(os.open('/dev/null', os.O_WRONLY), 1)
        sys.stdout = os.fdopen(stdout, 'w')
        logger.info("Disabling STL printouts")

    # Start up the main user-interface
    from ui.main import MainUI
    from PyQt4.QtGui import QApplication
    app = QApplication(sys.argv)
    main_window = MainUI()
    main_window.show()
    sys.exit(app.exec_())
def main():

    """
    Check starting conditions and start GUI.

    First, check command line arguments and start loggers. Set log levels. Try
    all imports and exit verbosely if a library is not found. Disable outputs
    to stdout and start the GUI.
    """

    # Set ERROR level for PyQt4 logger
    qtlogger = logging.getLogger('PyQt4')
    qtlogger.setLevel(logging.ERROR)

    parser = argparse.ArgumentParser(description="cfclient - "
                                     "Crazyflie graphical control client")
    parser.add_argument('--debug', '-d', nargs=1, default='info', type=str,
                        help="set debug level "
                        "[minimal, info, debug, debugfile]")
    args = parser.parse_args()
    globals().update(vars(args))

    cflogger = logging.getLogger('')

    # Set correct logging fuctionality according to commandline
    if ("debugfile" in debug):
        logging.basicConfig(level=logging.DEBUG)
        # Add extra format options for file logger (thread and time)
        formatter = logging.Formatter('%(asctime)s:%(threadName)s:%(name)'
                                      's:%(levelname)s:%(message)s')
        filename = "debug-%s.log" % datetime.datetime.now()
        filehandler = logging.FileHandler(filename)
        filehandler.setLevel(logging.DEBUG)
        filehandler.setFormatter(formatter)
        cflogger.addHandler(filehandler)
    elif ("debug" in debug):
        logging.basicConfig(level=logging.DEBUG)
    elif ("minimal" in debug):
        logging.basicConfig(level=logging.WARNING)
    elif ("info" in debug):
        logging.basicConfig(level=logging.INFO)

    logger = logging.getLogger(__name__)
    
    logger.debug("Using config path {}".format(sys.path[1]))
    logger.debug("sys.path={}".format(sys.path))

    # Try all the imports used in the project here to control what happens....
    try:
        import usb
    except ImportError:
        logger.critical("No pyusb installation found, exiting!")
        sys.exit(1)

    try:
        import sdl2
    except ImportError:
        logger.critical("No pysdl2 installation found, exiting!")
        sys.exit(1)

    try:
        import PyQt4
    except ImportError:
        logger.critical("No PyQT4 installation found, exiting!")
        sys.exit(1)

    # Disable printouts from STL
    if os.name == 'posix':
        stdout = os.dup(1)
        os.dup2(os.open('/dev/null', os.O_WRONLY), 1)
        sys.stdout = os.fdopen(stdout, 'w')
        logger.info("Disabling STL printouts")
    
    if os.name == 'nt':
        stdout = os.dup(1)
        os.dup2(os.open('NUL', os.O_WRONLY), 1)
        sys.stdout = os.fdopen(stdout, 'w')
        logger.info("Disabling STL printouts")

    # Start up the main user-interface
    from ui.main import MainUI
    from PyQt4.QtGui import QApplication, QIcon
    app = QApplication(sys.argv)

    app.setWindowIcon(QIcon(sys.path[0] + "/cfclient/icon-256.png"))
    # Make sure the right icon is set in Windows 7+ taskbar
    if os.name == 'nt':
        import ctypes
        try:
            myappid = 'mycompany.myproduct.subproduct.version'
            ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid)
        except Exception:
            pass
    
    main_window = MainUI()
    main_window.show()
    sys.exit(app.exec_())
Esempio n. 5
0
def main():
    """
    Check starting conditions and start GUI.

    First, check command line arguments and start loggers. Set log levels. Try
    all imports and exit verbosely if a library is not found. Disable outputs
    to stdout and start the GUI.
    """

    # Set ERROR level for PyQt4 logger
    qtlogger = logging.getLogger('PyQt4')
    qtlogger.setLevel(logging.ERROR)

    parser = argparse.ArgumentParser(description="cfclient - "
                                     "Crazyflie graphical control client")
    parser.add_argument('--debug',
                        '-d',
                        nargs=1,
                        default='info',
                        type=str,
                        help="set debug level "
                        "[minimal, info, debug, debugfile]")
    args = parser.parse_args()
    globals().update(vars(args))

    cflogger = logging.getLogger('')

    # Set correct logging fuctionality according to commandline
    if ("debugfile" in debug):
        logging.basicConfig(level=logging.DEBUG)
        # Add extra format options for file logger (thread and time)
        formatter = logging.Formatter('%(asctime)s:%(threadName)s:%(name)'
                                      's:%(levelname)s:%(message)s')
        filename = "debug-%s.log" % datetime.datetime.now()
        filehandler = logging.FileHandler(filename)
        filehandler.setLevel(logging.DEBUG)
        filehandler.setFormatter(formatter)
        cflogger.addHandler(filehandler)
    elif ("debug" in debug):
        logging.basicConfig(level=logging.DEBUG)
    elif ("minimal" in debug):
        logging.basicConfig(level=logging.WARNING)
    elif ("info" in debug):
        logging.basicConfig(level=logging.INFO)

    logger = logging.getLogger(__name__)

    logger.debug("Using config path {}".format(sys.path[1]))
    logger.debug("sys.path={}".format(sys.path))

    # Try all the imports used in the project here to control what happens....
    try:
        import usb
    except ImportError:
        logger.critical("No pyusb installation found, exiting!")
        sys.exit(1)

    try:
        import sdl2
    except ImportError:
        logger.critical("No pysdl2 installation found, exiting!")
        sys.exit(1)

    try:
        import PyQt4
    except ImportError:
        logger.critical("No PyQT4 installation found, exiting!")
        sys.exit(1)

    # Disable printouts from STL
    if os.name == 'posix':
        stdout = os.dup(1)
        os.dup2(os.open('/dev/null', os.O_WRONLY), 1)
        sys.stdout = os.fdopen(stdout, 'w')
        logger.info("Disabling STL printouts")

    if os.name == 'nt':
        stdout = os.dup(1)
        os.dup2(os.open('NUL', os.O_WRONLY), 1)
        sys.stdout = os.fdopen(stdout, 'w')
        logger.info("Disabling STL printouts")

    # Start up the main user-interface
    from ui.main import MainUI
    from PyQt4.QtGui import QApplication, QIcon
    app = QApplication(sys.argv)

    app.setWindowIcon(QIcon(sys.path[0] + "/cfclient/icon-256.png"))
    # Make sure the right icon is set in Windows 7+ taskbar
    if os.name == 'nt':
        import ctypes
        try:
            myappid = 'mycompany.myproduct.subproduct.version'
            ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(
                myappid)
        except Exception:
            pass

    main_window = MainUI()
    main_window.show()
    sys.exit(app.exec_())