Python gtk.main_iteration() Examples

The following are 22 code examples of gtk.main_iteration(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module gtk , or try the search function .
Example #1
Source File: gtk2reactor.py    From python-for-android with Apache License 2.0 7 votes vote down vote up
def __init__(self, useGtk=True):
        self._simtag = None
        self._reads = set()
        self._writes = set()
        self._sources = {}
        posixbase.PosixReactorBase.__init__(self)
        # pre 2.3.91 the glib iteration and mainloop functions didn't release
        # global interpreter lock, thus breaking thread and signal support.
        if getattr(gobject, "pygtk_version", ()) >= (2, 3, 91) and not useGtk:
            self.context = gobject.main_context_default()
            self.__pending = self.context.pending
            self.__iteration = self.context.iteration
            self.loop = gobject.MainLoop()
            self.__crash = self.loop.quit
            self.__run = self.loop.run
        else:
            import gtk
            self.__pending = gtk.events_pending
            self.__iteration = gtk.main_iteration
            self.__crash = _our_mainquit
            self.__run = gtk.main 
Example #2
Source File: main.py    From gimp-plugin-export-layers with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, layer_tree, settings):
    self._layer_tree = layer_tree
    self._settings = settings
    
    self._image = self._layer_tree.image
    self._layer_exporter = None
    
    self._settings.load([pg.config.SESSION_SOURCE])
    
    self._init_gui()
    
    pg.gui.set_gui_excepthook_parent(self._dialog)
    
    gtk.main_iteration()
    self.show()
    self.export_layers() 
Example #3
Source File: main.py    From gimp-plugin-export-layers with GNU General Public License v3.0 6 votes vote down vote up
def handle_gui_in_export(run_mode, image, layer, output_filepath, window):
  should_manipulate_window = run_mode == gimpenums.RUN_INTERACTIVE
  
  if should_manipulate_window:
    window_position = window.get_position()
    window.hide()
  while gtk.events_pending():
    gtk.main_iteration()
  
  try:
    yield
  finally:
    if should_manipulate_window:
      window.move(*window_position)
      window.show()
    while gtk.events_pending():
      gtk.main_iteration() 
Example #4
Source File: core.py    From ntu-dsi-dcn with GNU General Public License v2.0 5 votes vote down vote up
def update_view_timeout(self):
        #print "view: update_view_timeout called at real time ", time.time()

        # while the simulator is busy, run the gtk event loop
        while not self.simulation.lock.acquire(False):
            while gtk.events_pending():
                gtk.main_iteration()
        pause_messages = self.simulation.pause_messages
        self.simulation.pause_messages = []
        try:
            self.update_view()
            self.simulation.target_time = ns.core.Simulator.Now ().GetSeconds () + self.sample_period
            #print "view: target time set to %f" % self.simulation.target_time
        finally:
            self.simulation.lock.release()

        if pause_messages:
            #print pause_messages
            dialog = gtk.MessageDialog(parent=self.window, flags=0, type=gtk.MESSAGE_WARNING, buttons=gtk.BUTTONS_OK,
                                       message_format='\n'.join(pause_messages))
            dialog.connect("response", lambda d, r: d.destroy())
            dialog.show()
            self.play_button.set_active(False)

        # if we're paused, stop the update timer
        if not self.play_button.get_active():
            self._update_timeout_id = None
            return False

        #print "view: self.simulation.go.set()"
        self.simulation.go.set()
        #print "view: done."
        return True 
Example #5
Source File: draganddropcontext.py    From gimp-plugin-export-layers with GNU General Public License v3.0 5 votes vote down vote up
def _get_drag_icon_pixbuf(self, widget, scrolled_window):
    if widget.get_window() is None:
      return
    
    if (scrolled_window is not None
        and self._are_items_partially_hidden_because_of_visible_horizontal_scrollbar(
              scrolled_window)):
      return None
    
    self._setup_widget_to_add_border_to_drag_icon(widget)
    
    while gtk.events_pending():
      gtk.main_iteration()
    
    widget_allocation = widget.get_allocation()
    
    pixbuf = gtk.gdk.Pixbuf(
      gtk.gdk.COLORSPACE_RGB,
      False,
      8,
      widget_allocation.width,
      widget_allocation.height)
    
    drag_icon_pixbuf = pixbuf.get_from_drawable(
      widget.get_window(),
      widget.get_colormap(),
      0,
      0,
      0,
      0,
      widget_allocation.width,
      widget_allocation.height)
    
    self._restore_widget_after_creating_drag_icon(widget)
    
    return drag_icon_pixbuf 
