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")
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):
self.buffer_widget.eval_js("update_node_topic('{}');".format(topic))

@ -33,6 +33,15 @@
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(){
var selected_node = _jm.get_selected_node(); // as parent of new node
if(!selected_node) {

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

@ -1130,18 +1130,18 @@ of `eaf--buffer-app-name' inside the EAF buffer."
"com.lazycat.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."
(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
(eaf-call "handle_input_message" input-buffer-id callback-type input-message)
(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."
(condition-case nil
(cond ((string-equal interactive_type "string")
(read-string interactive-string))
(read-string interactive-string input_content))
((string-equal interactive_type "file")
(expand-file-name (read-file-name interactive-string))))
(quit nil)))

@ -376,7 +376,7 @@ class EAF(dbus.service.Object):
pass
@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
@dbus.service.signal(EAF_DBUS_NAME)

Loading…
Cancel
Save