Commits

Ronald Oussoren  committed 221b408

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

  • Participants
  • Parent commits 7a6c65e

Comments (0)

Files changed (4)

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

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

File 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>

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

Binary file modified.

File 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