public function iniciarGUI() { $this->conectarCampo(); //começa a contar o tempo $this->tempo->iniciar($this, $this->tempoMax); Gtk::main(); }
/** * Close (hide) this window * */ public function close() { $this->window->hide_all(); if ($this->initialized) { Gtk::main_quit(); } }
public function run() { $gladefile = BASEDIR . '/data/explorer.glade'; $config = \Explorer\Config::getInstance(); $main = new \Explorer\Controller\MainWindowController($gladefile); \Gtk::Main(); }
function on_menu_select($menu_item) { $item = $menu_item->child->get_label(); echo "menu selected: {$item}\n"; if ($item == '_Quit') { Gtk::main_quit(); } }
function on_menu_select($button, $item) { // note 8 echo "menu item selected: {$item}\n"; if ($item == '_Quit') { Gtk::main_quit(); } }
function ExecXMoney() { CheckSistema(); ExecWizard(); ExecLogin(); ExecJanelaPrincipal(); Gtk::main(); }
function __construct() { require_once "knj/class_knj_eventmanager.php"; $this->em = new EventManager(); $this->em->addEvent(array("mouseclick", "north", "east", "south", "west", "northeast", "northwest", "southeast", "southwest")); $this->proc = fopen("/dev/input/mice", "r") or die; Gtk::io_add_watch($this->proc, GObject::IO_IN, array($this, "on_mouseevent_do")); }
function xmoney_close_clicked() { $dialog = new Question($this->Owner, 'Sair do X-Money?'); $result = $dialog->ask(); if ($result != Gtk::RESPONSE_YES) { return; } Gtk::main_quit(); }
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')); }
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")); } }
public function init(GtkFrame $userList, GtkFrame $userForm, GtkFrame $rolePanel) { $mainVBox = new GtkVBox(false, 10); $mainHBox = new GtkHBox(true, 10); $mainVBox->pack_start($userList, true, true, 0); $mainHBox->pack_start($userForm, true, true, 0); $mainHBox->pack_start($rolePanel, true, true, 0); $mainVBox->pack_start($mainHBox, false, false, 0); $this->window->add($mainVBox); $this->window->show_all(); Gtk::main(); }
function __create_box() { $iv = new GtkIconView(); $model = new GtkListStore(GdkPixbuf::gtype, GObject::TYPE_STRING); $iv->set_model($model); $iv->set_columns(1); $ids = Gtk::stock_list_ids(); sort($ids); foreach ($ids as $id) { $pixbuf = $iv->render_icon($id, Gtk::ICON_SIZE_DIALOG); $model->set($model->append(), 0, $pixbuf, 1, $id); } $iv->set_pixbuf_column(0); $iv->set_text_column(1); //multi select incl. zooming up an rectangle to select icons $iv->set_selection_mode(Gtk::SELECTION_MULTIPLE); //labels at the right side $iv->set_orientation(Gtk::ORIENTATION_HORIZONTAL); //enough place for the text so that it doesn't wrap $iv->set_item_width(200); //spacing between icon and label $iv->set_spacing(0); //spacing between single rows $iv->set_row_spacing(0); //spacing between cols //margin from the edges of the view widget -> like the CSS margin property $iv->set_margin(5); //in how many columns the view will be split //Icon order (for 3 columns): // 1 2 3 // 4 5 6 //FIXME: is there a way to arrange it horizontally so that it's arranged that way: // 1 4 7 // 2 5 8 // 3 6 9 ? //0 is auto-fit $iv->set_columns(0); $editor = new WidgetEditor($iv, array(array('selection_mode', GtkComboBox::gtype, 'Gtk::SELECTION_'), array('orientation', GtkComboBox::gtype, 'Gtk::ORIENTATION_'), array('item_width', GtkScale::gtype, 0, 500), array('spacing', GtkScale::gtype, -100, 100), array('row_spacing', GtkScale::gtype, -100, 100), array('column_spacing', GtkScale::gtype, -100, 100), array('margin', GtkScale::gtype, -100, 200), array('columns', GtkScale::gtype, 0, 20))); $scrollwin = new GtkScrolledWindow(); $scrollwin->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); $scrollwin->add($iv); return $scrollwin; }
public function __construct($file) { $this->loadGlade($file); $this->mainWindow = new \Explorer\GUI\MainWindow($this); $status = $this->glade->get_widget('loadingprogress'); $r = new \ReflectionObject($this); $methods = iterator_to_array(new InitFuncFilterIterator(new \ArrayIterator($r->getMethods()))); $count = count($methods); $i = 0; foreach ($methods as $method) { $this->{$method}(); $status->set_pulse_step(++$i / $count); while (\Gtk::events_pending()) { \Gtk::main_iteration(); } } $this->glade->get_widget('loadingwindow')->set_visible(false); $this->mainWindow->show(); }
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; }
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); }
private function create_model() { $store = new GtkListStore(GObject::TYPE_PHP_VALUE, GObject::TYPE_STRING); $ids = Gtk::stock_list_ids(); sort($ids); foreach ($ids as $id) { $info = new StockItemInfo($id); $stock_item = Gtk::stock_lookup($id); if ($stock_item) { $info->stock_item = $stock_item; } else { $info->stock_item = array('', '', 0, 0, ''); } $icon_set = GtkIconFactory::lookup_default($id); if ($icon_set) { $sizes = $icon_set->get_sizes(); $size = $sizes[0]; for ($i = 0; $i < count($sizes); $i++) { if ($sizes[$i] == Gtk::ICON_SIZE_MENU) { $size = Gtk::ICON_SIZE_MENU; break; } } $info->small_icon = $this->render_icon($info->stock_id, $size); if ($size != Gtk::ICON_SIZE_MENU) { list($width, $height) = Gtk::icon_size_lookup(Gtk::ICON_SIZE_MENU); $info->small_icon = $info->small_icon->scale_simple($width, $height, 'bilinear'); } } else { $info->small_icon = null; } if ($info->stock_item[3] == 0) { $info->accel_str = ''; } else { $info->accel_str = '<' . Gtk::accelerator_get_label($info->stock_item[3], $info->stock_item[2]) . '>'; } $iter = $store->append(); $store->set($iter, 0, $info, 1, $id); } return $store; }
function CloseWindow(){ Gtk::main_quit(); }
/** * Método que libera o loop principal do Gtk * * @name DoEvents() */ public function DoEvents() { // Espera enquanto existe evento pendente while (Gtk::events_pending()) { // Libera o loop Gtk::main_iteration(); } }
* Executado quando usuário clica no botão salvar */ public function onSaveClick() { // obtém os valores dos campos $dados['id'] = $this->campos['id']->get_text(); $dados['nome'] = $this->campos['nome']->get_text(); $dados['endereco'] = $this->campos['endereco']->get_text(); $dados['telefone'] = $this->campos['telefone']->get_text(); $dados['id_cidade'] = $this->campos['id_cidade']->get_active(); try { // instancia cliente SOAP $client = new SoapClient(NULL, array('encoding' => 'ISO-8859-1', 'exceptions' => TRUE, 'location' => "http://127.0.0.1/server.php", 'uri' => "http://test-uri/")); // realiza chamada remota de método $retorno = $client->salvar($dados); // exibe diálogo de mensagem $dialog = new GtkMessageDialog(null, Gtk::DIALOG_MODAL, Gtk::MESSAGE_INFO, Gtk::BUTTONS_OK, 'Registro inserido com sucesso!'); $dialog->run(); $dialog->destroy(); } catch (SoapFault $excecao) { // exibe diálogo de erro $error = new GtkMessageDialog(null, Gtk::DIALOG_MODAL, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, $excecao->getMessage()); $error->run(); $error->destroy(); } } } // instancia janela NovoCliente new NovoCliente(); Gtk::Main();
/** * 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")); }
function on_window1_destroy() { Gtk::main_quit(); exit; }
/** * 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')); } }
} if ($store_system_config) { $config->store('system'); } if ($store_user_config) { $config->store('user'); } $command = isset($options[1][0]) ? $options[1][0] : null; if (empty($command) && ($store_user_config || $store_system_config)) { exit; } if ($fetype == 'Gtk' || $fetype == 'Gtk2') { if (!$config->validConfiguration()) { PEAR::raiseError('CRITICAL ERROR: no existing valid configuration files found in files ' . "'{$pear_user_config}' or '{$pear_system_config}', please copy an existing configuration" . 'file to one of these locations, or use the -c and -s options to create one'); } Gtk::main(); } else { do { if ($command == 'help') { usage(null, @$options[1][1]); } if (!$config->validConfiguration()) { PEAR::raiseError('CRITICAL ERROR: no existing valid configuration files found in files ' . "'{$pear_user_config}' or '{$pear_system_config}', please copy an existing configuration" . 'file to one of these locations, or use the -c and -s options to create one'); } PEAR::pushErrorHandling(PEAR_ERROR_RETURN); $cmd = PEAR_Command::factory($command, $config); PEAR::popErrorHandling(); if (PEAR::isError($cmd)) { usage(null, @$options[1][0]); } $short_args = $long_args = null;
function destroy() { Gtk::main_quit(); }
/** * Método do descarregamento do formulario * * @name frmDemo_unload() */ public function frmDemo_unload() { // Encerra a aplicação Gtk::main_quit(); }
function grava_dados() { if (!$this->check_dados()) { return; } $db = new Database($this, false); if (!$db->link) { return; } $nome = $this->nome->get_text(); $descricao = $this->descricao->get_text(); if ($this->operacao == 'i') { $sql = 'call SP_Perfil_Inc'; } else { $sql = 'call SP_Perfil_Alt'; } $data = $sql . '(' . String($this->CodPerfil) . ',' . String($nome) . ',' . String($descricao) . ',' . $GLOBALS['CodUsuario'] . ');'; if (!$db->multi_query($data)) { return; } // Mensagem $line = $db->line(); $mensagem = $line['Mensagem']; if ($this->operacao == 'i') { $line = $db->line(); $CodPerfil = $line['CodPerfil']; } // limpa BUFFER while ($db->line()) { } // pega CodPerfil if (!$CodPerfil) { $CodPerfil = $this->CodPerfil; } // Permissoes $db->query(' DELETE FROM Tb_Permissoes WHERE Cod_S_Perfil = ' . $CodPerfil); foreach ($this->itens as $key => $value) { if ($value->get_active()) { if (!$db->query(' INSERT INTO Tb_Permissoes (Cod_S_Perfil, Cod_S_Item) ' . ' VALUES (' . String($CodPerfil) . ',' . String($key) . ');')) { return; } else { $this->progresso->pulse(); while (Gtk::events_pending()) { Gtk::main_iteration(); } } } } new Message($this, $mensagem); return true; }
<?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";
public function click_section(GtkTreeView $view, GtkTreeIter $iter, array $path) { // Set the path to make sure the selection is selected $view->set_cursor($path); /** @var GtkTreeModel */ $model = $view->get_model(); $value = $model->get_value($iter, 0); // Do multi processing here! ~_~ // TODO: Detect Windows verse Unix $proc = new Gorilla3d\Process(); // Unix $proc->setCommand("php threads.php &"); // Windows //$proc->setCommand("start php threads.php"); $proc->open(); $proc->write($value); // Keep checking if the process is done foreach (range(1, 6) as $i) { // Needed to not block UI while (Gtk::events_pending()) { Gtk::main_iteration(); } // Sleep 0.5 seconds before checking again (locks UI for 1/2 a second usleep(500000); echo "SLEEP!" . PHP_EOL; } $proc->close(); /* $sections = Fourchan\Sections::getSections(); $url = false; if(isset($sections[$value])) { $url = $sections[$value]; } else { echo "fart!\n"; } if($url) { $parser = new Fourchan\Parser($url); $parser->getPages(); $parser->getThreads(); // lots of threads >.< var_dump($parser->threads); } */ /** @var GtkTreeSelection */ /* For multiple selections $selection = $view->get_selection(); list($model, $arPaths) = $selection->get_selected_rows(); echo "Selection is now:\r\n"; foreach ($arPaths as $path) { $iter = $model->get_iter($path); echo ' ' . $model->get_value($iter, 0) . "\r\n"; } */ /* */ echo "clicked Thread!" . PHP_EOL; }
function on_menu_select($menu_item) { global $G; $item = $menu_item->child->get_label(); switch ($item) { case "_Koniec": Gtk::main_quit(); break; case "_Displej": show_display(); break; #case "Š_tartovka": uprav_startovku();break; #case "Š_tartovka": uprav_startovku();break; case "_Behy": uprav_behy(); break; case "Papiere pre _zapisovateľov": $cmd = './vysledky.php ZAPIS'; print $cmd . "\n"; shell_exec("nohup {$cmd} > /dev/null 2> /dev/null & echo \$!"); break; case "_VZ": $cmd = './vysledky.php VZ'; print $cmd . "\n"; shell_exec("nohup {$cmd} > /dev/null 2> /dev/null & echo \$!"); break; case "Š_tartovka": $cmd = './vysledky.php START'; print $cmd . "\n"; shell_exec("nohup {$cmd} > /dev/null 2> /dev/null & echo \$!"); break; case "_Prezentácia": $cmd = './vysledky.php PREZENCKA'; print $cmd . "\n"; shell_exec("nohup {$cmd} > /dev/null 2> /dev/null & echo \$!"); break; default: $id = explode(' ', $item); $id = $id[0]; if (isset($G["behy"][$id])) { #print 'BEH'.$id; $cmd = './vysledky.php ' . $id; print $cmd . "\n"; shell_exec("nohup {$cmd} > /dev/null 2> /dev/null & echo \$!"); } if (isset($G["sucty"][$item])) { #print 'SUCET'.$item; $cmd = './vysledky.php ' . str_replace(",", " ", $G["sucty"][$item]); print $cmd . "\n"; shell_exec("nohup {$cmd} > /dev/null 2> /dev/null & echo \$!"); } break; } }
public function iniciarGUI() { Gtk::main(); }