Upload files to 'project_manager'

This commit is contained in:
jyamihud 2020-11-26 15:50:17 +00:00
parent 6b64413cd1
commit aecb1c333c
5 changed files with 351 additions and 0 deletions

View file

@ -0,0 +1,221 @@
# 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
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"))
# Install Updates button
try:
if win.update["count"]:
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:
pass
# 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():
os.system("xdg-open "+link.replace("(", "\(").replace(")", "\)"))
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:
UI_color.set(layer, win, "text_normal")
layer.set_font_size(15)
layer.move_to(win.current["w"]/2-180,
current_Y + win.scroll["pm_update"] + 140)
layer.show_text(str(filename))
def do():
gitlink = "https://github.com/JYamihud/VCStudio/commits/main/"
os.system("xdg-open "+gitlink+filename)
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_see_history"),
fill=False,
clip=clip)
layer.stroke()
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

View file

@ -0,0 +1,3 @@
/home/vcs/Projects/Films/Shorts/MoriasRace
/home/vcs/Desktop/test1
/home/vcs/Desktop/Имя_нового_проэкта

View file

@ -0,0 +1 @@
404: Not Found

View file

@ -0,0 +1,104 @@
# THIS FILE IS A PART OF VCStudio
# PYTHON 3
import os
from subprocess import *
def get_update_info(win):
# In the GTK version you could make updates by downloading new versions of
# the files from the GIT repository. But it's not an easy thing to set up
# seamlessly for the user. IK because similar system is already in place
# for the Blender-Organizer.
# This system will be somewhat simplified in the UI side of things. But a
# tiny bit more complex from the underliying system. For example. In the old
# release there was no notification of the update.
# So this function here will check for updates.
# Now I have no idea how to implement update notifications. And whether I
# should in the first place. In the old update system I had often made
# easy to fix mistakes. But I was relying a little bit on the fact that
# people don't see immediatly that the update is available. Which I could
# use to fix all the mistakes I found without calling a whole another
# version. Maybe it's a good thing here too.
# I think that since VCStudio Project-Manager is going to be ran as a kind
# of launcher thingy... People will more often use the VCStudio it self and
# rearly the launcher. And so, some kind of automatic update check could be
# done. And no nasty notification. Just a number on the update icon.
# Now to make it work. I need to separate the reading of network to a separate
# python file. update_request.py . That I gonna run as a subprocess to this
# file.
# The updating it self will have to be confirmed by the user. For which will
# need a UI layer. pm_updateLayer.py and a update download file for actually
# donloading and saving those files. update_download.py
# So let's start already.
if "request" not in win.update:
# This is going to open a SUBPROCESS for the getting of the update info
# I'm doing it like this so there will not be lag.
win.update["request"] = Popen(['stdbuf', '-o0', "python3", \
os.getcwd()+"/project_manager/update_request.py"],\
stdout=PIPE, universal_newlines=True)
win.update["versions"] = {}
win.update["get_files"] = []
elif "END" not in win.update:
# This going to read lines returned by the process on every frame.
line = win.update["request"].stdout.readline()[:-1]
if line:
if line.startswith("VERSION "):
try:
now_version = float(line.replace("VERSION ", ""))
if "count" not in win.update:
win.update["count"] = 0
if now_version > win.version:
win.update["count"] += 1
win.update["now_version"] = now_version
if now_version not in win.update["versions"]:
win.update["versions"][now_version] = {
"open":False,
"files":[],
"link":"https://github.com/JYamihud/VCStudio"
}
except:
raise()
pass
elif line.startswith("["):
try:
win.update["versions"][win.update["now_version"]]["link"] = \
line[1:-1]
except:
pass
elif line != "END":
try:
win.update["versions"][win.update["now_version"]]["files"]\
.append(line)
if win.update["now_version"] > win.version:
if line not in win.update["get_files"]:
win.update["get_files"].append(line)
except:
pass
# To end the reading non-sense
if line == "END":
win.update["END"] = True

View file

@ -0,0 +1,22 @@
# THIS FILE IS A PART OF VCStudio
# PYTHON 3
import urllib3
# This file requests a update from the GITHUB reposytory containing the update
# information.
filepath = "https://raw.githubusercontent.com/JYamihud/VCStudio/main/settings/update.data"
# Those 3 lines basically retrieve the file from the internet and output them
# to the console. Which I'm catching in the update_reader.py using a Pipe.
try:
http = urllib3.PoolManager()
resp = http.request('GET', filepath)
print(resp.data.decode('utf-8'))
except:
data = open("settings/update.data")
print(data.read())
print("END")