[GTKUI] Fix magnet association button on Windows
This commit is contained in:
parent
da254a80cf
commit
14ee13bdd4
|
@ -33,6 +33,7 @@
|
||||||
* #378: Allow showing a pieces bar instead of a regular progress bar in a
|
* #378: Allow showing a pieces bar instead of a regular progress bar in a
|
||||||
torrent's status tab.
|
torrent's status tab.
|
||||||
* #2093: Make torrent opening compatible with all unicode paths.
|
* #2093: Make torrent opening compatible with all unicode paths.
|
||||||
|
* #1084: Fix magnet association button on Windows
|
||||||
|
|
||||||
==== WebUI ====
|
==== WebUI ====
|
||||||
* Server (deluge-web) now daemonizes by default, use -d or --do-not-daemonize to disable.
|
* Server (deluge-web) now daemonizes by default, use -d or --do-not-daemonize to disable.
|
||||||
|
|
|
@ -12,6 +12,7 @@ import os
|
||||||
import logging
|
import logging
|
||||||
import cPickle
|
import cPickle
|
||||||
import shutil
|
import shutil
|
||||||
|
import sys
|
||||||
|
|
||||||
import pygtk
|
import pygtk
|
||||||
pygtk.require('2.0')
|
pygtk.require('2.0')
|
||||||
|
@ -164,19 +165,17 @@ def associate_magnet_links(overwrite=False):
|
||||||
hkey = _winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT, "Magnet")
|
hkey = _winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT, "Magnet")
|
||||||
except WindowsError:
|
except WindowsError:
|
||||||
overwrite = True
|
overwrite = True
|
||||||
finally:
|
else:
|
||||||
_winreg.CloseKey(hkey)
|
_winreg.CloseKey(hkey)
|
||||||
|
|
||||||
if overwrite:
|
if overwrite:
|
||||||
_winreg.CreateKey(_winreg.HKEY_CLASSES_ROOT, "Magnet")
|
deluge_exe = os.path.join(os.path.dirname(sys.executable), "deluge.exe")
|
||||||
magnet_key = _winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT, "Magnet", 0, _winreg.KEY_WRITE)
|
magnet_key = _winreg.CreateKey(_winreg.HKEY_CLASSES_ROOT, "Magnet")
|
||||||
_winreg.SetValue(magnet_key, "", _winreg.REG_SZ, "URL:Magnet Protocol")
|
_winreg.SetValue(magnet_key, "", _winreg.REG_SZ, "URL:Magnet Protocol")
|
||||||
_winreg.SetValue(magnet_key, "URL Protocol", _winreg.REG_SZ, "")
|
_winreg.SetValueEx(magnet_key, "URL Protocol", 0, _winreg.REG_SZ, "")
|
||||||
_winreg.SetValue(magnet_key, "DefaultIcon", _winreg.REG_SZ, "")
|
_winreg.SetValueEx(magnet_key, "BrowserFlags", 0, _winreg.REG_DWORD, 0x8)
|
||||||
_winreg.SetValue(magnet_key + "/DefaultIcon", "", _winreg.REG_SZ, "deluge.exe,1")
|
_winreg.SetValue(magnet_key, "DefaultIcon", _winreg.REG_SZ, "{},0".format(deluge_exe))
|
||||||
_winreg.SetValue(magnet_key, "shell\open\command", _winreg.REG_SZ, "")
|
_winreg.SetValue(magnet_key, r"shell\open\command", _winreg.REG_SZ, '"{}" "%1"'.format(deluge_exe))
|
||||||
## need to find current running dir: os.path.dirname(os.path.realpath(__file__))
|
|
||||||
_winreg.SetValue(magnet_key + "\shell\open\command", "", _winreg.REG_SZ, "C:\Program Files\Deluge\deluge.exe" "%1")
|
|
||||||
_winreg.CloseKey(magnet_key)
|
_winreg.CloseKey(magnet_key)
|
||||||
|
|
||||||
# Don't try associate magnet on OSX see: #2420
|
# Don't try associate magnet on OSX see: #2420
|
||||||
|
|
Loading…
Reference in New Issue