Complete the Terminal Command profile tab. Teach the colour scheme picker how to exist in the config and how to be controlled by the prefs UI
This commit is contained in:
parent
1924c2f81a
commit
594ee47912
|
@ -109,6 +109,35 @@
|
|||
</row>
|
||||
</data>
|
||||
</object>
|
||||
<object class="GtkListStore" id="ColourSchemeListStore">
|
||||
<columns>
|
||||
<!-- column-name scheme -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
<data>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Black on light yellow</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Black on white</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Grey on black</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Green on black</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">White on black</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Orange on black</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Custom</col>
|
||||
</row>
|
||||
</data>
|
||||
</object>
|
||||
<object class="GtkDialog" id="prefswin">
|
||||
<property name="border_width">5</property>
|
||||
<property name="type_hint">normal</property>
|
||||
|
@ -625,76 +654,12 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkVBox" id="vbox91">
|
||||
<object class="GtkAlignment" id="alignment1">
|
||||
<property name="visible">True</property>
|
||||
<property name="border_width">12</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">18</property>
|
||||
<child>
|
||||
<object class="GtkVBox" id="vbox79">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label33">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes"><b>Title</b></property>
|
||||
<property name="use_markup">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkAlignment" id="alignment10108">
|
||||
<property name="visible">True</property>
|
||||
<property name="left_padding">12</property>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox137">
|
||||
<property name="visible">True</property>
|
||||
<property name="spacing">12</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="title-entry-label">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Initial _title:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="justify">center</property>
|
||||
<property name="mnemonic_widget">title-entry</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="title-entry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">•</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</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>
|
||||
<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>
|
||||
<object class="GtkVBox" id="vbox80">
|
||||
<property name="visible">True</property>
|
||||
|
@ -867,10 +832,6 @@
|
|||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
|
@ -880,7 +841,7 @@
|
|||
<child type="tab">
|
||||
<object class="GtkLabel" id="label38">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Title and Command</property>
|
||||
<property name="label" translatable="yes">Terminal Command</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="justify">center</property>
|
||||
</object>
|
||||
|
@ -948,6 +909,7 @@
|
|||
<property name="receives_default">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="on_use_theme_colors_checkbutton_toggled"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="right_attach">2</property>
|
||||
|
@ -1050,6 +1012,15 @@
|
|||
<child>
|
||||
<object class="GtkComboBox" id="color-scheme-combobox">
|
||||
<property name="visible">True</property>
|
||||
<property name="model">ColourSchemeListStore</property>
|
||||
<property name="active">2</property>
|
||||
<signal name="changed" handler="on_color_scheme_combobox_changed"/>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="cellrenderertext6"/>
|
||||
<attributes>
|
||||
<attribute name="text">0</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
|
|
|
@ -137,6 +137,7 @@ DEFAULTS = {
|
|||
'background_image' : '',
|
||||
'backspace_binding' : 'ascii-del',
|
||||
'delete_binding' : 'delete-sequence',
|
||||
'color_scheme' : 'grey_on_black',
|
||||
'cursor_blink' : True,
|
||||
'cursor_shape' : 'block',
|
||||
'cursor_color' : '',
|
||||
|
|
|
@ -10,6 +10,14 @@ from version import APP_NAME, APP_VERSION
|
|||
from translation import _
|
||||
|
||||
class PrefsEditor:
|
||||
colorschemevalues = {'black_on_yellow': 0,
|
||||
'black_on_white': 1,
|
||||
'grey_on_black': 2,
|
||||
'green_on_black': 3,
|
||||
'white_on_black': 4,
|
||||
'orange_on_black': 5,
|
||||
'custom': 6}
|
||||
|
||||
data = {'titlebars': ['Show titlebars', 'This places a bar above each terminal which displays its title.'],
|
||||
'zoomedtitlebar': ['Show titlebar when zoomed', 'This places an informative bar above a zoomed terminal to indicate there are hidden terminals.'],
|
||||
'allow_bold': ['Allow bold text', 'Controls whether or not the terminals will honour requests for bold text'],
|
||||
|
@ -182,6 +190,54 @@ class PrefsEditor:
|
|||
widget = guiget('word-chars-entry')
|
||||
widget.set_text(self.config['word_chars'])
|
||||
|
||||
## Teminal Command tab
|
||||
# Login shell
|
||||
widget = guiget('login-shell-checkbutton')
|
||||
widget.set_active(self.config['login_shell'])
|
||||
# Login records
|
||||
widget = guiget('update-records-checkbutton')
|
||||
widget.set_active(self.config['update_records'])
|
||||
# Use Custom command
|
||||
widget = guiget('use-custom-command-checkbutton')
|
||||
widget.set_active(self.config['use_custom_command'])
|
||||
# Custom Command
|
||||
widget = guiget('custom-command-entry')
|
||||
widget.set_text(self.config['custom_command'])
|
||||
# Exit action
|
||||
widget = guiget('exit-action-combobox')
|
||||
if self.config['exit_action'] == 'restart':
|
||||
widget.set_active(1)
|
||||
elif self.config['exit_action'] == 'hold':
|
||||
widget.set_active(2)
|
||||
else:
|
||||
# Default is to close the terminal
|
||||
widget.set_active(0)
|
||||
|
||||
## Colors tab
|
||||
# Use system colors
|
||||
widget = guiget('use-theme-colors-checkbutton')
|
||||
widget.set_active(self.config['use_theme_colors'])
|
||||
# Colorscheme
|
||||
widget = guiget('color-scheme-combobox')
|
||||
scheme = self.config['color_scheme']
|
||||
if scheme not in self.colorschemevalues:
|
||||
scheme = 'grey_on_black'
|
||||
widget.set_active(self.colorschemevalues[scheme])
|
||||
# Foreground color
|
||||
widget = guiget('foreground-colorpicker')
|
||||
widget.set_color(gtk.gdk.Color(self.config['foreground_color']))
|
||||
if scheme == 'custom':
|
||||
widget.set_sensitive(True)
|
||||
else:
|
||||
widget.set_sensitive(False)
|
||||
# Background color
|
||||
widget = guiget('background-colorpicker')
|
||||
widget.set_color(gtk.gdk.Color(self.config['background_color']))
|
||||
if scheme == 'custom':
|
||||
widget.set_sensitive(True)
|
||||
else:
|
||||
widget.set_sensitive(False)
|
||||
|
||||
def on_profile_selection_changed(self, selection):
|
||||
"""A different profile was selected"""
|
||||
(listmodel, rowiter) = selection.get_selected()
|
||||
|
@ -202,6 +258,66 @@ class PrefsEditor:
|
|||
iter = model.get_iter(path)
|
||||
model.set_value(iter, 0, newtext)
|
||||
|
||||
def on_color_scheme_combobox_changed(self, widget):
|
||||
"""Update the fore/background colour pickers"""
|
||||
value = None
|
||||
guiget = self.builder.get_object
|
||||
active = widget.get_active()
|
||||
for key in self.colorschemevalues.keys():
|
||||
if self.colorschemevalues[key] == active:
|
||||
value = key
|
||||
|
||||
fore = guiget('foreground-colorpicker')
|
||||
back = guiget('background-colorpicker')
|
||||
if value == 'custom':
|
||||
fore.set_sensitive(True)
|
||||
back.set_sensitive(True)
|
||||
else:
|
||||
fore.set_sensitive(False)
|
||||
back.set_sensitive(False)
|
||||
|
||||
forecol = None
|
||||
backcol = None
|
||||
if value == 'grey_on_black':
|
||||
forecol = '#AAAAAA'
|
||||
backcol = '#000000'
|
||||
elif value == 'black_on_yellow':
|
||||
forecol = '#000000'
|
||||
backcol = '#FFFFDD'
|
||||
elif value == 'black_on_white':
|
||||
forecol = '#000000'
|
||||
backcol = '#FFFFFF'
|
||||
elif value == 'white_on_black':
|
||||
forecol = '#FFFFFF'
|
||||
backcol = '#000000'
|
||||
elif value == 'green_on_black':
|
||||
forecol = '#00FF00'
|
||||
backcol = '#000000'
|
||||
elif value == 'orange_on_black':
|
||||
forecol = '#E53C00'
|
||||
backcol = '#000000'
|
||||
|
||||
if forecol is not None:
|
||||
fore.set_color(gtk.gdk.Color(forecol))
|
||||
if backcol is not None:
|
||||
back.set_color(gtk.gdk.Color(backcol))
|
||||
|
||||
def on_use_theme_colors_checkbutton_toggled(self, widget):
|
||||
"""Update colour pickers"""
|
||||
guiget = self.builder.get_object
|
||||
active = widget.get_active()
|
||||
|
||||
scheme = guiget('color-scheme-combobox')
|
||||
fore = guiget('foreground-colorpicker')
|
||||
back = guiget('background-colorpicker')
|
||||
|
||||
if active:
|
||||
for widget in [scheme, fore, back]:
|
||||
widget.set_sensitive(False)
|
||||
else:
|
||||
scheme.set_sensitive(True)
|
||||
self.on_color_scheme_combobox_changed(scheme)
|
||||
|
||||
def source_get_type (self, key):
|
||||
if config.DEFAULTS['global_config'].has_key (key):
|
||||
print "found %s in global_config" % key
|
||||
|
|
Loading…
Reference in New Issue