From ff3f1e710104d9e12775ca8515c0ff3d05347768 Mon Sep 17 00:00:00 2001 From: "Jeison Yehuda Amihud (Blender Dumbass)" Date: Mon, 11 Jan 2021 20:48:25 +0000 Subject: [PATCH] Terminal Mode ( Studio ) Some changes for the terminal mode. And also some changes to support cursor changes. Might have a weird effect on the Operating System. --- project_manager/pm_console.py | 9 ++++++++- project_manager/pm_gtk.py | 13 +++++++++++++ project_manager/pm_project.py | 10 ++++++++-- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/project_manager/pm_console.py b/project_manager/pm_console.py index 9ca3ab6..ece2366 100644 --- a/project_manager/pm_console.py +++ b/project_manager/pm_console.py @@ -4,7 +4,10 @@ # This a console project manager. import os -w, h = os.get_terminal_size() +try: + w, h = os.get_terminal_size() +except: + w, h, = 50,50 from settings import settings from settings import talk @@ -47,6 +50,8 @@ def cls(): #cleaning the terminal os.system("clear") + + def run(): cls() @@ -141,6 +146,8 @@ def run(): elif command == "project": + commands = pm_project.get_list() + n = input("\033[1;33m : ") print("\033[1;35m "+talk.text("Wait")) pm_project.load(n) diff --git a/project_manager/pm_gtk.py b/project_manager/pm_gtk.py index c7eadf3..54eb10a 100644 --- a/project_manager/pm_gtk.py +++ b/project_manager/pm_gtk.py @@ -8,6 +8,7 @@ import datetime import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk +from gi.repository import Gdk from gi.repository import GLib import cairo import threading @@ -163,6 +164,16 @@ def pmdrawing(pmdrawing, main_layer, win): win.sFPS = datetime.datetime.now() + win.cursors = { + "arrow":Gdk.Cursor.new(Gdk.CursorType.ARROW), + "watch":Gdk.Cursor.new(Gdk.CursorType.WATCH), + "text" :Gdk.Cursor.new(Gdk.CursorType.XTERM), + "hand" :Gdk.Cursor.new(Gdk.CursorType.HAND1), + "cross":Gdk.Cursor.new(Gdk.CursorType.CROSS) + } + win.current["cursor"] = win.cursors["arrow"] + + # Getting update info. I've added a bit of delay. So the starting of the # Popen would not be noticed by the user as much. #if win.current["frame"] > 50: @@ -235,6 +246,8 @@ def pmdrawing(pmdrawing, main_layer, win): main_layer.set_source_surface(layer, 0 , 0) main_layer.paint() + win.get_root_window().set_cursor(win.current["cursor"]) + # If you press ESC you get back from any window to the main menu. if 65307 in win.current["keys"] and win.url != "install_updates": win.url = "project_manager" diff --git a/project_manager/pm_project.py b/project_manager/pm_project.py index b3935c6..a585257 100644 --- a/project_manager/pm_project.py +++ b/project_manager/pm_project.py @@ -1,13 +1,14 @@ # THIS FILE IS A PART OF VCStudio # PYTHON 3 -# this file handles language import os +import sys import subprocess from settings import settings from settings import talk from studio import studio_gtk +from studio_console import sc_main from gi.repository import GLib def new(name): @@ -110,7 +111,12 @@ def load(path, win=False): #if new if not is_legacy(path): - studio_gtk.run(path, win) + + # Console mode + if len(sys.argv) > 1 and sys.argv[1] == "-c": + sc_main.run(path) + else: + studio_gtk.run(path, win) #old organizer else: