/** * @name __construct() * @return Demo */ public function __construct() { // Cria a janela $this->widgets['frmDemo'] = new GtkWindow(); $this->widgets['frmDemo']->set_size_request(600, 300); $this->widgets['frmDemo']->set_position(Gtk::WIN_POS_CENTER_ALWAYS); $this->widgets['frmDemo']->connect("destroy", array($this, "frmDemo_unload")); $box = new GtkVBox(); // Adiciona o textview do resultado $this->widgets['txtResult'] = Fabula::GtkTextView(); $box->pack_start(Fabula::GtkViewPort($this->widgets['txtResult']), TRUE, TRUE); // Adiciona o textview dos comandos $this->widgets['txtCommands'] = Fabula::GtkEntry(); $box->pack_start($this->widgets['txtCommands'], FALSE, FALSE); $this->widgets['txtCommands']->grab_focus(); // Connecta o entry de comandos para capturar o botão enter $this->widgets['txtCommands']->connect("key-press-event", array($this, "txtCommands_onkeypress")); // Inicia o pipe $this->pipe = Fabula::PipeIO("/bin/sh", array()); $this->pipe->set_callback("stdout", array($this, "on_pipe_io_stdout")); $this->pipe->run(); // Inicia a aplicação $this->widgets['frmDemo']->add($box); $this->frmDemo_onload(); }
/** * 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; } }