Example #1
0
def gui(): # drawing the screen

	global SCREEN, START_SCREEN, CONFIG_SCREEN, KEYMENUS, LABELS
	global BEVT_KEYMENU, BUT_KEYMENU, CFGKEY
	global BUT_TYPES, SCROLL_DOWN, VARS_NUM

	WIDTH, HEIGHT = Window.GetAreaSize()

	theme = Theme.Get()[0]
	tui = theme.get('ui')
	ttxt = theme.get('text')

	COL_BG = float_colors(ttxt.back)
	COL_TXT = ttxt.text
	COL_TXTHI = ttxt.text_hi

	BGL.glClearColor(COL_BG[0],COL_BG[1],COL_BG[2],COL_BG[3])
	BGL.glClear(BGL.GL_COLOR_BUFFER_BIT)
	BGL.glColor3ub(COL_TXT[0],COL_TXT[1], COL_TXT[2])

	if SCREEN == START_SCREEN:
		x = 10
		y = 10
		h = 20
		w = 90
		BGL.glRasterPos2i(x, y)
		Draw.Text('Select a configuration key to access it.  Press Q or ESC to leave.')
		km_len = len(KEYMENUS)
		km_columns = (WIDTH - x) / w
		if km_columns == 0: km_rows = km_len
		else:
			km_rows = km_len / km_columns
			if (km_len % km_columns): km_rows += 1
		if km_rows == 0: km_rows = 1
		ystart = y + 2*h*km_rows
		if ystart > (HEIGHT - 70): ystart = HEIGHT - 70
		y = ystart
		column = 1
		for i, km in enumerate(KEYMENUS):
			column += 1
			BGL.glRasterPos2i(x + 2, y + h + 5)
			Draw.Text(LABELS[i])
			BUT_KEYMENU[i] = Draw.Menu(km, BEVT_KEYMENU[i],
				x, y, w - 10, h, 0, 'Choose a key to access its configuration data')
			if column > km_columns:
				column = 1
				y -= 2*h
				if y < 35: break
				x = 10
			else: x += w
		x = 10
		y = 50 + ystart
		BGL.glColor3ub(COL_TXTHI[0], COL_TXTHI[1], COL_TXTHI[2])
		BGL.glRasterPos2i(x, y)
		Draw.Text('Scripts Configuration Editor')
		Draw.PushButton('help', BEVT_HELP, x, 22, 45, 16,
			'View help information about this script (hotkey: H)')

	elif SCREEN == CONFIG_SCREEN:
		x = y = 10
		h = 18
		data = CFGKEY.sorteddata
		tips = CFGKEY.tips
		fromdisk = CFGKEY.fromdisk
		limits = CFGKEY.limits
		VARS_NUM = 0
		for k in data.keys():
			VARS_NUM += len(data[k])
		lines = VARS_NUM + 5 # to account for header and footer
		y = lines*h
		if y > HEIGHT - 20: y = HEIGHT - 20
		BGL.glColor3ub(COL_TXTHI[0],COL_TXTHI[1], COL_TXTHI[2])
		BGL.glRasterPos2i(x, y)
		Draw.Text('Scripts Configuration Editor')
		y -= 20
		BGL.glColor3ub(COL_TXT[0],COL_TXT[1], COL_TXT[2])
		txtsize = 10
		if HEIGHT < lines*h:
			BGL.glRasterPos2i(10, 5)
			txtsize += Draw.Text('Arrow keys or mouse wheel to scroll, ')
		BGL.glRasterPos2i(txtsize, 5)
		Draw.Text('Q or ESC to return.')
		BGL.glRasterPos2i(x, y)
		Draw.Text('Key: "%s"' % CFGKEY.name)
		bh = 16
		bw = 45
		by = 16
		i = -1
		if CFGKEY.scriptname:
			i = 0
			Draw.PushButton('help', BEVT_HELP, x, by, bw, bh,
				'Show documentation for the script that owns this key (hotkey: H)')
		Draw.PushButton('back', BEVT_BACK, x + (1+i)*bw, by, bw, bh,
			'Back to config keys selection screen (hotkey: ESC)')
		Draw.PushButton('exit', BEVT_EXIT, x + (2+i)*bw, by, bw, bh,
			'Exit from Scripts Config Editor (hotkey: Q)')
		Draw.PushButton('revert', BEVT_CANCEL, x + (3+i)*bw, by, bw, bh,
			'Revert data to original values (hotkey: U)')
		Draw.PushButton('apply', BEVT_APPLY, x + (4+i)*bw, by, bw, bh,
			'Apply changes, if any (hotkey: ENTER)')
		delmsg = 'Delete this data key from memory'
		if fromdisk: delmsg = "%s and from disk" % delmsg
		Draw.PushButton('delete', BEVT_DEL, x + (5+i)*bw, by, bw, bh,
			'%s (hotkey: DELETE)' % delmsg)
		if fromdisk:
			Draw.Toggle("file", BEVT_DISK, x + 3 + (6+i)*bw, by, bw, bh, DISK_UPDATE,
				'Update also the file where this config key is stored')
		i = -1
		top = -1
		y -= 20
		yend = 30
		if data.has_key(bool) and y > 0:
			lst = data[bool]
			for l in lst:
				top += 1
				i += 1
				if top < SCROLL_DOWN: continue
				y -= h
				if y < yend: break
				w = 20
				tog = data[bool][i][1]
				if tips and tips.has_key(l[0]): tooltip = tips[l[0]]
				else: tooltip = "click to toggle"
				BUT_TYPES[bool][i] = Draw.Toggle("", BEVT_BOOL + i,
					x, y, w, h, tog, tooltip)
				BGL.glRasterPos2i(x + w + 3, y + 5)
				Draw.Text(l[0].lower().replace('_', ' '))
			i = -1
			y -= 5
		if data.has_key(int) and y > 0:
			lst = data[int]
			for l in lst:
				w = 70
				top += 1
				i += 1
				if top < SCROLL_DOWN: continue
				y -= h
				if y < yend: break
				val = data[int][i][1]
				if limits: min, max = limits[l[0]]
				else: min, max = 0, 10
				if tips and tips.has_key(l[0]): tooltip = tips[l[0]]
				else: tooltip = "click / drag to change"
				BUT_TYPES[int][i] = Draw.Number("", BEVT_INT + i,
					x, y, w, h, val, min, max, tooltip)
				BGL.glRasterPos2i(x + w + 3, y + 3)
				Draw.Text(l[0].lower().replace('_', ' '))
			i = -1
			y -= 5
		if data.has_key(float) and y > 0:
			lst = data[float]
			for l in lst:
				w = 70
				top += 1
				i += 1
				if top < SCROLL_DOWN: continue
				y -= h
				if y < yend: break
				val = data[float][i][1]
				if limits: min, max = limits[l[0]]
				else: min, max = 0.0, 1.0
				if tips and tips.has_key(l[0]): tooltip = tips[l[0]]
				else: tooltip = "click and drag to change"
				BUT_TYPES[float][i] = Draw.Number("", BEVT_FLOAT + i,
					x, y, w, h, val, min, max, tooltip)
				BGL.glRasterPos2i(x + w + 3, y + 3)
				Draw.Text(l[0].lower().replace('_', ' '))
			i = -1
			y -= 5
		if data.has_key(str) and y > 0:
			lst = data[str]
			for l in lst:
				top += 1
				i += 1
				if top < SCROLL_DOWN: continue
				y -= h
				if y < yend: break
				name = l[0].lower()
				is_dir = is_file = False
				if name.find('_dir', -4) > 0:	is_dir = True
				elif name.find('_file', -5) > 0: is_file = True
				w = WIDTH - 20
				wbrowse = 50
				if is_dir and w > wbrowse: w -= wbrowse
				if tips and tips.has_key(l[0]): tooltip = tips[l[0]]
				else: tooltip = "click to write a new string"
				name = name.replace('_',' ') + ': '
				if len(l[1]) > MAX_STR_LEN:
					l[1] = l[1][:MAX_STR_LEN]
				BUT_TYPES[str][i] = Draw.String(name, BEVT_STR + i,
					x, y, w, h, l[1], MAX_STR_LEN, tooltip)
				if is_dir:
					Draw.PushButton('browse', BEVT_BROWSEDIR + i, x+w+1, y, wbrowse, h,
						'click to open a file selector (pick any file in the desired dir)')
				elif is_file:
					Draw.PushButton('browse', BEVT_BROWSEFILE + i, x + w + 1, y, 50, h,
						'click to open a file selector')
Example #2
0
def gui():  # drawing the screen

    global SCREEN, START_SCREEN, CONFIG_SCREEN, KEYMENUS, LABELS
    global BEVT_KEYMENU, BUT_KEYMENU, CFGKEY
    global BUT_TYPES, SCROLL_DOWN, VARS_NUM

    WIDTH, HEIGHT = Window.GetAreaSize()

    theme = Theme.Get()[0]
    tui = theme.get('ui')
    ttxt = theme.get('text')

    COL_BG = float_colors(ttxt.back)
    COL_TXT = ttxt.text
    COL_TXTHI = ttxt.text_hi

    BGL.glClearColor(COL_BG[0], COL_BG[1], COL_BG[2], COL_BG[3])
    BGL.glClear(BGL.GL_COLOR_BUFFER_BIT)
    BGL.glColor3ub(COL_TXT[0], COL_TXT[1], COL_TXT[2])

    if SCREEN == START_SCREEN:
        x = 10
        y = 10
        h = 20
        w = 90
        BGL.glRasterPos2i(x, y)
        Draw.Text(
            'Select a configuration key to access it.  Press Q or ESC to leave.'
        )
        km_len = len(KEYMENUS)
        km_columns = (WIDTH - x) / w
        if km_columns == 0: km_rows = km_len
        else:
            km_rows = km_len / km_columns
            if (km_len % km_columns): km_rows += 1
        if km_rows == 0: km_rows = 1
        ystart = y + 2 * h * km_rows
        if ystart > (HEIGHT - 70): ystart = HEIGHT - 70
        y = ystart
        column = 1
        for i, km in enumerate(KEYMENUS):
            column += 1
            BGL.glRasterPos2i(x + 2, y + h + 5)
            Draw.Text(LABELS[i])
            BUT_KEYMENU[i] = Draw.Menu(
                km, BEVT_KEYMENU[i], x, y, w - 10, h, 0,
                'Choose a key to access its configuration data')
            if column > km_columns:
                column = 1
                y -= 2 * h
                if y < 35: break
                x = 10
            else:
                x += w
        x = 10
        y = 50 + ystart
        BGL.glColor3ub(COL_TXTHI[0], COL_TXTHI[1], COL_TXTHI[2])
        BGL.glRasterPos2i(x, y)
        Draw.Text('Scripts Configuration Editor')
        Draw.PushButton('help', BEVT_HELP, x, 22, 45, 16,
                        'View help information about this script (hotkey: H)')

    elif SCREEN == CONFIG_SCREEN:
        x = y = 10
        h = 18
        data = CFGKEY.sorteddata
        tips = CFGKEY.tips
        fromdisk = CFGKEY.fromdisk
        limits = CFGKEY.limits
        VARS_NUM = 0
        for k in data.keys():
            VARS_NUM += len(data[k])
        lines = VARS_NUM + 5  # to account for header and footer
        y = lines * h
        if y > HEIGHT - 20: y = HEIGHT - 20
        BGL.glColor3ub(COL_TXTHI[0], COL_TXTHI[1], COL_TXTHI[2])
        BGL.glRasterPos2i(x, y)
        Draw.Text('Scripts Configuration Editor')
        y -= 20
        BGL.glColor3ub(COL_TXT[0], COL_TXT[1], COL_TXT[2])
        txtsize = 10
        if HEIGHT < lines * h:
            BGL.glRasterPos2i(10, 5)
            txtsize += Draw.Text('Arrow keys or mouse wheel to scroll, ')
        BGL.glRasterPos2i(txtsize, 5)
        Draw.Text('Q or ESC to return.')
        BGL.glRasterPos2i(x, y)
        Draw.Text('Key: "%s"' % CFGKEY.name)
        bh = 16
        bw = 45
        by = 16
        i = -1
        if CFGKEY.scriptname:
            i = 0
            Draw.PushButton(
                'help', BEVT_HELP, x, by, bw, bh,
                'Show documentation for the script that owns this key (hotkey: H)'
            )
        Draw.PushButton('back', BEVT_BACK, x + (1 + i) * bw, by, bw, bh,
                        'Back to config keys selection screen (hotkey: ESC)')
        Draw.PushButton('exit', BEVT_EXIT, x + (2 + i) * bw, by, bw, bh,
                        'Exit from Scripts Config Editor (hotkey: Q)')
        Draw.PushButton('revert', BEVT_CANCEL, x + (3 + i) * bw, by, bw, bh,
                        'Revert data to original values (hotkey: U)')
        Draw.PushButton('apply', BEVT_APPLY, x + (4 + i) * bw, by, bw, bh,
                        'Apply changes, if any (hotkey: ENTER)')
        delmsg = 'Delete this data key from memory'
        if fromdisk: delmsg = "%s and from disk" % delmsg
        Draw.PushButton('delete', BEVT_DEL, x + (5 + i) * bw, by, bw, bh,
                        '%s (hotkey: DELETE)' % delmsg)
        if fromdisk:
            Draw.Toggle(
                "file", BEVT_DISK, x + 3 + (6 + i) * bw, by, bw, bh,
                DISK_UPDATE,
                'Update also the file where this config key is stored')
        i = -1
        top = -1
        y -= 20
        yend = 30
        if data.has_key(bool) and y > 0:
            lst = data[bool]
            for l in lst:
                top += 1
                i += 1
                if top < SCROLL_DOWN: continue
                y -= h
                if y < yend: break
                w = 20
                tog = data[bool][i][1]
                if tips and tips.has_key(l[0]): tooltip = tips[l[0]]
                else: tooltip = "click to toggle"
                BUT_TYPES[bool][i] = Draw.Toggle("", BEVT_BOOL + i, x, y, w, h,
                                                 tog, tooltip)
                BGL.glRasterPos2i(x + w + 3, y + 5)
                Draw.Text(l[0].lower().replace('_', ' '))
            i = -1
            y -= 5
        if data.has_key(int) and y > 0:
            lst = data[int]
            for l in lst:
                w = 70
                top += 1
                i += 1
                if top < SCROLL_DOWN: continue
                y -= h
                if y < yend: break
                val = data[int][i][1]
                if limits: min, max = limits[l[0]]
                else: min, max = 0, 10
                if tips and tips.has_key(l[0]): tooltip = tips[l[0]]
                else: tooltip = "click / drag to change"
                BUT_TYPES[int][i] = Draw.Number("", BEVT_INT + i, x, y, w, h,
                                                val, min, max, tooltip)
                BGL.glRasterPos2i(x + w + 3, y + 3)
                Draw.Text(l[0].lower().replace('_', ' '))
            i = -1
            y -= 5
        if data.has_key(float) and y > 0:
            lst = data[float]
            for l in lst:
                w = 70
                top += 1
                i += 1
                if top < SCROLL_DOWN: continue
                y -= h
                if y < yend: break
                val = data[float][i][1]
                if limits: min, max = limits[l[0]]
                else: min, max = 0.0, 1.0
                if tips and tips.has_key(l[0]): tooltip = tips[l[0]]
                else: tooltip = "click and drag to change"
                BUT_TYPES[float][i] = Draw.Number("", BEVT_FLOAT + i, x, y, w,
                                                  h, val, min, max, tooltip)
                BGL.glRasterPos2i(x + w + 3, y + 3)
                Draw.Text(l[0].lower().replace('_', ' '))
            i = -1
            y -= 5
        if data.has_key(str) and y > 0:
            lst = data[str]
            for l in lst:
                top += 1
                i += 1
                if top < SCROLL_DOWN: continue
                y -= h
                if y < yend: break
                name = l[0].lower()
                is_dir = is_file = False
                if name.find('_dir', -4) > 0: is_dir = True
                elif name.find('_file', -5) > 0: is_file = True
                w = WIDTH - 20
                wbrowse = 50
                if is_dir and w > wbrowse: w -= wbrowse
                if tips and tips.has_key(l[0]): tooltip = tips[l[0]]
                else: tooltip = "click to write a new string"
                name = name.replace('_', ' ') + ': '
                if len(l[1]) > MAX_STR_LEN:
                    l[1] = l[1][:MAX_STR_LEN]
                BUT_TYPES[str][i] = Draw.String(name, BEVT_STR + i, x, y, w, h,
                                                l[1], MAX_STR_LEN, tooltip)
                if is_dir:
                    Draw.PushButton(
                        'browse', BEVT_BROWSEDIR + i, x + w + 1, y, wbrowse, h,
                        'click to open a file selector (pick any file in the desired dir)'
                    )
                elif is_file:
                    Draw.PushButton('browse', BEVT_BROWSEFILE + i, x + w + 1,
                                    y, 50, h, 'click to open a file selector')
