[file manager] create prototype

This commit is contained in:
contrapunctus 2021-04-17 19:29:57 +05:30
commit 493b12219c
2 changed files with 40 additions and 0 deletions

7
magrathea.asd Normal file
View File

@ -0,0 +1,7 @@
(defsystem magrathea
:version "0.0.1"
:serial t
:license "Unlicense"
:author "contrapunctus <contrapunctus at disroot dot org>"
:depends-on (:mcclim)
:components ((:file "src/file-manager")))

33
src/file-manager.lisp Normal file
View File

@ -0,0 +1,33 @@
(in-package :cl)
(defpackage :magrathea.file-manager
(:use :clim :clim-lisp)
(:import-from :uiop :directory-files)
(:export :run-file-manager))
(in-package :magrathea.file-manager)
(defclass file ()
((path :initarg :pathname :accessor path)))
(defclass dir (file) nil)
(define-application-frame file-manager ()
((files :initform (directory-files *default-pathname-defaults*)
:accessor files))
(:pointer-documentation t)
(:panes (app :application
:display-time t
:height 300 :width 600
:display-function 'display-files)
(int :interactor :height 200 :width 600))
(:layouts (default (vertically () app int))))
(defun display-files (frame pane)
(format pane "~{~s~}" (files frame)))
(define-file-manager-command (com-quit :name t) ()
(frame-exit *application-frame*))
(defun run-file-manager ()
(run-frame-top-level (make-application-frame 'file-manager)))