Re: [Pyobjc-dev] Separating functionality into modules
Brought to you by:
ronaldoussoren
From: Jack J. <Jac...@cw...> - 2002-11-19 12:48:27
|
On Monday, Nov 18, 2002, at 16:45 Europe/Amsterdam, bb...@ma... wrote: >> 4. Why AddressBook is included completely eludes me. Is this >> framework somehow >> more important than the other ones, or is this really only an >> example? > > At the moment, it is the only first-class, high level, OO API included > with the system that is not highly application specific > [PreferencesPane, ScreenSaver, Project Builder] and includes a public > API. It is generically useful and represents functionality that > quite a number of developers will want to use. Ok, fair enough. > >> If for (4) I'm correct and AddressBook is just an example, shouldn't >> we provide a general solution in the form of a factory function so >> the user can do >> AddressBook = Foundation.Python.GenerateModuleForBundle("AddressBook") > > It requires a compiled component to wrap a framework such that > enumerated types, #defines, and functions can be exported. Ronald has > done an amazing job of automating the generating of the wrappers, but > it needs some work before it could automatically generate a module > project to wrap a specific framework. That would be very, very > > cool... Oops, I missed that bit, I didn't realise there was an extension module too, I thought it was pure python. [search.... search....] No, I can't find it. Are you sure that this module isn't pure Python? Because if it is then my factory function idea should work (create a module, populate it with the classes returned by Foundation.load_bundle, return the module). And, if there is C code for AddressBook: where is it? >> We need a new place to put Python-specific modules, at the moment >> only for >> AppKit but later we may want this for the other packages too. I can >> see two simple solutions: >> A. Put them in a sub-package. Foundation.Python comes to mind, but >> there may >> be better names. >> B. Prefix them with "Py". Again, another prefix is also possible. > > Before we go here, how much functionality are we actually talking > about? At the moment there isn't much, indeed, but I can imagine it growing. With Python's multiple inheritance and operator overloading, for instance, there's all sorts of nifty things you could do, such as class TableViewList(list, PyObjC.listTableDataSourceMixin): pass x = TableViewList() and then use x both as a normal Python list and as an NSTableDataSource. Note that I haven't actually worked this example out (so it may be plain impossible), but you get the idea. Another example of a python-specific functionality is a mixin class for a dialog that would automatically keep the dialog items synced with another object (using Pythons introspection to obtain the names of the dialog items, looking them up in the other object. Combined with slots this could even happen completely automatic). >> Oh yes: I want a version number somewhere, probably in objc. I don't >> really care whether there's a static version number or a function >> that returns a version number, but I need a version number for my >> Python Installation Manager (which will help keep the size of >> MacPython distributions down, but still allow pretty easy access to >> any package for end users; see the pythonmac-sig discussions for more >> details). > > Yes; how about something like.... > > >>> sys.version_info > (2, 2, 0, 'final', 0) > >>> sys.version > '2.2 (#1, 07/14/02, 23:25:09) \n[GCC Apple cpp-precomp 6.14]' What I want is the version of the PyObjC package. The only thing I need it for is to compare it against the most recent version (which is obtain from a net-based database) and to warn the user that a new version is available. So a simple version = '0.9' in objc/__init__.py should suffice. It doesn't matter what the datatype of the version is, as long as it is monotonically increasing. -- - Jack Jansen <Jac...@or...> http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman - |