Exemplo n.º 1
0
 def __init__(self, controller):
   GeneratorMixin.GeneratorMixin.__init__(self)
   self.controller = controller
   self.testUpdateEvent = None
   self.torApp = Tor.get()
   self.lastTestResult = None
   ClientUtil.add_updater(self)
   self._add_events("failure", "success", "size_changed")
   
   #make the components for this GUI
   instructionBox = self._make_instruction_box()
   requiredPortsBox = self._make_required_ports_box()
   optionalPortsBox = self._make_optional_ports_box()
   buttonBox = self._make_button_box()
   
   #pack them into our window:
   box = gtk.VBox(spacing=PADDING)
   box.pack_start(instructionBox, False, False, 0)
   box.pack_start(requiredPortsBox, False, False, 0)
   box.pack_start(optionalPortsBox, False, False, 0)
   box.pack_end(buttonBox, False, False, 0)
   box.show()
   
   paddedBox = GTKUtils.add_padding(box, PADDING)
   paddedBox.show()
   frame = GTKUtils.add_frame(paddedBox)
   frame.show()
   
   self.container = frame
   self.label = gtk.Label("Relay Setup")
   
   #make pretty:
   _unify_widget_widths([self.relayBox.label, self.dhtBox.label, self.dirBox.label, self.upnpBox.label])
   _unify_widget_widths([self.relayBox.entry.entry, self.dhtBox.entry.entry, self.dirBox.entry.entry, self.upnpBox.entry.entry])
   self.container.set_focus_child(self.doneButton)
Exemplo n.º 2
0
 def __init__(self):
   gui.console.Controller.Controller.__init__(self)
   self.statistics = {}
   #we can't just print stuff out to the screen, so this is called instead until I figure out something less stupidlike
   Logger.PRINT_FUNCTION = self.log_msg
   self.stdscr = None
   #theses objects are usd by the credit display
   for item in ('Wallet', 'Bank Balance', 'Earned', 'Spent'):
     self.statistics[item] = (Money(item, 0))
   self.status = {"Relay": 'Unknown', "UPNP": 'Unknown', "Published": 'Unknown', "Port": 'Unknown', "Client": 'Unknown'}
   self.rows          = {}
   self.lastData      = None
   self.curDownload   = None
   self.socksDisplay  = PsuedoGobject()
   self.statusDisplay = PsuedoGobject()
   self.torrents      = {'torrents':[], 'maxLength': 0}
   self.torStatus     = None
   #Keystrokes go into a threadsafe queue and are popped out in the main thread 
   self.q = Queue.Queue()
   self.shouldListen = True
   #this is used to store the previous N calls to log_msg
   self.msgBuffer = []
   #stores infos about external socks apps
   self.apps = {}
   self.moniesDisplay = [9, None]
   self.statusDisplay = (9, 60)
   self._start_curses()
   Globals.reactor.callInThread(self._listener)
   self.catch_event("shutdown")
   ClientUtil.add_updater(self)
Exemplo n.º 3
0
  def cleanup(self):
    """Make sure the reactor, threads, etc have been stopped.  Also removes
    the file that indicates we shutdown cleanly."""
    
    #shutdown Twisted
    if ProgramState.USE_GTK:
      Globals.reactor.stop()
      Globals.reactor.runUntilCurrent()
      
    #ensure that all threads have closed:
    remainingThreads = threading.enumerate()
    for thread in remainingThreads:
      if threading._MainThread != type(thread):
        log_msg("Thread has not finished by the end of the program: %s" % (thread), 1)

    #start the update if necessary:
    if Updater.get().APPLY_UPDATE:
      ClientUtil.apply_update()
      
    #NOTE:  we intentionally leave the log files open so that errors can get written to them...
    log_msg("Thanks for using BitBlinder", 2)
    ErrorReporting.destroy_marker_file()
    
    #NOTE:  this is here so that threads can finish properly.  I was getting errors from leftover threads without it.
    #However, I'm pretty sure that it was just from the IDE
    time.sleep(0.2)
Exemplo n.º 4
0
 def on_response(self, dialog, response_id):
   if (response_id == gtk.RESPONSE_OK):
     #get the login details, etc:
     self.username = str(self.nameEntry.get_text())
     if not self.username:
       GUIController.get().show_msgbox("You must enter a username of some sort.", title="Invalid Username")
       return
     #ship off to the ftp server!
     log_msg("archiving stuffs", 2)
     startiter = self.textbuffer.get_start_iter()
     enditer   = self.textbuffer.get_end_iter()
     buf = self.textbuffer.get_text(startiter, enditer)
     ClientUtil.create_error_archive(buf)
     log_msg("submiting archive", 2)
     def response(success):
       if success:
         GUIController.get().show_msgbox("The bug report was sent successfully.", title="Success!")
       else:
         if not ProgramState.DONE:
           GUIController.get().show_msgbox("The bug report failed.  You can submit the bug manually at:", title="Too Much Fail", link=GTKUtils.make_html_link("http://innomi.net/bugs/report/1", 'http://innomi.net/bugs/report/1'))
     ftpSubmitter = ErrorReporting.send_error_report()
     ftpSubmitter.cb = response
     GUIController.get().show_msgbox("The bug report is being sent.  BitBlinder will alert you when it is finished.", title="Thanks!")
     self.dia.destroy()
   elif (response_id == gtk.RESPONSE_CANCEL):
     self.dia.destroy()
   else:
     log_msg("canceled error submition", 2)
     
Exemplo n.º 5
0
  def __init__(self, torApp):
    self.torApp = torApp
    ClientUtil.add_updater(self)
    self.catch_event("tor_ready")
    self.textview = gtk.TextView(buffer=None)
    self.buffer = self.textview.get_buffer()
    self.textview.set_editable(False)  
    self.textview.set_cursor_visible(False)
    self.textview.set_wrap_mode(gtk.WRAP_WORD)
    
    self.textEventList = self.textview
    self.textEventList.show()
    # create a new scrolled window.
    scrolled_window = gtk.ScrolledWindow()
    scrolled_window.set_border_width(10)
    scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
    #scrolled_window.set_size_request(300, 350)
    scrolled_window.add_with_viewport(self.textEventList)
    scrolled_window.show()
    
    self.entry = gtk.Entry(100)
    self.entry.connect("activate", self.enter_callback, self.entry)
    self.entry.show()

    vbox = gtk.VBox()
    vbox.pack_start(scrolled_window, True, True, 10)
    vbox.pack_end(self.entry, False, False)
    
    self.label = gtk.Label("Console")
    self.container = vbox
Exemplo n.º 6
0
    def cleanup(self):
        """Make sure the reactor, threads, etc have been stopped.  Also removes
    the file that indicates we shutdown cleanly."""

        #shutdown Twisted
        if ProgramState.USE_GTK:
            Globals.reactor.stop()
            Globals.reactor.runUntilCurrent()

        #ensure that all threads have closed:
        remainingThreads = threading.enumerate()
        for thread in remainingThreads:
            if threading._MainThread != type(thread):
                log_msg(
                    "Thread has not finished by the end of the program: %s" %
                    (thread), 1)

        #start the update if necessary:
        if Updater.get().APPLY_UPDATE:
            ClientUtil.apply_update()

        #NOTE:  we intentionally leave the log files open so that errors can get written to them...
        log_msg("Thanks for using BitBlinder", 2)
        ErrorReporting.destroy_marker_file()

        #NOTE:  this is here so that threads can finish properly.  I was getting errors from leftover threads without it.
        #However, I'm pretty sure that it was just from the IDE
        time.sleep(0.2)
Exemplo n.º 7
0
 def __init__(self, name, settingsClass, description):
     """Create an application.  All subclasses must call this function.
 @param name:           name of the application
 @type name:            str
 @param settingsClass:  used for storing application settings
 @type settingsClass:   Settings
 @param description:    short description of the application
 @type description:     str
 """
     GeneratorMixin.GeneratorMixin.__init__(self)
     BWHistory.BWHistory.__init__(self)
     self._add_events("launched", "started", "stopped", "finished")
     #: applications are stored in a single folder, by default under this folder:
     self.appBasePath = "apps"
     #: the name of the application
     self.name = name
     #: a short description of the application
     self.desc = description
     #load the settings file:
     if not hasattr(settingsClass, "defaultFile"):
         fileName = "%sSettings.ini" % (name)
     else:
         fileName = settingsClass.defaultFile
     fileName = os.path.join(Globals.USER_DATA_DIR, fileName)
     #: the Settings class instance
     self.settings = settingsClass()
     if not self.settings.load(fileName):
         self.isFirstRun = True
     else:
         self.isFirstRun = False
     #store for later loading the file
     self.settings.fileName = fileName
     #: list of process that are this application:
     self.processes = []
     #: this indicates that the program is in the process of shutting down:
     self.shutdownDeferred = None
     #: set when the process is starting up and we're waiting for it to finish
     self.startupDeferred = None
     #: set when starting or stopping and we need to restart:
     self.restartDeferred = None
     #: flag set when restarting:
     self.isRestarting = None
     #: dictionary mapping from id -> obj for all Circuits
     self.circuits = set()
     #: as above, but closed/failed circuits are never in this dictionary
     self.liveCircuits = set()
     #: dictionary mapping from id -> obj for all Streams
     self.streams = {}
     #: the 2-letter country code of the country to exit from, or None if this setting should be ignored
     self.exitCountry = None
     #: how many coins this application has spent so far
     self.coinsSpent = 0
     #: amount of time in seconds after which we stop trying to shutdown cleanly and give up
     self.shutdownTimeoutLength = 10
     #listen for a bunch of events:
     self.catch_event("shutdown")
     self.catch_event("tor_done")
     ClientUtil.add_updater(self)
