mirror of
https://github.com/markqvist/NomadNet.git
synced 2025-06-06 21:49:09 -04:00
Added selection check
This commit is contained in:
parent
33ccab0907
commit
313cc108de
1 changed files with 26 additions and 22 deletions
|
@ -576,30 +576,32 @@ class KnownNodes(urwid.WidgetWrap):
|
||||||
self.delegate.left_pile.contents[0] = (overlay, options)
|
self.delegate.left_pile.contents[0] = (overlay, options)
|
||||||
|
|
||||||
def delete_selected_entry(self):
|
def delete_selected_entry(self):
|
||||||
source_hash = self.ilb.get_selected_item().original_widget.source_hash
|
si = self.ilb.get_selected_item()
|
||||||
|
if si != None:
|
||||||
|
source_hash = si.original_widget.source_hash
|
||||||
|
|
||||||
def dismiss_dialog(sender):
|
def dismiss_dialog(sender):
|
||||||
self.delegate.close_list_dialogs()
|
self.delegate.close_list_dialogs()
|
||||||
|
|
||||||
def confirmed(sender):
|
def confirmed(sender):
|
||||||
self.app.directory.forget(source_hash)
|
self.app.directory.forget(source_hash)
|
||||||
self.rebuild_widget_list()
|
self.rebuild_widget_list()
|
||||||
self.delegate.close_list_dialogs()
|
self.delegate.close_list_dialogs()
|
||||||
|
|
||||||
|
|
||||||
dialog = ListDialogLineBox(
|
dialog = ListDialogLineBox(
|
||||||
urwid.Pile([
|
urwid.Pile([
|
||||||
urwid.Text("Delete Node\n"+self.app.directory.simplest_display_str(source_hash)+"\n", align="center"),
|
urwid.Text("Delete Node\n"+self.app.directory.simplest_display_str(source_hash)+"\n", align="center"),
|
||||||
urwid.Columns([("weight", 0.45, urwid.Button("Yes", on_press=confirmed)), ("weight", 0.1, urwid.Text("")), ("weight", 0.45, urwid.Button("No", on_press=dismiss_dialog))])
|
urwid.Columns([("weight", 0.45, urwid.Button("Yes", on_press=confirmed)), ("weight", 0.1, urwid.Text("")), ("weight", 0.45, urwid.Button("No", on_press=dismiss_dialog))])
|
||||||
]), title="?"
|
]), title="?"
|
||||||
)
|
)
|
||||||
dialog.delegate = self.delegate
|
dialog.delegate = self.delegate
|
||||||
bottom = self
|
bottom = self
|
||||||
|
|
||||||
overlay = urwid.Overlay(dialog, bottom, align="center", width=("relative", 100), valign="middle", height="pack", left=2, right=2)
|
overlay = urwid.Overlay(dialog, bottom, align="center", width=("relative", 100), valign="middle", height="pack", left=2, right=2)
|
||||||
|
|
||||||
options = self.delegate.left_pile.options("weight", 1)
|
options = self.delegate.left_pile.options("weight", 1)
|
||||||
self.delegate.left_pile.contents[0] = (overlay, options)
|
self.delegate.left_pile.contents[0] = (overlay, options)
|
||||||
|
|
||||||
|
|
||||||
def rebuild_widget_list(self):
|
def rebuild_widget_list(self):
|
||||||
|
@ -1181,10 +1183,12 @@ class LXMFPeers(urwid.WidgetWrap):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def delete_selected_entry(self):
|
def delete_selected_entry(self):
|
||||||
destination_hash = self.ilb.get_selected_item().original_widget.destination_hash
|
si = self.ilb.get_selected_item()
|
||||||
self.app.message_router.unpeer(destination_hash)
|
if si != None:
|
||||||
self.delegate.reinit_lxmf_peers()
|
destination_hash = si.original_widget.destination_hash
|
||||||
self.delegate.show_peers()
|
self.app.message_router.unpeer(destination_hash)
|
||||||
|
self.delegate.reinit_lxmf_peers()
|
||||||
|
self.delegate.show_peers()
|
||||||
|
|
||||||
|
|
||||||
def rebuild_widget_list(self):
|
def rebuild_widget_list(self):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue