studio_settingsLayer.py 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831
  1. # THIS FILE IS A PART OF VCStudio
  2. # PYTHON 3
  3. import os
  4. import datetime
  5. # GTK module ( Graphical interface
  6. import gi
  7. gi.require_version('Gtk', '3.0')
  8. from gi.repository import Gtk
  9. from gi.repository import GLib
  10. from gi.repository import Gdk
  11. import cairo
  12. # Own modules
  13. from settings import settings
  14. from settings import talk
  15. from settings import fileformats
  16. from studio import studio_dialogs
  17. from project_manager import pm_project
  18. #UI modules
  19. from UI import UI_elements
  20. from UI import UI_color
  21. # Studio
  22. from studio import studio_dialogs
  23. from studio import analytics
  24. from network import http_client
  25. def layer(win):
  26. # Making the layer
  27. surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, win.current['w'],
  28. win.current['h'])
  29. layer = cairo.Context(surface)
  30. #text setting
  31. layer.select_font_face("Monospace", cairo.FONT_SLANT_NORMAL, cairo.FONT_WEIGHT_NORMAL)
  32. UI_color.set(layer, win, "dark_overdrop")
  33. layer.rectangle(
  34. 0,
  35. 0,
  36. win.current["w"],
  37. win.current["h"],
  38. )
  39. layer.fill()
  40. UI_color.set(layer, win, "node_background")
  41. UI_elements.roundrect(layer, win,
  42. win.current["w"]/2-250,
  43. 100,
  44. 500,
  45. win.current["h"]-200,
  46. 10)
  47. # Exit button
  48. def do():
  49. win.url = "story_editor"
  50. win.textactive = ""
  51. UI_elements.roundrect(layer, win,
  52. win.current["w"]/2+210,
  53. win.current["h"]-140,
  54. 40,
  55. 40,
  56. 10,
  57. button=do,
  58. icon="cancel",
  59. tip=talk.text("cancel"))
  60. # Clipping everything
  61. UI_elements.roundrect(layer, win,
  62. win.current["w"]/2-250,
  63. 100,
  64. 500,
  65. win.current["h"]-260,
  66. 10,
  67. fill=False)
  68. layer.clip()
  69. clip = [
  70. win.current["w"]/2-250,
  71. 100,
  72. 500,
  73. win.current["h"]-260]
  74. # Setting up the scroll
  75. if "studio_settings" not in win.scroll:
  76. win.scroll["studio_settings"] = 0
  77. current_Y = 0 # The max scroll value
  78. # Projectname
  79. UI_elements.image(layer, win, "settings/themes/"\
  80. +win.settings["Theme"]+"/icons/analytics.png",
  81. win.current["w"]/2-240,
  82. 110 + current_Y + win.scroll["studio_settings"],
  83. 40,
  84. 40)
  85. UI_elements.text(layer, win, "Project_Name_setting",
  86. win.current["w"]/2-190,
  87. 110 + current_Y + win.scroll["studio_settings"],
  88. 420,
  89. 40,
  90. set_text=win.analytics["name"],
  91. tip=talk.text("project_name"))
  92. if win.text["Project_Name_setting"]["text"] != win.analytics["name"]:
  93. def do():
  94. win.analytics["name"] = win.text["Project_Name_setting"]["text"]
  95. UI_elements.roundrect(layer, win,
  96. win.current["w"]/2-240+430,
  97. 110 + current_Y + win.scroll["studio_settings"],
  98. 40,
  99. 40,
  100. 10,
  101. button=do,
  102. icon="ok",
  103. tip=talk.text("checked"))
  104. current_Y += 50
  105. # Director
  106. UI_elements.image(layer, win, "settings/themes/"\
  107. +win.settings["Theme"]+"/icons/analytics.png",
  108. win.current["w"]/2-240,
  109. 110 + current_Y + win.scroll["studio_settings"],
  110. 40,
  111. 40)
  112. UI_elements.text(layer, win, "Project_Director_setting",
  113. win.current["w"]/2-190,
  114. 110 + current_Y + win.scroll["studio_settings"],
  115. 420,
  116. 40,
  117. set_text=win.analytics["director"],
  118. tip=talk.text("project_director"))
  119. if win.text["Project_Director_setting"]["text"] != win.analytics["director"]:
  120. def do():
  121. win.analytics["director"] = win.text["Project_Director_setting"]["text"]
  122. UI_elements.roundrect(layer, win,
  123. win.current["w"]/2-240+430,
  124. 110 + current_Y + win.scroll["studio_settings"],
  125. 40,
  126. 40,
  127. 10,
  128. button=do,
  129. icon="ok",
  130. tip=talk.text("checked"))
  131. current_Y += 50
  132. # Project Comment
  133. UI_elements.image(layer, win, "settings/themes/"\
  134. +win.settings["Theme"]+"/icons/analytics.png",
  135. win.current["w"]/2-240,
  136. 110 + current_Y + win.scroll["studio_settings"],
  137. 40,
  138. 40)
  139. UI_elements.text(layer, win, "Project_status_setting",
  140. win.current["w"]/2-190,
  141. 110 + current_Y + win.scroll["studio_settings"],
  142. 420,
  143. 40,
  144. set_text=win.analytics["status"],
  145. tip=talk.text("project_status"))
  146. if win.text["Project_status_setting"]["text"] != win.analytics["status"]:
  147. def do():
  148. win.analytics["status"] = win.text["Project_status_setting"]["text"]
  149. UI_elements.roundrect(layer, win,
  150. win.current["w"]/2-240+430,
  151. 110 + current_Y + win.scroll["studio_settings"],
  152. 40,
  153. 40,
  154. 10,
  155. button=do,
  156. icon="ok",
  157. tip=talk.text("checked"))
  158. current_Y += 50
  159. # Banner / Background image settings.
  160. if os.path.exists(win.project+"/set/banner.png"):
  161. UI_elements.image(layer, win, win.project+"/set/banner.png",
  162. win.current["w"]/2-240,
  163. 110 + current_Y + win.scroll["studio_settings"],
  164. 480,
  165. 200,
  166. cell="settings_background")
  167. elif os.path.exists(win.project+"/py_data/banner.png"):
  168. UI_elements.image(layer, win, win.project+"/py_data/banner.png",
  169. win.current["w"]/2-240,
  170. 110 + current_Y + win.scroll["studio_settings"],
  171. 480,
  172. 200,
  173. cell="settings_background")
  174. else:
  175. UI_elements.image(layer, win, "icon.png",
  176. win.current["w"]/2-240,
  177. 110 + current_Y + win.scroll["studio_settings"],
  178. 480,
  179. 200,
  180. cell="settings_background")
  181. def do():
  182. def after(win, var):
  183. try:
  184. if var:
  185. # Let's check that the selected if an image.
  186. for f in fileformats.images:
  187. if var.endswith(f):
  188. # Now let's copy the picture from whereever it is to be the new
  189. # banner. For this first of all I need to check whether it exists
  190. # inside the project.
  191. if os.path.exists(win.project+"/"+var):
  192. fr = win.project+"/"+var
  193. else:
  194. fr = var
  195. with open(fr, "rb") as in_file, open(win.project+"/set/banner.png", "wb") as out_file:
  196. out_file.write(in_file.read())
  197. # Refrashing images
  198. win.images = {}
  199. break
  200. except:
  201. raise()
  202. studio_dialogs.file_select(win, "banner_editing", after, force=True)
  203. UI_elements.roundrect(layer, win,
  204. win.current["w"]/2-250,
  205. 100 + current_Y + win.scroll["studio_settings"],
  206. 500,
  207. 220,
  208. 10,
  209. button=do,
  210. fill=False,
  211. tip=talk.text("project_banner"))
  212. layer.stroke()
  213. current_Y += 220
  214. # Start date and Deadline
  215. UI_elements.image(layer, win, "settings/themes/"\
  216. +win.settings["Theme"]+"/icons/schedule.png",
  217. win.current["w"]/2-240,
  218. 110 + current_Y + win.scroll["studio_settings"],
  219. 40,
  220. 40)
  221. UI_elements.text(layer, win, "Project_startdate_setting",
  222. win.current["w"]/2-190,
  223. 110 + current_Y + win.scroll["studio_settings"],
  224. 200,
  225. 40,
  226. set_text=win.analytics["startdate"],
  227. tip=talk.text("project_startdate"))
  228. if win.text["Project_startdate_setting"]["text"] != win.analytics["startdate"]\
  229. and analytics.ifdate(win.text["Project_startdate_setting"]["text"]):
  230. def do():
  231. win.analytics["startdate"] = win.text["Project_startdate_setting"]["text"]
  232. # Refrashing the analytics
  233. analytics.save(win.project, win.analytics)
  234. win.analytics = analytics.load(win.project)
  235. UI_elements.roundrect(layer, win,
  236. win.current["w"]/2-240+210,
  237. 110 + current_Y + win.scroll["studio_settings"],
  238. 40,
  239. 40,
  240. 10,
  241. button=do,
  242. icon="ok",
  243. tip=talk.text("checked"))
  244. UI_elements.text(layer, win, "Project_deadline_setting",
  245. win.current["w"]/2-190+210,
  246. 110 + current_Y + win.scroll["studio_settings"],
  247. 200,
  248. 40,
  249. set_text=win.analytics["deadline"],
  250. tip=talk.text("project_deadline"))
  251. if win.text["Project_deadline_setting"]["text"] != win.analytics["deadline"]\
  252. and analytics.ifdate(win.text["Project_deadline_setting"]["text"]):
  253. def do():
  254. win.analytics["deadline"] = win.text["Project_deadline_setting"]["text"]
  255. # Refrashing the analytics
  256. analytics.save(win.project, win.analytics)
  257. win.analytics = analytics.load(win.project)
  258. UI_elements.roundrect(layer, win,
  259. win.current["w"]/2-240+420,
  260. 110 + current_Y + win.scroll["studio_settings"],
  261. 40,
  262. 40,
  263. 10,
  264. button=do,
  265. icon="ok",
  266. tip=talk.text("checked"))
  267. current_Y += 50
  268. # Days a week.
  269. UI_elements.text(layer, win, "Project_days_a_week_setting",
  270. win.current["w"]/2-190,
  271. 110 + current_Y + win.scroll["studio_settings"],
  272. 80,
  273. 40,
  274. set_text=str(win.analytics.get("days_a_week", 7)),
  275. tip=talk.text("days_a_week"))
  276. if win.text["Project_days_a_week_setting"]["text"] != str(win.analytics.get("days_a_week", 7))\
  277. and analytics.if_days_a_week(win.text["Project_days_a_week_setting"]["text"]):
  278. def do():
  279. win.analytics["days_a_week"] = int(win.text["Project_days_a_week_setting"]["text"])
  280. # Refrashing the analytics
  281. analytics.save(win.project, win.analytics)
  282. win.analytics = analytics.load(win.project)
  283. UI_elements.roundrect(layer, win,
  284. win.current["w"]/2-150,
  285. 110 + current_Y + win.scroll["studio_settings"],
  286. 40,
  287. 40,
  288. 10,
  289. button=do,
  290. icon="ok",
  291. tip=talk.text("checked"))
  292. UI_color.set(layer, win, "text_normal")
  293. layer.set_font_size(20)
  294. layer.move_to(win.current["w"]/2-100,
  295. current_Y + win.scroll["studio_settings"] + 135)
  296. layer.show_text(talk.text("days_a_week"))
  297. current_Y += 100
  298. # Username
  299. UI_elements.image(layer, win, "settings/themes/"\
  300. +win.settings["Theme"]+"/icons/user.png",
  301. win.current["w"]/2-240,
  302. 110 + current_Y + win.scroll["studio_settings"],
  303. 40,
  304. 40)
  305. UI_elements.text(layer, win, "Username_setting",
  306. win.current["w"]/2-190,
  307. 110 + current_Y + win.scroll["studio_settings"],
  308. 420,
  309. 40,
  310. set_text=win.settings["Username"],
  311. tip=talk.text("username"))
  312. if win.text["Username_setting"]["text"] != win.settings["Username"]:
  313. def do():
  314. win.settings["Username"] = win.text["Username_setting"]["text"]
  315. settings.write("Username", win.settings["Username"])
  316. UI_elements.roundrect(layer, win,
  317. win.current["w"]/2-240+430,
  318. 110 + current_Y + win.scroll["studio_settings"],
  319. 40,
  320. 40,
  321. 10,
  322. button=do,
  323. icon="ok",
  324. tip=talk.text("checked"))
  325. current_Y += 50
  326. # Preparing lists.
  327. if "settings_lists" not in win.current:
  328. win.current["settings_lists"] = {}
  329. win.current["settings_lists"]["languages"] = settings.list_languages()
  330. win.current["settings_lists"]["languages_open"] = False
  331. win.current["settings_lists"]["themes"] = os.listdir(os.getcwd()+"/settings/themes")
  332. win.current["settings_lists"]["themes_open"] = False
  333. # Languages
  334. def do():
  335. win.current["settings_lists"]["languages_open"] = \
  336. not win.current["settings_lists"]["languages_open"]
  337. UI_elements.roundrect(layer, win,
  338. win.current["w"]/2-240,
  339. 110 + current_Y + win.scroll["studio_settings"],
  340. 450,
  341. 40,
  342. 10,
  343. button=do,
  344. icon="font",
  345. tip=talk.text("change_language"))
  346. UI_color.set(layer, win, "text_normal")
  347. layer.set_font_size(20)
  348. layer.move_to(win.current["w"]/2-180,
  349. current_Y + win.scroll["studio_settings"] + 135)
  350. layer.show_text(win.settings["Language"])
  351. current_Y += 50
  352. if win.current["settings_lists"]["languages_open"]:
  353. for lang in win.current["settings_lists"]["languages"]:
  354. if lang != win.settings["Language"]:
  355. UI_color.set(layer, win, "button_active")
  356. layer.move_to(win.current["w"]/2-227, 102 + current_Y + win.scroll["studio_settings"])
  357. layer.line_to(win.current["w"]/2-227, 152 + current_Y + win.scroll["studio_settings"])
  358. layer.stroke()
  359. def do():
  360. win.settings["Language"] = lang
  361. settings.write("Language", lang)
  362. win.current["settings_lists"]["languages_open"] = False
  363. UI_elements.roundrect(layer, win,
  364. win.current["w"]/2-220,
  365. 110 + current_Y + win.scroll["studio_settings"],
  366. 430,
  367. 40,
  368. 10,
  369. button=do,
  370. icon="font",
  371. tip=talk.text("set_language")+lang)
  372. UI_color.set(layer, win, "text_normal")
  373. layer.set_font_size(20)
  374. layer.move_to(win.current["w"]/2-150,
  375. current_Y + win.scroll["studio_settings"] + 135)
  376. layer.show_text(lang)
  377. current_Y += 50
  378. # Themes. Finally we have some themes to choose from. And a good place to
  379. # change them so the user would not need to do it manually. I think it's
  380. # important.
  381. # So there is a folder in the VCStudio installation called. settings/themes
  382. # which contains all of the themes. So let's look through it.
  383. # Themes
  384. def do():
  385. win.current["settings_lists"]["themes_open"] = \
  386. not win.current["settings_lists"]["themes_open"]
  387. UI_elements.roundrect(layer, win,
  388. win.current["w"]/2-240,
  389. 110 + current_Y + win.scroll["studio_settings"],
  390. 450,
  391. 40,
  392. 10,
  393. button=do,
  394. icon="theme",
  395. tip=talk.text("change_theme"))
  396. UI_color.set(layer, win, "text_normal")
  397. layer.set_font_size(20)
  398. layer.move_to(win.current["w"]/2-180,
  399. current_Y + win.scroll["studio_settings"] + 135)
  400. layer.show_text(win.settings["Theme"])
  401. current_Y += 50
  402. if win.current["settings_lists"]["themes_open"]:
  403. for lang in win.current["settings_lists"]["themes"]:
  404. if lang != win.settings["Theme"]:
  405. UI_color.set(layer, win, "button_active")
  406. layer.move_to(win.current["w"]/2-227, 102 + current_Y + win.scroll["studio_settings"])
  407. layer.line_to(win.current["w"]/2-227, 152 + current_Y + win.scroll["studio_settings"])
  408. layer.stroke()
  409. def do():
  410. win.settings["Theme"] = lang
  411. settings.write("Theme", lang)
  412. win.current["settings_lists"]["themes_open"] = False
  413. win.color = UI_color.get_table()
  414. UI_elements.roundrect(layer, win,
  415. win.current["w"]/2-220,
  416. 110 + current_Y + win.scroll["studio_settings"],
  417. 430,
  418. 40,
  419. 10,
  420. button=do,
  421. icon="theme",
  422. tip=talk.text("set_theme")+lang)
  423. UI_color.set(layer, win, "text_normal")
  424. layer.set_font_size(20)
  425. layer.move_to(win.current["w"]/2-150,
  426. current_Y + win.scroll["studio_settings"] + 135)
  427. layer.show_text(lang)
  428. current_Y += 50
  429. # BLUR
  430. blur_ok = "unchecked"
  431. if win.settings["Blur"]:
  432. blur_ok = "checked"
  433. def do():
  434. win.settings["Blur"] = not win.settings["Blur"]
  435. settings.write("Blur", win.settings["Blur"])
  436. UI_elements.roundrect(layer, win,
  437. win.current["w"]/2-240,
  438. 110 + current_Y + win.scroll["studio_settings"],
  439. 450,
  440. 40,
  441. 10,
  442. button=do,
  443. icon=blur_ok,
  444. tip=talk.text("Blur"))
  445. UI_color.set(layer, win, "text_normal")
  446. layer.set_font_size(20)
  447. layer.move_to(win.current["w"]/2-180,
  448. current_Y + win.scroll["studio_settings"] + 135)
  449. layer.show_text(talk.text("Blur"))
  450. current_Y += 50
  451. if win.settings["Blur"]:
  452. ablur_ok = "unchecked"
  453. if win.settings["Auto_De-Blur"]:
  454. ablur_ok = "checked"
  455. def do():
  456. win.settings["Auto_De-Blur"] = not win.settings["Auto_De-Blur"]
  457. settings.write("Auto_De-Blur", win.settings["Auto_De-Blur"])
  458. UI_elements.roundrect(layer, win,
  459. win.current["w"]/2-240,
  460. 110 + current_Y + win.scroll["studio_settings"],
  461. 450,
  462. 40,
  463. 10,
  464. button=do,
  465. icon=ablur_ok,
  466. tip=talk.text("Auto_De-Blur"))
  467. UI_color.set(layer, win, "text_normal")
  468. layer.set_font_size(20)
  469. layer.move_to(win.current["w"]/2-180,
  470. current_Y + win.scroll["studio_settings"] + 135)
  471. layer.show_text(talk.text("Auto_De-Blur"))
  472. current_Y += 50
  473. # Pixelated Blur
  474. ablur_ok = "unchecked"
  475. if win.settings["PixelBlur"]:
  476. ablur_ok = "checked"
  477. def do():
  478. win.settings["PixelBlur"] = not win.settings["PixelBlur"]
  479. settings.write("PixelBlur", win.settings["PixelBlur"])
  480. UI_elements.roundrect(layer, win,
  481. win.current["w"]/2-240,
  482. 110 + current_Y + win.scroll["studio_settings"],
  483. 450,
  484. 40,
  485. 10,
  486. button=do,
  487. icon=ablur_ok,
  488. tip=talk.text("PixelBlur"))
  489. UI_color.set(layer, win, "text_normal")
  490. layer.set_font_size(20)
  491. layer.move_to(win.current["w"]/2-180,
  492. current_Y + win.scroll["studio_settings"] + 135)
  493. layer.show_text(talk.text("PixelBlur"))
  494. current_Y += 50
  495. # ROUNDNESS
  496. # The roundness setting is a setting that will define how round the UI will
  497. # look. Potentially it can grow beyond 1.0, but will introduce weird rendering
  498. # artifacts. If you wan to do that be free to edit the Setting file manually.
  499. # I'm going to use the Scroller for this setting. But first we need an icon. And
  500. # I think the opengl icon is quite good for this.
  501. UI_elements.image(layer, win, "settings/themes/"\
  502. +win.settings["Theme"]+"/icons/opengl.png",
  503. win.current["w"]/2-240,
  504. 110 + current_Y + win.scroll["studio_settings"],
  505. 40,
  506. 40)
  507. # Then i'm going to hack my way to it. I'm going to use a scroll for a scrooled
  508. # window as the slider. Creativity.
  509. maxround = 1000 # I need it do be a higher number then from 0 to 1 since we want
  510. # to imulate the scroll
  511. if "roundness_setting" not in win.scroll:
  512. win.scroll["roundness_setting"] = 0 - win.settings["Roundness"] * 549
  513. if (0 - win.settings["Roundness"] * 549) != win.scroll["roundness_setting"]:
  514. win.settings["Roundness"] = (win.scroll["roundness_setting"] / 549)*-1
  515. settings.write("Roundness", win.settings["Roundness"])
  516. UI_elements.scroll_area(layer, win, "roundness_setting",
  517. int(win.current["w"]/2-200),
  518. 110 + current_Y + win.scroll["studio_settings"]+33,
  519. 450,
  520. 0,
  521. maxround,
  522. bar=True,
  523. sideways=True,
  524. url="settings_layer"
  525. )
  526. current_Y += 100
  527. # WHICH BLENDER TO USE
  528. if "blender-bash" not in win.settings:
  529. win.settings["blender-bash"] = "blender"
  530. UI_elements.image(layer, win, "settings/themes/"\
  531. +win.settings["Theme"]+"/icons/blender.png",
  532. win.current["w"]/2-240,
  533. 110 + current_Y + win.scroll["studio_settings"],
  534. 40,
  535. 40)
  536. UI_elements.text(layer, win, "blender-bash",
  537. win.current["w"]/2-190,
  538. 110 + current_Y + win.scroll["studio_settings"],
  539. 420,
  540. 40,
  541. set_text=win.settings["blender-bash"],
  542. tip=talk.text("blender-bash"))
  543. if win.text["blender-bash"]["text"] != win.settings["blender-bash"]:
  544. def do():
  545. win.settings["blender-bash"] = win.text["blender-bash"]["text"]
  546. settings.write("blender-bash", win.settings["blender-bash"])
  547. UI_elements.roundrect(layer, win,
  548. win.current["w"]/2-240+430,
  549. 110 + current_Y + win.scroll["studio_settings"],
  550. 40,
  551. 40,
  552. 10,
  553. button=do,
  554. icon="ok",
  555. tip=talk.text("checked"))
  556. current_Y += 100
  557. # REMOTE SERVER
  558. rserv_ok = "unchecked"
  559. if win.analytics["from-remote-server"]:
  560. rserv_ok = "checked"
  561. def do():
  562. win.analytics["from-remote-server"] = not win.analytics["from-remote-server"]
  563. UI_elements.roundrect(layer, win,
  564. win.current["w"]/2-240,
  565. 110 + current_Y + win.scroll["studio_settings"],
  566. 450,
  567. 40,
  568. 10,
  569. button=do,
  570. icon=rserv_ok,
  571. tip=talk.text("Remote_Server_tip"))
  572. UI_color.set(layer, win, "text_normal")
  573. layer.set_font_size(20)
  574. layer.move_to(win.current["w"]/2-180,
  575. current_Y + win.scroll["studio_settings"] + 135)
  576. layer.show_text(talk.text("Remote_Server"))
  577. current_Y += 50
  578. if win.analytics["from-remote-server"]:
  579. # Remote Server Host Name
  580. UI_elements.image(layer, win, "settings/themes/"\
  581. +win.settings["Theme"]+"/icons/server.png",
  582. win.current["w"]/2-240,
  583. 110 + current_Y + win.scroll["studio_settings"],
  584. 40,
  585. 40)
  586. UI_elements.text(layer, win, "remote-server-url",
  587. win.current["w"]/2-190,
  588. 110 + current_Y + win.scroll["studio_settings"],
  589. 420,
  590. 40,
  591. set_text=win.analytics["remote-server-url"],
  592. tip=talk.text("remote-server-url"))
  593. if win.text["remote-server-url"]["text"] != win.analytics["remote-server-url"]:
  594. def do():
  595. win.analytics["remote-server-url"] = win.text["remote-server-url"]["text"]
  596. UI_elements.roundrect(layer, win,
  597. win.current["w"]/2-240+430,
  598. 110 + current_Y + win.scroll["studio_settings"],
  599. 40,
  600. 40,
  601. 10,
  602. button=do,
  603. icon="ok",
  604. tip=talk.text("checked"))
  605. current_Y += 50
  606. if win.analytics["remote-server-url"]:
  607. def do():
  608. def after(win, var):
  609. pass
  610. studio_dialogs.http_client_dialog(win, "http-client", after, http_client.get_essentials)
  611. UI_elements.roundrect(layer, win,
  612. win.current["w"]/2-240,
  613. 110 + current_Y + win.scroll["studio_settings"],
  614. 450,
  615. 40,
  616. 10,
  617. button=do,
  618. icon="update",
  619. tip=talk.text("remote-update-initial-tip"))
  620. UI_color.set(layer, win, "text_normal")
  621. layer.set_font_size(20)
  622. layer.move_to(win.current["w"]/2-180,
  623. current_Y + win.scroll["studio_settings"] + 135)
  624. layer.show_text(talk.text("remote-update-initial"))
  625. current_Y += 50
  626. current_Y += 50
  627. UI_elements.scroll_area(layer, win, "studio_settings",
  628. int(win.current["w"]/2-250),
  629. 100,
  630. 500,
  631. win.current["h"]-260,
  632. current_Y,
  633. bar=True,
  634. mmb=True,
  635. url="settings_layer"
  636. )
  637. return surface