Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.0, 1.0.1, and 1.0.2

history: receive DnD event of bundle file/repo dir in location bar

In repo dir case, it just sets dir path to location bar.
In bundle file case, it starts bundle preview automatically.
But it can't recognize whether dropped file is valid bundle.

Changeset b72986b686f4

Parent cc567252f4e5

by Yuki KODAMA

Changes to one file · Browse files at b72986b686f4 Showing diff from parent cc567252f4e5 Diff from another changeset...

 
13
14
15
 
16
17
18
 
35
36
37
 
 
38
39
40
 
1417
1418
1419
 
 
 
 
 
 
1420
1421
1422
 
1980
1981
1982
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1983
1984
1985
 
13
14
15
16
17
18
19
 
36
37
38
39
40
41
42
43
 
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
 
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
@@ -13,6 +13,7 @@
 import shutil  import tempfile  import atexit +import urllib    from mercurial import ui, hg, cmdutil, commands, extensions, util, match, url  from mercurial import hbisect, error @@ -35,6 +36,8 @@
 MODE_DATE = 3  MODE_USER = 4   +HIST_DND_URI_LIST = 1024 +  class FilterBar(gtklib.SlimToolbar):   'Filter Toolbar for repository log'   @@ -1417,6 +1420,12 @@
  self.pathentry = urlcombo.get_child()   syncbox.append_widget(urlcombo, expand=True)   + ## dnd setup for path entry + self.dnd_targets = [('text/uri-list', 0, HIST_DND_URI_LIST)] + self.pathentry.drag_dest_set(gtk.DEST_DEFAULT_MOTION | \ + gtk.DEST_DEFAULT_DROP, self.dnd_targets, gtk.gdk.ACTION_MOVE) + self.pathentry.connect('drag-data-received', self.dnd_received) +   self.update_urllist()     ## post pull drop-down list @@ -1980,6 +1989,20 @@
  self.ppullcombo.set_active_iter(row.iter)   break   + def dnd_received(self, widget, context, x, y, sel, target_type, *args): + if target_type == HIST_DND_URI_LIST: + # borrow from cslist.py + for line in sel.data.rstrip('\x00').splitlines(): + if line.startswith('file:'): + path = os.path.normpath(urllib.url2pathname(line[5:])) + break + else: + return + if os.path.isfile(path): + self.set_bundlefile(path) + else: + self.pathentry.set_text(path) +   def realize_settings(self):   self.vpaned.set_position(self.setting_vpos)   self.hpaned.set_position(self.setting_hpos)