-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #66 from yadaiio/Improve_documentation_and_examples
Improve documentation and examples
- Loading branch information
Showing
9 changed files
with
55 additions
and
66 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,28 +1,23 @@ | ||
<?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(); | ||
$launcher = new Clue\React\Zenity\Launcher(); | ||
|
||
$q = new EntryDialog('What\'s your name?'); | ||
$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 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!')); | ||
$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 WarningDialog('You should have selected yes!')); | ||
$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 WarningDialog('No name given')); | ||
$launcher->launch(new Clue\React\Zenity\Dialog\WarningDialog('No name given')); | ||
}); |
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,25 +1,24 @@ | ||
<?php | ||
|
||
use Clue\React\Zenity\Launcher; | ||
use Clue\React\Zenity\Dialog\FileSelectionDialog; | ||
use Clue\React\Zenity\Builder; | ||
use Clue\React\Zenity\Dialog\InfoDialog; | ||
|
||
require __DIR__ . '/../vendor/autoload.php'; | ||
|
||
$launcher = new Launcher(); | ||
$builder = new Builder(); | ||
$launcher = new Clue\React\Zenity\Launcher(); | ||
$builder = new Clue\React\Zenity\Builder(); | ||
|
||
$launcher->launch($builder->fileSelection())->then(function (SplFileInfo $file) use ($launcher) { | ||
var_dump($file); | ||
|
||
$launcher->launch(new InfoDialog('Selected "' . $file->getFilename() . '". Re-opening dialog with same selection'))->then(function () use ($file, $launcher) { | ||
$selection = new FileSelectionDialog(); | ||
$launcher->launch(new Clue\React\Zenity\Dialog\InfoDialog('Selected "' . $file->getFilename() . '". Re-opening dialog with same selection'))->then(function () use ($file, $launcher) { | ||
$selection = new Clue\React\Zenity\Dialog\FileSelectionDialog(); | ||
$selection->setFilename($file); | ||
$selection->setTitle('Pretend we\'re overwriting the file'); | ||
$selection->setConfirmOverwrite(true); | ||
$selection->setSave(true); | ||
|
||
$launcher->launch($selection); | ||
}, function (Exception $e) { | ||
echo 'Error: ' . $e->getMessage() . PHP_EOL; | ||
}); | ||
}, function (Exception $e) { | ||
echo 'Error: ' . $e->getMessage() . PHP_EOL; | ||
}); |
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
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
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