Upload files to 'UI'

This commit is contained in:
Jeison Yehuda Amihud (Blender Dumbass) 2020-12-11 17:21:19 +00:00
parent d95cb88c50
commit 24dd5a50de

View file

@ -580,7 +580,8 @@ def scroll_area(layer, win, name, x, y, width, height, maxlength,
def text(outlayer, win, name, x, y, width, height, set_text="", parse=False, fill=True,
editable=True, multiline=False , linebreak=False, centered=False, tip=""):
editable=True, multiline=False , linebreak=False, centered=False, tip="",
offset=[0,0]):
# This function will handle all the text writting in the software.
# I'm not sure about how parsing going to work for script files later.
@ -676,10 +677,10 @@ def text(outlayer, win, name, x, y, width, height, set_text="", parse=False, fil
# Mouse select
if win.current["LMB"]:
if int(win.current["mx"]) in range(int(x), int(x+width))\
and int(win.current["my"]) in range(int(y), int(y+height)):
win.text[name]["cursor"][0] = int((win.current["LMB"][0]-x-offsetX)/12)
win.text[name]["cursor"][1] = int((win.current["mx"]-x-offsetX)/12)
if int(win.current["mx"]-offset[0]) in range(int(x), int(x+width))\
and int(win.current["my"]-offset[1]) in range(int(y), int(y+height)):
win.text[name]["cursor"][0] = int((win.current["LMB"][0]-x-offsetX-offset[0])/12)
win.text[name]["cursor"][1] = int((win.current["mx"]-x-offsetX-offset[0])/12)
# If second part of selection ends up bigger then the first. Reverse them.
if win.text[name]["cursor"][0] > win.text[name]["cursor"][1]:
@ -712,7 +713,8 @@ def text(outlayer, win, name, x, y, width, height, set_text="", parse=False, fil
# Let's filter the input first.
# For example
if not multiline: #Removing enter key press
if 65293 in win.current["keys"] or 65421 in win.current["keys"]:
if 65293 in win.current["keys"] or 65421 in win.current["keys"]\
or 65289 in win.current["keys"]: # TAB
win.current["key_letter"] = ""
@ -847,7 +849,8 @@ def text(outlayer, win, name, x, y, width, height, set_text="", parse=False, fil
10,
fill=False,
button=do,
tip=tip)
tip=tip,
offset=offset)
outlayer.stroke()
if win.textactive == name: