コード例 #1
0
ファイル: __init__.py プロジェクト: aragubas/taiyou-framework
    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
コード例 #2
0
ファイル: __init__.py プロジェクト: aragubas/taiyou-framework
def GetAppDataFromAppName(AppName):
    Path = "{1}{0}".format(AppName, TaiyouPath_AppDataFolder)

    # Check if path exists
    if not CoreUtils.Directory_Exists(Path):
        CoreUtils.Directory_MakeDir(Path)

    return Path
コード例 #3
0
ファイル: __init__.py プロジェクト: aragubas/taiyou-framework
    def LoadRegKeysInFolder(self):
        """
        Load all keys on Specified Folder
        :param reg_dir:Specified Folder
        :return:
        """
        if self.Reg_Path == "":
            raise Exception("Registry Path was not set.")

        reg_dir = self.Reg_Path
        # -- FIX for working on Windows -- #
        self.Reg_Path = self.SourceFolder + reg_dir.replace(
            self.SourceFolder, "")
        self.Reg_Path = self.Reg_Path.replace(
            "/", CorePaths.TaiyouPath_CorrectSlash)

        start_time = time.time()
        # -- Unload the Registry -- #
        self.UnloadRegistry()

        print("Taiyou.ContentManager.LoadRegistry : Loading Registry...")

        temp_reg_keys = UTILS.Directory_FilesList(reg_dir)
        index = -1

        for x in temp_reg_keys:
            if self.StopLongOperations:
                break

            index += 1

            CorrectKeyName = x.replace(reg_dir, "").replace(".data", "")
            file = open(x, "r")

            CurrentLine = file.read().splitlines()
            AllData = ""
            for x in CurrentLine:
                if not x.startswith("#"):
                    AllData += x + "\n"

            # -- Format the Text -- #
            AllData = AllData.rstrip().replace("%n", "\n").replace(
                "%t", "\t").replace("%s", " ")

            self.reg_keys.append(CorrectKeyName)
            self.reg_contents.append(AllData)

            print("Taiyou.ContentManager.LoadRegistry : KeyLoaded[" +
                  CorrectKeyName + "]")

        print(
            "Taiyou.ContentManager.LoadRegistry : Total of {0} registry keys loaded. In {1} seconds."
            .format(str(len(self.reg_keys)),
                    UTILS.FormatNumber(time.time() - start_time, 4)))

        UTILS.GarbageCollector_Collect()
コード例 #4
0
ファイル: __init__.py プロジェクト: aragubas/taiyou-framework
    def UnloadSoundTuneCache(self):
        print(
            "ContentManager.UnloadSoundTuneCache : Clearing FrequencyGenerator Cache..."
        )
        self.SoundTuneCache_Cache.clear()
        self.SoundTuneCache_Names.clear()
        UTILS.GarbageCollector_Collect()

        del self.SoundTuneCache_Cache
        del self.SoundTuneCache_Names
        UTILS.GarbageCollector_Collect()

        self.SoundTuneCache_Cache = list()
        self.SoundTuneCache_Names = list()
        UTILS.GarbageCollector_Collect()
        print("ContentManager.UnloadSoundTuneCache : Done")
コード例 #5
0
def PreRender_ShapeRectangle(Rectangle, Color, BorderRadius,
                             Border_TopRight_Radius, Border_TopLeft_Radius,
                             Border_BottomLeft_Radius,
                             Border_BottomRight_Radius, BorderWidth,
                             DrawLines):
    PreRenderSurface = pygame.Surface(
        (Rectangle[2], Rectangle[3]),
        pygame.SRCALPHA | pygame.HWACCEL | pygame.HWSURFACE)

    # -- Fix the Color Range -- #
    Color = UTILS.FixColorRange(Color)

    # Set Opacity
    PreRenderSurface.set_alpha(Color[3])

    # -- Border Radius-- #
    if BorderRadius > 0 and Border_TopRight_Radius == 0 and Border_TopLeft_Radius == 0 and Border_BottomLeft_Radius == 0 and Border_BottomRight_Radius == 0:
        Border_TopRight_Radius = BorderRadius
        Border_TopLeft_Radius = BorderRadius
        Border_BottomRight_Radius = BorderRadius
        Border_BottomLeft_Radius = BorderRadius

    # -- Render the Rectangle -- #
    if not DrawLines:
        pygame.draw.rect(PreRenderSurface, Color,
                         (0, 0, Rectangle[2], Rectangle[3]), BorderWidth,
                         BorderRadius, Border_TopLeft_Radius,
                         Border_TopRight_Radius, Border_BottomLeft_Radius,
                         Border_BottomRight_Radius)

    else:
        gFxdraw.rectangle(PreRenderSurface, (0, 0, Rectangle[2], Rectangle[3]),
                          Color)

    return PreRenderSurface
