def __init__(self, pDefaultContent, pRootObj): self.DefaultContent = pDefaultContent self.RootObj = pRootObj self.ApplicationSelector = UI.ApplicationSelector( pDefaultContent, Core.MAIN.ScreenWidth / 2 - 550 / 2, Core.MAIN.ScreenHeight / 2 - 120 / 2) self.NoFoldersFound = False self.LoadApplicationsList() self.BottomButtonsList = Widget.Widget_Controller( pDefaultContent, (5, Core.MAIN.ScreenHeight - 50 - 5, Core.MAIN.ScreenWidth - 10, 50)) VersionText = "Taiyou Framework v" + CoreUtils.FormatNumber(Core.TaiyouGeneralVersion) + \ "\nTaiyou UI/Taskbar v" + Core.Get_TaiyouUIVersion() self.BottomButtonsList.Append( Widget.Widget_Label(pDefaultContent, "/Ubuntu_Bold.ttf", VersionText, 14, (200, 200, 200), 5, 5, 0)) self.ApplicationManagerBarAnimatorDisableToggle = True self.ApplicationManagerBarAnimator = CoreUtils.AnimationController(2) self.ApplicationManagerBarAnimator.Enabled = False self.ApplicationManagerBar = Widget.Widget_Controller( pDefaultContent, (5, 650, Core.MAIN.ScreenWidth - 10, 50)) self.ApplicationManagerBar.Append( Widget.Widget_Button(pDefaultContent, "Open Application", 14, 5, 5, 0)) self.ApplicationManagerEnabled = False self.TextsBaseX = 0 self.DisableInput = False
def ReloadImage(self): """ Reload all loaded images :return: """ print("Image.Reload : Reloading Images...") Unload() LoadImagesInFolder(Core.Get_GameSourceFolder()) print("Image.Reload : Operation Completed")
def Initialize(): global DISPLAY global ScreenWidth global ScreenHeight global EngineInitialized print("TaiyouFramework.Initialize : Initializing Taiyou...") # -- Load Engine -- # Core.Init() EngineInitialized = True print("TaiyouFramework.Initialize : Initialization complete.")
def RenderBottomInfosText(self, ContentsSurface): # Draw Bottom Text TitleText = "TaskBar v" + Core.Get_TaiyouUIVersion() TextY = 15 TitleFontSize = 12 TitleFont = "/Ubuntu_Bold.ttf" self.DefaultContent.FontRender( ContentsSurface, TitleFont, TitleFontSize, TitleText, (240, 240, 240), int(self.RootObj.Animation.Value - 255) / 10 + ContentsSurface.get_width() / 2 - self.DefaultContent.GetFont_width(TitleFont, TitleFontSize, TitleText) / 2, ContentsSurface.get_height() - self.DefaultContent.GetFont_height( TitleFont, TitleFontSize, TitleText) - TextY)
# You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # import pygame import System.Core as Core from Library import CoreEffects as Fx print("Taiyou FX version " + Core.Get_FXVersion()) def Simple_BlurredRectangle(SourceSurface, Rectangle, BlurAmmount=100, BackgroundAlpha=100, BackgroundFillColor=(0, 0, 0)): # Create new surface, blit SourceSurface ResultCeira = pygame.Surface((Rectangle[2], Rectangle[3])) ResultCeira.blit(SourceSurface, (0, 0), (Rectangle[0], Rectangle[1], Rectangle[2], Rectangle[3])) ResultCeira = Surface_Blur(ResultCeira, BlurAmmount) # Copy the ResultCeira surface, fill with Fill Color then set a Alpha Value BlackBG = ResultCeira.copy()
def Update(self): if self.ApplicationSeletor: self.ApplicationSeletorAnimatorStart.Update() if self.ApplicationSeletorAnimatorStart.Value <= 10 and not self.FatalErrorScreen: self.ApplicationSeletorAnimatorStart.Enabled = True if not self.ApplicationSeletorWelcomeSound and not self.FatalErrorScreen: self.ApplicationSeletorWelcomeSound = True self.DefaultContent.PlaySound("/intro.wav") return if self.ProgressProgression and not self.LoadingComplete: self.ProgressAddDelay += 1 if self.ProgressAddDelay == 5: self.ProgressAddDelay = 0 self.Progress += 1 if self.ProgressAddDelay == 1: self.LoadingSteps(self.Progress) if self.Progress >= self.ProgressMax and not self.LoadingComplete: self.LoadingComplete = True print("Taiyou.Bootloader : Loading Complete") # Start the Default Application CreatedProcessPID = 0 try: print( "Taiyou.Bootloader : Loading has been completed\nStarting user selected applicaton..." ) # Create the Application Process CreatedProcessPID = CoreAccess.CreateProcess( Core.GetUserSelectedApplication(), Core.GetUserSelectedApplication()) # Allow Window Manager to receive request WmControl.WindowManagerSignal(None, 4) # Kills the Bootloader process self.KillProcess(False) except Exception: print( "Taiyou.Bootloader : Fatal Error : Error while creating the process to the Auto-Start Application." ) Traceback = traceback.format_exc() print(Traceback) CoreAccess.KillProcessByPID(CreatedProcessPID) # Check if SelectedFile wax exists try: UserSelectedApplication = Core.GetUserSelectedApplication( ) self.GenerateCrashLog(Traceback, UserSelectedApplication) print( "Something bad happened while creating the process for the default application." ) self.FatalErrorScreen = True self.ApplicationSeletor = True self.APPLICATION_HAS_FOCUS = True except: print("Selected application file is not readable.") self.ApplicationSeletor = True self.APPLICATION_HAS_FOCUS = True
# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # import System.Core as Core from Library import CoreAccess import traceback # The main Entry Point print("Taiyou Window Manager Manager (WMM) version " + Core.Get_WindowManagerManagerVersion()) TaskBarUIProcessID = -1 def CallWindowManagerUI(): try: process_obj = Core.ProcessAccess[TaskBarUIProcessID] process_obj.UI_Call_Request() except: print("Error while processing WindowManager call request.") def GetWindowManager(): return Core.ProcessAccess[TaskBarUIProcessID]
# # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # import pygame import Library.CoreContentManager as CntMng import System.Core as tge from Library import CoreUtils as UTILS print("Taiyou SHAPE version: " + tge.Get_ShapeVersion()) PreRenderedRects_Keys = list() PreRenderedRects_Results = list() def ClearPreRendered_Rectangles(): global PreRenderedRects_Keys global PreRenderedRects_Results PreRenderedRects_Keys.clear() PreRenderedRects_Results.clear() def Shape_Rectangle(DISPLAY, Color,
def CreateProcess(Path, ProcessName, pInitArgs=None): """ Set the Application Object :param ApplicationFolder:Folder Path :return: """ global ProcessNextPID global LastProcessWasErrorProcess global LastProcess print("CoreAccess.CreateProcess : Creating Process: [" + ProcessName + "]...") try: # Get Process Path Path = Path.replace("/", CorePaths.TaiyouPath_CorrectSlash) ProcessIndex = len(ProcessAccess_PID) ProcessNextPID += 1 # Import Module Module = importlib.import_module(Core.Get_MainModuleName(Path)) try: # Get Process Object from Module ProcessWax = Module.Process(ProcessNextPID, ProcessName, Core.Get_MainModuleName(Path), pInitArgs, ProcessIndex) except: # Unload Module del Module # Check if module is imported and remove it if Core.Get_MainModuleName(Path) in sys.modules: sys.modules.pop(Core.Get_MainModuleName(Path)) UTILS.GarbageCollector_Collect() # Unload Module del Module # Check if module is imported and remove it if Core.Get_MainModuleName(Path) in sys.modules: sys.modules.pop(Core.Get_MainModuleName(Path)) UTILS.GarbageCollector_Collect() # Start process thread with UpdateRequest Function Thread = threading.Thread(target=ProcessWax.UpdateRequest).start() # Set THIS_THREAD Variable to Process ProcessWax.THIS_THREAD = Thread print("CoreAccess.CreateProcess : Process created sucefully") # Return newly created process PID LastProcessWasErrorProcess = False LastProcess = None return ProcessNextPID except: print("CoreAccess.CreateProcess : Error while creating process.") print(traceback.format_exc()) if not LastProcessWasErrorProcess: LastProcessWasErrorProcess = True try: LastProcess.KillProcess(False) LastProcess = None except: print( "Core.Main.CreateProcess : Error while trying to kill process" ) CreateProcess( "System{0}SystemApps{0}crash_dialog".format( CorePaths.TaiyouPath_CorrectSlash), "application_crash", (ProcessName, None, None, 1))
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # # -- Imports -- import System.Core as Core import pygame import numpy as np import os, time, numpy, math from Library import CoreUtils as UTILS from Library import CorePrimitives as Shape from Library import CorePaths print("Taiyou ContentManager version " + Core.Get_ContentManagerVersion()) DefaultImage = None FontRenderingDisabled = False ImageRenderingDisabled = False RectangleRenderingDisabled = False ImageTransparency = False SoundDisabled = False def InitModule(): global DefaultImage DefaultImage = pygame.image.load("{0}img/default.png".format( CorePaths.TaiyouPath_SystemDataPath))
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # # Import some stuff import System.Core as Core from Library import CoreUtils as UTILS from Library import CorePrimitives as Shape from Library import CorePaths from Library import CoreAccess import pygame, sys, importlib, threading, traceback # The main Entry Point print("Taiyou Main version " + Core.Get_TaiyouMainVersion()) # -- Variables -- # FPS = 75 ScreenWidth = 1024 ScreenHeight = 720 WorkObject = None InitDelay_Delta = 0 InitDelay_Enabled = True EngineInitialized = False ErrorScreenInitialzed = False ThrowException = True SystemFault_Trigger = False SystemFault_Traceback = "" SystemFault_ProcessObject = None timer = pygame.time.Clock()
# # # -- Imports -- # import System.Core as tge import os, shutil, requests, string, random, threading, zipfile, urllib.request, gc, psutil, collections, time from pathlib import Path from urllib.error import HTTPError from PIL import Image import numpy as np import scipy import scipy.misc import scipy.cluster import Library.CoreUtils.Convert print("Taiyou Utils version " + tge.Get_UtilsVersion()) def Directory_FilesList(dirName): """ Get a list of files in a Directory :param dirName:Directory Path :return: """ # -- Create a list with all files in Directory -- # listOfFile = os.listdir(dirName) allFiles = list() for entry in listOfFile: fullPath = os.path.join(dirName, entry) if os.path.isdir(fullPath):
# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # # -- Imports -- import System.Core as Core import os, platform, getpass from Library import CoreUtils print("CorePaths version " + Core.Get_CorePathsVersion()) TaiyouPath_SystemPath = "" TaiyouPath_SystemRootPath = "" TaiyouPath_AppDataFolder = "" TaiyouPath_CorrectSlash = "" TaiyouPath_TaiyouConfigFile = "" TaiyouPath_RootDevice = "" TaiyouPath_ApplicationsDataPath = "" TaiyouPath_SystemDataPath = "" TaiyouPath_UserPackpagesPath = "" TaiyouPath_UserPath = "" TaiyouPath_UserTempFolder = "" TaiyouPath_ApplicationsFolder = "" TaiyouPath_SystemApplicationsFolder = "" TaiyouPath_ApplicationsDataFolder = ""