-
-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy path01-dialog.php
More file actions
23 lines (19 loc) · 1.02 KB
/
01-dialog.php
File metadata and controls
23 lines (19 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php
require __DIR__ . '/../vendor/autoload.php';
$launcher = new Clue\React\Zenity\Launcher();
$q = new Clue\React\Zenity\Dialog\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 Clue\React\Zenity\Dialog\InfoDialog('Welcome to the introduction of zenity, ' . $name))->then(function () use ($launcher) {
$launcher->launch(new Clue\React\Zenity\Dialog\QuestionDialog('Do you want to quit?'))->then(function () use ($launcher) {
$launcher->launch(new Clue\React\Zenity\Dialog\ErrorDialog('Oh noes!'));
}, function() use ($launcher) {
$launcher->launch(new Clue\React\Zenity\Dialog\WarningDialog('You should have selected yes!'));
});
}, function (Exception $e) {
echo 'Error: ' . $e->getMessage() . PHP_EOL;
});
}, function () use ($launcher) {
$launcher->launch(new Clue\React\Zenity\Dialog\WarningDialog('No name given'));
});