Rev 173: Hack in the new model to get it viewable. in http://bazaar.launchpad.net/~jameinel/bzr-explorer/wt_model
John Arbash Meinel
john at arbash-meinel.com
Tue Jul 7 23:25:41 BST 2009
At http://bazaar.launchpad.net/~jameinel/bzr-explorer/wt_model
------------------------------------------------------------
revno: 173
revision-id: john at arbash-meinel.com-20090707222537-zpmiifw0a9ndia1y
parent: john at arbash-meinel.com-20090707221849-17waznmkhccielpg
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: wt_model
timestamp: Tue 2009-07-07 17:25:37 -0500
message:
Hack in the new model to get it viewable.
It would seem I need to re-think the root object.
It seems views have to have an indexable object to view.
Which means that we need an arbitrary root object, and then
the root-id of the filesystem will be a child of that.
-------------- next part --------------
=== modified file 'lib/wt_browser.py'
--- a/lib/wt_browser.py 2009-07-07 20:51:58 +0000
+++ b/lib/wt_browser.py 2009-07-07 22:25:37 +0000
@@ -19,6 +19,9 @@
from PyQt4 import QtCore, QtGui
from bzrlib.plugins.explorer.lib.i18n import gettext, N_
+from bzrlib.plugins.explorer.lib import (
+ wt_model,
+ )
from bzrlib.plugins.explorer.lib.kinds import (
OPEN_FOLDER_ACTION,
EDIT_ACTION,
@@ -39,13 +42,14 @@
def _build_ui(self):
# Init them model and view
- model = WorkingTreeModel()
+ from bzrlib import workingtree
+ model = wt_model.WorkingTreeModel(workingtree.WorkingTree.open('.'))
# sort flags for tree view: direcotries first,
# on Windows items are case-insensitive
flags = QtCore.QDir.SortFlags(QtCore.QDir.Name|QtCore.QDir.DirsFirst)
if sys.platform == 'win32':
flags |= QtCore.QDir.IgnoreCase
- model.setSorting(flags)
+ # model.setSorting(flags)
view = QtGui.QTreeView()
view.setModel(model)
@@ -147,7 +151,8 @@
else:
# Show the tree
self.stacked.setCurrentIndex(1)
- index = self.model.index(path)
+ index = self.model.index(0, 0, None)
+ print index.row(), index.column(), index.internalPointer()
self.view.setRootIndex(index)
self._root = path
self._selected_fileinfo = None
=== modified file 'lib/wt_model.py'
--- a/lib/wt_model.py 2009-07-07 22:18:49 +0000
+++ b/lib/wt_model.py 2009-07-07 22:25:37 +0000
@@ -46,6 +46,10 @@
self.children = []
self.status = None
+ def __repr__(self):
+ return '%s(%s)' % (self.__class__.__name__,
+ self.__dict__)
+
def row(self):
"""Return the row for this object in the parents children list."""
if self.parent is None:
More information about the bazaar-commits
mailing list