Exemplo n.º 8
0
 def __init__(self, name, settingsClass, description):
   """Create an application.  All subclasses must call this function.
   @param name:           name of the application
   @type name:            str
   @param settingsClass:  used for storing application settings
   @type settingsClass:   Settings
   @param description:    short description of the application
   @type description:     str
   """
   GeneratorMixin.GeneratorMixin.__init__(self)
   BWHistory.BWHistory.__init__(self)
   self._add_events("launched", "started", "stopped", "finished")
   #: applications are stored in a single folder, by default under this folder:
   self.appBasePath = "apps"
   #: the name of the application
   self.name = name
   #: a short description of the application
   self.desc = description
   #load the settings file:
   if not hasattr(settingsClass, "defaultFile"):
     fileName = "%sSettings.ini" % (name)
   else:
     fileName = settingsClass.defaultFile
   fileName = os.path.join(Globals.USER_DATA_DIR, fileName)
   #: the Settings class instance
   self.settings = settingsClass()
   if not self.settings.load(fileName):
     self.isFirstRun = True
   else:
     self.isFirstRun = False
   #store for later loading the file
   self.settings.fileName = fileName
   #: list of process that are this application:
   self.processes = []
   #: this indicates that the program is in the process of shutting down:
   self.shutdownDeferred = None
   #: set when the process is starting up and we're waiting for it to finish
   self.startupDeferred = None
   #: set when starting or stopping and we need to restart:
   self.restartDeferred = None
   #: flag set when restarting:
   self.isRestarting = None
   #: dictionary mapping from id -> obj for all Circuits
   self.circuits = set()
   #: as above, but closed/failed circuits are never in this dictionary
   self.liveCircuits = set()
   #: dictionary mapping from id -> obj for all Streams
   self.streams = {}
   #: the 2-letter country code of the country to exit from, or None if this setting should be ignored
   self.exitCountry = None
   #: how many coins this application has spent so far
   self.coinsSpent = 0
   #: amount of time in seconds after which we stop trying to shutdown cleanly and give up
   self.shutdownTimeoutLength = 10
   #listen for a bunch of events:
   self.catch_event("shutdown")
   self.catch_event("tor_done")
   ClientUtil.add_updater(self)
Exemplo n.º 9
0
 def __init__(self):    
   ClientUtil.add_updater(self)
   #Statistics
   stat_vbox = gtk.VBox()
   self.statistics = {}
   for stat in ("Local Balance", "Bank Balance", "Credits Earned"):
     gtkObj = gtk.Label(stat+": ")
     gtkObj.stat_value = ""
     align = gtk.Alignment(xalign=0.0, yalign=0.5, xscale=0.0, yscale=0.0)
     align.add(gtkObj)
     align.set_padding(0, 0, 5, 0)
     stat_vbox.pack_end(align, False, False, 5)
     align.show()
     gtkObj.show()
     self.statistics[stat] = gtkObj
   stat_align = gtk.Alignment(xalign=0.0, yalign=0.5, xscale=0.0, yscale=0.0)
   stat_align.add(stat_vbox)
   stat_vbox.show()
   stat_align.show()
   
   self.payments = 0
   self.failures = 0
   self.withdrawals = 0
   self.deposits = 0
   self.TEST_DONE = True
   
   self.buttonRow = gtk.HBox()
   
   b = gtk.Button("Request ACoins")
   self.buttonRow.pack_start(b)
   b.connect('clicked', self.request_cb)
   
   b = gtk.Button("Deposit ACoins")
   self.buttonRow.pack_start(b)
   b.connect('clicked', self.deposit_cb)
   
   b = gtk.Button("ACoin Payment")
   self.buttonRow.pack_start(b)
   b.connect('clicked', self.payment_cb)
   
   self.buttonRow.show_all()
   
   self.entry = gtk.Entry(0)
   self.entry.connect('activate', self.entry_cb)
   balanceEntryBox = gtk.HBox()
   balanceEntryBox.pack_start(gtk.Label("Pretend bank balance is:  "), False, False, 0)
   balanceEntryBox.pack_start(self.entry, True, True, 0)
   
   #Glue:
   self.vbox = gtk.VBox()
   self.vbox.pack_start(stat_align, False, False, 10)
   self.vbox.pack_end(self.buttonRow, False, False, 10)
   self.vbox.pack_end(balanceEntryBox, False, False, 10)
   self.vbox.show()
   
   self.container = self.vbox
   self.label = gtk.Label("Bank")
   return
Exemplo n.º 10
0
  def __init__(self, root):
    BaseDialog.BaseDialog.__init__(self, "Welcome!", ("ok",), None)
    self.root = root
    width = 200
    padding = 20

    imagePath = ClientUtil.get_image_file("bb_logo.png")
    pixbuf = gtk.gdk.pixbuf_new_from_file(imagePath)
    pixbuf = pixbuf.scale_simple(width, int(width * 0.553), gtk.gdk.INTERP_TILES)
    
    image = gtk.Image()
    image.set_from_pixbuf(pixbuf)
    
    vBox = gtk.VBox()
    vBox.pack_start(image, False, False, padding-3)
    welcomeLabel = gtk.Label(WELCOME_TEXT)
    welcomeLabel.set_line_wrap(True)
    welcomeLabel.set_justify(gtk.JUSTIFY_FILL)
    welcomeLabel.set_size_request(width, -1)
    align = gtk.Alignment(0, 0, 1, 1)
    align.set_padding(0, padding, padding, padding)
    align.add(welcomeLabel)
    vBox.pack_start(align, False, False, 0)
    
    frame = gtk.Frame()
    frame.add(vBox)
    
    widgetHack = gtk.EventBox()
    widgetHack.add(frame)
    widgetHack.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("white"))

    self.dia.vbox.pack_start(widgetHack, True, True, 0)
    self.dia.show_all()
Exemplo n.º 11
0
 def set_start_on_boot(self, newVal):
   """Change the registry key (if necessary) for auto launching BitBlinder at startup on windows, does nothing on *nix.
   Ends up calling a function made with NSIS that will get the necessary permissions to do the modification
   @param newVal:  whether to start on boot or not
   @type  newVal:  bool"""
   if not System.IS_WINDOWS:
     return
   #No need to change if the value is already correct?
   if self.check_start_on_boot() == newVal:
     if self.startOnBootDeferred:
       log_msg("Failed to modify 'start at bootup' value, already editing the registry!", 0)
     return
   if self.startOnBootDeferred:
     return
   def uac_done(result):
     self.startOnBootDeferred = None
     if result != True:
       log_ex(result, "Bad result while running BitBlinderSettingsUpdate.exe")
   #launch the program:
   if newVal:
     args = " --add-startup=" + ClientUtil.get_launch_command()
   else:
     args = " --remove-startup"
     
   encodedExe = System.encode_for_filesystem(os.path.join(Globals.WINDOWS_BIN, "BitBlinderSettingsUpdate.exe"))
   self.startOnBootDeferred = SerialProcessLauncher.get().run_app(encodedExe + "  /S" + args)
   self.startOnBootDeferred.addCallback(uac_done)
   self.startOnBootDeferred.addErrback(uac_done)
Exemplo n.º 12
0
def check_previous_logs():
  try:
    #check to see if we closed cleanly before we start_logs!
    errorFile = os.path.join(Globals.LOG_FOLDER, 'errors.out')
    shutdownMarkerFileName = os.path.join(Globals.LOG_FOLDER, 'closedcleanly.txt')
    failedToCloseCleanlyLastTime = Files.file_exists(shutdownMarkerFileName)
    wasErrorLastTime = Files.file_exists(errorFile) and os.path.getsize(errorFile) != 0
    
    #submit error log
    if failedToCloseCleanlyLastTime or wasErrorLastTime:
      startTime = time.time()
      ClientUtil.create_error_archive("autogenerated")
      log_msg("Took %.2f seconds to zip error logs" % (time.time() - startTime), 2)
    #remove error log
    else:
      Files.delete_file(Globals.BUG_REPORT_NAME, True)
  except Exception, error:
    log_ex(error, "Failed to make error report!")
Exemplo n.º 13
0
    def __init__(self):
        ListenerMixin.ListenerMixin.__init__(self)

        #these are all the top-level windows that will ever be used.  This Controller is responsible for all of them.
        self.loginWindow = None
        self.btWindow = None
        self.firefoxWindow = None

        self.bankApp = None
        self.torApp = None
        self.bbApp = None
        self.btApp = None
        self.ffApp = None

        self.updateDialog = None
        self.lowMoneyDialog = None
        self.povertyDialog = None
        self.settingsDialog = None

        #listen for the events that we need to know about
        self.catch_event("no_credits")
        self.catch_event("shutdown")
        self.catch_event("new_args")

        #necessary for GTK to function properly:
        gobject.threads_init()

        #set the default image for the window
        defaultImage = ClientUtil.get_image_file(u"bb_logo.png")
        gtk.window_set_default_icon_from_file(defaultImage)

        #: windows which have been (de)iconified by left clickingon the status icon
        self.previouslyToggledWindows = []

        #sytem tray icon stuffs- handle when it is left clicked...
        statusIcon = ClientUtil.get_image_file("bb_favicon.ico")
        self.statusIcon = StatusIcon.StatusIcon(statusIcon)
        self.statusIcon.set_visible(False)
        self._start_listening_for_event("activated", self.statusIcon,
                                        self.on_status_icon_activated)
        self._start_listening_for_event("popup", self.statusIcon,
                                        self.on_status_icon_popup)
Exemplo n.º 14
0
    def __init__(self, controller):
        GeneratorMixin.GeneratorMixin.__init__(self)
        self.controller = controller
        self.testUpdateEvent = None
        self.torApp = Tor.get()
        self.lastTestResult = None
        ClientUtil.add_updater(self)
        self._add_events("failure", "success", "size_changed")

        #make the components for this GUI
        instructionBox = self._make_instruction_box()
        requiredPortsBox = self._make_required_ports_box()
        optionalPortsBox = self._make_optional_ports_box()
        buttonBox = self._make_button_box()

        #pack them into our window:
        box = gtk.VBox(spacing=PADDING)
        box.pack_start(instructionBox, False, False, 0)
        box.pack_start(requiredPortsBox, False, False, 0)
        box.pack_start(optionalPortsBox, False, False, 0)
        box.pack_end(buttonBox, False, False, 0)
        box.show()

        paddedBox = GTKUtils.add_padding(box, PADDING)
        paddedBox.show()
        frame = GTKUtils.add_frame(paddedBox)
        frame.show()

        self.container = frame
        self.label = gtk.Label("Relay Setup")

        #make pretty:
        _unify_widget_widths([
            self.relayBox.label, self.dhtBox.label, self.dirBox.label,
            self.upnpBox.label
        ])
        _unify_widget_widths([
            self.relayBox.entry.entry, self.dhtBox.entry.entry,
            self.dirBox.entry.entry, self.upnpBox.entry.entry
        ])
        self.container.set_focus_child(self.doneButton)
Exemplo n.º 15
0
    def on_response(self, dialog, response_id):
        if (response_id == gtk.RESPONSE_OK):
            #get the login details, etc:
            self.username = str(self.nameEntry.get_text())
            if not self.username:
                GUIController.get().show_msgbox(
                    "You must enter a username of some sort.",
                    title="Invalid Username")
                return
            #ship off to the ftp server!
            log_msg("archiving stuffs", 2)
            startiter = self.textbuffer.get_start_iter()
            enditer = self.textbuffer.get_end_iter()
            buf = self.textbuffer.get_text(startiter, enditer)
            ClientUtil.create_error_archive(buf)
            log_msg("submiting archive", 2)

            def response(success):
                if success:
                    GUIController.get().show_msgbox(
                        "The bug report was sent successfully.",
                        title="Success!")
                else:
                    if not ProgramState.DONE:
                        GUIController.get().show_msgbox(
                            "The bug report failed.  You can submit the bug manually at:",
                            title="Too Much Fail",
                            link=GTKUtils.make_html_link(
                                "http://innomi.net/bugs/report/1",
                                'http://innomi.net/bugs/report/1'))

            ftpSubmitter = ErrorReporting.send_error_report()
            ftpSubmitter.cb = response
            GUIController.get().show_msgbox(
                "The bug report is being sent.  BitBlinder will alert you when it is finished.",
                title="Thanks!")
            self.dia.destroy()
        elif (response_id == gtk.RESPONSE_CANCEL):
            self.dia.destroy()
        else:
            log_msg("canceled error submition", 2)
Exemplo n.º 16
0
  def __init__(self):
    ListenerMixin.ListenerMixin.__init__(self)
    
    #these are all the top-level windows that will ever be used.  This Controller is responsible for all of them.
    self.loginWindow = None
    self.btWindow = None
    self.firefoxWindow = None
    
    self.bankApp = None
    self.torApp = None
    self.bbApp = None
    self.btApp = None
    self.ffApp = None
    
    self.updateDialog = None
    self.lowMoneyDialog = None
    self.povertyDialog = None
    self.settingsDialog = None
    
    #listen for the events that we need to know about
    self.catch_event("no_credits")
    self.catch_event("shutdown")
    self.catch_event("new_args")
    
    #necessary for GTK to function properly:
    gobject.threads_init()
    
    #set the default image for the window
    defaultImage = ClientUtil.get_image_file(u"bb_logo.png")
    gtk.window_set_default_icon_from_file(defaultImage)
    
    #: windows which have been (de)iconified by left clickingon the status icon
    self.previouslyToggledWindows = []

    #sytem tray icon stuffs- handle when it is left clicked...
    statusIcon = ClientUtil.get_image_file("bb_favicon.ico")
    self.statusIcon = StatusIcon.StatusIcon(statusIcon)
    self.statusIcon.set_visible(False)
    self._start_listening_for_event("activated", self.statusIcon, self.on_status_icon_activated)
    self._start_listening_for_event("popup", self.statusIcon, self.on_status_icon_popup)
Exemplo n.º 17
0
 def __init__(self):
     gui.console.Controller.Controller.__init__(self)
     self.statistics = {}
     #we can't just print stuff out to the screen, so this is called instead until I figure out something less stupidlike
     Logger.PRINT_FUNCTION = self.log_msg
     self.stdscr = None
     #theses objects are usd by the credit display
     for item in ('Wallet', 'Bank Balance', 'Earned', 'Spent'):
         self.statistics[item] = (Money(item, 0))
     self.status = {
         "Relay": 'Unknown',
         "UPNP": 'Unknown',
         "Published": 'Unknown',
         "Port": 'Unknown',
         "Client": 'Unknown'
     }
     self.rows = {}
     self.lastData = None
     self.curDownload = None
     self.socksDisplay = PsuedoGobject()
     self.statusDisplay = PsuedoGobject()
     self.torrents = {'torrents': [], 'maxLength': 0}
     self.torStatus = None
     #Keystrokes go into a threadsafe queue and are popped out in the main thread
     self.q = Queue.Queue()
     self.shouldListen = True
     #this is used to store the previous N calls to log_msg
     self.msgBuffer = []
     #stores infos about external socks apps
     self.apps = {}
     self.moniesDisplay = [9, None]
     self.statusDisplay = (9, 60)
     self._start_curses()
     Globals.reactor.callInThread(self._listener)
     self.catch_event("shutdown")
     ClientUtil.add_updater(self)
Exemplo n.º 18
0
def make_image_button(labelText, callback, fileName, vertical=False, makeButton=True, iconSize=16):
  """Make a button that consists of an image and a label (joined either vertically or horizontally)"""
  if makeButton:
    button = gtk.Button()
  else:
    button = gtk.EventBox()
  if labelText != None:
    label = gtk.Label("")
    label.set_markup('<span size="large">%s</span>' % (labelText))
    button.label = label
  image = gtk.Image()
  #get the full path
  filePath = ClientUtil.get_image_file(fileName)
  pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(filePath, iconSize, iconSize)
  image.set_from_pixbuf(pixbuf)
  box = None
  if vertical:
    box = gtk.VBox()
  else:
    box = gtk.HBox()
  button.add(box)
  box.pack_start(image, False, False, 0)
  if labelText != None:
    align = gtk.Alignment(xalign=0.5, yalign=0.5, xscale=1.0, yscale=0.0)
    align.add(label)
    align.set_padding(1, 1, 1, 1)
    box.pack_start(align, True, False, 0)
  if callback:
    if makeButton:
      button.connect('clicked', callback)
    else:
      button.set_events(gtk.gdk.BUTTON_PRESS_MASK)
      button.connect("button_press_event", callback)
  button.show_all()
  button.image = image
  return button
Exemplo n.º 19
0
    def _create_tab_label(self, label, child):

        text = label.get_text()
        label.set_markup('<span>%s</span>' % text)
        image = gtk.Image()
        imagePath = ClientUtil.get_image_file('square_x.png')
        pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(imagePath, 8, 8)
        image.set_from_pixbuf(pixbuf)
        #    image.set_from_stock(gtk.STOCK_CLOSE, gtk.ICON_SIZE_MENU)
        #    image.set_size_request(6, 6)
        closeButton = gtk.Button()
        closeButton.set_name("LittleButton")
        closeButton.connect("clicked", self._close_tab, child)
        closeButton.set_image(image)
        closeButton.set_relief(gtk.RELIEF_NONE)
        sizeRequest = closeButton.size_request()
        closeButton.show()

        box = gtk.HBox()
        box.pack_start(label, True, True)
        box.pack_end(closeButton, False, False)
        box.show()

        return box
Exemplo n.º 20
0
  def _create_tab_label(self, label, child):
    
    text = label.get_text()
    label.set_markup('<span>%s</span>' % text)
    image = gtk.Image()
    imagePath = ClientUtil.get_image_file('square_x.png')
    pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(imagePath, 8, 8)
    image.set_from_pixbuf(pixbuf)
#    image.set_from_stock(gtk.STOCK_CLOSE, gtk.ICON_SIZE_MENU)
#    image.set_size_request(6, 6)
    closeButton = gtk.Button()
    closeButton.set_name("LittleButton")
    closeButton.connect("clicked", self._close_tab, child)
    closeButton.set_image(image)
    closeButton.set_relief(gtk.RELIEF_NONE)
    sizeRequest = closeButton.size_request()
    closeButton.show()
    
    box = gtk.HBox()
    box.pack_start(label, True, True)
    box.pack_end(closeButton, False, False)
    box.show()
    
    return box
Exemplo n.º 21
0
    def set_start_on_boot(self, newVal):
        """Change the registry key (if necessary) for auto launching BitBlinder at startup on windows, does nothing on *nix.
    Ends up calling a function made with NSIS that will get the necessary permissions to do the modification
    @param newVal:  whether to start on boot or not
    @type  newVal:  bool"""
        if not System.IS_WINDOWS:
            return
        #No need to change if the value is already correct?
        if self.check_start_on_boot() == newVal:
            if self.startOnBootDeferred:
                log_msg(
                    "Failed to modify 'start at bootup' value, already editing the registry!",
                    0)
            return
        if self.startOnBootDeferred:
            return

        def uac_done(result):
            self.startOnBootDeferred = None
            if result != True:
                log_ex(
                    result,
                    "Bad result while running BitBlinderSettingsUpdate.exe")

        #launch the program:
        if newVal:
            args = " --add-startup=" + ClientUtil.get_launch_command()
        else:
            args = " --remove-startup"

        encodedExe = System.encode_for_filesystem(
            os.path.join(Globals.WINDOWS_BIN, "BitBlinderSettingsUpdate.exe"))
        self.startOnBootDeferred = SerialProcessLauncher.get().run_app(
            encodedExe + "  /S" + args)
        self.startOnBootDeferred.addCallback(uac_done)
        self.startOnBootDeferred.addErrback(uac_done)
Exemplo n.º 22
0
    def create(self):
        self.connect("destroy", self.destroy_cb)

        ClientUtil.add_updater(self)
        self.catch_event("no_credits")

        def on_launched(button):
            self.start()

        self._start_listening_for_event("launched", self.app, on_launched)

        self.popupMenu = TorrentPopupMenu(self)

        #everything changes in relation to this magic number
        maggicPadding = 2

        self.statusRow = BTUtilityStatusRow(self.app, maggicPadding)
        self.buttonRow = BTUtilityButtonRow(self.app, maggicPadding)
        self._start_listening_for_event("add_file", self.buttonRow,
                                        self._add_file_cb)
        self._start_listening_for_event("remove_file", self.buttonRow,
                                        self._remove_file_cb)
        self._start_listening_for_event("pause_torrent", self.buttonRow,
                                        self._pause_cb)
        self._start_listening_for_event("toggle_anonymity", self.buttonRow,
                                        self._toggle_anon_cb)

        self.rows = {}
        self.curDownload = None
        self.exitDialog = None
        self.trackerEditDialog = None

        #create a liststore with one string column to use as the model
        #COLUMNS:
        #0:  File name
        typeList = [
            gobject.TYPE_STRING,
            #1:  Amount done
            gobject.TYPE_FLOAT,
            #2:  Status
            gobject.TYPE_STRING,
            #3:  ETA
            gobject.TYPE_STRING,
            #4:  Peers
            gobject.TYPE_STRING,
            #5:  Seeds
            gobject.TYPE_STRING,
            #6:  Download Rate
            gobject.TYPE_STRING,
            #7:  Upload Rate
            gobject.TYPE_STRING,
            #8:  Download Amount
            gobject.TYPE_STRING,
            #9:  Upload Amount
            gobject.TYPE_STRING,
            #10:  Upload Amount
            gobject.TYPE_STRING,
            #11:  the hash for the download.  Stored hex-encoded, because nulls mess up gtk
            gobject.TYPE_STRING,
            #12:  is the row visible?
            gobject.TYPE_BOOLEAN
        ]
        self.attrIdx = {}
        self.attrIdx["name"] = 0
        self.attrIdx["progress"] = 1
        self.attrIdx["progressMsg"] = 2
        self.attrIdx["status"] = 3
        self.attrIdx["peers"] = 4
        self.attrIdx["seeds"] = 5
        self.attrIdx["rateUp"] = 6
        self.attrIdx["rateDown"] = 7
        self.attrIdx["amountUp"] = 8
        self.attrIdx["amountDown"] = 9
        self.attrIdx["copies"] = 10
        self.attrIdx["hash"] = 11
        self.attrIdx["visibility"] = 12
        self.liststore = gtk.ListStore(*typeList)
        COLUMN_NAMES = [
            "Name", "Progress", "Time Left", "Peers", "Seeds", "Down Rate",
            "Up Rate", "Down Amt", "Up Amt", "Copies"
        ]

        modelfilter, treeview = GTKUtils.make_listview(self.liststore,
                                                       COLUMN_NAMES)
        GTKUtils.make_text_cell(treeview.columns[0], 0)
        GTKUtils.make_progress_cell(treeview.columns[1], 1, 2)
        for i in range(2, len(COLUMN_NAMES)):
            GTKUtils.make_text_cell(treeview.columns[i], i + 1)

        #make treeview searchable
        treeview.set_search_column(0)
        #attach the filtermodel and treeview
        treeview.set_model(gtk.TreeModelSort(modelfilter))
        treeview.connect("cursor-changed", self.row_change_cb)
        treeview.connect("button-press-event", self.button_press_cb)
        treeview.connect("button-press-event", self.button_press_cb)
        #    treeview.set_size_request(-1, 30)
        treeview.get_selection().set_mode(gtk.SELECTION_MULTIPLE)

        self.treeview, self.modelfilter = treeview, modelfilter
        self.modelfilter.set_visible_func(self.visible_cb)

        topBox = gtk.VBox()
        topBox.pack_start(self.buttonRow, False, False, 0)
        scrolledTorrentsBox = GTKUtils.make_scroll_box(
            treeview,
            hPolicy=gtk.POLICY_AUTOMATIC,
            vPolicy=gtk.POLICY_AUTOMATIC)
        scrolledTorrentsBoxAlign = gtk.Alignment(0, 0, 1, 1)
        scrolledTorrentsBoxAlign.set_padding(0, maggicPadding, maggicPadding,
                                             maggicPadding)
        scrolledTorrentsBoxAlign.add(scrolledTorrentsBox)

        topBox.pack_start(scrolledTorrentsBoxAlign, True, True, 0)

        self.priorityBox = gtk.HBox()
        self.priorityBox.pack_start(
            gtk.Label("Select a torrent to set the priority for its files."),
            True, True, 0)
        self.priorityBox.set_border_width(0)

        self.peerBox = gtk.HBox()
        self.peerBox.pack_start(
            gtk.Label("Select a torrent to see your peers in the swarm."),
            True, True, 0)

        self.bwGraph = BWGraph.BWGraph(self.app, root=self)
        self.bwGraph.container.set_size_request(-1, 150)

        self.notebook = ClosableTabNotebook.ClosableTabNotebook()
        self.notebook.set_show_border(True)
        self.notebook.set_border_width(0)
        self.bwGraph.label = gtk.Label("BitTorrent Traffic")
        self.priorityBox.label = gtk.Label("Priorities")
        self.priorityBox.container = self.priorityBox
        self.peerBox.label = gtk.Label("Peers")
        self.peerBox.container = self.peerBox
        self.notebook.show_display(self.bwGraph)
        self.notebook.show_display(self.priorityBox)
        self.notebook.show_display(self.peerBox)
        self.notebook.show_display(self.bwGraph)

        alignBottom = gtk.Alignment(0, 0, 1, 1)
        alignBottom.set_padding(0, maggicPadding + 3, maggicPadding + 2,
                                maggicPadding + 2)
        alignBottom.add(self.notebook)

        vBoxBottom = gtk.VBox()
        vBoxBottom.pack_start(alignBottom, True, True, 0)
        vBoxBottom.pack_end(self.statusRow, False, False, 0)

        vpane = gtk.VPaned()

        self.menuBar = BitTorrentMenuBar(self.controller, self)

        frame = gtk.Frame()
        frame.set_shadow_type(gtk.SHADOW_OUT)
        frame.add(topBox)

        alignTop = gtk.Alignment(1, 1, 1, 1)
        alignTop.set_padding(10, 0, maggicPadding + 3, maggicPadding + 3)
        alignTop.add(frame)

        topContainer = gtk.VBox()
        topContainer.pack_start(self.menuBar.create_menus(), False, False, 0)
        topContainer.pack_start(alignTop, True, True, 0)

        vpane.pack1(topContainer, resize=True, shrink=False)
        vpane.pack2(vBoxBottom, resize=False, shrink=False)

        self.label = gtk.Label("")
        self.label.set_markup(
            "<span size='x-large' weight='bold'>Bit Twister</span>")
        self.container = vpane
        vpane.set_position(400)
        self.add(self.container)
        self.container.show_all()