Example #6
Source File: progress.py    From gimp-plugin-export-layers with GNU General Public License v3.0 5 votes vote down vote up
def _progress_set_fraction(self, fraction):
    self._progress_bar.set_fraction(fraction)
    while gtk.events_pending():
      gtk.main_iteration() 
Example #7
Source File: main.py    From gimp-plugin-export-layers with GNU General Public License v3.0 5 votes vote down vote up
def _progress_set_value_and_show_dialog(self, fraction):
    self._progress_bar.set_fraction(fraction)
    
    # Without this workaround, the main dialog would not appear until the export
    # of the second layer.
    if not self._dialog.get_mapped():
      self._dialog.show()
    
    while gtk.events_pending():
      gtk.main_iteration() 
Example #8
Source File: main.py    From gimp-plugin-export-layers with GNU General Public License v3.0 5 votes vote down vote up
def _finish_init_and_show(self):
    while gtk.events_pending():
      gtk.main_iteration()
    
    self._dialog.vbox.show_all()
    self._show_hide_more_settings()
    
    self._dialog.set_focus(self._file_extension_entry)
    self._button_export.grab_default()
    # Place the cursor at the end of the text entry.
    self._file_extension_entry.set_position(-1)
    
    self._dialog.show() 
Example #9
Source File: core.py    From Tocino with GNU General Public License v2.0 5 votes vote down vote up
def update_view_timeout(self):
        #print "view: update_view_timeout called at real time ", time.time()

        # while the simulator is busy, run the gtk event loop
        while not self.simulation.lock.acquire(False):
            while gtk.events_pending():
                gtk.main_iteration()
        pause_messages = self.simulation.pause_messages
        self.simulation.pause_messages = []
        try:
            self.update_view()
            self.simulation.target_time = ns.core.Simulator.Now ().GetSeconds () + self.sample_period
            #print "view: target time set to %f" % self.simulation.target_time
        finally:
            self.simulation.lock.release()

        if pause_messages:
            #print pause_messages
            dialog = gtk.MessageDialog(parent=self.window, flags=0, type=gtk.MESSAGE_WARNING, buttons=gtk.BUTTONS_OK,
                                       message_format='\n'.join(pause_messages))
            dialog.connect("response", lambda d, r: d.destroy())
            dialog.show()
            self.play_button.set_active(False)

        # if we're paused, stop the update timer
        if not self.play_button.get_active():
            self._update_timeout_id = None
            return False

        #print "view: self.simulation.go.set()"
        self.simulation.go.set()
        #print "view: done."
        return True 
Example #10
Source File: core.py    From ns3-802.11ad with GNU General Public License v2.0 5 votes vote down vote up
def update_view_timeout(self):
        #print "view: update_view_timeout called at real time ", time.time()

        # while the simulator is busy, run the gtk event loop
        while not self.simulation.lock.acquire(False):
            while gtk.events_pending():
                gtk.main_iteration()
        pause_messages = self.simulation.pause_messages
        self.simulation.pause_messages = []
        try:
            self.update_view()
            self.simulation.target_time = ns.core.Simulator.Now ().GetSeconds () + self.sample_period
            #print "view: target time set to %f" % self.simulation.target_time
        finally:
            self.simulation.lock.release()

        if pause_messages:
            #print pause_messages
            dialog = gtk.MessageDialog(parent=self.window, flags=0, type=gtk.MESSAGE_WARNING, buttons=gtk.BUTTONS_OK,
                                       message_format='\n'.join(pause_messages))
            dialog.connect("response", lambda d, r: d.destroy())
            dialog.show()
            self.play_button.set_active(False)

        # if we're paused, stop the update timer
        if not self.play_button.get_active():
            self._update_timeout_id = None
            return False

        #print "view: self.simulation.go.set()"
        self.simulation.go.set()
        #print "view: done."
        return True 
