2007-12-21 Gary Burton <gary.burton@zen.co.uk>

* src/ScratchPad.py: allow items to be moved, feature #1465



svn: r9556
This commit is contained in:
Gary Burton 2007-12-21 22:16:28 +00:00
parent 104875c5a3
commit 0e89fd5ed0
2 changed files with 21 additions and 9 deletions

View File

@ -1,3 +1,6 @@
2007-12-21 Gary Burton <gary.burton@zen.co.uk>
* src/ScratchPad.py: allow items to be moved, feature #1465
2007-12-21 Douglas S. Blank <dblank@cs.brynmawr.edu>
* src/DataViews/_PersonView.py: pass create_quickreport uistate
* src/Editors/_EditPrimary.py: pass create_quickreport uistate

View File

@ -31,13 +31,19 @@ from xml.sax.saxutils import escape
from gettext import gettext as _
from time import strftime as strftime
try:
import fcntl
use_lock = True
except:
use_lock = False
#-------------------------------------------------------------------------
#
# GTK/Gnome modules
#
#-------------------------------------------------------------------------
import gtk
from gtk.gdk import ACTION_COPY, BUTTON1_MASK
from gtk.gdk import ACTION_COPY, BUTTON1_MASK, ACTION_MOVE
#-------------------------------------------------------------------------
#
@ -64,6 +70,13 @@ _stock_image = os.path.join(const.IMAGE_DIR,'stock_link.png')
LINK_PIC = gtk.gdk.pixbuf_new_from_file(_stock_image)
BLANK_PIC = gtk.gdk.Pixbuf(0,0,8,1,1)
#-------------------------------------------------------------------------
#
# The file used to store the state of the scratchpad between sessions
#
#-------------------------------------------------------------------------
SCRATCHPAD_FILE = os.path.join(const.HOME_DIR,"scratchpad.dat")
#-------------------------------------------------------------------------
#
# wrapper classes to provide object specific listing in the ListView
@ -1033,7 +1046,7 @@ class ScratchPadListView:
targets = [ScratchPadListView.LOCAL_DRAG_TARGET] + \
[target.target() for target in o.__class__.DROP_TARGETS]
self._widget.enable_model_drag_source(BUTTON1_MASK, targets, ACTION_COPY)
self._widget.enable_model_drag_source(BUTTON1_MASK, targets, ACTION_COPY | ACTION_MOVE)
def object_drag_begin(self, context, a):
return
@ -1046,11 +1059,6 @@ class ScratchPadListView:
sel_data.set(sel_data.target, 8, o.pack())
def object_drag_data_received(self,widget,context,x,y,selection,info,time):
# Ignore drops from the same widget.
if ScratchPadListView.LOCAL_DRAG_TYPE in context.targets:
return
model = widget.get_model()
sel_data = selection.data
@ -1102,6 +1110,8 @@ class ScratchPadListView:
else:
model.append([o.__class__.DRAG_TARGET.drag_type,o,o.tooltip])
if context.action == ACTION_MOVE:
context.finish(True, True, time)
# remember time for double drop workaround.
self._previous_drop_time = realTime
@ -1231,7 +1241,6 @@ class ScratchPadWindow(ManagedWindow.ManagedWindow):
model.remove(node)
return
def short(val,size=60):
if len(val) > size:
return "%s..." % val[0:size]