Use consistent ellipsis mode
This commit is contained in:
parent
95a0c3f5f1
commit
0d428fc913
@ -277,7 +277,8 @@ class Palette(PaletteWindow):
|
|||||||
self._secondary_label.set_max_width_chars(
|
self._secondary_label.set_max_width_chars(
|
||||||
style.MENU_WIDTH_CHARS)
|
style.MENU_WIDTH_CHARS)
|
||||||
self._secondary_label.set_line_wrap(True)
|
self._secondary_label.set_line_wrap(True)
|
||||||
self._secondary_label.set_ellipsize(Pango.EllipsizeMode.END)
|
self._secondary_label.set_ellipsize(
|
||||||
|
style.DEFAULT_ELLIPSIS_MODE)
|
||||||
self._secondary_label.set_lines(NO_OF_LINES)
|
self._secondary_label.set_lines(NO_OF_LINES)
|
||||||
self._secondary_label.set_justify(Gtk.Justification.FILL)
|
self._secondary_label.set_justify(Gtk.Justification.FILL)
|
||||||
else:
|
else:
|
||||||
@ -285,7 +286,8 @@ class Palette(PaletteWindow):
|
|||||||
body_width = NO_OF_LINES * style.MENU_WIDTH_CHARS
|
body_width = NO_OF_LINES * style.MENU_WIDTH_CHARS
|
||||||
body_width -= ELLIPSIS_LENGTH
|
body_width -= ELLIPSIS_LENGTH
|
||||||
if len(label) > body_width:
|
if len(label) > body_width:
|
||||||
label = ' '.join(label[:body_width].split()[:-1]) + '...'
|
label = label[0:style.DEFAULT_ELLIPSIS_CHARACTERS] + \
|
||||||
|
'...' + label[-style.DEFAULT_ELLIPSIS_CHARACTERS:]
|
||||||
label = textwrap.fill(label, width=style.MENU_WIDTH_CHARS)
|
label = textwrap.fill(label, width=style.MENU_WIDTH_CHARS)
|
||||||
|
|
||||||
self._secondary_text = label
|
self._secondary_text = label
|
||||||
|
@ -147,3 +147,6 @@ PALETTE_CURSOR_DISTANCE = zoom(10)
|
|||||||
TOOLBAR_ARROW_SIZE = zoom(24)
|
TOOLBAR_ARROW_SIZE = zoom(24)
|
||||||
|
|
||||||
MENU_WIDTH_CHARS = 60
|
MENU_WIDTH_CHARS = 60
|
||||||
|
|
||||||
|
DEFAULT_ELLIPSIS_MODE = Pango.EllipsizeMode.MIDDLE
|
||||||
|
DEFAULT_ELLIPSIS_CHARACTERS = 7
|
||||||
|
Loading…
Reference in New Issue
Block a user