Example #11
Source File: core.py    From ns3-ecn-sharp with GNU General Public License v2.0 5 votes vote down vote up
def update_view_timeout(self):
        #print "view: update_view_timeout called at real time ", time.time()

        # while the simulator is busy, run the gtk event loop
        while not self.simulation.lock.acquire(False):
            while gtk.events_pending():
                gtk.main_iteration()
        pause_messages = self.simulation.pause_messages
        self.simulation.pause_messages = []
        try:
            self.update_view()
            self.simulation.target_time = ns.core.Simulator.Now ().GetSeconds () + self.sample_period
            #print "view: target time set to %f" % self.simulation.target_time
        finally:
            self.simulation.lock.release()

        if pause_messages:
            #print pause_messages
            dialog = gtk.MessageDialog(parent=self.window, flags=0, type=gtk.MESSAGE_WARNING, buttons=gtk.BUTTONS_OK,
                                       message_format='\n'.join(pause_messages))
            dialog.connect("response", lambda d, r: d.destroy())
            dialog.show()
            self.play_button.set_active(False)

        # if we're paused, stop the update timer
        if not self.play_button.get_active():
            self._update_timeout_id = None
            return False

        #print "view: self.simulation.go.set()"
        self.simulation.go.set()
        #print "view: done."
        return True 
Example #12
Source File: gtk2reactor.py    From BitTorrent with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, useGtk=True):
        self.context = gobject.main_context_default()
        self.loop = gobject.MainLoop()
        posixbase.PosixReactorBase.__init__(self)
        # pre 2.3.91 the glib iteration and mainloop functions didn't release
        # global interpreter lock, thus breaking thread and signal support.
        if (hasattr(gobject, "pygtk_version") and gobject.pygtk_version >= (2, 3, 91)
            and not useGtk):
            self.__pending = self.context.pending
            self.__iteration = self.context.iteration
            self.__crash = self.loop.quit
            self.__run = self.loop.run
        else:
            import gtk
            self.__pending = gtk.events_pending
            self.__iteration = gtk.main_iteration
            self.__crash = _our_mainquit
            self.__run = gtk.main

    # The input_add function in pygtk1 checks for objects with a
    # 'fileno' method and, if present, uses the result of that method
    # as the input source. The pygtk2 input_add does not do this. The
    # function below replicates the pygtk1 functionality.

    # In addition, pygtk maps gtk.input_add to _gobject.io_add_watch, and
    # g_io_add_watch() takes different condition bitfields than
    # gtk_input_add(). We use g_io_add_watch() here in case pygtk fixes this
    # bug. 
Example #13
Source File: core.py    From CRE-NS3 with GNU General Public License v2.0 5 votes vote down vote up
def update_view_timeout(self):
        #print "view: update_view_timeout called at real time ", time.time()

        # while the simulator is busy, run the gtk event loop
        while not self.simulation.lock.acquire(False):
            while gtk.events_pending():
                gtk.main_iteration()
        pause_messages = self.simulation.pause_messages
        self.simulation.pause_messages = []
        try:
            self.update_view()
            self.simulation.target_time = ns.core.Simulator.Now ().GetSeconds () + self.sample_period
            #print "view: target time set to %f" % self.simulation.target_time
        finally:
            self.simulation.lock.release()

        if pause_messages:
            #print pause_messages
            dialog = gtk.MessageDialog(parent=self.window, flags=0, type=gtk.MESSAGE_WARNING, buttons=gtk.BUTTONS_OK,
                                       message_format='\n'.join(pause_messages))
            dialog.connect("response", lambda d, r: d.destroy())
            dialog.show()
            self.play_button.set_active(False)

        # if we're paused, stop the update timer
        if not self.play_button.get_active():
            self._update_timeout_id = None
            return False

        #print "view: self.simulation.go.set()"
        self.simulation.go.set()
        #print "view: done."
        return True 
Example #14
Source File: core.py    From ns-3-dev-git with GNU General Public License v2.0 5 votes vote down vote up
def update_view_timeout(self):
        #print "view: update_view_timeout called at real time ", time.time()

        # while the simulator is busy, run the gtk event loop
        while not self.simulation.lock.acquire(False):
            while gtk.events_pending():
                gtk.main_iteration()
        pause_messages = self.simulation.pause_messages
        self.simulation.pause_messages = []
        try:
            self.update_view()
            self.simulation.target_time = ns.core.Simulator.Now ().GetSeconds () + self.sample_period
            #print "view: target time set to %f" % self.simulation.target_time
        finally:
            self.simulation.lock.release()

        if pause_messages:
            #print pause_messages
            dialog = gtk.MessageDialog(parent=self.window, flags=0, type=gtk.MESSAGE_WARNING, buttons=gtk.BUTTONS_OK,
                                       message_format='\n'.join(pause_messages))
            dialog.connect("response", lambda d, r: d.destroy())
            dialog.show()
            self.play_button.set_active(False)

        # if we're paused, stop the update timer
        if not self.play_button.get_active():
            self._update_timeout_id = None
            return False

        #print "view: self.simulation.go.set()"
        self.simulation.go.set()
        #print "view: done."
        return True 
