Index: src/core.py =================================================================== --- src/core.py (revision 909) +++ src/core.py (working copy) @@ -243,17 +243,18 @@ class Manager: # Apply the queue at this time, after all is loaded and ready self.apply_queue() except IOError: self.state = persistent_state() else: self.state = persistent_state() - + def connect_event(self, event_type, callback): + self.event_callback[event_type].append(callback) def quit(self): # Analyze data needed for pickling, etc. self.pre_quitting() # Pickle the prefs print "Saving prefs..." self.config.save() @@ -523,17 +524,20 @@ class Manager: ret.append(event) try: if event['unique_ID'] not in self.unique_IDs: event = pop_event() continue except KeyError: event = pop_event() continue - + # Call any event callbacks + for event in event_callback[event['event_type']]: + event() + if event['event_type'] is self.constants['EVENT_FINISHED']: # Queue seeding torrent to bottom if needed if(self.get_pref('enable_move_completed')): try: deluge_core.move_storage(event['unique_ID'], self.get_pref('default_finished_path')) except SystemError: raise SystemError("You cannot move torrent to a different partition. Please fix your preferences") continue