Exemple #1
0
    def __init__(self, **kwargs):

        lib.kwargs.set_kwargs(self, **kwargs)

        super(Credits, self).__init__(**kwargs)

        self.credits_touchedMessageSent = False
        self.credits_timeoutMessageSent = False

        self.last_runtime = 0.0

        self.credits = ZoneOfInterest(img=Image("images/credits.png"),
                                      pos=(11, 200))
        self.credits.alpha = 0.99

        self.label = Label(text="Composition VIII, Kandinsky",
                           font_size=25,
                           color=(0, 0, 0, 1),
                           pos=(600, 25),
                           font_name="fonts/Akkurat.ttf")

        self.background_path = "images/bgs/" + str(self.clientIdIndex +
                                                   1) + ".jpg"
        self.perspective_path = "images/perspectives/" + str(
            self.clientIdIndex + 1) + ".jpg"

        self.background = ZoneOfInterest(img=Image(self.background_path))
        self.perspective = ZoneOfInterest(img=Image(self.perspective_path))
Exemple #2
0
  def __init__(self, **kwargs):

    lib.kwargs.set_kwargs(self, **kwargs)

    super(Credits, self).__init__(**kwargs)  

    self.credits_touchedMessageSent = False
    self.credits_timeoutMessageSent = False

    self.last_runtime = 0.0

    self.credits = ZoneOfInterest(img=Image("images/credits.png"), pos=(11, 200))
    self.credits.alpha = 0.99
    
    self.label = Label(text="Composition VIII, Kandinsky",
                        font_size=25, 
                        color=(0,0,0,1), 
                        pos=(600,25), 
                        font_name="fonts/Akkurat.ttf")

    self.background_path = "images/bgs/" + str(self.clientIdIndex + 1) + ".jpg"
    self.perspective_path = "images/perspectives/" + str(self.clientIdIndex + 1) + ".jpg"

    self.background = ZoneOfInterest(img=Image(self.background_path))
    self.perspective = ZoneOfInterest(img=Image(self.perspective_path))
Exemple #3
0
    def __init__(self, **kwargs):

        lib.kwargs.set_kwargs(self, **kwargs)

        super(Learning, self).__init__(**kwargs)

        # Widget position
        self.pos = (lib.config.viewport[self.clientIdIndex][0], 0)
        self.width = lib.config.viewport[self.clientIdIndex][1]
        self.background_path = "images/bgs/" + str(self.clientIdIndex +
                                                   1) + ".jpg"

        self.threshold_reachedMessageSent = False

        self.last_touch = 0

        self.points = []

        # ZoneOfInterest
        self.shapes = []

        for zi in lib.config.zones_of_interest[self.clientIdIndex]:
            self.shapes.append(
                ZoneOfInterest(img=kivy.core.image.Image(zi[0]),
                               pos=zi[1],
                               alpha_index=1.0))

        rez = lib.config.viewport[self.clientIdIndex]
        self.max_points = (MAX_POINTS * RATIO / 1024) * abs(rez[0] - rez[1])
Exemple #4
0
    def __init__(self, **kwargs):

        lib.kwargs.set_kwargs(self, **kwargs)

        super(ScreenSaver, self).__init__(**kwargs)

        self.pos = (lib.config.viewport[self.clientIdIndex][0], 0)
        self.width = abs(lib.config.viewport[self.clientIdIndex][0] -
                         lib.config.viewport[self.clientIdIndex][1])

        self.scan_duration = SCAN_DURATION / Window.width * (self.width)

        self.points = []
        self.trigger_points = []

        # ZoneOfInterest
        self.shapes = []

        for zi in lib.config.zones_of_interest[self.clientIdIndex]:
            self.shapes.append(
                ZoneOfInterest(img=kivy.core.image.Image(zi[0]),
                               pos=zi[1],
                               alpha_index=1.0))

        # Scaner
        self.scan_endMessageSent = False
        self.screensaver_touchedMessageSent = False
        self.fadeInMessageReceived = False

        self.scanner = kivy.uix.image.Image(source=SCAN_IMG_PATH,
                                            size=(218, 768),
                                            color=(1, 1, 1, 1),
                                            pos=(0 - 218, 0))
        self.scanner.pos = (self.pos[0] - self.scanner.width, 0)

        self.mask = Widget()
        self.mask.canvas.add(Color(0, 0, 0, 1, mode="rgb"))
        if self.clientIdIndex == 0:
            self.mask.canvas.add(
                Rectangle(size=self.scanner.size,
                          pos=(self.pos[0] - self.scanner.width, 0)))
        else:
            self.mask.canvas.add(
                Rectangle(size=self.scanner.size,
                          pos=(self.pos[0] + self.width, 0)))
Exemple #5
0
class Credits(Widget):
    def __init__(self, **kwargs):

        lib.kwargs.set_kwargs(self, **kwargs)

        super(Credits, self).__init__(**kwargs)

        self.credits_touchedMessageSent = False
        self.credits_timeoutMessageSent = False

        self.last_runtime = 0.0

        self.credits = ZoneOfInterest(img=Image("images/credits.png"),
                                      pos=(11, 200))
        self.credits.alpha = 0.99

        self.label = Label(text="Composition VIII, Kandinsky",
                           font_size=25,
                           color=(0, 0, 0, 1),
                           pos=(600, 25),
                           font_name="fonts/Akkurat.ttf")

        self.background_path = "images/bgs/" + str(self.clientIdIndex +
                                                   1) + ".jpg"
        self.perspective_path = "images/perspectives/" + str(
            self.clientIdIndex + 1) + ".jpg"

        self.background = ZoneOfInterest(img=Image(self.background_path))
        self.perspective = ZoneOfInterest(img=Image(self.perspective_path))

