Example #1
0
  def to_designation(self):
    '''Look at current ESC arguments and return their meaning
    as a change in mapping in designation to code set
    '''
    if DEBUG:
      print 'ESC ' + str(self)
    if len(self._args) < 2:
      raise DecodingError()

    #strip the last byte of _args to examine, since it varies by final byte
    #(i.e. the final byte indicates the code set we'll change to)
    final_byte = self._args[-1]
    #TODO: check final_byte to make sure it's code_set or throw
    designation = self._args[:-1]
    if DEBUG:
      print 'final byte: {b}'.format(b=final_byte)
      print 'designation: {d}'.format(d=str(designation))
    code_set = code_set_handler_from_final_byte(final_byte)
    d = 0
    if designation in ESC.GRAPHIC_SETS_TABLE:
      if DEBUG:
        print 'designation in table'
      #for now i'm assuming i only need the designation g0-g3
      #and the final byte (to get the new code set)
      d = ESC.find_designation(designation)
    else:
      if DEBUG:
        print 'not in table'
      raise DecodingError()
    return (d, code_set)
    def to_designation(self):
        '''Look at current ESC arguments and return their meaning
    as a change in mapping in designation to code set
    '''
        if DEBUG:
            print 'ESC ' + str(self)
        if len(self._args) < 2:
            raise DecodingError()

        #strip the last byte of _args to examine, since it varies by final byte
        #(i.e. the final byte indicates the code set we'll change to)
        final_byte = self._args[-1]
        #TODO: check final_byte to make sure it's code_set or throw
        designation = self._args[:-1]
        if DEBUG:
            print 'final byte: {b}'.format(b=final_byte)
            print 'designation: {d}'.format(d=str(designation))
        code_set = code_set_handler_from_final_byte(final_byte)
        d = 0
        if designation in ESC.GRAPHIC_SETS_TABLE:
            if DEBUG:
                print 'designation in table'
            #for now i'm assuming i only need the designation g0-g3
            #and the final byte (to get the new code set)
            d = ESC.find_designation(designation)
        else:
            if DEBUG:
                print 'not in table'
            raise DecodingError()
        return (d, code_set)
Example #3
0
 def designate(self, decoder, final_byte):
   '''cause in  Designation change on decoder
   '''
   decoder._G3.set(code_set_handler_from_final_byte(final_byte))
 def designate(self, decoder, final_byte):
     '''cause in  Designation change on decoder
 '''
     decoder._G3.set(code_set_handler_from_final_byte(final_byte))