Your message dated Fri, 2 Jan 2015 03:12:43 +0100
with message-id <[email protected]>
and subject line Re: [alacarte] GUI behaviour of right item pane does not meet 
expectations
has caused the Debian Bug report #562005,
regarding [alacarte] GUI behaviour of right item pane does not meet expectations
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
562005: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=562005
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: alacarte
Version: 0.12.4-1
Severity: normal
Tags: patch

--- Please enter the report below this line. ---

Hi,

naming conventions for the following description:
- "item pane": right half of the window
- "menu pane": left part of the window

various GUI actions of alacarte don't work as expected:

1) drag and drop of an item from the item pane "into" a menu item of the item
pane

I expect the dragged item to be moved into the selected target menu, but the
item just gets moved to the position after the target.
The same operation works as expected, if the destination is on the "menu pane".


2) moving a separator item from the item pane "into" a menu item of the "menu
pane"

I expect, that this removes the dragged separator from the original menu and
creates a new separator in the destination. The GUI feedback also indicates
this: the separator disappears.
But the separator is not moved at all: clicking on the original menu (for
refresh) causes the separator to appear again. The destination menu does not
contain a new separator.


3) dragging an item from the item pane to another position in the item pane
(between two other items)

This works as expected, if the destination is _above_ the current position of
the dragged item. But if it is below, then the item gets moved one position
further down, than expected.


The attached patch fixes these three issues.
I am not sure, if I handled the "undo" log properly, but the rest of the code
should be fine.

thanks for your work,
Lars

--- System information. ---
Architecture: i386
Kernel:       Linux 2.6.30-2-686

Debian Release: squeeze/sid
  990 testing         localhost 

--- Package information. ---
Depends               (Version) | Installed
===============================-+-=============
python                 (>= 2.4) | 2.5.4-2
python-support      (>= 0.90.0) | 1.0.6
python-gtk2         (>= 2.13.0) | 2.16.0-1
python-gmenu       (>= 2.27.92) | 2.28.0.1-1
gnome-menus        (>= 2.27.92) | 2.28.0.1-1
python-gobject      (>= 2.15.1) | 2.20.0-1


Recommends       (Version) | Installed
==========================-+-===========
gnome-panel                | 2.28.0-3


Package's Suggests field is empty.


-- 

gpg key: https://systemausfall.org/schluessel/lars-devel.0.asc
diff -ruN Alacarte.orig/MainWindow.py Alacarte/MainWindow.py
--- Alacarte.orig/MainWindow.py	2009-09-26 02:30:48.000000000 +0200
+++ Alacarte/MainWindow.py	2009-12-21 22:27:14.000000000 +0100
@@ -419,6 +419,8 @@
 				elif item.get_type() == gmenu.TYPE_DIRECTORY:
 					if self.editor.moveMenu(item, new_parent) == False:
 						self.loadUpdates()
+				elif item.get_type() == gmenu.TYPE_SEPARATOR:
+					self.editor.moveSeparator(item, new_parent)
 				else:
 					context.finish(False, False, etime) 
 				context.finish(True, True, etime)
@@ -495,7 +497,9 @@
 
 	def on_item_tree_drag_data_received(self, treeview, context, x, y, selection, info, etime):
 		items = treeview.get_model()
-		types = (gtk.TREE_VIEW_DROP_BEFORE,	gtk.TREE_VIEW_DROP_INTO_OR_BEFORE)
+		types_before = (gtk.TREE_VIEW_DROP_BEFORE, gtk.TREE_VIEW_DROP_INTO_OR_BEFORE)
+		types_into = (gtk.TREE_VIEW_DROP_INTO_OR_BEFORE, gtk.TREE_VIEW_DROP_INTO_OR_AFTER)
+		types_after = (gtk.TREE_VIEW_DROP_AFTER, gtk.TREE_VIEW_DROP_INTO_OR_AFTER)
 		if selection.target == 'ALACARTE_ITEM_ROW':
 			drop_info = treeview.get_dest_row_at_pos(x, y)
 			before = None
@@ -503,22 +507,32 @@
 			if self.drag_data == None:
 				return False
 			item = self.drag_data
+			# by default we assume, that the items stays in the same menu
+			destination = item.get_parent()
 			if drop_info:
 				path, position = drop_info
-				if position in types:
-					before = items[path][3]
+				target = items[path][3]
+				# move the item to the directory, if the item was dropped into it
+				if (target.get_type() == gmenu.TYPE_DIRECTORY) and (position in types_into):
+					# append the selected item to the choosen menu
+					destination = target
+				elif position in types_before:
+					before = target
+				elif position in types_after:
+					after = target
 				else:
-					after = items[path][3]
+					# this does not happen
+					pass
 			else:
 				path = (len(items) - 1,)
 				after = items[path][3]
 			if item.get_type() == gmenu.TYPE_ENTRY:
-				self.editor.moveItem(item, item.get_parent(), before, after)
+				self.editor.moveItem(item, destination, before, after)
 			elif item.get_type() == gmenu.TYPE_DIRECTORY:
-				if self.editor.moveMenu(item, item.get_parent(), before, after) == False:
+				if self.editor.moveMenu(item, destination, before, after) == False:
 					self.loadUpdates()
 			elif item.get_type() == gmenu.TYPE_SEPARATOR:
-				self.editor.moveSeparator(item, item.get_parent(), before, after)
+				self.editor.moveSeparator(item, destination, before, after)
 			context.finish(True, True, etime)
 		elif selection.target == 'text/plain':
 			if selection.data == None:
diff -ruN Alacarte.orig/MenuEditor.py Alacarte/MenuEditor.py
--- Alacarte.orig/MenuEditor.py	2009-09-26 02:30:48.000000000 +0200
+++ Alacarte/MenuEditor.py	2009-12-21 22:26:47.000000000 +0100
@@ -343,8 +343,15 @@
 		self.save()
 
 	def moveSeparator(self, separator, new_parent, before=None, after=None):
+		undo = []
+		# remove the original separator if its parent is not the new destination
+		if separator.get_parent() != new_parent:
+			self.deleteSeparator(separator)
+			undo.append(separator)
+		# this adds the new separator to the specified position
 		self.__positionItem(new_parent, separator, before, after)
-		self.__addUndo([self.__getMenu(new_parent),])
+		undo.append(self.__getMenu(new_parent))
+		self.__addUndo(undo)
 		self.save()
 
 	def deleteItem(self, item):
@@ -690,18 +697,21 @@
 		self.__addXmlFilename(xml_parent, dom, file_id, 'Exclude')
 
 	def __positionItem(self, parent, item, before=None, after=None):
-		if not before and not after:
-			return
 		if after:
 			index = parent.contents.index(after) + 1
 		elif before:
 			index = parent.contents.index(before)
+		else:
+			# append the item to the list
+			index = len(parent.contents)
 		contents = parent.contents
 		#if this is a move to a new parent you can't remove the item
-		try:
+		if item in contents:
+			# decrease the destination index, if we shorten the list
+			if (before and (contents.index(item) < index)) \
+					or (after and (contents.index(item) < index - 1)):
+				index -= 1
 			contents.remove(item)
-		except:
-			pass
 		contents.insert(index, item)
 		layout = self.__createLayout(contents)
 		dom = self.__getMenu(parent).dom

--- End Message ---
--- Begin Message ---
Hi Pedro,


Am Sat, 11 Oct 2014 22:09:39 +0100
schrieb Pedro Beja <[email protected]>:

> [..]
> Should we close this bug now ?

I am fine with that - the GUI moved quite far away from the state it had been
when I opened this bug report.

Thank you or taking the time to clean things up!

cheers,
Lars

--- End Message ---

Reply via email to