Exemplo n.º 23
0
  def create(self):
    self.connect("destroy", self.destroy_cb)
    
    ClientUtil.add_updater(self)
    self.catch_event("no_credits")
    
    def on_launched(button):
      self.start()
    self._start_listening_for_event("launched", self.app, on_launched)
    
    self.popupMenu = TorrentPopupMenu(self)
      
    #everything changes in relation to this magic number
    maggicPadding = 2
    
    self.statusRow = BTUtilityStatusRow(self.app, maggicPadding)
    self.buttonRow = BTUtilityButtonRow(self.app, maggicPadding)
    self._start_listening_for_event("add_file", self.buttonRow, self._add_file_cb)
    self._start_listening_for_event("remove_file", self.buttonRow, self._remove_file_cb) 
    self._start_listening_for_event("pause_torrent", self.buttonRow, self._pause_cb) 
    self._start_listening_for_event("toggle_anonymity", self.buttonRow, self._toggle_anon_cb)
    
    self.rows = {}
    self.curDownload = None
    self.exitDialog = None
    self.trackerEditDialog = None
    
    #create a liststore with one string column to use as the model
                #COLUMNS:
                #0:  File name
    typeList = [gobject.TYPE_STRING,
                #1:  Amount done
                gobject.TYPE_FLOAT,
                #2:  Status
                gobject.TYPE_STRING,
                #3:  ETA
                gobject.TYPE_STRING,
                #4:  Peers
                gobject.TYPE_STRING,
                #5:  Seeds
                gobject.TYPE_STRING,
                #6:  Download Rate
                gobject.TYPE_STRING,
                #7:  Upload Rate
                gobject.TYPE_STRING,
                #8:  Download Amount
                gobject.TYPE_STRING,
                #9:  Upload Amount
                gobject.TYPE_STRING,
                #10:  Upload Amount
                gobject.TYPE_STRING,
                #11:  the hash for the download.  Stored hex-encoded, because nulls mess up gtk
                gobject.TYPE_STRING,
                #12:  is the row visible?
                gobject.TYPE_BOOLEAN
                ]
    self.attrIdx = {}
    self.attrIdx["name"]         = 0
    self.attrIdx["progress"]     = 1
    self.attrIdx["progressMsg"]  = 2
    self.attrIdx["status"]       = 3
    self.attrIdx["peers"]        = 4
    self.attrIdx["seeds"]        = 5
    self.attrIdx["rateUp"]       = 6
    self.attrIdx["rateDown"]     = 7
    self.attrIdx["amountUp"]     = 8
    self.attrIdx["amountDown"]   = 9
    self.attrIdx["copies"]       = 10
    self.attrIdx["hash"]         = 11
    self.attrIdx["visibility"]   = 12
    self.liststore = gtk.ListStore(*typeList)
    COLUMN_NAMES = ["Name", "Progress", "Time Left", "Peers", "Seeds", "Down Rate", "Up Rate", "Down Amt", "Up Amt", "Copies"]
    
    modelfilter, treeview = GTKUtils.make_listview(self.liststore, COLUMN_NAMES)
    GTKUtils.make_text_cell(treeview.columns[0], 0)
    GTKUtils.make_progress_cell(treeview.columns[1], 1, 2)
    for i in range (2, len(COLUMN_NAMES)):
      GTKUtils.make_text_cell(treeview.columns[i], i+1)
    
    #make treeview searchable
    treeview.set_search_column(0)
    #attach the filtermodel and treeview
    treeview.set_model(gtk.TreeModelSort(modelfilter))
    treeview.connect("cursor-changed", self.row_change_cb)
    treeview.connect("button-press-event", self.button_press_cb)
    treeview.connect("button-press-event", self.button_press_cb)
#    treeview.set_size_request(-1, 30)
    treeview.get_selection().set_mode(gtk.SELECTION_MULTIPLE)
    
    self.treeview, self.modelfilter = treeview, modelfilter
    self.modelfilter.set_visible_func(self.visible_cb)
    
    topBox = gtk.VBox()
    topBox.pack_start(self.buttonRow, False, False, 0)
    scrolledTorrentsBox = GTKUtils.make_scroll_box(treeview, hPolicy=gtk.POLICY_AUTOMATIC, vPolicy=gtk.POLICY_AUTOMATIC)
    scrolledTorrentsBoxAlign = gtk.Alignment(0, 0, 1, 1) 
    scrolledTorrentsBoxAlign.set_padding(0, maggicPadding, maggicPadding, maggicPadding)
    scrolledTorrentsBoxAlign.add(scrolledTorrentsBox)

    topBox.pack_start(scrolledTorrentsBoxAlign, True, True, 0)
    
    self.priorityBox = gtk.HBox()
    self.priorityBox.pack_start(gtk.Label("Select a torrent to set the priority for its files."), True, True, 0)
    self.priorityBox.set_border_width(0)
    
    self.peerBox = gtk.HBox()
    self.peerBox.pack_start(gtk.Label("Select a torrent to see your peers in the swarm."), True, True, 0)
    
    self.bwGraph = BWGraph.BWGraph(self.app, root=self)
    self.bwGraph.container.set_size_request(-1, 150)

    self.notebook = ClosableTabNotebook.ClosableTabNotebook()
    self.notebook.set_show_border(True)
    self.notebook.set_border_width(0)
    self.bwGraph.label = gtk.Label("BitTorrent Traffic")
    self.priorityBox.label = gtk.Label("Priorities")
    self.priorityBox.container = self.priorityBox
    self.peerBox.label = gtk.Label("Peers")
    self.peerBox.container = self.peerBox
    self.notebook.show_display(self.bwGraph)
    self.notebook.show_display(self.priorityBox)
    self.notebook.show_display(self.peerBox)
    self.notebook.show_display(self.bwGraph)
    
    alignBottom = gtk.Alignment(0, 0, 1, 1)
    alignBottom.set_padding(0, maggicPadding + 3, maggicPadding + 2, maggicPadding + 2)
    alignBottom.add(self.notebook)
    
    vBoxBottom = gtk.VBox()
    vBoxBottom.pack_start(alignBottom, True, True, 0)
    vBoxBottom.pack_end(self.statusRow, False, False, 0)
    
    vpane = gtk.VPaned()
    
    self.menuBar = BitTorrentMenuBar(self.controller, self)    
    
    frame = gtk.Frame()
    frame.set_shadow_type(gtk.SHADOW_OUT)
    frame.add(topBox)
    
    alignTop = gtk.Alignment(1, 1, 1, 1)
    alignTop.set_padding(10, 0, maggicPadding + 3, maggicPadding + 3)
    alignTop.add(frame)
    
    topContainer = gtk.VBox()
    topContainer.pack_start(self.menuBar.create_menus(), False, False, 0)
    topContainer.pack_start(alignTop, True, True, 0)
    
    vpane.pack1(topContainer, resize=True, shrink=False)
    vpane.pack2(vBoxBottom, resize=False, shrink=False)
    
    self.label = gtk.Label("")
    self.label.set_markup("<span size='x-large' weight='bold'>Bit Twister</span>")
    self.container = vpane
    vpane.set_position(400)
    self.add(self.container)
    self.container.show_all()
Exemplo n.º 24
0
  def create(self):
    #Stores references to the program rows
    self.rows = {}
    self.selectedApp = None
    
    ClientUtil.add_updater(self)
    
    #create a liststore with one string column to use as the model
                #COLUMNS:
                #0:  Program name
    typeList = [gobject.TYPE_STRING,
                #1:  Number of hops
                gobject.TYPE_INT,
                #2:  Download Rate
                gobject.TYPE_STRING,
                #3:  Upload Rate
                gobject.TYPE_STRING,
                #4:  Coins spent
                gobject.TYPE_INT
                ]
    self.attrIdx = {}
    self.attrIdx["name"]         = 0
    self.attrIdx["numHops"]      = 1
    self.attrIdx["rateDown"]     = 2
    self.attrIdx["rateUp"]       = 3
    self.attrIdx["numCredits"]     = 4
    self.liststore = gtk.ListStore(*typeList)
    COLUMN_NAMES = ['Name','Anonymity Level', "Down Rate", "Up Rate", "Credits Used"]
    viewName = "Anonymous Programs"

    modelfilter, treeview = GTKUtils.make_listview(self.liststore, COLUMN_NAMES)
    for i in range (0, len(COLUMN_NAMES)):
      GTKUtils.make_text_cell(treeview.columns[i], i)
    
    #make treeview searchable
    treeview.set_search_column(0)
    #attach the filtermodel and treeview
    treeview.set_model(gtk.TreeModelSort(modelfilter))
#    treeview.connect("row-activated", self.row_activate_cb)
    treeview.connect("cursor-changed", self.row_change_cb)
    treeview.connect("button-press-event", self.button_press_cb)
    treeview.set_size_request(-1, 80)
    treeview.get_selection().set_mode(gtk.SELECTION_SINGLE)
      
    def make_button(text, cb, picFile):
      return GTKUtils.make_image_button(text, cb, picFile)
    
    bottomRow = gtk.HBox()
    self.removeButton = make_button('Stop', self.stop_cb, ClientUtil.get_image_file("stop.png"))
    bottomRow.pack_start(self.removeButton, False, False, 1)
    self.anonEntry = SettingsDisplay.make_entry("anonymity level", 1)
    self.anonEntry.connect_user_changed(self.toggle_anon_cb)
    bottomRow.pack_end(self.anonEntry.get_gtk_element(), False, False, 5)
    label = gtk.Label("")
    label.set_markup('<span size="large" weight="bold">Number of Hops: </span>')
    bottomRow.pack_end(label, False, False, 5)
    
    self.treeview, self.modelfilter = treeview, modelfilter
#    self.modelfilter.set_visible_func(self.visible_cb)

    self.bankDisplay = BankDisplay.BankDisplay()
    self.circuitList = CircuitList.CircuitList()
    self.console = Console.Console(Tor.get())

    self.bwGraph = BWGraph.BWGraph(BWHistory.localBandwidth, root=self)
    self.bwGraph.container.set_size_request(-1, 200)
    self.bwGraphLabel = gtk.Label("All Traffic")
    
    self.notebook = ClosableTabNotebook.ClosableTabNotebook()
    self.notebook.show_display(self.bwGraph)
    
    notebookAlign = gtk.Alignment(0, 0, 1, 1)
    notebookAlign.set_padding(5, 5, 0, 5)
    notebookAlign.add(self.notebook)
    
    self.topBox = gtk.VBox()
    self.topBox.pack_start(GTKUtils.make_scroll_box(treeview, hPolicy=gtk.POLICY_AUTOMATIC, vPolicy=gtk.POLICY_AUTOMATIC), True, True, 10)
    self.topBox.pack_start(bottomRow, False, True, 10)
    
    alignBottom = gtk.Alignment(1, 1, 1, 1)
    alignBottom.set_padding(10, 3, 1, 1)
    alignBottom.add(notebookAlign)
    vpane = gtk.VPaned()
     
    frame = gtk.Frame()
    frame.set_shadow_type(gtk.SHADOW_OUT)
    frame.add(self.topBox)
    
    alignTop = gtk.Alignment(1, 1, 1, 1)
    alignTop.set_padding(10, 10, 7, 7)
    alignTop.add(frame)
    
    topContainer = gtk.VBox()
    topContainer.pack_start(alignTop, True, True, 0)
    
    vpane.pack1(topContainer, resize=True, shrink=False)
    vpane.pack2(alignBottom, resize=True, shrink=False)
    vpane.set_position(400)
    
    self.label = gtk.Label("")
    self.label.set_markup("<span size='x-large' weight='bold'>Applications</span>")
    self.container = vpane
    
    self.catch_event("settings_changed")
    
    self.menuBar = SocksServerMenuBar(self.root, self)
    
    vbox = gtk.VBox() 
    vbox.pack_start(self.menuBar.create_menus(), False, False, 0)
    vbox.pack_start(self.container, True, True, 0)
    self.add(vbox)
    vbox.show_all()
