Got python3/Qt5 port working in Windows, but still need to finish packaging (#261)

This commit is contained in:
Micah Lee 2016-02-15 13:06:12 -08:00
parent a11cbe4f82
commit d1c36fa04f
4 changed files with 16 additions and 30 deletions

View file

@ -161,21 +161,7 @@ class ServerStatus(QtWidgets.QVBoxLayout):
"""
url = 'http://{0:s}/{1:s}'.format(self.app.onion_host, self.web.slug)
if platform.system() == 'Windows':
# Qt's QClipboard isn't working in Windows
# https://github.com/micahflee/onionshare/issues/46
import ctypes
GMEM_DDESHARE = 0x2000
ctypes.windll.user32.OpenClipboard(None)
ctypes.windll.user32.EmptyClipboard()
hcd = ctypes.windll.kernel32.GlobalAlloc(GMEM_DDESHARE, len(bytes(url)) + 1)
pch_data = ctypes.windll.kernel32.GlobalLock(hcd)
ctypes.cdll.msvcrt.strcpy(ctypes.c_char_p(pch_data), bytes(url))
ctypes.windll.kernel32.GlobalUnlock(hcd)
ctypes.windll.user32.SetClipboardData(1, hcd)
ctypes.windll.user32.CloseClipboard()
else:
clipboard = self.qtapp.clipboard()
clipboard.setText(url)
clipboard = self.qtapp.clipboard()
clipboard.setText(url)
self.url_copied.emit()