2020-11-26 16:50:17 +01:00
|
|
|
# THIS FILE IS A PART OF VCStudio
|
|
|
|
# PYTHON 3
|
|
|
|
|
|
|
|
import os
|
|
|
|
|
|
|
|
# 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
|
2020-12-11 18:16:55 +01:00
|
|
|
from settings import oscalls
|
2020-11-26 16:50:17 +01:00
|
|
|
from project_manager import pm_project
|
|
|
|
|
|
|
|
#UI modules
|
|
|
|
from UI import UI_elements
|
|
|
|
from UI import UI_color
|
|
|
|
|
|
|
|
|
|
|
|
def layer(win):
|
|
|
|
|
|
|
|
# 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()
|
|
|
|
|
|
|
|
# So it's going to be like a little window in the center of the VCStudio
|
|
|
|
# with a simple UI. Probably like 2 things. Folder and a projectname.
|
|
|
|
|
|
|
|
UI_color.set(layer, win, "node_background")
|
|
|
|
UI_elements.roundrect(layer, win,
|
|
|
|
win.current["w"]/2-250,
|
|
|
|
100,
|
|
|
|
500,
|
|
|
|
win.current["h"]-200,
|
|
|
|
10)
|
|
|
|
|
|
|
|
# Exit button
|
|
|
|
def do():
|
|
|
|
win.url = "project_manager"
|
|
|
|
win.textactive = ""
|
|
|
|
|
|
|
|
|
|
|
|
UI_elements.roundrect(layer, win,
|
|
|
|
win.current["w"]/2+210,
|
|
|
|
win.current["h"]-140,
|
|
|
|
40,
|
|
|
|
40,
|
|
|
|
10,
|
|
|
|
button=do,
|
|
|
|
icon="cancel",
|
|
|
|
tip=talk.text("cancel"))
|
2021-01-11 20:07:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
# Setting to get all files. Sometimes you need a way to restore the entire
|
|
|
|
# program. Or sometimes I make mistakes. And want give myself and others a
|
|
|
|
# simple way to refresh the system. So here I gonna make a button that will
|
|
|
|
# tell the updater to ignore the update version and download the whole
|
|
|
|
# package. All 300 something files. ( It's 2021/01 at the time. )
|
|
|
|
|
|
|
|
# Also not so long ago I made Version naming mistakes. So some kind of way
|
|
|
|
# to download versions should exist. Here we go.
|
|
|
|
|
|
|
|
if "Update_all" not in win.settings:
|
|
|
|
win.settings["Update_all"] = False
|
|
|
|
settings.write("Update_all", False)
|
|
|
|
|
|
|
|
if win.settings["Update_all"]:
|
|
|
|
ic = "checked"
|
|
|
|
else:
|
|
|
|
ic = "unchecked"
|
|
|
|
|
|
|
|
def do():
|
|
|
|
win.settings["Update_all"] = not win.settings["Update_all"]
|
|
|
|
settings.write("Update_all", win.settings["Update_all"])
|
|
|
|
|
|
|
|
|
|
|
|
UI_elements.roundrect(layer, win,
|
|
|
|
win.current["w"]/2-250,
|
|
|
|
win.current["h"]-140,
|
|
|
|
420,
|
|
|
|
40,
|
|
|
|
10,
|
|
|
|
button=do,
|
|
|
|
icon=ic,
|
|
|
|
tip=talk.text("update_all_tooltip"))
|
|
|
|
|
|
|
|
|
|
|
|
UI_color.set(layer, win, "text_normal")
|
|
|
|
layer.set_font_size(15)
|
|
|
|
layer.move_to(
|
|
|
|
win.current["w"]/2-200,
|
|
|
|
win.current["h"]-115)
|
|
|
|
layer.show_text(talk.text("update_all")+" "+str(len(win.update["get_all_files"]))+" "+talk.text("files"))
|
|
|
|
|
|
|
|
|
2020-11-26 16:50:17 +01:00
|
|
|
|
|
|
|
# Install Updates button
|
|
|
|
try:
|
2021-01-11 20:07:16 +01:00
|
|
|
if win.update["count"] or win.settings["Update_all"]:
|
2020-11-26 16:50:17 +01:00
|
|
|
def do():
|
|
|
|
win.url = "install_updates"
|
|
|
|
win.update["frame"] = win.current["frame"]
|
|
|
|
|
|
|
|
|
|
|
|
UI_elements.roundrect(layer, win,
|
|
|
|
win.current["w"]/2+170,
|
|
|
|
win.current["h"]-140,
|
|
|
|
40,
|
|
|
|
40,
|
|
|
|
10,
|
|
|
|
button=do,
|
|
|
|
icon="ok",
|
|
|
|
tip=talk.text("update_install"))
|
|
|
|
except:
|
2021-01-11 20:07:16 +01:00
|
|
|
pass
|
2020-11-26 16:50:17 +01:00
|
|
|
|
|
|
|
# Clipping everything
|
|
|
|
UI_elements.roundrect(layer, win,
|
|
|
|
win.current["w"]/2-250,
|
|
|
|
100,
|
|
|
|
500,
|
|
|
|
win.current["h"]-260,
|
|
|
|
10,
|
|
|
|
fill=False)
|
|
|
|
layer.clip()
|
|
|
|
|
|
|
|
clip = [
|
|
|
|
win.current["w"]/2-250,
|
|
|
|
100,
|
|
|
|
500,
|
|
|
|
win.current["h"]-260]
|
|
|
|
|
|
|
|
# Setting up the scroll
|
|
|
|
if "pm_update" not in win.scroll:
|
|
|
|
win.scroll["pm_update"] = 0
|
|
|
|
|
|
|
|
current_Y = 0 # The max scroll value
|
|
|
|
|
|
|
|
for version in win.update["versions"]:
|
|
|
|
is_open = win.update["versions"][version]["open"]
|
|
|
|
files = win.update["versions"][version]["files"]
|
|
|
|
link = win.update["versions"][version]["link"]
|
|
|
|
|
|
|
|
|
|
|
|
if version == win.version:
|
|
|
|
UI_color.set(layer, win, "node_imagefile")
|
|
|
|
sufix = talk.text("update_current")
|
|
|
|
elif version < win.version:
|
|
|
|
UI_color.set(layer, win, "node_badfile")
|
|
|
|
sufix = talk.text("update_previous")
|
|
|
|
elif version > win.version:
|
|
|
|
UI_color.set(layer, win, "node_blendfile")
|
|
|
|
sufix = talk.text("update_available")
|
|
|
|
|
|
|
|
UI_elements.roundrect(layer, win,
|
|
|
|
win.current["w"]/2-240,
|
|
|
|
110 + current_Y + win.scroll["pm_update"],
|
|
|
|
450,
|
|
|
|
40,
|
|
|
|
10)
|
|
|
|
|
|
|
|
UI_color.set(layer, win, "text_normal")
|
|
|
|
layer.set_font_size(20)
|
|
|
|
layer.move_to(win.current["w"]/2-180,
|
|
|
|
current_Y + win.scroll["pm_update"] + 140)
|
|
|
|
layer.show_text(str(version)+" "+sufix)
|
|
|
|
|
|
|
|
def do():
|
2020-12-11 18:16:55 +01:00
|
|
|
|
2020-12-17 07:33:24 +01:00
|
|
|
oscalls.Open(link)
|
2020-11-26 16:50:17 +01:00
|
|
|
|
|
|
|
UI_elements.roundrect(layer, win,
|
|
|
|
win.current["w"]/2-200,
|
|
|
|
110 + current_Y + win.scroll["pm_update"],
|
|
|
|
410,
|
|
|
|
40,
|
|
|
|
10,
|
|
|
|
button=do,
|
|
|
|
tip=talk.text("update_read_version_notes"),
|
|
|
|
fill=False,
|
|
|
|
clip=clip)
|
|
|
|
layer.stroke()
|
|
|
|
|
|
|
|
# Open and Close button. A little side triangle thingy.
|
|
|
|
|
|
|
|
if is_open:
|
|
|
|
icon = "open"
|
|
|
|
expandcall = talk.text("Compress")
|
|
|
|
else:
|
|
|
|
icon = "closed"
|
|
|
|
expandcall = talk.text("Expand")
|
|
|
|
|
|
|
|
def do():
|
|
|
|
win.update["versions"][version]["open"] = not is_open
|
|
|
|
|
|
|
|
UI_elements.roundrect(layer, win,
|
|
|
|
win.current["w"]/2-240,
|
|
|
|
110 + current_Y + win.scroll["pm_update"],
|
|
|
|
40,
|
|
|
|
40,
|
|
|
|
10,
|
|
|
|
button=do,
|
|
|
|
icon=icon,
|
|
|
|
tip=expandcall,
|
|
|
|
clip=clip)
|
|
|
|
|
|
|
|
current_Y = current_Y + 50
|
|
|
|
|
|
|
|
if is_open:
|
|
|
|
for filename in files:
|
2020-12-01 18:34:36 +01:00
|
|
|
|
|
|
|
UI_color.set(layer, win, "button_active")
|
|
|
|
layer.move_to(win.current["w"]/2-227, 102 + current_Y + win.scroll["pm_update"])
|
|
|
|
layer.line_to(win.current["w"]/2-227, 152 + current_Y + win.scroll["pm_update"])
|
|
|
|
layer.stroke()
|
|
|
|
|
2020-11-26 16:50:17 +01:00
|
|
|
|
2021-03-03 15:53:06 +01:00
|
|
|
gitlink = "https://notabug.org/jyamihud/VCStudio/commits/master/"
|
2020-11-26 16:50:17 +01:00
|
|
|
def do():
|
2020-12-11 18:16:55 +01:00
|
|
|
oscalls.Open(gitlink+filename)
|
2020-11-26 16:50:17 +01:00
|
|
|
|
|
|
|
UI_elements.roundrect(layer, win,
|
2020-12-01 18:34:36 +01:00
|
|
|
win.current["w"]/2-220,
|
2020-11-26 16:50:17 +01:00
|
|
|
110 + current_Y + win.scroll["pm_update"],
|
2020-12-01 18:34:36 +01:00
|
|
|
430,
|
2020-11-26 16:50:17 +01:00
|
|
|
40,
|
|
|
|
10,
|
|
|
|
button=do,
|
2021-03-03 15:53:06 +01:00
|
|
|
tip=talk.text("update_see_history")+"\n"+gitlink+filename,
|
|
|
|
icon="notabug",
|
2020-11-26 16:50:17 +01:00
|
|
|
clip=clip)
|
|
|
|
layer.stroke()
|
2021-03-03 15:53:06 +01:00
|
|
|
|
|
|
|
UI_color.set(layer, win, "text_normal")
|
|
|
|
layer.set_font_size(15)
|
|
|
|
layer.move_to(win.current["w"]/2-170,
|
|
|
|
current_Y + win.scroll["pm_update"] + 140)
|
|
|
|
layer.show_text(str(filename))
|
|
|
|
|
|
|
|
|
2020-11-26 16:50:17 +01:00
|
|
|
current_Y = current_Y + 50
|
|
|
|
|
|
|
|
UI_elements.scroll_area(layer, win, "pm_update",
|
|
|
|
int(win.current["w"]/2-250),
|
|
|
|
100,
|
|
|
|
500,
|
|
|
|
win.current["h"]-260,
|
|
|
|
current_Y,
|
|
|
|
bar=True,
|
|
|
|
mmb=True,
|
|
|
|
url="update_layer"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
return surface
|