UI_helpDialog.py 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430
  1. ####################################
  2. # #
  3. # COPYRIGHT NOTICE #
  4. # #
  5. # This file is a part of Victori- #
  6. # ous Children Studio Organizer. #
  7. # Or simply VCStudio. Copyright #
  8. # of J.Y.Amihud. But don't be sad #
  9. # because I released the entire #
  10. # project under a GNU GPL license. #
  11. # You may use Version 3 or later. #
  12. # See www.gnu.org/licenses if your #
  13. # copy has no License file. Please #
  14. # note. Ones I used the GPL v2 for #
  15. # it. It's no longer the case. #
  16. # #
  17. ####################################
  18. import os
  19. import datetime
  20. import json
  21. from subprocess import *
  22. # GTK module ( Graphical interface
  23. import gi
  24. gi.require_version('Gtk', '3.0')
  25. from gi.repository import Gtk
  26. from gi.repository import GLib
  27. from gi.repository import Gdk
  28. import cairo
  29. # Own modules
  30. from settings import settings
  31. from settings import talk
  32. from settings import fileformats
  33. from settings import oscalls
  34. from project_manager import pm_project
  35. #UI modules
  36. from UI import UI_elements
  37. from UI import UI_color
  38. from UI import UI_math
  39. from UI import UI_Markdown
  40. # Studio
  41. from studio import studio_dialogs
  42. from studio import analytics
  43. from studio import story
  44. def layer(win, call):
  45. ##########################################################################
  46. # This file will give the user documentation about various part of VCStudio
  47. ##########################################################################
  48. # Determening whether we are in a Tiny mode or not. Whether to shrink
  49. # everything or keep it full screen.
  50. tiny = False
  51. if win.current["w"] < 1280:
  52. tiny = True
  53. # Making the layer
  54. surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, win.current['w'],
  55. win.current['h'])
  56. layer = cairo.Context(surface)
  57. #text setting
  58. layer.select_font_face("Monospace", cairo.FONT_SLANT_NORMAL, cairo.FONT_WEIGHT_NORMAL)
  59. UI_color.set(layer, win, "dark_overdrop")
  60. layer.rectangle(
  61. 0,
  62. 0,
  63. win.current["w"],
  64. win.current["h"],
  65. )
  66. layer.fill()
  67. nodeX = 500
  68. if tiny:
  69. nodeX = 100
  70. UI_color.set(layer, win, "node_background")
  71. UI_elements.roundrect(layer, win,
  72. 100,
  73. 100,
  74. nodeX,
  75. win.current["h"]-200,
  76. 10)
  77. # Exit button
  78. def do():
  79. win.current["calls"][call]["var"] = False
  80. exitX = 560
  81. if tiny:
  82. exitX = 150
  83. UI_elements.roundrect(layer, win,
  84. exitX,
  85. win.current["h"]-140,
  86. 40,
  87. 40,
  88. 10,
  89. button=do,
  90. icon="cancel",
  91. tip=talk.text("cancel"))
  92. x = 110
  93. y = 170
  94. width = nodeX - 20
  95. height = win.current["h"]-270
  96. # Search
  97. if not tiny:
  98. UI_elements.image(layer, win, "settings/themes/"\
  99. +win.settings["Theme"]+"/icons/search.png",
  100. x+width/4,
  101. y-50,
  102. 40,
  103. 40)
  104. UI_elements.text(layer, win, "in_help",
  105. x+width/4+50,
  106. y-50,
  107. width/2-50,
  108. 40)
  109. ### MARKDOWN
  110. UI_Markdown.draw(layer, win, "help_markdown",
  111. nodeX+200,
  112. 100,
  113. win.current["w"]-(nodeX+300),
  114. win.current["h"]-200)
  115. # Clip
  116. UI_elements.roundrect(layer, win,
  117. x,
  118. y,
  119. width,
  120. height-60,
  121. 10,
  122. fill=False)
  123. layer.clip()
  124. clip = [
  125. x,
  126. y,
  127. width,
  128. height-60]
  129. # Little testing thing. Make it True to see where it's clipping.
  130. if False:
  131. # Background
  132. UI_color.set(layer, win, "dark_overdrop")
  133. layer.rectangle(x,y,width, height)
  134. layer.fill()
  135. # Setting up the scroll
  136. if "help" not in win.scroll:
  137. win.scroll["help"] = 0
  138. current_Y = 0
  139. # So for the help dialog there will be basically a list of documentations
  140. # With links to the various documentation peaces. for this I will need to
  141. # create a little dictionary
  142. documentations = {
  143. talk.text("readme"):[
  144. ["Markdown", "README.md"],
  145. ["icon", "scene"]
  146. ],
  147. talk.text("license"):[
  148. ["Markdown", "LICENSE.md"],
  149. ["icon", "scene"]
  150. ],
  151. talk.text("documentation_installation"):[
  152. ["Markdown", "wiki/docs/Installation.md"],
  153. ["video", "https://open.lbry.com/@blender-organizer:5/rnd0001-4061:1?r=7YADjAZEbHJg8n4qV5rAuBh5Hca7cZQK"],
  154. ["icon", "new"]
  155. ],
  156. talk.text("documentation_project_manager"):[
  157. ["Markdown", "wiki/docs/Project-Manager.md"],
  158. ["video", "https://open.lbry.com/@blender-organizer:5/Victorious-Children-Studio-Organizer-%28-VCStudio-%29---Project-Manager-Tutorial---Creating-Projects---Scanning-the-OS---Settings:7?r=7YADjAZEbHJg8n4qV5rAuBh5Hca7cZQK"],
  159. ["icon", "configure_file"]
  160. ],
  161. talk.text("documentation_story_editor"):[
  162. ["Markdown", "wiki/docs/Story-Editor.md"],
  163. ["icon", "node"]
  164. ],
  165. talk.text("documentation_script_writer"):[
  166. ["Markdown", "wiki/docs/Script-Writer.md"],
  167. ["icon", "frase"]
  168. ],
  169. talk.text("documentation_analytics"):[
  170. ["Markdown", "wiki/docs/Analytics.md"],
  171. ["icon", "analytics"]
  172. ],
  173. talk.text("documentation_assets"):[
  174. ["Markdown", "wiki/docs/Assets.md"],
  175. ["update", "https://notabug.org/jyamihud/VCStudio/wiki/Version+20.1211+%28Asset+Manager+Alpha+++Default+Blend+Files++Project%27s+Settings%29"],
  176. ["icon", "obj"]
  177. ],
  178. talk.text("documentation_link_assets"):[
  179. ["Markdown", "wiki/docs/LinkingAssets.md"],
  180. ["update", "https://notabug.org/jyamihud/VCStudio/wiki/Version+20.1263+%28+Linking+Assets+++Configuring+Assets+%29"],
  181. ["icon", "link"]
  182. ],
  183. talk.text("documentation_render"):[
  184. ["Markdown", "wiki/docs/Rendering.md"],
  185. ["update", "https://notabug.org/jyamihud/VCStudio/wiki/Version+20.1266+%28+Rendering+Of+Shots+%29"],
  186. ["icon", "render"]
  187. ],
  188. talk.text("documentation_multiuser"):[
  189. ["Markdown", "wiki/docs/Multiuser.md"],
  190. ["update", "https://notabug.org/jyamihud/VCStudio/wiki/Version+21.0"],
  191. ["icon", "multiuser"]
  192. ]
  193. }
  194. # Okay let's draw this crazy behimith.
  195. if "current_help_selected" not in win.current:
  196. win.current["current_help_selected"] = False
  197. for name in documentations:
  198. # Let's make the search work.
  199. # First I want it to automatically select the stuff with the right name
  200. if win.text["in_help"]["text"].lower() == name.lower():
  201. win.current["current_help_selected"] = name
  202. win.text["in_help"]["text"] = ""
  203. # Now let's ignore all those not in the search
  204. if win.text["in_help"]["text"] and win.text["in_help"]["text"].lower() not in name.lower():
  205. continue
  206. # let's simplify the name
  207. doc = documentations[name]
  208. # There will be a simple button. That will open one up.
  209. def do():
  210. win.text["in_help"]["text"] = ""
  211. win.scroll["markdown"] = 0
  212. if name != win.current["current_help_selected"]:
  213. win.current["current_help_selected"] = name
  214. else:
  215. win.current["current_help_selected"] = False
  216. # I want to make sure that there is no icon before making it
  217. # be "question"
  218. showicon = "question"
  219. for entry in doc:
  220. if entry[0] == "icon":
  221. showicon = entry[1]
  222. UI_elements.roundrect(layer, win,
  223. x,
  224. y+current_Y + win.scroll["help"],
  225. width,
  226. 40,
  227. 10,
  228. icon=showicon,
  229. button=do,
  230. tip=name)
  231. # And a text. The name of the entry
  232. if not tiny:
  233. UI_color.set(layer, win, "text_normal")
  234. layer.set_font_size(20)
  235. layer.move_to(x+50,
  236. y+current_Y + win.scroll["help"]+25)
  237. layer.show_text(name)
  238. # Now if it's selected we going to see what links are inside.
  239. if name == win.current["current_help_selected"]:
  240. # But first let's draw a roundrect arround the douche
  241. UI_color.set(layer, win, "progress_background")
  242. UI_elements.roundrect(layer, win,
  243. x,
  244. y+current_Y + win.scroll["help"],
  245. width,
  246. 40,
  247. 10,
  248. fill=False)
  249. layer.stroke()
  250. current_Y = current_Y + 50
  251. # Let's not list all the entries.
  252. for entry in doc:
  253. if entry[0] == "Markdown":
  254. win.current["mdfs"]["help_markdown"] = entry[1]
  255. #win.current["current_help_selected"] = ""
  256. continue
  257. # icon do not show
  258. elif entry[0] == "icon":
  259. continue
  260. # Launch button
  261. def do():
  262. oscalls.Open(entry[-1])
  263. UI_elements.roundrect(layer, win,
  264. x+10,
  265. y+current_Y + win.scroll["help"],
  266. width-20,
  267. 40,
  268. 10,
  269. icon=entry[0],
  270. button=do,
  271. tip=entry[-1])
  272. # And a text. The name of the entry
  273. if not tiny:
  274. UI_color.set(layer, win, "text_normal")
  275. layer.set_font_size(20)
  276. layer.move_to(x+70,
  277. y+current_Y + win.scroll["help"]+25)
  278. layer.show_text(talk.text("documentation_type_"+entry[0]))
  279. current_Y = current_Y + 50
  280. else:
  281. current_Y = current_Y + 50
  282. # Call
  283. def do():
  284. os.system("xdg-open https://meet.jit.si/VCStudioDevelopmentConference")
  285. UI_elements.roundrect(layer, win,
  286. x,
  287. y+current_Y + win.scroll["help"],
  288. width,
  289. 40,
  290. 10,
  291. button=do,
  292. icon="call",
  293. tip=talk.text("contact_us_tip"))
  294. UI_color.set(layer, win, "text_normal")
  295. layer.set_font_size(20)
  296. layer.move_to(x+50,
  297. y+current_Y + win.scroll["help"]+25)
  298. layer.show_text(talk.text("contact_us_now"))
  299. current_Y = current_Y + 50
  300. # Report Bug Button
  301. def do():
  302. os.system("xdg-open https://notabug.org/jyamihud/VCStudio/issues")
  303. UI_elements.roundrect(layer, win,
  304. x,
  305. y+current_Y + win.scroll["help"],
  306. width,
  307. 40,
  308. 10,
  309. button=do,
  310. icon="bug",
  311. tip=talk.text("report_bug_tip"))
  312. UI_color.set(layer, win, "text_normal")
  313. layer.set_font_size(20)
  314. layer.move_to(x+50,
  315. y+current_Y + win.scroll["help"]+25)
  316. layer.show_text(talk.text("report_bug_now"))
  317. current_Y = current_Y + 50
  318. ###########################
  319. UI_elements.scroll_area(layer, win, "help",
  320. x,
  321. y,
  322. width,
  323. height-60,
  324. current_Y,
  325. bar=True,
  326. mmb=True,
  327. url="help"
  328. )
  329. return surface