Yardım Özel mesajda çift mesaj gösterimi

Konu sahibi bu konuda soru soruyor. Sorusu ile ilgili bilgisi olanların yanıtlamasını bekliyor.

ZordeX

Üye
Üye
Mesaj
8
Beğeni
1
Puan
405
Ticaret Puanı
0
1687814554866.png

Merhaba!
Nasıl düzeltileceği hakkında fikri olan var mı?
 
Bu sorundan önce ne tür bir işlem yaptınız birde uiwhisper.py ekler misin?
 
karşılaştırma yapın burada bir pürüz olmalı
uiwhisper.py:
Genişlet Daralt Kopyala
    def SendWhisper(self):

        text = self.chatLine.GetText()
        textLength = len(text)

        if textLength > 0:
            if net.IsInsultIn(text):
                chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.CHAT_INSULT_STRING)
                return

            net.SendWhisperPacket(self.targetName, text)
            self.chatLine.SetText("")

            chat.AppendWhisper(chat.WHISPER_TYPE_CHAT, self.targetName, player.GetName() + " : " + text)
 
Yardımlarınız için şimdiden teşekkürler.
uiwhisper.py:
Genişlet Daralt Kopyala
import ui
import net
import chat
import player
import app
import localeInfo
import ime
import chr

class WhisperButton(ui.Button):
    def [B]init[/B](self):
        ui.Button.[B]init[/B](self, "TOP_MOST")

    def [B]del[/B](self):
        ui.Button.[B]del[/B](self)

    def SetToolTipText(self, text, x=0, y = 32):
        ui.Button.SetToolTipText(self, text, x, y)
        self.ToolTipText.Show()

    def SetToolTipTextWithColor(self, text, color, x=0, y = 32):
        ui.Button.SetToolTipText(self, text, x, y)
        self.ToolTipText.SetPackedFontColor(color)
        self.ToolTipText.Show()

    def ShowToolTip(self):
        if 0 != self.ToolTipText:
            self.ToolTipText.Show()

    def HideToolTip(self):
        if 0 != self.ToolTipText:
            self.ToolTipText.Show()

