def _makeObjects(self):
     self.data = DropData()
     self.fileObject = wx.FileDataObject()
     comp = wx.DataObjectComposite()
     comp.Add(self.data)
     comp.Add(self.fileObject)
     self.comp = comp
     self.SetDataObject(comp)
Exemple #2
0
    def make_drag_data(self, blist_item):
        data = wx.DataObjectComposite()

        import contacts.contactsdnd as contactsdnd
        contactsdnd.add_to_dataobject(data, blist_item)

        self.dragging_obj = blist_item
        return data
Exemple #3
0
    def __init__(self):
        wx.DropTarget.__init__(self)

        self.doComposite = wx.DataObjectComposite()
        self.filedo = wx.FileDataObject()

        self.doComposite.Add(self.filedo)
        self.SetDataObject(self.doComposite)
Exemple #4
0
 def InitObjects(self):
     """Initializes the text and file data objects"""
     self._data = wx.DataObjectComposite()
     self.txtdo = wx.TextDataObject()
     self.filedo = wx.FileDataObject()
     self._data.Add(self.txtdo, False)
     self._data.Add(self.filedo, True)
     self.SetDataObject(self._data)
Exemple #5
0
 def __init__(self, window, *args, **kwargs):
     super(NodeGraphDropTarget, self).__init__(*args, **kwargs)
     self._window = window
     self._composite = wx.DataObjectComposite()
     self._textDropData = wx.TextDataObject()
     self._fileDropData = wx.FileDataObject()
     self._composite.Add(self._textDropData)
     self._composite.Add(self._fileDropData)
     self.SetDataObject(self._composite)
Exemple #6
0
 def __init__(self, panel):
     wx.DropTarget.__init__(self)
     self.panel = panel
     self.data = wx.DataObjectComposite()
     self.filedrop = wx.FileDataObject()
     self.textdrop = wx.TextDataObject()
     self.data.Add(self.filedrop, False)
     self.data.Add(self.textdrop, False)
     self.SetDataObject(self.data)
Exemple #7
0
 def __init__(self, callback):
     super(ImageDropTarget, self).__init__()
     self.callback = callback
     self.do = wx.DataObjectComposite()
     self.file_do = wx.FileDataObject()
     self.url_do = wx.TextDataObject()
     self.do.Add(self.file_do)
     self.do.Add(self.url_do)
     self.SetDataObject(self.do)
Exemple #8
0
 def __init__(self, window, dndFiles, dndList):
     _wx.DropTarget.__init__(self)
     self.window = window
     self.data_object = _wx.DataObjectComposite()
     self.dataFile = _wx.FileDataObject()                 # Accept files
     self.dataList = _wx.CustomDataObject('ListIndexes')  # Accept indexes from a list
     if dndFiles: self.data_object.Add(self.dataFile)
     if dndList : self.data_object.Add(self.dataList)
     self.SetDataObject(self.data_object)
Exemple #9
0
 def test_get_mimedata(self):
     toolkit_data = wx.DataObjectComposite()
     text_data = wx.CustomDataObject(wx.DataFormat('text/plain'))
     text_data.SetData(b'hello world')
     toolkit_data.Add(text_data)
     data_wrapper = DataWrapper(toolkit_data=toolkit_data)
     self.assertEqual(data_wrapper.mimetypes(), {'text/plain'})
     self.assertEqual(data_wrapper.get_mimedata('text/plain'),
                      b'hello world')
Exemple #10
0
        def DoDragDrop():
            dd = wx.CustomDataObject("xxx")
            dd.SetData(str(c))

            data = wx.DataObjectComposite()
            data.Add(dd)

            dropSource = wx.DropSource(self)
            dropSource.SetData(data)
            result = dropSource.DoDragDrop(wx.Drag_AllowMove)
 def __init__(self, file_callback_fn, text_callback_fn):
     super(self.__class__, self).__init__()
     self.file_callback_fn = file_callback_fn
     self.text_callback_fn = text_callback_fn
     self.file_data_object = wx.FileDataObject()
     self.text_data_object = wx.TextDataObject()
     self.composite_data_object = wx.DataObjectComposite()
     self.composite_data_object.Add(self.file_data_object, True)
     self.composite_data_object.Add(self.text_data_object)
     self.SetDataObject(self.composite_data_object)
Exemple #12
0
		def DoDragDrop():
			dd = wx.CustomDataObject("special")
			dd.SetData(' '.join(nodeIDs))

			data = wx.DataObjectComposite()
			data.Add(dd)

			dropSource = wx.DropSource(self)
			dropSource.SetData(data)
			result = dropSource.DoDragDrop(wx.Drag_AllowMove)