コード例 #6
0
def Shape_Line(DISPLAY,
               Color,
               startX,
               startY,
               endX,
               endY,
               LineWidth,
               FoldLine=True):
    """
    Draw a Line
    :param DISPLAY:Surface to be drawn
    :param Color:Color (RGB)
    :param startX:Line StartX
    :param startY:Line StartY
    :param endX:Line EndX
    :param endY:Line EndY
    :param LineWidth:Line Width
    :param FoldLine:Fold the line when getting offscreen
    :return:
    """
    # -- Fix the Color Range -- #
    Color = UTILS.FixColorRange(Color)

    if FoldLine:
        if endX > DISPLAY.get_width():
            endX = DISPLAY.get_width()
        if endY > DISPLAY.get_height():
            endY = DISPLAY.get_height()

        if startX < 0:
            startX = 0
        if startY < 0:
            startY = 0

    pygame.draw.line(DISPLAY, Color, (startX, startY), (endX, endY), LineWidth)
コード例 #7
0
ファイル: __init__.py プロジェクト: aragubas/taiyou-framework
    def FinishInstalation(self, DeleteExtractPath=False):
        print("Instalation has been completed.")
        self.PackpageInstalationEnabled = False
        self.PackpageInstalationStepNextDelay = 0
        self.IgnorePackpageReplace = False
        self.PackpageReplaceWarning = False
        self.BackFromPackpageReplaceWarning = False
        self.InstalationCompleteDeletePackpage = False

        if DeleteExtractPath:
            CoreUtils.Directory_Remove(self.ExtractPath)

        if self.PackpageInstalationStep >= self.PackpageInstalationStepMax:
            self.SetStatusText(self.ContentManager.Get_RegKey("/strings/packpage_install_complete").format(self.SelectedPackpage))

        else:
            self.SetStatusText(self.ContentManager.Get_RegKey("/strings/packpage_install_error").format(self.SelectedPackpage))

        self.PackpageInstalationStep = 0

        # Re-Enable the Install Button
        self.DownToolbar.GetWidget(1).IsVisible = True
        self.DownToolbar.GetWidget(2).IsVisible = False
        self.DownToolbar.GetWidget(3).IsVisible = False
        self.DownToolbar.GetWidget(4).IsVisible = False

        self.SelectedPackpage = ""
        self.UpdatePackpageList()
コード例 #8
0
def Shape_Circle(DISPLAY,
                 X,
                 Y,
                 Radius,
                 Color,
                 Width=0,
                 draw_top_right=False,
                 draw_top_left=False,
                 draw_bottom_left=False,
                 draw_bottom_right=False):
    """
    Draw a Circle
    :param DISPLAY:Surface to draw
    :param X:Circle X
    :param Y:Circle Y
    :param Radius:Circle Radius
    :param Color:Color (RGB)
    :param Width:Circle Width
    :param draw_top_right:Draw top right
    :param draw_top_left:Draw top left
    :param draw_bottom_left:Draw bottom left
    :param draw_bottom_right:Draw bottom right
    :return:
    """
    if X - Radius < DISPLAY.get_width() and Y - Radius < DISPLAY.get_height(
    ) and X > -Radius and Y > -Radius and Radius > 1:
        Color = UTILS.FixColorRange(Color)

        pygame.draw.circle(DISPLAY, Color, (X, Y), Radius, Width,
                           draw_top_right, draw_top_left, draw_bottom_left,
                           draw_bottom_right)
