Beispiel #1
0
    def advance_time(self, proportion):

        mouse_pos_x = soya.get_mouse_rel_pos()[0]

        if self.left >= self.left_limit and self.left <= self.right_limit and soya.get_grab_input() == 1:

            # move slider puck to relative mouse pos:
            self.left += mouse_pos_x
            self.label.left = self.left + self.width / 4

            # find relative position of puck inside limits:
            relative_pos = self.range - (self.right_limit - self.left)

            # generate value from 0 - 1, round to three decimal places:
            self.val = round(relative_pos / (self.range), 3)

        elif self.val <= self.val_min:
            soya.set_grab_input(0)
            self.left = self.left_limit + 1
            # safe lower limit:
            self.val = 0.01

        elif self.val >= self.val_max:
            soya.set_grab_input(0)
            self.left = self.right_limit - 1
            self.val = .99

        elif soya.get_grab_input() == 0:
            self.left += 0 

        else:
            self.left += 0

        # update label value as a percentage each cycle:
        self.label.label = str(self.val * 100)[:-2]
Beispiel #2
0
    def start_mouse_grab(self):
        soya.cursor_set_visible(0)
        soya.set_grab_input(1)
        soya.set_mouse_pos(camera.width / 2, camera.height / 2)
        soya.clear_events()
        Rx, ry = soya.get_mouse_rel_pos()

        self.grab_cursor = 1
Beispiel #3
0
    def advance_time(self, proportion):

        mouse_pos_x = soya.get_mouse_rel_pos()[0]

        if self.left >= self.left_limit and self.left <= self.right_limit and soya.get_grab_input(
        ) == 1:

            # move slider puck to relative mouse pos:
            self.left += mouse_pos_x
            self.label.left = self.left + self.width / 4

            # find relative position of puck inside limits:
            relative_pos = self.range - (self.right_limit - self.left)

            # generate value from 0 - 1, round to three decimal places:
            self.val = round(relative_pos / (self.range), 3)

        elif self.val <= self.val_min:
            soya.set_grab_input(0)
            self.left = self.left_limit + 1
            # safe lower limit:
            self.val = 0.01

        elif self.val >= self.val_max:
            soya.set_grab_input(0)
            self.left = self.right_limit - 1
            self.val = .99

        elif soya.get_grab_input() == 0:
            self.left += 0

        else:
            self.left += 0

        # update label value as a percentage each cycle:
        self.label.label = str(self.val * 100)[:-2]
Beispiel #4
0
 def pyui_mousemove(self, event):
     # event_type,mx,my,relx,rely,buttons=event
     rx, ry = soya.get_mouse_rel_pos()
     self.on_mouse_motion((event.type, event.pos[0], event.pos[1], rx, ry))