Dirty hack to get favorites re-ordering functional. All dnd working now

This commit is contained in:
Michael Webster 2013-03-08 15:25:14 -05:00
parent fffebe8897
commit a90cb0ac19
2 changed files with 6 additions and 4 deletions

View File

@ -319,6 +319,9 @@ class pluginclass( object ):
self.applicationList = [] self.applicationList = []
#self.menuFileMonitors = [] #self.menuFileMonitors = []
#dirty ugly hack, to get favorites drag origin position
self.drag_origin = None
self.rebuildLock = False self.rebuildLock = False
self.activeFilter = (1, "") self.activeFilter = (1, "")
@ -1483,8 +1486,6 @@ class pluginclass( object ):
self.favoritesBox.attach( favorite, col, col + 1, row, row + 1, yoptions = 0 ) self.favoritesBox.attach( favorite, col, col + 1, row, row + 1, yoptions = 0 )
def favoritesReorder( self, oldposition, newposition ): def favoritesReorder( self, oldposition, newposition ):
print oldposition, "old"
print newposition, "new"
if oldposition == newposition: if oldposition == newposition:
return return
tmp = self.favorites[ oldposition ] tmp = self.favorites[ oldposition ]
@ -1567,11 +1568,13 @@ class pluginclass( object ):
def onFavButtonDragReorderGet( self, widget, context, selection, targetType, eventTime ): def onFavButtonDragReorderGet( self, widget, context, selection, targetType, eventTime ):
if targetType == self.TARGET_TYPE_FAV: if targetType == self.TARGET_TYPE_FAV:
self.drag_origin = widget.position
selection.set( selection.target, 8, str(widget.position)) selection.set( selection.target, 8, str(widget.position))
def onFavButtonDragReorder( self, widget, context, x, y, selection, targetType, time ): def onFavButtonDragReorder( self, widget, context, x, y, selection, targetType, time ):
if targetType == self.TARGET_TYPE_FAV: if targetType == self.TARGET_TYPE_FAV:
self.favoritesReorder( int(selection.data), widget.position ) #self.favoritesReorder( int(selection.data), widget.position )
self.favoritesReorder( self.drag_origin, widget.position )
def menuChanged( self, x, y ): def menuChanged( self, x, y ):
# wait some miliseconds because there a multiple events send at the same time and we don't want to rebuild the menu for each # wait some miliseconds because there a multiple events send at the same time and we don't want to rebuild the menu for each

View File

@ -367,7 +367,6 @@ class ApplicationLauncher( easyButton ):
def dragDataGet( self, widget, context, selection, targetType, eventTime ): def dragDataGet( self, widget, context, selection, targetType, eventTime ):
print "drag data get"
if targetType == 100: # text/plain if targetType == 100: # text/plain
selection.set_text( "'" + self.desktopFile + "'", -1 ) selection.set_text( "'" + self.desktopFile + "'", -1 )
elif targetType == 101: # text/uri-list elif targetType == 101: # text/uri-list