Merge lp:~songofacandy/qbzr/qbrowse-fix into lp:qbzr
- qbrowse-fix
- Merge into trunk2a
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 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Gary van der Merwe | Approve | ||
Review via email: mp+16069@code.launchpad.net |
Commit message
Description of the change
methane (songofacandy) wrote : | # |
Gary van der Merwe (garyvdm) : | # |
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.
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:/
> You are the owner of lp:~songofacandy/qbzr/qbrowse-fix.
>
--
Naoki INADA <email address hidden>
Alexander Belchenko (bialix) wrote : | # |
INADA Naoki пишет:
> I've merged this. Thank you.
Please, next time write something in the NEWS about your bugfix.
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.
Alexander Belchenko (bialix) wrote : | # |
Naoki, sorry for asking so late.
Why you're using posixpath module instead of bzrlib.
Gary van der Merwe (garyvdm) wrote : | # |
On 06/01/2010 12:18, Alexander Belchenko wrote:
> Why you're using posixpath module instead of bzrlib.
> 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.
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.
>> 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.
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?
methane (songofacandy) wrote : | # |
> Gary, osutils.pathjoin *forces* '/' on Windows. That's why I've asked
> about it.
I haven't know about bzrlib.
The posixpath.join should be replaced by it.
--
Naoki INADA <email address hidden>
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.
> 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
1 | === modified file 'lib/treewidget.py' | |||
2 | --- lib/treewidget.py 2009-12-06 15:16:30 +0000 | |||
3 | +++ lib/treewidget.py 2009-12-12 01:39:12 +0000 | |||
4 | @@ -18,6 +18,7 @@ | |||
5 | 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. |
6 | 19 | 19 | ||
7 | 20 | import os, sys | 20 | import os, sys |
8 | 21 | import posixpath # to use '/' path sep in path.join(). | ||
9 | 21 | from time import (strftime, localtime) | 22 | from time import (strftime, localtime) |
10 | 22 | from PyQt4 import QtCore, QtGui | 23 | from PyQt4 import QtCore, QtGui |
11 | 23 | from bzrlib import errors | 24 | from bzrlib import errors |
12 | @@ -820,7 +821,9 @@ | |||
13 | 820 | value = unicode(value.toString()) | 821 | value = unicode(value.toString()) |
14 | 821 | item_data = self.inventory_data[index.internalId()] | 822 | item_data = self.inventory_data[index.internalId()] |
15 | 822 | parent = self.inventory_data[item_data.parent_id] | 823 | parent = self.inventory_data[item_data.parent_id] |
17 | 823 | new_path = os.path.join(parent.path, value) | 824 | new_path = posixpath.join(parent.path, value) |
18 | 825 | if item_data.path == new_path: | ||
19 | 826 | return False | ||
20 | 824 | try: | 827 | try: |
21 | 825 | if item_data.item.file_id: | 828 | if item_data.item.file_id: |
22 | 826 | # Versioned file | 829 | # Versioned file |
23 | @@ -870,8 +873,11 @@ | |||
24 | 870 | if role == QtCore.Qt.DisplayRole: | 873 | if role == QtCore.Qt.DisplayRole: |
25 | 871 | return QtCore.QVariant(item.name) | 874 | return QtCore.QVariant(item.name) |
26 | 872 | if role == QtCore.Qt.EditRole: | 875 | if role == QtCore.Qt.EditRole: |
29 | 873 | parent = self.inventory_data[item_data.parent_id] | 876 | path = item_data.path |
30 | 874 | return QtCore.QVariant(item_data.path[len(parent.path):]) | 877 | if item_data.parent_id: |
31 | 878 | parent = self.inventory_data[item_data.parent_id] | ||
32 | 879 | path = path[len(parent.path)+1:] | ||
33 | 880 | return QtCore.QVariant(path) | ||
34 | 875 | if role == QtCore.Qt.DecorationRole: | 881 | if role == QtCore.Qt.DecorationRole: |
35 | 876 | if item_data.icon is None: | 882 | if item_data.icon is None: |
36 | 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(): |
37 | @@ -945,12 +951,12 @@ | |||
38 | 945 | return QtCore.QVariant() | 951 | return QtCore.QVariant() |
39 | 946 | 952 | ||
40 | 947 | def flags(self, index): | 953 | def flags(self, index): |
43 | 948 | #if not index.isValid(): | 954 | if not index.isValid(): |
44 | 949 | # return QtCore.Qt.ItemIsEnabled | 955 | return 0 |
45 | 950 | 956 | ||
46 | 951 | flags = (QtCore.Qt.ItemIsEnabled | | 957 | flags = (QtCore.Qt.ItemIsEnabled | |
47 | 952 | QtCore.Qt.ItemIsSelectable) | 958 | QtCore.Qt.ItemIsSelectable) |
49 | 953 | 959 | ||
50 | 954 | if isinstance(self.tree, WorkingTree): | 960 | if isinstance(self.tree, WorkingTree): |
51 | 955 | flags = flags | QtCore.Qt.ItemIsDragEnabled | 961 | flags = flags | QtCore.Qt.ItemIsDragEnabled |
52 | 956 | 962 | ||
53 | @@ -958,7 +964,7 @@ | |||
54 | 958 | flags = flags | QtCore.Qt.ItemIsEditable | 964 | flags = flags | QtCore.Qt.ItemIsEditable |
55 | 959 | if self.checkable: | 965 | if self.checkable: |
56 | 960 | flags = flags | QtCore.Qt.ItemIsUserCheckable | 966 | flags = flags | QtCore.Qt.ItemIsUserCheckable |
58 | 961 | 967 | ||
59 | 962 | id = index.internalId() | 968 | id = index.internalId() |
60 | 963 | if id < len(self.inventory_data): | 969 | if id < len(self.inventory_data): |
61 | 964 | item_data = self.inventory_data[index.internalId()] | 970 | item_data = self.inventory_data[index.internalId()] |
62 | @@ -1218,10 +1224,11 @@ | |||
63 | 1218 | 1224 | ||
64 | 1219 | def __init__(self, *args): | 1225 | def __init__(self, *args): |
65 | 1220 | RevisionTreeView.__init__(self, *args) | 1226 | RevisionTreeView.__init__(self, *args) |
67 | 1221 | 1227 | ||
68 | 1222 | self.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection) | 1228 | self.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection) |
69 | 1223 | self.setUniformRowHeights(True) | 1229 | self.setUniformRowHeights(True) |
71 | 1224 | self.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers) | 1230 | self.setEditTriggers(QtGui.QAbstractItemView.SelectedClicked | |
72 | 1231 | QtGui.QAbstractItemView.EditKeyPressed) | ||
73 | 1225 | self.viewport().setAcceptDrops(True) | 1232 | self.viewport().setAcceptDrops(True) |
74 | 1226 | self.setDropIndicatorShown(True) | 1233 | self.setDropIndicatorShown(True) |
75 | 1227 | self.setDragDropMode(QtGui.QAbstractItemView.InternalMove); | 1234 | self.setDragDropMode(QtGui.QAbstractItemView.InternalMove); |
76 | @@ -1900,7 +1907,7 @@ | |||
77 | 1900 | """Rename the selected file.""" | 1907 | """Rename the selected file.""" |
78 | 1901 | 1908 | ||
79 | 1902 | indexes = self.get_selection_indexes() | 1909 | indexes = self.get_selection_indexes() |
81 | 1903 | if len(indexes) <> 1: | 1910 | if len(indexes) != 1: |
82 | 1904 | return | 1911 | return |
83 | 1905 | index = indexes[0] | 1912 | index = indexes[0] |
84 | 1906 | index = self.tree_filter_model.mapFromSource (index) | 1913 | index = self.tree_filter_model.mapFromSource (index) |
* Can use 'F2' to start renaming.
* Fix error on end renaming without changes.