Jump to content
Metin2 Network
Create New...
  • Download unlimited resources when you are a Premium Member, Buy now!

Drackarys track problem


AlexuuSky2

Recommended Posts

Well, i didn't find a model for problems.. 

problem is at trackwindow, to be exatctly in uitrack.py

[spoiler]

1231 18:01:12351 :: Traceback (most recent call last):

1231 18:01:12351 ::   File "game.py", line 1258, in OnKeyDown

1231 18:01:12352 ::   File "game.py", line 354, in <lambda>

1231 18:01:12352 ::   File "interfaceModule.py", line 1854, in OpenTrackWindow

1231 18:01:12352 ::   File "interfaceModule.py", line 1852, in MakeTrackWindow

1231 18:01:12352 ::   File "uiTrack.py", line 187, in __init__

1231 18:01:12352 ::   File "uiTrack.py", line 360, in __LoadWindow

1231 18:01:12352 ::   File "uiTrack.py", line 385, in SetTrackType

1231 18:01:12352 ::   File "uiTrack.py", line 394, in Refresh

1231 18:01:12352 :: TypeError
1231 18:01:12352 :: : 
1231 18:01:12352 :: SetPosition() takes exactly 3 arguments (4 given)
1231 18:01:12352 :: [/spoiler]

function for that specific line (394) is this 

[spoiler]    def Refresh(self):
        listbox = self.GetChild("listbox")
        listbox.RemoveAllItems()
        trackDataList = self.__dataDict[self.__trackType] if self.__dataDict.has_key(self.__trackType) else []
        yItemCount = 0
        for data in trackDataList:
            trackItem = self.TrackItem(_weakref.proxy(listbox), data)
           <-- trackItem.SetPosition(0, yItemCount * trackItem.GetHeight(), True) --> This is 394
            listbox.AppendItem(trackItem)
            trackItem.Show()
            yItemCount+=1
        listbox.RefreshAll()[/spoiler]

i know it's something about ui.py but i'm not sure..

 

and this is the listbox class from ui.py

[spoiler]

