Exemple #1
0
 def update_image(self):
     # nothing to do fo static files
     if self.config[
             "mode"] == "Debug Key" and self.data is not None and self.should_update:
         self.image.loadFromData(self.data.data)
         self.should_update = False
     if self.config["mode"] == "Video Device":
         rval, frame = self.vc.read()
         if not rval:
             logger = ColorLog()
             logger.error("Failed to read frame from camera device")
             return
         frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
         self.image = qtg.QImage(frame, frame.shape[1], frame.shape[0],
                                 qtg.QImage.Format_RGB888)
Exemple #2
0
import PyQt5.QtCore as qtc
import PyQt5.QtWidgets as qtw
import PyQt5.QtGui as qtg

from mate.net.nao import Nao
import mate.net.utils as netutils
import mate.net.nao_data as nao_data
import mate.ui.utils as ui_utils

from .motion_editor import *
from .render import RenderView
from .config import Config
from mate.ui.panels._panel import _Panel
from mate.debug.colorlog import ColorLog

logger = ColorLog()


class Main(_Panel):
    name = "Motion Editor"

    def __init__(self, main_window, nao: Nao, model: typing.Dict = None):
        super(Main, self).__init__(main_window, self.name, nao)
        ui_utils.loadUi(__file__, self)
        self.model = ui_utils.load_model(
            os.path.dirname(__file__) + "/model.json", model)

        self.play_timer = qtc.QTimer()
        self.capture_timer = qtc.QTimer()

        # Initialize model to assure consistent state
Exemple #3
0
    parser.add_argument("-t",
                        "--timeout",
                        help="Connection timeout in seconds",
                        default=None)

    parser.add_argument("--default-config-dir",
                        help="Path to nao/etc/configuration/",
                        default=os.path.realpath(os.path.dirname(__file__)) +
                        "/../../etc/configuration/")

    return parser.parse_args()


if __name__ == "__main__":
    initTime = time.time()
    logger = ColorLog()
    setproctitle.setproctitle("mate ({})".format(sys.argv[0]))
    args = parse_arguments()
    settings = qtc.QSettings(args.config + "main.config",
                             qtc.QSettings.NativeFormat)
    if args.verbose:
        logger.setLevel(logging.DEBUG)
    elif settings.value("logLevel"):
        logger.setLevel(int(settings.value("logLevel")))
    else:
        logger.setLevel(logging.INFO)
    logger.info(__name__ + ": Initializing Mate")

    app = App(sys.argv)
    main_window = MainWindow(args.config, args.panel_directory, args.verbose,
                             args.timeout, args.default_config_dir)