示例#1
0
    def _create_applications(self):
        """Creates all application classes that the MainLoop coordinates.  This does NOT start them-
    that's done later.
    WARNING: the gui assumes the apps exist!
    """
        #create the Bank application:
        Bank.start()
        self.bankApp = Bank.get()
        #create the Tor application:
        Tor.start()
        self.torApp = Tor.get()

        #create the pseudo applications for InnomiNet
        BitBlinder.start(self.torApp, self.bankApp)
        self.bbApp = BitBlinder.get()
        #create the applications:
        BitTorrentClient.start(self.torApp)
        self.btApp = BitTorrentClient.get()
        self.bbApp.add_application(self.btApp)
        if System.IS_WINDOWS:
            FirefoxPortable.start(self.torApp)
            self.ffApp = FirefoxPortable.get()
            self.bbApp.add_application(self.ffApp)

        self.gui.on_applications_created(self.bankApp, self.torApp, self.bbApp,
                                         self.btApp, self.ffApp)
示例#2
0
 def _create_applications(self):
   """Creates all application classes that the MainLoop coordinates.  This does NOT start them-
   that's done later.
   WARNING: the gui assumes the apps exist!
   """
   #create the Bank application:
   Bank.start()
   self.bankApp = Bank.get()
   #create the Tor application:
   Tor.start()
   self.torApp = Tor.get()
   
   #create the pseudo applications for InnomiNet
   BitBlinder.start(self.torApp, self.bankApp)
   self.bbApp = BitBlinder.get()
   #create the applications:
   BitTorrentClient.start(self.torApp)
   self.btApp = BitTorrentClient.get()
   self.bbApp.add_application(self.btApp)
   if System.IS_WINDOWS:
     FirefoxPortable.start(self.torApp)
     self.ffApp = FirefoxPortable.get()
     self.bbApp.add_application(self.ffApp)
   
   self.gui.on_applications_created(self.bankApp, self.torApp, self.bbApp, self.btApp, self.ffApp)
示例#3
0
 def create_view_menu(self):
   self.viewMenu = gtk.Menu()
   self.viewMenuRoot = gtk.MenuItem("View")
   
   GTKUtils.append_menu_item(self.viewMenu, "Help", self.show_help)
   self.viewMenu.append(gtk.SeparatorMenuItem())
   
   def make_toggle_window_entry(window, name):
     menuItem = GTKUtils.append_menu_item(self.viewMenu, " ", window.toggle_window_state)
     def on_toggled(window):
       if window.is_visible():
         menuItem.child.set_text("Hide %s" % (name))
       else:
         menuItem.child.set_text("Show %s" % (name))
     on_toggled(window)
     self._start_listening_for_event("shown", window, on_toggled)
     self._start_listening_for_event("hidden", window, on_toggled)
     return menuItem
     
   make_toggle_window_entry(self.controller.btWindow, "BitTorrent")
   firefox = FirefoxPortable.get()
   if firefox:
     make_toggle_window_entry(self.controller.firefoxWindow, "Firefox")
   make_toggle_window_entry(self.controller.serverWindow, "Server")
   make_toggle_window_entry(self.controller.socksClientWindow, "SOCKS Clients")
   
   self.viewMenu.append(gtk.SeparatorMenuItem())
   GTKUtils.append_menu_item(self.viewMenu, "Preferences", self.controller.show_settings_cb)
   self.viewMenuRoot.set_submenu(self.viewMenu)
   self.viewMenuRoot.show()
   return self.viewMenu
示例#4
0
 def create_file_menu(self):
   self.fileMenu = gtk.Menu()
   self.fileMenuRoot = gtk.MenuItem("File")
   
   def make_toggle_app_entry(app, is_running_func, toggle_func, name, stopEvent, startEvent):
     menuItem = GTKUtils.append_menu_item(self.fileMenu, " ", toggle_func)
     def on_toggled(app):
       if is_running_func():
         menuItem.child.set_text("Stop %s" % (name))
       else:
         menuItem.child.set_text("Start %s" % (name))
     on_toggled(app)
     self._start_listening_for_event(startEvent, app, on_toggled)
     self._start_listening_for_event(stopEvent, app, on_toggled)
     return menuItem
     
   self.serverMenuItem = make_toggle_app_entry(Tor.get(), Tor.get().is_server, 
     self.controller.toggle_relay, "Relay", "server_stopped", "server_started")
   self.bittorrentMenuItem = make_toggle_app_entry(BitTorrentClient.get(), BitTorrentClient.get().is_running, 
     self.controller.toggle_bittorrent, "BitTorrent", "stopped", "started")
   firefox = FirefoxPortable.get()
   if firefox:
     self.firefoxMenuItem = make_toggle_app_entry(firefox, firefox.is_running, 
       self.controller.toggle_firefox, "Browser", "stopped", "started")
   
   self.fileMenu.append(gtk.SeparatorMenuItem())
   GTKUtils.append_menu_item(self.fileMenu, "Update", self.controller.update_check)
   GTKUtils.append_menu_item(self.fileMenu, "Quit", self.controller.quit_cb)
   self.fileMenuRoot.set_submenu(self.fileMenu)
   self.fileMenuRoot.show()
   return self.fileMenu