OSDN Git Service

utorrent.TorrentContentsListItem.name: Use the new _getColumnLocation method, rather...
authorJames Teh <jamie@jantrid.net>
Tue, 11 Sep 2012 04:35:14 +0000 (14:35 +1000)
committerJames Teh <jamie@jantrid.net>
Tue, 11 Sep 2012 04:35:14 +0000 (14:35 +1000)
source/appModules/utorrent.py

index 26c0722..649c707 100644 (file)
@@ -44,17 +44,9 @@ class TorrentContentsListItem(ListItem):
                        return superContent\r
                # We need to use the display model to retrieve the Name column.\r
                try:\r
-                       # We don't want to just use displayText because it also contains the size, which is exposed correctly in the value property.\r
-                       # Therefore, use the left and right of the Name column as obtained from the column header.\r
-                       nameHdrLoc = Window._get_firstChild(self).firstChild.firstChild.location\r
-                       left = nameHdrLoc[0]\r
-                       right = left + nameHdrLoc[2]\r
-                       # Use the top and bottom of the list item.\r
-                       selfLoc = self.location\r
-                       top = selfLoc[1]\r
-                       bottom = top + selfLoc[3]\r
+                       left, top, width, height = self._getColumnLocation(column)\r
                        return displayModel.getWindowTextInRect(self.appModule.helperLocalBindingHandle, self.windowHandle,\r
-                               left, top, right, bottom,\r
+                               left, top, left + width, top + height,\r
                                displayModel.DisplayModelTextInfo.minHorizontalWhitespace, displayModel.DisplayModelTextInfo.minVerticalWhitespace)[0]\r
                except:\r
                        log.debugWarning("Error retrieving name using display model", exc_info=True)\r