1
0
Fork 0

- added module 'fetch-post-tree.lisp';

- changed the window type from gemini to standard type for printing the output from a module.
This commit is contained in:
cage 2022-08-23 16:36:34 +02:00
parent bf938f6e4b
commit 0617f56885
4 changed files with 67 additions and 1 deletions

View File

@ -0,0 +1,51 @@
;; tinmop module for utility move command in thread window
;; Copyright © 2022 cage
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
(defpackage :fetch-post-tree
(:use
:cl
:misc
:fs
:text-utils
:specials
:program-events
:ui-goodies)
(:local-nicknames (:a :alexandria)))
(in-package :fetch-post-tree)
(if (ui:tui-active-p)
(labels ((on-input-complete (status-id)
(with-enqueued-process ()
(if (string-not-empty-p status-id)
(let* ((timeline (thread-window:timeline-type *thread-window*))
(folder (thread-window:timeline-folder *thread-window*))
(expand-event (make-instance 'expand-thread-event
:force-saving-of-ignored-status t
:new-folder folder
:new-timeline timeline
:status-id status-id))
(refresh-event (make-instance 'refresh-thread-windows-event
:priority +minimum-event-priority+
:message-status-id status-id)))
(notify "Fetching data")
(push-event expand-event)
(push-event refresh-event)
(notify "Data fetched"))
(error-message "ID empty")))))
(ui:ask-string-input #'on-input-complete
:prompt "Type the post's ID: "))
(format *error-output* "This script needs can not be ran from the command line.~%"))

View File

@ -1525,6 +1525,7 @@
:add-pagination-status-event
:status-id
:timeline
:display-output-script-page
:gemini-display-data-page
:gemini-request-event
:gemini-back-event

View File

@ -1079,6 +1079,20 @@
(tui:with-notify-errors
(api-client:poll-vote poll-id choices))))
(defclass display-output-script-page (program-event)
((window
:initform nil
:initarg :window
:accessor window)))
(defmethod process-event ((object display-output-script-page))
(with-accessors ((page-data payload)
(window window)) object
(when (text-utils:string-not-empty-p page-data)
(tui:with-notify-errors
(message-window:prepare-for-rendering window page-data)
(windows:draw window)))))
(defclass gemini-display-data-page (program-event)
((window
:initform nil

View File

@ -2717,7 +2717,7 @@ example)."
:verbose nil
:print nil
:if-does-not-exist :error)))))
(push-event (make-instance 'gemini-display-data-page
(push-event (make-instance 'display-output-script-page
:window *message-window*
:payload output)))))))
(defun load-script-file ()