Need pass topic to minibuffer when change node topic.

master
Andy Stewart 6 years ago
parent 497596aa99
commit 0d63e5804f
  1. 6
      app/mindmap/buffer.py
  2. 9
      app/mindmap/index.html
  3. 6
      core/buffer.py
  4. 8
      eaf.el
  5. 2
      eaf.py

@ -74,7 +74,11 @@ class AppBuffer(BrowserBuffer):
self.send_input_message("Change node background: ", "change_node_background", "file") self.send_input_message("Change node background: ", "change_node_background", "file")
def update_node_topic(self): def update_node_topic(self):
self.send_input_message("Update topic: ", "update_node_topic") self.send_input_message(
"Update topic: ",
"update_node_topic",
"string",
self.buffer_widget.execute_js("get_node_topic();"))
def handle_update_node_topic(self, topic): def handle_update_node_topic(self, topic):
self.buffer_widget.eval_js("update_node_topic('{}');".format(topic)) self.buffer_widget.eval_js("update_node_topic('{}');".format(topic))

@ -33,6 +33,15 @@
return _jm.get_node("root").topic; return _jm.get_node("root").topic;
} }
function get_node_topic() {
var selected_node = _jm.get_selected_node(); // as parent of new node
if (selected_node) {
return selected_node.topic;
} else {
return ""
}
}
function add_sub_node(){ function add_sub_node(){
var selected_node = _jm.get_selected_node(); // as parent of new node var selected_node = _jm.get_selected_node(); // as parent of new node
if(!selected_node) { if(!selected_node) {

@ -152,7 +152,7 @@ class Buffer(QGraphicsScene):
open_url_in_background_tab = QtCore.pyqtSignal(str) open_url_in_background_tab = QtCore.pyqtSignal(str)
translate_text = QtCore.pyqtSignal(str) translate_text = QtCore.pyqtSignal(str)
before_destroy_hook = QtCore.pyqtSignal() before_destroy_hook = QtCore.pyqtSignal()
input_message = QtCore.pyqtSignal(str, str, str, str) input_message = QtCore.pyqtSignal(str, str, str, str, str)
close_buffer = QtCore.pyqtSignal(str) close_buffer = QtCore.pyqtSignal(str)
message_to_emacs = QtCore.pyqtSignal(str) message_to_emacs = QtCore.pyqtSignal(str)
set_emacs_var = QtCore.pyqtSignal(str, str) set_emacs_var = QtCore.pyqtSignal(str, str)
@ -239,8 +239,8 @@ class Buffer(QGraphicsScene):
def get_key_event_widgets(self): def get_key_event_widgets(self):
return [self.buffer_widget] return [self.buffer_widget]
def send_input_message(self, message, callback_type, input_type="string"): def send_input_message(self, message, callback_type, input_type="string", input_content=""):
self.input_message.emit(self.buffer_id, message, callback_type, input_type) self.input_message.emit(self.buffer_id, message, callback_type, input_type, input_content)
def handle_input_message(self, result_type, result_content): def handle_input_message(self, result_type, result_content):
pass pass

@ -1130,18 +1130,18 @@ of `eaf--buffer-app-name' inside the EAF buffer."
"com.lazycat.eaf" "input_message" "com.lazycat.eaf" "input_message"
#'eaf--input-message) #'eaf--input-message)
(defun eaf--input-message (input-buffer-id interactive-string callback-type interactive_type) (defun eaf--input-message (input-buffer-id interactive-string callback-type interactive_type input_content)
"Handles input message INTERACTIVE-STRING on the Python side given INPUT-BUFFER-ID and CALLBACK-TYPE." "Handles input message INTERACTIVE-STRING on the Python side given INPUT-BUFFER-ID and CALLBACK-TYPE."
(let* ((input-message (eaf-read-input (concat "[EAF/" eaf--buffer-app-name "] " interactive-string) interactive_type))) (let* ((input-message (eaf-read-input (concat "[EAF/" eaf--buffer-app-name "] " interactive-string) interactive_type input_content)))
(if input-message (if input-message
(eaf-call "handle_input_message" input-buffer-id callback-type input-message) (eaf-call "handle_input_message" input-buffer-id callback-type input-message)
(eaf-call "cancel_input_message" input-buffer-id callback-type)))) (eaf-call "cancel_input_message" input-buffer-id callback-type))))
(defun eaf-read-input (interactive-string interactive_type) (defun eaf-read-input (interactive-string interactive_type input_content)
"Like `read-string' which read an INTERACTIVE-STRING, but return nil if user execute `keyboard-quit' when input." "Like `read-string' which read an INTERACTIVE-STRING, but return nil if user execute `keyboard-quit' when input."
(condition-case nil (condition-case nil
(cond ((string-equal interactive_type "string") (cond ((string-equal interactive_type "string")
(read-string interactive-string)) (read-string interactive-string input_content))
((string-equal interactive_type "file") ((string-equal interactive_type "file")
(expand-file-name (read-file-name interactive-string)))) (expand-file-name (read-file-name interactive-string))))
(quit nil))) (quit nil)))

@ -376,7 +376,7 @@ class EAF(dbus.service.Object):
pass pass
@dbus.service.signal(EAF_DBUS_NAME) @dbus.service.signal(EAF_DBUS_NAME)
def input_message(self, buffer_id, message, callback_type, input_type): def input_message(self, buffer_id, message, callback_type, input_type, input_content):
pass pass
@dbus.service.signal(EAF_DBUS_NAME) @dbus.service.signal(EAF_DBUS_NAME)

Loading…
Cancel
Save