Example #15
Source File: core.py    From royal-chaos with MIT License 5 votes vote down vote up
def update_view_timeout(self):
        #print "view: update_view_timeout called at real time ", time.time()

        # while the simulator is busy, run the gtk event loop
        while not self.simulation.lock.acquire(False):
            while gtk.events_pending():
                gtk.main_iteration()
        pause_messages = self.simulation.pause_messages
        self.simulation.pause_messages = []
        try:
            self.update_view()
            self.simulation.target_time = ns.core.Simulator.Now ().GetSeconds () + self.sample_period
            #print "view: target time set to %f" % self.simulation.target_time
        finally:
            self.simulation.lock.release()

        if pause_messages:
            #print pause_messages
            dialog = gtk.MessageDialog(parent=self.window, flags=0, type=gtk.MESSAGE_WARNING, buttons=gtk.BUTTONS_OK,
                                       message_format='\n'.join(pause_messages))
            dialog.connect("response", lambda d, r: d.destroy())
            dialog.show()
            self.play_button.set_active(False)

        # if we're paused, stop the update timer
        if not self.play_button.get_active():
            self._update_timeout_id = None
            return False

        #print "view: self.simulation.go.set()"
        self.simulation.go.set()
        #print "view: done."
        return True 
Example #16
Source File: core.py    From ns3-rdma with GNU General Public License v2.0 5 votes vote down vote up
def update_view_timeout(self):
        #print "view: update_view_timeout called at real time ", time.time()

        # while the simulator is busy, run the gtk event loop
        while not self.simulation.lock.acquire(False):
            while gtk.events_pending():
                gtk.main_iteration()
        pause_messages = self.simulation.pause_messages
        self.simulation.pause_messages = []
        try:
            self.update_view()
            self.simulation.target_time = ns.core.Simulator.Now ().GetSeconds () + self.sample_period
            #print "view: target time set to %f" % self.simulation.target_time
        finally:
            self.simulation.lock.release()

        if pause_messages:
            #print pause_messages
            dialog = gtk.MessageDialog(parent=self.window, flags=0, type=gtk.MESSAGE_WARNING, buttons=gtk.BUTTONS_OK,
                                       message_format='\n'.join(pause_messages))
            dialog.connect("response", lambda d, r: d.destroy())
            dialog.show()
            self.play_button.set_active(False)

        # if we're paused, stop the update timer
        if not self.play_button.get_active():
            self._update_timeout_id = None
            return False

        #print "view: self.simulation.go.set()"
        self.simulation.go.set()
        #print "view: done."
        return True 
Example #17
Source File: core.py    From 802.11ah-ns3 with GNU General Public License v2.0 5 votes vote down vote up
def update_view_timeout(self):
        #print "view: update_view_timeout called at real time ", time.time()

        # while the simulator is busy, run the gtk event loop
        while not self.simulation.lock.acquire(False):
            while gtk.events_pending():
                gtk.main_iteration()
        pause_messages = self.simulation.pause_messages
        self.simulation.pause_messages = []
        try:
            self.update_view()
            self.simulation.target_time = ns.core.Simulator.Now ().GetSeconds () + self.sample_period
            #print "view: target time set to %f" % self.simulation.target_time
        finally:
            self.simulation.lock.release()

        if pause_messages:
            #print pause_messages
            dialog = gtk.MessageDialog(parent=self.window, flags=0, type=gtk.MESSAGE_WARNING, buttons=gtk.BUTTONS_OK,
                                       message_format='\n'.join(pause_messages))
            dialog.connect("response", lambda d, r: d.destroy())
            dialog.show()
            self.play_button.set_active(False)

        # if we're paused, stop the update timer
        if not self.play_button.get_active():
            self._update_timeout_id = None
            return False

        #print "view: self.simulation.go.set()"
        self.simulation.go.set()
        #print "view: done."
        return True 
