Example #1
0
 def __init__(self, tile=None, meld=None):
     assert bool(tile) != bool(meld)
     QMimeData.__init__(self)
     self.tile = tile
     self.meld = meld
     if self.tile:
         self.setText(tile.element)
     else:
         self.setText(meld.joined)
Example #2
0
 def __init__(self, tile=None, meld=None):
     assert bool(tile) != bool(meld)
     QMimeData.__init__(self)
     self.tile = tile
     self.meld = meld
     if self.tile:
         self.setText(tile.element)
     else:
         self.setText(meld.joined)
Example #3
0
    def __init__(self, data=None): 
        """ 
        Initialise the instance. 
        """ 
        QMimeData.__init__(self) 

        # Keep a local reference to be returned if possible. 
        self._local_instance = data 

        if data is not None: 
            # We may not be able to pickle the data. 
            try: 
                pdata = dumps(data) 
            except: 
                return 

            # This format (as opposed to using a single sequence) allows the 
            # type to be extracted without unpickling the data itself. 
            self.setData(self.MIME_TYPE, dumps(data.__class__) + pdata) 
Example #4
0
    def __init__ ( self, data = None ):
        """ Initialise the instance.
        """
        QMimeData.__init__( self )

        # Keep a local reference to be returned if possible:
        self._local_instance = data

        if data is not None:
            # Pickle both the class and the data. This format (as opposed to
            # using a single sequence) allows the type to be extracted without
            # unpickling the data itself.

            # We may not be able to pickle the data:
            try:
                pdata = dumps( data.__class__ ) + dumps( data )
            except:
                pdata = dumps( None ) + dumps( None )

            self.setData( self.MIME_TYPE, pdata )