def back_to_overview(self): component.stop(["TorrentDetail"]) component.deregister(self) self.stdscr.erase() component.get("ConsoleUI").set_mode(self.alltorrentmode) self.alltorrentmode._go_top = False self.alltorrentmode.resume()
def switch_mode(self, func, error_smg): def on_stop(arg): if arg and True in arg[0]: func() else: self.messages.append(('Error', error_smg)) component.stop(['TorrentList']).addCallback(on_stop)
def __on_disconnect(self): """ Called when disconnected from the daemon. We basically just stop all the components here. """ self.daemon_bps = (0, 0, 0) component.stop()
def __show_events(self): def doevents(arg): if arg and True in arg[0]: self.stdscr.clear() component.get("ConsoleUI").set_mode(EventView(self,self.stdscr,self.encoding)) else: self.messages.append(("Error","An error occured trying to display events")) component.stop(["AllTorrents"]).addCallback(doevents)
def show_addtorrents_screen(self): def dodeets(arg): if arg and True in arg[0]: self.stdscr.erase() component.get("ConsoleUI").set_mode(AddTorrents(self,self.stdscr, self.config, self.encoding)) else: self.messages.append(("Error","An error occured trying to display add torrents screen")) component.stop(["AllTorrents"]).addCallback(dodeets)
def _on_get_cache_status(status,port,config): def doprefs(arg): if arg and True in arg[0]: self.stdscr.clear() component.get("ConsoleUI").set_mode(Preferences(self,config,self.config,port,status,self.stdscr,self.encoding)) else: self.messages.append(("Error","An error occured trying to display preferences")) component.stop(["AllTorrents"]).addCallback(doprefs)
def show_torrent_details(self,tid): def dodeets(arg): if arg and True in arg[0]: self.stdscr.clear() component.get("ConsoleUI").set_mode(TorrentDetail(self,tid,self.stdscr,self.encoding)) else: self.messages.append(("Error","An error occured trying to display torrent details")) component.stop(["AllTorrents"]).addCallback(dodeets)
def on_quit(self): # Note: Qt docs advise to do cleanup in aboutToQuit(), # because is some cases exec_ is not guaranteed to return. from deluge import component component.stop() component.shutdown() self.ui_config.save()
def __legacy_mode(self): def dolegacy(arg): if arg and True in arg[0]: self.stdscr.erase() component.get("ConsoleUI").set_mode(self.legacy_mode) self.legacy_mode.refresh() curses.curs_set(2) else: self.messages.append(("Error","An error occured trying to switch to legacy mode")) component.stop(["AllTorrents"]).addCallback(dolegacy)
def shutdown(self, *args, **kwargs): log.debug("gtkui shutting down..") component.stop() # Process any pending gtk events since the mainloop has been quit while gtk.events_pending(): gtk.main_iteration(0) # Shutdown all components component.shutdown() # Make sure the config is saved. self.config.save()
def shutdown(self, *args, **kwargs): log.debug("gtkui shutting down..") component.stop() # Process any pending gtk events since the mainloop has been quit if not deluge.common.windows_check() and not deluge.common.osx_check(): while gtk.events_pending() and reactor.running: reactor.doIteration(0) # Shutdown all components component.shutdown() # Make sure the config is saved. self.config.save()
def start_console(self): # Maintain a list of (torrent_id, name) for use in tab completion self.started_deferred = defer.Deferred() if not self.initialized: self.initialized = True d = self.start_components() else: def on_stopped(result): return component.start(['SessionProxy']) d = component.stop(['SessionProxy']).addCallback(on_stopped) return d
def tearDown(self): component.stop() component._ComponentRegistry.components = {}
def on_start(result, c1, counter): self.assertTrue(c1._component_timer) self.assertTrue(c1._component_timer.running) self.assertNotEqual(c1.counter, counter) return component.stop()
def on_start(result, *args): for c in args: self.assertEqual(c._component_state, 'Started') return component.stop().addCallback(on_stop, *args)
def on_start(result, c): self.assertEqual(c._component_state, 'Started') return component.stop(['test_stop_component_c1' ]).addCallback(on_stop, c)
def on_start(result, c): self.assertEqual(c._component_state, 'Started') return component.stop(['test_stop_component_c1']).addCallback(on_stop, c)
def on_client_disconnect(self): component.stop()
def on_start(result, c1, c2): self.assertEquals(c1._component_state, "Started") self.assertEquals(c2._component_state, "Started") self.assertEquals(c1.start_count, 1) self.assertEquals(c2.start_count, 1) return component.stop(["test_start_depends_c1"]).addCallback(on_stop, c1, c2)
def back_to_overview(self): component.stop(["TorrentDetail"]) component.deregister(self) self.stdscr.clear() component.get("ConsoleUI").set_mode(self.alltorrentmode) self.alltorrentmode.resume()
def on_start(*args): for c in args[1:]: self.assertEquals(c._component_state, "Started") return component.stop().addCallback(on_stop, *args[1:])
def on_start(result, c): self.assertEquals(c._component_state, "Started") return component.stop(["test_stop_component_c1"]).addCallback(on_stop, c)
def __on_disconnect(self): """ Called when disconnected from the daemon. We basically just stop all the components here. """ component.stop()