コード例 #9
0
ファイル: __init__.py プロジェクト: aragubas/taiyou-framework
    def UnloadImage(self):
        """
        Unload all loaded sprites
        :return:
        """
        print("Image.Unload : Unloading Images...")
        UTILS.GarbageCollector_Collect()
        del self.Images_Data
        del self.Images_Name
        del CurrentLoadedFonts_Name
        UTILS.GarbageCollector_Collect()

        self.Images_Data = list()
        self.Images_Name = list()

        print("Image.Unload : Done")
コード例 #10
0
ファイル: __init__.py プロジェクト: aragubas/OneTrack
def NewMusicFile():
    global track_list

    track_list = UI.TrackList()
    Utils.GarbageCollector_Collect()

    # -- Unload the Current SoundCahce -- #
    UI.ContentManager.UnloadSoundTuneCache()

    # -- Update Tittlebar -- #
    var.ProcessReference.TITLEBAR_TEXT = "OneTrack v{0}".format(
        var.ProcessReference.DefaultContents.Get_RegKey("/version"))

    track_list = UI.TrackList()
    track_list.Rectangle = pygame.Rect(0, 100, Core.MAIN.ScreenWidth,
                                       Core.MAIN.ScreenHeight - 200)

    var.BPM = 150
    var.Rows = 32
    var.GenerateSoundCache = True
    var.SelectedTrack = 0
    var.Highlight = 4
    var.HighlightSecond = 16
    var.Patterns = 2

    OptionsBar.UpdateChanger()
    OptionsBar.Update()

    var.ProcessReference.DefaultContents.Write_RegKey(
        "/dialog/imported_older_version/show_once", "False")
コード例 #11
0
ファイル: __init__.py プロジェクト: aragubas/taiyou-framework
    def Draw(self, ContentsSurface):
        # Draw the title
        try:
            ProcessName = Core.MAIN.SystemFault_ProcessObject.NAME
        except:
            ProcessName = "Unknown"

        TitleText = "The process {0} has failed.".format(
            CoreUtils.ShortString(ProcessName, 40))
        TitleFontSize = 22
        TitleFont = "/Ubuntu_Bold.ttf"
        self.DefaultContent.FontRender(
            ContentsSurface, TitleFont, TitleFontSize, TitleText,
            (240, 240, 240),
            ContentsSurface.get_width() / 2 -
            self.DefaultContent.GetFont_width(TitleFont, TitleFontSize,
                                              TitleText) / 2, 15)

        # Draw the SystemFault message
        try:
            TitleText = "Title : {0}\nPID : {1}\nExecPath : {2}\n\nDetails about the crash has been saved on logs folder\nlocated in: <root>/logs/.".format(
                Core.CoreUtils.ShortString(
                    Core.MAIN.SystemFault_ProcessObject.TITLEBAR_TEXT, 35),
                str(Core.MAIN.SystemFault_ProcessObject.PID),
                Core.CoreUtils.ShortString(
                    Core.MAIN.SystemFault_ProcessObject.ROOT_MODULE, 35))
        except:
            TitleText = "Cannot obtain process information."
        TitleFontSize = 14
        TitleFont = "/Ubuntu.ttf"
        X = ContentsSurface.get_width() / 2 - self.DefaultContent.GetFont_width(
            TitleFont, TitleFontSize, TitleText) / 2
        Y = 55
        self.DefaultContent.FontRender(ContentsSurface, TitleFont,
                                       TitleFontSize, TitleText,
                                       (240, 240, 240), X + 50, Y)

        # Draw the Warning Icon
        self.DefaultContent.ImageRender(ContentsSurface, "/warning.png",
                                        X - 97, Y, 95, 97, True)

        # Draw the Traceback Text
        self.DefaultContent.FontRender(ContentsSurface, "/Ubuntu.ttf", 12,
                                       Core.MAIN.SystemFault_Traceback,
                                       (240, 240, 240), 2, 175)

        # Draw Bottom Text
        TitleText = "Press [F11] to exit."
        TitleFontSize = 14
        TitleFont = "/Ubuntu_Lite.ttf"
        self.DefaultContent.FontRender(
            ContentsSurface, TitleFont, TitleFontSize, TitleText,
            (240, 240, 240),
            ContentsSurface.get_width() / 2 -
            self.DefaultContent.GetFont_width(TitleFont, TitleFontSize,
                                              TitleText) / 2,
            ContentsSurface.get_height() - self.DefaultContent.GetFont_height(
                TitleFont, TitleFontSize, TitleText) - 15)
