Skip to content

Commit

Permalink
Namecoin: Split out add_domain in DNS dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyRand committed Dec 12, 2019
1 parent 8a9b5b9 commit 36c96ef
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions electrum_nmc/electrum/gui/qt/configure_dns_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,11 @@ def __init__(self, value, parent):

subdomains.update([record[0] for record in records])

self.ui.comboDomain.addItems(list(subdomains))
self.ui.comboDomain.addItem(_(self.__class__.TEXT_ADD_SUBDOMAIN))

for domain in subdomains:
self.add_domain(domain)

self.ui.comboDomain.activated.connect(self.domain_changed)

self.ui.listDNSRecords.setModel(QStandardItemModel(self))
Expand Down Expand Up @@ -126,6 +128,9 @@ def __init__(self, value, parent):

self.accepted.connect(lambda: self.name_dialog.set_value(self.get_value()))

def add_domain(self, domain):
self.ui.comboDomain.addItem(domain)

def domain_changed(self, index):
if self.ui.comboDomain.itemText(index) == _(self.__class__.TEXT_ADD_SUBDOMAIN):
d = QDialog(parent=self)
Expand All @@ -135,7 +140,7 @@ def domain_changed(self, index):

ui.labelDomainName.setText(self.base_domain)

ui.btnAdd.accepted.connect(lambda: self.ui.comboDomain.addItem(ui.editSubDomain.text() + "." + self.base_domain))
ui.btnAdd.accepted.connect(lambda: self.add_domain(ui.editSubDomain.text() + "." + self.base_domain))

dialogs.append(d)
d.show()
Expand Down

0 comments on commit 36c96ef

Please sign in to comment.