PasteBin

Created By davea at 2008/03/04 14:00

https://sucs.org/pb/256 (plain)
  1.  
  2.   import objc
  3.   import _uicaboodle
  4.   from objc import YES, NO, NULL, nil
  5.   objc.loadBundle('UIKit', globals(), '/System/Library/Frameworks/UIKit.framework')
  6.   UIApplication = objc.lookUpClass('UIApplication')
  7.   UITable = objc.lookUpClass('UITable')
  8.   UIWindow = objc.lookUpClass('UIWindow')
  9.   UIHardware = objc.lookUpClass('UIHardware')
  10.   UIView = objc.lookUpClass('UIView')
  11.   UINavigationBar = objc.lookUpClass('UINavigationBar')
  12.   UINavigationItem = objc.lookUpClass('UINavigationItem')
  13.   UIPreferencesTable = objc.lookUpClass('UIPreferencesTable')
  14.   UIPreferencesTextTableCell = objc.lookUpClass('UIPreferencesTextTableCell')
  15.   UIPreferencesTableCell = objc.lookUpClass('UIPreferencesTableCell')
  16.   UISectionList = objc.lookUpClass("UISectionList")
  17.   UIImageAndTextTableCell = objc.lookUpClass("UIImageAndTextTableCell")
  18.  
  19.   class PYApplication(UIApplication):
  20.       def applicationDidFinishLaunching_(self, unused):
  21.           frame = UIHardware.fullScreenApplicationContentRect()
  22.  
  23.           self.window = UIWindow.alloc().initWithFrame_(frame)
  24.  
  25.           self.view = UIView.alloc().initWithFrame_(self.window.bounds())
  26.           self.window.setContentView_(self.view)
  27.  
  28.           self.window.orderFront_(self)
  29.           self.window.makeKey_(self)
  30.           self.window._setHidden_(NO)
  31.  
  32.           navsize = UINavigationBar.defaultSize()
  33.           navrect = ((0, 0), navsize)
  34.  
  35.           self.navbar = UINavigationBar.alloc().initWithFrame_(navrect)
  36.           self.view.addSubview_(self.navbar)
  37.  
  38.           self.navbar.setBarStyle_(1)
  39.           self.navbar.setDelegate_(self)
  40.  
  41.           navitem = UINavigationItem.alloc().initWithTitle_(u"Network Information")
  42.           self.navbar.pushNavigationItem_(navitem)
  43.  
  44.           bounds = self.view.bounds()
  45.           tblrect = ((0, navsize[1]), (bounds[1][0], bounds[1][1] - navsize[1]))
  46.  
  47.           self.secList = UISectionList.alloc().initWithFrame_(tblrect)
  48.           self.secList.setDataSource_(self)
  49.           self.secList.reloadData()
  50.          
  51.           col = UITableColumn.alloc().initWithTitle_identifier_width_(u"Name", u"name", 320.0)
  52.           table = self.secList.table()
  53.           table.setSeparatorStyle_(1)
  54.           table.addTableColumn_(col)
  55.          
  56.           self.view.addSubview_(self.secList)
  57.      
  58.       def numberOfSectionsInSectionList_(self, sectionList):
  59.           print u"numberOfSectionsInSectionList_", sectionList
  60.           return 0
  61.      
  62.       def sectionList_titleForSection_(self, sectionList, section):
  63.           print u"sectionList_titleForSection_", sectionList, section
  64.           return u"Title"
  65.      
  66.       def sectionList_rowForSection_(self, sectionList, section):
  67.           print u"sectionList_rowForSection_", sectionList, section
  68.           return 0
  69.      
  70.       def numberOfRowsInTable_(self, table):
  71.           print u"numberOfRowsInTable_", table
  72.           return 0
  73.      
  74.       def table_cellForRow_column_(self, table, row, column):
  75.           print u"table_cellForRow_column_", table, row, column
  76.           cell = UIImageAndTextTableCell.alloc.init()
  77.           cell.setTitle_(u"Test " + row)
  78.           return cell
  79.      
  80.      
  81.       def respondsToSelector_(self, selector):
  82.           responds = dir(self).count(selector.replace(":", "_")) > 0
  83.           if not responds:
  84.               print selector
  85.           return responds
  86.  
  87.   _uicaboodle.UIApplicationMain(['NetInfo'], PYApplication)

You must be logged in to paste new items to the PasteBin