Merge github.com:gnome-terminator/terminator into feature/guake-like-functionality

This commit is contained in:
itdominator 2024-04-12 15:04:16 -05:00
commit b36121c1c5
22 changed files with 777 additions and 413 deletions

View File

@ -41,13 +41,11 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install -e . pip install -e '.[test]'
python setup.py develop
- name: Compile all scripts - name: Compile all scripts
run: python -m compileall -f terminatorlib/ tests/ remotinator terminator run: python -m compileall -f terminatorlib/ tests/ remotinator terminator
- name: Run tests - name: Run tests
run: | run: |
pip install -e '.[test]' xvfb-run -a pytest
xvfb-run -a python setup.py test

View File

@ -1,13 +1,13 @@
'\" t '\" t
.\" Title: terminator_config .\" Title: terminator_config
.\" Author: [see the "AUTHOR(S)" section] .\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 2.0.18 .\" Generator: Asciidoctor 2.0.16
.\" Date: 2023-04-22 .\" Date: 2023-10-10
.\" Manual: Manual for Terminator .\" Manual: Manual for Terminator
.\" Source: Terminator .\" Source: Terminator
.\" Language: English .\" Language: English
.\" .\"
.TH "TERMINATOR_CONFIG" "5" "2023-04-22" "Terminator" "Manual for Terminator" .TH "TERMINATOR_CONFIG" "5" "2023-10-10" "Terminator" "Manual for Terminator"
.ie \n(.g .ds Aq \(aq .ie \n(.g .ds Aq \(aq
.el .ds Aq ' .el .ds Aq '
.ss \n[.ss] 0 .ss \n[.ss] 0
@ -130,12 +130,11 @@ If set to True, the window will resize in step with font sizes.
Default value: \fBFalse\fP Default value: \fBFalse\fP
.RE .RE
.sp .sp
\fBsuppress_multiple_term_dialog\fP = \fIboolean\fP \fBask_before_closing\fP = \fIstring\fP
.RS 4 .RS 4
If set to True, Terminator will ask for confirmation when closing Specify when to ask for confirmation before closing a window or a tab.
multiple terminals. Can be any of: \*(Aqalways\*(Aq, \*(Aqmultiple_terminals\*(Aq, \*(Aqnever\*(Aq.
.br Default value: \fBmultiple_terminals\fP
Default value: \fBFalse\fP
.RE .RE
.sp .sp
\fBborderless\fP = \fIboolean\fP \fBborderless\fP = \fIboolean\fP

View File

@ -2,7 +2,7 @@
:doctype: manpage :doctype: manpage
:manmanual: Manual for Terminator :manmanual: Manual for Terminator
:mansource: Terminator :mansource: Terminator
:revdate: 2023-04-22 :revdate: 2023-10-10
:docdate: {revdate} :docdate: {revdate}
== NAME == NAME
@ -90,10 +90,10 @@ Default value: *False*
If set to True, the window will resize in step with font sizes. + If set to True, the window will resize in step with font sizes. +
Default value: *False* Default value: *False*
*suppress_multiple_term_dialog* = _boolean_:: *ask_before_closing* = _string_::
If set to True, Terminator will ask for confirmation when closing Specify when to ask for confirmation before closing a window or a tab.
multiple terminals. + Can be any of: 'always', 'multiple_terminals', 'never'.
Default value: *False* Default value: *multiple_terminals*
// --- Window appearance --- // --- Window appearance ---

327
po/ru.po
View File

@ -5,24 +5,22 @@
# #
# Translators: # Translators:
# Gnome Terminator <terminator@lazyfrosch.de>, 2020 # Gnome Terminator <terminator@lazyfrosch.de>, 2020
# Mariya Shikunova <mariia@basealt.ru>, 2023
# #
#, fuzzy #, fuzzy
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-01-22 00:51+0100\n" "POT-Creation-Date: 2022-10-19 09:29-0400\n"
"PO-Revision-Date: 2020-04-22 08:11+0000\n" "PO-Revision-Date: 2020-04-22 08:11+0000\n"
"Last-Translator: Gnome Terminator <terminator@lazyfrosch.de>, 2020\n" "Last-Translator: Mariya Shikunova <mariia@basealt.ru>, 2023\n"
"Language-Team: Russian (https://www.transifex.com/terminator/teams/109338/" "Language-Team: Russian (https://app.transifex.com/terminator/teams/109338/ru/)\n"
"ru/)\n"
"Language: ru\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" "Language: ru\n"
"%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n" "Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n"
"%100>=11 && n%100<=14)? 2 : 3);\n"
#. Command uuid req. Description #. Command uuid req. Description
#: ../remotinator.py:39 #: ../remotinator.py:39
@ -47,7 +45,7 @@ msgstr "Вывести список всех терминалов"
#: ../remotinator.py:44 #: ../remotinator.py:44
msgid "Get the uuid of the current focused terminal" msgid "Get the uuid of the current focused terminal"
msgstr "" msgstr "Вывести UUID текущего терминала"
#: ../remotinator.py:45 #: ../remotinator.py:45
msgid "Get the UUID of a parent window" msgid "Get the UUID of a parent window"
@ -67,23 +65,23 @@ msgstr "Вывести заголовок родительской вкладк
#: ../remotinator.py:49 #: ../remotinator.py:49
msgid "Set the title of a parent tab" msgid "Set the title of a parent tab"
msgstr "" msgstr "Указать заголовок родительской вкладки"
#: ../remotinator.py:50 #: ../remotinator.py:50
msgid "Set the background image" msgid "Set the background image"
msgstr "" msgstr "Указать фоновое изображение"
#: ../remotinator.py:51 #: ../remotinator.py:51
msgid "Set the background image for all terminals" msgid "Set the background image for all terminals"
msgstr "" msgstr "Указать фоновое изображение для всех терминалов"
#: ../remotinator.py:52 #: ../remotinator.py:52
msgid "Switch current terminal profile" msgid "Switch current terminal profile"
msgstr "" msgstr "Переключиться на профиль текущего терминала"
#: ../remotinator.py:53 #: ../remotinator.py:53
msgid "Switch profile of all currently running terminals" msgid "Switch profile of all currently running terminals"
msgstr "" msgstr "Переключиться на профиль всех текущих запущенных терминалов"
#: ../remotinator.py:70 #: ../remotinator.py:70
#, python-format #, python-format
@ -112,23 +110,24 @@ msgstr ""
#: ../remotinator.py:80 #: ../remotinator.py:80
msgid "Profile name to switch to" msgid "Profile name to switch to"
msgstr "" msgstr "Имя профиля для переключения"
#: ../remotinator.py:83 #: ../remotinator.py:83
msgid "File to pass to command" msgid "File to pass to command"
msgstr "" msgstr "Файл для передачи команде"
#: ../remotinator.py:86 #: ../remotinator.py:86
msgid "Command to run in new terminal" msgid "Command to run in new terminal"
msgstr "" msgstr "Команда для выполнения в новом терминале"
#: ../remotinator.py:89 #: ../remotinator.py:89
msgid "Tab name to set. Only used with \"set_tab_title\" command." msgid "Tab name to set. Only used with \"set_tab_title\" command."
msgstr "" msgstr ""
"Имя вкладки для установки. Используется только с командой «set_tab_title»."
#: ../remotinator.py:92 #: ../remotinator.py:92
msgid "Tab name to set." msgid "Tab name to set."
msgstr "" msgstr "Имя вкладки для установки."
#: ../data/terminator.desktop.in.h:1 ../data/terminator.appdata.xml.in.h:1 #: ../data/terminator.desktop.in.h:1 ../data/terminator.appdata.xml.in.h:1
#: ../terminatorlib/plugins/activitywatch.py:83 #: ../terminatorlib/plugins/activitywatch.py:83
@ -153,6 +152,11 @@ msgid ""
"terminals in grids (tabs is the most common default method, which Terminator" "terminals in grids (tabs is the most common default method, which Terminator"
" also supports)." " also supports)."
msgstr "" msgstr ""
"Удобный инструмент для настройки терминалов. На его создание вдохновили "
"такие программы, как gnome-multi-term и quadkonsole, в которых основное "
"внимание уделяется размещению терминалов в виде сетки (наиболее "
"распространённый метод по умолчанию — вкладки, который также поддерживается "
"в Terminator)"
#: ../data/terminator.appdata.xml.in.h:5 #: ../data/terminator.appdata.xml.in.h:5
msgid "" msgid ""
@ -161,6 +165,10 @@ msgid ""
"out in different directions with useful features for sysadmins and other " "out in different directions with useful features for sysadmins and other "
"users." "users."
msgstr "" msgstr ""
"Большая часть поведения Terminator основана на GNOME Terminal, и со временем"
" в приложение добавляется всё больше функций из него, однако также есть "
"планы по расширению Terminator в разных направлениях с помощью полезных "
"функций для системных администраторов и других пользователей."
#: ../data/terminator.appdata.xml.in.h:6 #: ../data/terminator.appdata.xml.in.h:6
msgid "Some highlights:" msgid "Some highlights:"
@ -180,7 +188,7 @@ msgstr "Перетаскивание и изменение порядка тер
#: ../data/terminator.appdata.xml.in.h:10 #: ../data/terminator.appdata.xml.in.h:10
msgid "Lots of keyboard shortcuts" msgid "Lots of keyboard shortcuts"
msgstr "Множество сочетаний клавиш быстрого доступа" msgstr "Множество комбинаций клавиш быстрого доступа"
#: ../data/terminator.appdata.xml.in.h:11 #: ../data/terminator.appdata.xml.in.h:11
msgid "Save multiple layouts and profiles via GUI preferences editor" msgid "Save multiple layouts and profiles via GUI preferences editor"
@ -225,7 +233,7 @@ msgid ""
"This window has several terminals open. Closing the window will also close " "This window has several terminals open. Closing the window will also close "
"all terminals within it." "all terminals within it."
msgstr "" msgstr ""
"Это окно имеет несколько запущенных терминалов. Закрытие окна повлечет за " "Это окно имеет несколько запущенных терминалов. Закрытие окна повлечёт за "
"собой так же и их закрытие." "собой так же и их закрытие."
#: ../terminatorlib/container.py:178 #: ../terminatorlib/container.py:178
@ -233,7 +241,7 @@ msgid ""
"This tab has several terminals open. Closing the tab will also close all " "This tab has several terminals open. Closing the tab will also close all "
"terminals within it." "terminals within it."
msgstr "" msgstr ""
"Эта вкладка имеет несколько запущенных терминалов. Ее закрытие повлечет за " "Эта вкладка имеет несколько запущенных терминалов. Её закрытие повлечёт за "
"собой также и их закрытие." "собой также и их закрытие."
#: ../terminatorlib/container.py:198 #: ../terminatorlib/container.py:198
@ -308,7 +316,7 @@ msgstr "Укажите файл конфигурации"
#: ../terminatorlib/optionparse.py:71 #: ../terminatorlib/optionparse.py:71
msgid "Specify a partial config json file" msgid "Specify a partial config json file"
msgstr "" msgstr "Укажите частичный json-файл конфигурации"
#: ../terminatorlib/optionparse.py:76 #: ../terminatorlib/optionparse.py:76
msgid "Set the working directory" msgid "Set the working directory"
@ -316,7 +324,8 @@ msgstr "Установить рабочий каталог"
#: ../terminatorlib/optionparse.py:77 #: ../terminatorlib/optionparse.py:77
msgid "Set a custom icon for the window (by file or name)" msgid "Set a custom icon for the window (by file or name)"
msgstr "Установить пользовательский значок для этого окна (по файлу или имени)" msgstr ""
"Установить пользовательский значок для этого окна (по файлу или имени)"
#: ../terminatorlib/optionparse.py:80 #: ../terminatorlib/optionparse.py:80
msgid "Set a custom WM_WINDOW_ROLE property on the window" msgid "Set a custom WM_WINDOW_ROLE property on the window"
@ -352,19 +361,19 @@ msgstr "Разделенный запятыми список методов дл
#: ../terminatorlib/optionparse.py:96 #: ../terminatorlib/optionparse.py:96
msgid "If Terminator is already running, just open a new tab" msgid "If Terminator is already running, just open a new tab"
msgstr "Если Терминатор уже запущен, просто откройте новую вкладку" msgstr "Если Terminator уже запущен, просто откройте новую вкладку"
#: ../terminatorlib/optionparse.py:98 #: ../terminatorlib/optionparse.py:98
msgid "If Terminator is already running, just unhide all hidden windows" msgid "If Terminator is already running, just unhide all hidden windows"
msgstr "" msgstr "Если Terminator уже запущен, раскройте все скрытые окна"
#: ../terminatorlib/optionparse.py:100 #: ../terminatorlib/optionparse.py:100
msgid "List all profiles" msgid "List all profiles"
msgstr "" msgstr "Вывести список всех профилей"
#: ../terminatorlib/optionparse.py:102 #: ../terminatorlib/optionparse.py:102
msgid "List all layouts" msgid "List all layouts"
msgstr "" msgstr "Вывести список всех компоновок"
#: ../terminatorlib/plugins/activitywatch.py:54 #: ../terminatorlib/plugins/activitywatch.py:54
msgid "Watch for _activity" msgid "Watch for _activity"
@ -482,7 +491,7 @@ msgstr "Название *%s* уже существует"
#: ../terminatorlib/plugins/dir_open.py:26 #: ../terminatorlib/plugins/dir_open.py:26
msgid "Open current directory" msgid "Open current directory"
msgstr "" msgstr "Открыть текущий каталог"
#: ../terminatorlib/plugins/logger.py:21 #: ../terminatorlib/plugins/logger.py:21
#: ../terminatorlib/plugins/terminalshot.py:21 #: ../terminatorlib/plugins/terminalshot.py:21
@ -552,15 +561,15 @@ msgstr "Оставить терминал открытым"
#: ../terminatorlib/preferences.glade.h:11 #: ../terminatorlib/preferences.glade.h:11
msgid "Black on light yellow" msgid "Black on light yellow"
msgstr "Черный на светло-жёлтом" msgstr "Чёрный на светло-жёлтом"
#: ../terminatorlib/preferences.glade.h:12 #: ../terminatorlib/preferences.glade.h:12
msgid "Black on white" msgid "Black on white"
msgstr "Черный на белом" msgstr "Чёрный на белом"
#: ../terminatorlib/preferences.glade.h:13 #: ../terminatorlib/preferences.glade.h:13
msgid "Gray on black" msgid "Gray on black"
msgstr "серый на чёрном" msgstr "Серый на чёрном"
#: ../terminatorlib/preferences.glade.h:14 #: ../terminatorlib/preferences.glade.h:14
msgid "Green on black" msgid "Green on black"
@ -572,7 +581,7 @@ msgstr "Белый на чёрном"
#: ../terminatorlib/preferences.glade.h:16 #: ../terminatorlib/preferences.glade.h:16
msgid "Orange on black" msgid "Orange on black"
msgstr "Оранжевый на черном" msgstr "Оранжевый на чёрном"
#: ../terminatorlib/preferences.glade.h:17 #: ../terminatorlib/preferences.glade.h:17
msgid "Ambience" msgid "Ambience"
@ -592,7 +601,7 @@ msgstr "Gruvbox светлая"
#: ../terminatorlib/preferences.glade.h:21 #: ../terminatorlib/preferences.glade.h:21
msgid "Gruvbox dark" msgid "Gruvbox dark"
msgstr "Gruvbox темная" msgstr "Gruvbox тёмная"
#: ../terminatorlib/preferences.glade.h:22 #: ../terminatorlib/preferences.glade.h:22
msgid "Custom" msgid "Custom"
@ -616,7 +625,7 @@ msgstr "Используемый в GNOME по умолчанию"
#: ../terminatorlib/preferences.glade.h:27 #: ../terminatorlib/preferences.glade.h:27
msgid "Click to focus" msgid "Click to focus"
msgstr "Активизация при щелчке мышью" msgstr "Фокус по щелчку"
#: ../terminatorlib/preferences.glade.h:28 #: ../terminatorlib/preferences.glade.h:28
msgid "Follow mouse pointer" msgid "Follow mouse pointer"
@ -684,7 +693,7 @@ msgstr "Полноэкранный режим"
#: ../terminatorlib/preferences.glade.h:45 #: ../terminatorlib/preferences.glade.h:45
msgid "Terminator Preferences" msgid "Terminator Preferences"
msgstr "Терминатор Параметры" msgstr "Параметры Terminator"
#: ../terminatorlib/preferences.glade.h:46 #: ../terminatorlib/preferences.glade.h:46
msgid "<b>Behavior</b>" msgid "<b>Behavior</b>"
@ -716,7 +725,7 @@ msgstr "Подсказка геометрии окна"
#: ../terminatorlib/preferences.glade.h:53 #: ../terminatorlib/preferences.glade.h:53
msgid "DBus server" msgid "DBus server"
msgstr "DBus сервер" msgstr "Сервер DBus"
#: ../terminatorlib/preferences.glade.h:54 #: ../terminatorlib/preferences.glade.h:54
msgid "Mouse focus:" msgid "Mouse focus:"
@ -728,11 +737,11 @@ msgstr "Режим трансляции нажатий клавиш"
#: ../terminatorlib/preferences.glade.h:56 #: ../terminatorlib/preferences.glade.h:56
msgid "PuTTY style paste:" msgid "PuTTY style paste:"
msgstr "" msgstr "Стиль вставки PuTTY:"
#: ../terminatorlib/preferences.glade.h:57 #: ../terminatorlib/preferences.glade.h:57
msgid "Smart copy" msgid "Smart copy"
msgstr "\"Умное\" копирование" msgstr "«Умное» копирование"
#: ../terminatorlib/preferences.glade.h:58 #: ../terminatorlib/preferences.glade.h:58
msgid "Re-use profiles for new terminals" msgid "Re-use profiles for new terminals"
@ -744,23 +753,23 @@ msgstr "Использовать пользовательский обработ
#: ../terminatorlib/preferences.glade.h:60 #: ../terminatorlib/preferences.glade.h:60
msgid "PRIMARY" msgid "PRIMARY"
msgstr "" msgstr "PRIMARY"
#: ../terminatorlib/preferences.glade.h:61 #: ../terminatorlib/preferences.glade.h:61
msgid "Clipboard" msgid "Clipboard"
msgstr "" msgstr "Буфер обмена"
#: ../terminatorlib/preferences.glade.h:62 #: ../terminatorlib/preferences.glade.h:62
msgid "Clear selection on copy" msgid "Clear selection on copy"
msgstr "" msgstr "Отменить выделение при копировании"
#: ../terminatorlib/preferences.glade.h:63 #: ../terminatorlib/preferences.glade.h:63
msgid "Open links with a single click (instead of Ctrl-left click)" msgid "Open links with a single click (instead of Ctrl-left click)"
msgstr "" msgstr "Открывать ссылки щелчком мыши (вместо Ctrl+ЛКМ)"
#: ../terminatorlib/preferences.glade.h:64 #: ../terminatorlib/preferences.glade.h:64
msgid "Disable mouse paste" msgid "Disable mouse paste"
msgstr "" msgstr "Отключить вставку мышью"
#: ../terminatorlib/preferences.glade.h:65 #: ../terminatorlib/preferences.glade.h:65
msgid "Custom URL handler:" msgid "Custom URL handler:"
@ -788,11 +797,11 @@ msgstr "Дополнительные стили (зависит от темы)"
#: ../terminatorlib/preferences.glade.h:71 #: ../terminatorlib/preferences.glade.h:71
msgid "Cell Height:" msgid "Cell Height:"
msgstr "" msgstr "Высота ячейки:"
#: ../terminatorlib/preferences.glade.h:72 #: ../terminatorlib/preferences.glade.h:72
msgid "Cell Width:" msgid "Cell Width:"
msgstr "" msgstr "Ширина ячейки:"
#: ../terminatorlib/preferences.glade.h:73 #: ../terminatorlib/preferences.glade.h:73
msgid "Tab position:" msgid "Tab position:"
@ -808,7 +817,7 @@ msgstr "Кнопки переключения вкладок"
#: ../terminatorlib/preferences.glade.h:76 #: ../terminatorlib/preferences.glade.h:76
msgid "Title bar at bottom (Require restart)" msgid "Title bar at bottom (Require restart)"
msgstr "" msgstr "Панель заголовка внизу (требуется перезапуск)"
#: ../terminatorlib/preferences.glade.h:77 #: ../terminatorlib/preferences.glade.h:77
msgid "Global" msgid "Global"
@ -844,11 +853,11 @@ msgstr "Копирование на выбор"
#: ../terminatorlib/preferences.glade.h:85 #: ../terminatorlib/preferences.glade.h:85
msgid "Disable Ctrl+mousewheel zoom" msgid "Disable Ctrl+mousewheel zoom"
msgstr "" msgstr "Отключить масштабирование через Ctrl+колёсико мыши"
#: ../terminatorlib/preferences.glade.h:86 #: ../terminatorlib/preferences.glade.h:86
msgid "Select-by-_word characters:" msgid "Select-by-_word characters:"
msgstr "Выбор _слов по символам:" msgstr "Символы, выделяемые по _слову:"
#: ../terminatorlib/preferences.glade.h:87 #: ../terminatorlib/preferences.glade.h:87
msgid "<b>Cursor</b>" msgid "<b>Cursor</b>"
@ -864,11 +873,11 @@ msgstr "Мерцание"
#: ../terminatorlib/preferences.glade.h:90 #: ../terminatorlib/preferences.glade.h:90
msgid "Use default colors" msgid "Use default colors"
msgstr "" msgstr "Цвет по умолчанию"
#: ../terminatorlib/preferences.glade.h:91 #: ../terminatorlib/preferences.glade.h:91
msgid "Foreground:" msgid "Foreground:"
msgstr "" msgstr "Передний план:"
#: ../terminatorlib/preferences.glade.h:92 #: ../terminatorlib/preferences.glade.h:92
msgid "Background:" msgid "Background:"
@ -928,11 +937,11 @@ msgstr "Встроенные с_хемы:"
#: ../terminatorlib/preferences.glade.h:107 #: ../terminatorlib/preferences.glade.h:107
msgid "_Foreground:" msgid "_Foreground:"
msgstr "" msgstr "ередний план"
#: ../terminatorlib/preferences.glade.h:108 #: ../terminatorlib/preferences.glade.h:108
msgid "_Background:" msgid "_Background:"
msgstr "" msgstr "_Задний план:"
#: ../terminatorlib/preferences.glade.h:109 #: ../terminatorlib/preferences.glade.h:109
msgid "<b>Palette</b>" msgid "<b>Palette</b>"
@ -948,7 +957,7 @@ msgstr "Цветовая _палитра:"
#: ../terminatorlib/preferences.glade.h:112 #: ../terminatorlib/preferences.glade.h:112
msgid "Show b_old text in bright colors" msgid "Show b_old text in bright colors"
msgstr "" msgstr "Показывать п_олужирный текст в светлых цветах"
#: ../terminatorlib/preferences.glade.h:113 #: ../terminatorlib/preferences.glade.h:113
msgid "Colors" msgid "Colors"
@ -964,19 +973,19 @@ msgstr "_Прозрачный фон"
#: ../terminatorlib/preferences.glade.h:116 #: ../terminatorlib/preferences.glade.h:116
msgid "Background Image" msgid "Background Image"
msgstr "" msgstr "Фоновое изображение"
#: ../terminatorlib/preferences.glade.h:117 #: ../terminatorlib/preferences.glade.h:117
msgid "Background Image File:" msgid "Background Image File:"
msgstr "" msgstr "Файл фонового изображения"
#: ../terminatorlib/preferences.glade.h:118 #: ../terminatorlib/preferences.glade.h:118
msgid "Choose file" msgid "Choose file"
msgstr "" msgstr "Выберите файл"
#: ../terminatorlib/preferences.glade.h:119 #: ../terminatorlib/preferences.glade.h:119
msgid "S_hade background:" msgid "S_hade background:"
msgstr "" msgstr "З_атенение фона:"
#: ../terminatorlib/preferences.glade.h:120 #: ../terminatorlib/preferences.glade.h:120
msgid "<small><i>None</i></small>" msgid "<small><i>None</i></small>"
@ -1022,12 +1031,12 @@ msgstr "Прокрутка"
msgid "" msgid ""
"<small><i><b>Note:</b> These options may cause some applications to behave " "<small><i><b>Note:</b> These options may cause some applications to behave "
"incorrectly. They are only here to allow you to work around certain " "incorrectly. They are only here to allow you to work around certain "
"applications and operating systems that expect different terminal behavior.</" "applications and operating systems that expect different terminal "
"i></small>" "behavior.</i></small>"
msgstr "" msgstr ""
"<small><i><b>Замечание:</b> Эти параметры могут вызвать некорректную работу " "<small><i><b>Замечание:</b> Эти параметры могут вызвать некорректную работу "
"некоторых приложений. Они представлены только для того, чтобы позволить " "некоторых приложений. Они представлены только для того, чтобы позволить "
"работать с некоторыми приложениями и операционными ситемами, ожидающими " "работать с некоторыми приложениями и операционными системами, ожидающими "
"другого поведения терминала. </i></small>" "другого поведения терминала. </i></small>"
#: ../terminatorlib/preferences.glade.h:131 #: ../terminatorlib/preferences.glade.h:131
@ -1072,7 +1081,7 @@ msgstr "Укажите шрифт заголовка"
#: ../terminatorlib/preferences.glade.h:141 #: ../terminatorlib/preferences.glade.h:141
msgid "Titlebar" msgid "Titlebar"
msgstr "" msgstr "Заголовок окна"
#: ../terminatorlib/preferences.glade.h:142 #: ../terminatorlib/preferences.glade.h:142
#: ../terminatorlib/terminal_popup_menu.py:204 #: ../terminatorlib/terminal_popup_menu.py:204
@ -1113,11 +1122,11 @@ msgstr "Комбинации клавиш"
#: ../terminatorlib/preferences.glade.h:153 #: ../terminatorlib/preferences.glade.h:153
msgid "Plugin" msgid "Plugin"
msgstr "Надстройка" msgstr "Модуль"
#: ../terminatorlib/preferences.glade.h:154 #: ../terminatorlib/preferences.glade.h:154
msgid "This plugin has no configuration options" msgid "This plugin has no configuration options"
msgstr "Этот плагин не имеет параметров конфигурации" msgstr "Этот модуль не имеет параметров конфигурации"
#: ../terminatorlib/preferences.glade.h:155 #: ../terminatorlib/preferences.glade.h:155
msgid "Plugins" msgid "Plugins"
@ -1125,32 +1134,17 @@ msgstr "Модули"
#: ../terminatorlib/preferences.glade.h:158 #: ../terminatorlib/preferences.glade.h:158
msgid "Version: 2.1.1" msgid "Version: 2.1.1"
msgstr "" msgstr "Версия: 2.1.1"
#: ../terminatorlib/preferences.glade.h:159 #: ../terminatorlib/preferences.glade.h:159
msgid "" msgid ""
"The goal of this project is to produce a useful tool for arranging " "The goal of this project is to produce a useful tool for arranging terminals. It is inspired by programs such as gnome-multi-term, quadkonsole, etc. in that the main focus is arranging terminals in grids (tabs is the most common default method, which Terminator also supports).\n"
"terminals. It is inspired by programs such as gnome-multi-term, quadkonsole, "
"etc. in that the main focus is arranging terminals in grids (tabs is the "
"most common default method, which Terminator also supports).\n"
"\n" "\n"
"Much of the behavior of Terminator is based on GNOME Terminal, and we are " "Much of the behavior of Terminator is based on GNOME Terminal, and we are adding more features from that as time goes by, but we also want to extend out in different directions with useful features for sysadmins and other users. If you have any suggestions, please file wishlist bugs! (see left for the Development link)"
"adding more features from that as time goes by, but we also want to extend "
"out in different directions with useful features for sysadmins and other "
"users. If you have any suggestions, please file wishlist bugs! (see left for "
"the Development link)"
msgstr "" msgstr ""
"Задачей данного проекта является создание удобного инструмента для " "Задачей данного проекта является создание удобного инструмента для совмещения терминалов. Вдохновлённый такими программами как gnome-multi-term, quadkonsole и подобных, он прежде всего нацелен собирать терминалы в сетки (которые в свою очередь могут разноситься по вкладкам, которые, кстати Terminator так же поддерживает).\n"
"совмещения терминалов. Вдохновленный такими программами как gnome-multi-"
"term, quadkonsole и подобных, он прежде всего нацелен собирать терминалы в "
"сетки (которые в свою очередь могут разноситься по вкладкам, которые, кстати "
"Terminator так же поддерживает).\n"
"\n" "\n"
"Большая часть функционала заимствована из GNOME Terminal и мы со временем " "Большая часть функционала заимствована из GNOME Terminal и мы со временем добавляем больше разных плюшек оттуда. Но хотелось бы как-то еще расширить его возможности для сисадминов и прочих пользователей. Если у вас есть какие-либо предложения, пожалуйста озвучьте их на багтрекере (wishlist bugs)! (см. сайт разработчиков)"
"добавляем больше разных плюшек оттуда. Но хотелось бы как-то еще расширить "
"его возможности для сисадминов и прочих пользователей. Если у вас есть какие-"
"либо предложения, пожалуйста озвучьте их на багтрекере (wishlist bugs)! (см. "
"сайт разработчиков)"
#: ../terminatorlib/preferences.glade.h:162 #: ../terminatorlib/preferences.glade.h:162
msgid "The Manual" msgid "The Manual"
@ -1159,9 +1153,10 @@ msgstr "Руководство"
#: ../terminatorlib/preferences.glade.h:163 #: ../terminatorlib/preferences.glade.h:163
msgid "" msgid ""
"<a href=\"https://github.com/gnome-terminator/terminator\">Development</a>\n" "<a href=\"https://github.com/gnome-terminator/terminator\">Development</a>\n"
"<a href=\"https://github.com/gnome-terminator/terminator/issues\">Bugs / " "<a href=\"https://github.com/gnome-terminator/terminator/issues\">Bugs / Enhancements</a>"
"Enhancements</a>"
msgstr "" msgstr ""
"<a href=\"https://github.com/gnome-terminator/terminator\">Разработка</a>\n"
"<a href=\"https://github.com/gnome-terminator/terminator/issues\">Ошибки / Улучшения</a>"
#: ../terminatorlib/preferences.glade.h:165 #: ../terminatorlib/preferences.glade.h:165
msgid "About" msgid "About"
@ -1181,15 +1176,15 @@ msgstr "Восстановить размер шрифта"
#: ../terminatorlib/prefseditor.py:107 #: ../terminatorlib/prefseditor.py:107
msgid "Increase font size on all terminals" msgid "Increase font size on all terminals"
msgstr "" msgstr "Увеличить размер шрифта во всех терминалах"
#: ../terminatorlib/prefseditor.py:108 #: ../terminatorlib/prefseditor.py:108
msgid "Decrease font size on all terminals" msgid "Decrease font size on all terminals"
msgstr "" msgstr "Уменьшить размер шрифта во всех терминалах"
#: ../terminatorlib/prefseditor.py:109 #: ../terminatorlib/prefseditor.py:109
msgid "Restore original font size on all terminals" msgid "Restore original font size on all terminals"
msgstr "" msgstr "Восстановить исходный размер шрифта во всех терминалах"
#: ../terminatorlib/prefseditor.py:110 #: ../terminatorlib/prefseditor.py:110
msgid "Create a new tab" msgid "Create a new tab"
@ -1249,7 +1244,7 @@ msgstr "Вставить из буфера обмена"
#: ../terminatorlib/prefseditor.py:126 #: ../terminatorlib/prefseditor.py:126
msgid "Paste primary selection" msgid "Paste primary selection"
msgstr "" msgstr "Вставить первоначальный выделенный фрагмент"
#: ../terminatorlib/prefseditor.py:127 #: ../terminatorlib/prefseditor.py:127
msgid "Show/Hide the scrollbar" msgid "Show/Hide the scrollbar"
@ -1385,7 +1380,7 @@ msgstr "Показать/Скрыть окно"
#: ../terminatorlib/prefseditor.py:160 #: ../terminatorlib/prefseditor.py:160
msgid "Create new group" msgid "Create new group"
msgstr "" msgstr "Создать новую группу"
#: ../terminatorlib/prefseditor.py:161 #: ../terminatorlib/prefseditor.py:161
msgid "Group all terminals" msgid "Group all terminals"
@ -1393,7 +1388,7 @@ msgstr "Группировать все терминалы"
#: ../terminatorlib/prefseditor.py:162 #: ../terminatorlib/prefseditor.py:162
msgid "Group/Ungroup all terminals" msgid "Group/Ungroup all terminals"
msgstr "Группировать/разрознить все терминалы" msgstr "Группировать/разделить все терминалы"
#: ../terminatorlib/prefseditor.py:163 #: ../terminatorlib/prefseditor.py:163
msgid "Ungroup all terminals" msgid "Ungroup all terminals"
@ -1401,15 +1396,15 @@ msgstr "Разгруппировать все терминалы"
#: ../terminatorlib/prefseditor.py:164 #: ../terminatorlib/prefseditor.py:164
msgid "Group terminals in window" msgid "Group terminals in window"
msgstr "" msgstr "Группировать терминалы в окне"
#: ../terminatorlib/prefseditor.py:165 #: ../terminatorlib/prefseditor.py:165
msgid "Group/Ungroup terminals in window" msgid "Group/Ungroup terminals in window"
msgstr "" msgstr "Группировать/разделить терминалы в окне"
#: ../terminatorlib/prefseditor.py:166 #: ../terminatorlib/prefseditor.py:166
msgid "Ungroup terminals in window" msgid "Ungroup terminals in window"
msgstr "" msgstr "Разгруппировать терминалы в окне"
#: ../terminatorlib/prefseditor.py:167 #: ../terminatorlib/prefseditor.py:167
msgid "Group terminals in tab" msgid "Group terminals in tab"
@ -1417,7 +1412,7 @@ msgstr "Группировать терминалы во вкладке"
#: ../terminatorlib/prefseditor.py:168 #: ../terminatorlib/prefseditor.py:168
msgid "Group/Ungroup terminals in tab" msgid "Group/Ungroup terminals in tab"
msgstr "Группировать/разрознить терминалы во вкладке" msgstr "Группировать/разделить терминалы во вкладке"
#: ../terminatorlib/prefseditor.py:169 #: ../terminatorlib/prefseditor.py:169
msgid "Ungroup terminals in tab" msgid "Ungroup terminals in tab"
@ -1429,7 +1424,7 @@ msgstr "Создать новое окно"
#: ../terminatorlib/prefseditor.py:171 #: ../terminatorlib/prefseditor.py:171
msgid "Spawn a new Terminator process" msgid "Spawn a new Terminator process"
msgstr "Создать новый процесс Terminator'а" msgstr "Создать новый процесс Terminator"
#: ../terminatorlib/prefseditor.py:172 #: ../terminatorlib/prefseditor.py:172
msgid "Don't broadcast key presses" msgid "Don't broadcast key presses"
@ -1449,7 +1444,7 @@ msgstr "Вставить номер терминала"
#: ../terminatorlib/prefseditor.py:176 #: ../terminatorlib/prefseditor.py:176
msgid "Insert padded terminal number" msgid "Insert padded terminal number"
msgstr "Вставить номер терминала" msgstr "Вставить дополненный номер терминала"
#: ../terminatorlib/prefseditor.py:177 #: ../terminatorlib/prefseditor.py:177
msgid "Edit window title" msgid "Edit window title"
@ -1477,17 +1472,17 @@ msgstr "Переключиться на предыдущий профиль"
#: ../terminatorlib/prefseditor.py:183 #: ../terminatorlib/prefseditor.py:183
msgid "Open the Preferences window" msgid "Open the Preferences window"
msgstr "" msgstr "Открыть окно параметров"
#: ../terminatorlib/prefseditor.py:184 #: ../terminatorlib/prefseditor.py:184
msgid "Open the manual" msgid "Open the manual"
msgstr "Открыть руководство" msgstr "Открыть руководство"
#: ../terminatorlib/prefseditor.py:1370 #: ../terminatorlib/prefseditor.py:1366
msgid "New Profile" msgid "New Profile"
msgstr "Создать профиль" msgstr "Создать профиль"
#: ../terminatorlib/prefseditor.py:1413 ../terminatorlib/prefseditor.py:1418 #: ../terminatorlib/prefseditor.py:1409 ../terminatorlib/prefseditor.py:1414
msgid "New Layout" msgid "New Layout"
msgstr "Новое расположение" msgstr "Новое расположение"
@ -1534,7 +1529,7 @@ msgstr "Вст_авить"
#: ../terminatorlib/terminal_popup_menu.py:112 #: ../terminatorlib/terminal_popup_menu.py:112
msgid "Set W_indow Title" msgid "Set W_indow Title"
msgstr "" msgstr "Указать название о_кна"
#: ../terminatorlib/terminal_popup_menu.py:117 #: ../terminatorlib/terminal_popup_menu.py:117
msgid "Split H_orizontally" msgid "Split H_orizontally"
@ -1574,7 +1569,7 @@ msgstr "Группирование"
#: ../terminatorlib/terminal_popup_menu.py:186 #: ../terminatorlib/terminal_popup_menu.py:186
msgid "Relaunch Command" msgid "Relaunch Command"
msgstr "" msgstr "Перезапустить команду"
#: ../terminatorlib/terminal_popup_menu.py:191 #: ../terminatorlib/terminal_popup_menu.py:191
msgid "Show _scrollbar" msgid "Show _scrollbar"
@ -1582,7 +1577,7 @@ msgstr "Показать полосу прокрутки"
#: ../terminatorlib/terminal_popup_menu.py:248 #: ../terminatorlib/terminal_popup_menu.py:248
msgid "_Layouts..." msgid "_Layouts..."
msgstr "" msgstr "аблоны..."
#: ../terminatorlib/terminal.py:481 #: ../terminatorlib/terminal.py:481
msgid "N_ew group..." msgid "N_ew group..."
@ -1599,11 +1594,11 @@ msgstr "Удалить группу %s"
#: ../terminatorlib/terminal.py:512 #: ../terminatorlib/terminal.py:512
msgid "G_roup all in window" msgid "G_roup all in window"
msgstr "" msgstr "С_группировать всё в окне"
#: ../terminatorlib/terminal.py:517 #: ../terminatorlib/terminal.py:517
msgid "Ungro_up all in window" msgid "Ungro_up all in window"
msgstr "" msgstr "Раз_группировать всё в окне"
#: ../terminatorlib/terminal.py:522 #: ../terminatorlib/terminal.py:522
msgid "G_roup all in tab" msgid "G_roup all in tab"
@ -1611,7 +1606,7 @@ msgstr "С_группировать всё во вкладке"
#: ../terminatorlib/terminal.py:527 #: ../terminatorlib/terminal.py:527
msgid "Ungro_up all in tab" msgid "Ungro_up all in tab"
msgstr "Раз_рознить терминалы во вкладке" msgstr "Раз_группировать терминалы во вкладке"
#: ../terminatorlib/terminal.py:532 #: ../terminatorlib/terminal.py:532
msgid "Remove all groups" msgid "Remove all groups"
@ -1650,25 +1645,25 @@ msgstr "_Добавить номер терминала"
msgid "Insert _padded terminal number" msgid "Insert _padded terminal number"
msgstr "Вставить _номер терминала" msgstr "Вставить _номер терминала"
#: ../terminatorlib/terminal.py:1490 #: ../terminatorlib/terminal.py:1492
msgid "Unable to find a shell" msgid "Unable to find a shell"
msgstr "Не удается найти оболочку (shell)" msgstr "Не удается найти оболочку (shell)"
#: ../terminatorlib/terminal.py:1521 #: ../terminatorlib/terminal.py:1546
msgid "Unable to start shell:" msgid "Unable to start shell:"
msgstr "Не удается запустить оболочку:" msgstr "Не удается запустить оболочку:"
#: ../terminatorlib/terminal.py:1975 #: ../terminatorlib/terminal.py:2000
msgid "Rename Window" msgid "Rename Window"
msgstr "Переименование окна" msgstr "Переименование окна"
#: ../terminatorlib/terminal.py:1983 #: ../terminatorlib/terminal.py:2008
msgid "Enter a new title for the Terminator window..." msgid "Enter a new title for the Terminator window..."
msgstr "Введите новое название для окна Terminator..." msgstr "Введите новое название для окна Terminator..."
#: ../terminatorlib/titlebar.py:112 #: ../terminatorlib/titlebar.py:112
msgid "[INACTIVE: Right-Click for Relaunch option] " msgid "[INACTIVE: Right-Click for Relaunch option] "
msgstr "" msgstr "[НЕАКТИВНО: Щёлкните правой кнопкой мыши для функции перезапуска] "
#: ../terminatorlib/titlebar.py:258 #: ../terminatorlib/titlebar.py:258
msgid "Alpha" msgid "Alpha"
@ -1773,117 +1768,9 @@ msgstr "окно"
#: ../terminatorlib/window.py:773 #: ../terminatorlib/window.py:773
#, python-format #, python-format
msgid "Window group %s" msgid "Window group %s"
msgstr "" msgstr "Группа окон %s"
#: ../terminatorlib/window.py:799 #: ../terminatorlib/window.py:799
#, python-format #, python-format
msgid "Tab %d" msgid "Tab %d"
msgstr "Вкладка %d" msgstr "Вкладка %d"
#~ msgid "Current Locale"
#~ msgstr "Текущая языковая настройка"
#~ msgid "Western"
#~ msgstr "Западная"
#~ msgid "Central European"
#~ msgstr "Центрально-европейская"
#~ msgid "South European"
#~ msgstr "Южно-европейская"
#~ msgid "Baltic"
#~ msgstr "Балтийская"
#~ msgid "Cyrillic"
#~ msgstr "Кириллица"
#~ msgid "Arabic"
#~ msgstr "Арабская"
#~ msgid "Greek"
#~ msgstr "Греческая"
#~ msgid "Hebrew Visual"
#~ msgstr "Иврит (Визуальный)"
#~ msgid "Hebrew"
#~ msgstr "Иврит"
#~ msgid "Turkish"
#~ msgstr "Турецкая"
#~ msgid "Nordic"
#~ msgstr "Скандинавская"
#~ msgid "Celtic"
#~ msgstr "Кельтская"
#~ msgid "Romanian"
#~ msgstr "Румынская"
#~ msgid "Unicode"
#~ msgstr "Юникод"
#~ msgid "Armenian"
#~ msgstr "Армянская"
#~ msgid "Chinese Traditional"
#~ msgstr "Традиционная китайская"
#~ msgid "Cyrillic/Russian"
#~ msgstr "Кириллица/Русская"
#~ msgid "Japanese"
#~ msgstr "Японская"
#~ msgid "Korean"
#~ msgstr "Корейская"
#~ msgid "Chinese Simplified"
#~ msgstr "Упрощенная китайская"
#~ msgid "Georgian"
#~ msgstr "Грузинская"
#~ msgid "Cyrillic/Ukrainian"
#~ msgstr "Кириллица/Украина"
#~ msgid "Croatian"
#~ msgstr "Хорватская"
#~ msgid "Hindi"
#~ msgstr "Хинди"
#~ msgid "Persian"
#~ msgstr "Персидская"
#~ msgid "Gujarati"
#~ msgstr "Гуарати (Индия)"
#~ msgid "Gurmukhi"
#~ msgstr "Гармукхи"
#~ msgid "Icelandic"
#~ msgstr "Исладнский"
#~ msgid "Vietnamese"
#~ msgstr "Вьетнамский"
#~ msgid "Thai"
#~ msgstr "Тайский"
#~ msgid "Encoding:"
#~ msgstr "Кодировка:"
#~ msgid "Encodings"
#~ msgstr "Кодировки"
#~ msgid "Default"
#~ msgstr "По умолчанию"
#~ msgid "User defined"
#~ msgstr "Пользовательский"
#~ msgid "Other Encodings"
#~ msgstr "Другие кодировки"

View File

@ -175,7 +175,7 @@ class InstallData(install_data):
return data_files return data_files
if platform.system() in ['FreeBSD', 'OpenBSD']: if platform.system() in ['OpenBSD']:
man_dir = 'man' man_dir = 'man'
else: else:
man_dir = 'share/man' man_dir = 'share/man'
@ -219,9 +219,6 @@ setup(name=APP_NAME,
'terminatorlib', 'terminatorlib',
'terminatorlib.plugins', 'terminatorlib.plugins',
], ],
setup_requires=[
'pytest-runner',
],
install_requires=[ install_requires=[
'pycairo', 'pycairo',
'configobj', 'configobj',
@ -229,7 +226,6 @@ setup(name=APP_NAME,
'pygobject', 'pygobject',
'psutil', 'psutil',
], ],
tests_require=test_deps,
extras_require={'test': test_deps}, extras_require={'test': test_deps},
package_data={'terminatorlib': ['preferences.glade', 'layoutlauncher.glade']}, package_data={'terminatorlib': ['preferences.glade', 'layoutlauncher.glade']},
cmdclass={'build': BuildData, 'install_data': InstallData, 'uninstall': Uninstall}, cmdclass={'build': BuildData, 'install_data': InstallData, 'uninstall': Uninstall},

View File

@ -21,8 +21,7 @@
import sys import sys
import os import os
import psutil
import pwd
try: try:
ORIGCWD = os.getcwd() ORIGCWD = os.getcwd()
except OSError: except OSError:
@ -111,11 +110,9 @@ if __name__ == '__main__':
elif OPTIONS.toggle_visibility: elif OPTIONS.toggle_visibility:
dbg('requesting to toggle windows visibility') dbg('requesting to toggle windows visibility')
ipc.toggle_visibility_cmdline(optionslist) ipc.toggle_visibility_cmdline(optionslist)
elif OPTIONS.reload:
if OPTIONS.reload:
dbg('requesting to reload configuration for all windows') dbg('requesting to reload configuration for all windows')
ipc.reload_configuration() ipc.reload_configuration()
elif OPTIONS.unhide: elif OPTIONS.unhide:
print('requesting to unhide windows') print('requesting to unhide windows')
ipc.unhide_cmdline(optionslist) ipc.unhide_cmdline(optionslist)

View File

@ -105,7 +105,7 @@ DEFAULTS = {
'enabled_plugins' : ['LaunchpadBugURLHandler', 'enabled_plugins' : ['LaunchpadBugURLHandler',
'LaunchpadCodeURLHandler', 'LaunchpadCodeURLHandler',
'APTURLHandler'], 'APTURLHandler'],
'suppress_multiple_term_dialog': False, 'ask_before_closing' : 'multiple_terminals',
'always_split_with_profile': False, 'always_split_with_profile': False,
'putty_paste_style' : False, 'putty_paste_style' : False,
'putty_paste_style_source_clipboard': False, 'putty_paste_style_source_clipboard': False,
@ -499,6 +499,34 @@ class Config(object):
"""Set a layout""" """Set a layout"""
return(self.base.set_layout(layout, tree)) return(self.base.set_layout(layout, tree))
def copy_layout_item(self, src_layout, dst_layout, item):
items = {}
for child in src_layout:
section = src_layout[child]
sec_type = section.get('type', None)
if sec_type != 'Terminal':
continue
cp_item = section.get(item, None)
uuid = str(section.get('uuid', None))
if cp_item:
items[uuid] = cp_item
dbg("items to be copied:%s" % items)
for child in dst_layout:
section = dst_layout[child]
sec_type = section.get('type', None)
if sec_type != 'Terminal':
continue
uuid = str(section.get('uuid', None))
update_item = items.get(uuid, None)
if uuid and update_item:
dbg("update layout item:(%s) with value:(%s)"
% (item, update_item))
section[item] = update_item
class ConfigBase(Borg): class ConfigBase(Borg):
"""Class to provide access to our user configuration""" """Class to provide access to our user configuration"""
loaded = None loaded = None
@ -622,12 +650,7 @@ class ConfigBase(Borg):
dbg('config already loaded') dbg('config already loaded')
return return
if self.command_line_options and self.command_line_options.config: filename = self.get_config_filename()
filename = self.command_line_options.config
else:
filename = os.path.join(get_config_dir(), 'config')
if not os.path.exists(filename):
filename = os.path.join(get_system_config_dir(), 'config')
dbg('looking for config file: %s' % filename) dbg('looking for config file: %s' % filename)
try: try:
# #
@ -706,6 +729,68 @@ class ConfigBase(Borg):
self.loaded = True self.loaded = True
def get_config_filename(self):
filename = ''
if self.command_line_options and self.command_line_options.config:
filename = self.command_line_options.config
else:
filename = os.path.join(get_config_dir(), 'config')
if not os.path.exists(filename):
filename = os.path.join(get_system_config_dir(), 'config')
return filename
def save_config_with_suffix(self, suffix):
try:
filename = self.get_config_filename()
#save the current config, to revert any changes make in preferences
#save the current config to config_dir path which is at least writable
cfg_filename = os.path.join(get_config_dir(), 'config')
cur_loaded_file = cfg_filename + suffix
if os.path.exists(filename) and cur_loaded_file:
dbg('copy file:%s to' \
' file:%s' % (filename, cur_loaded_file))
shutil.copy2(filename, cur_loaded_file)
elif cur_loaded_file:
open(cur_loaded_file, 'a').close()
else:
err('ConfigBase:: Unable to get filename to save')
except Exception as ex:
err('ConfigBase::save_config_with_suffix' \
' Unable to save config: %s' % ex)
def restore_config_with_suffix(self, suffix):
try:
filename = self.get_config_filename()
cfg_filename = os.path.join(get_config_dir(), 'config')
cur_loaded_file = cfg_filename + suffix
if os.path.exists(cur_loaded_file):
if not os.access(filename, os.W_OK):
dbg('path:%s not writable' \
' restoring to path:%s' % (filename,cfg_filename))
filename = cfg_filename
dbg('restore from file:%s to file:%s'
% (cur_loaded_file, filename))
shutil.copy2(cur_loaded_file, filename)
except Exception as ex:
err('ConfigBase::restore_config_with_suffix' \
' Unable to restore config: %s' % ex)
def remove_config_with_suffix(self, suffix):
try:
cfg_filename = os.path.join(get_config_dir(), 'config')
cur_loaded_file = cfg_filename + suffix
if os.path.exists(cur_loaded_file):
dbg('remove file:%s' % (cur_loaded_file))
os.remove(cur_loaded_file)
except Exception as ex:
err('ConfigBase::remove_config_with_suffix' \
' Unable to remove config: %s' % ex)
def reload(self): def reload(self):
"""Force a reload of the base config""" """Force a reload of the base config"""
self.loaded = False self.loaded = False
@ -771,6 +856,7 @@ class ConfigBase(Borg):
open(filename, 'a').close() open(filename, 'a').close()
backup_file = filename + '~' backup_file = filename + '~'
if os.path.exists(filename):
shutil.copy2(filename, backup_file) shutil.copy2(filename, backup_file)
with open(filename, 'wb') as fh: with open(filename, 'wb') as fh:

View File

@ -152,33 +152,54 @@ class Container(object):
"""Unzoom a terminal""" """Unzoom a terminal"""
raise NotImplementedError('unzoom') raise NotImplementedError('unzoom')
def construct_confirm_close(self, window, reqtype): def construct_confirm_close(self, window, child):
"""Create a confirmation dialog for closing things""" """Create a confirmation dialog for closing things"""
maker = Factory()
has_multiple_terms = False
if not maker.isinstance(child, 'Terminal'):
has_multiple_terms = True
elif maker.isinstance(self, 'Window'):
has_multiple_terms = self.is_zoomed()
# skip this dialog if applicable # skip this dialog if applicable
if self.config['suppress_multiple_term_dialog']: if self.config['ask_before_closing'] == 'never':
return Gtk.ResponseType.ACCEPT
elif self.config['ask_before_closing'] == 'multiple_terminals':
if not has_multiple_terms:
return Gtk.ResponseType.ACCEPT return Gtk.ResponseType.ACCEPT
# text
confirm_button_text = (_('Close _Terminals') if has_multiple_terms
else _('Close _Terminal'))
big_label_text = (_('Close multiple terminals?') if has_multiple_terms
else _('Close terminal?'))
if not has_multiple_terms:
description_text = _('Do you really wish to close this terminal?')
elif maker.isinstance(self, 'Window'):
description_text = _('This window has several terminals open. Closing \
the window will also close all terminals within it.')
elif maker.isinstance(self, 'Notebook'):
description_text = _('This tab has several terminals open. Closing \
the tab will also close all terminals within it.')
else:
description_text = ''
# dialog GUI
dialog = Gtk.Dialog(_('Close?'), window, Gtk.DialogFlags.MODAL) dialog = Gtk.Dialog(_('Close?'), window, Gtk.DialogFlags.MODAL)
dialog.set_resizable(False) dialog.set_resizable(False)
dialog.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT) dialog.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT)
c_all = dialog.add_button(Gtk.STOCK_CLOSE, Gtk.ResponseType.ACCEPT) c_all = dialog.add_button(Gtk.STOCK_CLOSE, Gtk.ResponseType.ACCEPT)
c_all.get_children()[0].get_children()[0].get_children()[1].set_label( c_all.get_children()[0].get_children()[0].get_children()[1].set_label(
_('Close _Terminals')) confirm_button_text)
primary = Gtk.Label(label=_('<big><b>Close multiple terminals?</b></big>')) primary = Gtk.Label(label=_('<big><b>' + big_label_text + '</b></big>'))
primary.set_use_markup(True) primary.set_use_markup(True)
primary.set_alignment(0, 0.5) primary.set_alignment(0, 0.5)
if reqtype == 'window':
label_text = _('This window has several terminals open. Closing \ secondary = Gtk.Label(label=description_text)
the window will also close all terminals within it.')
elif reqtype == 'tab':
label_text = _('This tab has several terminals open. Closing \
the tab will also close all terminals within it.')
else:
label_text = ''
secondary = Gtk.Label(label=label_text)
secondary.set_line_wrap(True) secondary.set_line_wrap(True)
labels = Gtk.VBox() labels = Gtk.VBox()
@ -203,7 +224,8 @@ the tab will also close all terminals within it.')
# set configuration # set configuration
self.config.base.reload() self.config.base.reload()
self.config['suppress_multiple_term_dialog'] = checkbox.get_active() if checkbox.get_active():
self.config['ask_before_closing'] = 'never'
self.config.save() self.config.save()
dialog.destroy() dialog.destroy()

View File

@ -359,6 +359,7 @@ def new_tab_cmdline(session, options):
def toggle_visibility_cmdline(session,options): def toggle_visibility_cmdline(session,options):
session.toggle_visibility_cmdline(options) session.toggle_visibility_cmdline(options)
@with_proxy
def reload_configuration(session): def reload_configuration(session):
"""Call the dbus method to reload configuration for all windows""" """Call the dbus method to reload configuration for all windows"""
session.reload_configuration() session.reload_configuration()

View File

@ -343,10 +343,6 @@ class Notebook(Container, Gtk.Notebook):
self.set_current_page(tabpos) self.set_current_page(tabpos)
self.show_all() self.show_all()
if maker.isinstance(term_widget, 'Terminal'): if maker.isinstance(term_widget, 'Terminal'):
#notify plugins of tab-change
dbg("emit tab-change for tabpos: %s " % tabpos)
term_widget.emit('tab-change', tabpos)
self.set_current_page(tabpos)
widget.grab_focus() widget.grab_focus()
def wrapcloseterm(self, widget): def wrapcloseterm(self, widget):
@ -379,19 +375,22 @@ class Notebook(Container, Gtk.Notebook):
maker = Factory() maker = Factory()
child = nb.get_nth_page(tabnum) child = nb.get_nth_page(tabnum)
confirm_close = self.construct_confirm_close(self.window, child)
if confirm_close != Gtk.ResponseType.ACCEPT:
dbg('user cancelled request')
return
if maker.isinstance(child, 'Terminal'): if maker.isinstance(child, 'Terminal'):
dbg('child is a single Terminal') dbg('child is a single Terminal')
del nb.last_active_term[child] del nb.last_active_term[child]
child.close() child.close()
# FIXME: We only do this del and return here to avoid removing the # FIXME: We only do this del and return here to avoid removing the
# page below, which child.close() implicitly does # page below, which child.close() implicitly does
del(label) del(label)
return
elif maker.isinstance(child, 'Container'): elif maker.isinstance(child, 'Container'):
dbg('child is a Container') dbg('child is a Container')
result = self.construct_confirm_close(self.window, _('tab'))
if result == Gtk.ResponseType.ACCEPT:
containers = None containers = None
objects = None objects = None
containers, objects = enumerate_descendants(child) containers, objects = enumerate_descendants(child)
@ -401,13 +400,8 @@ class Notebook(Container, Gtk.Notebook):
descendant.close() descendant.close()
while Gtk.events_pending(): while Gtk.events_pending():
Gtk.main_iteration() Gtk.main_iteration()
return
else:
dbg('user cancelled request')
return
else: else:
err('Notebook::closetab: child is unknown type %s' % child) err('Notebook::closetab: child is unknown type %s' % child)
return
def resizeterm(self, widget, keyname): def resizeterm(self, widget, keyname):
"""Handle a keyboard event requesting a terminal resize""" """Handle a keyboard event requesting a terminal resize"""

View File

@ -1,8 +1,15 @@
# Terminator by Chris Jones <cmsj@tenshu.net> # Terminator by Chris Jones <cmsj@tenshu.net>
# GPL v2 only # GPL v2 only
#
# -added keybinding, bookmark functionality
# -made name parsing to menu, optional
# - Vishweshwar Saran Singh Deo vssdeo@gmail.com
# TODO: tags
"""custom_commands.py - Terminator Plugin to add custom command menu entries""" """custom_commands.py - Terminator Plugin to add custom command menu entries"""
import sys import sys
import os import os
import time
# Fix imports when testing this file directly # Fix imports when testing this file directly
if __name__ == '__main__': if __name__ == '__main__':
@ -14,8 +21,17 @@ import terminatorlib.plugin as plugin
from terminatorlib.config import Config from terminatorlib.config import Config
from terminatorlib.translation import _ from terminatorlib.translation import _
from terminatorlib.util import get_config_dir, err, dbg, gerr from terminatorlib.util import get_config_dir, err, dbg, gerr
from terminatorlib.terminator import Terminator
(CC_COL_ENABLED, CC_COL_NAME, CC_COL_COMMAND) = list(range(0,3)) from terminatorlib.plugin import KeyBindUtil
(CC_COL_ENABLED, CC_COL_NAME, CC_COL_NAME_PARSE, CC_COL_COMMAND) = list(range(0,4))
PluginActAdd = "plugin_add"
PluginActBmk = "plugin_bmk"
PluginAddDesc = "Plugin Add Bookmark"
PluginBmkDesc = "Plugin Open Bookmark Preferences"
# Every plugin you want Terminator to load *must* be listed in 'AVAILABLE' # Every plugin you want Terminator to load *must* be listed in 'AVAILABLE'
AVAILABLE = ['CustomCommandsMenu'] AVAILABLE = ['CustomCommandsMenu']
@ -25,10 +41,27 @@ class CustomCommandsMenu(plugin.MenuItem):
capabilities = ['terminal_menu'] capabilities = ['terminal_menu']
cmd_list = {} cmd_list = {}
conf_file = os.path.join(get_config_dir(),"custom_commands") conf_file = os.path.join(get_config_dir(),"custom_commands")
keyb = None
def __init__( self): def __init__( self):
# In prev code dbox is needed if _create_command_dialog func is called
# after configure func where dbox is init. In case we call
# _create_command_dialog without calling configure func, like in quick
# bookmark add then we need to check.
self.dbox = None
config = Config() config = Config()
sections = config.plugin_get_config(self.__class__.__name__) sections = config.plugin_get_config(self.__class__.__name__)
self.connect_signals()
self.keyb = KeyBindUtil(config)
self.keyb.bindkey_check_config(
[PluginAddDesc , PluginActAdd, "<Alt>b"])
self.keyb.bindkey_check_config(
[PluginBmkDesc , PluginActBmk, "<Shift><Alt>b"])
if not isinstance(sections, dict): if not isinstance(sections, dict):
return return
noord_cmds = [] noord_cmds = []
@ -38,24 +71,110 @@ class CustomCommandsMenu(plugin.MenuItem):
print("CustomCommandsMenu: Ignoring section %s" % s) print("CustomCommandsMenu: Ignoring section %s" % s)
continue continue
name = s["name"] name = s["name"]
name_parse = s.get("name_parse", "True")
command = s["command"] command = s["command"]
enabled = s["enabled"] and s["enabled"] or False enabled = s["enabled"] and s["enabled"] or False
if "position" in s: if "position" in s:
self.cmd_list[int(s["position"])] = {'enabled' : enabled, self.cmd_list[int(s["position"])] = {'enabled' : enabled,
'name' : name, 'name' : name,
'name_parse' : name_parse,
'command' : command 'command' : command
} }
else: else:
noord_cmds.append( noord_cmds.append(
{'enabled' : enabled, {'enabled' : enabled,
'name' : name, 'name' : name,
'name_parse' : name_parse,
'command' : command 'command' : command
} }
) )
for cmd in noord_cmds: for cmd in noord_cmds:
self.cmd_list[len(self.cmd_list)] = cmd self.cmd_list[len(self.cmd_list)] = cmd
def unload(self):
dbg("unloading")
for window in self.windows:
try:
window.disconnect_by_func(self.on_keypress)
except:
dbg("no connected signals")
self.keyb.unbindkey(
[PluginAddDesc , PluginActAdd, "<Alt>b"])
self.keyb.unbindkey(
[PluginBmkDesc , PluginActBmk, "<Shift><Alt>b"])
def connect_signals(self):
self.windows = Terminator().get_windows()
for window in self.windows:
window.connect('key-press-event', self.on_keypress)
def get_last_exe_cmd(self):
cur_win = Terminator().last_focused_term.get_toplevel()
#TODO: there has to be a better way to get the last command executed
focus_term = cur_win.get_focussed_terminal()
tmp_file = os.path.join(os.sep, 'tmp', 'term_cmd')
command = 'fc -n -l -1 -1 > ' + tmp_file + '; #bookmark last cmd\n'
focus_term.vte.feed_child(str(command).encode("utf-8"))
fsz = 0
count = 0
while not (count == 2 or fsz):
time.sleep(0.1)
if os.path.exists(tmp_file):
fsz = os.path.getsize(tmp_file)
count += 1
last_cmd = None
try:
with open(tmp_file, 'r') as file:
last_cmd = file.read()
file.close()
except Exception as ex:
err('Unable to open %s ex: (%s)' % (tmp_file, ex))
if os.path.exists(tmp_file):
os.remove(tmp_file)
if last_cmd:
last_cmd = last_cmd.rstrip()
dbg('last exec cmd: (%s)' % last_cmd)
return last_cmd
def get_last_exe_cmd_dialog_vars(self):
last_exe_cmd = self.get_last_exe_cmd()
dialog_vars = { 'enabled' : True,
'name' : last_exe_cmd,
'name_parse': False,
'command' : last_exe_cmd }
return dialog_vars
def on_keypress(self, widget, event):
act = self.keyb.keyaction(event)
dbg("keyaction: (%s) (%s)" % (str(act), event.keyval))
if act == PluginActAdd:
dbg("add bookmark")
self.setup_store()
dialog_vars = self.get_last_exe_cmd_dialog_vars()
self.on_new(None, {'dialog_vars' : dialog_vars })
self.update_cmd_list(self.store)
self._save_config()
return True
if act == PluginActBmk:
dbg("open custom command preferences")
self.configure(None)
return True
def callback(self, menuitems, menu, terminal): def callback(self, menuitems, menu, terminal):
"""Add our menu items to the menu""" """Add our menu items to the menu"""
submenus = {} submenus = {}
item = Gtk.MenuItem.new_with_mnemonic(_('_Custom Commands')) item = Gtk.MenuItem.new_with_mnemonic(_('_Custom Commands'))
@ -81,6 +200,10 @@ class CustomCommandsMenu(plugin.MenuItem):
branch_names = command['name'].split('/')[:-1] branch_names = command['name'].split('/')[:-1]
target_submenu = submenu target_submenu = submenu
parent_submenu = submenu parent_submenu = submenu
if not command['name_parse']:
leaf_name = command['name']
branch_names = ''
else:
for idx in range(len(branch_names)): for idx in range(len(branch_names)):
lookup_name = '/'.join(branch_names[0:idx+1]) lookup_name = '/'.join(branch_names[0:idx+1])
target_submenu = submenus.get(lookup_name, None) target_submenu = submenus.get(lookup_name, None)
@ -109,11 +232,13 @@ class CustomCommandsMenu(plugin.MenuItem):
for command in [ self.cmd_list[key] for key in sorted(self.cmd_list.keys()) ] : for command in [ self.cmd_list[key] for key in sorted(self.cmd_list.keys()) ] :
enabled = command['enabled'] enabled = command['enabled']
name = command['name'] name = command['name']
name_parse = command['name_parse']
command = command['command'] command = command['command']
item = {} item = {}
item['enabled'] = enabled item['enabled'] = enabled
item['name'] = name item['name'] = name
item['name_parse'] = name_parse
item['command'] = command item['command'] = command
item['position'] = i item['position'] = i
@ -128,6 +253,13 @@ class CustomCommandsMenu(plugin.MenuItem):
for terminal in data['terminals']: for terminal in data['terminals']:
terminal.vte.feed_child(command.encode()) terminal.vte.feed_child(command.encode())
def setup_store(self):
self.store = Gtk.ListStore(bool, str, bool, str)
for command in [ self.cmd_list[key] for key in sorted(self.cmd_list.keys()) ]:
self.store.append([command['enabled'], command['name'],
command['name_parse'], command['command']])
return self.store
def configure(self, widget, data = None): def configure(self, widget, data = None):
ui = {} ui = {}
dbox = Gtk.Dialog( dbox = Gtk.Dialog(
@ -139,6 +271,7 @@ class CustomCommandsMenu(plugin.MenuItem):
_("_OK"), Gtk.ResponseType.ACCEPT _("_OK"), Gtk.ResponseType.ACCEPT
) )
) )
if widget:
dbox.set_transient_for(widget.get_toplevel()) dbox.set_transient_for(widget.get_toplevel())
icon_theme = Gtk.IconTheme.get_default() icon_theme = Gtk.IconTheme.get_default()
@ -149,10 +282,7 @@ class CustomCommandsMenu(plugin.MenuItem):
icon = dbox.render_icon(Gtk.STOCK_DIALOG_INFO, Gtk.IconSize.BUTTON) icon = dbox.render_icon(Gtk.STOCK_DIALOG_INFO, Gtk.IconSize.BUTTON)
dbox.set_icon(icon) dbox.set_icon(icon)
store = Gtk.ListStore(bool, str, str) store = self.setup_store()
for command in [ self.cmd_list[key] for key in sorted(self.cmd_list.keys()) ]:
store.append([command['enabled'], command['name'], command['command']])
treeview = Gtk.TreeView(store) treeview = Gtk.TreeView(store)
#treeview.connect("cursor-changed", self.on_cursor_changed, ui) #treeview.connect("cursor-changed", self.on_cursor_changed, ui)
@ -226,7 +356,10 @@ class CustomCommandsMenu(plugin.MenuItem):
button.set_sensitive(False) button.set_sensitive(False)
ui['button_delete'] = button ui['button_delete'] = button
button = Gtk.Button(_("Bookmark Last Cmd"))
button_box.pack_start(button, False, True, 0)
button.connect("clicked", self.on_last_exe_cmd, ui)
ui['button_save_last_cmd'] = button
hbox.pack_start(button_box, False, True, 0) hbox.pack_start(button_box, False, True, 0)
self.dbox = dbox self.dbox = dbox
@ -237,6 +370,7 @@ class CustomCommandsMenu(plugin.MenuItem):
self._save_config() self._save_config()
del(self.dbox) del(self.dbox)
dbox.destroy() dbox.destroy()
self.dbox = None
return return
@ -245,12 +379,14 @@ class CustomCommandsMenu(plugin.MenuItem):
self.cmd_list = {} self.cmd_list = {}
i=0 i=0
while iter: while iter:
(enabled, name, command) = store.get(iter, (enabled, name, name_parse, command) = store.get(iter,
CC_COL_ENABLED, CC_COL_ENABLED,
CC_COL_NAME, CC_COL_NAME,
CC_COL_NAME_PARSE,
CC_COL_COMMAND) CC_COL_COMMAND)
self.cmd_list[i] = {'enabled' : enabled, self.cmd_list[i] = {'enabled' : enabled,
'name': name, 'name': name,
'name_parse' : name_parse,
'command' : command} 'command' : command}
iter = store.iter_next(iter) iter = store.iter_next(iter)
i = i + 1 i = i + 1
@ -278,7 +414,8 @@ class CustomCommandsMenu(plugin.MenuItem):
data['button_edit'].set_sensitive(iter is not None) data['button_edit'].set_sensitive(iter is not None)
data['button_delete'].set_sensitive(iter is not None) data['button_delete'].set_sensitive(iter is not None)
def _create_command_dialog(self, enabled_var = False, name_var = "", command_var = ""): def _create_command_dialog(self, enabled_var = False, name_var = "",
name_parse_var = "", command_var = ""):
dialog = Gtk.Dialog( dialog = Gtk.Dialog(
_("New Command"), _("New Command"),
None, None,
@ -288,38 +425,85 @@ class CustomCommandsMenu(plugin.MenuItem):
_("_OK"), Gtk.ResponseType.ACCEPT _("_OK"), Gtk.ResponseType.ACCEPT
) )
) )
#since we call this via shortcut keybinding
#lets focus on OK button
buttonbox = dialog.get_action_area()
buttons = buttonbox.get_children()
dialog.set_focus(buttons[1])
# dbox is init in configure function, in case we want to
# create dialog directly
if self.dbox:
dialog.set_transient_for(self.dbox) dialog.set_transient_for(self.dbox)
table = Gtk.Table(3, 2)
table = Gtk.Table(4, 2)
table.set_row_spacings(5)
table.set_col_spacings(5)
label = Gtk.Label(label=_("Enabled:")) label = Gtk.Label(label=_("Enabled:"))
label.set_alignment(0, 0)
table.attach(label, 0, 1, 0, 1) table.attach(label, 0, 1, 0, 1)
enabled = Gtk.CheckButton() enabled = Gtk.CheckButton()
enabled.set_active(enabled_var) enabled.set_active(enabled_var)
table.attach(enabled, 1, 2, 0, 1) table.attach(enabled, 1, 2, 0, 1)
label = Gtk.Label(label=_("Name:")) label = Gtk.Label(label=_("Parse Name into SubMenu's:"))
label.set_alignment(0, 0)
table.attach(label, 0, 1, 1, 2) table.attach(label, 0, 1, 1, 2)
name_parse = Gtk.CheckButton()
name_parse.set_active(name_parse_var)
table.attach(name_parse, 1, 2, 1, 2)
label = Gtk.Label(label=_("Name:"))
table.attach(label, 0, 1, 2, 3)
name = Gtk.Entry() name = Gtk.Entry()
name.set_text(name_var) name.set_text(name_var)
table.attach(name, 1, 2, 1, 2) table.attach(name, 1, 2, 2, 3)
label = Gtk.Label(label=_("Command:")) label = Gtk.Label(label=_("Command:"))
table.attach(label, 0, 1, 2, 3) table.attach(label, 0, 1, 3, 4)
command = Gtk.TextView() command = Gtk.TextView()
command.get_buffer().set_text(command_var) command.get_buffer().set_text(command_var)
table.attach(command, 1, 2, 2, 3) table.attach(command, 1, 2, 3, 4)
dialog.vbox.pack_start(table, True, True, 0) dialog.vbox.pack_start(table, True, True, 10)
dialog.show_all() dialog.show_all()
return (dialog,enabled,name,command) return (dialog,enabled,name,name_parse,command)
def on_last_exe_cmd(self, button, data):
new_data = data.copy()
new_data['dialog_vars'] = self.get_last_exe_cmd_dialog_vars()
self.on_new(button, new_data)
def on_new(self, button, data): def on_new(self, button, data):
(dialog,enabled,name,command) = self._create_command_dialog()
#default values can be passed to dialogue window if required
enabled_var = ''
name_var = ''
name_parse_var= ''
command_var = ''
if data and 'dialog_vars' in data:
dialog_vars = data.get('dialog_vars', {})
enabled_var = dialog_vars.get('enabled', True)
name_var = dialog_vars.get('name', '')
name_parse_var= dialog_vars.get('name_parse', False)
command_var = dialog_vars.get('command', '')
(dialog,enabled,name,name_parse,command) = self._create_command_dialog(
enabled_var = enabled_var,
name_var = name_var,
name_parse_var = name_parse_var,
command_var = command_var)
res = dialog.run() res = dialog.run()
item = {} item = {}
if res == Gtk.ResponseType.ACCEPT: if res == Gtk.ResponseType.ACCEPT:
item['enabled'] = enabled.get_active() item['enabled'] = enabled.get_active()
item['name'] = name.get_text() item['name'] = name.get_text()
item['name_parse'] = name_parse.get_active()
item['command'] = command.get_buffer().get_text(command.get_buffer().get_start_iter(), command.get_buffer().get_end_iter(), True) item['command'] = command.get_buffer().get_text(command.get_buffer().get_start_iter(), command.get_buffer().get_end_iter(), True)
if item['name'] == '' or item['command'] == '': if item['name'] == '' or item['command'] == '':
err = Gtk.MessageDialog(dialog, err = Gtk.MessageDialog(dialog,
@ -332,7 +516,9 @@ class CustomCommandsMenu(plugin.MenuItem):
err.destroy() err.destroy()
else: else:
# we have a new command # we have a new command
store = data['treeview'].get_model() store = data['treeview'].get_model() if 'treeview' in data else None
if not store:
store = self.setup_store()
iter = store.get_iter_first() iter = store.get_iter_first()
name_exist = False name_exist = False
while iter != None: while iter != None:
@ -341,7 +527,8 @@ class CustomCommandsMenu(plugin.MenuItem):
break break
iter = store.iter_next(iter) iter = store.iter_next(iter)
if not name_exist: if not name_exist:
store.append((item['enabled'], item['name'], item['command'])) store.append((item['enabled'], item['name'],
item['name_parse'], item['command']))
else: else:
gerr(_("Name *%s* already exist") % item['name']) gerr(_("Name *%s* already exist") % item['name'])
dialog.destroy() dialog.destroy()
@ -420,16 +607,17 @@ class CustomCommandsMenu(plugin.MenuItem):
if not iter: if not iter:
return return
(dialog,enabled,name,command) = self._create_command_dialog( (dialog,enabled,name,name_parse,command) = self._create_command_dialog(
enabled_var = store.get_value(iter, CC_COL_ENABLED), enabled_var = store.get_value(iter, CC_COL_ENABLED),
name_var = store.get_value(iter, CC_COL_NAME), name_var = store.get_value(iter, CC_COL_NAME),
command_var = store.get_value(iter, CC_COL_COMMAND) name_parse_var = store.get_value(iter, CC_COL_NAME_PARSE),
) command_var = store.get_value(iter, CC_COL_COMMAND))
res = dialog.run() res = dialog.run()
item = {} item = {}
if res == Gtk.ResponseType.ACCEPT: if res == Gtk.ResponseType.ACCEPT:
item['enabled'] = enabled.get_active() item['enabled'] = enabled.get_active()
item['name'] = name.get_text() item['name'] = name.get_text()
item['name_parse'] = name_parse.get_active()
item['command'] = command.get_buffer().get_text(command.get_buffer().get_start_iter(), command.get_buffer().get_end_iter(), True) item['command'] = command.get_buffer().get_text(command.get_buffer().get_start_iter(), command.get_buffer().get_end_iter(), True)
if item['name'] == '' or item['command'] == '': if item['name'] == '' or item['command'] == '':
err = Gtk.MessageDialog(dialog, err = Gtk.MessageDialog(dialog,
@ -452,6 +640,7 @@ class CustomCommandsMenu(plugin.MenuItem):
store.set(iter, store.set(iter,
CC_COL_ENABLED,item['enabled'], CC_COL_ENABLED,item['enabled'],
CC_COL_NAME, item['name'], CC_COL_NAME, item['name'],
CC_COL_NAME_PARSE, item['name_parse'],
CC_COL_COMMAND, item['command'] CC_COL_COMMAND, item['command']
) )
else: else:

View File

@ -1,7 +1,5 @@
from gi.repository import Gtk from gi.repository import Gtk
from terminatorlib.config import Config
from terminatorlib.terminal import Terminal
from terminatorlib.translation import _ from terminatorlib.translation import _
import terminatorlib.plugin as plugin import terminatorlib.plugin as plugin

View File

@ -48,6 +48,8 @@ class MouseFreeURLHandler(plugin.Plugin):
keyb = KeyBindUtil(config) keyb = KeyBindUtil(config)
matches = [] matches = []
matches_ptr = -1 matches_ptr = -1
vte = None
cur_term = None
#basic pattern #basic pattern
searchtext = "https?\:\/\/[^\s]+[\/\w]" searchtext = "https?\:\/\/[^\s]+[\/\w]"
@ -64,16 +66,9 @@ class MouseFreeURLHandler(plugin.Plugin):
[PluginUrlLaunch, PluginUrlActLaunch, "<Alt>Return"]) [PluginUrlLaunch, PluginUrlActLaunch, "<Alt>Return"])
def connect_signals(self): def connect_signals(self):
#this is not giving list off all connected terminals in window for term in Terminator().terminals:
dbg("direct terminals: %s" % Terminator().terminals)
#get list of all terminals indirectly
terms = Terminator().terminals[0]
dbg("in-direct get terminals: %s" % terms.terminator.terminals)
for term in terms.terminator.terminals:
dbg("signal connect term:%s" % term) dbg("signal connect term:%s" % term)
term.connect('tab-change', self.on_focus_in) term.connect('focus-in', self.on_focus_in)
self.windows = Terminator().get_windows() self.windows = Terminator().get_windows()
for window in self.windows: for window in self.windows:
@ -81,9 +76,7 @@ class MouseFreeURLHandler(plugin.Plugin):
def unload(self): def unload(self):
dbg("unloading") dbg("unloading")
#disconnect all signals and events for term in Terminator().terminals:
terms = Terminator().terminals[0]
for term in terms.terminator.terminals:
try: try:
term.disconnect_by_func(self.on_focus_in) term.disconnect_by_func(self.on_focus_in)
except: except:
@ -107,23 +100,30 @@ class MouseFreeURLHandler(plugin.Plugin):
def extract(self): def extract(self):
#can we do extract more efficiently #can we do extract more efficiently
col, row = self.vte.get_cursor_position() col, row = self.vte.get_cursor_position()
(txt, attr) = self.vte.get_text_range(0,0,row, col) (txt, attr) = self.vte.get_text_range_format(
Vte.Format.TEXT, 0, 0, row, col)
self.matches = re.findall(self.searchtext, txt) self.matches = re.findall(self.searchtext, txt)
self.matches_ptr = len(self.matches)-1 self.matches_ptr = len(self.matches)-1
def get_term(self):
return Terminator().last_focused_term
def get_selected_url(self): def get_selected_url(self):
if len(self.matches): if len(self.matches):
dbg("found selected URL (%s %s %s)" % dbg("found selected URL (%s %s)" %
(self.matches_ptr, self.matches[self.matches_ptr], self)) (self.matches_ptr, self.matches[self.matches_ptr]))
return self.matches[self.matches_ptr] return self.matches[self.matches_ptr]
dbg("selected URL (%s %s)" % (self.matches_ptr, "not found")) dbg("selected URL (%s %s)" % (self.matches_ptr, "not found"))
return None return None
def on_focus_in(self, widget, event): def get_focussed_terminal(self):
dbg("focus-in clear url search buffer: %s" % self) """iterate over all the terminals to find which, if any, has focus"""
for terminal in Terminator().terminals:
if terminal.get_vte().has_focus():
return(terminal)
return(None)
def on_focus_in(self, widget, event = None):
dbg("focus-in clear url search buffer widget: %s" % widget)
self.cur_term = self.get_focussed_terminal()
self.vte = self.cur_term.get_vte()
self.clear_search() self.clear_search()
def on_keypress(self, widget, event): def on_keypress(self, widget, event):
@ -160,7 +160,7 @@ class MouseFreeURLHandler(plugin.Plugin):
self.get_selected_url() # dbg url print self.get_selected_url() # dbg url print
self.vte.copy_clipboard() self.vte.copy_clipboard()
return True return True
else:
self.vte.search_find_previous() self.vte.search_find_previous()
if self.matches_ptr > 0: if self.matches_ptr > 0:
@ -174,26 +174,44 @@ class MouseFreeURLHandler(plugin.Plugin):
if act == PluginUrlActEsc: if act == PluginUrlActEsc:
self.clear_search() self.clear_search()
return
if act == PluginUrlActLaunch: if act == PluginUrlActLaunch:
url = self.get_selected_url() url = self.get_selected_url()
if url: if url:
self.get_term().open_url(url, prepare=False) self.cur_term.open_url(url, prepare=False)
return
#TODO: use case for KeyBindUtil
#So this is capturing <Return> key as if user presses return
#then the current selection would be cleared in case he types
#more commands or text in terminal has more urls now. So next
#time search should restart with complete text
#For KeyBindUtil if we register <Return> then keybinding will
#be shown in Preferences->Keybindings and if any other plugin
#wants to listen to same key code it will throw error since in
#UI binding has to be unique. May be we can have keybinds
#hidden from UI which plugins can use internally
if event.keyval == 65293: #<Return>
self.clear_search()
return
def clear_search(self): def clear_search(self):
self.matches = [] self.matches = []
self.flag_http_on = False self.flag_http_on = False
self.matches_ptr = -1 self.matches_ptr = -1
if self.get_term():
self.vte = self.get_term().get_vte() if self.vte:
self.vte.search_set_regex(None, 0) self.vte.search_set_regex(None, 0)
dbg("search URL off") dbg("search URL off")
self.vte.unselect_all()
def search(self): def search(self):
dbg("searching text") dbg("searching text")
self.flag_http_on = True self.flag_http_on = True
self.vte = self.get_term().get_vte()
self.vte.search_set_wrap_around(True) self.vte.search_set_wrap_around(True)
regex_flags_pcre2 = (regex.FLAGS_PCRE2 | regex.PCRE2_CASELESS) regex_flags_pcre2 = (regex.FLAGS_PCRE2 | regex.PCRE2_CASELESS)

View File

@ -1,4 +1,5 @@
import os import os
import signal
import sys import sys
# Fix imports when testing this file directly # Fix imports when testing this file directly
@ -45,8 +46,20 @@ class SaveLastSessionLayout(plugin.Plugin):
config.save() config.save()
return True return True
def signal_handler(self,signum, frame):
signame = signal.Signals(signum).name
dbg('signal handler called:signal %s (%s)' %
(signame, signum))
self.save_session_layout()
def connect_signals(self): def connect_signals(self):
dbg("SaveLastSessionLayout connect_signals") dbg("SaveLastSessionLayout connect_signals")
signal.signal(signal.SIGTERM, self.signal_handler)
signal.signal(signal.SIGCHLD, self.signal_handler)
signal.signal(signal.SIGHUP, self.signal_handler)
n = 0 n = 0
for term in Terminator().terminals: for term in Terminator().terminals:
dbg("SaveLastSessionLayout connect_signals to term num:(%d)" % n) dbg("SaveLastSessionLayout connect_signals to term num:(%d)" % n)

View File

@ -0,0 +1,69 @@
import os
import sys
# Fix imports when testing this file directly
if __name__ == '__main__':
sys.path.append( os.path.join(os.path.dirname(__file__), "../.."))
from gi.repository import Gtk,Vte
from terminatorlib.config import Config
import terminatorlib.plugin as plugin
from terminatorlib.translation import _
from terminatorlib.util import get_config_dir, err, dbg, gerr
from terminatorlib.terminator import Terminator
from terminatorlib import util
# AVAILABLE must contain a list of all the classes that you want exposed
AVAILABLE = ['SaveUserSessionLayout']
class SaveUserSessionLayout(plugin.MenuItem):
capabilities = ['terminal_menu', 'session']
config = None
conf_file = os.path.join(get_config_dir(),"save_last_session_cwd")
conf_sessions = []
emit_close_count = 0
vte_version = Vte.get_minor_version()
def __init__(self):
dbg("SaveUserSessionLayout Init")
plugin.MenuItem.__init__(self)
def callback(self, menuitems, menu, terminal):
""" Add save menu item to the menu"""
vte_terminal = terminal.get_vte()
item = Gtk.MenuItem.new_with_mnemonic(_('Save _UserSessionLayout'))
item.connect("activate", self.save_all_session_layouts, terminal)
menuitems.append(item)
def save_all_session_layouts(self, menuitem, terminal):
for term in Terminator().terminals:
self.save_session_layout("", "")
#not used, but capability can be used to load automatically
def load_session_layout(self, debugtab=False, widget=None, cwd=None, metadata=None, profile=None):
dbg("SaveUserSessionLayout load layout")
terminator = Terminator()
util.spawn_new_terminator(terminator.origcwd, ['-u', '-l', 'SaveUserSessionLayout'])
def save_session_layout(self, debugtab=False, widget=None, cwd=None, metadata=None, profile=None):
config = Config()
terminator = Terminator()
current_layout = terminator.describe_layout(save_cwd = True)
dbg("SaveUserSessionLayout: save layout(%s)" % current_layout)
res = config.replace_layout("SaveUserSessionLayout", current_layout)
if (not res):
r = config.add_layout("SaveUserSessionLayout", current_layout)
config.save()
return True
def close(self, term, event, arg1 = None):
if (self.emit_close_count == 0):
self.emit_close_count = self.emit_close_count + 1
self.save_session_layout("", "")

View File

@ -1,7 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.40.0 --> <!-- Generated with glade 3.38.2 -->
<interface> <interface>
<requires lib="gtk+" version="3.10"/> <requires lib="gtk+" version="3.10"/>
<object class="GtkListStore" id="AskBeforeCloseListStore">
<columns>
<!-- column-name askwhenclose -->
<column type="gchararray"/>
</columns>
<data>
<row>
<col id="0" translatable="yes">Never</col>
</row>
<row>
<col id="0" translatable="yes">Multiple Terminals</col>
</row>
<row>
<col id="0" translatable="yes">Always</col>
</row>
</data>
</object>
<object class="GtkListStore" id="BackspaceKeyListStore"> <object class="GtkListStore" id="BackspaceKeyListStore">
<columns> <columns>
<!-- column-name Result --> <!-- column-name Result -->
@ -424,6 +441,7 @@
<property name="title" translatable="yes">Terminator Preferences</property> <property name="title" translatable="yes">Terminator Preferences</property>
<property name="default-width">640</property> <property name="default-width">640</property>
<property name="default-height">400</property> <property name="default-height">400</property>
<signal name="destroy" handler="on_destroy_event" swapped="no"/>
<child> <child>
<object class="GtkBox" id="dialog_vbox1"> <object class="GtkBox" id="dialog_vbox1">
<property name="visible">True</property> <property name="visible">True</property>
@ -472,7 +490,7 @@
<property name="spacing">36</property> <property name="spacing">36</property>
<property name="homogeneous">True</property> <property name="homogeneous">True</property>
<child> <child>
<!-- n-columns=2 n-rows=8 --> <!-- n-columns=2 n-rows=9 -->
<object class="GtkGrid" id="grid1"> <object class="GtkGrid" id="grid1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
@ -523,7 +541,7 @@
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
<property name="top-attach">1</property> <property name="top-attach">2</property>
<property name="width">2</property> <property name="width">2</property>
</packing> </packing>
</child> </child>
@ -540,7 +558,7 @@
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
<property name="top-attach">2</property> <property name="top-attach">3</property>
<property name="width">2</property> <property name="width">2</property>
</packing> </packing>
</child> </child>
@ -557,7 +575,7 @@
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
<property name="top-attach">3</property> <property name="top-attach">4</property>
<property name="width">2</property> <property name="width">2</property>
</packing> </packing>
</child> </child>
@ -574,7 +592,7 @@
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
<property name="top-attach">4</property> <property name="top-attach">5</property>
<property name="width">2</property> <property name="width">2</property>
</packing> </packing>
</child> </child>
@ -591,7 +609,7 @@
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
<property name="top-attach">5</property> <property name="top-attach">6</property>
<property name="width">2</property> <property name="width">2</property>
</packing> </packing>
</child> </child>
@ -608,7 +626,7 @@
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
<property name="top-attach">6</property> <property name="top-attach">7</property>
<property name="width">2</property> <property name="width">2</property>
</packing> </packing>
</child> </child>
@ -625,10 +643,40 @@
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
<property name="top-attach">7</property> <property name="top-attach">8</property>
<property name="width">2</property> <property name="width">2</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkComboBox" id="askbeforeclose">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="model">AskBeforeCloseListStore</property>
<property name="active">1</property>
<signal name="changed" handler="on_askbeforeclose_changed" swapped="no"/>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Ask Before Closing:</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>
@ -1241,7 +1289,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<!-- n-columns=2 n-rows=4 --> <!-- n-columns=2 n-rows=5 -->
<object class="GtkGrid" id="grid4"> <object class="GtkGrid" id="grid4">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
@ -4410,6 +4458,21 @@ Much of the behavior of Terminator is based on GNOME Terminal, and we are adding
<property name="position">0</property> <property name="position">0</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkButton" id="restoreconfigbutton">
<property name="label">Discard Changes</property>
<property name="use-action-appearance">False</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<signal name="clicked" handler="on_restoreconfigbutton_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child> <child>
<object class="GtkButton" id="okbutton"> <object class="GtkButton" id="okbutton">
<property name="label">gtk-close</property> <property name="label">gtk-close</property>
@ -4423,7 +4486,7 @@ Much of the behavior of Terminator is based on GNOME Terminal, and we are adding
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">1</property> <property name="position">2</property>
</packing> </packing>
</child> </child>
</object> </object>

View File

@ -235,14 +235,25 @@ class PrefsEditor:
nb = guiget('notebook1') nb = guiget('notebook1')
nb.set_current_page(cur_page) nb.set_current_page(cur_page)
self.config.base.save_config_with_suffix('_cur')
def on_destroy_event(self, _widget):
self.config.base.remove_config_with_suffix('_cur')
def on_closebutton_clicked(self, _button): def on_closebutton_clicked(self, _button):
"""Close the window""" """Close the window"""
self.config.base.remove_config_with_suffix('_cur')
terminator = Terminator() terminator = Terminator()
terminator.reconfigure() terminator.reconfigure()
self.window.destroy() self.window.destroy()
self.calling_window.preventHide = False self.calling_window.preventHide = False
del(self) del(self)
def on_restoreconfigbutton_clicked(self, _button):
"""restore config to load time"""
self.config.base.restore_config_with_suffix('_cur')
self.on_closebutton_clicked(_button)
def set_values(self): def set_values(self):
"""Update the preferences window with all the configuration from """Update the preferences window with all the configuration from
Config()""" Config()"""
@ -297,6 +308,18 @@ class PrefsEditor:
active = 0 active = 0
widget = guiget('winstatecombo') widget = guiget('winstatecombo')
widget.set_active(active) widget.set_active(active)
# Ask Before Closing
option = self.config['ask_before_closing']
if option == 'never':
active = 0
elif option == 'multiple_terminals':
active = 1
elif option == 'always':
active = 2
else:
active = 1
widget = guiget('askbeforeclose')
widget.set_active(active)
# Window borders # Window borders
widget = guiget('winbordercheck') widget = guiget('winbordercheck')
widget.set_active(not self.config['borderless']) widget.set_active(not self.config['borderless'])
@ -1486,7 +1509,20 @@ class PrefsEditor:
value = 'normal' value = 'normal'
self.config['window_state'] = value self.config['window_state'] = value
self.config.save() self.config.save()
def on_askbeforeclose_changed(self, widget):
"""Ask Before Close changed"""
selected = widget.get_active()
if selected == 0:
value = 'Never'
elif selected == 1:
value = 'Multiple Terminals'
elif selected == 2:
value = 'Always'
else:
value = 'Multiple Terminals'
configval = value.lower().replace(" ","_")
self.config['ask_before_closing'] = configval
self.config.save()
# helper function, not a signal # helper function, not a signal
def addprofile(self, name, toclone): def addprofile(self, name, toclone):
"""Add a profile""" """Add a profile"""
@ -1583,6 +1619,14 @@ class PrefsEditor:
(model, rowiter) = selected.get_selected() (model, rowiter) = selected.get_selected()
name = model.get_value(rowiter, 0) name = model.get_value(rowiter, 0)
config_layout = self.config.base.get_layout(name)
dbg("layout from terminator:(%s)" % current_layout)
dbg("layout from config:(%s)" % config_layout)
self.config.copy_layout_item(config_layout, current_layout, 'directory')
self.config.copy_layout_item(config_layout, current_layout, 'command')
dbg("updated layout from terminator:(%s)" % current_layout)
if self.config.replace_layout(name, current_layout): if self.config.replace_layout(name, current_layout):
treeview.set_cursor(model.get_path(rowiter), column=treeview.get_column(0), start_editing=False) treeview.set_cursor(model.get_path(rowiter), column=treeview.get_column(0), start_editing=False)
self.config.save() self.config.save()
@ -2152,7 +2196,7 @@ class LayoutEditor:
def on_layout_profile_workingdir_activate(self, widget): def on_layout_profile_workingdir_activate(self, widget):
"""A new working directory has been entered for this item""" """A new working directory has been entered for this item"""
workdir = widget.get_text() workdir = os.path.expanduser(widget.get_text())
layout = self.config.layout_get_config(self.layout_name) layout = self.config.layout_get_config(self.layout_name)
layout[self.layout_item]['directory'] = workdir layout[self.layout_item]['directory'] = workdir
self.config.save() self.config.save()

View File

@ -15,7 +15,7 @@ try:
except ImportError: except ImportError:
from urllib import unquote as urlunquote from urllib import unquote as urlunquote
from .util import dbg, err, spawn_new_terminator, make_uuid, manual_lookup, display_manager from .util import dbg, err, spawn_new_terminator, make_uuid, manual_lookup
from . import util from . import util
from .config import Config from .config import Config
from .cwd import get_pid_cwd from .cwd import get_pid_cwd
@ -300,6 +300,7 @@ class Terminal(Gtk.VBox):
registry.load_plugins(force) registry.load_plugins(force)
def _add_regex(self, name, re): def _add_regex(self, name, re):
dbg(f"adding regex: {re}")
match = -1 match = -1
if regex.FLAGS_PCRE2: if regex.FLAGS_PCRE2:
try: try:
@ -321,21 +322,25 @@ class Terminal(Gtk.VBox):
"""Update the regexps used to match URLs""" """Update the regexps used to match URLs"""
userchars = "-A-Za-z0-9" userchars = "-A-Za-z0-9"
passchars = "-A-Za-z0-9,?;.:/!%$^*&~\"#'" passchars = "-A-Za-z0-9,?;.:/!%$^*&~\"#'"
hostchars = "-A-Za-z0-9:\[\]" hostchars = r"-A-Za-z0-9:\[\]"
pathchars = "-A-Za-z0-9_$.+!*(),;:@&=?/~#%'" pathchars = "-A-Za-z0-9_$.+!*(),;:@&=?/~#%'"
schemes = "(news:|telnet:|nntp:|file:/|https?:|ftps?:|webcal:|ssh:)" schemes = "(news:|telnet:|nntp:|https?:|ftps?:|webcal:|ssh:)"
user = "[" + userchars + "]+(:[" + passchars + "]+)?" user = "[" + userchars + "]+(:[" + passchars + "]+)?"
urlpath = "/[" + pathchars + "]*[^]'.}>) \t\r\n,\\\"]" urlpath = "/[" + pathchars + "]*[^]'.}>) \t\r\n,\\\"]"
lboundry = "\\b" lboundry = "\\b"
rboundry = "\\b" rboundry = "\\b"
re = (lboundry + "file:/" + "//?(:[0-9]+)?(" + urlpath + ")" +
rboundry + "/?")
self._add_regex('file', re)
re = (lboundry + schemes + re = (lboundry + schemes +
"//(" + user + "@)?[" + hostchars +".]+(:[0-9]+)?(" + "//(" + user + "@)?[" + hostchars +".]+(:[0-9]+)?(" +
urlpath + ")?" + rboundry + "/?") urlpath + ")?" + rboundry + "/?")
self._add_regex('full_uri', re) self._add_regex('full_uri', re)
if self.matches['full_uri'] == -1: if self.matches['full_uri'] == -1 or self.matches['file'] == -1:
err ('Terminal::update_url_matches: Failed adding URL matches') err ('Terminal::update_url_matches: Failed adding URL matches')
else: else:
re = (lboundry + re = (lboundry +
@ -345,18 +350,18 @@ class Terminal(Gtk.VBox):
self._add_regex('voip', re) self._add_regex('voip', re)
re = (lboundry + re = (lboundry +
"(www|ftp)[" + hostchars + "]*\.[" + hostchars + "(www|ftp)[" + hostchars + r"]*\.[" + hostchars +
".]+(:[0-9]+)?(" + urlpath + ")?" + rboundry + "/?") ".]+(:[0-9]+)?(" + urlpath + ")?" + rboundry + "/?")
self._add_regex('addr_only', re) self._add_regex('addr_only', re)
re = (lboundry + re = (lboundry +
"(mailto:)?[a-zA-Z0-9][a-zA-Z0-9.+-]*@[a-zA-Z0-9]" + "(mailto:)?[a-zA-Z0-9][a-zA-Z0-9.+-]*@[a-zA-Z0-9]" +
"[a-zA-Z0-9-]*\.[a-zA-Z0-9][a-zA-Z0-9-]+" + r"[a-zA-Z0-9-]*\.[a-zA-Z0-9][a-zA-Z0-9-]+" +
"[.a-zA-Z0-9-]*" + rboundry) "[.a-zA-Z0-9-]*" + rboundry)
self._add_regex('email', re) self._add_regex('email', re)
re = (lboundry + re = (lboundry +
"""news:[-A-Z\^_a-z{|}~!"#$%&'()*+,./0-9;:=?`]+@""" + r"""news:[-A-Z\^_a-z{|}~!"#$%&'()*+,./0-9;:=?`]+@""" +
"[-A-Za-z0-9.]+(:[0-9]+)?" + rboundry) "[-A-Za-z0-9.]+(:[0-9]+)?" + rboundry)
self._add_regex('nntp', re) self._add_regex('nntp', re)
@ -1507,7 +1512,7 @@ class Terminal(Gtk.VBox):
def set_cwd(self, cwd=None): def set_cwd(self, cwd=None):
"""Set our cwd""" """Set our cwd"""
if cwd is not None: if cwd is not None:
self.cwd = cwd self.cwd = os.path.expanduser(cwd)
def held_open(self, widget=None, respawn=False, debugserver=False): def held_open(self, widget=None, respawn=False, debugserver=False):
self.is_held_open = True self.is_held_open = True

View File

@ -12,7 +12,6 @@ from .util import err, dbg, spawn_new_terminator
from .config import Config from .config import Config
from .prefseditor import PrefsEditor from .prefseditor import PrefsEditor
from . import plugin from . import plugin
from .layoutlauncher import LayoutLauncher
class TerminalPopupMenu(object): class TerminalPopupMenu(object):
"""Class implementing the Terminal context menu""" """Class implementing the Terminal context menu"""

View File

@ -17,7 +17,6 @@ from .config import Config
from .keybindings import Keybindings from .keybindings import Keybindings
from .util import dbg, err, enumerate_descendants from .util import dbg, err, enumerate_descendants
from .factory import Factory from .factory import Factory
from .version import APP_NAME, APP_VERSION
from .translation import _ from .translation import _
try: try:
@ -186,13 +185,6 @@ class Terminator(Borg):
for terminal in self.terminals: for terminal in self.terminals:
dbg('checking: %s (%s)' % (terminal.uuid.urn, terminal)) dbg('checking: %s (%s)' % (terminal.uuid.urn, terminal))
if terminal.uuid.urn == uuid: if terminal.uuid.urn == uuid:
if terminal.get_toplevel().is_child_notebook():
topchild = terminal.get_toplevel().get_child()
current_page = topchild.get_current_page()
#we need to emit signal for plugin and retain same page
dbg("current_page for tab-change-signal:%s" % current_page)
terminal.emit('tab-change', current_page)
return terminal return terminal
return None return None
@ -339,6 +331,7 @@ class Terminator(Borg):
# For windows without a notebook ensure Terminal is visible and focused # For windows without a notebook ensure Terminal is visible and focused
if window_last_active_term_mapping[window]: if window_last_active_term_mapping[window]:
term = self.find_terminal_by_uuid(window_last_active_term_mapping[window].urn) term = self.find_terminal_by_uuid(window_last_active_term_mapping[window].urn)
if term:
term.ensure_visible_and_focussed() term.ensure_visible_and_focussed()
# Build list of new windows using prelayout list # Build list of new windows using prelayout list
@ -614,7 +607,7 @@ class Terminator(Borg):
def get_focussed_terminal(self): def get_focussed_terminal(self):
"""iterate over all the terminals to find which, if any, has focus""" """iterate over all the terminals to find which, if any, has focus"""
for terminal in self.terminals: for terminal in self.terminals:
if terminal.has_focus(): if terminal.get_vte().has_focus():
return(terminal) return(terminal)
return(None) return(None)

View File

@ -77,6 +77,7 @@ class Window(Container, Gtk.Window):
# self.set_property('allow-shrink', True) # FIXME FOR GTK3, or do we need this actually? # self.set_property('allow-shrink', True) # FIXME FOR GTK3, or do we need this actually?
icon_to_apply='' icon_to_apply=''
self.apply_config() self.apply_config()
self.title = WindowTitle(self) self.title = WindowTitle(self)
@ -348,22 +349,15 @@ class Window(Container, Gtk.Window):
def on_delete_event(self, window, event, data=None): def on_delete_event(self, window, event, data=None):
"""Handle a window close request""" """Handle a window close request"""
maker = Factory() maker = Factory()
if maker.isinstance(self.get_child(), 'Terminal'):
if self.is_zoomed():
return(self.confirm_close(window, _('window')))
else:
dbg('Only one child, closing is fine')
return(False)
elif maker.isinstance(self.get_child(), 'Container'):
return(self.confirm_close(window, _('window')))
else:
dbg('unknown child: %s' % self.get_child())
def confirm_close(self, window, type): child = self.get_child()
"""Display a confirmation dialog when the user is closing multiple if (maker.isinstance(child, 'Terminal') or
terminals in one window""" maker.isinstance(child, 'Container')):
confirm_close = self.construct_confirm_close(window, child)
return(not (self.construct_confirm_close(window, type) == Gtk.ResponseType.ACCEPT)) return (confirm_close != Gtk.ResponseType.ACCEPT)
else:
dbg('unknown child: %s' % child)
return False # close anyway
def on_destroy_event(self, widget, data=None): def on_destroy_event(self, widget, data=None):
"""Handle window destruction""" """Handle window destruction"""
@ -877,7 +871,7 @@ class Window(Container, Gtk.Window):
def group_win_toggle(self, widget): def group_win_toggle(self, widget):
"""Toggle grouping to all windows in the current window""" """Toggle grouping to all windows in the current window"""
if widget.group == 'Window': if widget.group:
self.ungroup_win(widget) self.ungroup_win(widget)
else: else:
self.group_win(widget) self.group_win(widget)

View File

@ -30,7 +30,6 @@ False
""" """
import os
import sys, os.path import sys, os.path
sys.path.insert(0, os.path.realpath(os.path.join(os.path.dirname(__file__), ".."))) sys.path.insert(0, os.path.realpath(os.path.join(os.path.dirname(__file__), "..")))