class ProxyDialog(QtGui.QDialog): options = [ BoolOption("persist", "save_authentication", True), ] def __init__(self, authenticator, proxy, parent=None): QtGui.QDialog.__init__(self, parent) self._authenticator = authenticator self._proxy = proxy self.ui = Ui_PasswordDialog() self.ui.setupUi(self) self.ui.info_text.setText( _("The proxy %s requires you to login. Please enter your username and password." ) % self.config.setting["proxy_server_host"]) self.ui.save_authentication.setChecked( self.config.persist["save_authentication"]) self.ui.username.setText(self.config.setting["proxy_username"]) self.ui.password.setText(self.config.setting["proxy_password"]) self.ui.save_authentication.hide() self.connect(self.ui.buttonbox, QtCore.SIGNAL('accepted()'), self.set_proxy_password) def set_proxy_password(self): self.config.setting["proxy_username"] = unicode( self.ui.username.text()) self.config.setting["proxy_password"] = unicode( self.ui.password.text()) self._authenticator.setUser(unicode(self.ui.username.text())) self._authenticator.setPassword(unicode(self.ui.password.text())) self.accept()
class ProxyDialog(QtGui.QDialog): options = [ config.BoolOption("persist", "save_authentication", True), ] def __init__(self, authenticator, proxy, parent=None): QtGui.QDialog.__init__(self, parent) self._authenticator = authenticator self._proxy = proxy self.ui = Ui_PasswordDialog() self.ui.setupUi(self) self.ui.info_text.setText(_("The proxy %s requires you to login. Please enter your username and password.") % config.setting["proxy_server_host"]) self.ui.save_authentication.setChecked(config.persist["save_authentication"]) self.ui.username.setText(config.setting["proxy_username"]) self.ui.password.setText(config.setting["proxy_password"]) self.ui.save_authentication.hide() self.ui.buttonbox.accepted.connect(self.set_proxy_password) def set_proxy_password(self): config.setting["proxy_username"] = unicode(self.ui.username.text()) config.setting["proxy_password"] = unicode(self.ui.password.text()) self._authenticator.setUser(unicode(self.ui.username.text())) self._authenticator.setPassword(unicode(self.ui.password.text())) self.accept()
class PasswordDialog(QtGui.QDialog): options = [ config.BoolOption("persist", "save_authentication", True), ] def __init__(self, authenticator, reply, parent=None): QtGui.QDialog.__init__(self, parent) self._authenticator = authenticator self.ui = Ui_PasswordDialog() self.ui.setupUi(self) self.ui.info_text.setText(_("The server %s requires you to login. Please enter your username and password.") % reply.url().host()) # TODO: Implement proper password storage for arbitrary servers if self._is_musicbrainz_server(reply.url().host(), reply.url().port()): self.ui.save_authentication.setChecked(config.persist["save_authentication"]) self.ui.username.setText(config.setting["username"]) self.ui.password.setText(config.setting["password"]) else: self.ui.username.setText(reply.url().userName()) self.ui.password.setText(reply.url().password()) self.ui.save_authentication.setChecked(False) self.ui.save_authentication.hide() self.ui.buttonbox.accepted.connect(self.set_new_password) def set_new_password(self): config.persist["save_authentication"] = self.ui.save_authentication.isChecked() if config.persist["save_authentication"]: config.setting["username"] = unicode(self.ui.username.text()) config.setting["password"] = rot13(unicode(self.ui.password.text())) self._authenticator.setUser(unicode(self.ui.username.text())) self._authenticator.setPassword(unicode(self.ui.password.text())) self.accept() def _is_musicbrainz_server(self, host, port): return host == config.setting["server_host"] and port == config.setting["server_port"]
def __init__(self, authenticator, reply, parent=None): super().__init__(parent) self._authenticator = authenticator self.ui = Ui_PasswordDialog() self.ui.setupUi(self) self.ui.info_text.setText( _("The server %s requires you to login. Please enter your username and password." ) % reply.url().host()) self.ui.username.setText(reply.url().userName()) self.ui.password.setText(reply.url().password()) self.ui.buttonbox.accepted.connect(self.set_new_password)
def __init__(self, authenticator, proxy, parent=None): super().__init__(parent) self._authenticator = authenticator self._proxy = proxy self.ui = Ui_PasswordDialog() self.ui.setupUi(self) self.ui.info_text.setText( _("The proxy %s requires you to login. Please enter your username and password." ) % config.setting["proxy_server_host"]) self.ui.username.setText(config.setting["proxy_username"]) self.ui.password.setText(config.setting["proxy_password"]) self.ui.buttonbox.accepted.connect(self.set_proxy_password)
def __init__(self, authenticator, reply, parent=None): QtGui.QDialog.__init__(self, parent) self._authenticator = authenticator self.ui = Ui_PasswordDialog() self.ui.setupUi(self) self.ui.info_text.setText(_("The server %s requires you to login. Please enter your username and password.") % reply.url().host()) # TODO: Implement proper password storage for arbitrary servers if self._is_musicbrainz_server(reply.url().host(), reply.url().port()): self.ui.save_authentication.setChecked(config.persist["save_authentication"]) self.ui.username.setText(config.setting["username"]) self.ui.password.setText(config.setting["password"]) else: self.ui.username.setText(reply.url().userName()) self.ui.password.setText(reply.url().password()) self.ui.save_authentication.setChecked(False) self.ui.save_authentication.hide() self.ui.buttonbox.accepted.connect(self.set_new_password)
class PasswordDialog(PicardDialog): def __init__(self, authenticator, reply, parent=None): PicardDialog.__init__(self, parent) self._authenticator = authenticator self.ui = Ui_PasswordDialog() self.ui.setupUi(self) self.ui.info_text.setText( _("The server %s requires you to login. Please enter your username and password.") % reply.url().host()) self.ui.username.setText(reply.url().userName()) self.ui.password.setText(reply.url().password()) self.ui.buttonbox.accepted.connect(self.set_new_password) def set_new_password(self): self._authenticator.setUser(unicode(self.ui.username.text())) self._authenticator.setPassword(unicode(self.ui.password.text())) self.accept()
class ProxyDialog(PicardDialog): def __init__(self, authenticator, proxy, parent=None): PicardDialog.__init__(self, parent) self._authenticator = authenticator self._proxy = proxy self.ui = Ui_PasswordDialog() self.ui.setupUi(self) self.ui.info_text.setText( _("The proxy %s requires you to login. Please enter your username and password." ) % config.setting["proxy_server_host"]) self.ui.username.setText(config.setting["proxy_username"]) self.ui.password.setText(config.setting["proxy_password"]) self.ui.buttonbox.accepted.connect(self.set_proxy_password) def set_proxy_password(self): config.setting["proxy_username"] = unicode(self.ui.username.text()) config.setting["proxy_password"] = unicode(self.ui.password.text()) self._authenticator.setUser(unicode(self.ui.username.text())) self._authenticator.setPassword(unicode(self.ui.password.text())) self.accept()
def __init__(self, authenticator, proxy, parent=None): PicardDialog.__init__(self, parent) self._authenticator = authenticator self._proxy = proxy self.ui = Ui_PasswordDialog() self.ui.setupUi(self) self.ui.info_text.setText(_("The proxy %s requires you to login. Please enter your username and password.") % config.setting["proxy_server_host"]) self.ui.username.setText(config.setting["proxy_username"]) self.ui.password.setText(config.setting["proxy_password"]) self.ui.buttonbox.accepted.connect(self.set_proxy_password)
def __init__(self, authenticator, proxy, parent=None): QtGui.QDialog.__init__(self, parent) self._authenticator = authenticator self._proxy = proxy self.ui = Ui_PasswordDialog() self.ui.setupUi(self) self.ui.info_text.setText( _("The proxy %s requires you to login. Please enter your username and password.") % self.config.setting["proxy_server_host"] ) self.ui.save_authentication.setChecked(self.config.persist["save_authentication"]) self.ui.username.setText(self.config.setting["proxy_username"]) self.ui.password.setText(self.config.setting["proxy_password"]) self.ui.save_authentication.hide() self.connect(self.ui.buttonbox, QtCore.SIGNAL("accepted()"), self.set_proxy_password)