Exemplo n.º 25
0
                    if os.path.exists(Globals.UPDATE_FILE_NAME):
                        shutil.move(Globals.UPDATE_FILE_NAME,
                                    Globals.UPDATE_FILE_NAME + ".prev")
                    break
                except Exception, error:
                    time.sleep(0.5)
                    if time.time() > startTime + 5.0:
                        log_ex(
                            error,
                            "Failed to remove update .exe from the previous update"
                        )
                        ignoreUpdater = True
                        #ok, lets try making a file, just so I can see why this is failing for people:
                        if issubclass(type(error), WindowsError):
                            try:
                                testFile = open(
                                    Globals.UPDATE_FILE_NAME + ".test", "wb")
                                testFile.write("hello?")
                                testFile.close()
                            except Exception, error:
                                log_ex(error, "And we could NOT write a file")
                            else:
                                log_msg(
                                    "But we successfully wrote to a file (%s)  Weird."
                                    % (Globals.UPDATE_FILE_NAME + ".test"))
                        break
    #apply any pending updates and quit:
    if ProgramState.INSTALLED and not ignoreUpdater and Files.file_exists(
            Globals.UPDATE_FILE_NAME):
        ClientUtil.apply_update()
Exemplo n.º 26
0
  def __init__(self):
    bbApp = BitBlinder.get()
    self.bbApp = bbApp
    self.torApp = bbApp.torApp
    self.catch_event("tor_ready")
    self.catch_event("tor_done")
    self.catch_event("new_relay")
    ClientUtil.add_updater(self)
    #create the view and store for all the data columns:
    #TODO:  make display text prettier (transition to MB as appropriate, etc)
    self.mdl = gtk.TreeStore( gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, int, str, str, "gboolean" )
    modelfilter = self.mdl.filter_new()
    self.visColumn = 10
    modelfilter.set_visible_column(self.visColumn)
    self.view = gtk.TreeView( modelfilter )
    self.columnLabels = ["ID", "Status", "Path", "BW (down)", "Reason", "Age", "Total (Down)"]

    #add each of the columns
    for i in range(0,len(self.columnLabels)):
      name = self.columnLabels[i]
      colId = i
      #make column
      column = gtk.TreeViewColumn(name)
      #basic string renderer for the data in the column
      column.cell = gtk.CellRendererText()
      #add the renderer to the column...  idk if you can add more than one
      column.pack_start(column.cell, True)
      #add the column to the treeview
      self.view.append_column(column)
      ##TODO:  this gave an exception last time for some reason
      ##this acts as a macro to set a bunch of properties that make this column sortable
      #column.set_sort_column_id(colId)
      #tell the column where to get it's string data, and the data for colors
      column.set_attributes(column.cell, text=colId, background=len(self.columnLabels)+1, foreground=len(self.columnLabels)+2)
      #set properties to make the column interact intuitively.
      column.set_properties(reorderable=True, expand=True, clickable=True, resizable=True)
      
    hbox = gtk.HBox()
    self.showCircuits = False
    self.showStreams = False
    button = gtk.CheckButton("Show closed Streams:")
    button.connect("toggled", self.toggle_cb, "streams")
    hbox.pack_start(button)
    button = gtk.CheckButton("Show closed Circuits:")
    button.connect("toggled", self.toggle_cb, "circuits")
    hbox.pack_start(button)
      
    self.vbox = gtk.VBox()
    #make scrollwindow because the circuit list gets really long
    self.scrolled_window = gtk.ScrolledWindow()
    self.scrolled_window.set_border_width(10)
    self.scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
    #self.scrolled_window.set_size_request(500, 500)
    self.scrolled_window.add_with_viewport(self.view)
    self.scrolled_window.show()
    self.comboRow = gtk.HButtonBox()
    self.buttonRow = gtk.HButtonBox()
#    self.testRow = gtk.HBox()
    self.vbox.pack_start(hbox, False)
    self.vbox.pack_start(self.scrolled_window)
    self.vbox.pack_start(self.comboRow, False)
    self.vbox.pack_start(self.buttonRow, False)
#    self.vbox.pack_start(self.testRow, False)
    
    self.testStreams = []
    self.objects = set()
    
    self.routerCombos = []
    for i in range(0,3):
      combo = gtk.combo_box_new_text() 
      self.routerCombos.append(combo)
      combo.set_size_request(100, -1)
      self.comboRow.pack_start(combo)
      
    self.countryCombo = gtk.combo_box_new_text()
    self.countryCombo.append_text("")
    self.countryCombo.set_size_request(150, -1)
    self.comboRow.pack_start(self.countryCombo)
    self.countryCombo.connect("changed", self.country_changed_cb)
      
    b = gtk.Button("Launch Circuit")
    self.buttonRow.pack_start(b)
    b.connect('clicked', self.launch_circuit)
    
    b = gtk.Button("Download")
    self.buttonRow.pack_start(b)
    b.connect('clicked', self.launch_test_download)
    
    b = gtk.Button("Upload")
    self.buttonRow.pack_start(b)
    b.connect('clicked', self.launch_test_upload)
    
    b = gtk.Button("PAR Test")
    self.buttonRow.pack_start(b)
    b.connect('clicked', self.launch_par_test)
    
    b = gtk.Button("DHT")
    self.buttonRow.pack_start(b)
    b.connect('clicked', self.dht_cb)
    
    b = gtk.Button("Inspect")
    self.buttonRow.pack_start(b)
    b.connect('clicked', self.inspect_cb)
    
    b = gtk.Button("Kill Selected")
    self.buttonRow.pack_start(b)
    b.connect('clicked', self.kill_selected)
    
    self.vbox.show()
    self.comboRow.show()
    self.buttonRow.show()
    
    #these are used by GTK Controller to easily add the component to the main window
    self.label = gtk.Label("Circuit List")
    self.container = self.vbox
Exemplo n.º 27
0
  def __init__(self, app, torrentHash, data):
    self.app = app
    ClientUtil.add_updater(self)
    self.torrentHash = torrentHash
    self.torrentData = data
    self.download = None
    #a mapping from peer id to row
    self.peerRows = {}
    self.attrIdx = {}
    
    self.COLUMNS = [ ("ip",           "IP",        "string"),
                     ("upRate",       "uRate",     "rate"),
                     ("downRate",     "dRate",     "rate"),
                     ("upTotal",      "uTotal",    "amount"),
                     ("downTotal",    "dTotal",    "amount"),
                     ("upChoked",     "uChoked",   "string"),
                     ("downChoked",   "dChoked",   "string"),
                     ("snub",         "Snub",      "string"),
                     ("upInterest",   "uInterest", "string"),
                     ("downInterest", "dInterest", "string"),
                     ("speed",        "Speed",     "rate"),
                     ("requests",     "Requests",  "string"),
                     ("circ",         "Circ",      "string"),
                     ("amountDone",   "Done",      "percent"),
                     ("client",       "Client",    "string"),
                     ("id",           "ID",        "string")]
    COLUMN_NAMES = [columnTuple[1] for columnTuple in self.COLUMNS]
    TYPE_LIST = []
    for columnTuple in self.COLUMNS:
      columnType = columnTuple[2]
      if columnType in ("string"):
        TYPE_LIST.append(gobject.TYPE_STRING)
      elif columnType == "amount":
        TYPE_LIST.append(gobject.TYPE_INT)
      elif columnType in ("rate", "percent"):
        TYPE_LIST.append(gobject.TYPE_FLOAT)
      else:
        raise Exception("Bad type for column:  %s" % (columnType))

    self.liststore = gtk.ListStore(*TYPE_LIST)
    modelfilter, treeview = GTKUtils.make_listview(self.liststore, COLUMN_NAMES)
    for i in range(0, len(self.COLUMNS)):
      attrName = self.COLUMNS[i][0]
      attrType = self.COLUMNS[i][2]
      self.attrIdx[attrName] = i
      if attrType == "string":
        GTKUtils.make_text_cell(treeview.columns[i], i, makeSortable=True)
      else:
        cellFunc = getattr(self, "_cell_data_" + attrType)
        self._make_number_cell(treeview.columns[i], i, cellFunc)
        
    #make treeview searchable
    treeview.set_search_column(0)
    #attach the filtermodel and treeview
    self.model = gtk.TreeModelSort(modelfilter)
    treeview.set_model(self.model)
    treeview.get_selection().set_mode(gtk.SELECTION_MULTIPLE)
    self.modelfilter, self.treeview = modelfilter, treeview
    scrolled_window = GTKUtils.make_scroll_box(self.treeview, hPolicy=gtk.POLICY_AUTOMATIC, vPolicy=gtk.POLICY_AUTOMATIC)
    scrolled_window.set_size_request(-1, 200)
    self.container = scrolled_window
Exemplo n.º 28
0
def start():
  """Start listening for connections from other instances of BitBlinder"""
  ClientUtil.check_port(Globals.NOMNET_STARTUP_PORT, _on_startup_port_ready)
Exemplo n.º 29
0
    def __init__(self, controller):
        GeneratorMixin.GeneratorMixin.__init__(self)
        ListenerMixin.ListenerMixin.__init__(self)

        self.controller = controller
        self.torApp = Tor.get()

        self._add_events("show_settings", "toggle_server", "show_setup", "done")
        ClientUtil.add_updater(self)

        self.bwGraph = BWGraph.BWGraph(BWHistory.remoteBandwidth, root=controller.serverWindow)
        self.bwGraph.container.set_size_request(400, 200)
        self.bwGraph.label = gtk.Label("Relay Traffic")
        self.statusRows = []

        self.statistics = {}
        self.torStatus = None
        self.rows = []
        iconSize = 24
        tooltips = gtk.Tooltips()

        def make_row_box(name, labelText, childWidget):
            """packs a gui row with a label, childWidget, and an image.
      it then adds the row and a separator to a vbox which it returns 
      as well as the label it created as for use in homogenizing all the label widths"""

            image = gtk.Image()
            image.set_from_pixbuf(Images.GREY_CIRCLE)
            imageAlign = gtk.Alignment(0, 0, 0, 0)
            # push the widget over
            imageAlign.set_padding(0, 0, 0, 10)
            imageAlign.add(image)

            textLabel = gtk.Label()
            textLabel.set_markup("<span size='large' weight='bold'>%s</span>" % (labelText))
            # stick the align on the left
            textLabel.set_alignment(0, 0.5)

            row = StatusHBox(name, textLabel, childWidget, image)
            self.statusRows.append(row)

            row.pack_start(imageAlign, False, False, 0)
            row.pack_start(textLabel, False, False, 0)
            row.pack_start(childWidget, False, False, 0)

            # pad the whole row
            rowAlign = gtk.Alignment(0, 0, 1, 1)
            rowAlign.set_padding(0, 0, 5, 5)
            rowAlign.add(row)

            sep = gtk.HSeparator()
            vBox = gtk.VBox()
            vBox.pack_start(rowAlign, False, False, 10)
            vBox.pack_start(sep, False, False, 0)

            return (vBox, row)

        creditsValueLabel = gtk.Label("0")
        creditsBox, self.creditsRow = make_row_box("credits", "Credits: ", creditsValueLabel)

        statusValueLabel = gtk.Label("Unknown")
        statusBox, self.statusRow = make_row_box("status", "Status: ", statusValueLabel)

        def on_toggle(widget):
            self._trigger_event("toggle_server")

        self.relayToggleButton = GTKUtils.make_image_button(_("Start"), on_toggle, "exit.png")
        self.relayToggleButton.set_size_request(75, -1)
        relayBox, self.relayRow = make_row_box("relay", "Relay:", self.relayToggleButton)

        textLabel = gtk.Label("Unknown")
        relayPortBox, self.tcpRelayPortRow = make_row_box("orPort", "TCP Relay Port:", textLabel)

        textLabel = gtk.Label("Unknown")
        udpRelayPortBox, self.udpRelayPortRow = make_row_box("dhtPort", "UDP Relay Port:", textLabel)

        textLabel = gtk.Label()
        textLabel.set_markup('<span size="large">     55555 is unreachable        </span>')
        dirPortBox, self.dirPortRow = make_row_box("dirPort", "Directory Port:", textLabel)

        labels = [
            box.rowLabel
            for box in self.creditsRow,
            self.statusRow,
            self.relayRow,
            self.tcpRelayPortRow,
            self.udpRelayPortRow,
            self.dirPortRow,
        ]
        maxLabelWidth = 5 + max([label.size_request()[0] for label in labels])
        for label in labels:
            label.set_size_request(maxLabelWidth, -1)

        hideButton = gtk.Button("Hide")
        hideButton.connect("clicked", self._hide_cb)
        settingsButton = gtk.Button("Settings")

        def on_settings(widget):
            self._trigger_event("show_settings")

        settingsButton.connect("clicked", on_settings)
        buttonBox = gtk.HBox()
        buttonBox.pack_start(hideButton, False, False, 0)
        buttonBox.pack_end(settingsButton, False, False, 0)

        self.serverBox = gtk.VBox()
        for box in [relayBox, statusBox, relayPortBox, udpRelayPortBox, dirPortBox, creditsBox]:
            self.serverBox.pack_start(box, True, False, 0)
        self.serverBox.pack_start(buttonBox, True, False, 0)
        align = gtk.Alignment(0, 0, 0, 0)
        align.set_padding(0, 0, 5, 5)
        align.add(self.serverBox)

        serverFrame = GTKUtils.add_frame(align)
        makeAuroraFramesRounded = gtk.HBox()
        makeAuroraFramesRounded.set_size_request(0, 0)
        serverFrame.set_label_widget(makeAuroraFramesRounded)

        self.notebook = ClosableTabNotebook.ClosableTabNotebook()
        self.notebook.show_display(self.bwGraph)

        notebookAlign = gtk.Alignment(0, 0, 1, 1)
        notebookAlign.set_padding(5, 5, 0, 5)
        notebookAlign.add(self.notebook)

        hbox = gtk.HBox()
        hbox.pack_start(serverFrame, False, False, 0)
        hbox.pack_start(notebookAlign, True, True, 0)
        hbox.show_all()

        self.catch_event("settings_changed")

        #    self.container = hbox
        self.label = gtk.Label("Server Status %s" % (Globals.VERSION))

        vbox = gtk.VBox()
        self.menuBar = BaseMenuBar.BaseMenuBar(self.controller)
        vbox.pack_start(self.menuBar.create_menus(), False, False, 0)
        vbox.pack_start(hbox, True, True, 0)
        vbox.show_all()
        self.container = vbox
Exemplo n.º 30
0
    def __init__(self):
        ClientUtil.add_updater(self)
        #Statistics
        stat_vbox = gtk.VBox()
        self.statistics = {}
        for stat in ("Local Balance", "Bank Balance", "Credits Earned"):
            gtkObj = gtk.Label(stat + ": ")
            gtkObj.stat_value = ""
            align = gtk.Alignment(xalign=0.0,
                                  yalign=0.5,
                                  xscale=0.0,
                                  yscale=0.0)
            align.add(gtkObj)
            align.set_padding(0, 0, 5, 0)
            stat_vbox.pack_end(align, False, False, 5)
            align.show()
            gtkObj.show()
            self.statistics[stat] = gtkObj
        stat_align = gtk.Alignment(xalign=0.0,
                                   yalign=0.5,
                                   xscale=0.0,
                                   yscale=0.0)
        stat_align.add(stat_vbox)
        stat_vbox.show()
        stat_align.show()

        self.payments = 0
        self.failures = 0
        self.withdrawals = 0
        self.deposits = 0
        self.TEST_DONE = True

        self.buttonRow = gtk.HBox()

        b = gtk.Button("Request ACoins")
        self.buttonRow.pack_start(b)
        b.connect('clicked', self.request_cb)

        b = gtk.Button("Deposit ACoins")
        self.buttonRow.pack_start(b)
        b.connect('clicked', self.deposit_cb)

        b = gtk.Button("ACoin Payment")
        self.buttonRow.pack_start(b)
        b.connect('clicked', self.payment_cb)

        self.buttonRow.show_all()

        self.entry = gtk.Entry(0)
        self.entry.connect('activate', self.entry_cb)
        balanceEntryBox = gtk.HBox()
        balanceEntryBox.pack_start(gtk.Label("Pretend bank balance is:  "),
                                   False, False, 0)
        balanceEntryBox.pack_start(self.entry, True, True, 0)

        #Glue:
        self.vbox = gtk.VBox()
        self.vbox.pack_start(stat_align, False, False, 10)
        self.vbox.pack_end(self.buttonRow, False, False, 10)
        self.vbox.pack_end(balanceEntryBox, False, False, 10)
        self.vbox.show()

        self.container = self.vbox
        self.label = gtk.Label("Bank")
        return
Exemplo n.º 31
0
def make_icon(fileName, iconSize=24):
  return gtk.gdk.pixbuf_new_from_file_at_size(ClientUtil.get_image_file(fileName), iconSize, iconSize)
