- Limit voice overlay text length option
This commit is contained in:
parent
65e1a7138b
commit
528dc0889b
5 changed files with 79 additions and 11 deletions
|
|
@ -223,6 +223,8 @@ class Discover:
|
|||
"main", "avatar_bg_col", fallback="[0.0,0.0,0.0,0.0]")))
|
||||
self.voice_overlay.set_avatar_size(
|
||||
config.getint("main", "avatar_size", fallback=48))
|
||||
self.voice_overlay.set_nick_length(
|
||||
config.getint("main", "nick_length", fallback=32))
|
||||
self.voice_overlay.set_icon_spacing(
|
||||
config.getint("main", "icon_spacing", fallback=8))
|
||||
self.voice_overlay.set_text_padding(
|
||||
|
|
|
|||
|
|
@ -136,6 +136,13 @@
|
|||
<property name="step-increment">1</property>
|
||||
<property name="page-increment">8</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="voice_nick_lenght_adj">
|
||||
<property name="lower">10</property>
|
||||
<property name="upper">32</property>
|
||||
<property name="value">32</property>
|
||||
<property name="step-increment">1</property>
|
||||
<property name="page-increment">10</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="voice_text_offset">
|
||||
<property name="lower">-100</property>
|
||||
<property name="upper">100</property>
|
||||
|
|
@ -1267,10 +1274,30 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
<object class="GtkLabel">
|
||||
<property name="name">voice_nick_length_label</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="label" translatable="yes">Limit text length</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">4</property>
|
||||
<property name="top-attach">7</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
<object class="GtkSpinButton">
|
||||
<property name="name">voice_nick_length</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="adjustment">voice_nick_lenght_adj</property>
|
||||
<signal name="value-changed" handler="voice_nick_length_changed" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">5</property>
|
||||
<property name="top-attach">7</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
|
|
|
|||
|
|
@ -136,6 +136,13 @@
|
|||
<property name="step-increment">1</property>
|
||||
<property name="page-increment">8</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="voice_nick_lenght_adj">
|
||||
<property name="lower">10</property>
|
||||
<property name="upper">32</property>
|
||||
<property name="value">32</property>
|
||||
<property name="step-increment">1</property>
|
||||
<property name="page-increment">10</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="voice_text_offset">
|
||||
<property name="lower">-100</property>
|
||||
<property name="upper">100</property>
|
||||
|
|
@ -1267,10 +1274,30 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
<object class="GtkLabel">
|
||||
<property name="name">voice_nick_length_label</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="label" translatable="yes">Limit text length</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">4</property>
|
||||
<property name="top-attach">7</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
<object class="GtkSpinButton">
|
||||
<property name="name">voice_nick_length</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="adjustment">voice_nick_lenght_adj</property>
|
||||
<signal name="value-changed" handler="voice_nick_length_label_changed" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">5</property>
|
||||
<property name="top-attach">7</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
|
|
@ -2091,7 +2118,7 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<!-- n-columns=2 n-rows=7 -->
|
||||
<!-- n-columns=2 n-rows=6 -->
|
||||
<object class="GtkGrid">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
|
|
@ -2259,12 +2286,6 @@
|
|||
<property name="top-attach">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">4</property>
|
||||
|
|
|
|||
|
|
@ -313,6 +313,9 @@ class MainSettingsWindow():
|
|||
self.widget['voice_avatar_opacity'].set_value(config.getfloat(
|
||||
"main", "icon_transparency", fallback=1.0))
|
||||
|
||||
self.widget['voice_nick_length'].set_value(
|
||||
config.getint("main", "nick_length", fallback=32))
|
||||
|
||||
self.widget['voice_avatar_size'].set_value(
|
||||
config.getint("main", "avatar_size", fallback=48))
|
||||
|
||||
|
|
@ -823,6 +826,10 @@ class MainSettingsWindow():
|
|||
self.config_set("main", "avatar_size", "%s" %
|
||||
(int(button.get_value())))
|
||||
|
||||
def voice_nick_length_changed(self, button):
|
||||
self.config_set("main", "nick_length", "%s" %
|
||||
(int(button.get_value())))
|
||||
|
||||
def voice_display_icon_only_changed(self, button):
|
||||
self.config_set("main", "icon_only", "%s" % (button.get_active()))
|
||||
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ class VoiceOverlayWindow(OverlayWindow):
|
|||
'friendlyname': name,
|
||||
})
|
||||
self.avatar_size = 48
|
||||
self.nick_length = 32
|
||||
self.text_pad = 6
|
||||
self.text_font = None
|
||||
self.title_font = None
|
||||
|
|
@ -239,6 +240,13 @@ class VoiceOverlayWindow(OverlayWindow):
|
|||
self.avatar_size = size
|
||||
self.needsredraw = True
|
||||
|
||||
def set_nick_length(self, size):
|
||||
"""
|
||||
Set the length of nickname
|
||||
"""
|
||||
self.nick_length = size
|
||||
self.needsredraw = True
|
||||
|
||||
def set_icon_spacing(self, i):
|
||||
"""
|
||||
Set the spacing between avatar icons
|
||||
|
|
@ -754,6 +762,9 @@ class VoiceOverlayWindow(OverlayWindow):
|
|||
"""
|
||||
Draw username & background at given position
|
||||
"""
|
||||
if self.nick_length < 32 and len(string) > self.nick_length:
|
||||
string = string[:(self.nick_length-1)] + u"\u2026"
|
||||
|
||||
context.save()
|
||||
layout = self.create_pango_layout(string)
|
||||
layout.set_auto_dir(True)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue