def start(self): try: self.stop() #ns_timer = \ # NSTimer.timerWithTimeInterval_target_selector_userInfo_repeats_( # self._interval, self._target, '_ns_fire', None, self._repeat) ns_timer = \ NSTimer.timerWithTimeInterval_target_selector_userInfo_repeats_( self._interval, trigger, 'fire:', None, self._repeat) self._ns_timer = ns_timer ns_timer_to_task[ns_timer] = self ns_run_loop = NSRunLoop.mainRunLoop() ns_run_loop.addTimer_forMode_(ns_timer, NSDefaultRunLoopMode) ns_run_loop.addTimer_forMode_(ns_timer, NSEventTrackingRunLoopMode) ns_run_loop.addTimer_forMode_(ns_timer, NSModalPanelRunLoopMode) except: logging.exception('pygui task start error')
def loop(): from Foundation import NSRunLoop NSRunLoop.mainRunLoop().run()
def wait(time): from Foundation import NSDate from Foundation import NSRunLoop NSRunLoop.mainRunLoop().runBeforeDate_(NSDate.dateWithTimeIntervalSinceNow_(time))
def continue_runloop(self): NSRunLoop.mainRunLoop().runUntilDate_( NSDate.dateWithTimeIntervalSinceNow_(0.01))