FROM : Uliano Guerrini
DATE : Wed Nov 07 18:04:07 2007
Il giorno 07/nov/07, alle ore 17:48, Bill Bumgarner ha scritto:
>
> Import Quartz *after* the application's main event loop has been
> started, either in applicationDidFinishLaunching_() as I
> demonstrated in my first message:
>
>> class FoobarAppDelegate(NSObject):
>> def applicationDidFinishLaunching_(self, sender):
>> import Quartz
this is useless as the scope of that import is limited to that
function in that file
>>
>
> Or import it as the first line of the drawRect_() method of your view.
I found a better (much efficient, I hope) workaround:
Quartz = None
class MyView(NSView):
def awakeFromNib(self):
global Quartz
Quartz = __import__('Quartz')
def drawRect_(self, rect):
context = NSGraphicsContext.currentContext().graphicsPort()
Quartz.whatever()
here the import happens to be called only once per class and Quartz is
global to the whole file. Still it is not elegant but I can live with it
cheers,
uliano
DATE : Wed Nov 07 18:04:07 2007
Il giorno 07/nov/07, alle ore 17:48, Bill Bumgarner ha scritto:
>
> Import Quartz *after* the application's main event loop has been
> started, either in applicationDidFinishLaunching_() as I
> demonstrated in my first message:
>
>> class FoobarAppDelegate(NSObject):
>> def applicationDidFinishLaunching_(self, sender):
>> import Quartz
this is useless as the scope of that import is limited to that
function in that file
>>
>
> Or import it as the first line of the drawRect_() method of your view.
I found a better (much efficient, I hope) workaround:
Quartz = None
class MyView(NSView):
def awakeFromNib(self):
global Quartz
Quartz = __import__('Quartz')
def drawRect_(self, rect):
context = NSGraphicsContext.currentContext().graphicsPort()
Quartz.whatever()
here the import happens to be called only once per class and Quartz is
global to the whole file. Still it is not elegant but I can live with it
cheers,
uliano
| Related mails | Author | Date |
|---|---|---|
| Uliano Guerrini | Nov 7, 08:49 | |
| Bill Bumgarner | Nov 7, 08:58 | |
| Uliano Guerrini | Nov 7, 09:46 | |
| Bill Bumgarner | Nov 7, 09:57 | |
| Uliano Guerrini | Nov 7, 10:41 | |
| Bill Bumgarner | Nov 7, 17:48 | |
| Uliano Guerrini | Nov 7, 18:04 | |
| Bill Bumgarner | Nov 7, 18:46 | |
| Luc Heinrich | Nov 8, 09:32 | |
| Uliano Guerrini | Nov 8, 13:00 | |
| Luc Heinrich | Nov 8, 14:10 | |
| Uliano Guerrini | Nov 8, 14:41 |






Cocoa mail archive

