def _make_slider_box(self, startingValue): if self.allowNonanonymousMode: lowestLimit = 0 else: lowestLimit = 1 adjustment = gtk.Adjustment(value=startingValue, lower=lowestLimit, upper=3, step_incr=1, page_incr=0, page_size=0) anonymityScale = gtk.HScale(adjustment) anonymityScale.set_digits(0) anonymityScale.set_draw_value(True) anonymityScale.set_value_pos(gtk.POS_BOTTOM) anonymityScale.connect("value_changed", self._on_anonymity_slider_changed) self.anonymityScale = anonymityScale anonLabel = gtk.Label() anonLabel.set_markup( '<span weight="bold" size="large">Anonymity</span>') anonLabel.set_alignment(0, 0) anonLabel = GTKUtils.add_padding(anonLabel, 1, 0, 0, 0) speedLabel = gtk.Label() speedLabel.set_markup('<span weight="bold" size="large">Speed</span>') speedLabel.set_alignment(0, 0) speedLabel = GTKUtils.add_padding(speedLabel, 1, 0, 0, 0) sliderBox = gtk.HBox() sliderBox.pack_start(speedLabel, False, False, 0) sliderBox.pack_start(anonymityScale, True, True, 1) sliderBox.pack_start(anonLabel, False, False, 0) vbox = gtk.VBox() vbox.pack_start(sliderBox, True, True, 5) hbox = gtk.HBox() self.AnonymousPerson = gtk.Image() self.AnonymousPerson.set_from_pixbuf( get_path_length_image(startingValue)) hbox.pack_start(self.AnonymousPerson, False, False, 0) self.helperTextLabel = gtk.Label() self.helperTextLabel.set_line_wrap(True) self.helperTextLabel.set_justify(gtk.JUSTIFY_FILL) hbox.pack_start(self.helperTextLabel, True, True, 5) self._normalize_helper_label_height() vbox.pack_start(hbox, True, True, 5) self._update_helper_text(startingValue) return vbox
def __init__(self, controller): buttons = (gtk.STOCK_YES, gtk.RESPONSE_YES, gtk.STOCK_NO, gtk.RESPONSE_NO) dia = gtk.Dialog("Credits Low", None, 0, buttons) self.controller = controller vbox = gtk.VBox() title = gtk.Label() markup = "<span size='large' weight='bold'>You Are Running out of Credits</span>" title.set_markup(markup) title.set_justify(gtk.JUSTIFY_CENTER) vbox.pack_start(title, True, False, 0) #A text entry telling the user what to do: balance = Bank.get().get_expected_balance() balanceGB = Format.convert_to_gb(balance) label = gtk.Label() text = "You only have %s (%s) credits remaining. You must set up a relay to gain more credits. \ This will allow other users to send traffic via your computer.\n\nWould you like to set up a relay now?" % (balance, balanceGB) label.set_markup(text) label.set_line_wrap(True) vbox.pack_start(label, True, True, 5) #if we should always check: self.askAboutRelay = gtk.CheckButton("Always ask about help setting up relay") vbox.pack_start(self.askAboutRelay, True, True, 10) #initialize the checkbox: self.askAboutRelay.set_active(CoreSettings.get().askAboutRelay) vbox = GTKUtils.add_padding(vbox, 5) dia.vbox.pack_start(vbox, True, True, 0) dia.connect("response", self.on_response) self.dia = dia #start the dialog dia.show_all()
def show_msgbox(self, text, title="Notice", cb=None, buttons=(gtk.STOCK_OK, gtk.RESPONSE_OK), args=None, width=200, link=None, makeSafe=False, root=None): """Launches a message box and keeps the main thread going. cb will be called when the messagebox is finished.""" if not args: args = [] log_msg(text, 3) dia = gtk.Dialog(title, root, 0, buttons) #ensure that the dialog is modal if the parent window is, otherwise it's not selectable! if root and root.get_modal(): dia.set_modal(True) label = gtk.Label("") if makeSafe: label.set_text(text) else: label.set_markup(text) label.set_selectable(True) label.set_size_request(width, -1) label.set_line_wrap(True) paddedLabel = GTKUtils.add_padding(label, 5) dia.vbox.pack_start(paddedLabel, True, True, 10) if link: dia.vbox.pack_start(link, True, True, 10) dia.show_all() #have to do a callback if you want to see the result of the dialog: def on_response(dialog, response_id, cb): if cb: cb(dialog, response_id, *args) dialog.destroy() #connect the handler: dia.connect("response", on_response, cb) return dia
def __init__(self): GeneratorMixin.GeneratorMixin.__init__(self) self.torApp = Tor.get() self._add_events("done") #make the components for this GUI headerBox = self._make_header_box() exitTrafficBox = self._make_exit_traffic_box() buttonBox = self._make_button_box() #pack them into our window: box = gtk.VBox(spacing=PADDING) box.pack_start(headerBox, False, False, 0) box.pack_start(exitTrafficBox, False, False, 0) box.pack_start(gtk.HSeparator(), False, False, 0) box.pack_start(buttonBox, False, False, 0) box.show() paddedBox = GTKUtils.add_padding(box, PADDING) paddedBox.show() self.container = paddedBox self.label = gtk.Label("Exit Traffic Types") self.container.set_focus_child(self.doneButton)
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)
def _make_exit_traffic_box(self): def make_exit_row(labelText): #make the widgets label = gtk.Label() label.set_markup("<span size='large'>%s</span>" % (labelText)) entry = SettingsDisplay.make_entry("bool", True) #and pack them together box = gtk.HBox() box.pack_start(label, False, False, 0) box.pack_end(entry.entry, False, False, 0) return (entry, box) #make widgets exitTrafficLabel = gtk.Label() exitTrafficLabel.set_markup("<span size='large' weight='bold'>Exit Traffic Permissions:</span>") exitTrafficLabel.set_alignment(0.0, 0.5) self.webTrafficEntry, webBox = make_exit_row(" Allow Web Traffic") self.btTrafficEntry, btBox = make_exit_row(" Allow BitTorrent Traffic") self.dhtTrafficEntry, dhtBox = make_exit_row(" Allow DHT Traffic") risksLink = GTKUtils.make_html_link("What are the risks?", "") risksLink.label.set_alignment(0.0, 0.5) #pack them together: box = gtk.VBox(spacing=PADDING) box.pack_start(exitTrafficLabel, False, False, 0) box.pack_start(btBox, False, False, 0) box.pack_start(webBox, False, False, 0) box.pack_start(dhtBox, False, False, 0) box.pack_start(risksLink, False, False, 0) box = GTKUtils.add_padding(box, PADDING) frame = GTKUtils.add_frame(box, width=0) frame.show_all() return frame
def _make_slider_box(self, startingValue): if self.allowNonanonymousMode: lowestLimit = 0 else: lowestLimit = 1 adjustment = gtk.Adjustment(value=startingValue, lower=lowestLimit, upper=3, step_incr=1, page_incr=0, page_size=0) anonymityScale = gtk.HScale(adjustment) anonymityScale.set_digits(0) anonymityScale.set_draw_value(True) anonymityScale.set_value_pos(gtk.POS_BOTTOM) anonymityScale.connect("value_changed", self._on_anonymity_slider_changed) self.anonymityScale = anonymityScale anonLabel = gtk.Label() anonLabel.set_markup('<span weight="bold" size="large">Anonymity</span>') anonLabel.set_alignment(0, 0) anonLabel = GTKUtils.add_padding(anonLabel, 1, 0, 0, 0) speedLabel = gtk.Label() speedLabel.set_markup('<span weight="bold" size="large">Speed</span>') speedLabel.set_alignment(0, 0) speedLabel = GTKUtils.add_padding(speedLabel, 1, 0, 0, 0) sliderBox = gtk.HBox() sliderBox.pack_start(speedLabel, False, False, 0) sliderBox.pack_start(anonymityScale, True, True, 1) sliderBox.pack_start(anonLabel, False, False, 0) vbox = gtk.VBox() vbox.pack_start(sliderBox, True, True, 5) hbox = gtk.HBox() self.AnonymousPerson = gtk.Image() self.AnonymousPerson.set_from_pixbuf(get_path_length_image(startingValue)) hbox.pack_start(self.AnonymousPerson, False, False, 0) self.helperTextLabel = gtk.Label() self.helperTextLabel.set_line_wrap(True) self.helperTextLabel.set_justify(gtk.JUSTIFY_FILL) hbox.pack_start(self.helperTextLabel, True, True, 5) self._normalize_helper_label_height() vbox.pack_start(hbox, True, True, 5) self._update_helper_text(startingValue) return vbox
def __init__(self, app, allowNonanonymousMode=True): BaseDialog.BaseDialog.__init__(self, "%s Anonymity Selector" % (app.name), ("ok", "cancel"), None) self.app = app self.allowNonanonymousMode = allowNonanonymousMode titleLabel = gtk.Label() titleLabel.set_markup( "<span size='x-large' weight='bold'>%s Anonymity Selector</span>" % (self.app.name)) titleLabel.set_justify(gtk.JUSTIFY_CENTER) vbox = gtk.VBox() vbox.pack_start(titleLabel, False, False, 5) infoTextLabel = WrapLabel.WrapLabel(infoText) infoTextLabel.set_justify(gtk.JUSTIFY_FILL) #keep the label from having no width infoTextLabel.set_size_request(300, -1) infoAndSlider = gtk.VBox() infoAndSlider.pack_start(infoTextLabel, False, False, 0) instructionBox = self._make_instruction_box() infoAndSlider.pack_start(instructionBox, False, False, 0) #get the appropriate path length from the app if not self.allowNonanonymousMode or self.app.useTor: pathLength = self.app.settings.pathLength else: pathLength = 0 anonymityBox = self._make_slider_box(pathLength) infoAndSlider.pack_start(anonymityBox, False, False, 0) infoAndSlider = GTKUtils.add_padding(infoAndSlider, 5) infoAndSlider = GTKUtils.add_frame(infoAndSlider, name='Choose Your Anonymity Level') vbox.pack_start(infoAndSlider, False, False, 0) optionalInfos = self._make_optional_info_box() optionalInfos = GTKUtils.add_padding(optionalInfos, 0, 5, 5, 5) vbox.pack_start(optionalInfos, False, False, 0) self.dia.vbox.pack_start(vbox, False, False, 0) self.dia.vbox.show_all() self.optionalInfosBox.hide() self.dia.window.raise_()
def __init__(self, app, allowNonanonymousMode=True): BaseDialog.BaseDialog.__init__(self, "%s Anonymity Selector" % (app.name), ("ok", "cancel"), None) self.app = app self.allowNonanonymousMode = allowNonanonymousMode titleLabel = gtk.Label() titleLabel.set_markup("<span size='x-large' weight='bold'>%s Anonymity Selector</span>" % (self.app.name)) titleLabel.set_justify(gtk.JUSTIFY_CENTER) vbox = gtk.VBox() vbox.pack_start(titleLabel, False, False, 5) infoTextLabel = WrapLabel.WrapLabel(infoText) infoTextLabel.set_justify(gtk.JUSTIFY_FILL) #keep the label from having no width infoTextLabel.set_size_request(300, -1) infoAndSlider = gtk.VBox() infoAndSlider.pack_start(infoTextLabel, False, False, 0) instructionBox = self._make_instruction_box() infoAndSlider.pack_start(instructionBox, False, False, 0) #get the appropriate path length from the app if not self.allowNonanonymousMode or self.app.useTor: pathLength = self.app.settings.pathLength else: pathLength = 0 anonymityBox = self._make_slider_box(pathLength) infoAndSlider.pack_start(anonymityBox, False, False, 0) infoAndSlider = GTKUtils.add_padding(infoAndSlider, 5) infoAndSlider = GTKUtils.add_frame(infoAndSlider, name='Choose Your Anonymity Level') vbox.pack_start(infoAndSlider, False, False, 0) optionalInfos = self._make_optional_info_box() optionalInfos = GTKUtils.add_padding(optionalInfos, 0, 5, 5, 5) vbox.pack_start(optionalInfos, False, False, 0) self.dia.vbox.pack_start(vbox, False, False, 0) self.dia.vbox.show_all() self.optionalInfosBox.hide() self.dia.window.raise_()
def _make_required_ports_box(self): """Make a box containing the settings and status for all required ports (currently just the Relay port)""" #make entry rows self.relayBox = RelayPortStatusBox("Relay Port (TCP)", "orPort", self) self.upnpBox = UPnPStatusBox("UPnP") #pack them together: box = gtk.VBox(spacing=PADDING) box.pack_start(self.relayBox, False, False, 0) box.pack_start(self.upnpBox, False, False, 0) box = GTKUtils.add_padding(box, PADDING) frame = GTKUtils.add_frame(box, name="Relay Port", width=0) frame.show_all() return frame
def _make_optional_ports_box(self): """Make a box containing the settings and status for all optional ports (DHT and Dir)""" #make entry rows instructions = WrapLabel.WrapLabel("These ports perform minor misc functions that are helpful to other BitBlinder users. Set to 0 to disable.") self.dhtBox = PortStatusBox("Relay Port (UDP)", "dhtPort") self.dirBox = PortStatusBox("Dir Port (TCP)", "dirPort") #make a box for hiding these entry rows optionalPortsBox = gtk.VBox(spacing=PADDING) optionalPortsBox.pack_start(instructions, False, False, 0) optionalPortsBox.pack_start(self.dhtBox, False, False, 0) optionalPortsBox.pack_start(self.dirBox, False, False, 0) optionalPortsBox = GTKUtils.add_padding(optionalPortsBox, PADDING) optionalPortsBox.show_all() #make a frame with a built-in expander for showing and hiding these entry rows frame = OptionalToggleFrame.OptionalToggleFrame(optionalPortsBox, "Optional Ports") return frame
def _make_optional_info_box(self): """shows extra information that will scare away most users""" #make entry rows moreInfos = WrapLabel.WrapLabel(greaterInfoText) moreInfos.set_justify(gtk.JUSTIFY_FILL) #make a box for hiding self.optionalInfosBox = gtk.VBox() self.optionalInfosBox.pack_start(moreInfos, False, False, 0) self.optionalInfosBox = GTKUtils.add_padding(self.optionalInfosBox, 5) #make a frame with a built-in expander for showing and hiding these entry rows frame = GTKUtils.add_frame(self.optionalInfosBox, width=0) frameWidget = gtk.Expander("Learn More") frameWidget.connect("notify::expanded", self._toggle_optional_infos) frame.set_label_widget(frameWidget) return frame
def _make_optional_ports_box(self): """Make a box containing the settings and status for all optional ports (DHT and Dir)""" #make entry rows instructions = WrapLabel.WrapLabel( "These ports perform minor misc functions that are helpful to other BitBlinder users. Set to 0 to disable." ) self.dhtBox = PortStatusBox("Relay Port (UDP)", "dhtPort") self.dirBox = PortStatusBox("Dir Port (TCP)", "dirPort") #make a box for hiding these entry rows optionalPortsBox = gtk.VBox(spacing=PADDING) optionalPortsBox.pack_start(instructions, False, False, 0) optionalPortsBox.pack_start(self.dhtBox, False, False, 0) optionalPortsBox.pack_start(self.dirBox, False, False, 0) optionalPortsBox = GTKUtils.add_padding(optionalPortsBox, PADDING) optionalPortsBox.show_all() #make a frame with a built-in expander for showing and hiding these entry rows frame = OptionalToggleFrame.OptionalToggleFrame( optionalPortsBox, "Optional Ports") return frame
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)
def __init__(self, controller): buttons = (gtk.STOCK_YES, gtk.RESPONSE_YES, gtk.STOCK_NO, gtk.RESPONSE_NO) dia = gtk.Dialog("Credits Low", None, 0, buttons) self.controller = controller vbox = gtk.VBox() title = gtk.Label() markup = "<span size='large' weight='bold'>You Are Running out of Credits</span>" title.set_markup(markup) title.set_justify(gtk.JUSTIFY_CENTER) vbox.pack_start(title, True, False, 0) #A text entry telling the user what to do: balance = Bank.get().get_expected_balance() balanceGB = Format.convert_to_gb(balance) label = gtk.Label() text = "You only have %s (%s) credits remaining. You must set up a relay to gain more credits. \ This will allow other users to send traffic via your computer.\n\nWould you like to set up a relay now?" % ( balance, balanceGB) label.set_markup(text) label.set_line_wrap(True) vbox.pack_start(label, True, True, 5) #if we should always check: self.askAboutRelay = gtk.CheckButton( "Always ask about help setting up relay") vbox.pack_start(self.askAboutRelay, True, True, 10) #initialize the checkbox: self.askAboutRelay.set_active(CoreSettings.get().askAboutRelay) vbox = GTKUtils.add_padding(vbox, 5) dia.vbox.pack_start(vbox, True, True, 0) dia.connect("response", self.on_response) self.dia = dia #start the dialog dia.show_all()
def _make_exit_traffic_box(self): def make_exit_row(labelText): #make the widgets label = gtk.Label() label.set_markup("<span size='large'>%s</span>" % (labelText)) entry = SettingsDisplay.make_entry("bool", True) #and pack them together box = gtk.HBox() box.pack_start(label, False, False, 0) box.pack_end(entry.entry, False, False, 0) return (entry, box) #make widgets exitTrafficLabel = gtk.Label() exitTrafficLabel.set_markup( "<span size='large' weight='bold'>Exit Traffic Permissions:</span>" ) exitTrafficLabel.set_alignment(0.0, 0.5) self.webTrafficEntry, webBox = make_exit_row(" Allow Web Traffic") self.btTrafficEntry, btBox = make_exit_row( " Allow BitTorrent Traffic") self.dhtTrafficEntry, dhtBox = make_exit_row(" Allow DHT Traffic") risksLink = GTKUtils.make_html_link("What are the risks?", "") risksLink.label.set_alignment(0.0, 0.5) #pack them together: box = gtk.VBox(spacing=PADDING) box.pack_start(exitTrafficLabel, False, False, 0) box.pack_start(btBox, False, False, 0) box.pack_start(webBox, False, False, 0) box.pack_start(dhtBox, False, False, 0) box.pack_start(risksLink, False, False, 0) box = GTKUtils.add_padding(box, PADDING) frame = GTKUtils.add_frame(box, width=0) frame.show_all() return frame
def __init__(self, controller): self.window = gtk.Window() self.window.set_title("Out of credits!") self.controller = controller self.catch_event("settings_changed") self.window.connect("destroy", self._destroy_cb) #tell the user what happened headerLabel = gtk.Label() headerLabel.set_markup("<span size='x-large' weight='bold'>You have spent all your credits.\n</span>") headerImage = gtk.Image() headerImage.set_from_pixbuf(Images.make_icon("warning.png", 32)) headerBox = gtk.HBox(spacing=PADDING) headerBox.pack_start(headerImage, False, False, 0) headerBox.pack_start(headerLabel, False, False, 0) descriptionLabel = WrapLabel.WrapLabel("You must get more credits before you can keep sending traffic through BitBlinder. All users are given a small number of new credits each hour.\n\nYou can keep downloading with BitTorrent by disabling anonymity (upper right of the BitTorrent interface), but you will obviously not be anonymous!") descriptionBox = gtk.VBox(spacing=PADDING) descriptionBox.pack_start(headerBox, False, False, 0) descriptionBox.pack_start(descriptionLabel, False, False, 0) descriptionBox.show_all() #make some help text to explain what credits are creditLabel = WrapLabel.WrapLabel(CREDITS_HELP_TEXT) creditLabel = GTKUtils.add_padding(creditLabel, PADDING) creditLabel.show() creditExplanation = OptionalToggleFrame.OptionalToggleFrame(creditLabel, "What are credits?") creditExplanation = GTKUtils.add_padding(creditExplanation, PADDING) creditExplanation.show() #only appears if the user is still not configured as a relay relayButton = GTKUtils.make_image_button('<span size="large">Start Relay</span>', self._start_relay_cb, "power_off.png") relayLabel = WrapLabel.WrapLabel() relayLabel.set_markup('<span size="large" weight="bold">You should set up a relay! </span><span size="large">You will earn credits MUCH more quickly by being a relay and sending traffic for other users.</span>') self.relayRow = gtk.HBox(spacing=PADDING) spacingBox = gtk.VBox() spacingBox.pack_start(relayButton, True, False, 0) self.relayRow.pack_start(spacingBox, False, False, 0) self.relayRow.pack_start(relayLabel, True, True, 0) self.relayRow = GTKUtils.add_frame(self.relayRow, width=PADDING, name="Relay Setup") self.relayRow.show_all() #if we should always check self.alwaysShow = gtk.CheckButton("Always tell you when your credits run out.") self.alwaysShow.set_active(True) self.alwaysShow.show() #make the bottom button row waitButton = GTKUtils.make_image_button('<span size="large">Wait for Credits</span>', self._wait_cb, "time.png") purchaseButton = GTKUtils.make_image_button('<span size="large">Purchase Credits</span>', self._purchase_cb, "money.png") buttonRow = gtk.HBox(spacing=PADDING) buttonRow.pack_end(waitButton, False, False, 0) buttonRow.pack_end(purchaseButton, False, False, 0) buttonRow = GTKUtils.add_padding(buttonRow, PADDING) buttonRow.show_all() #pack everything together topBox = gtk.VBox(spacing=PADDING) topBox.pack_start(descriptionBox, False, False, 0) topBox.pack_start(creditExplanation, False, False, 0) topBox.pack_start(self.relayRow, False, False, 0) topBox.pack_start(self.alwaysShow, False, False, 0) topBox.show() topBox = GTKUtils.add_padding(topBox, PADDING) topBox.show() vbox = gtk.VBox() vbox.pack_start(topBox, False, False, 0) sep = gtk.HSeparator() sep.show() vbox.pack_end(buttonRow, False, False, 0) vbox.pack_end(sep, False, False, 0) vbox.show() #and add it into our dialog self.window.add(vbox) self.window.show()
def create(self): # titleLabel = gtk.Label() # titleLabel.set_markup("<span size='x-large' weight='bold'>Firefox Controls</span>") descriptionLabel = WrapLabel.WrapLabel("") descriptionLabel.set_markup( "<span size='x-large' weight='bold'>Important: Flash is NOT supported yet!</span>\n\nAlso, DO NOT leave Firefox open if you are not using it! Some website might keep sending traffic and cause you to lose credits over time\n\nThese will eventually be integrated into an extension inside of Firefox." ) #make the controls: def make_button_row(labelText, callback, imageFile, descriptionText): button = GTKUtils.make_image_button(labelText, callback, imageFile, iconSize=32) button.set_size_request(200, -1) label = WrapLabel.WrapLabel(descriptionText) label.set_size_request(200, -1) box = gtk.HBox(spacing=3 * PADDING) box.pack_start(button, False, False, 0) box.pack_start(label, False, False, 0) return (box, button) anonRow, self.anonButton = make_button_row( "Anonymity Level", self._anonymity_cb, "identity.png", "Control how fast and anonymous your Firefox traffic will be.") circuitRow, circuitButton = make_button_row( "New Circuit", self._new_circuit_cb, "network.png", "Get a new circuit (and IP address) for Firefox traffic. The new circuit might be faster or slower." ) ffRow, self.ffButton = make_button_row( "Launch", self.toggle_firefox, "grey.png", "Start or stop our anonymous version of Firefox.") visibilityRow, self.visibilityButton = make_button_row( "Hide", self._hide_cb, "hide.png", "Hide these controls. They can always be opened from the system tray icon or file menu." ) controlBox = gtk.VBox(spacing=PADDING) controlBox.pack_start(ffRow, False, False, 0) controlBox.pack_start(anonRow, False, False, 0) controlBox.pack_start(circuitRow, False, False, 0) controlBox.pack_start(visibilityRow, False, False, 0) controlBox = GTKUtils.add_padding(controlBox, PADDING) controlBox = GTKUtils.add_frame(controlBox, name="Controls") def on_launched(button): self.start() self.ffButton.label.set_text("Starting...") self.ffButton.image.set_from_pixbuf(Images.YELLOW_CIRCLE) self._start_listening_for_event("launched", self.app, on_launched) def on_started(button): self.ffButton.label.set_text("Stop") self.ffButton.image.set_from_pixbuf(Images.GREEN_CIRCLE) self._start_listening_for_event("started", self.app, on_started) def on_stopped(button): self.ffButton.label.set_text("Closing...") self.ffButton.image.set_from_pixbuf(Images.YELLOW_CIRCLE) self._start_listening_for_event("stopped", self.app, on_stopped) def on_finished(button): self.ffButton.label.set_text("Start") self.ffButton.image.set_from_pixbuf(Images.GREY_CIRCLE) self._start_listening_for_event("finished", self.app, on_finished) #pack everything into our window: box = gtk.VBox(spacing=PADDING) # box.pack_start(titleLabel, False, False, 0) box.pack_start(descriptionLabel, False, False, 0) box.pack_start(controlBox, False, False, 0) box.show() paddedBox = GTKUtils.add_padding(box, PADDING) paddedBox.show() frame = GTKUtils.add_frame(paddedBox) frame.show_all() vbox = gtk.VBox() self.menuBar = FirefoxMenuBar(self.controller) vbox.pack_start(self.menuBar.create_menus(), False, False, 0) vbox.pack_start(frame, True, True, 0) vbox.show_all() self.add(vbox)