Ejemplo n.º 1
0
    def query_target_count(self, target):
        '''return the target count'''
        rq = _NVCtrlQueryTargetCountRequest(self.opcode, target.type())
        binrp = minx.Xchange(self.xsock, rq)

        if binrp[0] == 0:
            raise minx.XServerError(binrp)
        else:
            return _NVCtrlQueryTargetCountReply(binrp)
Ejemplo n.º 2
0
    def query_valid_attr_values(self, target, displays, attr):
        display_mask = self._displays2mask(displays)
        rq = _NVCtrlQueryValidAttributeValuesRequest(self.opcode, target.id(),
            target.type(), display_mask, attr)
        binrp = minx.Xchange(self.xsock, rq)

        if binrp[0] == 0:
            raise minx.XServerError(binrp)
        else:
            return _NVCtrlQueryValidAttributeValuesReply(binrp)
Ejemplo n.º 3
0
    def query_binary_data(self, target, displays, attr):
        '''return binary data'''
        display_mask = self._displays2mask(displays)
        rq = _NVCtrlQueryBinaryDataRequest(self.opcode, target.id(),
                                           target.type(), display_mask, attr)
        binrp = minx.Xchange(self.xsock, rq)

        if binrp[0] == 0:
            raise minx.XServerError(binrp)
        else:
            return _NVCtrlQueryBinaryDataReply(binrp)
Ejemplo n.º 4
0
    def query_int_attribute(self, target, displays, attr):
        '''return the value of an integer attribute'''
        display_mask = self._displays2mask(displays)
        rq = _NVCtrlQueryAttributeRequest(self.opcode, target.id(),
                                          target.type(), display_mask, attr)
        binrp = minx.Xchange(self.xsock, rq)

        if binrp[0] == 0:
            raise minx.XServerError(binrp)
        else:
            return _NVCtrlQueryAttributeReply(binrp)
Ejemplo n.º 5
0
    def string_operation(self, target, displays, attr, data):
        '''execute a string operation'''
        display_mask = self._displays2mask(displays)
        rq = _NVCtrlStringOperationRequest(self.opcode, target.id(),
            target.type(), display_mask, attr, data)
        binrp = minx.Xchange(self.xsock, rq)

        if binrp[0] == 0:
            raise minx.XServerError(binrp)
        else:
            return _NVCtrlStringOperationReply(binrp)
Ejemplo n.º 6
0
    def set_string_attribute(self, target, displays, attr, data):
        '''set the value of a string attribute. target has to be a Screen.'''
        if not isinstance(target, Screen):
            raise ValueError( 'SetStringAttribute can only be executed on a screen' )

        display_mask = self._displays2mask(displays)
        rq = _NVCtrlSetStringAttributeRequest(self.opcode, target.id(),
            display_mask, attr, data)
        binrp = minx.Xchange(self.xsock, rq)

        if binrp[0] == 0:
            raise minx.XServerError(binrp)
        else:
            return _NVCtrlSetStringAttributeReply(binrp)
Ejemplo n.º 7
0
    def get_version(self):
        '''this function uses NVCtrlQueryExtension to get
        the major and minor versions of the NV-CONTROL extension
        in use. returned as a tuple (major,minor)'''

        if self.version:
            return self.version

        rq = _NVCtrlQueryExtensionRequest(self.opcode)
        binrp = minx.Xchange(self.xsock, rq)

        if binrp[0] == 0:
            raise minx.XServerError(binrp)
        else:
            nvc = _NVCtrlQueryExtensionReply(binrp)
            self.version = (nvc.major, nvc.minor)
            return self.version