Пример #1
0
def get_upy_sd_dir(upy_sd_name):
    platform = project.get_platform()
    if platform == "mac":
        return os.path.join("/Volumes", upy_sd_name)
    elif platform == "linux":
        return os.path.join("/media", upy_sd_name)
    else:
        raise NotImplementedError
Пример #2
0
    def __init__(self, width, height, window_name, enable_draw, update_fn=None,
                 fn_params=None):

        # each platform has its own key codes
        platform = project.get_platform()
        if platform == "linux":
            self.key_codes = {
                65362: "up",
                65364: "down",
                65361: "left",
                65363: "right",
                'esc': 'esc',
                10: "enter"
            }
        elif platform == "mac":
            self.key_codes = {
                63232: "up",
                63233: "down",
                63234: "left",
                63235: "right",
                13: "enter"
            }
        else:
            raise NotImplementedError

        self.width = width
        self.height = height

        self.window_name = window_name
        self.enable_draw = enable_draw

        self.frame = None

        # object wrapper for a video recorded from the current stream
        # Yes. It's possible to make videos from other video files
        self.recording = None
        self.recorder_width, self.recorder_height = 0, 0
        self.recorder_output_dir = ""
        self.is_recording = False

        # keep track of the frame number. Used for slider behavior
        self.frame_num = 0
        self.slider_num = 0

        # Capture status variables
        self.paused = False
        self.stopped = False

        # Capture runs on a thread. You may provide extra code to run inside
        # that thread
        self.update_fn = update_fn
        self.fn_params = fn_params