mirror of
https://github.com/aclist/dztui.git
synced 2026-10-30 14:42:54 +01:00
fix: pass correct number of records
This commit is contained in:
1 parent
1b1cb33a6e
commit
672c8f9e9e
4 files changed
+22
-13
No files matched your search
@@ -473,7 +473,7 @@ def query_by_ip(addr: str) -> Optional[dict]:
|
|||||||
try:
|
try:
|
||||||
record = addr.split(":")
|
record = addr.split(":")
|
||||||
# TODO: create a Record object
|
# TODO: create a Record object
|
||||||
ip, qport = record[0], record[2]
|
ip, qport = record[0], record[1]
|
||||||
res = query_direct(ip, int(qport))
|
res = query_direct(ip, int(qport))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.critical(e)
|
logger.critical(e)
|
||||||
|
|||||||
@@ -197,19 +197,19 @@ class ServerModelManager:
|
|||||||
@call_on_thread(dialog.querying)
|
@call_on_thread(dialog.querying)
|
||||||
def add_by_ip(self, addr: str) -> None:
|
def add_by_ip(self, addr: str) -> None:
|
||||||
res = Servers.query_by_ip(addr)
|
res = Servers.query_by_ip(addr)
|
||||||
self.parse_single_record(res)
|
self._parse_single_record(res)
|
||||||
|
|
||||||
def parse_single_record(self, record: dict) -> None:
|
def _parse_single_record(self, response: dict) -> None:
|
||||||
if res is None:
|
if response is None:
|
||||||
self.thread_man.set_cleanup_func(StoredFunc(self._cleanup_on_failure))
|
self.thread_man.set_cleanup_func(StoredFunc(self._cleanup_on_failure))
|
||||||
return
|
return
|
||||||
|
|
||||||
record = Servers.parse_json([res])
|
record = Servers.parse_json([response])
|
||||||
|
|
||||||
proxy_man = self._get_proxy_man()
|
proxy_man = self._get_proxy_man()
|
||||||
raw_model = proxy_man.get_control()
|
raw_model = proxy_man.get_control()
|
||||||
|
|
||||||
fqip = Servers.response_to_fq_ip(res)
|
fqip = Servers.response_to_fq_ip(response)
|
||||||
config_man = self.controller.get_config_man()
|
config_man = self.controller.get_config_man()
|
||||||
config_man.add_saved_server(fqip)
|
config_man.add_saved_server(fqip)
|
||||||
|
|
||||||
@@ -324,6 +324,7 @@ class ServerModelManager:
|
|||||||
manager.filter(FilterMode.INITIAL)
|
manager.filter(FilterMode.INITIAL)
|
||||||
self.to_insert = manager.get_proxy_model()
|
self.to_insert = manager.get_proxy_model()
|
||||||
|
|
||||||
|
# TODO: abstract for all methods
|
||||||
u_maps = set([row[1] for row in data])
|
u_maps = set([row[1] for row in data])
|
||||||
self._set_new_maps(sorted(u_maps))
|
self._set_new_maps(sorted(u_maps))
|
||||||
|
|
||||||
|
|||||||
@@ -217,6 +217,7 @@ class AddPanel(Gtk.Frame):
|
|||||||
ServerModelManager(self.controller, tree).add_by_ip(addr)
|
ServerModelManager(self.controller, tree).add_by_ip(addr)
|
||||||
|
|
||||||
def _on_activate(self, entry: Gtk.Entry) -> None:
|
def _on_activate(self, entry: Gtk.Entry) -> None:
|
||||||
|
# NOTE: default action is to add a record, not connect
|
||||||
if not self.add_server.is_sensitive():
|
if not self.add_server.is_sensitive():
|
||||||
return
|
return
|
||||||
self._submit_query()
|
self._submit_query()
|
||||||
|
|||||||
@@ -50,15 +50,22 @@ class LogTreeView(ContextMixin, TreeView):
|
|||||||
|
|
||||||
def _on_log_buttonpress(self, widget: Gtk.Widget, event: Gdk.EventButton) -> None:
|
def _on_log_buttonpress(self, widget: Gtk.Widget, event: Gdk.EventButton) -> None:
|
||||||
if event.button == Gdk.BUTTON_SECONDARY:
|
if event.button == Gdk.BUTTON_SECONDARY:
|
||||||
path, col, x, y = self.get_path_at_pos(int(event.x), int(event.y))
|
|
||||||
if path:
|
|
||||||
selection = self.get_selection()
|
|
||||||
model, selected_paths = selection.get_selected_rows()
|
|
||||||
if path not in selected_paths:
|
|
||||||
selection.select_path(path)
|
|
||||||
self.present_menu(widget, event)
|
self.present_menu(widget, event)
|
||||||
return True
|
return True
|
||||||
return False
|
#selection = self.get_selection()
|
||||||
|
#model, selected_paths = selection.get_selected_rows()
|
||||||
|
#if len(selected_paths) > 1:
|
||||||
|
# for path in selected_paths:
|
||||||
|
# selection.select_path(path)
|
||||||
|
# path, col, x, y = self.get_path_at_pos(int(event.x), int(event.y))
|
||||||
|
# if path:
|
||||||
|
# selection = self.get_selection()
|
||||||
|
# model, selected_paths = selection.get_selected_rows()
|
||||||
|
# if path not in selected_paths:
|
||||||
|
# selection.select_path(path)
|
||||||
|
# self.present_menu(widget, event)
|
||||||
|
# return True
|
||||||
|
#return False
|
||||||
|
|
||||||
def _on_log_keypress(self, widget: Gtk.Widget, event: Gdk.EventKey) -> None:
|
def _on_log_keypress(self, widget: Gtk.Widget, event: Gdk.EventKey) -> None:
|
||||||
self.present_menu(widget, event)
|
self.present_menu(widget, event)
|
||||||
Reference in new issue
Block a user