Themes Support

Now you can select themes.
This commit is contained in:
Jeison Yehuda Amihud (Blender Dumbass) 2021-01-02 23:33:58 +00:00
parent d067b6c64c
commit fb02ca0f81
2 changed files with 133 additions and 2 deletions

View file

@ -4,6 +4,7 @@
# This a console project manager.
import os
import time
# GTK module ( Graphical interface
import gi
@ -292,7 +293,9 @@ def layer(win, call):
def do():
win.current["calls"][call]["var"] = "/"+win.current["asset_cur"]+"/"+asset
win.assets = {}
layer.set_line_width(4)
UI_elements.roundrect(layer, win,
tileX-10,
@ -347,6 +350,19 @@ def layer(win, call):
except:
pass
# There is a problem that was introduced with the multiuser.
# Basically. The other user whould need to create this asset too. And it's
# not cool. I want to the experience to be seamless. Or at least somewhat seamless.
# So I'm going to enter the cur of the asset for a fraction of a second. And then
# come back to what ever we were doing.
tmp = win.cur
win.cur = win.current["asset_cur"]
time.sleep(0.1) # This should be plenty
win.cur = tmp
win.text["asset_select_search"]["text"] = ""
win.current["calls"][call]["var"] = "/"+win.current["asset_cur"]+"/"+newcreate

View file

@ -380,7 +380,8 @@ def layer(win):
win.current["settings_lists"] = {}
win.current["settings_lists"]["languages"] = settings.list_languages()
win.current["settings_lists"]["languages_open"] = False
win.current["settings_lists"]["themes"] = os.listdir(os.getcwd()+"/settings/themes")
win.current["settings_lists"]["themes_open"] = False
# Languages
def do():
@ -440,6 +441,77 @@ def layer(win):
current_Y += 50
# Themes. Finally we have some themes to choose from. And a good place to
# change them so the user would not need to do it manually. I think it's
# important.
# So there is a folder in the VCStudio installation called. settings/themes
# which contains all of the themes. So let's look through it.
# Themes
def do():
win.current["settings_lists"]["themes_open"] = \
not win.current["settings_lists"]["themes_open"]
UI_elements.roundrect(layer, win,
win.current["w"]/2-240,
110 + current_Y + win.scroll["studio_settings"],
450,
40,
10,
button=do,
icon="theme",
tip=talk.text("change_theme"))
UI_color.set(layer, win, "text_normal")
layer.set_font_size(20)
layer.move_to(win.current["w"]/2-180,
current_Y + win.scroll["studio_settings"] + 135)
layer.show_text(win.settings["Theme"])
current_Y += 50
if win.current["settings_lists"]["themes_open"]:
for lang in win.current["settings_lists"]["themes"]:
if lang != win.settings["Theme"]:
UI_color.set(layer, win, "button_active")
layer.move_to(win.current["w"]/2-227, 102 + current_Y + win.scroll["studio_settings"])
layer.line_to(win.current["w"]/2-227, 152 + current_Y + win.scroll["studio_settings"])
layer.stroke()
def do():
win.settings["Theme"] = lang
settings.write("Theme", lang)
win.current["settings_lists"]["themes_open"] = False
win.color = UI_color.get_table()
UI_elements.roundrect(layer, win,
win.current["w"]/2-220,
110 + current_Y + win.scroll["studio_settings"],
430,
40,
10,
button=do,
icon="theme",
tip=talk.text("set_theme")+lang)
UI_color.set(layer, win, "text_normal")
layer.set_font_size(20)
layer.move_to(win.current["w"]/2-150,
current_Y + win.scroll["studio_settings"] + 135)
layer.show_text(lang)
current_Y += 50
# BLUR
blur_ok = "unchecked"
@ -493,6 +565,49 @@ def layer(win):
current_Y + win.scroll["studio_settings"] + 135)
layer.show_text(talk.text("Auto_De-Blur"))
current_Y += 50
# ROUNDNESS
# The roundness setting is a setting that will define how round the UI will
# look. Potentially it can grow beyond 1.0, but will introduce weird rendering
# artifacts. If you wan to do that be free to edit the Setting file manually.
# I'm going to use the Scroller for this setting. But first we need an icon. And
# I think the opengl icon is quite good for this.
UI_elements.image(layer, win, "settings/themes/"\
+win.settings["Theme"]+"/icons/opengl.png",
win.current["w"]/2-240,
110 + current_Y + win.scroll["studio_settings"],
40,
40)
# Then i'm going to hack my way to it. I'm going to use a scroll for a scrooled
# window as the slider. Creativity.
maxround = 1000 # I need it do be a higher number then from 0 to 1 since we want
# to imulate the scroll
if "roundness_setting" not in win.scroll:
win.scroll["roundness_setting"] = 0 - win.settings["Roundness"] * 549
if (0 - win.settings["Roundness"] * 549) != win.scroll["roundness_setting"]:
win.settings["Roundness"] = (win.scroll["roundness_setting"] / 549)*-1
settings.write("Roundness", win.settings["Roundness"])
UI_elements.scroll_area(layer, win, "roundness_setting",
int(win.current["w"]/2-200),
110 + current_Y + win.scroll["studio_settings"]+33,
450,
0,
maxround,
bar=True,
sideways=True,
url="settings_layer"
)
current_Y += 50