Beispiel #1
0
 def on_rename_tab(self, *args):
     page_num = self.notebook.find_page_index_by_terminal(self.terminal)
     tab_text = self.notebook.get_tab_text_index(page_num)
     dialog = RenameDialog(self.window, tab_text)
     r = dialog.run()
     if r == Gtk.ResponseType.ACCEPT:
         new_text = TabNameUtils.shorten(dialog.get_text(), self.settings)
         self.notebook.rename_page(page_num, new_text, True)
     dialog.destroy()
Beispiel #2
0
 def on_rename(self, user_data):
     HidePrevention(self.get_toplevel()).prevent()
     dialog = RenameDialog(self.notebook.guake.window, self.label.get_text())
     r = dialog.run()
     if r == Gtk.ResponseType.ACCEPT:
         new_text = TabNameUtils.shorten(dialog.get_text(), self.notebook.guake.settings)
         page_num = self.notebook.find_tab_index_by_label(self)
         self.notebook.rename_page(page_num, new_text, True)
     dialog.destroy()
     HidePrevention(self.get_toplevel()).allow()
Beispiel #3
0
 def compute_tab_title(self, vte):
     """Abbreviate and cut vte terminal title when necessary
     """
     vte_title = vte.get_window_title() or _("Terminal")
     try:
         current_directory = vte.get_current_directory()
         if self.abbreviate and vte_title.endswith(current_directory):
             parts = current_directory.split('/')
             parts = [s[:1] for s in parts[:-1]] + [parts[-1]]
             vte_title = vte_title[:len(vte_title) -
                                   len(current_directory)] + '/'.join(parts)
     except OSError:
         pass
     return TabNameUtils.shorten(vte_title, self.settings)