コード例 #12
0
ファイル: __init__.py プロジェクト: aragubas/taiyou-framework
def GenerateCrashLog():
    print("Generating crash log...")
    # Create the directory for the Crash Logs
    CrashLogsDir = "./Logs/".replace("/", CorePaths.TaiyouPath_CorrectSlash)
    UTILS.Directory_MakeDir(CrashLogsDir)

    try:
        FilePath = CrashLogsDir + SystemFault_ProcessObject.NAME + ".txt"
    except:
        FilePath = CrashLogsDir + "unknow_process_name.txt"

    ProcessInformation = " --- PROCESS INFORMATION ---\n"

    ProcessInformation += "Name:"
    try:
        ProcessInformation += SystemFault_ProcessObject.NAME + "\n"
    except:
        ProcessInformation += "Error while parsing\n"

    ProcessInformation += "PID:"
    try:
        ProcessInformation += SystemFault_ProcessObject.PID + "\n"
    except:
        ProcessInformation += "Error while parsing\n"

    ProcessInformation += "ModulePath:"
    try:
        ProcessInformation += SystemFault_ProcessObject.ROOT_MODULE + "\n"
    except:
        ProcessInformation += "Error while parsing\n"

    ProcessInformation += "IsFullscreen:"
    try:
        ProcessInformation += SystemFault_ProcessObject.FULLSCREEN + "\n"
    except:
        ProcessInformation += "Error while parsing\n"

    ProcessInformation += "HasFocus:"
    try:
        ProcessInformation += SystemFault_ProcessObject.APPLICATION_HAS_FOCUS + "\n"
    except:
        ProcessInformation += "Error while parsing\n"

    ProcessInformation += "TitlebarText:"
    try:
        ProcessInformation += SystemFault_ProcessObject.TITLEBAR_TEXT + "\n"
    except:
        ProcessInformation += "Error while parsing\n"

    ProcessInformation += "\nAny field with 'Error while parsing' was because the process does not actualy have the variable\n\n --- ERROR TRACEBACK ---"

    FileWrite = open(FilePath, "w")
    FileWrite.write(ProcessInformation)
    FileWrite.write(SystemFault_Traceback)
    FileWrite.close()

    print("Crash log completed")
コード例 #13
0
ファイル: __init__.py プロジェクト: aragubas/taiyou-framework
def SetDisplay():
    global DISPLAY
    if not Core.RunInFullScreen:
        DISPLAY = pygame.display.set_mode((Core.MAIN.ScreenWidth, Core.MAIN.ScreenHeight), pygame.DOUBLEBUF | pygame.HWACCEL | pygame.HWSURFACE)

    else:
        DISPLAY = pygame.display.set_mode((Core.MAIN.ScreenWidth, Core.MAIN.ScreenHeight), pygame.DOUBLEBUF | pygame.HWACCEL | pygame.HWSURFACE | pygame.FULLSCREEN)

    pygame.display.set_caption("Taiyou Framework v" + UTILS.FormatNumber(Core.TaiyouGeneralVersion))
コード例 #14
0
ファイル: __init__.py プロジェクト: aragubas/taiyou-framework
    def ReloadRegistry(self):
        """
        Reload all Registry Keys
        :return:
        """
        print("Taiyou.ContentManager.ReloadRegistry : Reloading Registry...")
        self.UnloadRegistry()

        self.LoadRegKeysInFolder()

        UTILS.GarbageCollector_Collect()
コード例 #15
0
ファイル: __init__.py プロジェクト: aragubas/taiyou-framework
    def UnloadRegistry(self):
        """
        Unload all registry keys
        :return:
        """

        # -- Clear the Registry -- #
        print("Taiyou.ContentManager.UnloadRegistry : Unloading Registry")
        self.reg_keys = list()
        self.reg_contents = list()

        UTILS.GarbageCollector_Collect()
コード例 #16
0
ファイル: __init__.py プロジェクト: aragubas/taiyou-framework
def KillProcessByPID(PID):
    global ProcessListChanged
    Index = GetProcessIndexByPID(PID)

    # Call SIG_KILL Function on Process
    ProcessAccess[ProcessAccess_PID.index(PID)].KillProcess(False)

    UTILS.GarbageCollector_Collect()

    print("Taiyou : Finished process index: " + str(Index))

    #ProcessListChanged = True

    ClearPreRendered()
コード例 #17
0
ファイル: __init__.py プロジェクト: aragubas/taiyou-framework
    def LoadApplicationsList(self):
        # List all valid folders
        folder_list = CoreUtils.Directory_FilesList(
            "." + CorePaths.TaiyouPath_CorrectSlash)
        BootFolders = list()
        for file in folder_list:
            if file.endswith(CorePaths.TaiyouPath_CorrectSlash + "boot"):
                BootFolders.append(file)

        ListInstalledApplications(BootFolders, self.ApplicationSelector)

        if len(BootFolders) == 0 or len(
                self.ApplicationSelector.SeletorItems_ModulePath) == 0:
            self.NoFoldersFound = True
コード例 #18
0
ファイル: __init__.py プロジェクト: aragubas/taiyou-framework
    def FontRender(self,
                   DISPLAY,
                   FontFileLocation,
                   Size,
                   Text,
                   ColorRGB,
                   X,
                   Y,
                   antialias=True,
                   Opacity=255):
        """
        Render a Text using a font loaded into Taiyou Font Cache
        :param DISPLAY:Surface Name
        :param FontFileLocation:Font Resource Name [starting with /]
        :param Size:Font Size
        :param Text:Text to be Rendered
        :param ColorRGB:Color in RGB Format [R, G, B]
        :param X:X Location
        :param Y:Y Location
        :param antialias:Smooth Pixels [This option can decrea se peformace]
        :return:
        """
        if not FontRenderingDisabled:
            # -- Get the FontFileObject, required for all functions here -- #
            FontFileObject = self.GetFont_object(FontFileLocation, Size)
            ColorRGB = UTILS.FixColorRange(ColorRGB)

            if X <= DISPLAY.get_width(
            ) and Y <= DISPLAY.get_height() and X >= -FontFileObject.render(
                    Text, antialias, ColorRGB
            ).get_width() and Y >= -FontFileObject.render(
                    Text, antialias, ColorRGB).get_height() and not Text == "":
                # -- Fix Opacity Range -- #
                if Opacity < 0:
                    Opacity = 0
                if Opacity > 255:
                    Opacity = 255

                # -- Render Multiple Lines -- #
                for i, l in enumerate(Text.splitlines()):
                    # FontSurface Object
                    FontSurface = FontFileObject.render(l, antialias, ColorRGB)

                    # Set Font Opacity
                    FontSurface.set_alpha(Opacity)

                    # Blit Font Surface
                    DISPLAY.blit(FontSurface, (X, Y + Size * i))
コード例 #19
0
ファイル: __init__.py プロジェクト: aragubas/taiyou-framework
    def DrawProgressBar(self, DISPLAY):
        self.LoadingBarPos = (DISPLAY.get_width() / 2 - 250 / 2,
                              DISPLAY.get_height() / 2 + 10 / 2, 250, 10)
        self.LoadingBarProgress = (self.LoadingBarPos[0],
                                   self.LoadingBarPos[1],
                                   max(
                                       10,
                                       UTILS.Get_Percentage(
                                           self.Progress,
                                           self.LoadingBarPos[2],
                                           self.ProgressMax)), 10)

        Shape.Shape_Rectangle(DISPLAY, (20, 20, 58), self.LoadingBarPos, 0,
                              self.LoadingBarPos[3])
        Shape.Shape_Rectangle(DISPLAY, (94, 114, 219), self.LoadingBarProgress,
                              0, self.LoadingBarPos[3])