Exemplo n.º 32
0
  def __init__(self, controller):
    GeneratorMixin.GeneratorMixin.__init__(self)
    ListenerMixin.ListenerMixin.__init__(self)
    
    self.controller = controller
    self.torApp = Tor.get()
    
    self._add_events("show_settings", "toggle_server", "show_setup", "done")
    ClientUtil.add_updater(self)

    self.bwGraph = BWGraph.BWGraph(BWHistory.remoteBandwidth, root=controller.serverWindow)
    self.bwGraph.container.set_size_request(400, 200)
    self.bwGraph.label = gtk.Label("Relay Traffic")
    self.statusRows = []
    
    self.statistics = {}
    self.torStatus = None
    self.rows = []  
    iconSize = 24
    tooltips = gtk.Tooltips()
    
    def make_row_box(name, labelText, childWidget):
      """packs a gui row with a label, childWidget, and an image.
      it then adds the row and a separator to a vbox which it returns 
      as well as the label it created as for use in homogenizing all the label widths"""
      
      image = gtk.Image()
      image.set_from_pixbuf(Images.GREY_CIRCLE)
      imageAlign = gtk.Alignment(0, 0, 0, 0)
      #push the widget over 
      imageAlign.set_padding(0, 0, 0, 10)
      imageAlign.add(image)
     
      textLabel = gtk.Label()
      textLabel.set_markup("<span size='large' weight='bold'>%s</span>" % (labelText))
      #stick the align on the left
      textLabel.set_alignment(0, 0.5)
      
      row = StatusHBox(name, textLabel, childWidget, image)
      self.statusRows.append(row)
      
      row.pack_start(imageAlign, False, False, 0)
      row.pack_start(textLabel, False, False, 0)
      row.pack_start(childWidget, False, False, 0)
      
      #pad the whole row
      rowAlign = gtk.Alignment(0, 0, 1, 1)
      rowAlign.set_padding(0, 0, 5, 5)
      rowAlign.add(row)
      
      sep = gtk.HSeparator()
      vBox = gtk.VBox()
      vBox.pack_start(rowAlign, False, False, 10)
      vBox.pack_start(sep, False, False, 0)
      
      return (vBox, row)
    
    creditsValueLabel = gtk.Label("0")
    creditsBox, self.creditsRow = make_row_box('credits', 'Credits: ', creditsValueLabel)
    
    statusValueLabel = gtk.Label("Unknown")
    statusBox, self.statusRow = make_row_box('status', 'Status: ', statusValueLabel)
    
    def on_toggle(widget):
      self._trigger_event("toggle_server")
    self.relayToggleButton = GTKUtils.make_image_button(_("Start"), on_toggle, "exit.png")
    self.relayToggleButton.set_size_request(75, -1)
    relayBox, self.relayRow = make_row_box('relay', "Relay:", self.relayToggleButton)
    
    textLabel = gtk.Label("Unknown")
    relayPortBox, self.tcpRelayPortRow = make_row_box('orPort', "TCP Relay Port:", textLabel)
    
    textLabel = gtk.Label("Unknown")
    udpRelayPortBox, self.udpRelayPortRow = make_row_box('dhtPort', "UDP Relay Port:", textLabel)
    
    textLabel = gtk.Label()
    textLabel.set_markup('<span size="large">     55555 is unreachable        </span>')
    dirPortBox, self.dirPortRow = make_row_box('dirPort', "Directory Port:", textLabel)
    
    labels = [box.rowLabel for box in \
              self.creditsRow, self.statusRow, self.relayRow, self.tcpRelayPortRow, self.udpRelayPortRow, self.dirPortRow]
    maxLabelWidth = 5 + max([label.size_request()[0] for label in labels])
    for label in labels:
      label.set_size_request(maxLabelWidth, -1)
      
    hideButton = gtk.Button("Hide")
    hideButton.connect("clicked", self._hide_cb)
    settingsButton = gtk.Button("Settings")
    def on_settings(widget):
      self._trigger_event("show_settings")
    settingsButton.connect("clicked", on_settings)
    buttonBox = gtk.HBox()
    buttonBox.pack_start(hideButton, False, False, 0)
    buttonBox.pack_end(settingsButton, False, False, 0)
    
    self.serverBox = gtk.VBox()
    for box in [relayBox, statusBox, relayPortBox, udpRelayPortBox, dirPortBox, creditsBox]:
      self.serverBox.pack_start(box, True, False, 0)
    self.serverBox.pack_start(buttonBox, True, False, 0)
    align = gtk.Alignment(0, 0, 0, 0)
    align.set_padding(0, 0, 5, 5)
    align.add(self.serverBox)
    
    serverFrame = GTKUtils.add_frame(align)
    makeAuroraFramesRounded = gtk.HBox()
    makeAuroraFramesRounded.set_size_request(0,0)
    serverFrame.set_label_widget(makeAuroraFramesRounded)
    
    self.notebook = ClosableTabNotebook.ClosableTabNotebook()
    self.notebook.show_display(self.bwGraph)
    
    notebookAlign = gtk.Alignment(0, 0, 1, 1)
    notebookAlign.set_padding(5, 5, 0, 5)
    notebookAlign.add(self.notebook)

    hbox = gtk.HBox()
    hbox.pack_start(serverFrame, False, False, 0)
    hbox.pack_start(notebookAlign, True, True, 0)
    hbox.show_all()
    
    self.catch_event("settings_changed")
    
#    self.container = hbox
    self.label = gtk.Label("Server Status %s" % (Globals.VERSION))
    
    vbox = gtk.VBox() 
    self.menuBar = BaseMenuBar.BaseMenuBar(self.controller)    
    vbox.pack_start(self.menuBar.create_menus(), False, False, 0)
    vbox.pack_start(hbox, True, True, 0)
    vbox.show_all()
    self.container = vbox
Exemplo n.º 33
0
    def __init__(self):
        bbApp = BitBlinder.get()
        self.bbApp = bbApp
        self.torApp = bbApp.torApp
        self.catch_event("tor_ready")
        self.catch_event("tor_done")
        self.catch_event("new_relay")
        ClientUtil.add_updater(self)
        #create the view and store for all the data columns:
        #TODO:  make display text prettier (transition to MB as appropriate, etc)
        self.mdl = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_STRING,
                                 gobject.TYPE_STRING, gobject.TYPE_STRING,
                                 gobject.TYPE_STRING, gobject.TYPE_STRING,
                                 gobject.TYPE_STRING, int, str, str,
                                 "gboolean")
        modelfilter = self.mdl.filter_new()
        self.visColumn = 10
        modelfilter.set_visible_column(self.visColumn)
        self.view = gtk.TreeView(modelfilter)
        self.columnLabels = [
            "ID", "Status", "Path", "BW (down)", "Reason", "Age",
            "Total (Down)"
        ]

        #add each of the columns
        for i in range(0, len(self.columnLabels)):
            name = self.columnLabels[i]
            colId = i
            #make column
            column = gtk.TreeViewColumn(name)
            #basic string renderer for the data in the column
            column.cell = gtk.CellRendererText()
            #add the renderer to the column...  idk if you can add more than one
            column.pack_start(column.cell, True)
            #add the column to the treeview
            self.view.append_column(column)
            ##TODO:  this gave an exception last time for some reason
            ##this acts as a macro to set a bunch of properties that make this column sortable
            #column.set_sort_column_id(colId)
            #tell the column where to get it's string data, and the data for colors
            column.set_attributes(column.cell,
                                  text=colId,
                                  background=len(self.columnLabels) + 1,
                                  foreground=len(self.columnLabels) + 2)
            #set properties to make the column interact intuitively.
            column.set_properties(reorderable=True,
                                  expand=True,
                                  clickable=True,
                                  resizable=True)

        hbox = gtk.HBox()
        self.showCircuits = False
        self.showStreams = False
        button = gtk.CheckButton("Show closed Streams:")
        button.connect("toggled", self.toggle_cb, "streams")
        hbox.pack_start(button)
        button = gtk.CheckButton("Show closed Circuits:")
        button.connect("toggled", self.toggle_cb, "circuits")
        hbox.pack_start(button)

        self.vbox = gtk.VBox()
        #make scrollwindow because the circuit list gets really long
        self.scrolled_window = gtk.ScrolledWindow()
        self.scrolled_window.set_border_width(10)
        self.scrolled_window.set_policy(gtk.POLICY_AUTOMATIC,
                                        gtk.POLICY_AUTOMATIC)
        #self.scrolled_window.set_size_request(500, 500)
        self.scrolled_window.add_with_viewport(self.view)
        self.scrolled_window.show()
        self.comboRow = gtk.HButtonBox()
        self.buttonRow = gtk.HButtonBox()
        #    self.testRow = gtk.HBox()
        self.vbox.pack_start(hbox, False)
        self.vbox.pack_start(self.scrolled_window)
        self.vbox.pack_start(self.comboRow, False)
        self.vbox.pack_start(self.buttonRow, False)
        #    self.vbox.pack_start(self.testRow, False)

        self.testStreams = []
        self.objects = set()

        self.routerCombos = []
        for i in range(0, 3):
            combo = gtk.combo_box_new_text()
            self.routerCombos.append(combo)
            combo.set_size_request(100, -1)
            self.comboRow.pack_start(combo)

        self.countryCombo = gtk.combo_box_new_text()
        self.countryCombo.append_text("")
        self.countryCombo.set_size_request(150, -1)
        self.comboRow.pack_start(self.countryCombo)
        self.countryCombo.connect("changed", self.country_changed_cb)

        b = gtk.Button("Launch Circuit")
        self.buttonRow.pack_start(b)
        b.connect('clicked', self.launch_circuit)

        b = gtk.Button("Download")
        self.buttonRow.pack_start(b)
        b.connect('clicked', self.launch_test_download)

        b = gtk.Button("Upload")
        self.buttonRow.pack_start(b)
        b.connect('clicked', self.launch_test_upload)

        b = gtk.Button("PAR Test")
        self.buttonRow.pack_start(b)
        b.connect('clicked', self.launch_par_test)

        b = gtk.Button("DHT")
        self.buttonRow.pack_start(b)
        b.connect('clicked', self.dht_cb)

        b = gtk.Button("Inspect")
        self.buttonRow.pack_start(b)
        b.connect('clicked', self.inspect_cb)

        b = gtk.Button("Kill Selected")
        self.buttonRow.pack_start(b)
        b.connect('clicked', self.kill_selected)

        self.vbox.show()
        self.comboRow.show()
        self.buttonRow.show()

        #these are used by GTK Controller to easily add the component to the main window
        self.label = gtk.Label("Circuit List")
        self.container = self.vbox
Exemplo n.º 34
0
def start():
    """Start listening for connections from other instances of BitBlinder"""
    ClientUtil.check_port(Globals.NOMNET_STARTUP_PORT, _on_startup_port_ready)