Esempio n. 1
0
    def Render(self, DISPLAY):
        # -- Render Background -- #
        BGColor = UI.ThemesManager_GetProperty("Button_Active_BackgroundColor")
        LineColor = UI.ThemesManager_GetProperty(
            "Button_Active_IndicatorColor")

        if not self.Active:
            BGColor = UI.ThemesManager_GetProperty(
                "Button_Inactive_BackgroundColor")
            LineColor = UI.ThemesManager_GetProperty(
                "Button_Active_IndicatorColor")

        Shape.Shape_Rectangle(DISPLAY, BGColor, self.Rectangle)
        Shape.Shape_Rectangle(DISPLAY, LineColor, self.Rectangle, 1)

        # -- Render Change Title -- #
        TitleX = self.Rectangle[
            0] + self.Rectangle[2] / 2 - self.Content.GetFont_width(
                "/Ubuntu_Bold.ttf", 12, self.TitleName) / 2

        self.Content.FontRender(DISPLAY, "/Ubuntu_Bold.ttf", 12,
                                self.TitleName, (230, 230, 230), TitleX,
                                self.Rectangle[1])

        # -- Render EditableNumberView -- #
        self.Changer.Render(DISPLAY)
Esempio n. 2
0
    def Render(self, DISPLAY):
        if not self.LastRect == self.Rectangle:
            self.Surface = pygame.Surface(
                (self.Rectangle[2], self.Rectangle[3]))

        # -- Render Background -- #
        self.Surface.fill((190, 190, 190))
        Shape.Shape_Rectangle(self.Surface, (100, 100, 100),
                              (0, 0, self.Rectangle[2], self.Rectangle[3]), 5)

        for i in range(12):
            NoteLabel = self.GetNote_ByIndex(i)

            # -- Variables -- #
            Width = 30
            Height = 25
            X = i * (Width + 2)
            Y = self.Rectangle[3] - Height
            BackgroundColor = (100, 105, 155)
            TextColor = (0, 5, 100)
            IsHighNote = False

            if "#" in NoteLabel:
                Width = 30
                X = i * (Width + 2)
                Width = 35
                X -= 2
                Y = 0
                BackgroundColor = (10, 15, 25)
                TextColor = (200, 205, 255)
                IsHighNote = True

            TextX = X + (Width / 2 - UI.ContentManager.GetFont_width(
                "/PressStart2P.ttf", 12, NoteLabel) / 2)

            if self.LastNote == i:
                BackgroundColor = (200, 205, 255)
                TextColor = (0, 0, 0)

            if not IsHighNote:
                Shape.Shape_Rectangle(self.Surface, BackgroundColor,
                                      (X, Y, Width, Height), 0, 0, 5, 5)
            else:
                Shape.Shape_Rectangle(self.Surface, BackgroundColor,
                                      (X, Y, Width, Height), 0, 0, 0, 0, 5, 5)

            UI.ContentManager.FontRender(self.Surface, "/PressStart2P.ttf", 12,
                                         NoteLabel, TextColor, TextX, Y + 5)

        DISPLAY.blit(self.Surface, (self.Rectangle[0], self.Rectangle[1]))
Esempio n. 3
0
    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])
Esempio n. 4
0
    def Render(self, DISPLAY):
        # -- Render Background -- #
        Shape.Shape_Rectangle(self.Surface, self.BgColor,
                              (0, 0, self.Rectangle[2], self.Rectangle[3]))
        # -- Render Indicator -- #
        Shape.Shape_Rectangle(self.Surface, self.IndicatorColor,
                              (0, 0, self.Rectangle[2], self.Rectangle[3]), 1)

        # -- Render the Button Text -- #
        UI.ContentManager.FontRender(self.Surface, "/Ubuntu_Bold.ttf",
                                     self.FontSize - 2, self.Text,
                                     (240, 240, 240), self.Centred_X,
                                     self.Centred_Y)

        DISPLAY.blit(self.Surface, (self.Rectangle[0], self.Rectangle[1]))

        if self.ButtonState == 2:
            self.ButtonState = 0
Esempio n. 5
0
    def Draw(self, ContentsSurface):
        self.RenderTitle(ContentsSurface)
        self.WindowList.Render(ContentsSurface)

        # Render TaskbarTools Background
        Shape.Shape_Rectangle(ContentsSurface, (20, 20, 60), self.Tools)
        Shape.Shape_Rectangle(ContentsSurface, (94, 114, 219),
                              (self.Tools[0] - 2, self.Tools[1] - 2,
                               self.Tools[2] + 4, self.Tools[3] + 4),
                              BorderWidth=2)

        # Render Close Button
        self.Tools_WidgetController.Draw(ContentsSurface)

        self.RenderBottomText(ContentsSurface)
        self.RenderBottomInfosText(ContentsSurface)

        # Center Window list
        self.WindowList.Set_X(ContentsSurface.get_width() / 2 -
                              self.WindowList.Rectangle[2] / 2)
        self.WindowList.Set_Y(ContentsSurface.get_height() / 2 -
                              self.WindowList.Rectangle[3] / 2)
Esempio n. 6
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])
Esempio n. 7
0
    def Render(self, DISPLAY):
        # Blit the rect.
        Shape.Shape_Rectangle(DISPLAY, (15, 15, 15), self.Rectangle)

        if self.Text == self.DefaultText:
            UI.ContentManager.FontRender(
                DISPLAY, UI.ThemesManager_GetProperty("InputBox_FontFile"),
                self.FontSize, self.Text, (140, 140, 140), self.Rectangle[0],
                self.Rectangle[1])
        else:
            if not self.Text == "":
                UI.ContentManager.FontRender(
                    DISPLAY, UI.ThemesManager_GetProperty("InputBox_FontFile"),
                    self.FontSize, self.Text, (240, 240, 240),
                    self.Rectangle[0], self.Rectangle[1])

        if not self.Active:
            Shape.Shape_Rectangle(DISPLAY, (255, 51, 102),
                                  (self.Rectangle[0], self.Rectangle[1] - 1,
                                   self.Rectangle[2], 1))
        else:
            Shape.Shape_Rectangle(DISPLAY, (46, 196, 182),
                                  (self.Rectangle[0], self.Rectangle[1] - 1,
                                   self.Rectangle[2], 1))
Esempio n. 8
0
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)
Esempio n. 9
0
    def Draw(self, Surface):
        # Draw Background
        self.ObjectSurface.fill((0, 0, 0, 150))

        index = -1
        for _ in self.SeletorItems_Index:
            index += 1
            ItemRect = pygame.Rect(self.HScroll + 105 * index, 5, 100,
                                   self.Height - 10)
            ItemPicBox = pygame.Rect(ItemRect[0] + 2, ItemRect[1] + 4,
                                     ItemRect[2] - 4, ItemRect[3] - 8)

            if self.SelectedItemIndex == index:
                Shape.Shape_Rectangle(self.ObjectSurface, (255, 255, 255, 150),
                                      ItemRect,
                                      0,
                                      2,
                                      DontUseCache=True)

            if self.SeletorItems_Icon[index] == None:
                self.Content.ImageRender(self.ObjectSurface,
                                         "/folder_question.png",
                                         ItemPicBox[0],
                                         ItemPicBox[1],
                                         ItemPicBox[2],
                                         ItemPicBox[3],
                                         SmoothScaling=True)
            else:
                self.Content.ImageRender(self.ObjectSurface,
                                         self.SeletorItems_Icon[index],
                                         ItemPicBox[0],
                                         ItemPicBox[1],
                                         ItemPicBox[2],
                                         ItemPicBox[3],
                                         SmoothScaling=True,
                                         ImageNotLoaded=True)

        Surface.blit(self.ObjectSurface, (self.X, self.Y))
Esempio n. 10
0
def ClearPreRendered():
    Shape.ClearPreRendered_Rectangles()
