parent
01888e39a3
commit
0574db26f6
|
@ -30,6 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- fixed wrong icons directory for gtk-update-icon-cache
|
- fixed wrong icons directory for gtk-update-icon-cache
|
||||||
- fixed missing directories when uninstalling
|
- fixed missing directories when uninstalling
|
||||||
- fixed bug introduced by r420 with RCS VCS
|
- fixed bug introduced by r420 with RCS VCS
|
||||||
|
- fixed broken drag'n'drop since migration to Python3/GTK3
|
||||||
|
|
||||||
## [0.4.8] - 2014-07-18
|
## [0.4.8] - 2014-07-18
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -148,6 +148,8 @@ import subprocess
|
||||||
import unicodedata
|
import unicodedata
|
||||||
import webbrowser
|
import webbrowser
|
||||||
|
|
||||||
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
if not hasattr(__builtins__, 'WindowsError'):
|
if not hasattr(__builtins__, 'WindowsError'):
|
||||||
# define 'WindowsError' so 'except' statements will work on all platforms
|
# define 'WindowsError' so 'except' statements will work on all platforms
|
||||||
WindowsError = IOError
|
WindowsError = IOError
|
||||||
|
@ -2920,43 +2922,6 @@ def path2url(path, proto='file'):
|
||||||
r.append(c)
|
r.append(c)
|
||||||
return ''.join(r)
|
return ''.join(r)
|
||||||
|
|
||||||
# returns a path to a file named by the file URL 's'
|
|
||||||
def url2path(s):
|
|
||||||
n = len(s)
|
|
||||||
if n > 7 and s.startswith('file://'):
|
|
||||||
ss, i = [], 7
|
|
||||||
if isWindows():
|
|
||||||
if s[i] == '/':
|
|
||||||
i += 1
|
|
||||||
else:
|
|
||||||
# share
|
|
||||||
ss.append('//')
|
|
||||||
while i < n:
|
|
||||||
c = s[i]
|
|
||||||
i += 1
|
|
||||||
if c == '%':
|
|
||||||
v = 0
|
|
||||||
for j in 0, 1:
|
|
||||||
if i < n:
|
|
||||||
p = ord(s[i])
|
|
||||||
if p >= 48 and p <= 57:
|
|
||||||
p -= 48
|
|
||||||
elif p >= 65 and p <= 70:
|
|
||||||
p -= 55
|
|
||||||
elif p >= 97 and p <= 102:
|
|
||||||
p -= 87
|
|
||||||
else:
|
|
||||||
p = None
|
|
||||||
if p is not None:
|
|
||||||
v = 16 * v + p
|
|
||||||
i += 1
|
|
||||||
c = chr(v)
|
|
||||||
elif c == '|' and isWindows():
|
|
||||||
c = ':'
|
|
||||||
ss.append(c)
|
|
||||||
s = ''.join(ss)
|
|
||||||
return s.replace('/', os.sep)
|
|
||||||
|
|
||||||
# the file diff viewer is always in one of these modes defining the cursor,
|
# the file diff viewer is always in one of these modes defining the cursor,
|
||||||
# and hotkey behaviour
|
# and hotkey behaviour
|
||||||
LINE_MODE = 0
|
LINE_MODE = 0
|
||||||
|
@ -7077,31 +7042,13 @@ class Diffuse(Gtk.Window):
|
||||||
|
|
||||||
# callback used when receiving drag-n-drop data
|
# callback used when receiving drag-n-drop data
|
||||||
def drag_data_received_cb(self, widget, context, x, y, selection, targettype, eventtime, f):
|
def drag_data_received_cb(self, widget, context, x, y, selection, targettype, eventtime, f):
|
||||||
# parse uri-list
|
# get uri list
|
||||||
s = selection.data
|
uris = selection.get_uris()
|
||||||
ss, i, n = [], 0, len(s)
|
|
||||||
while i < n:
|
|
||||||
# skip separators
|
|
||||||
while i < n:
|
|
||||||
v = ord(s[i])
|
|
||||||
if v > 32 and v < 127:
|
|
||||||
break
|
|
||||||
i += 1
|
|
||||||
start = i
|
|
||||||
# find end of item
|
|
||||||
while i < n:
|
|
||||||
v = ord(s[i])
|
|
||||||
if v <= 32 or v >= 127:
|
|
||||||
break
|
|
||||||
i += 1
|
|
||||||
if i > start:
|
|
||||||
p = url2path(s[start:i])
|
|
||||||
if p is not None:
|
|
||||||
ss.append(p)
|
|
||||||
# load the first valid file
|
# load the first valid file
|
||||||
for s in ss:
|
for uri in uris:
|
||||||
if os.path.isfile(s):
|
path = urlparse(uri).path
|
||||||
self.loadFromInfo(f, FileInfo(s))
|
if os.path.isfile(path):
|
||||||
|
self.loadFromInfo(f, FileInfo(path))
|
||||||
break
|
break
|
||||||
|
|
||||||
# change the file info for pane 'f' to 'info'
|
# change the file info for pane 'f' to 'info'
|
||||||
|
|
Loading…
Reference in New Issue