Esempio n. 1
0
 def __init__( self ):
     self.__attribs  = SetBits()
     self.__ch       = ' '
     return
Esempio n. 2
0
class PageCell( object ):
    def __init__( self ):
        self.__attribs  = SetBits()
        self.__ch       = ' '
        return
    # end def

    def __del__( self ):
        return
    # end def


    def Get( self ):
        return self.__ch
    # end def

    def getAttr( self ):
        return self.__attribs
    # end def

    def Set( self, value, attrs = None ):
        if type( value ) in [ str, unicode ]:
            self.__ch = value
            self.__attribs.setBit( m_charDirtyCell )
            if attrs is not None:
                 self.SetAttributes( attrs )
            # end def
        elif type( value ) is PageCell:
            self.__ch = value.Get()
            self.__attribs.Set( value.GetAttr() )
            self.__attribs.setBit( m_charDirtyCell )
        # end def
        return
    # end def

    def SetAttributes( self, iAttribs ):
        self.__attribs.setInteger( iAttribs >> 8 )
        return
    # end def

    def GetAttributes( self ):
        return self.__attribs.getInteger() << 8
    # end def

    def AsInt( self ):
        return self.GetAttributes() | ord( self.__ch )
    # end def

    def Clear( self, attributes = None ):
        self.__ch = ' '
        if attributes is None:
            self.__attribs.Clear()
            self.__attribs.setBit( m_vidNormal )
        else:
            self.SetAttributes( attributes )
        # end if
        return
    # end def

    def ClearVideoAttribs( self ):
        self.__attribs.setBit( m_vidNormal )
        self.__attribs.clearBit( m_vidBlinking )
        self.__attribs.clearBit( m_vidReverse )
        self.__attribs.clearBit( m_vidInvis )
        self.__attribs.clearBit( m_vidUnderline )
        self.__attribs.setBit( m_charDirtyCell )
        return
    # end def


    def ClearTo( self, ch ):
        """
            ClearTo doesn't set the dirty flag
        """
        self.__ch = ch
        self.__attribs.Clear()
        self.__attribs.setBit( m_vidNormal )
        return
    # end def

    def SetDirty( self, val ):
        if val:
            self.__attribs.setBit( m_charDirtyCell )
        else:
            self.__attribs.clearBit( m_charDirtyCell )
        # end if
        return
    # end def

    def IsDirty( self ):
        return self.__attribs.testBit( m_charDirtyCell )
    # end def

    def SetNormal( self, val ):
        if val:
            self.__attribs.setBit( m_vidNormal )
        else:
            self.__attribs.clearBit( m_vidNormal )
        # end if
        return
    # end def

    def IsNormal( self ):
        return self.__attribs.testBit( m_vidNormal )
    # end def

    def SetBlinking( self, val ):
        if val:
            self.__attribs.setBit( m_vidBlinking )
        else:
            self.__attribs.clearBit( m_vidBlinking )
        # end if
        return
    # end def

    def IsBlinking( self ):
        return self.__attribs.testBit( m_vidBlinking )
    # end def

    def SetReverse( self, val ):
        if val:
            self.__attribs.setBit( m_vidReverse )
        else:
            self.__attribs.clearBit( m_vidReverse )
        # end if
        return
    # end def

    def IsReverse( self ):
        return self.__attribs.testBit( m_vidReverse )
    # end def

    def SetInvis( self, val ):
        if val:
            self.__attribs.setBit( m_vidInvis )
        else:
            self.__attribs.clearBit( m_vidInvis )
        # end if
        return
    # end def

    def IsInvis( self ):
        return self.__attribs.testBit( m_vidInvis )
    # end def

    def SetUnderline( self, val ):
        if val:
            self.__attribs.setBit( m_vidUnderline )
        else:
            self.__attribs.clearBit( m_vidUnderline )
        # end if
        return
    # end def

    def IsUnderline( self ):
        return self.__attribs.testBit( m_vidUnderline )
    # end def

    def SetUnprotect( self, val ):
        if val:
            self.__attribs.setBit( m_datUnprotect )
        else:
            self.__attribs.clearBit( m_datUnprotect )
        # end if
        return
    # end def

    def IsUnprotect( self ):
        return self.__attribs.testBit( m_datUnprotect )
    # end def

    def SetStartField( self, val ):
        if val:
            self.__attribs.setBit( m_charStartField )
        else:
            self.__attribs.clearBit( m_charStartField )
        # end if
        return
    # end def

    def IsStartField( self ):
        return self.__attribs.testBit( m_charStartField )
    # end def

    def SetMDT( self, val ):
        if val:
            self.__attribs.setBit( m_datMdt )
        else:
            self.__attribs.clearBit( m_datMdt )
        # end if
        return
    # end def

    def IsMDT( self ):
        return self.__attribs.testBit( m_datMdt )
    # end def

    def SetKeyUpshift( self, val ):
        if val:
            self.__attribs.setBit( m_keyUpshift )
        else:
            self.__attribs.clearBit( m_keyUpshift )
        # end def
        return
    # end def

    def IsKeyUpshift( self ):
        return self.__attribs.testBit( m_keyUpshift )