(self)
Layout operations have finished, record that fact
Layout operations have finished, record that fact
Layout operations have finished record that fact
def layout_done(self):
        """Layout operations have finished, record that fact"""
        self.doing_layout = False
        maker = Factory()

        window_last_active_term_mapping = {}
        for window in self.windows:
            if window.is_child_notebook():
                source = window.get_toplevel().get_children()[0]
            else:
                source = window
            window_last_active_term_mapping[window] = copy.copy(source.last_active_term)

        for terminal in self.terminals:
            if not terminal.pid:
                terminal.spawn_child()

        for window in self.windows:
            if not window.is_child_notebook():
                # For windows without a notebook ensure Terminal is visible and focussed
                if window_last_active_term_mapping[window]:
                    term = self.find_terminal_by_uuid(window_last_active_term_mapping[window].urn)
                    term.ensure_visible_and_focussed()

        # Build list of new windows using prelayout list
        new_win_list = []
        if self.prelayout_windows:
            for window in self.windows:
                if window not in self.prelayout_windows:
                    new_win_list.append(window)

        # Make sure all new windows get bumped to the top
        for window in new_win_list:
            window.show()
            window.grab_focus()
            try:
                t = GdkX11.x11_get_server_time(window.get_window())
            except (NameError,TypeError, AttributeError):
                t = 0
            window.get_window().focus(t)

        # Awful workaround to be sure that the last focused window is actually the one focused.
        # Don't ask, don't tell policy on this. Even this is not 100%
        if self.last_active_window:
            window = self.find_window_by_uuid(self.last_active_window.urn)
            count = 0
            while count < 1000 and Gtk.events_pending():
                count += 1
                Gtk.main_iteration_do(False)
                window.show()
                window.grab_focus()
                try:
                    t = GdkX11.x11_get_server_time(window.get_window())
                except (NameError,TypeError, AttributeError):
                    t = 0
                window.get_window().focus(t)

        self.prelayout_windows = None
def layout_done ( self ) : self . doing_layout = False maker = Factory ( ) window_last_active_term_mapping = { } for window in self . windows : if window . is_child_notebook ( ) : source = window . get_toplevel ( ) . get_children ( ) [ 0 ] else : source = window window_last_active_term_mapping [ window ] = copy . copy ( source . last_active_term ) for terminal in self . terminals : if not terminal . pid : terminal . spawn_child ( ) for window in self . windows : if not window . is_child_notebook ( ) : # For windows without a notebook ensure Terminal is visible and focussed if window_last_active_term_mapping [ window ] : term = self . find_terminal_by_uuid ( window_last_active_term_mapping [ window ] . urn ) term . ensure_visible_and_focussed ( ) # Build list of new windows using prelayout list new_win_list = [ ] if self . prelayout_windows : for window in self . windows : if window not in self . prelayout_windows : new_win_list . append ( window ) # Make sure all new windows get bumped to the top for window in new_win_list : window . show ( ) window . grab_focus ( ) try : t = GdkX11 . x11_get_server_time ( window . get_window ( ) ) except ( NameError , TypeError , AttributeError ) : t = 0 window . get_window ( ) . focus ( t ) # Awful workaround to be sure that the last focused window is actually the one focused. # Don't ask, don't tell policy on this. Even this is not 100% if self . last_active_window : window = self . find_window_by_uuid ( self . last_active_window . urn ) count = 0 while count < 1000 and Gtk . events_pending ( ) : count += 1 Gtk . main_iteration_do ( False ) window . show ( ) window . grab_focus ( ) try : t = GdkX11 . x11_get_server_time ( window . get_window ( ) ) except ( NameError , TypeError , AttributeError ) : t = 0 window . get_window ( ) . focus ( t ) self . prelayout_windows = None