Undo my madness
This commit is contained in:
parent
f8c8a71633
commit
41a8b2372c
|
@ -54,6 +54,10 @@ if __name__ == '__main__':
|
|||
TERMINATOR = Terminator()
|
||||
TERMINATOR.origcwd = ORIGCWD
|
||||
TERMINATOR.reconfigure()
|
||||
try:
|
||||
TERMINATOR.create_layout(OPTIONS.layout)
|
||||
except (KeyError,ValueError), ex:
|
||||
err('layout creation failed, creating a window ("%s")' % ex)
|
||||
TERMINATOR.new_window()
|
||||
|
||||
if OPTIONS.debug > 2:
|
||||
|
|
|
@ -2056,10 +2056,193 @@
|
|||
<property name="tab_fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkHBox" id="layouthbox">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<object class="GtkVBox" id="vbox2">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkTreeView" id="layoutlist">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="model">LayoutListStore</property>
|
||||
<property name="hadjustment">adjustment5</property>
|
||||
<property name="vadjustment">adjustment6</property>
|
||||
<property name="search_column">0</property>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="layoutcolumn">
|
||||
<property name="title">Layout</property>
|
||||
<property name="clickable">True</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="cellrenderertext12">
|
||||
<signal name="edited" handler="on_layout_name_edited"/>
|
||||
</object>
|
||||
<attributes>
|
||||
<attribute name="editable">1</attribute>
|
||||
<attribute name="text">0</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox5">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="layoutaddbutton">
|
||||
<property name="label">gtk-add</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<signal name="clicked" handler="on_layoutaddbutton_clicked"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="layoutremovebutton">
|
||||
<property name="label">gtk-remove</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<signal name="clicked" handler="on_layoutremovebutton_clicked"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkAlignment" id="canvasalignment">
|
||||
<property name="visible">True</property>
|
||||
<property name="top_padding">6</property>
|
||||
<property name="bottom_padding">6</property>
|
||||
<property name="left_padding">6</property>
|
||||
<property name="right_padding">6</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkVBox" id="vbox6">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkAlignment" id="alignment3">
|
||||
<property name="visible">True</property>
|
||||
<property name="left_padding">6</property>
|
||||
<child>
|
||||
<object class="GtkTable" id="table1">
|
||||
<property name="visible">True</property>
|
||||
<property name="n_rows">2</property>
|
||||
<property name="n_columns">2</property>
|
||||
<property name="column_spacing">12</property>
|
||||
<property name="row_spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label12">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Not yet implemented</property>
|
||||
<property name="label" translatable="yes">Profile</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="x_options"></property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label14">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Custom command</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_options"></property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="entry1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">•</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_options"></property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="layout_profile_chooser">
|
||||
<property name="visible">True</property>
|
||||
<property name="model">layoutprofilelist</property>
|
||||
<property name="active">0</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="cellrenderertext13"/>
|
||||
<attributes>
|
||||
<attribute name="text">0</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">2</property>
|
||||
|
|
|
@ -23,6 +23,7 @@ class PrefsEditor:
|
|||
keybindings = None
|
||||
window = None
|
||||
builder = None
|
||||
previous_layout_selection = None
|
||||
previous_profile_selection = None
|
||||
colorschemevalues = {'black_on_yellow': 0,
|
||||
'black_on_white': 1,
|
||||
|
@ -188,6 +189,19 @@ class PrefsEditor:
|
|||
selection.select_iter(self.profileiters['default'])
|
||||
|
||||
## Layouts tab
|
||||
widget = guiget('layoutlist')
|
||||
liststore = widget.get_model()
|
||||
layouts = self.config.list_layouts()
|
||||
self.layoutiters = {}
|
||||
for layout in layouts:
|
||||
if layout == 'default':
|
||||
editable = False
|
||||
else:
|
||||
editable = True
|
||||
self.layoutiters[layout] = liststore.append([layout, editable])
|
||||
selection = widget.get_selection()
|
||||
selection.connect('changed', self.on_layout_selection_changed)
|
||||
selection.select_iter(self.layoutiters['default'])
|
||||
|
||||
## Keybindings tab
|
||||
widget = guiget('keybindingtreeview')
|
||||
|
@ -262,6 +276,7 @@ class PrefsEditor:
|
|||
self.store_profile_values()
|
||||
|
||||
## Layouts tab
|
||||
self.store_layout(self.previous_layout_selection)
|
||||
|
||||
## Keybindings tab
|
||||
keybindings = self.config['keybindings']
|
||||
|
@ -601,6 +616,14 @@ class PrefsEditor:
|
|||
value = 'escape-sequence'
|
||||
self.config['delete_binding'] = value
|
||||
|
||||
def set_layout(self, layout):
|
||||
"""Set a layout"""
|
||||
pass
|
||||
|
||||
def store_layout(self, layout):
|
||||
"""Store a layout"""
|
||||
pass
|
||||
|
||||
def on_profileaddbutton_clicked(self, _button):
|
||||
"""Add a new profile to the list"""
|
||||
guiget = self.builder.get_object
|
||||
|
@ -637,6 +660,44 @@ class PrefsEditor:
|
|||
model.remove(rowiter)
|
||||
selection.select_iter(model.get_iter_first())
|
||||
|
||||
def on_layoutaddbutton_clicked(self, _button):
|
||||
"""Add a new layout to the list"""
|
||||
terminator = Terminator()
|
||||
current_layout = terminator.describe_layout()
|
||||
guiget = self.builder.get_object
|
||||
|
||||
treeview = guiget('layoutlist')
|
||||
model = treeview.get_model()
|
||||
values = [ r[0] for r in model ]
|
||||
|
||||
name = _('New Layout')
|
||||
if name in values:
|
||||
i = 1
|
||||
while name in values:
|
||||
i = i + 1
|
||||
name = '%s %d' % (_('New Layout'), i)
|
||||
|
||||
if self.config.add_layout(name, current_layout):
|
||||
model.append([name, True])
|
||||
|
||||
def on_layoutremovebutton_clicked(self, _button):
|
||||
"""Remove a layout from the list"""
|
||||
guiget = self.builder.get_object
|
||||
|
||||
treeview = guiget('layoutlist')
|
||||
selection = treeview.get_selection()
|
||||
(model, rowiter) = selection.get_selected()
|
||||
layout = model.get_value(rowiter, 0)
|
||||
|
||||
if layout == 'default':
|
||||
# We shouldn't let people delete this layout
|
||||
return
|
||||
|
||||
self.previous_sekection = None
|
||||
self.config.del_layout(layout)
|
||||
model.remove(rowiter)
|
||||
selection.select_iter(model.get_iter_first())
|
||||
|
||||
def on_use_custom_command_checkbutton_toggled(self, checkbox):
|
||||
"""Toggling the use_custom_command checkbox needs to alter the
|
||||
sensitivity of the custom_command entrybox"""
|
||||
|
@ -739,6 +800,45 @@ class PrefsEditor:
|
|||
if oldname == self.previous_profile_selection:
|
||||
self.previous_profile_selection = newtext
|
||||
|
||||
def on_layout_selection_changed(self, selection):
|
||||
"""A different layout was selected"""
|
||||
if self.previous_layout_selection is not None:
|
||||
dbg('Storing: %s' % self.previous_layout_selection)
|
||||
self.store_layout(self.previous_layout_selection)
|
||||
|
||||
(listmodel, rowiter) = selection.get_selected()
|
||||
if not rowiter:
|
||||
# Something is wrong, just jump to the first item in the list
|
||||
treeview = selection.get_tree_view()
|
||||
liststore = treeview.get_model()
|
||||
selection.select_iter(liststore.get_iter_first())
|
||||
return
|
||||
layout = listmodel.get_value(rowiter, 0)
|
||||
self.set_layout(layout)
|
||||
self.previous_layout_selection = layout
|
||||
|
||||
widget = self.builder.get_object('layoutremovebutton')
|
||||
if layout == 'default':
|
||||
widget.set_sensitive(False)
|
||||
else:
|
||||
widget.set_sensitive(True)
|
||||
|
||||
def on_layout_name_edited(self, cell, path, newtext):
|
||||
"""Update a layout name"""
|
||||
oldname = cell.get_property('text')
|
||||
if oldname == newtext or oldname == 'default':
|
||||
return
|
||||
dbg('Changing %s to %s' % (oldname, newtext))
|
||||
self.config.rename_layout(oldname, newtext)
|
||||
|
||||
widget = self.builder.get_object('layoutlist')
|
||||
model = widget.get_model()
|
||||
itera = model.get_iter(path)
|
||||
model.set_value(itera, 0, newtext)
|
||||
|
||||
if oldname == self.previous_layout_selection:
|
||||
self.previous_layout_selection = newtext
|
||||
|
||||
def on_color_scheme_combobox_changed(self, widget):
|
||||
"""Update the fore/background colour pickers"""
|
||||
value = None
|
||||
|
|
Loading…
Reference in New Issue