def doOrange(self):
     timer.clear_timeout(self.interval)
     showHide('red', 0)
     showHide('orange', 1)
     showHide('green', 0)
     self.interval = timer.set_interval(self.doGreen,
                                        2000 + random() * 5000)
Beispiel #2
0
 def quit(self):
     doc.unbind("keydown")
     doc.unbind("mousemove")
     self.display.game_canvas.style.cursor = "default"
     self.display.clear_all()
     if self.frame_id is not None:
         clear_timeout(self.frame_id)
def reset(clear_console=True):
    return
    try:
        PynodeCoreGlobals.GLOBAL_USER_ID = 0
        if clear_console: window.writeOutput("", False)
        pynode_graphlib.graph._reset()
        window.js_clear()
        if PynodeCoreGlobals.event_timer is not None:
            timer.clear_timeout(PynodeCoreGlobals.event_timer)
        if PynodeCoreGlobals.update_timer is not None:
            timer.clear_timeout(PynodeCoreGlobals.update_timer)
        PynodeCoreGlobals.event_queue = [EventPause(100)]
        PynodeCoreGlobals.fix_layout = True
        PynodeCoreGlobals.did_fix_layout = False
        PynodeCoreGlobals.did_update_layout = False
        PynodeCoreGlobals.has_ended = False
        PynodeCoreGlobals.delay_type = {}
        PynodeCoreGlobals.positioning_counter = 0
        PynodeCoreGlobals.error = ""
        PynodeCoreGlobals.click_listener_func = {"f": None}
        window.set_layout_type()
        window.registerClickListener(node_click)
        window.clickListenerFunc = None
    except:
        timer.set_timeout(reset, 20)
Beispiel #4
0
 def next_frame(self):
     if self.next_level:
         self.pause = True
         self.level += 1
         if self.level > len(levels):
             self.info.show_game_win()
             self.play_sound("win-sound")
             return False
         self.add_game_objects()
         self.info.write_help()
         return False
     elif self.pause:
         self.info.write_help()
         if self.frame_id is not None:
             clear_timeout(self.frame_id)
         return False
     elif self.player.lost_life:
         if self.player.lives == 0:
             self.pause = True
             self.info.show_game_over()
             return False
         else:
             self.pause = True
             self.player.lost_life = False
             self.ball = Ball(10,
                              self.display.height - 30,
                              dy=-5,
                              send_msg=self.receive_message,
                              ctx=self.display.main_canvas_ctx,
                              world=self.bottom_display)
             self.objects[0] = self.ball
             return True
     else:
         return True
def clicker(ev):
    global state,count,timer,interval,green,gaps
    if state== 'intro':
        state = 'test'
        green =False
        doc['zone'].value = 'test'
        count = 3
        interval=timer.set_interval(doOrange,2000)
    elif state in ('test','main'):
        if green:
            green = False
            gap=time.time()-last
            gaps.append(gap)
            doc["zone"].value += '\n{}'.format(gap)
            count -= 1
            if count ==0:
                if state== 'test':
                    green =False
                    gaps=[]
                    doc['zone'].value = state = 'main'
                    count = 5
                    interval=timer.set_interval(doOrange,2000)
                else:
                    state = 'done'
                    doc['result'].value = '{},{},{},{}'.format('nm','gn','yr'
                    ,','.join(encode(gaps)))
                    doc['zone'].value = 'please email results to '
            else: #do another test
                interval=timer.set_interval(doOrange,2000)
        else:  # pused to early so restart timer
            timer.clear_timeout(interval)
            interval=timer.set_interval(doGreen,2000 + random()*5000)
    else: # state 'done'
          pass
Beispiel #6
0
 def update(self):
     game_name = self.timeline.game_name
     if game_name != self.game_name:
         self.current_batch = 0
         self.game_name = game_name
     timer.clear_timeout(self._timer_id)
     self._do_next()
def doOrange():
    global interval
    timer.clear_timeout(interval)
    showHide('red',0)
    showHide('orange',1)
    showHide('green',0)
    interval=timer.set_interval(doGreen,2000 + random()*5000)
def doGreen():
    global green,last,interval
    timer.clear_timeout(interval)
    showHide('orange',0)
    showHide('green',1)
    green= True
    last= time.time()
def doGreen():
    global green, last, interval
    timer.clear_timeout(interval)
    showHide('orange', 0)
    showHide('green', 1)
    green = True
    last = time.time()
def clicker(ev):
    global state, count, timer, interval, green, gaps
    if state == 'intro':
        state = 'test'
        green = False
        doc['zone'].value = 'test'
        count = 3
        interval = timer.set_interval(doOrange, 2000)
    elif state in ('test', 'main'):
        if green:
            green = False
            gap = time.time() - last
            gaps.append(gap)
            doc["zone"].value += '\n{}'.format(gap)
            count -= 1
            if count == 0:
                if state == 'test':
                    green = False
                    gaps = []
                    doc['zone'].value = state = 'main'
                    count = 5
                    interval = timer.set_interval(doOrange, 2000)
                else:
                    state = 'done'
                    doc['result'].value = '{},{},{},{}'.format(
                        'nm', 'gn', 'yr', ','.join(encode(gaps)))
                    doc['zone'].value = 'please email results to '
            else:  #do another test
                interval = timer.set_interval(doOrange, 2000)
        else:  # pused to early so restart timer
            timer.clear_timeout(interval)
            interval = timer.set_interval(doGreen, 2000 + random() * 5000)
    else:  # state 'done'
        pass
def doOrange():
    global interval
    timer.clear_timeout(interval)
    showHide('red', 0)
    showHide('orange', 1)
    showHide('green', 0)
    interval = timer.set_interval(doGreen, 2000 + random() * 5000)
Beispiel #12
0
 def next_frame(self):
     if self.next_level:
         self.pause = True
         self.level += 1
         if self.level > len(levels):
             self.info.show_game_win()
             self.play_sound("win-sound")
             return False
         self.add_game_objects()
         self.info.write_help()
         return False
     elif self.pause:
         self.info.write_help()
         if self.frame_id is not None:
             clear_timeout(self.frame_id)
         return False
     elif self.player.lost_life:
         if self.player.lives == 0:
             self.pause = True
             self.info.show_game_over()
             return False
         else:
             self.pause = True
             self.player.lost_life = False
             self.ball = Ball(10, self.display.height-30, dy=-5,
                 send_msg=self.receive_message,
                 ctx=self.display.main_canvas_ctx, world=self.bottom_display)
             self.objects[0] = self.ball
             return True
     else:
         return True
Beispiel #13
0
 def quit(self):
     doc.unbind("keydown")
     doc.unbind("mousemove")
     self.display.game_canvas.style.cursor = "default"
     self.display.clear_all()
     if self.frame_id is not None:
         clear_timeout(self.frame_id)
Beispiel #14
0
def button_stop(event):
    clear_button_run()
    document["runPlay"].style.display = "inherit"
    document["run"].bind("click", button_play)
    reset(False)
    if PynodeCoreGlobals.event_timer is not None:
        timer.clear_timeout(PynodeCoreGlobals.event_timer)
Beispiel #15
0
def stop(click):
    global playing, idtimer
    timer.clear_timeout(idtimer)

    document['stop-btn'].unbind('click', stop)
    document['stop-btn'].id = "start-btn"
    document['start-btn'].bind('click', start)
    document['start-btn'].text = "START"

    console.log("Stop game of life execution")
    playing = False
    pass
Beispiel #16
0
 def func(obj):
     if event=="loaded" and self.timer is not None:
         timer.clear_timeout(self.timer)
         self.timer = None
     obj.text = obj.responseText
     obj.xml = obj.responseXML
     try:
         return callback(obj)
     except Exception as exc:
         import sys
         msg = exc.__name__
         if exc.args:
             msg += ': %s' %exc.args[0]
         msg += '\n'+exc.info
         sys.stderr.write(msg)
Beispiel #17
0
def input_field_activate(event):
    name = event.target.name
    value = event.target.value

    if __debug__:
        console.log("input_field_activate %s : %s" % (name, value))

    try:
        timeout_id = input_fields[name][1]
        if timeout_id:
            clear_timeout(timeout_id)
            input_fields[name][2] = None
        commit_data(name)
    except KeyError:
        pass
 def func(obj):
     if event=="loaded" and self.timer is not None:
         timer.clear_timeout(self.timer)
         self.timer = None
     obj.text = obj.responseText
     obj.xml = obj.responseXML
     try:
         return callback(obj)
     except Exception as exc:
         import sys
         msg = exc.__name__
         if exc.args:
             msg += ': %s' %exc.args[0]
         msg += '\n'+exc.info
         sys.stderr.write(msg)
