Merge lp:~songofacandy/qbzr/qbrowse-fix into lp:qbzr

Proposed by methane
Status: Merged
Merged at revision: not available
Proposed branch: lp:~songofacandy/qbzr/qbrowse-fix
Merge into: lp:qbzr
Diff against target: 84 lines (+17/-10)
1 file modified
lib/treewidget.py (+17/-10)
To merge this branch: bzr merge lp:~songofacandy/qbzr/qbrowse-fix
Reviewer Review Type Date Requested Status
Gary van der Merwe Approve
Review via email: mp+16069@code.launchpad.net
To post a comment you must log in.
Revision history for this message
methane (songofacandy) wrote :

* Can use 'F2' to start renaming.
* Fix error on end renaming without changes.

Revision history for this message
Gary van der Merwe (garyvdm) :
review: Approve
Revision history for this message
Gary van der Merwe (garyvdm) wrote :

PS: INADA: I see you are now a member of qbzr-dev - so I'm leaving this for you to merge. If you want me to merge it, let me know.

Revision history for this message
methane (songofacandy) wrote :

I've merged this. Thank you.

On Mon, Dec 21, 2009 at 10:11 PM, Gary van der Merwe <email address hidden> wrote:
> PS: INADA: I see you are now a member of qbzr-dev - so I'm leaving this for you to merge. If you want me to merge it, let me know.
> --
> https://code.edge.launchpad.net/~songofacandy/qbzr/qbrowse-fix/+merge/16069
> You are the owner of lp:~songofacandy/qbzr/qbrowse-fix.
>

--
Naoki INADA <email address hidden>

Revision history for this message
Alexander Belchenko (bialix) wrote :

INADA Naoki пишет:
> I've merged this. Thank you.

Please, next time write something in the NEWS about your bugfix.

Revision history for this message
methane (songofacandy) wrote :

On Tue, Dec 22, 2009 at 12:45 AM, Alexander Belchenko <email address hidden> wrote:
> INADA Naoki пишет:
>> I've merged this. Thank you.
>
> Please, next time write something in the NEWS about your bugfix.

roger.

Revision history for this message
Alexander Belchenko (bialix) wrote :

Naoki, sorry for asking so late.

Why you're using posixpath module instead of bzrlib.osutils.pathjoin function? I think the right way is to use the latter function. Do you have any specific reasons to avoid it?

Revision history for this message
Gary van der Merwe (garyvdm) wrote :

On 06/01/2010 12:18, Alexander Belchenko wrote:
> Why you're using posixpath module instead of bzrlib.osutils.pathjoin
> function? I think the right way is to use the latter function. Do you
> have any specific reasons to avoid it?

I questioned that when I reviewed this. In this case, we need '/', even
on windows. This is to fix bug 495519.

https://bugs.launchpad.net/qbzr/+bug/495519

Revision history for this message
Alexander Belchenko (bialix) wrote :

Gary van der Merwe пишет:
> On 06/01/2010 12:18, Alexander Belchenko wrote:
>> Why you're using posixpath module instead of bzrlib.osutils.pathjoin
>> function? I think the right way is to use the latter function. Do you
>> have any specific reasons to avoid it?
>
> I questioned that when I reviewed this. In this case, we need '/', even
> on windows. This is to fix bug 495519.

Gary, osutils.pathjoin *forces* '/' on Windows. That's why I've asked
about it.

Revision history for this message
Gary van der Merwe (garyvdm) wrote :

On Wed, Jan 6, 2010 at 2:09 PM, Alexander Belchenko <email address hidden> wrote:
> Gary, osutils.pathjoin *forces* '/' on Windows. That's why I've asked
> about it.

Oh! Maybe it should be reverted?

Revision history for this message
methane (songofacandy) wrote :

> Gary, osutils.pathjoin *forces* '/' on Windows. That's why I've asked
> about it.

I haven't know about bzrlib.osutils.pathjoin!
The posixpath.join should be replaced by it.

--
Naoki INADA <email address hidden>

Revision history for this message
Alexander Belchenko (bialix) wrote :

INADA Naoki пишет:
>> Gary, osutils.pathjoin *forces* '/' on Windows. That's why I've asked
>> about it.
>
> I haven't know about bzrlib.osutils.pathjoin!
> The posixpath.join should be replaced by it.

OK, I will change the code to use osutils then. I think it will be more
consistent in our usage of bzrlib functions.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/treewidget.py'
--- lib/treewidget.py 2009-12-06 15:16:30 +0000
+++ lib/treewidget.py 2009-12-12 01:39:12 +0000
@@ -18,6 +18,7 @@
18# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.18# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
1919
20import os, sys20import os, sys
21import posixpath # to use '/' path sep in path.join().
21from time import (strftime, localtime)22from time import (strftime, localtime)
22from PyQt4 import QtCore, QtGui23from PyQt4 import QtCore, QtGui
23from bzrlib import errors24from bzrlib import errors
@@ -820,7 +821,9 @@
820 value = unicode(value.toString())821 value = unicode(value.toString())
821 item_data = self.inventory_data[index.internalId()]822 item_data = self.inventory_data[index.internalId()]
822 parent = self.inventory_data[item_data.parent_id]823 parent = self.inventory_data[item_data.parent_id]
823 new_path = os.path.join(parent.path, value)824 new_path = posixpath.join(parent.path, value)
825 if item_data.path == new_path:
826 return False
824 try:827 try:
825 if item_data.item.file_id:828 if item_data.item.file_id:
826 # Versioned file829 # Versioned file
@@ -870,8 +873,11 @@
870 if role == QtCore.Qt.DisplayRole:873 if role == QtCore.Qt.DisplayRole:
871 return QtCore.QVariant(item.name)874 return QtCore.QVariant(item.name)
872 if role == QtCore.Qt.EditRole:875 if role == QtCore.Qt.EditRole:
873 parent = self.inventory_data[item_data.parent_id]876 path = item_data.path
874 return QtCore.QVariant(item_data.path[len(parent.path):])877 if item_data.parent_id:
878 parent = self.inventory_data[item_data.parent_id]
879 path = path[len(parent.path)+1:]
880 return QtCore.QVariant(path)
875 if role == QtCore.Qt.DecorationRole:881 if role == QtCore.Qt.DecorationRole:
876 if item_data.icon is None:882 if item_data.icon is None:
877 if item_data.change and not item_data.change.is_on_disk():883 if item_data.change and not item_data.change.is_on_disk():
@@ -945,12 +951,12 @@
945 return QtCore.QVariant()951 return QtCore.QVariant()
946 952
947 def flags(self, index):953 def flags(self, index):
948 #if not index.isValid():954 if not index.isValid():
949 # return QtCore.Qt.ItemIsEnabled955 return 0
950 956
951 flags = (QtCore.Qt.ItemIsEnabled |957 flags = (QtCore.Qt.ItemIsEnabled |
952 QtCore.Qt.ItemIsSelectable)958 QtCore.Qt.ItemIsSelectable)
953 959
954 if isinstance(self.tree, WorkingTree):960 if isinstance(self.tree, WorkingTree):
955 flags = flags | QtCore.Qt.ItemIsDragEnabled961 flags = flags | QtCore.Qt.ItemIsDragEnabled
956 962
@@ -958,7 +964,7 @@
958 flags = flags | QtCore.Qt.ItemIsEditable964 flags = flags | QtCore.Qt.ItemIsEditable
959 if self.checkable:965 if self.checkable:
960 flags = flags | QtCore.Qt.ItemIsUserCheckable966 flags = flags | QtCore.Qt.ItemIsUserCheckable
961 967
962 id = index.internalId()968 id = index.internalId()
963 if id < len(self.inventory_data):969 if id < len(self.inventory_data):
964 item_data = self.inventory_data[index.internalId()]970 item_data = self.inventory_data[index.internalId()]
@@ -1218,10 +1224,11 @@
12181224
1219 def __init__(self, *args):1225 def __init__(self, *args):
1220 RevisionTreeView.__init__(self, *args)1226 RevisionTreeView.__init__(self, *args)
1221 1227
1222 self.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)1228 self.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
1223 self.setUniformRowHeights(True)1229 self.setUniformRowHeights(True)
1224 self.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)1230 self.setEditTriggers(QtGui.QAbstractItemView.SelectedClicked |
1231 QtGui.QAbstractItemView.EditKeyPressed)
1225 self.viewport().setAcceptDrops(True)1232 self.viewport().setAcceptDrops(True)
1226 self.setDropIndicatorShown(True)1233 self.setDropIndicatorShown(True)
1227 self.setDragDropMode(QtGui.QAbstractItemView.InternalMove);1234 self.setDragDropMode(QtGui.QAbstractItemView.InternalMove);
@@ -1900,7 +1907,7 @@
1900 """Rename the selected file."""1907 """Rename the selected file."""
1901 1908
1902 indexes = self.get_selection_indexes()1909 indexes = self.get_selection_indexes()
1903 if len(indexes) <> 1:1910 if len(indexes) != 1:
1904 return1911 return
1905 index = indexes[0]1912 index = indexes[0]
1906 index = self.tree_filter_model.mapFromSource (index)1913 index = self.tree_filter_model.mapFromSource (index)

Subscribers

People subscribed via source and target branches