123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440 |
- # THIS FILE IS A PART OF FreeGILE
- # PYTHON 3
- import os
- import datetime
- import json
- from subprocess import *
- # GTK module ( Graphical interface
- import gi
- gi.require_version('Gtk', '3.0')
- from gi.repository import Gtk
- from gi.repository import GLib
- from gi.repository import Gdk
- import cairo
- # Own modules
- from settings import settings
- from settings import talk
- from settings import fileformats
- from settings import oscalls
- from project_manager import pm_project
- #UI modules
- from UI import UI_elements
- from UI import UI_color
- from UI import UI_math
- from UI import UI_Markdown
- # Studio
- from studio import studio_dialogs
- from studio import analytics
- from studio import story
- def layer(win, call):
-
- ##########################################################################
-
- # This file will give the user documentation about various part of FreeGILE
-
- ##########################################################################
- # Determening whether we are in a Tiny mode or not. Whether to shrink
- # everything or keep it full screen.
-
- tiny = False
- if win.current["w"] < 1280:
- tiny = True
-
-
- # Making the layer
- surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, win.current['w'],
- win.current['h'])
- layer = cairo.Context(surface)
-
-
- #text setting
- layer.select_font_face("Monospace", cairo.FONT_SLANT_NORMAL, cairo.FONT_WEIGHT_NORMAL)
-
- UI_color.set(layer, win, "dark_overdrop")
- layer.rectangle(
- 0,
- 0,
- win.current["w"],
- win.current["h"],
- )
- layer.fill()
-
- nodeX = 500
- if tiny:
- nodeX = 100
-
- UI_color.set(layer, win, "node_background")
- UI_elements.roundrect(layer, win,
- 100,
- 100,
- nodeX,
- win.current["h"]-200,
- 10)
-
-
-
-
-
- # Exit button
- def do():
- win.current["calls"][call]["var"] = False
-
- exitX = 560
- if tiny:
- exitX = 150
-
- UI_elements.roundrect(layer, win,
- exitX,
- win.current["h"]-140,
- 40,
- 40,
- 10,
- button=do,
- icon="cancel",
- tip=talk.text("cancel"))
-
-
- x = 110
- y = 170
- width = nodeX - 20
- height = win.current["h"]-270
-
- # Search
- if not tiny:
-
- UI_elements.image(layer, win, "settings/themes/"\
- +win.settings["Theme"]+"/icons/search.png",
- x+width/4,
- y-50,
- 40,
- 40)
- UI_elements.text(layer, win, "in_help",
- x+width/4+50,
- y-50,
- width/2-50,
- 40)
-
- ### MARKDOWN
-
-
-
- UI_Markdown.draw(layer, win, "help_markdown",
- nodeX+200,
- 100,
- win.current["w"]-(nodeX+300),
- win.current["h"]-200)
-
- # Clip
-
- UI_elements.roundrect(layer, win,
- x,
- y,
- width,
- height-60,
- 10,
- fill=False)
- layer.clip()
-
- clip = [
- x,
- y,
- width,
- height-60]
-
- # Little testing thing. Make it True to see where it's clipping.
- if False:
- # Background
- UI_color.set(layer, win, "dark_overdrop")
- layer.rectangle(x,y,width, height)
- layer.fill()
-
-
- # Setting up the scroll
- if "help" not in win.scroll:
- win.scroll["help"] = 0
-
- current_Y = 0
-
- # So for the help dialog there will be basically a list of documentations
- # With links to the various documentation peaces. for this I will need to
- # create a little dictionary
-
- documentations = {
- talk.text("readme"):[
- ["Markdown", "README.md"],
- ["icon", "scene"]
- ],
- talk.text("license"):[
- ["Markdown", "LICENSE.md"],
- ["icon", "scene"]
- ],
- talk.text("documentation_installation"):[
- ["Markdown", "wiki/docs/Installation.md"],
- ["video", "https://search.brave.com/"],
- ["icon", "new"]
- ],
- talk.text("documentation_project_manager"):[
- ["Markdown", "wiki/docs/Project-Manager.md"],
- ["video", "https://search.brave.com/"],
- ["icon", "configure_file"]
- ],
- talk.text("documentation_story_editor"):[
- ["Markdown", "wiki/docs/Story-Editor.md"],
- ["icon", "node"]
- ],
- talk.text("documentation_script_writer"):[
- ["Markdown", "wiki/docs/Script-Writer.md"],
- ["icon", "frase"]
- ],
- talk.text("documentation_analytics"):[
- ["Markdown", "wiki/docs/Analytics.md"],
- ["icon", "analytics"]
- ],
- talk.text("documentation_assets"):[
- ["Markdown", "wiki/docs/Assets.md"],
- ["update", "https://notabug.org/jyamihud/FreeGILE/wiki/Version+20.1211+%28Asset+Manager+Alpha+++Default+Blend+Files++Project%27s+Settings%29"],
- ["icon", "obj"]
- ],
- talk.text("documentation_link_assets"):[
- ["Markdown", "wiki/docs/LinkingAssets.md"],
- ["update", "https://notabug.org/jyamihud/FreeGILE/wiki/Version+20.1263+%28+Linking+Assets+++Configuring+Assets+%29"],
- ["icon", "link"]
- ],
- talk.text("documentation_render"):[
- ["Markdown", "wiki/docs/Rendering.md"],
- ["update", "https://notabug.org/jyamihud/FreeGILE/wiki/Version+20.1266+%28+Rendering+Of+Shots+%29"],
- ["icon", "render"]
- ],
- talk.text("documentation_multiuser"):[
- ["Markdown", "wiki/docs/Multiuser.md"],
- ["update", "https://notabug.org/jyamihud/FreeGILE/wiki/Version+21.0"],
- ["icon", "multiuser"]
- ]
- }
-
-
- # Okay let's draw this crazy behimith.
-
- if "current_help_selected" not in win.current:
- win.current["current_help_selected"] = False
-
- for name in documentations:
-
- # Let's make the search work.
-
- # First I want it to automatically select the stuff with the right name
- if win.text["in_help"]["text"].lower() == name.lower():
- win.current["current_help_selected"] = name
- win.text["in_help"]["text"] = ""
-
- # Now let's ignore all those not in the search
- if win.text["in_help"]["text"] and win.text["in_help"]["text"].lower() not in name.lower():
- continue
-
- # let's simplify the name
- doc = documentations[name]
-
- # There will be a simple button. That will open one up.
- def do():
-
- win.text["in_help"]["text"] = ""
- win.scroll["markdown"] = 0
- if name != win.current["current_help_selected"]:
- win.current["current_help_selected"] = name
- else:
- win.current["current_help_selected"] = False
- # I want to make sure that there is no icon before making it
- # be "question"
-
- showicon = "question"
- for entry in doc:
- if entry[0] == "icon":
- showicon = entry[1]
-
- UI_elements.roundrect(layer, win,
- x,
- y+current_Y + win.scroll["help"],
- width,
- 40,
- 10,
- icon=showicon,
- button=do,
- tip=name)
-
- # And a text. The name of the entry
- if not tiny:
- UI_color.set(layer, win, "text_normal")
- layer.set_font_size(20)
- layer.move_to(x+50,
- y+current_Y + win.scroll["help"]+25)
- layer.show_text(name)
- # Now if it's selected we going to see what links are inside.
- if name == win.current["current_help_selected"]:
-
- # But first let's draw a roundrect arround the douche
-
- UI_color.set(layer, win, "progress_background")
- UI_elements.roundrect(layer, win,
- x,
- y+current_Y + win.scroll["help"],
- width,
- 40,
- 10,
- fill=False)
- layer.stroke()
-
- current_Y = current_Y + 50
-
- # Let's not list all the entries.
-
- for entry in doc:
-
-
-
- if entry[0] == "Markdown":
-
-
- win.current["mdfs"]["help_markdown"] = entry[1]
-
- #win.current["current_help_selected"] = ""
- continue
- # icon do not show
- elif entry[0] == "icon":
- continue
-
- # Launch button
- def do():
- oscalls.Open(entry[-1])
-
- UI_elements.roundrect(layer, win,
- x+10,
- y+current_Y + win.scroll["help"],
- width-20,
- 40,
- 10,
- icon=entry[0],
- button=do,
- tip=entry[-1])
-
- # And a text. The name of the entry
- if not tiny:
- UI_color.set(layer, win, "text_normal")
- layer.set_font_size(20)
- layer.move_to(x+70,
- y+current_Y + win.scroll["help"]+25)
- layer.show_text(talk.text("documentation_type_"+entry[0]))
- current_Y = current_Y + 50
- else:
-
- current_Y = current_Y + 50
-
-
- # Call
- def do():
- os.system("xdg-open https://meet.jit.si/FreeGILEDevelopmentConference")
- talk.alert(talk.text("opened_browser"))
-
- UI_elements.roundrect(layer, win,
- x,
- y+current_Y + win.scroll["help"],
- width,
- 40,
- 10,
- button=do,
- icon="call",
- tip=talk.text("contact_us_tip"))
-
-
- UI_color.set(layer, win, "text_normal")
- layer.set_font_size(20)
- layer.move_to(x+50,
- y+current_Y + win.scroll["help"]+25)
- layer.show_text(talk.text("contact_us_now"))
-
- current_Y = current_Y + 50
- # Matrix Chat
- def do():
- os.system("xdg-open https://matrix.to/#/#FreeGILE:matrix.org")
- talk.alert(talk.text("opened_browser"))
- UI_elements.roundrect(layer, win,
- x,
- y+current_Y + win.scroll["help"],
- width,
- 40,
- 10,
- button=do,
- icon="frase",
- tip=talk.text("matrix_chat_tooltip"))
-
-
- UI_color.set(layer, win, "text_normal")
- layer.set_font_size(20)
- layer.move_to(x+50,
- y+current_Y + win.scroll["help"]+25)
- layer.show_text(talk.text("matrix_chat_button"))
-
- current_Y = current_Y + 50
-
- # Report Bug Button
- def do():
- os.system("xdg-open https://notabug.org/troler/FreeGILE/issues")
- talk.alert(talk.text("opened_browser"))
-
- UI_elements.roundrect(layer, win,
- x,
- y+current_Y + win.scroll["help"],
- width,
- 40,
- 10,
- button=do,
- icon="bug",
- tip=talk.text("report_bug_tip"))
-
-
- UI_color.set(layer, win, "text_normal")
- layer.set_font_size(20)
- layer.move_to(x+50,
- y+current_Y + win.scroll["help"]+25)
- layer.show_text(talk.text("report_bug_now"))
-
- current_Y = current_Y + 50
-
- ###########################
-
- UI_elements.scroll_area(layer, win, "help",
- x,
- y,
- width,
- height-60,
- current_Y,
- bar=True,
- mmb=True,
- url="help"
- )
-
-
- return surface
|