本文整理汇总了PHP中Gtk::timeout_add方法的典型用法代码示例。如果您正苦于以下问题:PHP Gtk::timeout_add方法的具体用法?PHP Gtk::timeout_add怎么用?PHP Gtk::timeout_add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk
的用法示例。
在下文中一共展示了Gtk::timeout_add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
parent::__construct();
$this->connect('expose-event', array($this, 'expose'));
$this->connect('button-press-event', array($this, 'button_press'));
$this->connect('button-release-event', array($this, 'button_release'));
$this->connect('motion-notify-event', array($this, 'motion_notify'));
$this->add_events(Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::POINTER_MOTION_MASK);
$this->update();
Gtk::timeout_add(1000, array($this, 'update'));
}
示例2: iniciar
public function iniciar($telaCampo, $tempoMax)
{
//Só vai contar o tempo se o $tempoMax for diferente den null.
//É usado quando o usuário escolhe a opção sem tempo.
if ($tempoMax != null) {
$this->contar = True;
$this->tempoMax = $tempoMax;
$this->telaCampo = $telaCampo;
$this->barraProgresso = $telaCampo->campoXML->get_widget('barra_tempo');
Gtk::timeout_add(1000, array($this, "contarTempo"));
}
}
示例3: lista_senha
function lista_senha()
{
global $arraytotal, $posicao, $tamanho, $lblsenha, $lblultima, $ultima_p, $ultima_n, $ultima_s;
if (sizeof($arraytotal) == 0) {
$posicao = 0;
$tamanho = 0;
$tela = "";
echo "sizeof: {$tamanho}\n";
} else {
$tela = $arraytotal[$posicao][0] . " " . $arraytotal[$posicao][1];
completa_ultimas($arraytotal[$posicao]);
echo "tela: {$tela}";
}
if ($posicao == $tamanho) {
completa_array();
$posicao = 0;
echo "completando array\n";
} else {
$posicao = $posicao + 1;
echo "incrementando posicao\n";
echo "proxima posicao: {$posicao}\n";
}
$lblsenha->set_label($tela);
if (trim($tela) != "") {
Gtk::timeout_add(100, 'toca_tchuru');
}
$telaultima = "";
if ($ultima_p[2] > 0) {
$telaultima = $telaultima . $ultima_p[1] . " " . $ultima_p[2];
}
if ($ultima_s[2] > 0) {
$telaultima = $telaultima . $ultima_s[1] . " " . $ultima_s[2];
}
if ($ultima_n[2] > 0) {
$telaultima = $telaultima . $ultima_n[1] . " " . $ultima_n[2];
}
$lblultima->set_label($telaultima);
echo "setando label\n\n\n";
return true;
}
示例4: __construct
function __construct()
{
parent::__construct(XMONEY_TITULO . ' - ' . XMONEY_DESCRICAO . ' - ' . XMONEY_DESC_VERSAO, 800, 600, 'logo.png');
$this->connect('delete_event', array($this, delete_event));
// Painel
$this->pack_start($hpaned = new GtkHPaned());
$hpaned->pack1($this->painel = new TPainel($this), false, true);
// Notebook
$hpaned->pack2($this->notebook = new TNotebook($this), true, true);
// status
$this->pack_start($hbox = new GtkHBox(), false);
$hbox->pack_start($filial = new GtkLabel());
$filial->set_markup('<b> Filial: </b>' . $GLOBALS['Filial']);
$hbox->pack_start($usuario = new GtkLabel());
$usuario->set_markup('<b>' . latin1(' Usuário: ') . '</b>' . $GLOBALS['Usuario']);
$hbox->pack_start($nome = new GtkLabel());
$nome->set_markup('<b> Nome: </b>' . $GLOBALS['Nome']);
$hbox->pack_start($this->data = new GtkLabel());
$this->children_show_all();
Gtk::timeout_add(1000, array($this, 'data_timeout'));
define('XMONEY_JANELA_PRINCIPAL', $this);
}
示例5: pocitajtb
}
}
function pocitajtb()
{
#prepocet tb podla st. casu a chyb
}
load_startovka($cb[0]);
$p = current($G["astartovka"]);
show_vysledky($G['beh']->get_text(), $p[1]);
$window->show_all();
function show_display()
{
global $window2, $G;
$window2->show_all();
}
$timeout_ID = Gtk::timeout_add(10, 'process_task');
Gtk::main();
function buttonbp()
{
global $G;
if (prev($G["behy"])) {
$b = current($G["behy"]);
$G["beh"]->set_text($b[0]);
load_startovka($b[0]);
} else {
reset($G["behy"]);
$b = current($G["behy"]);
$G["beh"]->set_text($b[0]);
load_startovka($b[0]);
}
}
示例6: sin
$r = $radius + $radius / 3.0 * sin($f * 2.0 * pi());
$xpos = floor($xmid + $r * cos($ang) - $iw / 2.0 + 0.5);
$ypos = floor($ymid + $r * sin($ang) - $ih / 2.0 + 0.5);
$k = $i & 1 ? sin($f * 2.0 * pi()) : cos($f * 2.0 * pi());
$k = 2.0 * $k * $k;
$k = max(0.25, $k);
$r1 = new GdkRectangle($xpos, $ypos, $iw * $k, $ih * $k);
$r2 = new GdkRectangle(0, 0, $back_width, $back_height);
$dest = $r1->intersect($r2);
$images[$i]->composite($frame, $dest->x, $dest->y, $dest->width, $dest->height, $xpos, $ypos, $k, $k, Gdk::INTERP_NEAREST, $i & 1 ? max(127, abs(255 * sin($f * 2.0 * pi()))) : max(127, abs(255 * cos($f * 2.0 * pi()))));
}
$da->queue_draw();
$frame_num++;
return true;
}
$timeout_id = 0;
//pixbuf_init ();
if (!load_pixbufs()) {
die("main(): Could not load all the pixbufs!");
}
$frame = new GdkPixbuf(Gdk::COLORSPACE_RGB, false, 8, $back_width, $back_height);
$window = new GtkWindow(Gtk::WINDOW_TOPLEVEL);
$window->set_size_request($back_width, $back_height);
$window->set_resizable(false);
$window->connect_simple('destroy', array('gtk', 'main_quit'));
$da = new GtkDrawingArea();
$da->connect('expose_event', 'expose_cb');
$window->add($da);
Gtk::timeout_add(FRAME_DELAY, 'timeout');
$window->show_all();
Gtk::main();
示例7: onChanged
/**
* whenever the user types something
* the content is validated according to the mask
* @ignore-autocomplete on
*/
public function onChanged()
{
if ($this->mask) {
$text = parent::get_text();
// remove the separadtors
$text = $this->unMask($text);
$len = strlen(trim($text));
// apply the mask
$new = $this->Mask($this->mask, $text);
// schedule the new content.
Gtk::timeout_add(1, array($this, 'Set'), $new);
Gtk::timeout_add(1, array($this, 'validateMask'));
}
}
示例8: cb
<?php
/**
* The exception is not visible in the Gtk::main() loop
* But visible when doing the main_iteration - that's
* because of the while that is a php method.
*
* Change the "if (true)" into "if (false)" to see that
* the exception is thrown in the while loop
*/
function cb()
{
echo "Exception will be thrown next line\r\n";
throw new Exception('Will not get displayed anywhere');
}
Gtk::timeout_add(10, 'cb');
if (true) {
Gtk::main();
} else {
sleep(1);
while (Gtk::events_pending()) {
Gtk::main_iteration();
}
}
echo "done throwing exception\r\n";
示例9: start
/**
* Inicia a captura (atualização) dos frames
*
* @name start()
*/
public function start()
{
$this->make_snapshot();
$this->resTimer = Gtk::timeout_add(600, array($this, "make_snapshot"));
}
示例10: iniciarAtraso
public function iniciarAtraso()
{
Gtk::timeout_add(1000, array($this, "atrasarJogada"));
}
示例11: hide
/**
* Esconde a janela
*
* @name hide()
*/
public function hide()
{
// Inicia o looping para movimentação
Gtk::timeout_add(20, array($this, "__hideStep"));
}
示例12: onPreExecuteExitAction
/**
* Execute the exit action
*/
public function onPreExecuteExitAction()
{
Gtk::timeout_add(10, array($this, 'onExecuteExitAction'));
}
示例13: play
/**
* Inicia o video
*
* @name play
* @return boolean
*/
public function play()
{
// Verifica se o video ja foi iniciado
if ($this->video_state == -1) {
// Verifica se existe arquivo
if (!file_exists($this->render_file)) {
return FALSE;
}
// Verifica se o caminho do render existe
if (!file_exists($this->render_path)) {
echo "Não foi possivle encontrar " . $this->render_path;
return FALSE;
}
// Adiciona os ultimos parametros
$options = array_merge($this->render_options, array("-slave", "-quiet", "-menu", "-wid", $this->socket->get_id(), escapeshellarg($this->render_file)));
// Cria o pipe
$this->pipe = Fabula::PipeIO($this->render_path, $options);
// Cria o callback do stdout
$this->pipe->set_callback("stdout", array($this, "stdout"));
// Cria o callback do final do video
$this->pipe->set_callback("hup", array($this, "io_hup"));
// Inicia o video
$this->pipe->run();
// Muda o estado do video
$this->video_state = 1;
// Adiciona o timeout
$this->video_changed_timeout = Gtk::timeout_add(500, array($this, "video_changed"));
// Retorna verdadeiro
return TRUE;
} else {
// Retorna a falha
return FALSE;
}
}
示例14: __changeMask
/**
* Método change do entry ao mascarar
*
* @name __changeMask()
* @access private
* @author Pablo Dall'Oglio
*/
public function __changeMask()
{
// Armazena o texto do entry
$text = parent::get_text();
// Remove os separadores
$text = $this->__unMask($text);
// Aplica a máscara
$newText = $this->__reMask($text);
// Agendando a colocação do novo conteúdo
Gtk::timeout_add(1, array($this, "__setMask"), $newText);
Gtk::timeout_add(1, array($this, "__valMask"));
}
示例15: readSVG
function readSVG($file)
{
global $fields, $config, $timerSpin, $_navName, $_navIndex, $_btnNav, $fileList, $_btnNavRefresh, $i18n;
if (is_dir($file)) {
setTopBar($i18n->_('loadProblemsDir', basename($file)), Gtk::STOCK_DIALOG_WARNING);
return;
}
if (!file_exists($file)) {
setTopBar($i18n->_('loadProblems', basename($file)), Gtk::STOCK_DIALOG_WARNING);
return;
}
resetFields();
$_btnNavRefresh->set_sensitive(true);
// Enable refresh button with first (and every other) reading file
// Set navigation bar - it's done everytime file is loading to refresh directory, which could change meanwhile
$fileList['directory'] = dirname($file);
$fileList['currentFile'] = $file;
$fileList['globFix'] = strtr($fileList['directory'], ['[' => '[[]', ']' => '[]]']);
$fileList['list'] = glob($fileList['globFix'] . DIRECTORY_SEPARATOR . "*.[Ss][Vv][Gg]");
$fileList['total'] = count($fileList['list']);
$fileList['current'] = intval(array_search($file, $fileList['list'])) + 1;
$fileList['isLast'] = $fileList['current'] === $fileList['total'];
$fileList['isFirst'] = $fileList['current'] === 1;
// As index is set during loading, the destination files for nav buttons are set same time, to avoid weird behavior on directory change
if (!$fileList['isFirst']) {
$fileList['nav'][-2] = $fileList['list'][0];
$fileList['nav'][-1] = $fileList['list'][$fileList['current'] - 2];
}
if (!$fileList['isLast']) {
$fileList['nav'][1] = $fileList['list'][$fileList['current']];
$fileList['nav'][2] = $fileList['list'][$fileList['total'] - 1];
}
// For now navigation buttons don't loop, so turn off unusable and on usable
$_btnNav[-2]->set_sensitive(!$fileList['isFirst']);
$_btnNav[-1]->set_sensitive(!$fileList['isFirst']);
$_btnNav[1]->set_sensitive(!$fileList['isLast']);
$_btnNav[2]->set_sensitive(!$fileList['isLast']);
gtSetText($_navName, basename($file));
gtSetText($_navIndex, $fileList['current'] . '/' . $fileList['total']);
// That's to be changed, as SVG with embedded raster files aren't recognized as image/svg+xml
if (mime_content_type($file) === 'image/svg+xml') {
$fileList['properSVG'] = true;
if ($config['displayPreview']) {
// display preview only when it's visible, so people without Inkscape won't get errors
// Generate preview
$outputFile = $config['tempDirectory'] . DIRECTORY_SEPARATOR . uniqid('preview', true) . '.png';
$previewArea = ['page', 'drawing'];
$cmdPreview = '--export-area-' . $previewArea[$config['previewArea']];
if (!empty($timerSpin)) {
Gtk::timeout_remove($timerSpin);
}
// needed for navigating to other file before preview is done
$timerSpin = Gtk::timeout_add(250, 'timerSpin', $outputFile);
// checking for Inkscape preview to be done
spinnerToggle(true);
// This command runs asynchronously two synchronous commands, so _after_ Inkscape is done it
// creates an empty file, so app would know when file is ready.
$asynchFix = detectOS(HK_OS_WINDOWS) ? "& type nul >>\"{$outputFile}.nul\"" : "&& touch \"{$outputFile}.nul\"";
execQuiet("\"{$config['inkscapePath']}\" --file=\"{$file}\" -w=200 {$cmdPreview} --export-png=\"{$outputFile}\" {$asynchFix}", true);
}
// Get SVG metadata
$meta = getSVGMetadata($file);
if (!$meta) {
// Parsing metadata error
setTopBar(sprintf(_('%s metadata not found'), basename($file)), Gtk::STOCK_CAPS_LOCK_WARNING);
return;
}
// Parsing metadata ok
foreach ($fields as $id) {
gtSetText("_entry{$id}", $meta[$id]);
}
setTopBar(sprintf(_('%s parsed'), basename($file)), Gtk::STOCK_APPLY);
} else {
// Not SVG file
$fileList['properSVG'] = false;
setTopBar($i18n->_('loadIncorrectSVG', basename($file)), Gtk::STOCK_DIALOG_WARNING);
}
$fileList['loadedFile'] = true;
}