-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated tui.php to add new widgets and infinitely draw the display. Also, changed the php-tui dependence in composer.json from a specific version to the development branch. This commit has extensive updates to the terminal user interface, enhancing the features and functionality.
- Loading branch information
1 parent
b223371
commit 1d69ffe
Showing
2 changed files
with
94 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,107 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
/** | ||
* This file is part of Cloud-Admin project. | ||
* | ||
* @link https://www.cloud-admin.jayjay.cn | ||
* @document https://wiki.cloud-admin.jayjay.cn | ||
* @license https://github.com/swow-cloud/swow-admin/blob/master/LICENSE | ||
*/ | ||
|
||
use PhpTui\Tui\DisplayBuilder; | ||
use PhpTui\Tui\Extension\Core\Shape\MapResolution; | ||
use PhpTui\Tui\Extension\Core\Shape\MapShape; | ||
use PhpTui\Tui\Extension\Core\Widget\Block\Padding; | ||
use PhpTui\Tui\Extension\Core\Widget\BlockWidget; | ||
use PhpTui\Tui\Extension\Core\Widget\CanvasWidget; | ||
use PhpTui\Tui\Extension\Core\Widget\GridWidget; | ||
use PhpTui\Tui\Extension\Core\Widget\ParagraphWidget; | ||
use PhpTui\Tui\Model\Direction; | ||
use PhpTui\Tui\Model\Layout\Constraint; | ||
use PhpTui\Tui\Model\Text\Text; | ||
use PhpTui\Tui\Model\Text\Title; | ||
use PhpTui\Tui\Model\Widget\Borders; | ||
use PhpTui\Tui\Model\Widget\BorderType; | ||
|
||
require 'vendor/autoload.php'; | ||
|
||
$display = DisplayBuilder::default()->build(); | ||
$display->clear(); | ||
$display->draw( | ||
CanvasWidget::fromIntBounds(-180, 180, -90, 90) | ||
->draw( | ||
MapShape::default()->resolution(MapResolution::High) | ||
GridWidget::default() | ||
->direction(Direction::Horizontal) | ||
->constraints( | ||
Constraint::percentage(50), | ||
Constraint::percentage(50) | ||
) | ||
->widgets( | ||
BlockWidget::default() | ||
->titles(Title::fromString('Left')) | ||
->padding(Padding::all(2)) | ||
->borders(Borders::ALL) | ||
->borderType(BorderType::Rounded) | ||
->widget( | ||
CanvasWidget::fromIntBounds(-180, 180, -90, 90) | ||
->draw( | ||
MapShape::default()->resolution(MapResolution::High) | ||
), | ||
), | ||
BlockWidget::default() | ||
->titles(Title::fromString('Right')) | ||
->padding(Padding::all(2)) | ||
->borders(Borders::ALL) | ||
->borderType(BorderType::Rounded) | ||
->widget( | ||
ParagraphWidget::fromText( | ||
Text::parse(<<<'EOT' | ||
The <fg=green>world</> is the totality of <options=bold>entities</>, | ||
the whole of reality, or everything that is.[1] The nature of the | ||
world has been <fg=red>conceptualized</> differently in different fields. Some | ||
conceptions see the world as unique while others talk of a | ||
plurality of <bg=green>worlds</>. | ||
EOT | ||
) | ||
) | ||
), | ||
) | ||
); | ||
$i = 0; | ||
while (true) { | ||
$i++; | ||
if ($i > 100) { | ||
break; | ||
} | ||
$display->draw( | ||
GridWidget::default() | ||
->direction(Direction::Horizontal) | ||
->constraints( | ||
Constraint::percentage(50), | ||
Constraint::percentage(50) | ||
) | ||
->widgets( | ||
BlockWidget::default() | ||
->titles(Title::fromString('Left')) | ||
->padding(Padding::all(2)) | ||
->borders(Borders::ALL) | ||
->borderType(BorderType::Rounded) | ||
->widget( | ||
CanvasWidget::fromIntBounds(-180, 180, -90, 90) | ||
->draw( | ||
MapShape::default()->resolution(MapResolution::High) | ||
), | ||
), | ||
BlockWidget::default() | ||
->titles(Title::fromString('Right')) | ||
->padding(Padding::all(2)) | ||
->borders(Borders::ALL) | ||
->borderType(BorderType::Rounded) | ||
->widget( | ||
ParagraphWidget::fromText( | ||
Text::parse(<<<'EOT' | ||
The <fg=green>world</> is the totality of <options=bold>entities</>, | ||
the whole of reality, or everything that is.[1] The nature of the | ||
world has been <fg=red>conceptualized</> differently in different fields. Some | ||
conceptions see the world as unique while others talk of a | ||
plurality of <bg=green>worlds</>. | ||
EOT | ||
) | ||
) | ||
), | ||
) | ||
); | ||
sleep(3); | ||
} |