class WhisperDialog(ui.ScriptWindow):

    class TextRenderer(ui.Window):
        def SetTargetName(self, targetName):
            self.targetName = targetName

        def OnRender(self):
            (x, y) = self.GetGlobalPosition()
            chat.RenderWhisper(self.targetName, x, y)

    class ResizeButton(ui.DragButton):

        def [B]init[/B](self):
            ui.DragButton.[B]init[/B](self)

        def [B]del[/B](self):
            ui.DragButton.[B]del[/B](self)

        def OnMouseOverIn(self):
            app.SetCursor(app.HVSIZE)

        def OnMouseOverOut(self):
            app.SetCursor(app.NORMAL)

    def [B]init[/B](self, eventMinimize, eventClose):
        print "NEW WHISPER DIALOG  ----------------------------------------------------------------------------"
        ui.ScriptWindow.[B]init[/B](self)
        self.targetName = ""
        self.eventMinimize = eventMinimize
        self.eventClose = eventClose
        self.eventAcceptTarget = None
        if app.ENABLE_MULTILANGUAGE_SYSTEM:
            self.languageID = 0
            self.empireID = 0
    def [B]del[/B](self):
        print "---------------------------------------------------------------------------- DELETE WHISPER DIALOG"
        ui.ScriptWindow.[B]del[/B](self)

    def LoadDialog(self):
        try:
            pyScrLoader = ui.PythonScriptLoader()
            pyScrLoader.LoadScriptFile(self, "UIScript/WhisperDialog.py")
        except:
            import exception
            exception.Abort("WhisperDialog.LoadDialog.LoadScript")

        try:
            GetObject=self.GetChild
            self.titleName = GetObject("titlename")
            self.titleNameEdit = GetObject("titlename_edit")
            self.closeButton = GetObject("closebutton")
            self.scrollBar = GetObject("scrollbar")
            self.chatLine = GetObject("chatline")
            self.minimizeButton = GetObject("minimizebutton")
            self.ignoreButton = GetObject("ignorebutton")
            self.reportViolentWhisperButton = GetObject("reportviolentwhisperbutton")
            self.acceptButton = GetObject("acceptbutton")
            self.sendButton = GetObject("sendbutton")
            self.board = GetObject("board")
            self.editBar = GetObject("editbar")
            self.gamemasterMark = GetObject("gamemastermark")
            if app.ENABLE_MULTILANGUAGE_SYSTEM:
                self.languageFlag = GetObject("language_flag")
                self.empireFlag = GetObject("empire_flag")
        except:
            import exception
            exception.Abort("DialogWindow.LoadDialog.BindObject")

        self.gamemasterMark.Hide()
        self.titleName.SetText("")
        self.titleNameEdit.SetText("")
        self.minimizeButton.SetEvent(ui.[B]mem_func[/B](self.Minimize))
        self.closeButton.SetEvent(ui.[B]mem_func[/B](self.Close))
        self.scrollBar.SetPos(1.0)
        self.scrollBar.SetScrollEvent(ui.[B]mem_func[/B](self.OnScroll))
        self.chatLine.SetReturnEvent(ui.[B]mem_func[/B](self.SendWhisper))
        self.chatLine.SetEscapeEvent(ui.[B]mem_func[/B](self.Minimize))
        self.chatLine.SetMultiLine()
        self.sendButton.SetEvent(ui.[B]mem_func[/B](self.SendWhisper))
        self.titleNameEdit.SetReturnEvent(ui.[B]mem_func[/B](self.AcceptTarget))
        self.titleNameEdit.SetEscapeEvent(ui.[B]mem_func[/B](self.Close))
        self.ignoreButton.SetToggleDownEvent(ui.[B]mem_func[/B](self.IgnoreTarget))
        self.ignoreButton.SetToggleUpEvent(ui.[B]mem_func[/B](self.IgnoreTarget))
        self.reportViolentWhisperButton.SetEvent(ui.[B]mem_func[/B](self.ReportViolentWhisper))
        self.acceptButton.SetEvent(ui.[B]mem_func[/B](self.AcceptTarget))
        if app.ENABLE_MULTILANGUAGE_SYSTEM:
            self.languageFlag.SetPosition(143, 12)
            self.empireFlag.SetPosition(163, 12)
            
        self.textRenderer = self.TextRenderer()
        self.textRenderer.SetParent(self)
        self.textRenderer.SetPosition(20, 28)
        self.textRenderer.SetTargetName("")
        self.textRenderer.Show()

        self.resizeButton = self.ResizeButton()
        self.resizeButton.SetParent(self)
        self.resizeButton.SetSize(20, 20)
        self.resizeButton.SetPosition(280, 180)
        self.resizeButton.SetMoveEvent(ui.[B]mem_func[/B](self.ResizeWhisperDialog))
        self.resizeButton.Show()

        self.ResizeWhisperDialog()

    def Destroy(self):

        self.eventMinimize = None
        self.eventClose = None
        self.eventAcceptTarget = None

        self.ClearDictionary()
        self.scrollBar.Destroy()
        self.titleName = None
        self.titleNameEdit = None
        self.closeButton = None
        self.scrollBar = None
        self.chatLine = None
        self.sendButton = None
        self.ignoreButton = None
        self.reportViolentWhisperButton = None
        self.acceptButton = None
        self.minimizeButton = None
        self.textRenderer = None
        self.board = None
        self.editBar = None
        self.resizeButton = None
        if app.ENABLE_MULTILANGUAGE_SYSTEM:
            self.languageFlag = None
            self.empireFlag = None
            self.languageID = 0
            self.empireID = 0
    def ResizeWhisperDialog(self):
        (xPos, yPos) = self.resizeButton.GetLocalPosition()
        if xPos < 280:
            self.resizeButton.SetPosition(280, yPos)
            return
        if yPos < 150:
            self.resizeButton.SetPosition(xPos, 150)
            return
        self.SetWhisperDialogSize(xPos + 20, yPos + 20)

    def SetWhisperDialogSize(self, width, height):
        try:

            max = int((width-90)/6) * 3 - 6

            self.board.SetSize(width, height)
            self.scrollBar.SetPosition(width-25, 35)
            self.scrollBar.SetScrollBarSize(height-100)
            self.scrollBar.SetPos(1.0)
            self.editBar.SetSize(width-18, 50)
            self.chatLine.SetSize(width-90, 40)
            self.chatLine.SetLimitWidth(width-90)
            self.SetSize(width, height)

            if 0 != self.targetName:
                chat.SetWhisperBoxSize(self.targetName, width - 50, height - 90)

            if localeInfo.IsARABIC():
                self.textRenderer.SetPosition(width-20, 28)
                self.scrollBar.SetPosition(width-25+self.scrollBar.GetWidth(), 35)
                self.editBar.SetPosition(10 + self.editBar.GetWidth(), height-60)
                self.sendButton.SetPosition(width - 80 + self.sendButton.GetWidth(), 10)
                self.minimizeButton.SetPosition(width-42 + self.minimizeButton.GetWidth(), 12)
                self.closeButton.SetPosition(width-24+self.closeButton.GetWidth(), 12)
                self.chatLine.SetPosition(5 + self.chatLine.GetWidth(), 5)
                self.board.SetPosition(self.board.GetWidth(), 0)
            else:
                self.textRenderer.SetPosition(20, 28)
                self.scrollBar.SetPosition(width-25, 35)
                self.editBar.SetPosition(10, height-60)
                self.sendButton.SetPosition(width-80, 10)
                self.minimizeButton.SetPosition(width-42, 12)
                self.closeButton.SetPosition(width-24, 12)

            self.SetChatLineMax(max)

        except:
            import exception
            exception.Abort("WhisperDialog.SetWhisperDialogSize.BindObject")

    def SetChatLineMax(self, max):
        self.chatLine.SetMax(max)

        from grpText import GetSplitingTextLine

        text = self.chatLine.GetText()
        if text:
            self.chatLine.SetText(GetSplitingTextLine(text, max, 0))
    if app.ENABLE_MULTILANGUAGE_SYSTEM:
        def RequestFlag(self, targetName):
            if targetName:
                import player
                player.RequestFlag(targetName)

        def SetFlag(self, languageID, empireID):
            self.languageID = int(languageID)
            self.empireID = int(empireID)

            if self.languageID == 0:
                self.languageFlag.Hide()
            else:
                langlist = ["en","de","tr","pt","es","fr","ro","pl","it","cz","hu"]
                if self.languageID > 11 or  self.languageID == 0:
                    self.languageID = 1

                self.languageFlag.LoadImage("d:/ymir work/ui/language_flag/%s.tga" % langlist[self.languageID-1])
                self.languageFlag.Show()

            if self.empireID == 0:
                self.empireFlag.Hide()
            else:
                self.empireFlag.LoadImage("d:/ymir work/ui/flag_empire/empire_%d_256.dds" % self.empireID)
                self.empireFlag.Show()

            
    def OpenWithTarget(self, targetName):
        chat.CreateWhisper(targetName)
        if app.ENABLE_MULTILANGUAGE_SYSTEM:
            self.RequestFlag(targetName)
        chat.SetWhisperBoxSize(targetName, self.GetWidth() - 60, self.GetHeight() - 90)
        self.chatLine.SetFocus()
        self.titleName.SetText(targetName)
        self.targetName = targetName
        self.textRenderer.SetTargetName(targetName)
        self.titleNameEdit.Hide()
        self.ignoreButton.Hide()
        if app.IsDevStage():
            self.reportViolentWhisperButton.Show()
        else:
            self.reportViolentWhisperButton.Hide()
        self.acceptButton.Hide()
        self.gamemasterMark.Hide()
        self.minimizeButton.Show()
        if app.ENABLE_MULTILANGUAGE_SYSTEM:
            self.languageFlag.Hide()
            self.empireFlag.Hide()
    def OpenWithoutTarget(self, event):
        self.eventAcceptTarget = event
        self.titleName.SetText("")
        self.titleNameEdit.SetText("")
        self.titleNameEdit.SetFocus()
        self.targetName = 0
        self.titleNameEdit.Show()
        self.ignoreButton.Hide()
        self.reportViolentWhisperButton.Hide()
        self.acceptButton.Show()
        self.minimizeButton.Hide()
        self.gamemasterMark.Hide()
        if app.ENABLE_MULTILANGUAGE_SYSTEM:
            self.languageFlag.Hide()
            self.empireFlag.Hide()
    def SetGameMasterLook(self):
        self.gamemasterMark.Show()
        self.reportViolentWhisperButton.Hide()

    def Minimize(self):
        self.titleNameEdit.KillFocus()
        self.chatLine.KillFocus()
        self.Hide()

        if None != self.eventMinimize:
            if app.ENABLE_MULTILANGUAGE_SYSTEM:
                self.eventMinimize(self.targetName, self.languageID, self.empireID)
            else:
                self.eventMinimize(self.targetName)

    def Close(self):
        chat.ClearWhisper(self.targetName)
        self.titleNameEdit.KillFocus()
        self.chatLine.KillFocus()
        self.Hide()

        if None != self.eventClose:
            self.eventClose(self.targetName)

    def ReportViolentWhisper(self):
        net.SendChatPacket("/reportviolentwhisper " + self.targetName)

    def IgnoreTarget(self):
        net.SendChatPacket("/ignore " + self.targetName)

    def AcceptTarget(self):
        name = self.titleNameEdit.GetText()
        if len(name) <= 0:
            self.Close()
            return

        if None != self.eventAcceptTarget:
            self.titleNameEdit.KillFocus()
            if app.ENABLE_MULTILANGUAGE_SYSTEM:
                self.RequestFlag(name)
            self.eventAcceptTarget(name)

    def OnScroll(self):
        chat.SetWhisperPosition(self.targetName, self.scrollBar.GetPos())

    def SendWhisper(self):
        import time

        text = self.chatLine.GetText()
        textLength = len(text)

        if textLength > 0:
            if app.LINK_IN_CHAT:
                link = self.GetLink(text)
                if link != "":
                    import chr
                    if not chr.IsGameMaster():
                        text = text.replace(link, "|cFF00C0FC|h|Hweb:" + link.replace("://", "XxX") + "|h" + link + "|h|r")
                    else:
                        text = text.replace(link, "|cFF00C0FC|h|Hsysweb:" + link.replace("://", "XxX") + "|h" + link + "|h|r")

            if net.IsInsultIn(text):
                chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.CHAT_INSULT_STRING)
                return

            net.SendWhisperPacket(self.targetName, text)
            self.chatLine.SetText("")

            chat.AppendWhisper(chat.WHISPER_TYPE_CHAT, self.targetName, player.GetName() + " : " + text)

    def OnTop(self):
        self.chatLine.SetFocus()

    def BindInterface(self, interface):
        self.interface = interface

    def OnMouseLeftButtonDown(self):
        hyperlink = ui.GetHyperlink()
        if hyperlink:
            if app.IsPressed(app.DIK_LALT):
                link = chat.GetLinkFromHyperlink(hyperlink)
                ime.PasteString(link)
            else:
                self.interface.MakeHyperlinkTooltip(hyperlink)

    if app.LINK_IN_CHAT:
        def GetLink(self, text):
            link = ""
            start = text.find("http://")
            if start == -1:
                start = text.find("https://")
            if start == -1:
                return ""

            return text[start:len(text)].split(" ")[0]

