74 @return number of columns (integer) |
74 @return number of columns (integer) |
75 """ |
75 """ |
76 if parent is None: |
76 if parent is None: |
77 parent = QModelIndex() |
77 parent = QModelIndex() |
78 |
78 |
79 if parent.isValid(): |
79 item = (parent.internalPointer() if parent.isValid() |
80 item = parent.internalPointer() |
80 else self.rootItem) |
81 else: |
|
82 item = self.rootItem |
|
83 |
81 |
84 return item.columnCount() + 1 |
82 return item.columnCount() + 1 |
85 |
83 |
86 def data(self, index, role): |
84 def data(self, index, role): |
87 """ |
85 """ |
1042 @param parent parent item |
1040 @param parent parent item |
1043 @param dinfo dinfo is the string for the directory (string) |
1041 @param dinfo dinfo is the string for the directory (string) |
1044 @param full flag indicating full pathname should be displayed (boolean) |
1042 @param full flag indicating full pathname should be displayed (boolean) |
1045 """ |
1043 """ |
1046 self._dirName = os.path.abspath(dinfo) |
1044 self._dirName = os.path.abspath(dinfo) |
1047 |
1045 dn = self._dirName if full else os.path.basename(self._dirName) |
1048 if full: |
|
1049 dn = self._dirName |
|
1050 else: |
|
1051 dn = os.path.basename(self._dirName) |
|
1052 |
|
1053 BrowserItem.__init__(self, parent, dn) |
1046 BrowserItem.__init__(self, parent, dn) |
1054 |
1047 |
1055 self.type_ = BrowserItemDirectory |
1048 self.type_ = BrowserItemDirectory |
1056 if ( |
1049 if ( |
1057 not Utilities.isDrive(self._dirName) and |
1050 not Utilities.isDrive(self._dirName) and |
1071 |
1064 |
1072 @param dinfo dinfo is the string for the directory (string) |
1065 @param dinfo dinfo is the string for the directory (string) |
1073 @param full flag indicating full pathname should be displayed (boolean) |
1066 @param full flag indicating full pathname should be displayed (boolean) |
1074 """ |
1067 """ |
1075 self._dirName = os.path.abspath(dinfo) |
1068 self._dirName = os.path.abspath(dinfo) |
1076 |
1069 dn = self._dirName if full else os.path.basename(self._dirName) |
1077 if full: |
|
1078 dn = self._dirName |
|
1079 else: |
|
1080 dn = os.path.basename(self._dirName) |
|
1081 self.itemData[0] = dn |
1070 self.itemData[0] = dn |
1082 |
1071 |
1083 def dirName(self): |
1072 def dirName(self): |
1084 """ |
1073 """ |
1085 Public method returning the directory name. |
1074 Public method returning the directory name. |