From bf6655a534a6775d30cafa67bd801276bda1d98d Mon Sep 17 00:00:00 2001 From: polo Date: Tue, 13 Aug 2024 23:45:21 +0200 Subject: =?UTF-8?q?VERSION=200.2=20doctrine=20ORM=20et=20entit=C3=A9s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/view/Zenity.php | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) (limited to 'src/view/Zenity.php') diff --git a/src/view/Zenity.php b/src/view/Zenity.php index 858dfa9..9e0fd1c 100644 --- a/src/view/Zenity.php +++ b/src/view/Zenity.php @@ -6,12 +6,12 @@ abstract class ZenityCmd { - protected $command = 'zenity'; - protected $command_type = ''; - protected $rows = []; - protected $text = ''; - protected $width = 300; - protected $height = 200; // recalculée en fonction du contenu, vaut au minimum 150 + protected string $command = 'zenity'; + protected string $command_type; + protected array $rows; + protected string $text; + protected int $width = 300; + protected int $height = 200; // recalculée en fonction du contenu, vaut au minimum 150 protected function __construct(string $text, array $rows = []) // $rows est optionnel { @@ -22,15 +22,11 @@ abstract class ZenityCmd $this->command .= ' --text="' . $this->text . '"'; } - public function get() + public function get(): string { + //echo $this->command . "\n"; return($this->command); } - // pré-remlir un formulaire zenity --forms - //~ public function formSet() - //~ { - //~ return($this->command); - //~ } } @@ -46,7 +42,7 @@ class ZenityList extends ZenityCmd $this->command .= ' --hide-header'; // ligne inutile, il y a déjà le --text if($this->rows !== []) { - $this->command .= ' --width=' . $this->width; + $this->command .= ' --width=' . (string)$this->width; $this->height = 80 + count($this->rows) * 25; $this->command .= ' --height=' . $this->height; $this->fillZenityList(); @@ -65,8 +61,8 @@ class ZenityList extends ZenityCmd $this->width = $this->columns * 120 * $widen; $this->height = 91 + count($this->rows) * 25; // inclut les lignes et la barre de défilement horizontale - $this->command .= ' --width=' . $this->width; - $this->command .= ' --height=' . $this->height; + $this->command .= ' --width=' . (string)$this->width; + $this->command .= ' --height=' . (string)$this->height; $this->fillZenityList(); } @@ -103,11 +99,11 @@ class ZenityList extends ZenityCmd $this->command .= $output; } - public function cleanCommand() + /*public function cleanCommand() { $this->command = 'zenity'; $this->__construct($this->text); - } + }*/ } class ZenityQuestion extends ZenityCmd @@ -131,7 +127,7 @@ class ZenityForms extends ZenityCmd $this->command_type = ' --forms'; parent::__construct($text, $rows); //$this->height = 80 + count($this->rows) * 25; // à tester, mais devrait produire le rendu attendu - self::entriesZenityForms($this->rows); + $this->entriesZenityForms($this->rows); } private function entriesZenityForms(array $input) -- cgit v1.2.3