studio_storyDeletionLayer.py 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. # THIS FILE IS A PART OF VCStudio
  2. # PYTHON 3
  3. # This a console project manager.
  4. import os
  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 project_manager import pm_project
  16. #UI modules
  17. from UI import UI_elements
  18. from UI import UI_color
  19. def layer(win):
  20. # Making the layer
  21. surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, win.current['w'],
  22. win.current['h'])
  23. layer = cairo.Context(surface)
  24. #text setting
  25. layer.select_font_face("Monospace", cairo.FONT_SLANT_NORMAL, cairo.FONT_WEIGHT_NORMAL)
  26. UI_color.set(layer, win, "dark_overdrop")
  27. layer.rectangle(
  28. 0,
  29. 0,
  30. win.current["w"],
  31. win.current["h"],
  32. )
  33. layer.fill()
  34. # So it's going to be like a little window in the center of the VCStudio
  35. # with a simple UI. Probably like 2 things. Folder and a projectname.
  36. UI_color.set(layer, win, "node_background")
  37. UI_elements.roundrect(layer, win,
  38. win.current["w"]/2-250,
  39. win.current["h"]/2-150,
  40. 500,
  41. 300,
  42. 10)
  43. # Title of the operation. Incase the user forgot.
  44. UI_elements.text(layer, win, "delete_scenes_question",
  45. win.current["w"]/2-250,
  46. win.current["h"]/2-140,
  47. 500,
  48. 30,
  49. 10,
  50. fill=False,
  51. centered=True,
  52. editable=False)
  53. win.text["delete_scenes_question"]["text"] = talk.text("DeleteQuestion")
  54. # Let's count how much of what it's going to be deleting.
  55. scenes = 0
  56. files = 0
  57. assets = 0
  58. markers = 0
  59. for thing in win.story["selected"]:
  60. if thing[0] == "scene":
  61. scenes += 1
  62. elif thing[0] == "file":
  63. files += 1
  64. elif thing[0] == "asset":
  65. assets += 1
  66. elif thing[0] == "marker":
  67. markers += 1
  68. # Text saying Stuff
  69. UI_color.set(layer, win, "text_normal")
  70. layer.set_font_size(20)
  71. layer.move_to(
  72. win.current["w"]/2-200,
  73. win.current["h"]/2-60)
  74. layer.show_text(str(scenes)+" "+talk.text("Scenes"))
  75. layer.move_to(
  76. win.current["w"]/2-200,
  77. win.current["h"]/2-30)
  78. layer.show_text(str(files)+" "+talk.text("LinksToFiles"))
  79. layer.move_to(
  80. win.current["w"]/2-200,
  81. win.current["h"]/2)
  82. layer.show_text(str(assets)+" "+talk.text("LinksToAssets"))
  83. layer.move_to(
  84. win.current["w"]/2-200,
  85. win.current["h"]/2+30)
  86. layer.show_text(str(markers)+" "+talk.text("Markers"))
  87. # Text at the bottom
  88. UI_elements.text(layer, win, "delete_scenes_conformation",
  89. win.current["w"]/2-250,
  90. win.current["h"]/2+60,
  91. 500,
  92. 30,
  93. 10,
  94. fill=False,
  95. centered=True,
  96. editable=False)
  97. win.text["delete_scenes_conformation"]["text"] = talk.text("OperationIrrevesable")
  98. def do():
  99. win.url = "story_editor"
  100. links = []
  101. for thing in win.story["selected"]:
  102. if thing[0] == "scene":
  103. del win.story["scenes"][thing[1]]
  104. elif thing[0] == "marker":
  105. del win.story["markers"][thing[1]]
  106. elif thing[0] in ["asset", "file"]:
  107. links.append(thing[1])
  108. new = []
  109. for num, i in enumerate(win.story["links"]):
  110. if num not in links:
  111. new.append(i)
  112. win.story["links"] = new
  113. win.story["selected"] = []
  114. UI_elements.roundrect(layer, win,
  115. win.current["w"]/2+170,
  116. win.current["h"]/2+110,
  117. 40,
  118. 40,
  119. 10,
  120. button=do,
  121. icon="ok",
  122. tip=talk.text("checked"))
  123. def do():
  124. win.url = "story_editor"
  125. UI_elements.roundrect(layer, win,
  126. win.current["w"]/2+210,
  127. win.current["h"]/2+110,
  128. 40,
  129. 40,
  130. 10,
  131. button=do,
  132. icon="cancel",
  133. tip=talk.text("cancel"))
  134. return surface