Helpviewer/CookieJar/CookieExceptionsModel.py

changeset 5656
9c21b2746218
parent 5389
9b1c800daff3
child 6048
82ad8ec9548c
equal deleted inserted replaced
5654:d75dfc0d10f2 5656:9c21b2746218
101 101
102 return None 102 return None
103 103
104 return None 104 return None
105 105
106 def columnCount(self, parent=QModelIndex()): 106 def columnCount(self, parent=None):
107 """ 107 """
108 Public method to get the number of columns of the model. 108 Public method to get the number of columns of the model.
109 109
110 @param parent parent index (QModelIndex) 110 @param parent parent index (QModelIndex)
111 @return number of columns (integer) 111 @return number of columns (integer)
112 """ 112 """
113 if parent is None:
114 parent = QModelIndex()
115
113 if parent.isValid(): 116 if parent.isValid():
114 return 0 117 return 0
115 else: 118 else:
116 return len(self.__headers) 119 return len(self.__headers)
117 120
118 def rowCount(self, parent=QModelIndex()): 121 def rowCount(self, parent=None):
119 """ 122 """
120 Public method to get the number of rows of the model. 123 Public method to get the number of rows of the model.
121 124
122 @param parent parent index (QModelIndex) 125 @param parent parent index (QModelIndex)
123 @return number of rows (integer) 126 @return number of rows (integer)
124 """ 127 """
128 if parent is None:
129 parent = QModelIndex()
130
125 if parent.isValid() or self.__cookieJar is None: 131 if parent.isValid() or self.__cookieJar is None:
126 return 0 132 return 0
127 else: 133 else:
128 return len(self.__allowedCookies) + \ 134 return len(self.__allowedCookies) + \
129 len(self.__blockedCookies) + \ 135 len(self.__blockedCookies) + \
130 len(self.__sessionCookies) 136 len(self.__sessionCookies)
131 137
132 def removeRows(self, row, count, parent=QModelIndex()): 138 def removeRows(self, row, count, parent=None):
133 """ 139 """
134 Public method to remove entries from the model. 140 Public method to remove entries from the model.
135 141
136 @param row start row (integer) 142 @param row start row (integer)
137 @param count number of rows to remove (integer) 143 @param count number of rows to remove (integer)
138 @param parent parent index (QModelIndex) 144 @param parent parent index (QModelIndex)
139 @return flag indicating success (boolean) 145 @return flag indicating success (boolean)
140 """ 146 """
147 if parent is None:
148 parent = QModelIndex()
149
141 if parent.isValid() or self.__cookieJar is None: 150 if parent.isValid() or self.__cookieJar is None:
142 return False 151 return False
143 152
144 lastRow = row + count - 1 153 lastRow = row + count - 1
145 self.beginRemoveRows(parent, row, lastRow) 154 self.beginRemoveRows(parent, row, lastRow)

eric ide

mercurial