Keybindings changes:

- added CellRendererClickablePixubf (thanks to Tryton team)
- removed 'Reset Keybindings' Button
- added 'Revert' column: revert setting to last saved user value
- added 'Default' column: revert setting to vendor or factory default
- added add 'None' column: allow keybindings without modificator (only useful for keys like TAB for example to bind menu-complete to it)
- removed Advanced > Tab Rotation, added menu-complete to Keybindings instead.
++ if you want to re-enable this feature set menu-complete in Keybindings to TAB with no modificator checked
- made TreeViewColumn headers translatable
- update german translation
parent 4249dff0
......@@ -6,6 +6,7 @@
- Philip Endecott (for original colorshell)
- UbuntuUsers Wiki (for some functions)
- TJ Carter (for some functions)
- Tryton Team (for CellRendererClickablePixbuf)
- commandlinefu.com for some functions or inspiration
- x2cd [reload]
......
......@@ -5,6 +5,11 @@ Overview of changes in v9.1 "Dial T for TNT"
* #187 (vim-rc):
set softtabstop instead of shiftwidth for setting tab length
=== Widgets ===
* added CellRendererClickablePixbuf from Tryton (http://www.tryton.org/),
with minor updates to be GTK+3 compatible
=== User Interface ===
* added missing revert-to-default icons for PWD Length Spinbutton
......@@ -17,6 +22,20 @@ Overview of changes in v9.1 "Dial T for TNT"
* Renamed "Clock Advanced" Prompt to "Equinox" (the name change is handled
internally, the config updated automatically, no user interaction required)
=== Keybindings ===
* add 'Revert' column: revert setting to last saved user value
* add 'Default' column: revert setting to vendor or factory default
* removed 'Reset Keybindings' button (no longer needed with clickable Pixbuf)
* add 'None' column: allow keybindings without modificator (only useful for
keys like TAB for example to bind menu-complete to it)
* removed Advanced > Tab Rotation, added menu-complete to Keybindings instead.
- if you want to re-enable this feature set menu-complete in Keybindings to TAB
with no modificator checked
* made TreeViewColumn headers translatable
=== Vim ===
* New color schemes provided:
......
ini_version = 13
ini_version = 14
[Style]
use_bashstyle = False
......@@ -59,7 +59,6 @@ fcedit = /usr/bin/vim
welcome_message = ""
path = ""
directory_indicator = /
tab_rotation = True
use_lscd = True
lscd_opts = --group-directories-first -CF --color
lscd_mkdir = False
......@@ -230,3 +229,4 @@ copy_forward_word = ""
forward_char = "C:f"
forward_word = "e:f"
overwrite_mode = ""
menu_complete = X:TAB
This diff is collapsed.
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: BashStyle-NG\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-09-06 19:15+0200\n"
"POT-Creation-Date: 2015-09-07 21:18+0200\n"
"PO-Revision-Date: 2015-09-05 20:57+0200\n"
"Last-Translator: Christopher Roy Bratusek <nano@jpberlin.de>\n"
"Language-Team: German (Germany) (http://www.transifex.com/projects/p/bs-ng/"
......@@ -61,7 +61,6 @@ msgstr "BashStyle-NG Logdatei:"
#: rc/settings/git-rc:12 rc/settings/git-rc:15 rc/settings/git-rc:20
#: rc/settings/git-rc:25 rc/settings/git-rc:32 rc/settings/git-rc:37
#: rc/settings/git-rc:44 rc/settings/git-rc:49 rc/settings/git-rc:60
#: rc/settings/keybindings-rc:57 rc/settings/keybindings-rc:60
#: rc/settings/ls-rc:12 rc/settings/options-rc:12 rc/settings/options-rc:15
#: rc/settings/options-rc:18 rc/settings/options-rc:21
#: rc/settings/options-rc:24 rc/settings/options-rc:27
......@@ -134,40 +133,40 @@ msgid "Colored ls"
msgstr "farbiges ls"
#: rc/settings/alias-rc:13 rc/settings/color-rc:14 rc/settings/git-rc:32
#: rc/settings/git-rc:49 rc/settings/keybindings-rc:57 rc/settings/nano-rc:18
#: rc/settings/nano-rc:26 rc/settings/nano-rc:34 rc/settings/nano-rc:42
#: rc/settings/nano-rc:50 rc/settings/nano-rc:58 rc/settings/nano-rc:66
#: rc/settings/nano-rc:74 rc/settings/nano-rc:82 rc/settings/nano-rc:90
#: rc/settings/nano-rc:98 rc/settings/nano-rc:106 rc/settings/nano-rc:114
#: rc/settings/nano-rc:125 rc/settings/nano-rc:140 rc/settings/options-rc:56
#: rc/settings/readline-rc:30 rc/settings/readline-rc:35
#: rc/settings/readline-rc:43 rc/settings/readline-rc:51
#: rc/settings/readline-rc:59 rc/settings/readline-rc:75
#: rc/settings/readline-rc:83 rc/settings/readline-rc:91
#: rc/settings/readline-rc:99 rc/settings/readline-rc:107
#: rc/settings/readline-rc:115 rc/settings/shopt-rc:13 rc/settings/shopt-rc:20
#: rc/settings/shopt-rc:27 rc/settings/shopt-rc:34 rc/settings/shopt-rc:41
#: rc/settings/shopt-rc:48 rc/settings/shopt-rc:55 rc/settings/shopt-rc:62
#: rc/settings/shopt-rc:72 rc/settings/shopt-rc:79 rc/settings/shopt-rc:86
#: rc/settings/shopt-rc:93 rc/settings/shopt-rc:103 rc/settings/shopt-rc:109
#: rc/settings/vim-rc:27 rc/settings/vim-rc:43 rc/settings/vim-rc:52
#: rc/settings/vim-rc:56 rc/settings/vim-rc:58 rc/settings/vim-rc:69
#: rc/settings/vim-rc:77 rc/settings/vim-rc:85 rc/settings/vim-rc:93
#: rc/settings/vim-rc:101 rc/settings/vim-rc:109 rc/settings/vim-rc:117
#: rc/settings/vim-rc:125 rc/settings/vim-rc:133 rc/settings/vim-rc:142
#: rc/settings/vim-rc:151 rc/settings/vim-rc:161 rc/settings/vim-rc:169
#: rc/settings/vim-rc:180 rc/settings/vim-rc:195 rc/settings/vim-rc:203
#: rc/settings/vim-rc:211 rc/settings/vim-rc:228
#: rc/settings/git-rc:49 rc/settings/nano-rc:18 rc/settings/nano-rc:26
#: rc/settings/nano-rc:34 rc/settings/nano-rc:42 rc/settings/nano-rc:50
#: rc/settings/nano-rc:58 rc/settings/nano-rc:66 rc/settings/nano-rc:74
#: rc/settings/nano-rc:82 rc/settings/nano-rc:90 rc/settings/nano-rc:98
#: rc/settings/nano-rc:106 rc/settings/nano-rc:114 rc/settings/nano-rc:125
#: rc/settings/nano-rc:140 rc/settings/options-rc:56 rc/settings/readline-rc:30
#: rc/settings/readline-rc:35 rc/settings/readline-rc:43
#: rc/settings/readline-rc:51 rc/settings/readline-rc:59
#: rc/settings/readline-rc:75 rc/settings/readline-rc:83
#: rc/settings/readline-rc:91 rc/settings/readline-rc:99
#: rc/settings/readline-rc:107 rc/settings/readline-rc:115
#: rc/settings/shopt-rc:13 rc/settings/shopt-rc:20 rc/settings/shopt-rc:27
#: rc/settings/shopt-rc:34 rc/settings/shopt-rc:41 rc/settings/shopt-rc:48
#: rc/settings/shopt-rc:55 rc/settings/shopt-rc:62 rc/settings/shopt-rc:72
#: rc/settings/shopt-rc:79 rc/settings/shopt-rc:86 rc/settings/shopt-rc:93
#: rc/settings/shopt-rc:103 rc/settings/shopt-rc:109 rc/settings/vim-rc:27
#: rc/settings/vim-rc:43 rc/settings/vim-rc:52 rc/settings/vim-rc:56
#: rc/settings/vim-rc:58 rc/settings/vim-rc:69 rc/settings/vim-rc:77
#: rc/settings/vim-rc:85 rc/settings/vim-rc:93 rc/settings/vim-rc:101
#: rc/settings/vim-rc:109 rc/settings/vim-rc:117 rc/settings/vim-rc:125
#: rc/settings/vim-rc:133 rc/settings/vim-rc:142 rc/settings/vim-rc:151
#: rc/settings/vim-rc:161 rc/settings/vim-rc:169 rc/settings/vim-rc:180
#: rc/settings/vim-rc:195 rc/settings/vim-rc:203 rc/settings/vim-rc:211
#: rc/settings/vim-rc:228
msgid "On"
msgstr "An"
#: rc/settings/alias-rc:16 rc/settings/git-rc:37 rc/settings/git-rc:60
#: rc/settings/keybindings-rc:60 rc/settings/nano-rc:21 rc/settings/nano-rc:29
#: rc/settings/nano-rc:37 rc/settings/nano-rc:45 rc/settings/nano-rc:53
#: rc/settings/nano-rc:61 rc/settings/nano-rc:69 rc/settings/nano-rc:77
#: rc/settings/nano-rc:85 rc/settings/nano-rc:93 rc/settings/nano-rc:101
#: rc/settings/nano-rc:109 rc/settings/nano-rc:117 rc/settings/nano-rc:128
#: rc/settings/nano-rc:144 rc/settings/options-rc:59 rc/settings/readline-rc:27
#: rc/settings/nano-rc:21 rc/settings/nano-rc:29 rc/settings/nano-rc:37
#: rc/settings/nano-rc:45 rc/settings/nano-rc:53 rc/settings/nano-rc:61
#: rc/settings/nano-rc:69 rc/settings/nano-rc:77 rc/settings/nano-rc:85
#: rc/settings/nano-rc:93 rc/settings/nano-rc:101 rc/settings/nano-rc:109
#: rc/settings/nano-rc:117 rc/settings/nano-rc:128 rc/settings/nano-rc:144
#: rc/settings/options-rc:59 rc/settings/readline-rc:27
#: rc/settings/readline-rc:38 rc/settings/readline-rc:46
#: rc/settings/readline-rc:54 rc/settings/readline-rc:62
#: rc/settings/readline-rc:78 rc/settings/readline-rc:86
......@@ -232,6 +231,25 @@ msgid "GIT aliases"
msgstr "GIT Aliase"
#: rc/settings/keybindings-rc:23 rc/settings/keybindings-rc:27
#: rc/settings/keybindings-rc:31 rc/settings/readline-rc:16
#: rc/settings/readline-rc:27 rc/settings/readline-rc:30
#: rc/settings/readline-rc:35 rc/settings/readline-rc:38
#: rc/settings/readline-rc:43 rc/settings/readline-rc:46
#: rc/settings/readline-rc:51 rc/settings/readline-rc:54
#: rc/settings/readline-rc:59 rc/settings/readline-rc:62
#: rc/settings/readline-rc:67 rc/settings/readline-rc:70
#: rc/settings/readline-rc:75 rc/settings/readline-rc:78
#: rc/settings/readline-rc:83 rc/settings/readline-rc:86
#: rc/settings/readline-rc:91 rc/settings/readline-rc:94
#: rc/settings/readline-rc:99 rc/settings/readline-rc:102
#: rc/settings/readline-rc:107 rc/settings/readline-rc:110
#: rc/settings/readline-rc:115 rc/settings/readline-rc:118
#: rc/settings/readline-rc:122
msgid "ReadlineCFG Setting:"
msgstr "ReadlineCFG Setze:"
#: rc/settings/keybindings-rc:23 rc/settings/keybindings-rc:27
#: rc/settings/keybindings-rc:31
#, sh-format
msgid "${ACT}"
msgstr "${ACT}"
......@@ -246,18 +264,19 @@ msgstr "e-${KEY}"
msgid "C-${KEY}"
msgstr "C-${KEY}"
#: rc/settings/keybindings-rc:37
#: rc/settings/keybindings-rc:31
#, fuzzy, sh-format
msgid "${KEY}"
msgstr "e-${KEY}"
#: rc/settings/keybindings-rc:41
msgid "ReadlineCFG Loading:"
msgstr "ReadlineCFG Lade:"
#: rc/settings/keybindings-rc:37
#: rc/settings/keybindings-rc:41
msgid "Keybindings"
msgstr "Tastenkürzel"
#: rc/settings/keybindings-rc:57 rc/settings/keybindings-rc:60
msgid "Tab-Rotation"
msgstr "Tab-Rotation"
#: rc/settings/ls-rc:12
msgid "LSCOLORS"
msgstr "LSCOLORS"
......@@ -407,22 +426,6 @@ msgstr "Farbiges grep"
msgid "ReadlineCFG"
msgstr "ReadlineCFG"
#: rc/settings/readline-rc:16 rc/settings/readline-rc:27
#: rc/settings/readline-rc:30 rc/settings/readline-rc:35
#: rc/settings/readline-rc:38 rc/settings/readline-rc:43
#: rc/settings/readline-rc:46 rc/settings/readline-rc:51
#: rc/settings/readline-rc:54 rc/settings/readline-rc:59
#: rc/settings/readline-rc:62 rc/settings/readline-rc:67
#: rc/settings/readline-rc:70 rc/settings/readline-rc:75
#: rc/settings/readline-rc:78 rc/settings/readline-rc:83
#: rc/settings/readline-rc:86 rc/settings/readline-rc:91
#: rc/settings/readline-rc:94 rc/settings/readline-rc:99
#: rc/settings/readline-rc:102 rc/settings/readline-rc:107
#: rc/settings/readline-rc:110 rc/settings/readline-rc:115
#: rc/settings/readline-rc:118 rc/settings/readline-rc:122
msgid "ReadlineCFG Setting:"
msgstr "ReadlineCFG Setze:"
#: rc/settings/readline-rc:16
msgid "Bellstyle"
msgstr "Glockenstil"
......@@ -700,3 +703,6 @@ msgstr "Code-Faltungsmethode"
#: rc/settings/vim-rc:228 rc/settings/vim-rc:231
msgid "Wildmenu"
msgstr "Wildmenu"
#~ msgid "Tab-Rotation"
#~ msgstr "Tab-Rotation"
......@@ -20,13 +20,17 @@ keybindings_setter () {
esac
if [[ ${MOD} == e ]]; then
dbg_msg "$ReadlineCFG Setting:" $"${ACT}" $"e-${KEY}"
dbg_msg $"ReadlineCFG Setting:" $"${ACT}" $"e-${KEY}"
bind "\\e${KEY}":self-insert
echo -E \"\\e${KEY}\":${ACT} >> $RC_FILE
echo -E \"\\e${KEY}\":${ACT} >> ${RC_FILE}
elif [[ ${MOD} == C ]]; then
dbg_msg "$ReadlineCFG Setting:" $"${ACT}" $"C-${KEY}"
dbg_msg $"ReadlineCFG Setting:" $"${ACT}" $"C-${KEY}"
bind "\\C-${KEY}":self-insert
echo -E \"\\C-${KEY}\":${ACT} >> $RC_FILE
echo -E \"\\C-${KEY}\":${ACT} >> ${RC_FILE}
elif [[ ${MOD} == X ]]; then
dbg_msg $"ReadlineCFG Setting:" $"${ACT}" $"${KEY}"
#bind "${KEY}":self-insert
echo -E ${KEY}:${ACT} >> ${RC_FILE}
fi
fi
}
......@@ -41,7 +45,7 @@ if [[ ! -e $HOME/.keybindings.bs-ng.* ]]; then
possible_hostname_completions possible_username_completions \
possible_variable_completions kill_line unix_line_discard \
beginning_of_line end_of_line clear_screen history_search_forward \
history_search_backward complete_path; do
history_search_backward complete_path menu_complete; do
keybindings_setter $(ini_get $key) ${key//_/-}
......@@ -52,10 +56,3 @@ if [[ ! -e $HOME/.keybindings.bs-ng.* ]]; then
unset RC_FILE
fi
if [[ $(ini_get tab_rotation) == True ]]; then
dbg_msg $"BashStyle-NG Setting:" $"Tab-Rotation" $"On"
dbg_log bind 'TAB:menu-complete'
dbg_log complete -d -X '.[a-zA-Z0-9]*' cd
else dbg_msg $"BashStyle-NG Setting:" $"Tab-Rotation" $"Off"
fi
......@@ -1262,10 +1262,16 @@ The Undobuffer Pythonmodule is licensed under the:
<columns>
<!-- column-name Binding -->
<column type="gchararray"/>
<!-- column-name Icon -->
<column type="gchararray"/>
<!-- column-name Icon2 -->
<column type="gchararray"/>
<!-- column-name Alt -->
<column type="gboolean"/>
<!-- column-name Ctrl -->
<column type="gboolean"/>
<!-- column-name None -->
<column type="gboolean"/>
<!-- column-name Key -->
<column type="gchararray"/>
</columns>
......@@ -1464,49 +1470,6 @@ The Undobuffer Pythonmodule is licensed under the:
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="reset_key">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="relief">none</property>
<child>
<object class="GtkBox" id="box29">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkImage" id="image2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">gtk-revert-to-saved</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label16">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Reset Keybindings</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="use_keybindingscfg">
<property name="label" translatable="yes">Customize Keybindings</property>
......@@ -1518,7 +1481,7 @@ The Undobuffer Pythonmodule is licensed under the:
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
<property name="position">2</property>
</packing>
</child>
</object>
......@@ -3229,30 +3192,6 @@ here (else you'll get unwanted results).</property>
<property name="x_options">GTK_EXPAND</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="tabrotate">
<property name="label" translatable="yes">Enable Tab-Rotation</property>
<property name="width_request">220</property>
<property name="height_request">26</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">tab_rotation
when doing completion using [TAB] instead of
display a list of possible completions, "rotate"
between matches pressing [TAB] multiple times.</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_EXPAND</property>
<property name="y_options">GTK_EXPAND</property>
</packing>
</child>
<child>
<object class="GtkVBox" id="advanced.box.dirchar">
<property name="visible">True</property>
......@@ -3298,6 +3237,9 @@ prompt).</property>
<property name="x_options">GTK_EXPAND</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">True</property>
......
......@@ -128,7 +128,6 @@ class BashStyleNG(object):
WidgetHandler.InitWidget("history_control", "Advanced", "history_control", "combo", dicts.history_types)
WidgetHandler.InitWidget("history_timeformat", "Advanced", "history_timeformat", "text", None)
WidgetHandler.InitWidget("dirchar", "Advanced", "directory_indicator", "text", None)
WidgetHandler.InitWidget("tabrotate", "Advanced", "tab_rotation", "bool", None)
WidgetHandler.InitWidget("enable_lscd", "Advanced", "use_lscd", "bool", None)
WidgetHandler.InitWidget("enable_treecd", "Advanced", "use_treecd", "bool", None)
WidgetHandler.InitWidget("lscd_mkdir", "Advanced", "lscd_mkdir", "bool", None)
......
......@@ -31,7 +31,7 @@ USER_DEFAULTS_SAVE = (os.getenv('HOME') + '/.bs-ng.ini.save')
FACTORY_DEFAULTS = (DATADIR + '/bashstyle-ng/bs-ng.ini')
VENDOR_DEFAULTS = ('/etc/bs-ng_vendor.ini')
app_ini_version = 13
app_ini_version = 14
class Config(object):
def InitConfig(self):
......
......@@ -97,15 +97,11 @@ class IconBook(object):
use_keys_button = gtkbuilder.get_object("use_keybindingscfg")
use_keys_button.set_visible(0)
reset_key = gtkbuilder.get_object("reset_key")
reset_key.set_visible(0)
def back_clicked(data):
notebook.set_current_page(0)
reset_key.set_visible(0)
use_keys_button.set_visible(0)
back.set_visible(0)
main_label.set_visible(1)
main_label.set_text(_("Choose a Category:"))
back = gtkbuilder.get_object("back")
back.connect("clicked", back_clicked)
......@@ -118,13 +114,13 @@ class IconBook(object):
def iconview_activated(widget, item):
model = widget.get_model()
notebook.set_current_page(notebook_pages[model[item][1]])
if model[item][1] == _("Keybindings") :
reset_key.set_visible(1)
use_keys_button.set_visible(1)
if model[item][1] == _("About BashStyle-NG") :
self.ShowAboutDialog()
if model[item][1] != _("About BashStyle-NG") :
if model[item][1] != _("About BashStyle-NG"):
back.set_visible(1)
main_label.set_visible(0)
main_label.set_text(_("Category: ") + _(model[item][1]))
if model[item][1] == _("Keybindings"):
use_keys_button.set_visible(1)
else:
self.ShowAboutDialog()
iconview.connect("item-activated", iconview_activated)
......@@ -25,6 +25,11 @@ try:
except ImportError:
FAILED.append(_("Gtk (from gi.repository)"))
try:
from gi.repository import GObject
except ImportError:
FAILED.append(_("GObject (from gi.repository)"))
try:
from gi.repository.GdkPixbuf import Pixbuf
except ImportError:
......@@ -64,9 +69,28 @@ keybindings = {
"forward_char",
"backward_word",
"forward_word",
"overwrite_mode"
"overwrite_mode",
"menu_complete"
}
class CellRendererClickablePixbuf(Gtk.CellRendererPixbuf):
__gsignals__ = {
'clicked': (GObject.SIGNAL_RUN_LAST, GObject.TYPE_NONE,
(GObject.TYPE_STRING,))
}
def __init__(self):
Gtk.CellRendererPixbuf.__init__(self)
self.set_property('mode', Gtk.CellRendererMode(1))
def do_activate(self, event, widget, path, background_area, cell_area, flags):
if (event
and cell_area.x <= event.x <= cell_area.x + cell_area.width
and cell_area.y <= event.y <= cell_area.y + cell_area.height):
self.emit('clicked', path)
GObject.type_register(CellRendererClickablePixbuf)
class KeyTree(object):
def __init__(self, cfo, udc, fdc):
......@@ -76,47 +100,66 @@ class KeyTree(object):
def InitTree(self):
use_keys = gtkbuilder.get_object("use_keybindingscfg")
reset = gtkbuilder.get_object("reset_key")
store = gtkbuilder.get_object("treeviewstore")
tree = gtkbuilder.get_object("treeview")
render_binding = Gtk.CellRendererText()
column_binding = Gtk.TreeViewColumn("Binding", render_binding, text=0)
column_binding = Gtk.TreeViewColumn(_("Binding"), render_binding, text=0)
tree.append_column(column_binding)
render_revert_user = CellRendererClickablePixbuf()
render_revert_user.set_property("icon-name", "gtk-revert-to-saved")
column_revert_user = Gtk.TreeViewColumn(_("Revert"), render_revert_user, icon_name=1)
tree.append_column(column_revert_user)
render_revert_factory = CellRendererClickablePixbuf()
render_revert_factory.set_property("icon-name", "gtk-delete")
column_revert_factory = Gtk.TreeViewColumn(_("Default"), render_revert_factory, icon_name=2)
tree.append_column(column_revert_factory)
render_alt = Gtk.CellRendererToggle()
render_alt.set_property("radio", True)
column_alt = Gtk.TreeViewColumn("Alt", render_alt, active=1)
column_alt = Gtk.TreeViewColumn(_("Alt"), render_alt, active=3)
tree.append_column(column_alt)
render_ctrl = Gtk.CellRendererToggle()
render_ctrl.set_property("radio", True)
column_ctrl = Gtk.TreeViewColumn("Ctrl", render_ctrl, active=2)
column_ctrl = Gtk.TreeViewColumn(_("Ctrl"), render_ctrl, active=4)
tree.append_column(column_ctrl)
def on_cell_toggled(widget, path, column, concurrent_column):
store[path][column] = not store[path][column]
store[path][concurrent_column] = not store[path][concurrent_column]
render_nmod = Gtk.CellRendererToggle()
render_nmod.set_property("radio", True)
column_nmod = Gtk.TreeViewColumn(_("None"), render_nmod, active=5)
tree.append_column(column_nmod)
def on_cell_toggled(widget, path, alt, ctrl, nmod):
store[path][3] = alt
store[path][4] = ctrl
store[path][5] = nmod
render_ctrl.connect("toggled", on_cell_toggled, 2, 1)
render_alt.connect("toggled", on_cell_toggled, 1, 2)
render_alt.connect("toggled", on_cell_toggled, True, False, False)
render_ctrl.connect("toggled", on_cell_toggled, False, True, False)
render_nmod.connect("toggled", on_cell_toggled, False, False, True)
render_key = Gtk.CellRendererText()
render_key.set_property("editable", True)
column_key = Gtk.TreeViewColumn("Key", render_key, text=3)
column_key = Gtk.TreeViewColumn(_("Key"), render_key, text=6)
tree.append_column(column_key)
def text_edited(widget, path, text):
store[path][3] = text
self.change_setting(store[path][0].replace("-", "_"), store[path][1],
store[path][2], store[path][3])
store[path][6] = text
if text == "":
on_cell_toggled(widget, path, False, False, False)
else:
self.change_setting(store[path][0].replace("-", "_"), store[path][3],
store[path][4], store[path][5], store[path][6])
render_key.connect("edited", text_edited)
def on_changed(selection):
(model, iter) = selection.get_selected()
self.change_setting(model[iter][0].replace("-", "_"), model[iter][1],
model[iter][2], model[iter][3])
self.change_setting(model[iter][0].replace("-", "_"), model[iter][3],
model[iter][4], model[iter][5], model[iter][6])
tree.get_selection().connect("changed", on_changed)
......@@ -129,29 +172,41 @@ class KeyTree(object):
use_keys.connect("toggled", on_use_keys)
def on_reset(data):
def on_reset(widget, path, config):
sel = tree.get_selection()
(model, iter) = sel.get_selected()
setting = model[iter][0].replace("-", "_")
self.config["Keybindings"][setting] = self.factorydefault["Keybindings"][setting]
if config == "user":
self.config["Keybindings"][setting] = self.userdefault["Keybindings"][setting]
else:
self.config["Keybindings"][setting] = self.factorydefault["Keybindings"][setting]
if self.config["Keybindings"][setting] == "":
alt = False
ctrl = False
nmod = False
boundkey = ""
else:
modifier = self.config["Keybindings"][setting].split(":")[0]
if modifier == "e":
alt = True
ctrl = False
nmod = False
elif modifier == "C":
alt = False
ctrl = True
nmod = False
elif modifier == "X":
alt = False
ctrl = False
nmod = True
boundkey = self.config["Keybindings"][setting].split(":")[1]
model[iter][1] = alt
model[iter][2] = ctrl
model[iter][3] = boundkey
model[iter][3] = alt
model[iter][4] = ctrl
model[iter][5] = nmod
model[iter][6] = boundkey
reset.connect("clicked", on_reset)
render_revert_user.connect("clicked", on_reset, "user")
render_revert_factory.connect("clicked", on_reset, "factory")
self.populate(keybindings, store)
......@@ -172,15 +227,22 @@ class KeyTree(object):
if modifier == "e":
alt = True
ctrl = False
nmod = False
elif modifier == "C":
alt = False
ctrl = True
nmod = False
elif modifier == "X":
alt = False
ctrl = False
nmod = True
else:
alt = False
ctrl = False
store.append([label, alt, ctrl, boundkey])
nmod = False
store.append([label, "gtk-revert-to-saved", "gtk-delete", alt, ctrl, nmod, boundkey])
def change_setting(self, setting, alt, ctrl, key):
def change_setting(self, setting, alt, ctrl, nmod, key):
if key == "":
self.config["Keybindings"][setting] = ""
else:
......@@ -188,5 +250,7 @@ class KeyTree(object):
self.config["Keybindings"][setting] = "e:" + key
elif ctrl == True:
self.config["Keybindings"][setting] = "C:" + key
elif nmod == True:
self.config["Keybindings"][setting] = "X:" + key
else:
self.config["Keybindings"][setting] = ""
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment