Beispiel #1
0
 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()
Beispiel #2
0
 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)
Beispiel #3
0
 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()
Beispiel #4
0
 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)
Beispiel #5
0
 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)
Beispiel #6
0
 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)
Beispiel #7
0
 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)
Beispiel #8
0
    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()
Beispiel #9
0
 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)
Beispiel #10
0
    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()
Beispiel #11
0
    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()
Beispiel #12
0
    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
Beispiel #13
0
 def tearDown(self):
     component.stop()
     component._ComponentRegistry.components = {}
Beispiel #14
0
 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()
Beispiel #15
0
 def on_start(result, *args):
     for c in args:
         self.assertEqual(c._component_state, 'Started')
     return component.stop().addCallback(on_stop, *args)
Beispiel #16
0
 def on_start(result, c):
     self.assertEqual(c._component_state, 'Started')
     return component.stop(['test_stop_component_c1'
                            ]).addCallback(on_stop, c)
Beispiel #17
0
 def on_start(result, c):
     self.assertEqual(c._component_state, 'Started')
     return component.stop(['test_stop_component_c1']).addCallback(on_stop, c)
Beispiel #18
0
 def on_client_disconnect(self):
     component.stop()
Beispiel #19
0
 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)
Beispiel #20
0
 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:])
Beispiel #22
0
 def on_start(*args):
     for c in args[1:]:
         self.assertEquals(c._component_state, "Started")
     return component.stop().addCallback(on_stop, *args[1:])
Beispiel #23
0
 def on_start(result, c):
     self.assertEquals(c._component_state, "Started")
     return component.stop(["test_stop_component_c1"]).addCallback(on_stop, c)
Beispiel #24
0
 def on_start(result, *args):
     for c in args:
         self.assertEqual(c._component_state, 'Started')
     return component.stop().addCallback(on_stop, *args)
Beispiel #25
0
 def tearDown(self):
     component.stop()
     component._ComponentRegistry.components = {}
 def on_start(result, c):
     self.assertEquals(c._component_state, "Started")
     return component.stop(["test_stop_component_c1"]).addCallback(on_stop, c)
Beispiel #27
0
 def __on_disconnect(self):
     """
     Called when disconnected from the daemon.  We basically just stop all
     the components here.
     """
     component.stop()
 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()
Beispiel #29
0
 def on_client_disconnect(self):
     component.stop()