# basis

    def start(self):
        print "Credits start() called"

        self.background.alpha = 0.0
        self.perspective.alpha = 0.0

        self.add_widget(self.background)
        self.add_widget(self.perspective)

        self.background.fadeIn()
        if self.clientIdIndex == 0:
            self.add_widget(self.label)

        Clock.schedule_once(self.switchToPerspective, PERSPECTIVE_DELAY)

        if self.clientIdIndex == 3:
            Clock.schedule_once(self.displayCredits, CREDIT_DELAY)

        Clock.schedule_once(self.announceTheEnd,
                            SCREENSAVER_DELAY)  # restart screensaver
        self.last_runtime = Clock.get_boottime()

    def stop(self):
        print "Credits stop() called"
        self.remove_widget(self.background)
        self.remove_widget(self.perspective)
        self.remove_widget(self.credits)

        self.reset()
        Clock.unschedule(self.switchToPerspective)
        Clock.unschedule(self.displayCredits)
        Clock.unschedule(self.announceTheEnd)

    def reset(self):
        self.credits_touchedMessageSent = False
        self.credits_timeoutMessageSent = False

# Custom methods

# Custom callbacks

    def switchToPerspective(self, instance=False):
        self.remove_widget(self.label)

        self.background.alpha = 0.99
        self.background.fadeOut()

        self.perspective.alpha = 0.0
        self.perspective.fadeIn()

    def displayCredits(self, instance=False):
        self.add_widget(self.credits)

    def announceTheEnd(self, instance=False):
        if not self.credits_timeoutMessageSent:
            print "This is the end."
            self.controller.sendMessage(
                "credits_timeout")  # go back to mode1, ScreenSaver
            self.credits_timeoutMessageSent = True

# Kivy callbacks

    def on_touch_down(self, touch):
        # Doesn't do anything if touched within the tenth first seconds.
        if abs(Clock.get_boottime() - self.last_runtime) > TOUCH_DELAY:
            if not self.credits_touchedMessageSent:
                print "Credits touched at, ", Clock.get_boottime()
                self.controller.sendMessage(
                    "credits_touched")  # go back to mode2, Learning
                self.credits_touchedMessageSent = True
Exemple #6
0
class Credits(Widget):
  
  def __init__(self, **kwargs):

    lib.kwargs.set_kwargs(self, **kwargs)

    super(Credits, self).__init__(**kwargs)  

    self.credits_touchedMessageSent = False
    self.credits_timeoutMessageSent = False

    self.last_runtime = 0.0

    self.credits = ZoneOfInterest(img=Image("images/credits.png"), pos=(11, 200))
    self.credits.alpha = 0.99
    
    self.label = Label(text="Composition VIII, Kandinsky",
                        font_size=25, 
                        color=(0,0,0,1), 
                        pos=(600,25), 
                        font_name="fonts/Akkurat.ttf")

    self.background_path = "images/bgs/" + str(self.clientIdIndex + 1) + ".jpg"
    self.perspective_path = "images/perspectives/" + str(self.clientIdIndex + 1) + ".jpg"

    self.background = ZoneOfInterest(img=Image(self.background_path))
    self.perspective = ZoneOfInterest(img=Image(self.perspective_path))

# basis
  def start(self):
    print "Credits start() called"    

    self.background.alpha = 0.0
    self.perspective.alpha = 0.0
    
    self.add_widget(self.background)
    self.add_widget(self.perspective)

    self.background.fadeIn()
    if self.clientIdIndex == 0:
      self.add_widget(self.label)
    
    Clock.schedule_once(self.switchToPerspective, PERSPECTIVE_DELAY)

    if self.clientIdIndex == 3:
      Clock.schedule_once(self.displayCredits, CREDIT_DELAY)
    
    Clock.schedule_once(self.announceTheEnd, SCREENSAVER_DELAY) # restart screensaver
    self.last_runtime = Clock.get_boottime()
    

  def stop(self):
    print "Credits stop() called"    
    self.remove_widget(self.background)
    self.remove_widget(self.perspective)
    self.remove_widget(self.credits)

    self.reset()
    Clock.unschedule(self.switchToPerspective)
    Clock.unschedule(self.displayCredits)
    Clock.unschedule(self.announceTheEnd) 
    

  def reset(self):
    self.credits_touchedMessageSent = False
    self.credits_timeoutMessageSent = False

# Custom methods

# Custom callbacks  
  def switchToPerspective(self, instance=False):
    self.remove_widget(self.label)
    
    self.background.alpha = 0.99
    self.background.fadeOut()
    
    self.perspective.alpha = 0.0
    self.perspective.fadeIn()


      
  def displayCredits(self, instance=False):
    self.add_widget(self.credits)


  def announceTheEnd(self, instance=False):
    if not self.credits_timeoutMessageSent:
      print "This is the end."
      self.controller.sendMessage("credits_timeout") # go back to mode1, ScreenSaver
      self.credits_timeoutMessageSent = True
    

# Kivy callbacks    
  def on_touch_down(self, touch):
    # Doesn't do anything if touched within the tenth first seconds.
    if abs(Clock.get_boottime() - self.last_runtime) > TOUCH_DELAY:
      if not self.credits_touchedMessageSent:
        print "Credits touched at, ", Clock.get_boottime()
        self.controller.sendMessage("credits_touched") # go back to mode2, Learning
        self.credits_touchedMessageSent = True