1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264 |
- import os
- import cairo
- try:
- from gi.repository import Gtk
- from gi.repository import Gdk
- except:
- pass
- from UI import UI_elements
- from UI import UI_color
- from settings import talk
- from studio import analytics
- from studio import history
- def get_list(filepath):
-
-
-
-
-
-
-
-
- checklist = {
- "fraction":0.0,
- "string":filepath,
- "editing":False,
- "selected":False,
- "open":True,
- "subtasks":[]
- }
-
-
- data = open(filepath)
- data = data.read()
- data = data.split("\n")
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- cleandata = []
-
- for line in data:
-
-
- tmp = line
- while tmp.startswith(" "):
- tmp = tmp[1:]
-
-
- if tmp.startswith("[ ]") or tmp.startswith("[V]"):
- cleandata.append(line)
-
-
-
-
-
-
-
-
-
-
- def convert(part, indent=0):
-
-
-
-
- subtask = []
-
- for num, line in enumerate(part):
-
-
-
-
-
- if line[indent:].startswith("["):
-
- thisline = {
- "fraction":0.0,
- "string":line[line.find("]")+2:],
- "editing":False,
- "selected":False,
- "open":False,
- "subtasks":[]
- }
-
- try:
- nextline = part[num+1]
- except:
- nextline = ""
-
- if not line[line.find("]")+1] == ".":
- thisline["open"] = True
-
- if nextline.find("[")-1 <= indent:
- if line[indent:].startswith("[V]"):
- thisline["fraction"] = 1.0
-
- else:
- subpart = []
- subdent = indent
- for n, l in enumerate(part[num+1:]):
- if n == 0:
- subdent = l.find("[")
-
- if l.find("[")-1 <= indent:
- break
-
- else:
- subpart.append(l)
-
-
- thisline["subtasks"] = convert(subpart, subdent)
-
- fracs = []
- for task in thisline["subtasks"]:
- if not task["string"].startswith("#"):
- fracs.append(task["fraction"])
-
- try:
- thisline["fraction"] = sum(fracs) / len(fracs)
- except:
- thisline["fraction"] = 0.0
-
-
- if thisline["fraction"] == 0.9999:
- thisline["fraction"] = 1.0
-
-
- subtask.append(thisline)
-
- return subtask
-
-
- checklist["subtasks"] = convert(cleandata)
- fracs = []
- for task in checklist["subtasks"]:
- if not task["string"].startswith("#"):
- fracs.append(task["fraction"])
-
- try:
- checklist["fraction"] = sum(fracs) / len(fracs)
- except:
- checklist["fraction"] = 0.0
-
-
- if checklist["fraction"] == 0.9999:
- checklist["fraction"] = 1.0
-
-
- return checklist
- def get_fraction(win, path):
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if path not in win.checklists:
-
-
-
- if os.path.exists(win.project+"/"+path):
- win.checklists[path] = get_list(win.project+"/"+path)
- else:
- win.checklists[path] = get_list(path)
-
-
-
-
- return win.checklists[path]["fraction"]
- def get_task_by_path(tasks, path, p=[]):
-
-
-
-
-
-
-
-
-
-
-
- for task in tasks:
-
- pa = p.copy()
- pa.append(" "+task["string"])
-
-
- if pa == path:
- return task
-
- if task["subtasks"]:
- t = get_task_by_path(task["subtasks"], path, pa)
- if t:
- return t
-
- return False
-
- def filter_tasks(data):
-
-
-
-
-
-
-
-
-
-
- data["selected"] = False
- data["editing"] = False
-
- if data["subtasks"]:
- for i in data["subtasks"]:
- filter_tasks(i)
-
-
- def save(path, data):
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- indent = [0]
-
- lines = []
-
- def writetasks(tasks):
-
- for task in tasks:
- if task["fraction"] and not task["subtasks"]:
- v = "[V]"
- else:
- v = "[ ]"
-
- if task["open"]:
- o = " "
- else:
- o = "."
-
- lines.append(" "*indent[0]+v+o+task["string"])
-
- if task["subtasks"]:
- indent[0] = indent[0] + 4
- writetasks(task["subtasks"])
- indent[0] = indent[0] - 4
-
- writetasks(data["subtasks"])
- if path:
-
- w = open(path, "w")
-
- for i in lines:
- w.write(i+"\n")
-
- w.close()
- ret = ""
- for i in lines:
- ret = ret+"\n"+i
- ret = ret[1:]
- return ret
-
- def draw(outlayer, win, path, back="story_editor"):
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if path not in win.checklists:
-
-
-
- if os.path.exists(win.project+"/"+path):
- win.checklists[path] = get_list(win.project+"/"+path)
- elif os.path.exists(win.project+"/rnd"+path):
- win.checklists[path] = get_list(win.project+"/rnd"+path)
- else:
- win.checklists[path] = get_list(path)
-
-
- x = win.current["w"] / 4 * 3 + 10
- y = 10
- width = win.current["w"] / 4 - 20
- height = win.current["h"] - 20
-
-
-
-
- surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, int(width), int(height))
- layer = cairo.Context(surface)
- layer.select_font_face("Monospace", cairo.FONT_SLANT_NORMAL, cairo.FONT_WEIGHT_NORMAL)
-
-
- UI_elements.roundrect(layer, win,
- 0,
- 0,
- width,
- height,
- 10,
- fill=False)
- layer.clip()
-
-
-
-
- UI_color.set(layer, win, "node_background")
- UI_elements.roundrect(layer, win,
- 0,
- 0,
- width,
- 50,
- 10)
-
- UI_elements.image(layer, win,
- "settings/themes/"+win.settings["Theme"]+"/icons/checklist.png",
- 5, 5, 40, 40)
-
- if win.url != "analytics":
- reducing = 60
- def do():
- win.cur = "/set"
- win.url = "analytics"
- UI_elements.roundrect(layer, win,
- width - 55,
- 5,
- 40,
- 40,
- 10,
- do,
- offset=[x,y],
- icon="analytics")
- else:
- reducing = 0
-
-
- fraction = win.checklists[path]["fraction"]
-
- UI_color.set(layer, win, "progress_background")
- UI_elements.roundrect(layer, win,
- 50,
- 17,
- width - 60 -reducing,
- 0,
- 7)
-
- UI_color.set(layer, win, "progress_active")
- UI_elements.roundrect(layer, win,
- 50,
- 17,
- (width - 60 -reducing)*fraction,
- 0,
- 7)
-
-
- UI_elements.roundrect(layer, win,
- 0,
- 60,
- width,
- height,
- 10,
- fill=False)
- layer.clip()
-
-
-
-
-
-
-
-
- tileX = 0
- current_Y = 70
-
-
-
-
- cXY = [tileX, current_Y]
-
- if "checklist" not in win.scroll:
- win.scroll["checklist"] = 0
-
- if "moving_task_now" not in win.current:
- win.current["moving_task_now"] = False
-
- def draw_tasks(tasks, cXY, schedulep):
-
-
-
-
-
-
-
-
-
-
-
-
-
- for num , task in enumerate(tasks):
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- schedulepath = schedulep.copy()
- schedulepath.append(" "+task["string"])
-
-
-
-
-
-
- if "schedule_task_selected" not in win.current:
- win.current["schedule_task_selected"] = False
-
- if win.current["schedule_task_selected"] and win.cur == win.current["schedule_task_selected"][-1]\
- or win.current["schedule_task_selected"] and win.cur == "/set" and win.current["schedule_task_selected"][-1] == "":
- csl = win.current["schedule_task_selected"][0][0][4]
-
-
- if " "+task["string"] in csl and not task["open"]:
- task["open"] = True
-
- if schedulepath == csl and not task["selected"]:
- filter_tasks(win.checklists[path])
- task["selected"] = True
- win.scroll["checklist"] = 0 - cXY[1] + height/2
-
-
-
-
-
-
-
-
- if 65535 in win.current["keys"] and task["selected"] and not win.current["schedule_task_selected"]:
- del tasks[num]
- win.current["keys"] = []
-
-
- save(path, win.checklists[path])
- win.checklists = {}
- win.assets = {}
- win.analytics = analytics.load(win.project)
- win.multiuser["last_request"] = ""
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- sx = cXY[0]
- sy = win.scroll["checklist"] + cXY[1]
-
- grabY = 40
- if task["subtasks"]:
- grabY = 60
-
-
- if win.current["LMB"]\
- and int(win.current["LMB"][0]) in range(int(x+sx), int(x+sx+width))\
- and int(win.current["LMB"][1]) in range(int(y+sy), int(y+sy+grabY))\
- and win.current["tool"] == "selection"\
- and int(win.current["LMB"][0]) not in range(int(win.current["mx"]-2), int(win.current["mx"]+2))\
- and int(win.current["LMB"][1]) not in range(int(win.current["my"]-2), int(win.current["my"]+2)):
-
-
-
-
-
-
-
-
-
-
- filter_tasks(win.checklists[path])
- task["selected"] = True
- win.current["schedule_task_selected"] = False
-
- win.current["tool"] = "grab"
- win.current["moving_task_now"] = False
-
-
-
-
- if not win.current["LMB"] and win.previous["LMB"] and win.current["tool"] == "grab"\
- and task["selected"]:
-
-
-
-
- win.current["moving_task_now"] = [tasks.pop(num), win.current["frame"]]
-
-
-
-
-
- thismoving = False
-
- somemoving = False
- someXY = [0,0]
-
-
-
-
-
- if win.current["tool"] == "grab":
-
-
-
-
- somemoving = True
- someXY = [
- win.current["mx"]-x,
- win.current["my"]-y
- ]
-
-
-
-
- if task["selected"]:
-
-
-
-
- sx = win.current["mx"] - x - (width - cXY[0])/2
- sy = win.current["my"] - y - 10
- task["open"] = False
- thismoving = True
- somemoving = False
-
-
-
-
-
-
-
-
- if win.current["mx"] < x:
- win.url = "analytics"
- win.current["grab_data"] = [path, back, win.cur, schedulepath, win.settings["Username"]]
- win.current["tool"] = "schedule"
-
-
-
-
-
-
-
-
-
- elif win.current["tool"] == "schedule" and win.current["mx"] > x:
- win.url = back
- win.current["tool"] = "grab"
-
-
-
-
-
-
- inside = False
- between = False
-
- if sy-10 < someXY[1] < sy+10 and somemoving and not task["selected"]:
-
- if win.current["moving_task_now"] and win.current["moving_task_now"][1] != win.current["frame"]:
- tasks.insert(num, win.current["moving_task_now"][0])
- win.current["tool"] = "selection"
- win.current["LMB"] = False
- win.previous["LMB"] = False
-
-
- save(path, win.checklists[path])
- win.checklists = {}
- win.assets = {}
- win.analytics = analytics.load(win.project)
- win.multiuser["last_request"] = ""
-
- elif win.current["LMB"]:
-
- for line in range(int(cXY[0]/20)):
-
- line = line * 20 + 10
-
- UI_color.set(layer, win, "node_background")
- layer.move_to(line, win.scroll["checklist"] + cXY[1]-10)
- layer.line_to(line, win.scroll["checklist"] + cXY[1]+40)
- layer.stroke()
-
- cXY[1] = cXY[1] + 50
-
- sx = cXY[0]
- sy = win.scroll["checklist"] + cXY[1]
-
- between = True
- somemoving = False
-
- elif sy < someXY[1] < sy + 40 and somemoving and not task["selected"]:
-
- if win.current["moving_task_now"] and win.current["moving_task_now"][1] != win.current["frame"]:
- task["subtasks"].append(win.current["moving_task_now"][0])
- win.current["tool"] = "selection"
- win.current["LMB"] = False
- win.previous["LMB"] = False
-
-
- save(path, win.checklists[path])
- win.checklists = {}
- win.assets = {}
- win.analytics = analytics.load(win.project)
- win.multiuser["last_request"] = ""
-
- elif win.current["LMB"]:
- inside = True
-
-
- if win.textactive != "editing_task" and win.current["tool"] == "selection":
- def do():
- ed = task["selected"] and not task["editing"]
- filter_tasks(win.checklists[path])
- win.current["schedule_task_selected"] = False
- task["selected"] = True
- if ed:
- task["editing"] = True
- UI_elements.roundrect(layer, win,
- sx+40,
- sy,
- width - cXY[0]-40,
- grabY,
- 10,
- button=do,
- offset=[x,y],
- fill=False)
- layer.stroke()
-
-
- if not task["subtasks"]:
- UI_color.set(layer, win, "node_background")
- if task["string"].startswith("#"):
- UI_color.set(layer, win, "dark_overdrop")
- UI_elements.roundrect(layer, win,
- sx,
- sy,
- width - cXY[0],
- 40,
- 10)
-
- if inside:
- UI_color.set(layer, win, "progress_background")
- UI_elements.roundrect(layer, win,
- sx,
- sy,
- width - cXY[0],
- 40,
- 10,
- fill=False)
- layer.stroke()
-
- if task["selected"]:
- UI_color.set(layer, win, "text_normal")
- UI_elements.roundrect(layer, win,
- sx,
- sy,
- width - cXY[0],
- 40,
- 10,
- fill=False)
- layer.stroke()
-
-
- for line in range(int(cXY[0]/20)):
-
- line = line * 20 + 10
-
- UI_color.set(layer, win, "node_background")
- layer.move_to(line, win.scroll["checklist"] + cXY[1]-10)
- layer.line_to(line, win.scroll["checklist"] + cXY[1]+40)
- layer.stroke()
-
- if not task["string"].startswith("#"):
- if task["fraction"]:
- im = "checked"
- else:
- im = "unchecked"
-
-
-
- def do():
- if task["fraction"]:
- task["fraction"] = 0.0
- history.record(win, path, "[Un-Checked]", schedulepath)
- win.textactive = ""
- try: del win.text["editing_task"]
- except: pass
- else:
- task["fraction"] = 1.0
- history.record(win, path, "[Checked]", schedulepath)
- win.textactive = ""
- try: del win.text["editing_task"]
- except: pass
-
-
- save(path, win.checklists[path])
- win.checklists = {}
- win.assets = {}
- win.multiuser["last_request"] = ""
- win.analytics = analytics.load(win.project)
-
- UI_elements.roundrect(layer, win,
- sx,
- sy,
- 40,
- 40,
- 10,
- button=do,
- icon=im,
- offset=[x,y])
-
-
- else:
- UI_color.set(layer, win, "node_background")
- if task["string"].startswith("#"):
- UI_color.set(layer, win, "dark_overdrop")
- UI_elements.roundrect(layer, win,
- sx,
- sy,
- width - cXY[0],
- 60,
- 10)
-
- if inside:
- UI_color.set(layer, win, "progress_background")
- UI_elements.roundrect(layer, win,
- sx,
- sy,
- width - cXY[0],
- 60,
- 10,
- fill=False)
- layer.stroke()
-
-
- if task["selected"]:
- UI_color.set(layer, win, "text_normal")
- UI_elements.roundrect(layer, win,
- sx,
- sy,
- width - cXY[0],
- 60,
- 10,
- fill=False)
- layer.stroke()
-
-
-
- for line in range(int(cXY[0]/20)):
-
- line = line * 20 + 10
-
- UI_color.set(layer, win, "node_background")
- layer.move_to(line, win.scroll["checklist"] + cXY[1]-10)
- layer.line_to(line, win.scroll["checklist"] + cXY[1]+60)
- layer.stroke()
-
-
- if not task["string"].startswith("#"):
- fraction = task["fraction"]
-
- UI_color.set(layer, win, "progress_background")
- UI_elements.roundrect(layer, win,
- sx+10,
- sy+45,
- width-20 - cXY[0],
- 0,
- 5)
-
- UI_color.set(layer, win, "progress_active")
- UI_elements.roundrect(layer, win,
- sx+10,
- sy+45,
- (width -20 - cXY[0])*fraction,
- 0,
- 5)
-
- if task["open"]:
- im = "open"
- else:
- im = "closed"
-
- def do():
- task["open"] = not task["open"]
- win.current["schedule_task_selected"] = False
-
- save(path, win.checklists[path])
- win.multiuser["last_request"] = ""
-
- UI_elements.roundrect(layer, win,
- sx,
- sy,
- 40,
- 60,
- 10,
- button=do,
- icon=im,
- offset=[x,y])
-
-
-
-
-
-
-
- if 65307 in win.current["keys"] and task["editing"]:
-
-
-
- win.textactive = ""
- task["editing"] = False
- del win.text["editing_task"]
- win.current["keys"] = []
-
-
- save(path, win.checklists[path])
- win.checklists = {}
- win.assets = {}
- win.analytics = analytics.load(win.project)
- win.multiuser["last_request"] = ""
-
- if not task["editing"]:
- layer.set_font_size(20)
- layer.move_to(
- sx+50,
- sy+25
- )
- if task["string"].startswith("#"):
- UI_color.set(layer, win, "progress_background")
- if not task["subtasks"]:
- layer.move_to(
- sx+10,
- sy+25
- )
- layer.show_text(task["string"][1:])
- else:
- UI_color.set(layer, win, "text_normal")
- layer.show_text(task["string"])
- else:
-
-
- UI_elements.text(layer, win, "editing_task",
- sx+39,
- sy,
- width - cXY[0] - 40,
- 40,
- set_text=task["string"],
- offset=[x,y])
-
- win.textactive = "editing_task"
-
-
-
-
- def do():
- task["string"] = win.text["editing_task"]["text"]
- win.textactive = ""
- filter_tasks(win.checklists[path])
- del win.text["editing_task"]
-
-
- save(path, win.checklists[path])
- win.multiuser["last_request"] = ""
-
- def button():
- do()
- win.checklists = {}
- win.assets = {}
-
- UI_elements.roundrect(layer, win,
- sx+39 + width - cXY[0] - 80,
- sy,
- 40,
- 40,
- 10,
- button=button,
- icon="ok",
- tip=talk.text("checked"),
- offset=[x,y])
-
-
- if 65293 in win.current["keys"]:
- button()
- win.current["keys"] = []
-
-
-
- if 65289 in win.current["keys"]:
- do()
- tasks.append(
- {
- "fraction":0.0,
- "string":"",
- "editing":True,
- "selected":True,
- "open":False,
- "subtasks":[]
- }
- )
- win.current["keys"] = []
-
-
- if not thismoving:
- if not task["subtasks"]:
- cXY[1] = cXY[1] + 50
- else:
- cXY[1] = cXY[1] + 70
-
- cXY[0] = cXY[0] + 20
-
-
-
- if task["open"]:
- draw_tasks(task["subtasks"], cXY, schedulepath)
-
- cXY[0] = cXY[0] - 20
-
-
-
- if ((task["subtasks"] and task["open"] and task["selected"])\
- or (task["selected"] and not task["subtasks"]))\
- and win.textactive != "editing_task"\
- and win.current["tool"] == "selection":
-
- cXY[0] = cXY[0] + 20
-
- def do():
- task["open"] = True
- filter_tasks(win.checklists[path])
- task["subtasks"].append(
- {
- "fraction":0.0,
- "string":"",
- "editing":True,
- "selected":True,
- "open":False,
- "subtasks":[]
- }
- )
-
-
- UI_elements.roundrect(layer, win,
- cXY[0],
- win.scroll["checklist"] + cXY[1],
- width - cXY[0],
- 40,
- 10,
- button=do,
- icon="new",
- offset=[x,y])
-
- UI_color.set(layer, win, "progress_background")
- UI_elements.roundrect(layer, win,
- cXY[0],
- win.scroll["checklist"] + cXY[1],
- width - cXY[0],
- 40,
- 10,
- fill=False)
- layer.stroke()
-
- layer.set_font_size(20)
- layer.move_to(
- cXY[0]+50,
- win.scroll["checklist"] + cXY[1]+25
- )
- layer.show_text(talk.text("add_new_subtask"))
-
- for line in range(int(cXY[0]/20)):
-
- line = line * 20 + 10
-
- UI_color.set(layer, win, "node_background")
- layer.move_to(line, win.scroll["checklist"] + cXY[1]-10)
- layer.line_to(line, win.scroll["checklist"] + cXY[1]+40)
- layer.stroke()
-
-
- cXY[0] = cXY[0] - 20
- cXY[1] = cXY[1] + 50
-
- schedulepath = []
- draw_tasks(win.checklists[path]["subtasks"], cXY, schedulepath)
-
-
-
- if win.current["tool"] == "grab"\
- and win.current["my"] - y > win.scroll["checklist"] + cXY[1]:
-
- if win.current["moving_task_now"] and win.current["moving_task_now"][1] != win.current["frame"]:
- win.checklists[path]["subtasks"].append(win.current["moving_task_now"][0])
- win.current["tool"] = "selection"
- win.current["LMB"] = False
- win.previous["LMB"] = False
-
-
- save(path, win.checklists[path])
- win.checklists = {}
- win.assets = {}
- win.analytics = analytics.load(win.project)
- win.multiuser["last_request"] = ""
-
-
-
-
- if win.textactive != "editing_task"\
- and win.current["tool"] == "selection":
- def do():
- filter_tasks(win.checklists[path])
- win.checklists[path]["subtasks"].append(
- {
- "fraction":0.0,
- "string":"",
- "editing":True,
- "selected":True,
- "open":False,
- "subtasks":[]
- }
- )
-
- UI_elements.roundrect(layer, win,
- cXY[0],
- win.scroll["checklist"] + cXY[1],
- width - cXY[0],
- 40,
- 10,
- button=do,
- icon="new",
- offset=[x,y])
-
- UI_color.set(layer, win, "progress_background")
- UI_elements.roundrect(layer, win,
- cXY[0],
- win.scroll["checklist"] + cXY[1],
- width - cXY[0],
- 40,
- 10,
- fill=False)
- layer.stroke()
-
- layer.set_font_size(20)
- layer.move_to(
- cXY[0]+50,
- win.scroll["checklist"] + cXY[1]+25
- )
- layer.show_text(talk.text("add_new_task"))
- cXY[1] = cXY[1] + 100
- def do():
- raw = save(False, win.checklists[path])
- clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
- clipboard.set_text( raw , -1)
-
- UI_elements.roundrect(layer, win,
- cXY[0],
- win.scroll["checklist"] + cXY[1],
- width - cXY[0],
- 40,
- 10,
- button=do,
- icon="copy_file",
- offset=[x,y])
-
- UI_color.set(layer, win, "progress_background")
- UI_elements.roundrect(layer, win,
- cXY[0],
- win.scroll["checklist"] + cXY[1],
- width - cXY[0],
- 40,
- 10,
- fill=False)
- layer.stroke()
-
- layer.set_font_size(20)
- layer.move_to(
- cXY[0]+50,
- win.scroll["checklist"] + cXY[1]+25
- )
- layer.show_text(talk.text("copy_checklist_to_clipboard"))
- cXY[1] = cXY[1] + 50
-
- def do():
- clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
- cliptext = str(clipboard.wait_for_text())
- savetext = ""
- for i in cliptext.split("\n"):
- if "[ ]" in i or "[V]" in i or "[v]" in i:
- savetext = savetext + "\n"+i.replace("[V]", "[ ]").replace("[v]", "[ ]")
- else:
- savetext = savetext + "\n[ ] #"+i
- cliptext = savetext[1:]
-
-
- s = open(path, 'ab')
- s.write(cliptext.encode("utf-8"))
- s.close()
- win.checklists[path] = get_list(path)
-
-
- UI_elements.roundrect(layer, win,
- cXY[0],
- win.scroll["checklist"] + cXY[1],
- width - cXY[0],
- 40,
- 10,
- button=do,
- icon="copy_file",
- offset=[x,y])
-
- UI_color.set(layer, win, "progress_background")
- UI_elements.roundrect(layer, win,
- cXY[0],
- win.scroll["checklist"] + cXY[1],
- width - cXY[0],
- 40,
- 10,
- fill=False)
- layer.stroke()
-
- layer.set_font_size(20)
- layer.move_to(
- cXY[0]+50,
- win.scroll["checklist"] + cXY[1]+25
- )
- layer.show_text(talk.text("copy_to_checklist_from_clipboard"))
-
-
-
- tileX, current_Y = cXY
-
-
-
- if win.current["tool"] == "grab":
- current_Y = current_Y + height
-
-
-
-
- outlayer.set_source_surface(surface, x, y)
- outlayer.paint()
-
-
- UI_elements.scroll_area(outlayer, win, "checklist",
- x+0,
- y+50,
- width,
- height-50,
- current_Y,
- bar=True,
- mmb=True)
-
-
-
-
-
|