commit f68c04e251c61fc5a35e2e18b733f46f73857d7c
parent 32c1b9cd5902cae9840b121b2dd0dfe332ff49a9
Author: Neil Booth <kyuupichan@gmail.com>
Date: Sun, 30 Aug 2015 18:19:27 +0900
Only pass user edits to item_edited()
It was picking up changes made when the history tab updates when
a transaction changes confirmation state
Diffstat:
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/gui/qt/util.py b/gui/qt/util.py
@@ -292,7 +292,9 @@ class EditableItemDelegate(QStyledItemDelegate):
def createEditor(self, parent, option, index):
if index.column() not in self.parent().editable_columns:
return None
- self.parent().prior_text = unicode(index.data().toString())
+ self.parent().editing = (self.parent().currentItem(),
+ index.column(),
+ unicode(index.data().toString()))
return QStyledItemDelegate.createEditor(self, parent, option, index)
class MyTreeWidget(QTreeWidget):
@@ -312,6 +314,7 @@ class MyTreeWidget(QTreeWidget):
self.insertChild = self.insertTopLevelItem
# Control which columns are editable
+ self.editing = (None, None, None)
if editable_columns is None:
editable_columns = [stretch_column]
self.editable_columns = editable_columns
@@ -340,7 +343,9 @@ class MyTreeWidget(QTreeWidget):
def item_changed(self, item, column):
'''Called only when the text actually changes'''
- self.item_edited(item, column, self.prior_text)
+ # Only pass user edits to item_edited()
+ if item == self.editing[0] and column == self.editing[1]:
+ self.item_edited(item, column, self.editing[2])
def item_edited(self, item, column, prior):
'''Called only when the text actually changes'''