forked from clue/reactphp-zenity
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path01-dialog.php
More file actions
28 lines (23 loc) · 1.01 KB
/
01-dialog.php
File metadata and controls
28 lines (23 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
use Clue\React\Zenity\Launcher;
use Clue\React\Zenity\Dialog\InfoDialog;
use Clue\React\Zenity\Dialog\QuestionDialog;
use Clue\React\Zenity\Dialog\ErrorDialog;
use Clue\React\Zenity\Dialog\EntryDialog;
use Clue\React\Zenity\Dialog\WarningDialog;
require __DIR__ . '/../vendor/autoload.php';
$launcher = new Launcher();
$q = new EntryDialog('What\'s your name?');
$q->setEntryText(getenv('USER'));
$q->setTitle('Enter your name');
$launcher->launch($q)->then(function ($name) use ($launcher) {
$launcher->launch(new InfoDialog('Welcome to the introduction of zenity, ' . $name))->then(function () use ($launcher) {
$launcher->launch(new QuestionDialog('Do you want to quit?'))->then(function () use ($launcher) {
$launcher->launch(new ErrorDialog('Oh noes!'));
}, function() use ($launcher) {
$launcher->launch(new WarningDialog('You should have selected yes!'));
});
});
}, function () use ($launcher) {
$launcher->launch(new WarningDialog('No name given'));
});