[PyQt] clipboard not work on GNOME/Unity?
zw g
pekingmaster at gmail.com
Tue Sep 11 03:12:12 BST 2012
Anyone? Some suggestion would be fine.
Thanks.
On Sat, Sep 8, 2012 at 8:17 PM, zw g <pekingmaster at gmail.com> wrote:
> Dear list,
>
>
> How can i copy files between applications on GNOME/Unity desktop(with
> Nautilus file manager)?
>
> The below code works fine on KDE & Mac OS X(Finder), but not work on
> GNOME/Unity-based desktop.
> The section marked with *bold* were the part i used for copy & paster
> files. (Paste the files i copied from my PyQt app to somewhere on the
> filesystem, /home/myuser/, etc.)
>
>
> def buildContextMenu(self):
> self.contextMenu = QMenu(self)
> copyAction = QAction(self.trUtf8('Copy'), self)
> self.contextMenu.addAction(copyAction)
>
> self.connect(copyAction, SIGNAL('triggered()'),
> self.copy2clipboard)
>
> def copy2clipboard(self):
> selectedList = self.selectedIndexes()
> if selectedList:
> paths = []
> for i in selectedList:
> p = unicode(i.model().filePath(i))
> if p not in paths:
> paths.append(p)
> *
> urls = [QUrl.fromLocalFile(i) for i in paths]
>
> mime_data = QMimeData()
> mime_data.setUrls(urls)
>
> clipboard = QApplication.clipboard()
> clipboard.setMimeData(mime_data)*
>
>
> Any help would be appreciated.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20120911/7cd16b3f/attachment.html>
More information about the PyQt
mailing list