1
0
mirror of https://codeberg.org/cage/tinmop/ synced 2024-12-26 00:02:34 +01:00

- [GUI] bound the wish interpreter handle to a special variable so that the gui event loop can reference it and call, without errors, nodgui functions.

This commit is contained in:
cage 2023-02-19 15:45:22 +01:00
parent d040aec005
commit cefbe59be6
5 changed files with 15 additions and 8 deletions

View File

@ -4,6 +4,8 @@
(defparameter *toplevel* gui:*tk*) (defparameter *toplevel* gui:*tk*)
(defparameter *gui-server* nil)
(a:define-constant +font-h1+ "sans 20 bold" :test #'string=) (a:define-constant +font-h1+ "sans 20 bold" :test #'string=)
(a:define-constant +font-h2+ "sans 15 bold" :test #'string=) (a:define-constant +font-h2+ "sans 15 bold" :test #'string=)

View File

@ -65,7 +65,7 @@
(defun notify-request-error (e) (defun notify-request-error (e)
(let ((message (format nil (_ "Comunication with backend failed: ~a") e))) (let ((message (format nil (_ "Comunication with backend failed: ~a") e)))
#+debug-mode (misc:dbg "request error ~a" message) #+debug-mode (misc:dbg "request error ~a" message)
#-debug-mode (gui-goodies:error-dialog gui:*tk* message))) #-debug-mode (gui-goodies:error-dialog gui-goodies:*toplevel* message)))
(defmacro with-notify-errors (&body body) (defmacro with-notify-errors (&body body)
`(handler-case `(handler-case
@ -274,6 +274,9 @@
(gui:with-nodgui (:title +program-name+) (gui:with-nodgui (:title +program-name+)
(icons:load-icons) (icons:load-icons)
(initialize-menu gui:*tk*) (initialize-menu gui:*tk*)
(setf gui-goodies:*toplevel* gui:*tk*)
(setf gui-goodies:*gui-server* gui:*wish*)
(client-events:start-events-loop)
(let ((main-frame (make-instance 'main-frame))) (let ((main-frame (make-instance 'main-frame)))
(gui:grid main-frame 0 0 :sticky :nswe) (gui:grid main-frame 0 0 :sticky :nswe)
(gui-goodies:gui-resize-grid-all gui:*tk*)))) (gui-goodies:gui-resize-grid-all gui:*tk*))))

View File

@ -23,8 +23,9 @@
(setf *stop-events-loop* nil)) (setf *stop-events-loop* nil))
(setf *events-loop-thread* (setf *events-loop-thread*
(bt:make-thread (lambda () (bt:make-thread (lambda ()
(let ((gui:*wish* gui-goodies:*gui-server*))
(loop while (events-loop-running-p) do (loop while (events-loop-running-p) do
(ev:dispatch-program-events-or-wait)))))) (ev:dispatch-program-events-or-wait)))))))
(defmacro with-enqueue-request ((method-name id the-error &rest args) &body on-error) (defmacro with-enqueue-request ((method-name id the-error &rest args) &body on-error)
`(ev:with-enqueued-process-and-unblock () `(ev:with-enqueued-process-and-unblock ()

View File

@ -264,7 +264,6 @@ etc.) happened"
(rpc-server-init))) (rpc-server-init)))
(command-line:*rpc-client-mode* (command-line:*rpc-client-mode*
(rpc-client-load-configuration) (rpc-client-load-configuration)
(client-events:start-events-loop)
(json-rpc-communication::start-client) (json-rpc-communication::start-client)
(client-main-window:init-main-window)) (client-main-window:init-main-window))
(command-line:*print-lisp-dependencies* (command-line:*print-lisp-dependencies*

View File

@ -3256,6 +3256,7 @@
(:local-nicknames (:comm :json-rpc-communication) (:local-nicknames (:comm :json-rpc-communication)
(:re :cl-ppcre) (:re :cl-ppcre)
(:a :alexandria) (:a :alexandria)
(:gui :nodgui)
(:ev :program-events)) (:ev :program-events))
(:export (:export
:events-loop-running-p :events-loop-running-p
@ -3315,6 +3316,7 @@
(:gui-shapes :nodgui.shapes)) (:gui-shapes :nodgui.shapes))
(:export (:export
:*toplevel* :*toplevel*
:*gui-server*
:gui-resize-grid-all :gui-resize-grid-all
:confirm-deletion :confirm-deletion
:info-operation-completed :info-operation-completed