예제 #1
0
 def display_move_on_clock(self, message):
     """Display a move on the web clock."""
     is_new_rev2 = self.dgtboard.is_revelation and self.dgtboard.enable_revelation_pi
     if self.enable_dgt3000 or is_new_rev2 or self.enable_dgtpi:
         bit_board, text = self.get_san(message, not self.enable_dgtpi)
         points = '...' if message.side == ClockSide.RIGHT else '.'
         if self.enable_dgtpi:
             text = '{:3d}{:s}{:s}'.format(bit_board.fullmove_number,
                                           points, text)
         else:
             text = '{:2d}{:s}{:s}'.format(bit_board.fullmove_number % 100,
                                           points, text)
     else:
         text = message.move.uci()
         if message.side == ClockSide.RIGHT:
             text = text[:2].rjust(3) + text[2:].rjust(3)
         else:
             text = text[:2].ljust(3) + text[2:].ljust(3)
     if self.get_name() not in message.devs:
         logging.debug('ignored %s - devs: %s', text, message.devs)
         return True
     self.clock_show_time = False
     self._create_clock_text()
     logging.debug('[%s]', text)
     self.shared['clock_text'] = text
     result = {'event': 'Clock', 'msg': text}
     DisplayMsg.show(Message.DISPLAY_TEXT(text=result))
     EventHandler.write_to_clients(result)
     return True
예제 #2
0
 def display_text_on_clock(self, message):
     """Display a text on the web clock."""
     is_new_rev2 = self.dgtboard.is_revelation and self.dgtboard.enable_revelation_pi
     if self.enable_dgtpi or is_new_rev2:
         text = message.l
     else:
         text = message.m if self.enable_dgt3000 else message.s
     if self.get_name() not in message.devs:
         logging.debug('ignored %s - devs: %s', text, message.devs)
         return True
     self.clock_show_time = False
     self._create_clock_text()
     logging.debug('[%s]', text)
     self.shared['clock_text'] = text
     result = {'event': 'Clock', 'msg': text}
     EventHandler.write_to_clients(result)
     DisplayMsg.show(Message.DISPLAY_TEXT(text=result))
     return True
 def display_text_on_clock(self, message):
     """Display a text on the web clock."""
     if self.enable_dgtpi:
         text = message.l
     else:
         text = message.m if self.enable_dgt3000 else message.s
     if text is None:
         text = message.m
     if self.get_name() not in message.devs:
         logging.debug('ignored %s - devs: %s', text, message.devs)
         return True
     self.clock_show_time = False
     self._create_clock_text()
     self.shared['clock_text'] = text
     result = {'event': 'Clock', 'msg': text}
     DisplayMsg.show(Message.DISPLAY_TEXT(text=result))
     EventHandler.write_to_clients(result)
     return True