Example #3
0
def gui():  # drawing the screen

    global SCREEN, START_SCREEN, SCRIPT_SCREEN
    global SCRIPT_INFO, AllGroups, GROUP_MENUS
    global BEVT_EMAIL, BEVT_LINK
    global BEVT_VIEWSOURCE, BEVT_EXIT, BEVT_BACK, BEVT_GMENU, BUT_GMENU, BEVT_EXEC
    global PADDING, WIN_W, WIN_H, SCROLL_DOWN, COLUMNS, FMODE

    theme = Theme.Get()[0]
    tui = theme.get('ui')
    ttxt = theme.get('text')

    COL_BG = float_colors(ttxt.back)
    COL_TXT = ttxt.text
    COL_TXTHI = ttxt.text_hi

    BGL.glClearColor(COL_BG[0], COL_BG[1], COL_BG[2], COL_BG[3])
    BGL.glClear(BGL.GL_COLOR_BUFFER_BIT)
    BGL.glColor3ub(COL_TXT[0], COL_TXT[1], COL_TXT[2])

    resize = screen_was_resized()
    if resize: fit_on_screen()

    if SCREEN == START_SCREEN:
        x = PADDING
        bw = 85
        bh = 25
        hincr = 50

        butcolumns = (WIN_W - 2 * x) / bw
        if butcolumns < 2: butcolumns = 2
        elif butcolumns > 7: butcolumns = 7

        len_gm = len(GROUP_MENUS)
        butlines = len_gm / butcolumns
        if len_gm % butcolumns: butlines += 1

        h = hincr * butlines + 20
        y = h + bh

        BGL.glColor3ub(COL_TXTHI[0], COL_TXTHI[1], COL_TXTHI[2])
        BGL.glRasterPos2i(x, y)
        Draw.Text('Scripts Help Browser')

        y -= bh

        BGL.glColor3ub(COL_TXT[0], COL_TXT[1], COL_TXT[2])

        i = 0
        j = 0
        for group_menu in GROUP_MENUS:
            BGL.glRasterPos2i(x, y)
            Draw.Text(group_menu[0] + ':')
            BUT_GMENU[j] = Draw.Menu(
                group_menu[1], BEVT_GMENU[j], x, y - bh - 5, bw, bh, 0,
                'Choose a script to read its help information')
            if i == butcolumns - 1:
                x = PADDING
                i = 0
                y -= hincr
            else:
                i += 1
                x += bw + 3
            j += 1

        x = PADDING
        y = 10
        BGL.glRasterPos2i(x, y)
        Draw.Text('Select script for its help.  Press Q or ESC to leave.')

    elif SCREEN == SCRIPT_SCREEN:
        if SCRIPT_INFO:

            if resize:
                SCRIPT_INFO.wrap_lines(1)
                SCROLL_DOWN = 0

            h = 18 * SCRIPT_INFO.len_content + 12 * SCRIPT_INFO.spaces
            x = PADDING
            y = WIN_H
            bw = 38
            bh = 16

            BGL.glColor3ub(COL_TXTHI[0], COL_TXTHI[1], COL_TXTHI[2])
            for line in SCRIPT_INFO.header:
                y -= 18
                BGL.glRasterPos2i(x, y)
                size = Draw.Text(line)

            for line in text_wrap('Tooltip: %s' % SCRIPT_INFO.script.tip):
                y -= 18
                BGL.glRasterPos2i(x, y)
                size = Draw.Text(line)

            i = 0
            y -= 28
            for data in SCRIPT_INFO.d['__url__']:
                Draw.PushButton('link %d' % (i + 1), BEVT_LINK[i], x + i * bw,
                                y, bw, bh, data[0])
                i += 1
            y -= bh + 1

            i = 0
            for data in SCRIPT_INFO.d['__email__']:
                Draw.PushButton('email', BEVT_EMAIL[i], x + i * bw, y, bw, bh,
                                data[0])
                i += 1
            y -= 18

            y0 = y
            BGL.glColor3ub(COL_TXT[0], COL_TXT[1], COL_TXT[2])
            for line in SCRIPT_INFO.content[SCROLL_DOWN:]:
                if line:
                    line = line.replace('<br>', '')
                    BGL.glRasterPos2i(x, y)
                    Draw.Text(line)
                    y -= 18
                else:
                    y -= 12
                if y < PADDING + 20:  # reached end, either stop or go to 2nd column
                    if COLUMNS == 1: break
                    elif x == PADDING:  # make sure we're still in column 1
                        x = 6 * TEXT_WRAP + PADDING / 2
                        y = y0

            x = PADDING
            Draw.PushButton(
                'source', BEVT_VIEWSOURCE, x, 17, 45, bh,
                'View this script\'s source code in the Text Editor (hotkey: S)'
            )
            Draw.PushButton('exit', BEVT_EXIT, x + 45, 17, 45, bh,
                            'Exit from Scripts Help Browser (hotkey: Q)')
            if not FMODE:
                Draw.PushButton(
                    'back', BEVT_BACK, x + 2 * 45, 17, 45, bh,
                    'Back to scripts selection screen (hotkey: ESC)')
                Draw.PushButton('run script', BEVT_EXEC, x + 3 * 45, 17, 60,
                                bh, 'Run this script')

            BGL.glColor3ub(COL_TXTHI[0], COL_TXTHI[1], COL_TXTHI[2])
            BGL.glRasterPos2i(x, 5)
            Draw.Text('use the arrow keys or the mouse wheel to scroll text',
                      'small')
