1
0
mirror of https://codeberg.org/cage/tinmop/ synced 2024-12-25 00:00:54 +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 *gui-server* nil)
(a:define-constant +font-h1+ "sans 20 bold" :test #'string=)
(a:define-constant +font-h2+ "sans 15 bold" :test #'string=)

View File

@ -65,7 +65,7 @@
(defun notify-request-error (e)
(let ((message (format nil (_ "Comunication with backend failed: ~a") e)))
#+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)
`(handler-case
@ -124,10 +124,10 @@
(defun initialize-menu (parent)
(with-accessors ((main-window main-window)) parent
(let* ((bar (gui:make-menubar parent))
(file (gui:make-menu bar (_ "File") :underline 0))
(help (gui:make-menu bar (_ "Help") :underline 0)))
(gui:make-menubutton file (_ "Quit") #'menu:quit :underline 0)
(gui:make-menubutton help (_ "About") #'menu:help-about :underline 0))))
(file (gui:make-menu bar (_ "File") :underline 0))
(help (gui:make-menu bar (_ "Help") :underline 0)))
(gui:make-menubutton file (_ "Quit") #'menu:quit :underline 0)
(gui:make-menubutton help (_ "About") #'menu:help-about :underline 0))))
(defclass tool-bar (gui:frame)
((iri-entry
@ -274,6 +274,9 @@
(gui:with-nodgui (:title +program-name+)
(icons:load-icons)
(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)))
(gui:grid main-frame 0 0 :sticky :nswe)
(gui-goodies:gui-resize-grid-all gui:*tk*))))

View File

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

View File

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

View File

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