コード例 #20
0
ファイル: __init__.py プロジェクト: aragubas/taiyou-framework
    def LoadImage(self, ImagePath, Transparency=False):
        """
        Load the Specified Image
        :param ImagePath:Path to the Specified Image
        :param Transparency:Bool Value to import with transparency or not
        :return:
        """
        if UTILS.Directory_Exists(ImagePath):
            self.Images_Name.append(Core.TaiyouPath_CorrectSlash +
                                    os.path.basename(ImagePath))

            if Transparency:
                self.Images_Data.append(
                    pygame.image.load(ImagePath).convert_alpha())

            else:
                self.Images_Data.append(pygame.image.load(ImagePath).convert())
コード例 #21
0
    def KillProcess(self, WhenKilled=True):
        """
        This function is called when the processing is being closed by Taiyou [Unsafe to Override]
        :return:
        """
        print("Process [{0}] has received kill request.".format(self.TITLEBAR_TEXT))
        CoreAccess.RemoveFromCoreAccess(self)
        if self.IS_GRAPHICAL:
            self.KillDrawThread()

        self.Running = False

        if WhenKilled:
            self.WhenKilled()

        del self
        UTILS.GarbageCollector_Collect()
コード例 #22
0
ファイル: __init__.py プロジェクト: aragubas/taiyou-framework
    def __init__(self, pDefaultContent, pRootProcess):
        self.Enabled = False
        self.DisableToggle = False
        self.RootProcess = pRootProcess
        self.Animation = CoreUtils.AnimationController(3,
                                                       multiplierRestart=True)
        self.CurrentMode = None
        self.GoToModeWhenReturning = None
        self.DefaultContent = pDefaultContent
        self.LastDisplayFrame = pygame.Surface(
            (Core.MAIN.ScreenWidth, Core.MAIN.ScreenHeight),
            pygame.HWACCEL | pygame.HWSURFACE)
        self.Workaround_RenderLastFrame = False
        self.BluredBackgroundResult = pygame.Surface(
            (0, 0), pygame.HWACCEL | pygame.HWSURFACE)

        self.SetMode(0)
コード例 #23
0
    def UpdateFileList(self):
        print("Load : Updating File List...")
        self.FolderList.ClearItems()
        AllFilesInDir = Utils.Directory_FilesList(
            CorePaths.GetAppDataFromAppName("OneTrack"))

        for file in AllFilesInDir:
            # Check if file is a valid OneTrack Project
            if file.endswith(".oneprj"):
                FileAllPath = file
                FileName = file.replace(
                    CorePaths.GetAppDataFromAppName("OneTrack"),
                    "").replace(".oneprj", "")

                ItemName = FileName[1:]
                ItemDescription = "Saved on: {0}".format(FileAllPath)

                self.FolderList.AddItem(ItemName, ItemDescription)
コード例 #24
0
ファイル: __init__.py プロジェクト: aragubas/OneTrack
def Initialize(self):
    global LagIndicatorSurface
    global LagTextWidth
    global LagTextHeight
    global LagTextColor
    global FlashingAnimation
    global ProcessInstanceRefence

    ProcessInstanceRefence = self

    LagTextWidth = UI.ContentManager.GetFont_width("/PressStart2P.ttf", 14,
                                                   "LAG")
    LagTextHeight = UI.ContentManager.GetFont_height("/PressStart2P.ttf", 14,
                                                     "LAG")

    LagIndicatorSurface = pygame.Surface((LagTextWidth + 4, LagTextHeight + 4))
    LagTextColor = (255, 0, 0)
    FlashingAnimation = Utils.AnimationController(5,
                                                  255,
                                                  multiplierRestart=True)
