[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
123/197: installer: Add a popup window for forms which have multiple cho
From: |
Danny Milosavljevic |
Subject: |
123/197: installer: Add a popup window for forms which have multiple choice fields. |
Date: |
Mon, 3 Jul 2017 20:37:11 -0400 (EDT) |
dannym pushed a commit to branch wip-installer-2
in repository guix.
commit 621cfad6360a0cf3da21f7ecc8fb7cbd0fdbea3c
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))
- 95/197: installer: Add a predicate to ensure the partitions have been formatted., (continued)
- 95/197: installer: Add a predicate to ensure the partitions have been formatted., Danny Milosavljevic, 2017/07/03
- 102/197: installer: Correct bug where the timezone page returned to the wrong page., Danny Milosavljevic, 2017/07/03
- 119/197: gurses: Allow menu update to work for panel windows., Danny Milosavljevic, 2017/07/03
- 103/197: installer: Avoid exception when the device to format cannot be found., Danny Milosavljevic, 2017/07/03
- 116/197: installer: Fix bug in config generation., Danny Milosavljevic, 2017/07/03
- 105/197: installer: Extend the 'file-system' concept to include swap spaces., Danny Milosavljevic, 2017/07/03
- 83/197: installer: "Setup" --> "Set up", Danny Milosavljevic, 2017/07/03
- 92/197: installer: Remove mkfs capability from mount points page., Danny Milosavljevic, 2017/07/03
- 118/197: installer: Distinguish between Wifi encryption methods., Danny Milosavljevic, 2017/07/03
- 127/197: gurses: Remove box from form popup window., Danny Milosavljevic, 2017/07/03
- 123/197: installer: Add a popup window for forms which have multiple choice fields.,
Danny Milosavljevic <=
- 121/197: installer: Note which types of file system are supported., Danny Milosavljevic, 2017/07/03
- 141/197: gurses: Avoid one usage of car and cdr., Danny Milosavljevic, 2017/07/03
- 151/197: installer: Avoid wpa_supplicant's output causing screen damage., Danny Milosavljevic, 2017/07/03
- 99/197: installer: Exit the format page after all partitions are successfully formatted., Danny Milosavljevic, 2017/07/03
- 101/197: installer: Replace one usage of car with match., Danny Milosavljevic, 2017/07/03
- 109/197: installer: Fix bug where the selected item of main page was not indicated., Danny Milosavljevic, 2017/07/03
- 104/197: installer: Support btrfs, Danny Milosavljevic, 2017/07/03
- 111/197: gurses: Change highlighting from bold to inverse., Danny Milosavljevic, 2017/07/03
- 108/197: installer: Do not add file systems which are invalid., Danny Milosavljevic, 2017/07/03
- 164/197: gurses: Use match instead of car., Danny Milosavljevic, 2017/07/03