Esempio n. 11
0
    def DrawWindow(self, pSurface, process):
        WindowGeometry = [
            process.POSITION[0], process.POSITION[1],
            process.DISPLAY.get_width() + 1,
            process.DISPLAY.get_height()
        ]
        if process.WINDOW_SURFACE is None:
            process.WINDOW_SURFACE = pygame.Surface(
                (WindowGeometry[2] + 1,
                 WindowGeometry[3] + process.TITLEBAR_RECTANGLE[3] + 1))
        process.TITLEBAR_RECTANGLE = pygame.Rect(WindowGeometry[0],
                                                 WindowGeometry[1],
                                                 WindowGeometry[2], 15)

        # Draw the title bar
        TitleBarColor = UI.ThemesManager_GetProperty("WM_TitlebarActiveColor")
        WindowBorderColor = UI.ThemesManager_GetProperty(
            "WM_BorderActiveColor")
        TextColor = UI.ThemesManager_GetProperty("WM_TitlebarTextActiveColor")
        FontSmoothEnabled = True

        if not process.APPLICATION_HAS_FOCUS:
            TitleBarColor = UI.ThemesManager_GetProperty(
                "WM_TitlebarInactiveColor")
            TextColor = UI.ThemesManager_GetProperty(
                "WM_TitlebarTextInactiveColor")
            WindowBorderColor = UI.ThemesManager_GetProperty(
                "WM_BorderInactiveColor")
            FontSmoothEnabled = False

        # Draw window titlebar only when needded.
        if process.WINDOW_SURFACE_LAST_DRAG_STATE != process.WINDOW_DRAG_ENABLED or process.WINDOW_SURFACE_LAST_DRAG_STATE_LAST_GEOMETRY != WindowGeometry:
            process.WINDOW_SURFACE_LAST_DRAG_STATE_LAST_GEOMETRY = WindowGeometry
            process.WINDOW_SURFACE_LAST_DRAG_STATE = process.WINDOW_DRAG_ENABLED
            process.WINDOW_SURFACE.fill(TitleBarColor)

        # Draw the Window Borders
        Shape.Shape_Rectangle(process.WINDOW_SURFACE, WindowBorderColor,
                              (0, 0, process.WINDOW_SURFACE.get_width(),
                               process.WINDOW_SURFACE.get_height()), 1)

        # Draw titlebar background
        Shape.Shape_Rectangle(process.WINDOW_SURFACE, TitleBarColor,
                              (1, 1, process.TITLEBAR_RECTANGLE[2] - 1,
                               process.TITLEBAR_RECTANGLE[3] - 1))

        # Draw Title Bar Text
        TitleBarText = process.TITLEBAR_TEXT
        FontSize = UI.ThemesManager_GetProperty(
            "WM_WINDOWDRAG_TITLEBAR_FONTSIZE")
        Font = UI.ThemesManager_GetProperty("WM_WINDOWDRAG_TITLEBAR_FONTFILE")
        process.LAST_TITLEBAR_TEXT = process.TITLEBAR_TEXT

        # Draw Titlebar Text
        self.DefaultContent.FontRender(
            process.WINDOW_SURFACE, Font, FontSize, TitleBarText, TextColor,
            WindowGeometry[2] / 2 -
            self.DefaultContent.GetFont_width(Font, FontSize, TitleBarText) /
            2, 0, FontSmoothEnabled)

        # Draw the Window Contents
        process.WINDOW_SURFACE.blit(pSurface,
                                    (1, process.TITLEBAR_RECTANGLE[3]))

        return process.WINDOW_SURFACE