Exemple #13
0
    def __init__(self, editor):
        wx.DropTarget.__init__(self)
        self._frame = editor._frame

        self.editor = editor
        self.data = wx.DataObjectComposite()
        self.text = wx.TextDataObject()
        self.data.Add(self.text)
        self.filenames = wx.FileDataObject()
        self.data.Add(self.filenames)
        self.SetDataObject(self.data)
 def __init__(self, editor):
     wx.DropTarget.__init__(self)
     self.editor = editor
     self.do = wx.DataObjectComposite()  # the dataobject that gets filled with the appropriate data
     self.filedo = wx.FileDataObject()
     self.textdo = wx.TextDataObject()
     self.bmpdo = wx.BitmapDataObject()
     self.do.Add(self.filedo)
     self.do.Add(self.bmpdo)
     self.do.Add(self.textdo)
     self.SetDataObject(self.do)
Exemple #15
0
    def InitObjects(self):
        """Initializes the text and file data objects
        @postcondition: all data objects are initialized

        """
        self._data['data'] = wx.DataObjectComposite()
        self._data['tdata'] = wx.TextDataObject()
        self._data['fdata'] = wx.FileDataObject()
        self._data['data'].Add(self._data['tdata'], True)
        self._data['data'].Add(self._data['fdata'], False)
        self.SetDataObject(self._data['data'])
Exemple #16
0
    def _create_data_objects(self, toplevel=False):
        data_objects = {}
        data_object = wx.DataObjectComposite()
        formats = [widget_data_format, sizer_data_format]
        if toplevel: formats.append(window_data_format)
        for fmt in formats:
            do = wx.CustomDataObject(fmt)
            data_objects[fmt.GetId()] = do
            data_object.Add(do)

        self.data_objects = data_objects
        self.data_object = data_object
Exemple #17
0
 def to_clipboard(self, textmodel):
     text = textmodel.get_text()
     plain = wx.TextDataObject()
     plain.SetText(text)
     pickled = wx.CustomDataObject("pytextmodel")
     pickled.SetData(cPickle.dumps(textmodel))
     data = wx.DataObjectComposite()
     data.Add(plain)
     data.Add(pickled)
     wx.TheClipboard.Open()
     wx.TheClipboard.SetData(data)
     wx.TheClipboard.Close()
Exemple #18
0
            def DoDragDrop():
                txt = tree.GetItemText(item)
                print "Starting drag'n'drop with %s..." % repr(txt)
                dd = DropData()
                dd.setObject(txt)

                comp = wx.DataObjectComposite()
                comp.Add(dd)
                dropSource = wx.DropSource(self)
                dropSource.SetData(comp)
                result = dropSource.DoDragDrop(wx.Drag_AllowMove)
                print "drag'n'drop finished with:", result, "\n"
Exemple #19
0
 def test_ignore_non_custom(self):
     toolkit_data = wx.DataObjectComposite()
     html_data = wx.HTMLDataObject()
     html_data.SetHTML("hello world")
     toolkit_data.Add(html_data)
     text_data = wx.CustomDataObject(wx.DataFormat('text/plain'))
     text_data.SetData(b'hello world')
     toolkit_data.Add(text_data)
     data_wrapper = DataWrapper(toolkit_data=toolkit_data)
     self.assertTrue('text/plain' in data_wrapper.mimetypes())
     self.assertEqual(data_wrapper.get_mimedata('text/plain'),
                      b'hello world')
Exemple #20
0
    def test_DataObjectComposite(self):
        do = wx.DataObjectComposite()
        df1 = wx.DataFormat("data type 1")
        df2 = wx.DataFormat("data type 2")
        d1 = wx.CustomDataObject(df1)
        d2 = wx.CustomDataObject(df2)
        do.Add(d1, True)
        do.Add(d2)

        self.assertTrue(do.GetPreferredFormat() == df1)
        d3 = do.GetObject(df2)
        self.assertTrue(isinstance(d3, wx.CustomDataObject))
        self.assertTrue(d3 is d2)
Exemple #21
0
	def __init__(self, panel):
		wx.PyDropTarget.__init__(self)
		self.panel = panel
		self.tree = self.panel.tree

		self.controllerData = wx.CustomDataObject("xxx")
		self.specialData = wx.CustomDataObject("special")

		self.data = wx.DataObjectComposite()
		self.data.Add(self.controllerData)
		self.data.Add(self.specialData)

		self.SetDataObject(self.data)
Exemple #22
0
    def __init__(self, formatNames, parent=None):
        wx.PyDropTarget.__init__(self)

        self.app = wx.GetApp()
        self.parent = parent

        # Specify the type of data we will accept
        self.doc = wx.DataObjectComposite()
        self.formats = {}
        for formatName in formatNames:
            do = wx.CustomDataObject(formatName)
            self.formats[formatName] = do
            self.doc.Add(do)
        self.SetDataObject(self.doc)
Exemple #23
0
    def __setDo(self):
        """
		"""

        # file and text names
        self.__fdo = wx.FileDataObject()
        self.__tdo = wx.TextDataObject()

        # allows several drop format
        self._do = wx.DataObjectComposite()
        self._do.Add(self.__tdo)
        self._do.Add(self.__fdo)

        self.SetDataObject(self._do)
Exemple #24
0
    def __init__(self, formatNames, fn, validateFn):
        wx.PyDropTarget.__init__(self)

        self.fn = fn
        self.validateFn = validateFn

        # Specify the type of data we will accept
        self.doc = wx.DataObjectComposite()
        self.formats = {}
        for formatName in formatNames:
            do = wx.CustomDataObject(formatName)
            self.formats[formatName] = do
            self.doc.Add(do)
        self.SetDataObject(self.doc)
Exemple #25
0
 def __init__(self, window, parent, i):
     wx.PyDropTarget.__init__(self)
     # the dataobject that gets filled with the appropriate data.
     self.dataobject = wx.DataObjectComposite()
     self.window = window
     self.parent = parent
     self.id_iterator = i
     self.filedo = wx.FileDataObject()
     self.textdo = wx.TextDataObject()
     self.bmpdo = wx.BitmapDataObject()
     self.dataobject.Add(self.filedo)
     self.dataobject.Add(self.bmpdo)
     self.dataobject.Add(self.textdo)
     self.SetDataObject(self.dataobject)
     self.my_send_dialogs = []
Exemple #26
0
 def copy(self):
     if not self.has_selection():
         return        
     s1, s2 = self.get_selected()[0] # XXXX
     part = self.model[s1:s2]
     text = part.get_text()
     plain = wx.TextDataObject()
     plain.SetText(text)
     pickled = wx.CustomDataObject("pytextmodel")
     pickled.SetData(cPickle.dumps(part))
     data = wx.DataObjectComposite()
     data.Add(plain)
     data.Add(pickled)
     wx.TheClipboard.Open()
     wx.TheClipboard.SetData(data)
     wx.TheClipboard.Close()
Exemple #27
0
    def __init__(self, window, log):
        wx.DropTarget.__init__(self)
        self.window = window
        self.log = log

        self.doComposite = wx.DataObjectComposite(
        )  # the dataobject that gets filled with the appropriate data
        self.filedo = wx.FileDataObject()
        self.textdo = wx.TextDataObject()
        self.bmpdo = wx.BitmapDataObject()
        self.urldo = wx.URLDataObject(url="")
        self.doComposite.Add(self.filedo)
        self.doComposite.Add(self.textdo)
        self.doComposite.Add(self.bmpdo)
        # self.doComposite.Add(self.urldo)  # bad combination..
        self.SetDataObject(self.doComposite)
Exemple #28
0
    def __init__(self, filenames_callable):

        wx.PyDropTarget.__init__(self)

        self._receiving_data_object = wx.DataObjectComposite()

        self._hydrus_media_data_object = wx.CustomDataObject(
            'application/hydrus-media')
        self._file_data_object = wx.FileDataObject()

        self._receiving_data_object.Add(self._hydrus_media_data_object, True)
        self._receiving_data_object.Add(self._file_data_object)

        self.SetDataObject(self._receiving_data_object)

        self._filenames_callable = filenames_callable
    def __init__(self, frame):
        wx.DropTarget.__init__(self)
        self._frame = frame

        self.source = -1
        self.tab = -1
        self.timer = wx.Timer()

        self.data = wx.DataObjectComposite()
        self.filenames = wx.FileDataObject()
        self.data.Add(self.filenames)
        self.text = wx.TextDataObject()
        self.data.Add(self.text)
        self.SetDataObject(self.data)

        self.timer.Bind(wx.EVT_TIMER, self.OnTimer)
Exemple #30
0
def get_data_object(widget):
    data = dump_widget(widget)
    # make a data object
    if isinstance(widget, edit_sizers.Sizer):
        do = wx.CustomDataObject(sizer_data_format)
    elif getattr(widget, "_is_toplevel", False):
        do = wx.CustomDataObject(window_data_format)
    else:
        do = wx.CustomDataObject(widget_data_format)
    do.SetData(data)
    cdo = wx.DataObjectComposite()
    cdo.Add(do)
    if widget.name:
        cdo.Add(wx.TextDataObject(widget.name),
                True)  # the widget name as text, preferred
    return cdo