def app_window_focus(self, timestamp): if timestamp is None: timestamp = long(glib.get_current_time()) #sel_child.app_window.activate(timestamp) xid = self.app_window.get_xid() gdk_win = gdk.window_foreign_new(xid) gdk_win.focus(timestamp)
def extern_load_uri(uri): """ extern_load_uri(uri) -> First attempts to load the uri with gtk.show_uri. If that fails it trys xdg-open, gnome-open, and exo-open. """ try: # Try gtk.show_uri. ret = gtk.show_uri(gtk.gdk.screen_get_default(), uri, int(glib.get_current_time())) if ret: return True except Exception as err: print("Error (%s) while loading uri: %s" % (err, uri)) app_list = ['xdg-open', 'gnome-open', 'exo-open'] for app in app_list: try: proc_tup = glib.spawn_async([app, uri], flags=glib.SPAWN_SEARCH_PATH) except Exception as err: print("Error (%s) while loading uri (%s) with app (%s)" % \ (err, uri, app)) # Go to the next app if there was an error. continue # If it gets here than it spawned without error. return True return False
def on_helplink_menuitem_activate(self, menuitem): gtk.show_uri(gtk.gdk.screen_get_default(), HELP_URI, int(glib.get_current_time()))