if "[B]main[/B]" == [B]name[/B]:
    import uiTest

    class TestApp(uiTest.App):
        def OnInit(self):
            wnd = WhisperDialog(self.OnMax, self.OnMin)
            wnd.LoadDialog()
            wnd.OpenWithoutTarget(self.OnNew)
            wnd.SetPosition(0, 0)
            wnd.Show()

            self.wnd = wnd

        def OnMax(self):
            pass

        def OnMin(self):
            pass

        def OnNew(self):
            pass

    TestApp().MainLoop()
 
Yardımlarınız için şimdiden teşekkürler.
uiwhisper.py:
Genişlet Daralt Kopyala
import ui
import net
import chat
import player
import app
import localeInfo
import ime
import chr

class WhisperButton(ui.Button):
    def [B]init[/B](self):
        ui.Button.[B]init[/B](self, "TOP_MOST")

    def [B]del[/B](self):
        ui.Button.[B]del[/B](self)

    def SetToolTipText(self, text, x=0, y = 32):
        ui.Button.SetToolTipText(self, text, x, y)
        self.ToolTipText.Show()

    def SetToolTipTextWithColor(self, text, color, x=0, y = 32):
        ui.Button.SetToolTipText(self, text, x, y)
        self.ToolTipText.SetPackedFontColor(color)
        self.ToolTipText.Show()

    def ShowToolTip(self):
        if 0 != self.ToolTipText:
            self.ToolTipText.Show()

    def HideToolTip(self):
        if 0 != self.ToolTipText:
            self.ToolTipText.Show()

