Text Size and len of text for Info-Boxes
#1
I have a little issue with the font size and the len of text displayed inside a
Python code

My personal function do display several infos / warnings / errors looks like this ...
Code:
#########################################################
# Function  : GUIInfo                                   #
#########################################################
# Parameter :                                           #
#                                                       #
# Selector    integer                                   #
#                                                       #
# 0           Info                                      #
# 1           Warning                                   #
# 2           Error                                     #
# 3           No text                                   #
#                                                       #
# Info        String to be shown inside Dialog-Box      #
#                                                       #
# Returns   : none                                      #
#########################################################
def GUIInfo(Selector,Info):

    dialog = xbmcgui.Dialog()
    title = __language__(33214 + Selector)
    selected = dialog.ok(title,Info)
    return 0

#########################################################

With the default english language most of the text is shown correctly ....
But as soon I change to German a few strings are to long to be displayed correctly. (On a single line)
It shows only a few points at the end. (like text.....)

* Is it possible to use a linebreak inside the strings.xml to be shown correctly
for a particular language ?

I saw inside the api documentation that it is possible to use multiple lines for a
dialog ....

heading : string or unicode - dialog heading.
line1 : string or unicode - line #1 text.
line2 : [opt] string or unicode - line #2 text.
line3 : [opt] string or unicode - line #3 text.

Is the len of the string that can be shown inside dialog.ok allways the same ?
(For example 35 Chars)

Independed from resolution and the used Theme ?

I hope somebody can give me a little tip ;-)
Reply
#2
it's not completely independent of either of those. the norm is that as long as it looks good on confluence, it's the responsibility of the other skinners to deliver at least the same amount of space for labels.
Reply
#3
Thanks :-) At home I can check howmany chars (X) do fit into the dialog.
I guess that inserting \n after X chars on single string do not automatic shows the dialog
with two lines ....
Reply
#4
no, we do not autowrap those dialogs. one fix, which would make sense, is to have the dialog use a textbox instead of 3 separate label controls. that would remedy this, sorta. you'd at least get scroll bars if we overrun the label lengths that way.
Reply
#5
spiff Wrote:no, we do not autowrap those dialogs. one fix, which would make sense, is to have the dialog use a textbox instead of 3 separate label controls. that would remedy this, sorta. you'd at least get scroll bars if we overrun the label lengths that way.

I have found a easy solution to wordwrap the output to 2 lines ...

BTW : My info-box comes perfect with German strings that are a bit longer than the default strings.

Code:
#########################################################
# Function  : GUIInfo                                   #
#########################################################
# Parameter :                                           #
#                                                       #
# Selector    integer                                   #
#                                                       #
# 0           Info                                      #
# 1           Warning                                   #
# 2           Error                                     #
# 3           No text                                   #
#                                                       #
# Info        String to be shown inside Dialog-Box      #
#                                                       #
# Returns   : none                                      #
#########################################################
def GUIInfo(Selector,Info):

    global __linebreak__

    # Is the text that should be displayed shorter than __linebreak__ ?

    LenInfo = len(Info)

    if (LenInfo <= (__linebreak__ - 1)):

        # The text fit into a single line

        dialog = xbmcgui.Dialog()
        title = __language__(33214 + Selector)
        selected = dialog.ok(title,Info)

    else:

        # we need to split the single string into 2 lines ...

        line1 = ''
        line2 = ''

        for word in Info.split(' '):
            l1 = len(line1)
            l2 = len(word)
            if ((l1 + l2) <= (__linebreak__ - 1)):
                line1 = line1 + word + ' '
            else:    
                line2 = line2 + word + ''

        dialog = xbmcgui.Dialog()
        title = __language__(33214 + Selector)
        selected = dialog.ok(title,line1,line2)
  
    return 0

#########################################################
Reply

Logout Mark Read Team Forum Stats Members Help
Text Size and len of text for Info-Boxes0