Python gtk.events_pending() Examples
The following are 28
code examples of gtk.events_pending().
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
.
![](https://www.programcreek.com/common/static/images/search.png)
Example #1
Source File: gtk2reactor.py From python-for-android with Apache License 2.0 | 7 votes |
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: window.py From NINJA-PingU with GNU General Public License v3.0 | 6 votes |
def rotate(self, widget, clockwise): """Rotate children in this window""" self.set_pos_by_ratio = True maker = Factory() # collect all paned children in breadth-first order paned = [] for child in self.get_children(): if maker.isinstance(child, 'Paned'): paned.append(child) for p in paned: for child in p.get_children(): if child not in paned and maker.isinstance(child, 'Paned'): paned.append(child) # then propagate the rotation for p in paned: p.rotate(widget, clockwise) self.show_all() widget.grab_focus() while gtk.events_pending(): gtk.main_iteration_do(False) self.set_pos_by_ratio = False
Example #3
Source File: main.py From gimp-plugin-export-layers with GNU General Public License v3.0 | 6 votes |
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: gtkreactor.py From BitTorrent with GNU General Public License v3.0 | 6 votes |
def doIteration(self, delay): # flush some pending events, return if there was something to do # don't use the usual "while gtk.events_pending(): mainiteration()" # idiom because lots of IO (in particular test_tcp's # ProperlyCloseFilesTestCase) can keep us from ever exiting. log.msg(channel='system', event='iteration', reactor=self) if gtk.events_pending(): gtk.mainiteration(0) return # nothing to do, must delay if delay == 0: return # shouldn't delay, so just return self.doIterationTimer = gtk.timeout_add(int(delay * 1000), self.doIterationTimeout) # This will either wake up from IO or from a timeout. gtk.mainiteration(1) # block # note: with the .simulate timer below, delays > 0.1 will always be # woken up by the .simulate timer if self.doIterationTimer: # if woken by IO, need to cancel the timer gtk.timeout_remove(self.doIterationTimer) self.doIterationTimer = None
Example #5
Source File: gtkreactor.py From python-for-android with Apache License 2.0 | 6 votes |
def doIteration(self, delay): # flush some pending events, return if there was something to do # don't use the usual "while gtk.events_pending(): mainiteration()" # idiom because lots of IO (in particular test_tcp's # ProperlyCloseFilesTestCase) can keep us from ever exiting. log.msg(channel='system', event='iteration', reactor=self) if gtk.events_pending(): gtk.mainiteration(0) return # nothing to do, must delay if delay == 0: return # shouldn't delay, so just return self.doIterationTimer = gtk.timeout_add(int(delay * 1000), self.doIterationTimeout) # This will either wake up from IO or from a timeout. gtk.mainiteration(1) # block # note: with the .simulate timer below, delays > 0.1 will always be # woken up by the .simulate timer if self.doIterationTimer: # if woken by IO, need to cancel the timer gtk.timeout_remove(self.doIterationTimer) self.doIterationTimer = None
Example #6
Source File: paned.py From NINJA-PingU with GNU General Public License v3.0 | 6 votes |
def do_redistribute(self, recurse_up=False, recurse_down=False): """Evenly divide available space between sibling panes""" #1 Find highest ancestor of the same type => ha highest_ancestor = self while type(highest_ancestor.get_parent()) == type(highest_ancestor): highest_ancestor = highest_ancestor.get_parent() # (1b) If Super modifier, redistribute higher sections too if recurse_up: grandfather=highest_ancestor.get_parent() if grandfather != self.get_toplevel(): grandfather.do_redistribute(recurse_up, recurse_down) gobject.idle_add(highest_ancestor._do_redistribute, recurse_up, recurse_down) while gtk.events_pending(): gtk.main_iteration_do(False) gobject.idle_add(highest_ancestor._do_redistribute, recurse_up, recurse_down)
Example #7
Source File: paned.py From NINJA-PingU with GNU General Public License v3.0 | 6 votes |
def on_button_press(self, widget, event): """Handle button presses on a Pane""" if event.button == 1 and event.type == gtk.gdk._2BUTTON_PRESS: if event.state & gtk.gdk.MOD4_MASK == gtk.gdk.MOD4_MASK: recurse_up=True else: recurse_up=False if event.state & gtk.gdk.SHIFT_MASK == gtk.gdk.SHIFT_MASK: recurse_down=True else: recurse_down=False # FIXME: These idle events are creating a lot of weird issues for i in range(3): while gtk.events_pending(): gtk.main_iteration_do(False) self.do_redistribute(recurse_up, recurse_down) return True else: return False
Example #8
Source File: core.py From IEEE-802.11ah-ns-3 with GNU General Public License v2.0 | 5 votes |
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 #9
Source File: progressupdater.py From gimp-plugin-export-layers with GNU General Public License v3.0 | 5 votes |
def _force_update(self): # This is necessary for the GTK progress bar to be updated properly. # See http://faq.pygtk.org/index.py?req=show&file=faq23.020.htp while gtk.events_pending(): gtk.main_iteration()
Example #10
Source File: progress.py From gimp-plugin-export-layers with GNU General Public License v3.0 | 5 votes |
def _progress_set_fraction(self, fraction): self._progress_bar.set_fraction(fraction) while gtk.events_pending(): gtk.main_iteration()
Example #11
Source File: main.py From gimp-plugin-export-layers with GNU General Public License v3.0 | 5 votes |
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 #12
Source File: main.py From gimp-plugin-export-layers with GNU General Public License v3.0 | 5 votes |
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 #13
Source File: window.py From NINJA-PingU with GNU General Public License v3.0 | 5 votes |
def split_axis(self, widget, vertical=True, cwd=None, sibling=None, widgetfirst=True): """Split the window""" if self.get_property('term_zoomed') == True: err("You can't split while a terminal is maximised/zoomed") return order = None maker = Factory() self.remove(widget) if vertical: container = maker.make('VPaned') else: container = maker.make('HPaned') self.set_pos_by_ratio = True if not sibling: sibling = maker.make('Terminal') sibling.set_cwd(cwd) sibling.spawn_child() if widget.group and self.config['split_to_group']: sibling.set_group(None, widget.group) if self.config['always_split_with_profile']: sibling.force_set_profile(None, widget.get_profile()) self.add(container) container.show_all() order = [widget, sibling] if widgetfirst is False: order.reverse() for term in order: container.add(term) container.show_all() sibling.grab_focus() while gtk.events_pending(): gtk.main_iteration_do(False) self.set_pos_by_ratio = False
Example #14
Source File: core.py From Tocino with GNU General Public License v2.0 | 5 votes |
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 ns3-802.11ad with GNU General Public License v2.0 | 5 votes |
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-ecn-sharp with GNU General Public License v2.0 | 5 votes |
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: gtk2reactor.py From BitTorrent with GNU General Public License v3.0 | 5 votes |
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 #18
Source File: paned.py From NINJA-PingU with GNU General Public License v3.0 | 5 votes |
def split_axis(self, widget, vertical=True, cwd=None, sibling=None, widgetfirst=True): """Default axis splitter. This should be implemented by subclasses""" order = None self.remove(widget) if vertical: container = VPaned() else: container = HPaned() self.get_toplevel().set_pos_by_ratio = True if not sibling: sibling = self.maker.make('terminal') sibling.set_cwd(cwd) sibling.spawn_child() if widget.group and self.config['split_to_group']: sibling.set_group(None, widget.group) if self.config['always_split_with_profile']: sibling.force_set_profile(None, widget.get_profile()) self.add(container) self.show_all() order = [widget, sibling] if widgetfirst is False: order.reverse() for terminal in order: container.add(terminal) self.show_all() sibling.grab_focus() while gtk.events_pending(): gtk.main_iteration_do(False) self.get_toplevel().set_pos_by_ratio = False
Example #19
Source File: core.py From CRE-NS3 with GNU General Public License v2.0 | 5 votes |
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: classification-banner.py From hardening-script-el6-kickstart with Apache License 2.0 | 5 votes |
def keypress(self, widget, event=None): if event.keyval == 65307: if not gtk.events_pending(): self.window.iconify() self.window.hide() time.sleep(15) self.window.show() self.window.deiconify() self.window.present() return True
Example #21
Source File: core.py From ns-3-dev-git with GNU General Public License v2.0 | 5 votes |
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 #22
Source File: core.py From royal-chaos with MIT License | 5 votes |
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 #23
Source File: core.py From ns3-rdma with GNU General Public License v2.0 | 5 votes |
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 #24
Source File: core.py From 802.11ah-ns3 with GNU General Public License v2.0 | 5 votes |
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 #25
Source File: core.py From ns3-load-balance with GNU General Public License v2.0 | 5 votes |
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 #26
Source File: core.py From ntu-dsi-dcn with GNU General Public License v2.0 | 5 votes |
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 #27
Source File: make_screenshots.py From gimp-plugin-export-layers with GNU General Public License v3.0 | 4 votes |
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 #28
Source File: gnome_connection_manager.py From gnome-connection-manager with GNU General Public License v3.0 | 4 votes |
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