Example #18
Source File: core.py    From ns3-load-balance with GNU General Public License v2.0 5 votes vote down vote up
def update_view_timeout(self):
        #print "view: update_view_timeout called at real time ", time.time()

        # while the simulator is busy, run the gtk event loop
        while not self.simulation.lock.acquire(False):
            while gtk.events_pending():
                gtk.main_iteration()
        pause_messages = self.simulation.pause_messages
        self.simulation.pause_messages = []
        try:
            self.update_view()
            self.simulation.target_time = ns.core.Simulator.Now ().GetSeconds () + self.sample_period
            #print "view: target time set to %f" % self.simulation.target_time
        finally:
            self.simulation.lock.release()

        if pause_messages:
            #print pause_messages
            dialog = gtk.MessageDialog(parent=self.window, flags=0, type=gtk.MESSAGE_WARNING, buttons=gtk.BUTTONS_OK,
                                       message_format='\n'.join(pause_messages))
            dialog.connect("response", lambda d, r: d.destroy())
            dialog.show()
            self.play_button.set_active(False)

        # if we're paused, stop the update timer
        if not self.play_button.get_active():
            self._update_timeout_id = None
            return False

        #print "view: self.simulation.go.set()"
        self.simulation.go.set()
        #print "view: done."
        return True 
Example #19
Source File: core.py    From IEEE-802.11ah-ns-3 with GNU General Public License v2.0 5 votes vote down vote up
def update_view_timeout(self):
        #print "view: update_view_timeout called at real time ", time.time()

        # while the simulator is busy, run the gtk event loop
        while not self.simulation.lock.acquire(False):
            while gtk.events_pending():
                gtk.main_iteration()
        pause_messages = self.simulation.pause_messages
        self.simulation.pause_messages = []
        try:
            self.update_view()
            self.simulation.target_time = ns.core.Simulator.Now ().GetSeconds () + self.sample_period
            #print "view: target time set to %f" % self.simulation.target_time
        finally:
            self.simulation.lock.release()

        if pause_messages:
            #print pause_messages
            dialog = gtk.MessageDialog(parent=self.window, flags=0, type=gtk.MESSAGE_WARNING, buttons=gtk.BUTTONS_OK,
                                       message_format='\n'.join(pause_messages))
            dialog.connect("response", lambda d, r: d.destroy())
            dialog.show()
            self.play_button.set_active(False)

        # if we're paused, stop the update timer
        if not self.play_button.get_active():
            self._update_timeout_id = None
            return False

        #print "view: self.simulation.go.set()"
        self.simulation.go.set()
        #print "view: done."
        return True 
Example #20
Source File: notebook.py    From NINJA-PingU with GNU General Public License v3.0 4 votes vote down vote up
def closetab(self, widget, label):
        """Close a tab"""
        tabnum = None
        try:
            nb = widget.notebook
        except AttributeError:
            err('TabLabel::closetab: called on non-Notebook: %s' % widget)
            return

        for i in xrange(0, nb.get_n_pages() + 1):
            if label == nb.get_tab_label(nb.get_nth_page(i)):
                tabnum = i
                break

        if tabnum is None:
            err('TabLabel::closetab: %s not in %s. Bailing.' % (label, nb))
            return

        maker = Factory()
        child = nb.get_nth_page(tabnum)

        if maker.isinstance(child, 'Terminal'):
            dbg('Notebook::closetab: child is a single Terminal')
            child.close()
            # FIXME: We only do this del and return here to avoid removing the
            # page below, which child.close() implicitly does
            del(label)
            return
        elif maker.isinstance(child, 'Container'):
            dbg('Notebook::closetab: child is a Container')
            dialog = self.construct_confirm_close(self.window, _('tab'))
            result = dialog.run()
            dialog.destroy()

            if result == gtk.RESPONSE_ACCEPT:
                containers = None
                objects = None
                containers, objects = enumerate_descendants(child)

                while len(objects) > 0:
                    descendant = objects.pop()
                    descendant.close()
                    while gtk.events_pending():
                        gtk.main_iteration()
                return
            else:
                dbg('Notebook::closetab: user cancelled request')
                return
        else:
            err('Notebook::closetab: child is unknown type %s' % child)
            return

        nb.remove_page(tabnum)
        del(label) 
