Skip to content
View in the app

A better way to browse. Learn more.

Learn more

TipBoard #lag fix

Featured Replies

  • Administrator

Search for uitip.py

class TipBoard(ui.Bar):

Complete replace:

class TipBoard(ui.Bar):
    TIP_DURATION = 5.0
    def __init__(self):
        ui.Bar.__init__(self)
        self.AddFlag("not_pick")
        self.tipList = []
        self.nextScrollTime = 0
        self.SetPosition(0, 70)
        self.SetSize(370, 20)
        self.SetColor(grp.GenerateColor(0.0, 0.0, 0.0, 0.5))
        self.SetWindowHorizontalAlignCenter()
        self.__CreateTextBar()

    def __del__(self):
        ui.Bar.__del__(self)

    def __CreateTextBar(self):
        x, y = self.GetGlobalPosition()
        self.textBar = ui.TextLine()
        self.textBar.SetParent(self)
        self.textBar.SetWindowHorizontalAlignCenter()
        self.textBar.SetHorizontalAlignCenter()
        # self.textBar.SetPackedFontColor(0xfffcda00) #color change
        self.textBar.SetPosition(3, 3)     
        self.textBar.Show()

    def __CleanOldTip(self):
        leaveList = []

        for tip in self.tipList:
            madeTime = tip[0]
            if app.GetTime() - madeTime > self.TIP_DURATION:
                pass
            else:
                leaveList.append(tip)

        self.tipList = leaveList

        if not leaveList:
            self.textBar.Hide()
            self.Hide()
            return

        self.__RefreshBoard()

    def __RefreshBoard(self):
        self.textBar.Hide()
        index = 0
        for tip in self.tipList:
            text = tip[1]
            self.textBar.SetText(str(text))
            self.textBar.Show()
            index += 1

    def SetTip(self, text):
        if not app.IsVisibleNotice():
            return

        curTime = app.GetTime()
        self.tipList.append((curTime, text))
        self.__RefreshBoard()
        self.nextScrollTime = app.GetTime()

        if not self.IsShow():
            self.Show()

    def OnUpdate(self):
        if not self.tipList:
            self.Hide()
            return

        if (app.GetTime() > (self.nextScrollTime)):
            self.nextScrollTime = app.GetTime()
            self.__CleanOldTip()

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.