コード例 #25
0
ファイル: __init__.py プロジェクト: aragubas/OneTrack
def Draw(DISPLAY):
    global LagIndicatorSurface
    global LagTextColor
    global LagEnabled
    global Alpha
    global FPS

    if not LagEnabled:
        return

    LagText = "LAG: " + Utils.FormatNumber(FPS, 2)
    LagTextWidth = UI.ContentManager.GetFont_width("/PressStart2P.ttf", 14,
                                                   LagText)
    LagTextHeight = UI.ContentManager.GetFont_height("/PressStart2P.ttf", 14,
                                                     LagText)

    Shape.Shape_Rectangle(DISPLAY, (0, 0, 0),
                          (5 - 2, 5 - 2, LagTextWidth + 4, LagTextHeight + 4),
                          0, 3)
    UI.ContentManager.FontRender(DISPLAY, "/PressStart2P.ttf", 14, LagText,
                                 LagTextColor, 5, 5)
コード例 #26
0
ファイル: __init__.py プロジェクト: aragubas/taiyou-framework
    def GenerateCrashLog(self, Traceback, ApplicationName):
        print("Generating crash log...")
        # Create the directory for the Crash Logs
        CrashLogsDir = "./Logs/".replace("/", Core.TaiyouPath_CorrectSlash)
        UTILS.Directory_MakeDir(CrashLogsDir)

        # Set the FileName
        FilePath = CrashLogsDir + ApplicationName + "_boot.txt"

        # Set the Application Information
        ProcessInformation = "This application has been failed to boot\n --- Application INFORMATION ---\n"

        ProcessInformation += "Name:" + ApplicationName + "\n"

        ProcessInformation += "--- ERROR TRACEBACK ---"

        FileWrite = open(FilePath, "w")
        FileWrite.write(ProcessInformation)
        FileWrite.write(Traceback)
        FileWrite.close()

        print("Crash log completed")
コード例 #27
0
    def Render(self, DISPLAY):
        if not self.IsVisible:
            return

        if self.Progress >= self.ProgressMax:
            self.Progress = self.ProgressMax

        if self.LastProgress != self.Progress:
            self.LastProgress = self.Progress
            UI.SystemResources.PlaySound("/progress.wav",
                                         UI.SystemSoundsVolume)

        self.ProgressRect = (self.Rectangle[0], self.Rectangle[1],
                             max(
                                 10,
                                 UTILS.Get_Percentage(self.Progress,
                                                      self.Rectangle[2],
                                                      self.ProgressMax)), 10)

        Shape.Shape_Rectangle(DISPLAY, (20, 20, 58), self.Rectangle, 0,
                              self.Rectangle[3])
        Shape.Shape_Rectangle(DISPLAY, (94, 114, 219), self.ProgressRect, 0,
                              self.ProgressRect[3])
コード例 #28
0
ファイル: __init__.py プロジェクト: aragubas/taiyou-framework
    def UpdatePackpageList(self):
        print("Updating Packpages lists...")
        self.PackpageVerticalList.ClearItems()
        self.PackpageVerticalList.ResetSelectedItem()

        PackpagesList = CoreUtils.Directory_FilesList(CorePaths.TaiyouPath_UserPackpagesPath)

        for Packpage in PackpagesList:
            if Packpage.endswith(self.ContentManager.Get_RegKey("packpage_file_format")):
                Name = Packpage.rstrip().replace(CorePaths.TaiyouPath_UserPackpagesPath, "").replace(self.ContentManager.Get_RegKey("packpage_file_format"), "")
                print("Found Packpage {0}".format(Name))
                self.PackpageVerticalList.AddItem(Name, self.ContentManager.Get_RegKey("packpage_description"))

        if len(self.PackpageVerticalList.ItemsName) == 0:
            print("No packpages has been found.")
            self.NoPackpagesFoundMode = True
            self.SetStatusText(self.ContentManager.Get_RegKey("/strings/no_packpage_found_mode_title"))
            self.DownToolbar.GetWidget(1).SetText(self.ContentManager.Get_RegKey("/strings/no_packpage_found_mode_refresh"))
        else:
            self.NoPackpagesFoundMode = False

            print("Some packpage has been found.")
            self.DownToolbar.GetWidget(1).SetText(self.ContentManager.Get_RegKey("/strings/install_button"))
            self.SetStatusText(self.ContentManager.Get_RegKey("/strings/select_app_list"))