class WhisperDialog(ui.ScriptWindow):

    class TextRenderer(ui.Window):
        def SetTargetName(self, targetName):
            self.targetName = targetName

        def OnRender(self):
            (x, y) = self.GetGlobalPosition()
            chat.RenderWhisper(self.targetName, x, y)

    class ResizeButton(ui.DragButton):

        def [B]init[/B](self):
            ui.DragButton.[B]init[/B](self)

        def [B]del[/B](self):
            ui.DragButton.[B]del[/B](self)

        def OnMouseOverIn(self):
            app.SetCursor(app.HVSIZE)

        def OnMouseOverOut(self):
            app.SetCursor(app.NORMAL)

    def [B]init[/B](self, eventMinimize, eventClose):
        print "NEW WHISPER DIALOG  ----------------------------------------------------------------------------"
        ui.ScriptWindow.[B]init[/B](self)
        self.targetName = ""
        self.eventMinimize = eventMinimize
        self.eventClose = eventClose
        self.eventAcceptTarget = None
        if app.ENABLE_MULTILANGUAGE_SYSTEM:
            self.languageID = 0
            self.empireID = 0
    def [B]del[/B](self):
        print "---------------------------------------------------------------------------- DELETE WHISPER DIALOG"
        ui.ScriptWindow.[B]del[/B](self)

    def LoadDialog(self):
        try:
            pyScrLoader = ui.PythonScriptLoader()
            pyScrLoader.LoadScriptFile(self, "UIScript/WhisperDialog.py")
        except:
            import exception
            exception.Abort("WhisperDialog.LoadDialog.LoadScript")

        try:
            GetObject=self.GetChild
            self.titleName = GetObject("titlename")
            self.titleNameEdit = GetObject("titlename_edit")
            self.closeButton = GetObject("closebutton")
            self.scrollBar = GetObject("scrollbar")
            self.chatLine = GetObject("chatline")
            self.minimizeButton = GetObject("minimizebutton")
            self.ignoreButton = GetObject("ignorebutton")
            self.reportViolentWhisperButton = GetObject("reportviolentwhisperbutton")
            self.acceptButton = GetObject("acceptbutton")
            self.sendButton = GetObject("sendbutton")
            self.board = GetObject("board")
            self.editBar = GetObject("editbar")
            self.gamemasterMark = GetObject("gamemastermark")
            if app.ENABLE_MULTILANGUAGE_SYSTEM:
                self.languageFlag = GetObject("language_flag")
                self.empireFlag = GetObject("empire_flag")
        except:
            import exception
            exception.Abort("DialogWindow.LoadDialog.BindObject")

        self.gamemasterMark.Hide()
        self.titleName.SetText("")
        self.titleNameEdit.SetText("")
        self.minimizeButton.SetEvent(ui.[B]mem_func[/B](self.Minimize))
        self.closeButton.SetEvent(ui.[B]mem_func[/B](self.Close))
        self.scrollBar.SetPos(1.0)
        self.scrollBar.SetScrollEvent(ui.[B]mem_func[/B](self.OnScroll))
        self.chatLine.SetReturnEvent(ui.[B]mem_func[/B](self.SendWhisper))
        self.chatLine.SetEscapeEvent(ui.[B]mem_func[/B](self.Minimize))
        self.chatLine.SetMultiLine()
        self.sendButton.SetEvent(ui.[B]mem_func[/B](self.SendWhisper))
        self.titleNameEdit.SetReturnEvent(ui.[B]mem_func[/B](self.AcceptTarget))
        self.titleNameEdit.SetEscapeEvent(ui.[B]mem_func[/B](self.Close))
        self.ignoreButton.SetToggleDownEvent(ui.[B]mem_func[/B](self.IgnoreTarget))
        self.ignoreButton.SetToggleUpEvent(ui.[B]mem_func[/B](self.IgnoreTarget))
        self.reportViolentWhisperButton.SetEvent(ui.[B]mem_func[/B](self.ReportViolentWhisper))
        self.acceptButton.SetEvent(ui.[B]mem_func[/B](self.AcceptTarget))
        if app.ENABLE_MULTILANGUAGE_SYSTEM:
            self.languageFlag.SetPosition(143, 12)
            self.empireFlag.SetPosition(163, 12)
           
        self.textRenderer = self.TextRenderer()
        self.textRenderer.SetParent(self)
        self.textRenderer.SetPosition(20, 28)
        self.textRenderer.SetTargetName("")
        self.textRenderer.Show()

        self.resizeButton = self.ResizeButton()
        self.resizeButton.SetParent(self)
        self.resizeButton.SetSize(20, 20)
        self.resizeButton.SetPosition(280, 180)
        self.resizeButton.SetMoveEvent(ui.[B]mem_func[/B](self.ResizeWhisperDialog))
        self.resizeButton.Show()

        self.ResizeWhisperDialog()

    def Destroy(self):

        self.eventMinimize = None
        self.eventClose = None
        self.eventAcceptTarget = None

        self.ClearDictionary()
        self.scrollBar.Destroy()
        self.titleName = None
        self.titleNameEdit = None
        self.closeButton = None
        self.scrollBar = None
        self.chatLine = None
        self.sendButton = None
        self.ignoreButton = None
        self.reportViolentWhisperButton = None
        self.acceptButton = None
        self.minimizeButton = None
        self.textRenderer = None
        self.board = None
        self.editBar = None
        self.resizeButton = None
        if app.ENABLE_MULTILANGUAGE_SYSTEM:
            self.languageFlag = None
            self.empireFlag = None
            self.languageID = 0
            self.empireID = 0
    def ResizeWhisperDialog(self):
        (xPos, yPos) = self.resizeButton.GetLocalPosition()
        if xPos < 280:
            self.resizeButton.SetPosition(280, yPos)
            return
        if yPos < 150:
            self.resizeButton.SetPosition(xPos, 150)
            return
        self.SetWhisperDialogSize(xPos + 20, yPos + 20)

    def SetWhisperDialogSize(self, width, height):
        try:

            max = int((width-90)/6) * 3 - 6

            self.board.SetSize(width, height)
            self.scrollBar.SetPosition(width-25, 35)
            self.scrollBar.SetScrollBarSize(height-100)
            self.scrollBar.SetPos(1.0)
            self.editBar.SetSize(width-18, 50)
            self.chatLine.SetSize(width-90, 40)
            self.chatLine.SetLimitWidth(width-90)
            self.SetSize(width, height)

            if 0 != self.targetName:
                chat.SetWhisperBoxSize(self.targetName, width - 50, height - 90)

            if localeInfo.IsARABIC():
                self.textRenderer.SetPosition(width-20, 28)
                self.scrollBar.SetPosition(width-25+self.scrollBar.GetWidth(), 35)
                self.editBar.SetPosition(10 + self.editBar.GetWidth(), height-60)
                self.sendButton.SetPosition(width - 80 + self.sendButton.GetWidth(), 10)
                self.minimizeButton.SetPosition(width-42 + self.minimizeButton.GetWidth(), 12)
                self.closeButton.SetPosition(width-24+self.closeButton.GetWidth(), 12)
                self.chatLine.SetPosition(5 + self.chatLine.GetWidth(), 5)
                self.board.SetPosition(self.board.GetWidth(), 0)
            else:
                self.textRenderer.SetPosition(20, 28)
                self.scrollBar.SetPosition(width-25, 35)
                self.editBar.SetPosition(10, height-60)
                self.sendButton.SetPosition(width-80, 10)
                self.minimizeButton.SetPosition(width-42, 12)
                self.closeButton.SetPosition(width-24, 12)

            self.SetChatLineMax(max)

        except:
            import exception
            exception.Abort("WhisperDialog.SetWhisperDialogSize.BindObject")

    def SetChatLineMax(self, max):
        self.chatLine.SetMax(max)

        from grpText import GetSplitingTextLine

        text = self.chatLine.GetText()
        if text:
            self.chatLine.SetText(GetSplitingTextLine(text, max, 0))
    if app.ENABLE_MULTILANGUAGE_SYSTEM:
        def RequestFlag(self, targetName):
            if targetName:
                import player
                player.RequestFlag(targetName)

        def SetFlag(self, languageID, empireID):
            self.languageID = int(languageID)
            self.empireID = int(empireID)

            if self.languageID == 0:
                self.languageFlag.Hide()
            else:
                langlist = ["en","de","tr","pt","es","fr","ro","pl","it","cz","hu"]
                if self.languageID > 11 or  self.languageID == 0:
                    self.languageID = 1

                self.languageFlag.LoadImage("d:/ymir work/ui/language_flag/%s.tga" % langlist[self.languageID-1])
                self.languageFlag.Show()

            if self.empireID == 0:
                self.empireFlag.Hide()
            else:
                self.empireFlag.LoadImage("d:/ymir work/ui/flag_empire/empire_%d_256.dds" % self.empireID)
                self.empireFlag.Show()

           
    def OpenWithTarget(self, targetName):
        chat.CreateWhisper(targetName)
        if app.ENABLE_MULTILANGUAGE_SYSTEM:
            self.RequestFlag(targetName)
        chat.SetWhisperBoxSize(targetName, self.GetWidth() - 60, self.GetHeight() - 90)
        self.chatLine.SetFocus()
        self.titleName.SetText(targetName)
        self.targetName = targetName
        self.textRenderer.SetTargetName(targetName)
        self.titleNameEdit.Hide()
        self.ignoreButton.Hide()
        if app.IsDevStage():
            self.reportViolentWhisperButton.Show()
        else:
            self.reportViolentWhisperButton.Hide()
        self.acceptButton.Hide()
        self.gamemasterMark.Hide()
        self.minimizeButton.Show()
        if app.ENABLE_MULTILANGUAGE_SYSTEM:
            self.languageFlag.Hide()
            self.empireFlag.Hide()
    def OpenWithoutTarget(self, event):
        self.eventAcceptTarget = event
        self.titleName.SetText("")
        self.titleNameEdit.SetText("")
        self.titleNameEdit.SetFocus()
        self.targetName = 0
        self.titleNameEdit.Show()
        self.ignoreButton.Hide()
        self.reportViolentWhisperButton.Hide()
        self.acceptButton.Show()
        self.minimizeButton.Hide()
        self.gamemasterMark.Hide()
        if app.ENABLE_MULTILANGUAGE_SYSTEM:
            self.languageFlag.Hide()
            self.empireFlag.Hide()
    def SetGameMasterLook(self):
        self.gamemasterMark.Show()
        self.reportViolentWhisperButton.Hide()

    def Minimize(self):
        self.titleNameEdit.KillFocus()
        self.chatLine.KillFocus()
        self.Hide()

        if None != self.eventMinimize:
            if app.ENABLE_MULTILANGUAGE_SYSTEM:
                self.eventMinimize(self.targetName, self.languageID, self.empireID)
            else:
                self.eventMinimize(self.targetName)

    def Close(self):
        chat.ClearWhisper(self.targetName)
        self.titleNameEdit.KillFocus()
        self.chatLine.KillFocus()
        self.Hide()

        if None != self.eventClose:
            self.eventClose(self.targetName)

    def ReportViolentWhisper(self):
        net.SendChatPacket("/reportviolentwhisper " + self.targetName)

    def IgnoreTarget(self):
        net.SendChatPacket("/ignore " + self.targetName)

    def AcceptTarget(self):
        name = self.titleNameEdit.GetText()
        if len(name) <= 0:
            self.Close()
            return

        if None != self.eventAcceptTarget:
            self.titleNameEdit.KillFocus()
            if app.ENABLE_MULTILANGUAGE_SYSTEM:
                self.RequestFlag(name)
            self.eventAcceptTarget(name)

    def OnScroll(self):
        chat.SetWhisperPosition(self.targetName, self.scrollBar.GetPos())

    def SendWhisper(self):
        import time

        text = self.chatLine.GetText()
        textLength = len(text)

        if textLength > 0:
            if app.LINK_IN_CHAT:
                link = self.GetLink(text)
                if link != "":
                    import chr
                    if not chr.IsGameMaster():
                        text = text.replace(link, "|cFF00C0FC|h|Hweb:" + link.replace("://", "XxX") + "|h" + link + "|h|r")
                    else:
                        text = text.replace(link, "|cFF00C0FC|h|Hsysweb:" + link.replace("://", "XxX") + "|h" + link + "|h|r")

            if net.IsInsultIn(text):
                chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.CHAT_INSULT_STRING)
                return

            net.SendWhisperPacket(self.targetName, text)
            self.chatLine.SetText("")

            chat.AppendWhisper(chat.WHISPER_TYPE_CHAT, self.targetName, player.GetName() + " : " + text)

    def OnTop(self):
        self.chatLine.SetFocus()

    def BindInterface(self, interface):
        self.interface = interface

    def OnMouseLeftButtonDown(self):
        hyperlink = ui.GetHyperlink()
        if hyperlink:
            if app.IsPressed(app.DIK_LALT):
                link = chat.GetLinkFromHyperlink(hyperlink)
                ime.PasteString(link)
            else:
                self.interface.MakeHyperlinkTooltip(hyperlink)

    if app.LINK_IN_CHAT:
        def GetLink(self, text):
            link = ""
            start = text.find("http://")
            if start == -1:
                start = text.find("https://")
            if start == -1:
                return ""

            return text[start:len(text)].split(" ")[0]

if "[B]main[/B]" == [B]name[/B]:
    import uiTest

    class TestApp(uiTest.App):
        def OnInit(self):
            wnd = WhisperDialog(self.OnMax, self.OnMin)
            wnd.LoadDialog()
            wnd.OpenWithoutTarget(self.OnNew)
            wnd.SetPosition(0, 0)
            wnd.Show()

            self.wnd = wnd

        def OnMax(self):
            pass

        def OnMin(self):
            pass

        def OnNew(self):
            pass

    TestApp().MainLoop()
Bu dosyanda bir problem göremedim
 
Üst