|
|
@ -6,7 +6,7 @@ from PyQt4.QtCore import * |
|
|
|
from electrum.plugins import hook |
|
|
|
from electrum.i18n import _ |
|
|
|
from electrum_gui.qt import EnterButton |
|
|
|
from electrum_gui.qt.util import ThreadedButton, Buttons, CancelButton |
|
|
|
from electrum_gui.qt.util import ThreadedButton, Buttons |
|
|
|
from electrum_gui.qt.util import WindowModalDialog, OkButton |
|
|
|
|
|
|
|
from labels import LabelsPlugin |
|
|
@ -28,28 +28,29 @@ class Plugin(LabelsPlugin): |
|
|
|
def settings_dialog(self, window): |
|
|
|
wallet = window.parent().wallet |
|
|
|
d = WindowModalDialog(window, _("Label Settings")) |
|
|
|
hbox = QHBoxLayout() |
|
|
|
hbox.addWidget(QLabel("Label sync options:")) |
|
|
|
upload = ThreadedButton("Force upload", |
|
|
|
partial(self.push_thread, wallet), |
|
|
|
partial(self.done_processing, d)) |
|
|
|
download = ThreadedButton("Force download", |
|
|
|
partial(self.pull_thread, wallet, True), |
|
|
|
partial(self.done_processing, d)) |
|
|
|
vbox = QVBoxLayout() |
|
|
|
vbox.addWidget(upload) |
|
|
|
vbox.addWidget(download) |
|
|
|
hbox.addLayout(vbox) |
|
|
|
vbox = QVBoxLayout(d) |
|
|
|
layout = QGridLayout() |
|
|
|
vbox.addLayout(layout) |
|
|
|
layout.addWidget(QLabel("Label sync options: "), 2, 0) |
|
|
|
self.upload = ThreadedButton("Force upload", |
|
|
|
partial(self.push_thread, wallet), |
|
|
|
self.done_processing) |
|
|
|
layout.addWidget(self.upload, 2, 1) |
|
|
|
self.download = ThreadedButton("Force download", |
|
|
|
partial(self.pull_thread, wallet, True), |
|
|
|
self.done_processing) |
|
|
|
layout.addWidget(self.download, 2, 2) |
|
|
|
self.accept = OkButton(d, _("Done")) |
|
|
|
vbox.addLayout(Buttons(CancelButton(d), self.accept)) |
|
|
|
vbox.addLayout(hbox) |
|
|
|
vbox.addSpacing(20) |
|
|
|
vbox.addLayout(Buttons(OkButton(d))) |
|
|
|
return bool(d.exec_()) |
|
|
|
|
|
|
|
def on_pulled(self, wallet): |
|
|
|
self.obj.emit(SIGNAL('labels_changed'), wallet) |
|
|
|
|
|
|
|
def done_processing(self): |
|
|
|
QMessageBox.information(None, _("Labels synchronised"), |
|
|
|
_("Your labels have been synchronised.")) |
|
|
|
def done_processing(self, dialog, result): |
|
|
|
dialog.show_message(_("Your labels have been synchronised.")) |
|
|
|
|
|
|
|
@hook |
|
|
|
def on_new_window(self, window): |
|
|
|