class ListBox(Window):

    TEMPORARY_PLACE = 3

    def __init__(self, layer = "UI"):
        Window.__init__(self, layer)
        self.overLine = -1
        self.selectedLine = -1
        self.width = 0
        self.height = 0
        self.stepSize = 17
        self.basePos = 0
        self.showLineCount = 0
        self.itemCenterAlign = True
        self.itemList = []
        self.keyDict = {}
        self.textDict = {}
        self.event = lambda *arg: None
    def __del__(self):
        Window.__del__(self)

    def SetWidth(self, width):
        self.SetSize(width, self.height)

    def SetSize(self, width, height):
        Window.SetSize(self, width, height)
        self.width = width
        self.height = height

    def SetTextCenterAlign(self, flag):
        self.itemCenterAlign = flag

    def SetBasePos(self, pos):
        self.basePos = pos
        self._LocateItem()

    def ClearItem(self):
        self.keyDict = {}
        self.textDict = {}
        self.itemList = []
        self.overLine = -1
        self.selectedLine = -1

    def InsertItem(self, number, text):
        self.keyDict[len(self.itemList)] = number
        self.textDict[len(self.itemList)] = text

        textLine = TextLine()
        textLine.SetParent(self)
        textLine.SetText(text)
        textLine.Show()

        if self.itemCenterAlign:
            textLine.SetWindowHorizontalAlignCenter()
            textLine.SetHorizontalAlignCenter()

        self.itemList.append(textLine)

        self._LocateItem()

    def ChangeItem(self, number, text):
        for key, value in self.keyDict.items():
            if value == number:
                self.textDict[key] = text

                if number < len(self.itemList):
                    self.itemList[key].SetText(text)

                return

    def LocateItem(self):
        self._LocateItem()

    def _LocateItem(self):

        skipCount = self.basePos
        yPos = 0
        self.showLineCount = 0

        for textLine in self.itemList:
            textLine.Hide()

            if skipCount > 0:
                skipCount -= 1
                continue

            if localeInfo.IsARABIC():
                w, h = textLine.GetTextSize()
                textLine.SetPosition(w+10, yPos + 3)
            else:
                textLine.SetPosition(0, yPos + 3)
            
            if app.BL_PRIVATESHOP_SEARCH_SYSTEM:
                textLine.SetPosition(0, yPos + 3)
            else:
                if localeInfo.IsARABIC():
                    w, h = textLine.GetTextSize()
                    textLine.SetPosition(w+10, yPos + 3)
                else:
                    textLine.SetPosition(0, yPos + 3)

            yPos += self.stepSize

            if yPos <= self.GetHeight():
                self.showLineCount += 1
                textLine.Show()

    def ArrangeItem(self):
        self.SetSize(self.width, len(self.itemList) * self.stepSize)
        self._LocateItem()

    def GetViewItemCount(self):
        return int(self.GetHeight() / self.stepSize)

    def GetItemCount(self):
        return len(self.itemList)

    def SetEvent(self, event):
        self.event = event

    def SelectItem(self, line):

        if not self.keyDict.has_key(line):
            return

        # if line == self.selectedLine:
            # return
        if not app.BL_PRIVATESHOP_SEARCH_SYSTEM:
            if line == self.selectedLine:
                return

        self.selectedLine = line
        self.event(self.keyDict.get(line, 0), self.textDict.get(line, "None"))

    def GetSelectedItem(self):
        return self.keyDict.get(self.selectedLine, 0)

    def OnMouseLeftButtonDown(self):
        if self.overLine < 0:
            return

    def OnMouseLeftButtonUp(self):
        if self.overLine >= 0:
            self.SelectItem(self.overLine+self.basePos)

    def OnUpdate(self):

        self.overLine = -1

        if self.IsIn():
            x, y = self.GetGlobalPosition()
            height = self.GetHeight()
            xMouse, yMouse = wndMgr.GetMousePosition()

            if yMouse - y < height - 1:
                self.overLine = (yMouse - y) / self.stepSize

                if self.overLine < 0:
                    self.overLine = -1
                if self.overLine >= len(self.itemList):
                    self.overLine = -1

    def OnRender(self):
        xRender, yRender = self.GetGlobalPosition()
        yRender -= self.TEMPORARY_PLACE
        widthRender = self.width
        heightRender = self.height + self.TEMPORARY_PLACE*2

        if localeInfo.IsCIBN10:
            if -1 != self.overLine and self.keyDict[self.overLine] != -1:
                grp.SetColor(HALF_WHITE_COLOR)
                grp.RenderBar(xRender + 2, yRender + self.overLine*self.stepSize + 4, self.width - 3, self.stepSize)                

            if -1 != self.selectedLine and self.keyDict[self.selectedLine] != -1:
                if self.selectedLine >= self.basePos:
                    if self.selectedLine - self.basePos < self.showLineCount:
                        grp.SetColor(SELECT_COLOR)
                        grp.RenderBar(xRender + 2, yRender + (self.selectedLine-self.basePos)*self.stepSize + 4, self.width - 3, self.stepSize)

        else:        
            if -1 != self.overLine:
                grp.SetColor(HALF_WHITE_COLOR)
                grp.RenderBar(xRender + 2, yRender + self.overLine*self.stepSize + 4, self.width - 3, self.stepSize)                

            if -1 != self.selectedLine:
                if self.selectedLine >= self.basePos:
                    if self.selectedLine - self.basePos < self.showLineCount:
                        grp.SetColor(SELECT_COLOR)
                        grp.RenderBar(xRender + 2, yRender + (self.selectedLine-self.basePos)*self.stepSize + 4, self.width - 3, self.stepSize)


[/spoiler]

Link to comment
Share on other sites

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...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

Terms of Service

Write what you are looking for and press enter or click the search icon to begin your search