Example #4
0
def gui(): # drawing the screen

	global SCREEN, START_SCREEN, SCRIPT_SCREEN
	global SCRIPT_INFO, AllGroups, GROUP_MENUS
	global BEVT_EMAIL, BEVT_LINK
	global BEVT_VIEWSOURCE, BEVT_EXIT, BEVT_BACK, BEVT_GMENU, BUT_GMENU, BEVT_EXEC
	global PADDING, WIN_W, WIN_H, SCROLL_DOWN, COLUMNS, FMODE

	theme = Theme.Get()[0]
	tui = theme.get('ui')
	ttxt = theme.get('text')

	COL_BG = float_colors(ttxt.back)
	COL_TXT = ttxt.text
	COL_TXTHI = ttxt.text_hi

	BGL.glClearColor(COL_BG[0],COL_BG[1],COL_BG[2],COL_BG[3])
	BGL.glClear(BGL.GL_COLOR_BUFFER_BIT)
	BGL.glColor3ub(COL_TXT[0],COL_TXT[1], COL_TXT[2])

	resize = screen_was_resized()
	if resize: fit_on_screen()

	if SCREEN == START_SCREEN:
		x = PADDING
		bw = 85
		bh = 25
		hincr = 50

		butcolumns = (WIN_W - 2*x)/ bw
		if butcolumns < 2: butcolumns = 2
		elif butcolumns > 7: butcolumns = 7

		len_gm = len(GROUP_MENUS)
		butlines = len_gm / butcolumns
		if len_gm % butcolumns: butlines += 1

		h = hincr * butlines + 20
		y = h + bh

		BGL.glColor3ub(COL_TXTHI[0],COL_TXTHI[1], COL_TXTHI[2])
		BGL.glRasterPos2i(x, y)
		Draw.Text('Scripts Help Browser')

		y -= bh

		BGL.glColor3ub(COL_TXT[0],COL_TXT[1], COL_TXT[2])

		i = 0
		j = 0
		for group_menu in GROUP_MENUS:
			BGL.glRasterPos2i(x, y)
			Draw.Text(group_menu[0]+':')
			BUT_GMENU[j] = Draw.Menu(group_menu[1], BEVT_GMENU[j],
				x, y-bh-5, bw, bh, 0,
				'Choose a script to read its help information')
			if i == butcolumns - 1:
				x = PADDING
				i = 0
				y -= hincr
			else:
				i += 1
				x += bw + 3
			j += 1

		x = PADDING
		y = 10
		BGL.glRasterPos2i(x, y)
		Draw.Text('Select script for its help.  Press Q or ESC to leave.')

	elif SCREEN == SCRIPT_SCREEN:
		if SCRIPT_INFO:

			if resize:
				SCRIPT_INFO.wrap_lines(1)
				SCROLL_DOWN = 0

			h = 18 * SCRIPT_INFO.len_content + 12 * SCRIPT_INFO.spaces
			x = PADDING
			y = WIN_H
			bw = 38
			bh = 16

			BGL.glColor3ub(COL_TXTHI[0],COL_TXTHI[1], COL_TXTHI[2])
			for line in SCRIPT_INFO.header:
				y -= 18
				BGL.glRasterPos2i(x, y)
				size = Draw.Text(line)

			for line in text_wrap('Tooltip: %s' % SCRIPT_INFO.script.tip):
				y -= 18
				BGL.glRasterPos2i(x, y)
				size = Draw.Text(line)

			i = 0
			y -= 28
			for data in SCRIPT_INFO.d['__url__']:
				Draw.PushButton('link %d' % (i + 1), BEVT_LINK[i],
					x + i*bw, y, bw, bh, data[0])
				i += 1
			y -= bh + 1

			i = 0
			for data in SCRIPT_INFO.d['__email__']:
				Draw.PushButton('email', BEVT_EMAIL[i], x + i*bw, y, bw, bh, data[0])
				i += 1
			y -= 18

			y0 = y
			BGL.glColor3ub(COL_TXT[0],COL_TXT[1], COL_TXT[2])
			for line in SCRIPT_INFO.content[SCROLL_DOWN:]:
				if line:
					line = line.replace('<br>', '')
					BGL.glRasterPos2i(x, y)
					Draw.Text(line)
					y -= 18
				else: y -= 12
				if y < PADDING + 20: # reached end, either stop or go to 2nd column
					if COLUMNS == 1: break
					elif x == PADDING: # make sure we're still in column 1
						x = 6*TEXT_WRAP + PADDING / 2
						y = y0

			x = PADDING
			Draw.PushButton('source', BEVT_VIEWSOURCE, x, 17, 45, bh,
				'View this script\'s source code in the Text Editor (hotkey: S)')
			Draw.PushButton('exit', BEVT_EXIT, x + 45, 17, 45, bh,
				'Exit from Scripts Help Browser (hotkey: Q)')
			if not FMODE: 
				Draw.PushButton('back', BEVT_BACK, x + 2*45, 17, 45, bh,
				'Back to scripts selection screen (hotkey: ESC)')
				Draw.PushButton('run script', BEVT_EXEC, x + 3*45, 17, 60, bh, 'Run this script')

			BGL.glColor3ub(COL_TXTHI[0],COL_TXTHI[1], COL_TXTHI[2])
			BGL.glRasterPos2i(x, 5)
			Draw.Text('use the arrow keys or the mouse wheel to scroll text', 'small')