mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-26 23:13:25 +00:00
settings dialog
This commit is contained in:
parent
c5747484b2
commit
a10455f685
3 changed files with 17 additions and 13 deletions
|
@ -2015,7 +2015,7 @@ class ElectrumWindow(QMainWindow):
|
||||||
cb.setChecked(p.is_enabled())
|
cb.setChecked(p.is_enabled())
|
||||||
cb.clicked.connect(mk_toggle(cb,p))
|
cb.clicked.connect(mk_toggle(cb,p))
|
||||||
grid_plugins.addWidget(cb, i, 0)
|
grid_plugins.addWidget(cb, i, 0)
|
||||||
if p.requires_settings:
|
if p.requires_settings():
|
||||||
grid_plugins.addWidget(EnterButton(_('Settings'), p.settings_dialog), i, 1)
|
grid_plugins.addWidget(EnterButton(_('Settings'), p.settings_dialog), i, 1)
|
||||||
grid_plugins.addWidget(HelpButton(description), i, 2)
|
grid_plugins.addWidget(HelpButton(description), i, 2)
|
||||||
except:
|
except:
|
||||||
|
|
|
@ -11,7 +11,9 @@ class BasePlugin:
|
||||||
self.description = description
|
self.description = description
|
||||||
self.gui = gui
|
self.gui = gui
|
||||||
self.config = gui.config
|
self.config = gui.config
|
||||||
self.requires_settings = False
|
|
||||||
|
def requires_settings(self):
|
||||||
|
return False
|
||||||
|
|
||||||
def toggle(self):
|
def toggle(self):
|
||||||
enabled = not self.is_enabled()
|
enabled = not self.is_enabled()
|
||||||
|
|
|
@ -65,15 +65,13 @@ To get started visit http://labelectrum.herokuapp.com/ to sign up for an account
|
||||||
return
|
return
|
||||||
response = json.loads(response.read())
|
response = json.loads(response.read())
|
||||||
|
|
||||||
def close_settings_dialog(self):
|
|
||||||
# When you enable the plugin for the first time this won't exist.
|
|
||||||
if self.is_enabled():
|
|
||||||
if hasattr(self, 'auth_token_edit'):
|
|
||||||
self.config.set_key("plugin_label_api_key", str(self.auth_token_edit.text()))
|
|
||||||
else:
|
|
||||||
QMessageBox.information(None, _("Label sync loaded"), _("Please open the settings again to configure the label sync plugin."))
|
|
||||||
|
|
||||||
def create_settings_tab(self, tabs):
|
def requires_settings(self):
|
||||||
|
return True
|
||||||
|
|
||||||
|
def settings_dialog(self):
|
||||||
|
dialog = QDialog(self.gui)
|
||||||
|
|
||||||
def check_for_api_key(api_key):
|
def check_for_api_key(api_key):
|
||||||
if api_key and len(api_key) > 12:
|
if api_key and len(api_key) > 12:
|
||||||
self.config.set_key("plugin_label_api_key", str(self.auth_token_edit.text()))
|
self.config.set_key("plugin_label_api_key", str(self.auth_token_edit.text()))
|
||||||
|
@ -83,8 +81,7 @@ To get started visit http://labelectrum.herokuapp.com/ to sign up for an account
|
||||||
self.upload.setEnabled(False)
|
self.upload.setEnabled(False)
|
||||||
self.download.setEnabled(False)
|
self.download.setEnabled(False)
|
||||||
|
|
||||||
cloud_tab = QWidget()
|
layout = QGridLayout()
|
||||||
layout = QGridLayout(cloud_tab)
|
|
||||||
layout.addWidget(QLabel("API Key: "),0,0)
|
layout.addWidget(QLabel("API Key: "),0,0)
|
||||||
|
|
||||||
self.auth_token_edit = QLineEdit(self.auth_token())
|
self.auth_token_edit = QLineEdit(self.auth_token())
|
||||||
|
@ -103,7 +100,12 @@ To get started visit http://labelectrum.herokuapp.com/ to sign up for an account
|
||||||
|
|
||||||
check_for_api_key(self.auth_token())
|
check_for_api_key(self.auth_token())
|
||||||
|
|
||||||
tabs.addTab(cloud_tab, "Label sync")
|
dialog.setLayout(layout)
|
||||||
|
|
||||||
|
dialog.exec_()
|
||||||
|
self.config.set_key("plugin_label_api_key", str(self.auth_token_edit.text()))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def full_push(self):
|
def full_push(self):
|
||||||
if self.do_full_push():
|
if self.do_full_push():
|
||||||
|
|
Loading…
Add table
Reference in a new issue