<s> from pyjamas import Factory <EOL> from pyjamas import DOM <EOL> from pyjamas . dnd . DNDHelper import dndHelper <EOL> from pyjamas . ui . Widget import Widget <EOL> from pyjamas . ui . DropHandler import DropHandler <EOL> import pyjd <EOL> class DropWidget ( object ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> class Html5DropWidget ( Widget , DropHandler ) : <EOL> def __init__ ( self , ** kw ) : <EOL> if ( not hasattr ( self , '<STR_LIT>' ) ) or kw : <EOL> Widget . __init__ ( self , ** kw ) <EOL> DropHandler . __init__ ( self ) <EOL> self . addDropListener ( self ) <EOL> class EmulatedDropWidget ( Html5DropWidget ) : <EOL> def __init__ ( self , ** kw ) : <EOL> Html5DropWidget . __init__ ( self , ** kw ) <EOL> dndHelper . registerTarget ( self ) <EOL> def init ( is_native = None ) : <EOL> global DropWidget <EOL> if is_native is None : <EOL> html5_dnd = hasattr ( DOM . createElement ( '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> else : <EOL> html5_dnd = is_native <EOL> if html5_dnd : <EOL> DropWidget = Html5DropWidget <EOL> else : <EOL> DropWidget = EmulatedDropWidget <EOL> if pyjd . is_desktop : <EOL> init ( pyjd . native_dnd ) <EOL> else : <EOL> init ( None ) <EOL> Factory . registerClass ( '<STR_LIT>' , '<STR_LIT>' , DropWidget ) </s>