Beispiel #19
0
def input_field_modified(event):
    name = event.target.name
    value = event.target.value

    if __debug__:
        console.log("input_field_modified %s : %s" % (name, value))

    timeout_id = None
    found = False
    options_list = event.target.getAttribute('list')
    if value and options_list:
        for option in document[options_list].getElementsByTagName('option'):
            if option.getAttribute('value') == value:
                found = True
                break
        else:
            found = False

    weight_entry = name[:len('devweight_')] == 'devweight_'

    if __debug__:
        if found:
            console.log(
                "Entry '%s' found in options list '%s', setting timeout." %
                (value, options_list))
        elif not value:
            console.log("Empty entry, setting timeout.")
        elif weight_entry:
            console.log("'Weight' entry value %s, setting timeout." % (value))

    if found or not value or weight_entry:
        try:
            if input_fields[name][2]:
                clear_timeout(input_fields[name][2])
            del input_fields[name]
        except KeyError:
            pass
        timeout_id = set_timeout(lambda: commit_data(name), 7500)

    input_fields[name] = [value, options_list, timeout_id]
 def cancel(self):
     timer.clear_timeout(self.tm)
 def doGreen(self):
   timer.clear_timeout(self.interval)
   showHide('orange',0)
   showHide('green',1)
   self.green= True
   self.last= time.time()
 def falsePress(self):
   timer.clear_timeout(self.interval)
   self.interval=timer.set_interval(self.doGreen,2000 + random()*5000)
Beispiel #23
0
 def cancel(self):
     timer.clear_timeout(self.tm)
Beispiel #24
0
 def pause(self):
     if not self._finished and self._timeout:
         timer.clear_timeout(self._timeout)
 def doGreen(self):
     timer.clear_timeout(self.interval)
     showHide('orange', 0)
     showHide('green', 1)
     self.green = True
     self.last = time.time()
Beispiel #26
0
def call_cancel(t):
    return timer.clear_timeout(t)
Beispiel #27
0
 def cancel(self):
     if not self._cancelled and not self._finished:
         if self._timeout:
             timer.clear_timeout(self._timeout)
         self._cancelled = True
         self._finished = True
Beispiel #28
0
 def pause(self):
     if not self._finished and self._timeout:
         timer.clear_timeout(self._timeout)
Beispiel #29
0
 def cancel(self):
     if not self._cancelled:
         timer.clear_timeout(self._timeout)
         self._cancelled = True
Beispiel #30
0
 def stop_button(ev):
     timer.clear_timeout(idtimer)
Beispiel #31
0
def button_pause(event):
    clear_button_run()
    document["runResume"].style.display = "inherit"
    document["run"].bind("click", button_resume)
    if PynodeCoreGlobals.event_timer is not None:
        timer.clear_timeout(PynodeCoreGlobals.event_timer)
 def doOrange(self):
   timer.clear_timeout(self.interval)
   showHide('red',0)
   showHide('orange',1)
   showHide('green',0)
   self.interval=timer.set_interval(self.doGreen,2000 + random()*5000)
Beispiel #33
0
def id_projet_on_input():
    global idtimer
    timer.clear_timeout(idtimer)
    idtimer = timer.set_timeout(id_projet_on_input_ajax, 1500)
Beispiel #34
0
 def callback():
     self.xmlhttp.abort()
     timer.clear_timeout(self.timer)
     self.timer = None
     func()
 def falsePress(self):
     timer.clear_timeout(self.interval)
     self.interval = timer.set_interval(self.doGreen,
                                        2000 + random() * 5000)
 def callback():
     self.xmlhttp.abort()
     timer.clear_timeout(self.timer)
     self.timer = None
     func()
Beispiel #37
0
 def cancel(self):
     if not self._cancelled:
         timer.clear_timeout(self._timeout)
         self._cancelled = True
Beispiel #38
0
 def cancel():
     if t:
         timer.clear_timeout(t)
Beispiel #39
0
 def cancel(self):
     if not self._cancelled and not self._finished:
         if self._timeout:
             timer.clear_timeout(self._timeout)
         self._cancelled = True
         self._finished = True
Beispiel #40
0
def on_data1_input():
    global idtimer
    timer.clear_timeout(idtimer)
    idtimer = timer.set_timeout(on_recherche_click, 1500)
Beispiel #41
0
 def window_scrolled(event):
     global scrolling_timeout
     if scrolling_timeout:
         clear_timeout(scrolling_timeout)
     scrolling_timeout = set_timeout(scrolled_timeout, 500)
Beispiel #42
0
 def process(key=None):
     capture_key.unbind('keypress')
     capture_key.remove()
     callback(key)
     if timeout:
         timer.clear_timeout(t)