[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
19/26: installer: Add a popup window for forms which have multiple choic
From: |
John Darrington |
Subject: |
19/26: installer: Add a popup window for forms which have multiple choice fields. |
Date: |
Sun, 22 Jan 2017 12:09:25 +0000 (UTC) |
jmd pushed a commit to branch wip-installer
in repository guix.
commit b162fa99b1db6759decb8dd43d1931c354808764
Author: John Darrington <address@hidden>
Date: Thu Jan 19 15:58:16 2017 +0100
installer: Add a popup window for forms which have multiple choice fields.
* gnu/system/installer/mount-point.scm (mount-point-page-init): Make all
windows
panels.
* gnu/system/installer/utils.scm (make-boxed-window): Make all windows
panels.
* gurses/form.scm (form-set-current-field, form-post, make-form): hide/show
popup window when the relevant field is selected.
---
gnu/system/installer/mount-point.scm | 4 ++--
gnu/system/installer/utils.scm | 3 +--
gurses/form.scm | 29 ++++++++++++++++++++++++++++-
3 files changed, 31 insertions(+), 5 deletions(-)
diff --git a/gnu/system/installer/mount-point.scm
b/gnu/system/installer/mount-point.scm
index 598d9bf..fe060a1 100644
--- a/gnu/system/installer/mount-point.scm
+++ b/gnu/system/installer/mount-point.scm
@@ -102,12 +102,12 @@
#:title (page-title p)))
(text-window (derwin (inner pr) 3 (getmaxx (inner pr))
- 0 0 #:panel #f))
+ 0 0 #:panel #t))
(bwin (derwin (inner pr)
3 (getmaxx (inner pr))
(- (getmaxy (inner pr)) 3) 0
- #:panel #f))
+ #:panel #t))
(nav (make-buttons my-buttons 1))
diff --git a/gnu/system/installer/utils.scm b/gnu/system/installer/utils.scm
index 6bd10f3..47b8cd7 100644
--- a/gnu/system/installer/utils.scm
+++ b/gnu/system/installer/utils.scm
@@ -284,8 +284,7 @@ which will process each string before returning it."
pair whose car is the inner window and whose cdr is the frame."
(let* ((win (if orig
(derwin orig height width starty startx #:panel #f)
- (newwin height width starty startx #:panel #f)
- ))
+ (newwin height width starty startx #:panel #f)))
(ystart (if title 3 1))
(sw (derwin win (- (getmaxy win) ystart 1)
(- (getmaxx win) 2)
diff --git a/gurses/form.scm b/gurses/form.scm
index 25ed4ff..2e8c242 100644
--- a/gurses/form.scm
+++ b/gurses/form.scm
@@ -33,6 +33,7 @@
#:export (get-current-field)
#:use-module (ncurses curses)
+ #:use-module (ncurses panel)
#:use-module (ice-9 match)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-9))
@@ -135,7 +136,7 @@ label eq? to N"
(make-field symbol label width things
(let ((p
(newwin (+ 2 (length
things))
- (+ 2 width) 0 0
#:panel #t)))
+ (+ 2 width) 0 0
#:panel #f)))
(box p 0 0)
(let loop ((ll things)
(y 0))
@@ -234,10 +235,24 @@ label eq? to N"
(refresh (form-window form)))))
+(define (ensure-panel! win)
+ (if (not (panel? win))
+ (make-panel! win)))
+
(define (form-set-current-field form which)
+ (let* ((old-field (get-current-field form))
+ (popup (field-popup old-field)))
+ (when popup
+ (hide-panel popup)))
(form-set-current-item! form which)
+ (let* ((new-field (array-ref (form-items form) which))
+ (popup (field-popup new-field)))
+ (when popup
+ (ensure-panel! popup)
+ (show-panel popup)))
(move (form-window form) which (form-tabpos form)))
+
(define (form-next-field form)
(if (< (form-current-item form) (1- (array-length (form-items form))))
(begin
@@ -267,6 +282,18 @@ label eq? to N"
(form-set-tabpos! form xpos)
+ (let loop ((fields (form-items form))
+ (pos 0))
+ (when (array-in-bounds? fields pos)
+ (let* ((f (array-ref fields pos))
+ (p (field-popup f)))
+ (when p
+ (ensure-panel! win)
+ (mvwin p
+ (+ (getbegy win) pos)
+ (+ (form-tabpos form) (getbegx win))))
+ (loop fields (1+ pos)))))
+
;; Print the field entry areas
(let loop ((fields (form-items form))
(pos 0))
- 03/26: installer: Do not allow the creation of invalid file-system specificaitons., (continued)
- 03/26: installer: Do not allow the creation of invalid file-system specificaitons., John Darrington, 2017/01/22
- 15/26: gurses: Allow menu update to work for panel windows., John Darrington, 2017/01/22
- 18/26: gurses: Populate the choices box in forms., John Darrington, 2017/01/22
- 06/26: installer: Add an explanatory text to the main page., John Darrington, 2017/01/22
- 22/26: installer: mount-points page: Enlarge the forms window., John Darrington, 2017/01/22
- 13/26: installer: Remove unnecessary "begin"., John Darrington, 2017/01/22
- 24/26: installer: Remove redundant list of file system types., John Darrington, 2017/01/22
- 20/26: gurses: Populate dropdown boxes in forms using a menu., John Darrington, 2017/01/22
- 12/26: installer: Fix bug in config generation., John Darrington, 2017/01/22
- 26/26: doc: Remove the text which mentions there is no graphical installer., John Darrington, 2017/01/22
- 19/26: installer: Add a popup window for forms which have multiple choice fields.,
John Darrington <=
- 16/26: gurses: Mini refactor., John Darrington, 2017/01/22
- 09/26: installer: Explicitly set the #:panel parameter for window creation procedures., John Darrington, 2017/01/22
- 11/26: installer: New procedure refresh*., John Darrington, 2017/01/22
- 23/26: gurses: Remove box from form popup window., John Darrington, 2017/01/22