Ronald Oussoren avatar Ronald Oussoren committed 221b408

Make the details view a tabbed view, the second page contains the list
of prerequisites

Comments (0)

Files changed (4)

pyobjc/Examples/PackageManager/Resources/English.lproj/PackageDatabase.nib/classes.nib

                 itemStatus = NSTextField; 
                 overwrite = id; 
                 packageTable = NSTableView; 
+                prerequisitesTable = id; 
                 progressOK = id; 
                 showHidden = id; 
                 verbose = id; 

pyobjc/Examples/PackageManager/Resources/English.lproj/PackageDatabase.nib/info.nib

 	</array>
 	<key>IBOpenObjects</key>
 	<array>
+		<integer>89</integer>
 		<integer>6</integer>
-		<integer>89</integer>
 	</array>
 	<key>IBSystem Version</key>
 	<string>7D24</string>
Add a comment to this file

pyobjc/Examples/PackageManager/Resources/English.lproj/PackageDatabase.nib/keyedobjects.nib

Binary file modified.

pyobjc/Examples/PackageManager/packman.py

     def setDB(self, pimpURL, pimpDB):
         self.pimp = pimpDB
         self._packages = pimpDB.list()
+        self._prerequisites = []
         if self.databaseName is not None:
             self.databaseName.setStringValue_(DB_DESCRIPTION(self.pimp))
             self.databaseMaintainer.setStringValue_(DB_MAINTAINER(self.pimp))
             setString(self.itemInstalled, None)
             self.itemDescription.setString_("")
             self.installButton.setEnabled_(False)
+            self._prerequisites = []
+            self.prerequisitesTable.reloadData()
 
         else:
             # Update the detail view
             setString(self.itemInstalled, status)
             setString(self.itemStatus, msg)
             self.installButton.setEnabled_(True)
+            self._prerequisites = package.prerequisites()
+            self.prerequisitesTable.reloadData()
 
     def addToFavorites_(self, sender):
         appdel = NSApplication.sharedApplication().delegate()
     #
 
     def numberOfRowsInTableView_(self, view):
+
         if not hasattr(self, 'pimp') or self.pimp is None:
             return 0
 
-        return len(self._packages)
+        if view is self.packageTable:
+            return len(self._packages)
+        else:
+            return len(self._prerequisites)
+
 
     def tableView_objectValueForTableColumn_row_(self, view, col, row):
 
         colname = col.identifier()
-        package = self._packages[row]
+
+        if view is self.packageTable:
+            package = self._packages[row]
+            shortdescription = None
+        else:
+            package, shortdescription = self._prerequisites[row]
 
         if colname == 'installed':
             # XXX: Nicer formatting
         return getattr(package, colname)()
 
     def tableView_sortDescriptorsDidChange_(self, view, oldDescriptors):
-        self.sortPackages()
-
-
-
+        if view is self.packageTable:
+            self.sortPackages()
 
     def sortPackages(self):
         """
 
         Update the input fields to show the current item.
         """
+
         row = self.favoritesTable.selectedRow()
         if row == -1:
             self.favoritesTitle.setStringValue_('')
             self.favoritesTitle.setEnabled_(True)
             self.favoritesURL.setEnabled_(True)
 
+
     def numberOfRowsInTableView_(self, view):
         """
         We're the datasource for the favorites list in the Favorites panel
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.