1
0
Fork 0

- [GUI] added scheduler arguments function to set busy the UI during the scheduled process running.

This commit is contained in:
cage 2023-07-23 11:12:03 +02:00
parent 9009e943d3
commit f98e02a8e2
1 changed files with 23 additions and 11 deletions

View File

@ -28,17 +28,30 @@
0))
(defmacro define-scheduled-procedure ((name frequency) &body body)
(a:with-gensyms (event-fn)
(a:with-gensyms (event-fn process-fn)
(let ((fn-name (misc:format-fn-symbol t "~a" name)))
`(defun ,fn-name (&key (start-on-boot nil))
(labels ((,event-fn ()
(ev:with-enqueued-process-and-unblock
(program-events:+minimum-event-priority+)
,@body
(,fn-name))))
`(defun ,fn-name (&key (start-on-boot nil) (set-busy nil) (set-busy-on-boot nil))
(macrolet ((enqueue (&body local-body)
`(ev:with-enqueued-process-and-unblock
(program-events:+minimum-event-priority+)
,@local-body)))
(labels ((,process-fn ()
(progn
,@body
(,fn-name)))
(,event-fn ()
(enqueue
(if set-busy
(gui-goodies:with-busy* (gui-goodies:*main-frame*)
(,process-fn))
(,process-fn)))))
(when start-on-boot
(funcall (function ,event-fn)))
(gui:after ,frequency (function ,event-fn)))))))
(if set-busy-on-boot
(enqueue
(gui-goodies:with-busy* (gui-goodies:*main-frame*)
(,process-fn)))
(enqueue (,event-fn))))
(gui:after ,frequency (function ,event-fn))))))))
(defun notify (message)
(when gui-goodies:*main-frame*
@ -46,7 +59,6 @@
(define-scheduled-procedure (refresh-gemlog-subscriptions
+refresh-gemlog-subscriptions-frequency+)
(notify (_ "Gemlogs subscriptions updating in progress…"))
(comm:make-request :gemini-gemlog-refresh-all-subscriptions 1)
(notify (_ "Gemlogs subscriptions updated")))
@ -60,6 +72,6 @@
(notify (_ "Old history entries removed")))
(defun start ()
(refresh-gemlog-subscriptions :start-on-boot t)
(refresh-gemlog-subscriptions :start-on-boot t :set-busy-on-boot t)
(purge-gemlogs)
(purge-history))