Example #21
Source File: make_screenshots.py    From gimp-plugin-export-layers with GNU General Public License v3.0 4 votes vote down vote up
def take_screenshots(gui, dialog, settings):
  pg.path.make_dirs(OUTPUT_DIRPATH)
  
  settings["gui_session/current_directory"].set_value(OUTPUT_DIRPATH)
  settings["gui/show_more_settings"].set_value(False)
  
  decoration_offsets = move_dialog_to_corner(dialog, settings)
  
  #HACK: Accessing private members
  gui._name_preview.set_selected_items(set([
    gui._name_preview._layer_exporter.layer_tree["main-background"].item.ID]))
  
  dialog.set_focus(gui._name_preview.tree_view)
  
  while gtk.events_pending():
    gtk.main_iteration()
  
  take_and_process_screenshot(
    SCREENSHOTS_DIRPATH,
    SCREENSHOT_DIALOG_BASIC_USAGE_FILENAME,
    settings,
    decoration_offsets)
  
  settings["gui/show_more_settings"].set_value(True)
  
  operations.clear(settings["main/procedures"])
  operations.clear(settings["main/constraints"])
  
  operations.add(
    settings["main/procedures"],
    builtin_procedures.BUILTIN_PROCEDURES["insert_background_layers"])
  operations.reorder(
    settings["main/procedures"], "insert_background_layers", 0)
  settings["main/procedures/added/use_layer_size/enabled"].set_value(False)
  
  operations.add(
    settings["main/constraints"],
    builtin_constraints.BUILTIN_CONSTRAINTS["only_layers_without_tags"])
  
  while gtk.events_pending():
    gtk.main_iteration()
  
  #HACK: Accessing private members
  gui._name_preview.set_selected_items(set([
    gui._name_preview._layer_exporter.layer_tree["bottom-frame"].item.ID]))
  
  while gtk.events_pending():
    gtk.main_iteration()
  
  take_and_process_screenshot(
    SCREENSHOTS_DIRPATH,
    SCREENSHOT_DIALOG_CUSTOMIZING_EXPORT_FILENAME,
    settings,
    decoration_offsets)
  
  gtk.main_quit() 
Example #22
Source File: gnome_connection_manager.py    From gnome-connection-manager with GNU General Public License v3.0 4 votes vote down vote up
def on_terminal_keypress(self, widget, event, *args):
        if shortcuts.has_key(get_key_name(event)):
            cmd = shortcuts[get_key_name(event)]
            if type(cmd) == list:
                #comandos predefinidos
                if cmd == _COPY:
                    self.terminal_copy(widget)
                elif cmd == _PASTE:
                    self.terminal_paste(widget)
                elif cmd == _COPY_ALL:
                    self.terminal_copy_all(widget)
                elif cmd == _SAVE:
                    self.show_save_buffer(widget)
                elif cmd == _FIND:
                    self.get_widget('txtSearch').select_region(0, -1)
                    self.get_widget('txtSearch').grab_focus()
                elif cmd == _FIND_NEXT:
                    if hasattr(self, 'search'):
                        self.find_word()
                elif cmd == _CLEAR:
                   widget.reset(True, True)
                elif cmd == _FIND_BACK:
                    if hasattr(self, 'search'):
                        self.find_word(backwards=True)
                elif cmd == _CONSOLE_PREV:
                    widget.get_parent().get_parent().prev_page()
                elif cmd == _CONSOLE_NEXT:
                    widget.get_parent().get_parent().next_page()
                elif cmd == _CONSOLE_CLOSE:
                    wid = widget.get_parent()                    
                    page = widget.get_parent().get_parent().page_num(wid)                    
                    if page != -1:
                        widget.get_parent().get_parent().remove_page(page)
                        wid.destroy()
                elif cmd == _CONSOLE_RECONNECT:                    
                    if not hasattr(widget, "command"):
                        widget.fork_command(SHELL)
                    else:
                        widget.fork_command(widget.command[0], widget.command[1])
                        while gtk.events_pending():
                            gtk.main_iteration(False)                                
                            
                        #esperar 2 seg antes de enviar el pass para dar tiempo a que se levante expect y prevenir que se muestre el pass
                        if widget.command[2]!=None and widget.command[2]!='':
                            gobject.timeout_add(2000, self.send_data, widget, widget.command[2])                    
                    widget.get_parent().get_parent().get_tab_label(widget.get_parent()).mark_tab_as_active()
                    return True
                elif cmd == _CONNECT:
                    self.on_btnConnect_clicked(None)
                elif cmd[0][0:8] == "console_":
                    page = int(cmd[0][8:]) - 1                   
                    widget.get_parent().get_parent().set_current_page(page)                
            else:
                #comandos del usuario
                widget.feed_child(cmd)
                
            return True
        return False