Esempio n. 12
0
    def DrawProcess(self, process):
        if process is None:
            return

        try:
            # Set Cursor
            self.CurrentCursor = process.CURSOR

            # If is fullscreen process, just draw at max resolution at 0, 0
            if process.FULLSCREEN:
                # If application has focus, draw again it's content
                if process.APPLICATION_HAS_FOCUS:
                    self.DrawFullscreenProcess(process)

                # If not, just draw a copy of its screen
                self.DrawFullscreenProcess(process)

                if not process.APPLICATION_HAS_FOCUS:
                    WindowGeometry = [
                        process.POSITION[0], process.POSITION[1],
                        process.DISPLAY.get_width() + 1,
                        process.DISPLAY.get_height()
                    ]
                    process.TITLEBAR_RECTANGLE = pygame.Rect(
                        WindowGeometry[0], WindowGeometry[1],
                        DISPLAY.get_width(), 15)

                    # Draw the title bar
                    TitleBarColor = UI.ThemesManager_GetProperty(
                        "WM_FullscreenWindowTitleBarColor")
                    TextColor = UI.ThemesManager_GetProperty(
                        "WM_FullscreenWindowTitleBarTextColor")

                    Shape.Shape_Rectangle(
                        DISPLAY, TitleBarColor,
                        (0, 0, process.TITLEBAR_RECTANGLE[2] + 1,
                         process.TITLEBAR_RECTANGLE[3]))

                    # Draw Title Bar Text
                    TitleBarText = process.TITLEBAR_TEXT
                    FontSize = 12
                    Font = "/Ubuntu.ttf"

                    self.DefaultContent.FontRender(
                        DISPLAY, Font, FontSize, TitleBarText, TextColor,
                        DISPLAY.get_width() / 2 -
                        self.DefaultContent.GetFont_width(
                            Font, FontSize, TitleBarText) / 2, 0)
                return

            # If not, draw window decoration
            if not process.FRAMELESS:
                DISPLAY.blit(self.DrawWindow(process.LAST_SURFACE, process),
                             (process.POSITION[0], process.POSITION[1]))
            else:
                DISPLAY.blit(process.LAST_SURFACE,
                             (process.POSITION[0], process.POSITION[1]))

        except:
            Core.MAIN.SystemFault_Trigger = True
            Core.MAIN.SystemFault_Traceback = traceback.format_exc()
            Core.MAIN.SystemFault_ProcessObject = process
            self.FocusedProcess = None
            self.TaskBarInstance.SetMode(1)
            WmControl.WindowManagerSignal(None, 4)
            self.UI_Call_Request()
            print(
                "TaiyouApplicationDrawLoop : Process Error Detected\nin Process PID({0})"
                .format(process.PID))
            print("Traceback:\n" + Core.MAIN.SystemFault_Traceback)

            # Kill the Process
            try:
                Core.MAIN.KillProcessByPID(process.PID)
            except:
                print("Error while killing process")

            # Generate the Crash Log
            Core.MAIN.GenerateCrashLog()
            return
Esempio n. 13
0
    def BackgroundGenerator(self):
        self.BGWaxUpdateTimer += 1

        if self.BGWaxUpdateTimer >= self.BGWaxUpdateInterval:
            self.BGWaxUpdateTimer = 0
            self.BGWaxUpdateInterval = randint(
                int(
                    self.DefaultContent.Get_RegKey(
                        "UI/dynamic_bg/interval_min")),
                int(
                    self.DefaultContent.Get_RegKey(
                        "UI/dynamic_bg/interval_max")))

            RenderEffectTileSizes = int(
                self.DefaultContent.Get_RegKey("UI/dynamic_bg/tile_size"))
            RenderEffectImageSize = int(
                self.DefaultContent.Get_RegKey("UI/dynamic_bg/image_size"))
            RenderEffect = pygame.Surface(
                (RenderEffectTileSizes * RenderEffectImageSize,
                 RenderEffectTileSizes * RenderEffectImageSize))

            for x in range(0, RenderEffectTileSizes):
                for y in range(0, RenderEffectTileSizes):
                    Color = (randint(
                        int(
                            self.DefaultContent.Get_RegKey(
                                "UI/dynamic_bg/min_value")),
                        int(
                            self.DefaultContent.Get_RegKey(
                                "UI/dynamic_bg/max_value"))),
                             randint(
                                 int(
                                     self.DefaultContent.Get_RegKey(
                                         "UI/dynamic_bg/min_value")),
                                 int(
                                     self.DefaultContent.Get_RegKey(
                                         "UI/dynamic_bg/max_value"))),
                             randint(
                                 int(
                                     self.DefaultContent.Get_RegKey(
                                         "UI/dynamic_bg/min_value")),
                                 int(
                                     self.DefaultContent.Get_RegKey(
                                         "UI/dynamic_bg/max_value"))))

                    Shape.Shape_Rectangle(
                        RenderEffect, Color,
                        (x * RenderEffectImageSize, y * RenderEffectImageSize,
                         RenderEffectImageSize, RenderEffectImageSize))

            self.BGWaxSurface = pygame.transform.scale(
                CoreEffects.Surface_Blur(RenderEffect, 150),
                (Core.MAIN.ScreenWidth, Core.MAIN.ScreenHeight))

        DISPLAY.blit(self.BGWaxSurface, (0, 0))

        today = date.today()
        DateText = "{0}".format(
            today.strftime(
                self.DefaultContent.Get_RegKey("UI/dynamic_bg/date_format")))
        now = datetime.now()
        TimeText = "{0}".format(
            now.strftime(
                self.DefaultContent.Get_RegKey("UI/dynamic_bg/hour_format")))

        self.DefaultContent.FontRender(DISPLAY, "/Ubuntu_Bold.ttf", 38,
                                       DateText, (50, 50, 50), 12, 12)
        self.DefaultContent.FontRender(DISPLAY, "/Ubuntu_Bold.ttf", 24,
                                       TimeText, (50, 50, 50), 12, 52)

        self.DefaultContent.FontRender(DISPLAY, "/Ubuntu_Bold.ttf", 24,
                                       TimeText, (150, 150, 150), 10, 50)
        self.DefaultContent.FontRender(DISPLAY, "/Ubuntu_Bold.ttf", 38,
                                       DateText, (150, 150, 150), 10, 10)

        NextBackdrop = "Backdrop %" + Core.UTILS.FormatNumber(
            Core.UTILS.Get_Percentage(self.BGWaxUpdateTimer, 100,
                                      self.BGWaxUpdateInterval))
        self.DefaultContent.FontRender(DISPLAY, "/Ubuntu_Bold.ttf", 12,
                                       NextBackdrop, (30, 30, 30), 9,
                                       Core.MAIN.ScreenHeight - 24)
        self.DefaultContent.FontRender(DISPLAY, "/Ubuntu_Bold.ttf", 12,
                                       NextBackdrop, (120, 120, 120), 10,
                                       Core.MAIN.ScreenHeight - 25)
Esempio n. 14
0
    def Render(self, DISPLAY):
        if not self.Rectangle[2] == self.LastRectangle[
                2] or not self.Rectangle[3] == self.LastRectangle[3]:
            self.LastRectangle[2] = self.Rectangle[2]
            self.LastRectangle[3] = self.Rectangle[3]

            self.ListSurface = pygame.Surface(
                (self.Rectangle[2], self.Rectangle[3]),
                pygame.SRCALPHA | pygame.HWACCEL | pygame.HWSURFACE)

        self.ListSurface.fill((0, 0, 0, 0))

        for i, itemNam in enumerate(self.ItemsName):
            ItemRect = (0, self.ScrollY + 42 * i, self.Rectangle[2], 40)

            BackgroundColor = (20, 42, 59, 50)
            ItemNameFontColor = (250, 250, 250)
            BorderColor = (32, 164, 243)
            TextsX = 5
            if self.ItemSprite[i] is not None:
                TextsX = 45

            if self.LastItemIndex == self.ItemIndexes[
                    i]:  # -- When the Item is Selected
                BackgroundColor = (20, 42, 59, 100)
                ItemNameFontColor = (255, 255, 255)
                BorderColor = (46, 196, 182)

            if self.ItemSelected[i]:  # -- When the Item is Clicked
                BackgroundColor = (30, 52, 69, 150)
                ItemNameFontColor = (250, 250, 250)
                BorderColor = (255, 51, 102)

            # -- Background -- #
            Shape.Shape_Rectangle(self.ListSurface,
                                  BackgroundColor,
                                  ItemRect,
                                  DontUseCache=True)

            # -- Indicator Bar -- #
            Shape.Shape_Rectangle(self.ListSurface,
                                  BorderColor,
                                  ItemRect,
                                  1,
                                  DontUseCache=True)

            # -- Render Item Name -- #
            self.ContentManager.FontRender(self.ListSurface,
                                           "/Ubuntu_Bold.ttf", 14, itemNam,
                                           ItemNameFontColor,
                                           TextsX + ItemRect[0],
                                           ItemRect[1] + 5)

            # -- Render Item Description -- #
            self.ContentManager.FontRender(self.ListSurface,
                                           "/Ubuntu_Bold.ttf", 10,
                                           self.ItemsDescription[i],
                                           ItemNameFontColor,
                                           TextsX + ItemRect[0],
                                           ItemRect[1] + 25)

            # -- Render the Item Sprite -- #
            if self.ItemSprite[i] is not None:
                self.ContentManager.ImageRender(
                    self.ListSurface,
                    self.ItemSprite[i],
                    ItemRect[0] + 4,
                    ItemRect[1] + 4,
                    36,
                    32,
                    ImageNotLoaded=self.ItemSpriteIsUnloaded[i],
                    SmoothScaling=True)

        # -- Blit All Work to Screen -- #
        DISPLAY.blit(self.ListSurface, (self.Rectangle[0], self.Rectangle[1]))