def _make_instruction_box(self): """Create a box that tells the user what to do in order to set up a relay, with links to get help if they are confused.""" #make the instructions self.instructionLabel = gtk.Label() self.instructionImage = gtk.Image() instructionBox = gtk.HBox(spacing=PADDING) instructionBox.pack_start(self.instructionImage, False, False, 0) instructionBox.pack_start(self.instructionLabel, False, False, 0) descriptionLabel = WrapLabel.WrapLabel("You must enable UPnP in your router or forward the port manually to be a relay. Otherwise, peers cannot send traffic through your computer.\n\nAlso remember to unblock BitBlinder.exe and Tor.exe in any firewall.") #make help link row routerAccessLink = GTKUtils.make_html_link("Access your router", "") portForwardingLink = GTKUtils.make_html_link("How do I forward a port?", "") linkRow = gtk.HBox() linkRow.pack_start(portForwardingLink, True, True, 0) linkRow.pack_start(routerAccessLink, True, True, 0) testingBox = self._make_test_bar() #pack everything together box = gtk.VBox(spacing=PADDING) box.pack_start(instructionBox, False, False, 0) box.pack_start(testingBox, False, False, 0) box.pack_start(descriptionLabel, False, False, 0) box.pack_start(linkRow, False, False, 0) box.show_all() return box
def _make_instruction_box(self): """Create a box that tells the user what to do in order to set up a relay, with links to get help if they are confused.""" #make the instructions self.instructionLabel = gtk.Label() self.instructionImage = gtk.Image() instructionBox = gtk.HBox(spacing=PADDING) instructionBox.pack_start(self.instructionImage, False, False, 0) instructionBox.pack_start(self.instructionLabel, False, False, 0) descriptionLabel = WrapLabel.WrapLabel( "You must enable UPnP in your router or forward the port manually to be a relay. Otherwise, peers cannot send traffic through your computer.\n\nAlso remember to unblock BitBlinder.exe and Tor.exe in any firewall." ) #make help link row routerAccessLink = GTKUtils.make_html_link("Access your router", "") portForwardingLink = GTKUtils.make_html_link( "How do I forward a port?", "") linkRow = gtk.HBox() linkRow.pack_start(portForwardingLink, True, True, 0) linkRow.pack_start(routerAccessLink, True, True, 0) testingBox = self._make_test_bar() #pack everything together box = gtk.VBox(spacing=PADDING) box.pack_start(instructionBox, False, False, 0) box.pack_start(testingBox, False, False, 0) box.pack_start(descriptionLabel, False, False, 0) box.pack_start(linkRow, False, False, 0) box.show_all() return box
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 create_box(self): #create each of the pages: self._mainBox = gtk.HBox() self.vbox.pack_start(self._mainBox, True, True, 0) BORDER_WIDTH = 10 def add_var(name, box, ignoreHBar=None): return self.add_variable(name, Tor.get().settings, Tor.get(), "", box, ignoreHBar) #general settings page: vbox = gtk.VBox() add_var("orPort", vbox) add_var("dirPort", vbox) add_var("dhtPort", vbox) vbox.set_border_width(BORDER_WIDTH) #windows settings, if necessary if System.IS_WINDOWS: startOnBootEntry = self.add_variable("startBitBlinderOnBoot", BitBlinder.get().settings, BitBlinder.get(), "", vbox) #NOTE: change the default to starting on bootup if we're a server now if not Tor.get().settings.wasRelay: startOnBootEntry.set_value(True) self.add_variable("halfOpenConnections", BitBlinder.get().settings, BitBlinder.get(), "", vbox) self._boxes.append(vbox) #exit traffic page: vbox = gtk.VBox() vbox.set_border_width(BORDER_WIDTH) exitTypeEntry = add_var("exitType", vbox, True) exitTypeEntry.set_value("Both") vbox.pack_start( GTKUtils.make_html_link( "Learn more about exit traffic", "%s/overview/" % (ProgramState.Conf.BASE_HTTP)), False, False, 2) self._boxes.append(vbox) #bandwidth page: vbox = gtk.VBox() vbox.set_border_width(BORDER_WIDTH) label = WrapLabel.WrapLabel("") label.set_markup( """<span size='large' weight='bold'>You should run BitBlinder in the background to accumulate credits. </span> """) vbox.pack_start(label, False, False, 0) # vbox.pack_start(gtk.HSeparator(), False, False, 0) add_var("monthlyCap", vbox) add_var("bwRate", vbox) add_var("bwSchedule", vbox) self._boxes.append(vbox) self._mainBox.set_size_request(600, -1) self.set_current_page()
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'))
def create_box(self): #create each of the pages: self._mainBox = gtk.HBox() self.vbox.pack_start(self._mainBox, True, True, 0) BORDER_WIDTH = 10 def add_var(name, box, ignoreHBar=None): return self.add_variable(name, Tor.get().settings, Tor.get(), "", box, ignoreHBar) #general settings page: vbox = gtk.VBox() add_var("orPort", vbox) add_var("dirPort", vbox) add_var("dhtPort", vbox) vbox.set_border_width(BORDER_WIDTH) #windows settings, if necessary if System.IS_WINDOWS: startOnBootEntry = self.add_variable("startBitBlinderOnBoot", BitBlinder.get().settings, BitBlinder.get(), "", vbox) #NOTE: change the default to starting on bootup if we're a server now if not Tor.get().settings.wasRelay: startOnBootEntry.set_value(True) self.add_variable("halfOpenConnections", BitBlinder.get().settings, BitBlinder.get(), "", vbox) self._boxes.append(vbox) #exit traffic page: vbox = gtk.VBox() vbox.set_border_width(BORDER_WIDTH) exitTypeEntry = add_var("exitType", vbox, True) exitTypeEntry.set_value("Both") vbox.pack_start(GTKUtils.make_html_link("Learn more about exit traffic", "%s/overview/" % (ProgramState.Conf.BASE_HTTP)), False, False, 2) self._boxes.append(vbox) #bandwidth page: vbox = gtk.VBox() vbox.set_border_width(BORDER_WIDTH) label = WrapLabel.WrapLabel("") label.set_markup("""<span size='large' weight='bold'>You should run BitBlinder in the background to accumulate credits. </span> """) vbox.pack_start(label, False, False, 0) # vbox.pack_start(gtk.HSeparator(), False, False, 0) add_var("monthlyCap", vbox) add_var("bwRate", vbox) add_var("bwSchedule", vbox) self._boxes.append(vbox) self._mainBox.set_size_request(600, -1) self.set_current_page()
def download_update(self, newVersionData): """Download the latest version of InnomiNet from the web server newVersion=the version to download""" self.newVersion = newVersionData[0] self.trueHash = newVersionData[1] self.updateString = newVersionData[2] if System.IS_WINDOWS: #if we're not already doing the update: if not self.downloadingUpdate: self.downloadingUpdate = True #baseURL += "BitBlinderUpdate-%s-%s.exe" % (Globals.VERSION, self.newVersion) fileName = "BitBlinderInstaller-%s.exe" % (self.newVersion) url = self.baseURL + fileName #TODO: go through a circuit if the user wants to be stealthy: BitBlinder.http_download(url, None, self.request_done, self.request_failed, progressCB=self.progressCB, fileName=Globals.UPDATE_FILE_NAME+".download") GUIController.get().show_msgbox("BitBlinder found a new version (%s)!\n\nDownloading update now... (you can choose whether to restart later)" % (self.newVersion)) else: #url = self.baseURL + "python-bitblinder_%s_%s.deb" % (self.newVersion, platform.machine()) url = "%s/download/" % (ProgramState.Conf.BASE_HTTP) if ProgramState.USE_GTK: link = GTKUtils.make_html_link(url, url) else: link = url GUIController.get().show_msgbox("A new linux package is available! Changes:\n\n%s\n\nGo download and install it from:" % (self.updateString), title="Update Available", link=link)
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 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'))
def __init__(self, bankApp): ListenerMixin.ListenerMixin.__init__(self) self.username = None self.password = None self._start_listening_for_event("login_success", bankApp, self.on_login_success) self._start_listening_for_event("login_failure", bankApp, self.on_login_failure) dia = gtk.Dialog("Login", None, 0, None) dia.connect("destroy", self.destroy_cb) # dia.connect("expose_event", self.expose_cb) self.started = False self.succeeded = False self.loginButton = dia.add_button("Login", gtk.RESPONSE_OK) self.quitButton = dia.add_button("Quit", gtk.RESPONSE_CANCEL) #username field self.usernameLabel = gtk.Label("Username") self.nameEntry = gtk.Entry() self.nameEntry.set_max_length(50) self.nameEntry.connect("activate", self.enter_callback) #password field self.pwLabel = gtk.Label("Password") self.pwEntry = gtk.Entry() self.pwEntry.set_max_length(50) #so people cant see our password: self.pwEntry.set_visibility(False) self.pwEntry.connect("activate", self.enter_callback) resetPasswordLink = GTKUtils.make_html_link( "Forgot your password?", "%s/accounts/resetPassword/" % (ProgramState.Conf.BASE_HTTP)) makeAccountLink = GTKUtils.make_html_link( "Need an account?", "%s/accounts/register/" % (ProgramState.Conf.BASE_HTTP)) #put them in a nice little table table = gtk.Table(4, 2, True) table.attach(self.usernameLabel, 0, 1, 0, 1) table.attach(self.nameEntry, 1, 2, 0, 1) table.attach(makeAccountLink, 1, 2, 1, 2) table.attach(self.pwLabel, 0, 1, 2, 3) table.attach(self.pwEntry, 1, 2, 2, 3) table.attach(resetPasswordLink, 1, 2, 3, 4) self.savePassCheck = gtk.CheckButton("Remember Username/Password") #A text entry telling the user what to do: self.label = WrapLabel.WrapLabel() self.label.set_markup( "<span weight='bold'>Use your account name and password from the BitBlinder website!</span>" ) align = gtk.Alignment(xalign=0.5, yalign=0.5, xscale=1.0, yscale=0.0) align.add(self.label) align.set_padding(10, 10, 5, 5) dia.vbox.pack_start(GTKUtils.add_frame(align), True, True, 10) dia.vbox.pack_start(table, True, True, 0) dia.vbox.pack_start(self.savePassCheck, True, True, 10) #load a global config that said whether to store the last user that logged in (and his password) settings = GlobalSettings.load() self.nameEntry.set_text(settings.username) self.pwEntry.set_text(settings.password) self.savePassCheck.set_active(settings.save_password) #connect the handler: dia.connect("response", self.on_response) self.dia = dia
def __init__(self, bankApp): ListenerMixin.ListenerMixin.__init__(self) self.username = None self.password = None self._start_listening_for_event("login_success", bankApp, self.on_login_success) self._start_listening_for_event("login_failure", bankApp, self.on_login_failure) dia = gtk.Dialog("Login", None, 0, None) dia.connect("destroy", self.destroy_cb) # dia.connect("expose_event", self.expose_cb) self.started = False self.succeeded = False self.loginButton = dia.add_button("Login", gtk.RESPONSE_OK) self.quitButton = dia.add_button("Quit", gtk.RESPONSE_CANCEL) #username field self.usernameLabel = gtk.Label("Username") self.nameEntry = gtk.Entry() self.nameEntry.set_max_length(50) self.nameEntry.connect("activate", self.enter_callback) #password field self.pwLabel = gtk.Label("Password") self.pwEntry = gtk.Entry() self.pwEntry.set_max_length(50) #so people cant see our password: self.pwEntry.set_visibility(False) self.pwEntry.connect("activate", self.enter_callback) resetPasswordLink = GTKUtils.make_html_link("Forgot your password?", "%s/accounts/resetPassword/" % (ProgramState.Conf.BASE_HTTP)) makeAccountLink = GTKUtils.make_html_link("Need an account?", "%s/accounts/register/" % (ProgramState.Conf.BASE_HTTP)) #put them in a nice little table table = gtk.Table(4, 2, True) table.attach(self.usernameLabel, 0, 1, 0, 1) table.attach(self.nameEntry, 1, 2, 0, 1) table.attach(makeAccountLink, 1, 2, 1, 2) table.attach(self.pwLabel, 0, 1, 2, 3) table.attach(self.pwEntry, 1, 2, 2, 3) table.attach(resetPasswordLink, 1, 2, 3, 4) self.savePassCheck = gtk.CheckButton("Remember Username/Password") #A text entry telling the user what to do: self.label = WrapLabel.WrapLabel() self.label.set_markup("<span weight='bold'>Use your account name and password from the BitBlinder website!</span>") align = gtk.Alignment(xalign=0.5, yalign=0.5, xscale=1.0, yscale=0.0) align.add(self.label) align.set_padding(10, 10, 5, 5) dia.vbox.pack_start(GTKUtils.add_frame(align), True, True, 10) dia.vbox.pack_start(table, True, True, 0) dia.vbox.pack_start(self.savePassCheck, True, True, 10) #load a global config that said whether to store the last user that logged in (and his password) settings = GlobalSettings.load() self.nameEntry.set_text(settings.username) self.pwEntry.set_text(settings.password) self.savePassCheck.set_active(settings.save_password) #connect the handler: dia.connect("response", self.on_response) self.dia = dia