Word-wrap help text in addon prefs

This commit is contained in:
Sybren A. Stüvel 2016-05-03 18:29:43 +02:00
parent 0ccd5cbf97
commit 58bae5b3a0

View File

@ -41,6 +41,8 @@ class BlenderCloudPreferences(AddonPreferences):
default='//textures') default='//textures')
def draw(self, context): def draw(self, context):
import textwrap
layout = self.layout layout = self.layout
# Carefully try and import the Blender ID addon # Carefully try and import the Blender ID addon
@ -53,28 +55,31 @@ class BlenderCloudPreferences(AddonPreferences):
blender_id_profile = blender_id.get_active_profile() blender_id_profile = blender_id.get_active_profile()
if blender_id is None: if blender_id is None:
blender_id_icon = 'ERROR' icon = 'ERROR'
blender_id_text = 'This add-on requires Blender ID' text = 'This add-on requires Blender ID'
blender_id_help = 'Make sure that the Blender ID add-on is installed and activated' help_text = 'Make sure that the Blender ID add-on is installed and activated'
elif not blender_id_profile: elif not blender_id_profile:
blender_id_icon = 'ERROR' icon = 'ERROR'
blender_id_text = 'You are logged out.' text = 'You are logged out.'
blender_id_help = 'To login, go to the Blender ID add-on preferences.' help_text = 'To login, go to the Blender ID add-on preferences.'
elif not pillar.SUBCLIENT_ID in blender_id_profile.subclients: elif pillar.SUBCLIENT_ID not in blender_id_profile.subclients:
blender_id_icon = 'QUESTION' icon = 'QUESTION'
blender_id_text = 'No Blender Cloud credentials.' text = 'No Blender Cloud credentials.'
blender_id_help = ('You are logged in on Blender ID, but your credentials have not ' help_text = ('You are logged in on Blender ID, but your credentials have not '
'been synchronized with Blender Cloud yet. Press the Update ' 'been synchronized with Blender Cloud yet. Press the Update '
'Credentials button.') 'Credentials button.')
else: else:
blender_id_icon = 'WORLD_DATA' icon = 'WORLD_DATA'
blender_id_text = 'You are logged in as %s.' % blender_id_profile.username text = 'You are logged in as %s.' % blender_id_profile.username
blender_id_help = ('To logout or change profile, ' help_text = ('To logout or change profile, '
'go to the Blender ID add-on preferences.') 'go to the Blender ID add-on preferences.')
sub = layout.column() sub = layout.column(align=True)
sub.label(text=blender_id_text, icon=blender_id_icon) sub.label(text=text, icon=icon)
sub.label(text="* " + blender_id_help)
help_lines = textwrap.wrap(help_text, 80)
for line in help_lines:
sub.label(text=line)
sub = layout.column() sub = layout.column()
sub.label(text='Local directory for downloaded textures') sub.label(text='Local directory for downloaded textures')
@ -83,7 +88,7 @@ class BlenderCloudPreferences(AddonPreferences):
# options for Pillar # options for Pillar
sub = layout.column() sub = layout.column()
sub.enabled = blender_id_icon != 'ERROR' sub.enabled = icon != 'ERROR'
# TODO: let users easily pick a project. For now, we just use the # TODO: let users easily pick a project. For now, we just use the
# hard-coded server URL and UUID of the textures project. # hard-coded server URL and UUID of the textures project.