Hi Justin,

When I drop a file from \100.0.0.1\share\folder\file.txt  onto a cmd window
(Windows 7), the whole path is entered in the cmd window.

// Fredrik


On Fri, Mar 13, 2015 at 9:40 PM Justin Israel <justinisr...@gmail.com>
wrote:

> What happens when you drag and drop that same thing onto a cmd terminal? I
> might be wrong, but my guess is that it is the actual mime data being
> delivered to your application.
>
> On Sat, Mar 14, 2015 at 12:55 AM Fredrik Averpil <
> fredrik.aver...@gmail.com> wrote:
>
>> Well, that's what I thought too, from reading the docs.
>>
>> But when dragging a file from \\100.0.0.1\share\folder\file.txt onto my
>> droppable widget will result in the url: /share/folder/file.txt ... with
>> the whole hostname/ipaddr omitted from the url. A bit confusing...
>>
>> // Fredrik
>>
>>
>>
>> On Fri, Mar 13, 2015 at 11:38 AM Justin Israel <justinisr...@gmail.com>
>> wrote:
>>
>>> I don't recall there being too much variation in the way you retrieve
>>> the path of a dropped file. You just check for the urls, and for text. It's
>>> up to the underlying platform specific code to deliver the mime info as
>>> part of its drop.
>>>
>>> On Fri, 13 Mar 2015 9:48 PM Fredrik Averpil <fredrik.aver...@gmail.com>
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> I've created a custom QLabel class which allows dropping a file onto
>>>> it. But I'm having issues with fetching the filepath of the dropped file
>>>> when dropped from anything but a Windows drive letter. So for example if
>>>> you drag and drop a file from a network share (which has not been mapped to
>>>> drive letter), I'm not getting the absolute full path. Also, on Mac OS X my
>>>> code does not seem to work at all.
>>>>
>>>> I'm totally new to the whole drag and drop concept and I feel I haven't
>>>> had the time to read up on this prior to dig into code. So I'm a little
>>>> lost on the concept side of things.
>>>>
>>>> Do I have to check for the filepath of the dropped file in several
>>>> different ways? This seems somewhat odd...
>>>>
>>>> Any tips or ideas on how to deal with this are very much welcome.
>>>>
>>>> Cheers,
>>>> Fredrik
>>>>
>>>>
>>>> This is the code I have currently:
>>>>
>>>> class DropableQLabel(QtGui.QLabel):
>>>>     def __init__(self, parent):
>>>>         super(DropableQLabel, self).__init__(parent)
>>>>
>>>>         self.skalman = parent.skalman
>>>>         self.skalman.browser = parent
>>>>
>>>>         self.setFixedWidth(300)
>>>>         self.setFixedHeight(169)
>>>>         self.setFrameShape(QtGui.QFrame.Box)
>>>>         self.setAlignment(QtCore.Qt.AlignCenter)
>>>>         self.setAcceptDrops(True)
>>>>
>>>>
>>>>     def dragEnterEvent(self, event):
>>>>         print 'Entered droppable area'
>>>>         if event.mimeData().hasUrls():
>>>>             event.acceptProposedAction()
>>>>         else:
>>>>             super(DropableQLabel, self).dragEnterEvent(event)
>>>>
>>>>
>>>>     def dropEvent(self, event):
>>>>         if event.mimeData().hasUrls():
>>>>             for url in event.mimeData().urls():
>>>>                 print url.path() # this is not always an absolute filepath
>>>>
>>>>
>>>>             event.acceptProposedAction()
>>>>         else:
>>>>             super(DropableQLabel,self).dropEvent(event)
>>>>
>>>> ​
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Python Programming for Autodesk Maya" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to python_inside_maya+unsubscr...@googlegroups.com.
>>>> To view this discussion on the web visit https://groups.google.com/d/
>>>> msgid/python_inside_maya/CAD%3DwhWP6rn%2B6-A8dd4p1TA6gRu3FSDw%
>>>> 2Bc5vWsfJ1gmfOUUWdmQ%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/python_inside_maya/CAD%3DwhWP6rn%2B6-A8dd4p1TA6gRu3FSDw%2Bc5vWsfJ1gmfOUUWdmQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Python Programming for Autodesk Maya" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to python_inside_maya+unsubscr...@googlegroups.com.
>>>
>> To view this discussion on the web visit https://groups.google.com/d/
>>> msgid/python_inside_maya/CAPGFgA0xf%3DG42_%3D%3DHo8YisEH%2Bg4DmDEpx%
>>> 2BNNnbEVAVySp%2B7DOw%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA0xf%3DG42_%3D%3DHo8YisEH%2Bg4DmDEpx%2BNNnbEVAVySp%2B7DOw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>
>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Python Programming for Autodesk Maya" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to python_inside_maya+unsubscr...@googlegroups.com.
>>
> To view this discussion on the web visit https://groups.google.com/d/
>> msgid/python_inside_maya/CAD%3DwhWMxSmGwRmUqdK7XdD2h7ryRn4r
>> gEM-dX60mv9B3p1fGng%40mail.gmail.com
>> <https://groups.google.com/d/msgid/python_inside_maya/CAD%3DwhWMxSmGwRmUqdK7XdD2h7ryRn4rgEM-dX60mv9B3p1fGng%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>
>
>> For more options, visit https://groups.google.com/d/optout.
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to python_inside_maya+unsubscr...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/python_inside_maya/CAPGFgA2CGJve8MCjqx8S%
> 3DEHemajOWFysYtMj4Y24uL5j3YzCwQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2CGJve8MCjqx8S%3DEHemajOWFysYtMj4Y24uL5j3YzCwQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAD%3DwhWP3knkKCWDH_m08fAUzcZgh3wF4OhYFO9khXo7p6%2B7H5Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to