コード例 #29
0
ファイル: __init__.py プロジェクト: aragubas/taiyou-framework
    def LoadSoundsInFolder(self):
        """
        Load all sounds on the specified folder\n
        :param FolderName:Folder Path Name
        :return:
        """
        if SoundDisabled:
            return

        if self.Sound_Path == "":
            raise Exception("Sound Path was not set.")

        FolderName = self.Sound_Path
        self.InitSoundSystem()

        temp_sound_files = UTILS.Directory_FilesList(FolderName)
        index = -1

        print("ContentManager.LoadSoundsInFolder : Loading Sounds")
        for x in temp_sound_files:
            if self.StopLongOperations:
                break

            try:
                index += 1
                print("\nContentManager.LoadSoundsInFolder : File[" + x +
                      "] detected; Index[" + str(index) + "]")

                CorrectKeyName = x.replace(FolderName, "")
                self.AllLoadedSounds[CorrectKeyName] = (pygame.mixer.Sound(x))
            except pygame.error:
                break

            print("ContentManager.LoadSoundsInFolder : ItemAdded[" +
                  CorrectKeyName + "]; Index[" + str(index) + "]\n")
        print("ContentManager.LoadSoundsInFolder : Operation Completed")
コード例 #30
0
ファイル: __init__.py プロジェクト: aragubas/taiyou-framework
    def __init__(self, pPID, pProcessName, pROOT_MODULE, pInitArgs,
                 pProcessIndex):
        self.ImagesHasBeenLoaded = False
        self.Timer = pygame.time.Clock()

        self.BootloaderKeys = Core.CntMng.ContentManager()
        self.BootloaderKeys.SetSourceFolder("", True)
        self.BootloaderKeys.SetRegKeysPath("reg/BOOTLOADER")
        self.BootloaderKeys.LoadRegKeysInFolder()

        # Load DefaultUI Contents
        UI.SystemResources = Core.CntMng.ContentManager()
        UI.SystemResources.SetSourceFolder("", True)
        UI.SystemResources.SetFontPath("fonts")
        UI.SystemResources.SetImageFolder("img")
        UI.SystemResources.SetRegKeysPath("reg")
        UI.SystemResources.SetSoundPath("sound")
        UI.SystemResources.SetFontPath("fonts")

        UI.SystemResources.InitSoundSystem()
        UI.SystemResources.LoadRegKeysInFolder()
        UI.SystemResources.LoadSoundsInFolder()

        UI.SystemSoundsVolume = float(
            UI.SystemResources.Get_RegKey("UI/system_sounds_volume"))

        self.DefaultContent = UI.SystemResources

        self.Progress = 0
        self.ProgressAddDelay = 0
        self.ProgressProgression = True
        self.ProgressMax = 2
        self.LoadingComplete = False
        self.InitialLoadingDelay = 0
        self.LastProgress = 0

        self.NoFoldersFound = False
        self.FatalErrorScreen = False

        self.ApplicationSeletorWelcomeSound = False

        self.InitialSignal = False

        super().__init__(pPID, pProcessName, pROOT_MODULE, pInitArgs,
                         pProcessIndex)

        self.CenterX = self.DISPLAY.get_width() / 2
        self.CenterY = self.DISPLAY.get_height() / 2

        self.ApplicationSeletor = False
        self.ApplicationSeletorAnimatorStart = UTILS.AnimationController(
            0.5, multiplierRestart=True)
        self.ApplicationSelectorObj = ApplicationSelector(
            self.DefaultContent, self.CenterX - 550 / 2,
            self.CenterY - 120 / 2)

        # List all valid folders
        folder_list = UTILS.Directory_FilesList(
            "." + CorePaths.TaiyouPath_CorrectSlash)
        BootFolders = list()
        for file in folder_list:
            if file.endswith(CorePaths.TaiyouPath_CorrectSlash + "boot"):
                BootFolders.append(file)

        ListInstalledApplications(BootFolders, self.ApplicationSelectorObj)

        if len(BootFolders) == 0 or len(
                self.ApplicationSelectorObj.SeletorItems_Index) == 0:
            self.NoFoldersFound = True