예제 #1
0
    def add_target(self, name, image_regions_images):
        # The target count is just supposed to prevent target naming collisions,
        # not keep track of how many active targets there are
        target_name = "_internal_name:target" + str(self._target_count)
        self._target_count += 1

        target_pickler = TargetPickler()
        (region_object, regions) = target_pickler.load(name, self._canvas, self, target_name)

        return target_name
예제 #2
0
    def add_target(self, name):
        # The target count is just supposed to prevent target naming collisions,
        # not keep track of how many active targets there are
        target_name = "_internal_name:target" + str(self._target_count)
        self._target_count += 1

        target_pickler = TargetPickler()
        (region_object, regions) = target_pickler.load(
            name, self._webcam_canvas, target_name)

        self._targets.append(target_name)
예제 #3
0
    def __init__(self, parent, webcam_image, target=None, notifynewfunc=None):

        self._cursor_shape = None
        self._selected_region = None
        self._regions = []
        self.build_gui(parent, webcam_image)

        if target is not None:
            target_pickler = TargetPickler()
            (region_object, self._regions) = target_pickler.load(target, self._target_canvas)

        self._notify_new_target = notifynewfunc
예제 #4
0
    def __init__(self, parent, webcam_image, target=None, notifynewfunc=None):

        self._cursor_shape = None
        self._selected_region = None
        self._regions = []
        self.build_gui(parent, webcam_image)

        if target is not None:
            target_pickler = TargetPickler()
            (region_object,
             self._regions) = target_pickler.load(target, self._target_canvas)

        self._notify_new_target = notifynewfunc
예제 #5
0
    def save_target(self):
        target_file = tkFileDialog.asksaveasfilename(
            defaultextension=".target",
            filetypes=[("ShootOFF Target", ".target")],
            initialdir="targets/",
            title="Save ShootOFF Target",
            parent=self._window,
        )

        if target_file and not os.path.isfile(target_file):
            self._notify_new_target(target_file)

        if target_file:
            target_pickler = TargetPickler()
            target_pickler.save(target_file, self._regions, self._target_canvas)
예제 #6
0
    def save_target(self):
        target_file = tkFileDialog.asksaveasfilename(
            defaultextension=".target",
            filetypes=[("ShootOFF Target", ".target")],
            initialdir="targets/",
            title="Save ShootOFF Target",
            parent=self._window)

        if (target_file and not os.path.isfile(target_file)):
            self._notify_new_target(target_file)

        if target_file:
            target_pickler = TargetPickler()
            target_pickler.save(target_file, self._regions,
                                self._target_canvas)
예제 #7
0
    def __init__(self, parent, webcam_image, target=None,
        notifynewfunc=None):

        self._cursor_shape = None
        self._selected_region = None
        self._regions = []
        self._freeform_vertices_points = []
        self._freeform_vertices_ids = []
        self._freeform_edges_ids = []
        self._freeform_temp_line_id = None
        self._image_regions_images = {}
        self.build_gui(parent, webcam_image)

        if target is not None:
            target_pickler = TargetPickler()
            (region_object, self._regions) = target_pickler.load(
                target, self._target_canvas, self._canvas_manager, 
                self._image_regions_images)

        self._notify_new_target = notifynewfunc
예제 #8
0
    def save_target(self):
        is_animated = self._canvas_manager.is_animated(self._regions)
        if is_animated:
            initdir = "animated_targets/"
        else:
            initdir = "targets/"

        target_file = tkFileDialog.asksaveasfilename(
            defaultextension=".target",
            filetypes=[("ShootOFF Target", ".target")],
            initialdir=initdir,
            title="Save ShootOFF Target",
            parent=self._window)

        is_new_target = target_file and not os.path.isfile(target_file)

        if target_file:
            target_pickler = TargetPickler()
            target_pickler.save(target_file, self._regions,
                self._target_canvas)

        if (is_new_target):
            self._notify_new_target(target_file, is_animated)