me
/
guix
Archived
1
0
Fork 0

installer: Limit listbox height.

Fixes: <https://issues.guix.gnu.org/44428>.

* gnu/installer/newt.scm (init): Print screen size.
* gnu/installer/newt/page.scm (default-listbox-height): New variable.
(run-listbox-selection-page): Use it.
* gnu/installer/newt/wifi.scm (wifi-listbox-height): Ditto.
* gnu/installer/newt/network.scm (run-technology-page): Set the maximum
listbox height to 5.
* gnu/installer/newt/ethernet.scm (run-ethernet-page): Ditto.
* gnu/installer/newt/final.scm (run-config-display-page): Change listbox
height.
* gnu/installer/newt/partition.scm (run-disk-page): Ditto.
* gnu/installer/newt/welcome.scm (display-logo?): New procedure.
(run-menu-page): Use it.
* gnu/installer/steps.scm (%configuration-file-width): Remove it.
master
Mathieu Othacehe 2020-11-06 10:59:54 +01:00
parent afa77bd228
commit ae0fe289d3
No known key found for this signature in database
GPG Key ID: 8354763531769CA6
9 changed files with 24 additions and 12 deletions

View File

@ -46,6 +46,7 @@
(newt-init) (newt-init)
(clear-screen) (clear-screen)
(set-screen-size!) (set-screen-size!)
(syslog "Display is ~ax~a.~%" (screen-columns) (screen-rows))
(push-help-line (push-help-line
(format #f (G_ "Press <F1> for installation parameters.")))) (format #f (G_ "Press <F1> for installation parameters."))))

View File

@ -77,7 +77,7 @@ connection is pending."
#:title (G_ "Ethernet connection") #:title (G_ "Ethernet connection")
#:listbox-items services #:listbox-items services
#:listbox-item->text ethernet-service->text #:listbox-item->text ethernet-service->text
#:listbox-height (min (+ (length services) 2) 10) #:listbox-height (min (+ (length services) 2) 5)
#:button-text (G_ "Exit") #:button-text (G_ "Exit")
#:button-callback-procedure #:button-callback-procedure
(lambda _ (lambda _

View File

@ -40,9 +40,8 @@
file)) file))
(define* (run-config-display-page #:key locale) (define* (run-config-display-page #:key locale)
(let ((width (%configuration-file-width)) (let ((width (max 70 (- (screen-columns) 20)))
(height (nearest-exact-integer (height (default-listbox-height)))
(/ (screen-rows) 2))))
(run-file-textbox-page (run-file-textbox-page
#:info-text (format #f (G_ "\ #:info-text (format #f (G_ "\
We're now ready to proceed with the installation! \ We're now ready to proceed with the installation! \

View File

@ -80,7 +80,7 @@ network devices were found. Do you want to continue anyway?"))
#:title (G_ "Internet access") #:title (G_ "Internet access")
#:listbox-items items #:listbox-items items
#:listbox-item->text technology->text #:listbox-item->text technology->text
#:listbox-height (min (+ (length items) 2) 10) #:listbox-height (min (+ (length items) 2) 5)
#:button-text (G_ "Exit") #:button-text (G_ "Exit")
#:button-callback-procedure #:button-callback-procedure
(lambda _ (lambda _

View File

@ -32,7 +32,9 @@
#:use-module (srfi srfi-34) #:use-module (srfi srfi-34)
#:use-module (srfi srfi-35) #:use-module (srfi srfi-35)
#:use-module (newt) #:use-module (newt)
#:export (draw-info-page #:export (default-listbox-height
draw-info-page
draw-connecting-page draw-connecting-page
run-input-page run-input-page
run-error-page run-error-page
@ -168,6 +170,10 @@ Like 'run-form', return two values: the exit reason, and an \"argument\"."
(_ (_
(values reason argument)))))) (values reason argument))))))
(define (default-listbox-height)
"Return the default listbox height."
(max 5 (- (screen-rows) 20)))
(define (draw-info-page text title) (define (draw-info-page text title)
"Draw an informative page with the given TEXT as content. Set the title of "Draw an informative page with the given TEXT as content. Set the title of
this page to TITLE." this page to TITLE."
@ -339,7 +345,8 @@ of the page is set to TITLE."
(info-textbox-width 50) (info-textbox-width 50)
listbox-items listbox-items
listbox-item->text listbox-item->text
(listbox-height 20) (listbox-height
(default-listbox-height))
(listbox-default-item #f) (listbox-default-item #f)
(listbox-allow-multiple? #f) (listbox-allow-multiple? #f)
(sort-listbox-items? #t) (sort-listbox-items? #t)

View File

@ -681,7 +681,7 @@ by pressing the Exit button.~%~%")))
(G_ "Guided partitioning") (G_ "Guided partitioning")
(G_ "Manual partitioning")) (G_ "Manual partitioning"))
#:info-textbox-width 76 ;we need a lot of room for INFO-TEXT #:info-textbox-width 76 ;we need a lot of room for INFO-TEXT
#:listbox-height 12 #:listbox-height (max 5 (- (screen-rows) 30))
#:listbox-items (disk-items) #:listbox-items (disk-items)
#:listbox-item->text cdr #:listbox-item->text cdr
#:sort-listbox-items? #f #:sort-listbox-items? #f

View File

@ -38,6 +38,9 @@
(define info-textbox-width (make-parameter 70)) (define info-textbox-width (make-parameter 70))
(define options-listbox-height (make-parameter 5)) (define options-listbox-height (make-parameter 5))
(define (display-logo?)
(> (screen-rows) 35))
(define* (run-menu-page title info-text logo (define* (run-menu-page title info-text logo
#:key #:key
listbox-items listbox-items
@ -55,7 +58,10 @@ we want this page to occupy all the screen space available."
items)) items))
(let* ((logo-textbox (let* ((logo-textbox
(make-textbox -1 -1 (logo-width) (logo-height) 0)) (make-textbox -1 -1
(if (display-logo?) (logo-width) 0)
(if (display-logo?) (logo-height) 0)
0))
(info-textbox (info-textbox
(make-reflowed-textbox -1 -1 (make-reflowed-textbox -1 -1
info-text info-text

View File

@ -165,7 +165,8 @@ of <service-item> records present in LISTBOX."
(define service-name-max-length (make-parameter 20)) (define service-name-max-length (make-parameter 20))
;; Height of the listbox displaying wifi services. ;; Height of the listbox displaying wifi services.
(define wifi-listbox-height (make-parameter 20)) (define wifi-listbox-height (make-parameter
(default-listbox-height)))
;; Information textbox width. ;; Information textbox width.
(define info-textbox-width (make-parameter 40)) (define info-textbox-width (make-parameter 40))

View File

@ -50,7 +50,6 @@
%installer-configuration-file %installer-configuration-file
%installer-target-dir %installer-target-dir
%configuration-file-width
format-configuration format-configuration
configuration->file)) configuration->file))
@ -218,7 +217,6 @@ stored in RESULTS. Return #f otherwise."
(define %installer-configuration-file (make-parameter "/mnt/etc/config.scm")) (define %installer-configuration-file (make-parameter "/mnt/etc/config.scm"))
(define %installer-target-dir (make-parameter "/mnt")) (define %installer-target-dir (make-parameter "/mnt"))
(define %configuration-file-width (make-parameter 79))
(define (format-configuration steps results) (define (format-configuration steps results)
"Return the list resulting from the application of the procedure defined in "Return the list resulting from the application of the procedure defined in