Add background image's drawing mode and alignment to preferences GUI
This commit is contained in:
parent
df8890199c
commit
6cc3052ba7
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.38.2 -->
|
||||
<!-- Generated with glade 3.40.0 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.10"/>
|
||||
<object class="GtkListStore" id="BackspaceKeyListStore">
|
||||
|
@ -154,6 +154,60 @@
|
|||
</row>
|
||||
</data>
|
||||
</object>
|
||||
<object class="GtkListStore" id="ImageAlignHorizListStore">
|
||||
<columns>
|
||||
<!-- column-name Alignment -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
<data>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Left</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Center</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Right</col>
|
||||
</row>
|
||||
</data>
|
||||
</object>
|
||||
<object class="GtkListStore" id="ImageAlignVertListStore">
|
||||
<columns>
|
||||
<!-- column-name Alignment -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
<data>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Top</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Middle</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Bottom</col>
|
||||
</row>
|
||||
</data>
|
||||
</object>
|
||||
<object class="GtkListStore" id="ImageDrawingModeListStore">
|
||||
<columns>
|
||||
<!-- column-name DrawingMode -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
<data>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Stretch and Fill</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Scale and Fit</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Scale and Crop</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Tiling</col>
|
||||
</row>
|
||||
</data>
|
||||
</object>
|
||||
<object class="GtkListStore" id="KeybindingsListStore">
|
||||
<columns>
|
||||
<!-- column-name Name -->
|
||||
|
@ -2659,6 +2713,16 @@
|
|||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkAlignment">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="left-padding">12</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
|
@ -2667,7 +2731,7 @@
|
|||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="label" translatable="yes">Background Image File:</property>
|
||||
<property name="label" translatable="yes">Image File:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
|
@ -2694,7 +2758,164 @@
|
|||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">4</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<child>
|
||||
<object class="GtkAccelLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="label" translatable="yes">Drawing mode:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="padding">5</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="background_image_mode_combobox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="model">ImageDrawingModeListStore</property>
|
||||
<property name="active">0</property>
|
||||
<signal name="changed" handler="on_background_image_mode_changed" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkCellRendererText"/>
|
||||
<attributes>
|
||||
<attribute name="text">0</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack-type">end</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="spacing">12</property>
|
||||
<property name="homogeneous">True</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="label" translatable="yes">Horizontal alignment:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="padding">5</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="background_image_align_horiz_combobox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="model">ImageAlignHorizListStore</property>
|
||||
<property name="active">1</property>
|
||||
<signal name="changed" handler="on_background_image_align_horiz_changed" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkCellRendererText"/>
|
||||
<attributes>
|
||||
<attribute name="text">0</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack-type">end</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="label" translatable="yes">Vertical alignment:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="padding">5</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="background_image_align_vert_combobox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="model">ImageAlignVertListStore</property>
|
||||
<property name="active">1</property>
|
||||
<signal name="changed" handler="on_background_image_align_vert_changed" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkCellRendererText"/>
|
||||
<attributes>
|
||||
<attribute name="text">0</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack-type">end</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
@ -2783,7 +3004,7 @@
|
|||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">4</property>
|
||||
<property name="position">6</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
|
@ -3721,12 +3942,12 @@
|
|||
</child>
|
||||
<child>
|
||||
<object class="GtkVBox" id="vbox124">
|
||||
<property name="can-focus">False</property>
|
||||
<child>
|
||||
<object class="GtkEntry" id="keybindingsearchentry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="has-focus">False</property>
|
||||
<property name="placeholder_text">filter keybindings</property>
|
||||
<property name="placeholder-text">filter keybindings</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
|
@ -3794,6 +4015,11 @@
|
|||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
|
|
|
@ -694,11 +694,42 @@ class PrefsEditor:
|
|||
elif self.config['background_type'] == 'image':
|
||||
guiget('image_radiobutton').set_active(True)
|
||||
self.update_background_tab()
|
||||
# Background image
|
||||
widget = guiget('background_image_file')
|
||||
widget.set_filename(self.config['background_image'])
|
||||
|
||||
widget = guiget('background_image_mode_combobox')
|
||||
if self.config['background_image_mode'] == 'scale_and_fit':
|
||||
widget.set_active(1)
|
||||
elif self.config['background_image_mode'] == 'scale_and_crop':
|
||||
widget.set_active(2)
|
||||
elif self.config['background_image_mode'] == 'tiling':
|
||||
widget.set_active(3)
|
||||
else:
|
||||
# default to stretch_and_fill
|
||||
widget.set_active(0)
|
||||
|
||||
widget = guiget('background_image_align_horiz_combobox')
|
||||
if self.config['background_image_align_horiz'] == 'center':
|
||||
widget.set_active(1)
|
||||
elif self.config['background_image_align_horiz'] == 'right':
|
||||
widget.set_active(2)
|
||||
else:
|
||||
# default to left
|
||||
widget.set_active(0)
|
||||
|
||||
widget = guiget('background_image_align_vert_combobox')
|
||||
if self.config['background_image_align_vert'] == 'middle':
|
||||
widget.set_active(1)
|
||||
elif self.config['background_image_align_vert'] == 'bottom':
|
||||
widget.set_active(2)
|
||||
else:
|
||||
# default to top
|
||||
widget.set_active(0)
|
||||
|
||||
# Background shading
|
||||
widget = guiget('background_darkness_scale')
|
||||
widget.set_value(float(self.config['background_darkness']))
|
||||
widget = guiget('background_image_file')
|
||||
widget.set_filename(self.config['background_image'])
|
||||
|
||||
## Scrolling tab
|
||||
# Scrollbar position
|
||||
|
@ -999,6 +1030,41 @@ class PrefsEditor:
|
|||
self.config['background_image'] = widget.get_filename()
|
||||
self.config.save()
|
||||
|
||||
def on_background_image_mode_changed(self, widget):
|
||||
selected = widget.get_active()
|
||||
if selected == 1:
|
||||
value = 'scale_and_fit'
|
||||
elif selected == 2:
|
||||
value = 'scale_and_crop'
|
||||
elif selected == 3:
|
||||
value = 'tiling'
|
||||
else:
|
||||
value = 'stretch_and_fill'
|
||||
self.config['background_image_mode'] = value
|
||||
self.config.save()
|
||||
|
||||
def on_background_image_align_horiz_changed(self, widget):
|
||||
selected = widget.get_active()
|
||||
if selected == 1:
|
||||
value = 'center'
|
||||
elif selected == 2:
|
||||
value = 'right'
|
||||
else:
|
||||
value = 'left'
|
||||
self.config['background_image_align_horiz'] = value
|
||||
self.config.save()
|
||||
|
||||
def on_background_image_align_vert_changed(self, widget):
|
||||
selected = widget.get_active()
|
||||
if selected == 1:
|
||||
value = 'middle'
|
||||
elif selected == 2:
|
||||
value = 'bottom'
|
||||
else:
|
||||
value = 'top'
|
||||
self.config['background_image_align_vert'] = value
|
||||
self.config.save()
|
||||
|
||||
def on_darken_background_scale_value_changed(self, widget):
|
||||
"""Background darkness setting changed"""
|
||||
value = widget.get_value() # This one is rounded according to the UI.
|
||||
|
@ -1603,10 +1669,12 @@ class PrefsEditor:
|
|||
self.config['background_type'] = backtype
|
||||
self.config.save()
|
||||
|
||||
if backtype == 'image':
|
||||
guiget('background_image_file').set_sensitive(True)
|
||||
else:
|
||||
guiget('background_image_file').set_sensitive(False)
|
||||
# toggle sensitivity of widgets related to background image
|
||||
for element in ('background_image_file',
|
||||
'background_image_align_horiz_combobox',
|
||||
'background_image_align_vert_combobox',
|
||||
'background_image_mode_combobox'):
|
||||
guiget(element).set_sensitive(backtype == 'image')
|
||||
|
||||
if backtype in ('transparent', 'image'):
|
||||
guiget('darken_background_scale').set_sensitive(True)
|
||||
|
|
Loading…
Reference in New Issue