- Mesaj
- 778
- Çözümler
- 26
- Beğeni
- 565
- Puan
- 809
- Ticaret Puanı
- 0
Linkleri görebilmek için
giriş yap veya kayıt ol.
arkadaşlar bu sistemi ekledim minimap in yanından buttonla nasıl çağırabilirim bu pencereyi
senin attığını geri sana yüklemişim Düzenlediğimi attım şimdihocam sizin attığınız pylerde EventCalander isminde button yok yine de ekleyeyim mi
self.ScaleDownButton
hocam kopyalayıp oyun açılır hale getirdim ama buttona bastığımda şu syserrı veriyor:uiMinimap.py dosyasının içinden
Python:self.ScaleDownButton
Bunu referans alarak sıfırdan bir buton oluştur ve SetEvent olayına fotodaki sistemin open / show fonksiyonunu bağla.
Sonra uiscript içinden isteğine göre konumlandırırsın.
1102 15:53:32173 :: Traceback (most recent call last):
1102 15:53:32173 :: File "ui.py", line 1668, in CallEvent
1102 15:53:32173 :: File "ui.py", line 89, in __call__
1102 15:53:32173 :: File "ui.py", line 71, in __call__
1102 15:53:32173 :: File "uiMiniMap.py", line 255, in OnNewButtonClick
1102 15:53:32173 :: AttributeError
1102 15:53:32173 :: :
1102 15:53:32173 :: 'MiniMap' object has no attribute 'interface'
1102 15:53:32173 ::
import ui
import uiScriptLocale
import wndMgr
import player
import miniMap
import localeInfo
import net
import app
import colorInfo
import constInfo
import background
import interfacemodule
import uitimerwindow
from constInfo import TextColor
class MapTextToolTip(ui.Window):
def __init__(self):
ui.Window.__init__(self)
textLine = ui.TextLine()
textLine.SetParent(self)
textLine.SetHorizontalAlignCenter()
textLine.SetOutline()
textLine.SetHorizontalAlignRight()
textLine.Show()
self.textLine = textLine
def __del__(self):
ui.Window.__del__(self)
def SetText(self, text):
self.textLine.SetText(text)
def SetTooltipPosition(self, PosX, PosY):
if localeInfo.IsARABIC():
w, h = self.textLine.GetTextSize()
self.textLine.SetPosition(PosX - w - 5, PosY)
else:
self.textLine.SetPosition(PosX - 5, PosY)
def SetTextColor(self, TextColor):
self.textLine.SetPackedFontColor(TextColor)
def GetTextSize(self):
return self.textLine.GetTextSize()
class AtlasWindow(ui.ScriptWindow):
class AtlasRenderer(ui.Window):
def __init__(self):
ui.Window.__init__(self)
self.AddFlag("not_pick")
def OnUpdate(self):
miniMap.UpdateAtlas()
def OnRender(self):
(x, y) = self.GetGlobalPosition()
fx = float(x)
fy = float(y)
miniMap.RenderAtlas(fx, fy)
def HideAtlas(self):
miniMap.HideAtlas()
def ShowAtlas(self):
miniMap.ShowAtlas()
def __init__(self):
self.tooltipInfo = MapTextToolTip()
self.tooltipInfo.Hide()
self.infoGuildMark = ui.MarkBox()
self.infoGuildMark.Hide()
self.AtlasMainWindow = None
self.mapName = ""
self.board = 0
ui.ScriptWindow.__init__(self)
def __del__(self):
ui.ScriptWindow.__del__(self)
def SetMapName(self, mapName):
if 949==app.GetDefaultCodePage():
try:
self.board.SetTitleName(localeInfo.MINIMAP_ZONE_NAME_DICT[mapName])
except:
pass
def LoadWindow(self):
try:
pyScrLoader = ui.PythonScriptLoader()
pyScrLoader.LoadScriptFile(self, "UIScript/AtlasWindow.py")
except:
import exception
exception.Abort("AtlasWindow.LoadWindow.LoadScript")
try:
self.board = self.GetChild("board")
except:
import exception
exception.Abort("AtlasWindow.LoadWindow.BindObject")
self.AtlasMainWindow = self.AtlasRenderer()
self.board.SetCloseEvent(self.Hide)
self.AtlasMainWindow.SetParent(self.board)
self.AtlasMainWindow.SetPosition(7, 30)
self.tooltipInfo.SetParent(self.board)
self.infoGuildMark.SetParent(self.board)
self.SetPosition(wndMgr.GetScreenWidth() - 136 - 256 - 10, 0)
self.Hide()
miniMap.RegisterAtlasWindow(self)
def Destroy(self):
miniMap.UnregisterAtlasWindow()
self.ClearDictionary()
self.AtlasMainWindow = None
self.tooltipAtlasClose = 0
self.tooltipInfo = None
self.infoGuildMark = None
self.board = None
def OnUpdate(self):
if not self.tooltipInfo:
return
if not self.infoGuildMark:
return
self.infoGuildMark.Hide()
self.tooltipInfo.Hide()
if False == self.board.IsIn():
return
(mouseX, mouseY) = wndMgr.GetMousePosition()
(bFind, sName, iPosX, iPosY, dwTextColor, dwGuildID) = miniMap.GetAtlasInfo(mouseX, mouseY)
if False == bFind:
return
if "empty_guild_area" == sName:
sName = localeInfo.GUILD_EMPTY_AREA
if localeInfo.IsARABIC() and sName[-1].isalnum():
self.tooltipInfo.SetText("(%s)%d, %d" % (sName, iPosX, iPosY))
else:
self.tooltipInfo.SetText("%s(%d, %d)" % (sName, iPosX, iPosY))
(x, y) = self.GetGlobalPosition()
self.tooltipInfo.SetTooltipPosition(mouseX - x, mouseY - y)
self.tooltipInfo.SetTextColor(dwTextColor)
self.tooltipInfo.Show()
self.tooltipInfo.SetTop()
if 0 != dwGuildID:
textWidth, textHeight = self.tooltipInfo.GetTextSize()
self.infoGuildMark.SetIndex(dwGuildID)
self.infoGuildMark.SetPosition(mouseX - x - textWidth - 18 - 5, mouseY - y)
self.infoGuildMark.Show()
def Hide(self):
if self.AtlasMainWindow:
self.AtlasMainWindow.HideAtlas()
self.AtlasMainWindow.Hide()
ui.ScriptWindow.Hide(self)
def Show(self):
if self.AtlasMainWindow:
(bGet, iSizeX, iSizeY) = miniMap.GetAtlasSize()
if bGet:
self.SetSize(iSizeX + 15, iSizeY + 38)
if localeInfo.IsARABIC():
self.board.SetPosition(iSizeX+15, 0)
self.board.SetSize(iSizeX + 15, iSizeY + 38)
#self.AtlasMainWindow.SetSize(iSizeX, iSizeY)
self.AtlasMainWindow.ShowAtlas()
self.AtlasMainWindow.Show()
ui.ScriptWindow.Show(self)
def SetCenterPositionAdjust(self, x, y):
self.SetPosition((wndMgr.GetScreenWidth() - self.GetWidth()) / 2 + x, (wndMgr.GetScreenHeight() - self.GetHeight()) / 2 + y)
def OnPressEscapeKey(self):
self.Hide()
return True
def __RegisterMiniMapColor(type, rgb):
miniMap.RegisterColor(type, rgb[0], rgb[1], rgb[2])
class MiniMap(ui.ScriptWindow):
CANNOT_SEE_INFO_MAP_DICT = {
"metin2_map_monkeydungeon" : False,
"metin2_map_monkeydungeon_02" : False,
"metin2_map_monkeydungeon_03" : False,
"metin2_map_devilsCatacomb" : False,
}
def __init__(self):
ui.ScriptWindow.__init__(self)
self.__Initialize()
miniMap.Create()
miniMap.SetScale(2.0)
self.AtlasWindow = AtlasWindow()
self.AtlasWindow.LoadWindow()
self.AtlasWindow.Hide()
self.tooltipMiniMapOpen = MapTextToolTip()
self.tooltipMiniMapOpen.SetText(localeInfo.MINIMAP)
self.tooltipMiniMapOpen.Show()
self.tooltipMiniMapClose = MapTextToolTip()
self.tooltipMiniMapClose.SetText(localeInfo.UI_CLOSE)
self.tooltipMiniMapClose.Show()
self.tooltipScaleUp = MapTextToolTip()
self.tooltipScaleUp.SetText(localeInfo.MINIMAP_INC_SCALE)
self.tooltipScaleUp.Show()
self.tooltipScaleDown = MapTextToolTip()
self.tooltipScaleDown.SetText(localeInfo.MINIMAP_DEC_SCALE)
self.tooltipScaleDown.Show()
self.tooltipAtlasOpen = MapTextToolTip()
self.tooltipAtlasOpen.SetText(localeInfo.MINIMAP_SHOW_AREAMAP)
self.tooltipAtlasOpen.Show()
self.tooltipInfo = MapTextToolTip()
self.tooltipInfo.Show()
if miniMap.IsAtlas():
self.tooltipAtlasOpen.SetText(localeInfo.MINIMAP_SHOW_AREAMAP)
else:
self.tooltipAtlasOpen.SetText(localeInfo.MINIMAP_CAN_NOT_SHOW_AREAMAP)
self.tooltipInfo = MapTextToolTip()
self.tooltipInfo.Show()
self.mapName = ""
self.isLoaded = 0
self.canSeeInfo = True
# AUTOBAN
self.imprisonmentDuration = 0
self.imprisonmentEndTime = 0
self.imprisonmentEndTimeText = ""
# END_OF_AUTOBAN
def OnNewButtonClick(self):
self.interface.OpenTimerWindow()
def __del__(self):
miniMap.Destroy()
ui.ScriptWindow.__del__(self)
def __Initialize(self):
self.positionInfo = 0
self.observerCount = 0
self.OpenWindow = 0
self.CloseWindow = 0
self.ScaleUpButton = 0
self.ScaleDownButton = 0
self.MiniMapHideButton = 0
self.MiniMapShowButton = 0
self.AtlasShowButton = 0
self.tooltipMiniMapOpen = 0
self.tooltipMiniMapClose = 0
self.tooltipScaleUp = 0
self.tooltipScaleDown = 0
self.tooltipAtlasOpen = 0
self.tooltipInfo = None
self.serverInfo = None
def SetMapName(self, mapName):
self.mapName=mapName
self.AtlasWindow.SetMapName(mapName)
if self.CANNOT_SEE_INFO_MAP_DICT.has_key(mapName):
self.canSeeInfo = False
self.HideMiniMap()
self.tooltipMiniMapOpen.SetText(localeInfo.MINIMAP_CANNOT_SEE)
else:
self.canSeeInfo = True
self.ShowMiniMap()
self.tooltipMiniMapOpen.SetText(localeInfo.MINIMAP)
# AUTOBAN
def SetImprisonmentDuration(self, duration):
self.imprisonmentDuration = duration
self.imprisonmentEndTime = app.GetGlobalTimeStamp() + duration
self.__UpdateImprisonmentDurationText()
def __UpdateImprisonmentDurationText(self):
restTime = max(self.imprisonmentEndTime - app.GetGlobalTimeStamp(), 0)
imprisonmentEndTimeText = localeInfo.SecondToDHM(restTime)
if imprisonmentEndTimeText != self.imprisonmentEndTimeText:
self.imprisonmentEndTimeText = imprisonmentEndTimeText
self.serverInfo.SetText("%s: %s" % (uiScriptLocale.AUTOBAN_QUIZ_REST_TIME, self.imprisonmentEndTimeText))
# END_OF_AUTOBAN
def Show(self):
self.__LoadWindow()
ui.ScriptWindow.Show(self)
def __LoadWindow(self):
if self.isLoaded == 1:
return
self.isLoaded = 1
try:
pyScrLoader = ui.PythonScriptLoader()
if localeInfo.IsARABIC():
pyScrLoader.LoadScriptFile(self, uiScriptLocale.LOCALE_UISCRIPT_PATH + "Minimap.py")
else:
pyScrLoader.LoadScriptFile(self, "UIScript/MiniMap.py")
except:
import exception
exception.Abort("MiniMap.LoadWindow.LoadScript")
try:
self.OpenWindow = self.GetChild("OpenWindow")
self.MiniMapWindow = self.GetChild("MiniMapWindow")
self.ScaleUpButton = self.GetChild("ScaleUpButton")
self.ScaleDownButton = self.GetChild("ScaleDownButton")
self.MiniMapHideButton = self.GetChild("MiniMapHideButton")
self.AtlasShowButton = self.GetChild("AtlasShowButton")
self.CloseWindow = self.GetChild("CloseWindow")
self.MiniMapShowButton = self.GetChild("MiniMapShowButton")
self.positionInfo = self.GetChild("PositionInfo")
self.observerCount = self.GetChild("ObserverCount")
self.serverInfo = self.GetChild("ServerInfo")
self.NewButton = self.GetChild("NewButton")
self.NewButton.SetEvent(ui.__mem_func__(self.OnNewButtonClick))
except:
import exception
exception.Abort("MiniMap.LoadWindow.Bind")
if constInfo.MINIMAP_POSITIONINFO_ENABLE==0:
self.positionInfo.Hide()
self.serverInfo.SetText(net.GetServerInfo())
self.ScaleUpButton.SetEvent(ui.__mem_func__(self.ScaleUp))
self.ScaleDownButton.SetEvent(ui.__mem_func__(self.ScaleDown))
self.MiniMapHideButton.SetEvent(ui.__mem_func__(self.HideMiniMap))
self.MiniMapShowButton.SetEvent(ui.__mem_func__(self.ShowMiniMap))
if miniMap.IsAtlas():
self.AtlasShowButton.SetEvent(ui.__mem_func__(self.ToggleAtlasWindow)) # @fixme014 ShowAtlas
(ButtonPosX, ButtonPosY) = self.MiniMapShowButton.GetGlobalPosition()
self.tooltipMiniMapOpen.SetTooltipPosition(ButtonPosX, ButtonPosY)
(ButtonPosX, ButtonPosY) = self.MiniMapHideButton.GetGlobalPosition()
self.tooltipMiniMapClose.SetTooltipPosition(ButtonPosX, ButtonPosY)
(ButtonPosX, ButtonPosY) = self.ScaleUpButton.GetGlobalPosition()
self.tooltipScaleUp.SetTooltipPosition(ButtonPosX, ButtonPosY)
(ButtonPosX, ButtonPosY) = self.ScaleDownButton.GetGlobalPosition()
self.tooltipScaleDown.SetTooltipPosition(ButtonPosX, ButtonPosY)
(ButtonPosX, ButtonPosY) = self.AtlasShowButton.GetGlobalPosition()
self.tooltipAtlasOpen.SetTooltipPosition(ButtonPosX, ButtonPosY)
(ButtonPosX, ButtonPosY) = self.NewButton.GetGlobalPosition()
self.tooltipNewButton = MapTextToolTip()
self.tooltipNewButton.SetTooltipPosition(ButtonPosX, ButtonPosY)
self.tooltipNewButton.Show()
self.ShowMiniMap()
def Destroy(self):
self.HideMiniMap()
self.AtlasWindow.Destroy()
self.AtlasWindow = None
self.ClearDictionary()
self.__Initialize()
def UpdateCurrentChannel(self, channelID):
(serverName, channelName) = net.GetServerInfo().split(",")
channelName = TextColor("CH-{}".format(channelID), "FFffFF")
net.SetServerInfo("{}, {}".format(serverName, channelName))
if self.serverInfo:
self.serverInfo.SetText(net.GetServerInfo())
def UpdateObserverCount(self, observerCount):
if observerCount>0:
self.observerCount.Show()
elif observerCount<=0:
self.observerCount.Hide()
self.observerCount.SetText(localeInfo.MINIMAP_OBSERVER_COUNT % observerCount)
def OnUpdate(self):
(x, y, z) = player.GetMainCharacterPosition()
miniMap.Update(x, y)
self.positionInfo.SetText("(%.0f, %.0f)" % (x/100, y/100))
if self.tooltipInfo:
if True == self.MiniMapWindow.IsIn():
(mouseX, mouseY) = wndMgr.GetMousePosition()
(bFind, sName, iPosX, iPosY, dwTextColor) = miniMap.GetInfo(mouseX, mouseY)
if bFind == 0:
self.tooltipInfo.Hide()
elif not self.canSeeInfo:
self.tooltipInfo.SetText("%s(%s)" % (sName, localeInfo.UI_POS_UNKNOWN))
self.tooltipInfo.SetTooltipPosition(mouseX - 5, mouseY)
self.tooltipInfo.SetTextColor(dwTextColor)
self.tooltipInfo.Show()
else:
if localeInfo.IsARABIC() and sName[-1].isalnum():
self.tooltipInfo.SetText("(%s)%d, %d" % (sName, iPosX, iPosY))
else:
self.tooltipInfo.SetText("%s(%d, %d)" % (sName, iPosX, iPosY))
self.tooltipInfo.SetTooltipPosition(mouseX - 5, mouseY)
self.tooltipInfo.SetTextColor(dwTextColor)
self.tooltipInfo.Show()
else:
self.tooltipInfo.Hide()
# AUTOBAN
if self.imprisonmentDuration:
self.__UpdateImprisonmentDurationText()
# END_OF_AUTOBAN
if True == self.MiniMapShowButton.IsIn():
self.tooltipMiniMapOpen.Show()
else:
self.tooltipMiniMapOpen.Hide()
if True == self.MiniMapHideButton.IsIn():
self.tooltipMiniMapClose.Show()
else:
self.tooltipMiniMapClose.Hide()
if True == self.ScaleUpButton.IsIn():
self.tooltipScaleUp.Show()
else:
self.tooltipScaleUp.Hide()
if True == self.ScaleDownButton.IsIn():
self.tooltipScaleDown.Show()
else:
self.tooltipScaleDown.Hide()
if True == self.AtlasShowButton.IsIn():
self.tooltipAtlasOpen.Show()
else:
self.tooltipAtlasOpen.Hide()
def OnRender(self):
(x, y) = self.GetGlobalPosition()
fx = float(x)
fy = float(y)
miniMap.Render(fx + 4.0, fy + 5.0)
def Close(self):
self.HideMiniMap()
def HideMiniMap(self):
miniMap.Hide()
self.OpenWindow.Hide()
self.CloseWindow.Show()
def ShowMiniMap(self):
if not self.canSeeInfo:
return
miniMap.Show()
self.OpenWindow.Show()
self.CloseWindow.Hide()
def isShowMiniMap(self):
return miniMap.isShow()
def ScaleUp(self):
miniMap.ScaleUp()
def ScaleDown(self):
miniMap.ScaleDown()
def ShowAtlas(self):
if not miniMap.IsAtlas():
return
if not self.AtlasWindow.IsShow():
self.AtlasWindow.Show()
def ToggleAtlasWindow(self):
if not miniMap.IsAtlas():
return
if self.AtlasWindow.IsShow():
self.AtlasWindow.Hide()
else:
self.AtlasWindow.Show()
if app.ENABLE_LOADING_PERFORMANCE:
def IsShowingAtlas(self):
return self.AtlasWindow.IsShow()
def OpenTimerWindow(self):
self.wndTimer.Open()
__MakeWindows içinde wndMiniMap gibi bir nesne ismi olması lazım yine onu kullanarak interface sınıfının örneğini mininape gönder minimapte bir değişken yap o değişkene bu örneği geçir ve artık orada interface sınıfından çağrı yapabilirsin.
Örneğin
def Interface(self, interface)
self.interface = interface
Sonra
self.interface.DungeonInfoWindow()
onPressKeyDict[app.DIK_F4] = lambda : self.__PressQuickSlot(7)
#altına ekle
onPressKeyDict[app.DIK_F8] = lambda : self.OpenTimerWindow()
#en alta ekle
def OpenTimerWindow(self):
self.interface.OpenTimerWindow()
interFaceModule.py ile uiMinimap.py gönderir misingame py:onPressKeyDict[app.DIK_F4] = lambda : self.__PressQuickSlot(7) #altına ekle onPressKeyDict[app.DIK_F8] = lambda : self.OpenTimerWindow() #en alta ekle def OpenTimerWindow(self): self.interface.OpenTimerWindow()
hocam bunları yapınca f8 ile pencere açılıyor ama buttonla minimapten neden açamadığımı anlamadım
def OnNewButtonClick(self):
interface = interfaceModule.Interface()
interface.OpenTimerWindow()
self.interface = interfaceModule.Interface()
Python:def OnNewButtonClick(self): interface = interfaceModule.Interface() interface.OpenTimerWindow()
Şeklinde dene.
Veya direkt class MiniMap(ui.ScriptWindow): sınıfının __init__ fonksiyonuna şunu ekle:
Python:self.interface = interfaceModule.Interface()
class MiniMap(ui.ScriptWindow):
CANNOT_SEE_INFO_MAP_DICT = {
"metin2_map_monkeydungeon" : False,
"metin2_map_monkeydungeon_02" : False,
"metin2_map_monkeydungeon_03" : False,
"metin2_map_devilsCatacomb" : False,
}
def __init__(self):
ui.ScriptWindow.__init__(self)
self.__Initialize()
self.interface = interfaceModule.Interface()
1102 17:31:24276 :: Traceback (most recent call last):
1102 17:31:24276 :: File "ui.py", line 1668, in CallEvent
1102 17:31:24276 :: File "ui.py", line 89, in __call__
1102 17:31:24276 :: File "ui.py", line 71, in __call__
1102 17:31:24276 :: File "uiMiniMap.py", line 254, in OnNewButtonClick
1102 17:31:24276 :: NameError
1102 17:31:24276 :: :
1102 17:31:24276 :: global name 'interface' is not defined
1102 17:31:24276 ::
teşekkür ederim hocam rarladım siteden çok uzun mesaj dediinterFaceModule.py ile uiMinimap.py gönderir misin
hocam düzelttim o şekilde şimdi de:Python:def OnNewButtonClick(self): self.interface.OpenTimerWindow()
Böyle olması gerekiyor.
1102 17:39:26422 :: Traceback (most recent call last):
1102 17:39:26422 :: File "ui.py", line 1668, in CallEvent
1102 17:39:26422 :: File "ui.py", line 89, in __call__
1102 17:39:26422 :: File "ui.py", line 71, in __call__
1102 17:39:26422 :: File "uiMiniMap.py", line 254, in OnNewButtonClick
1102 17:39:26422 :: File "interfaceModule.py", line 1803, in OpenTimerWindow
1102 17:39:26422 :: AttributeError
1102 17:39:26422 :: :
1102 17:39:26422 :: 'Interface' object has no attribute 'wndTimer'
1102 17:39:26422 ::
def __MakeTimerWindow(self):
self.wndTimer = uitimerwindow.TimerWindow()
self.wndTimer.LoadWindow()
Evet.hocam düzelttim o şekilde şimdi de:
Python:1102 17:39:26422 :: Traceback (most recent call last): 1102 17:39:26422 :: File "ui.py", line 1668, in CallEvent 1102 17:39:26422 :: File "ui.py", line 89, in __call__ 1102 17:39:26422 :: File "ui.py", line 71, in __call__ 1102 17:39:26422 :: File "uiMiniMap.py", line 254, in OnNewButtonClick 1102 17:39:26422 :: File "interfaceModule.py", line 1803, in OpenTimerWindow 1102 17:39:26422 :: AttributeError 1102 17:39:26422 :: : 1102 17:39:26422 :: 'Interface' object has no attribute 'wndTimer' 1102 17:39:26422 ::
interfacede wndTimer objesinin olmadığını söylüyor galiba onu nasıl tanımlamam gerekir
self.wndTimer= None yazabilir miyim
edit:
Python:def __MakeTimerWindow(self): self.wndTimer = uitimerwindow.TimerWindow() self.wndTimer.LoadWindow()
böyle bir fonksiyon varmış
hocam bunu da tanımlayınca şu hata geldi, valla konu da bulmaca gibi oldu cevaplarınız için teşekkür ederim:Evet.
self.wndInventory = None
bunun altına ekleyebilirsin.
self.wndTimer = None
1102 17:51:32148 :: Traceback (most recent call last):
1102 17:51:32148 :: File "ui.py", line 1668, in CallEvent
1102 17:51:32148 :: File "ui.py", line 89, in __call__
1102 17:51:32148 :: File "ui.py", line 71, in __call__
1102 17:51:32148 :: File "uiMiniMap.py", line 254, in OnNewButtonClick
1102 17:51:32148 :: File "interfaceModule.py", line 1804, in OpenTimerWindow
1102 17:51:32148 :: AttributeError
1102 17:51:32148 :: :
1102 17:51:32148 :: 'NoneType' object has no attribute 'Open'
1102 17:51:32148 ::
Kullandığın sistemin python dosyasında Open diye bir fonksiyon yok sanırım. Dosyaya göz atıp load fonksiyonunun adına bak ve syserrda hata aldığın satırdaki Open kısmını aslolan fonksiyon adı ile değiştir. (Show olabilir, Load vb. olabilir.)hocam bunu da tanımlayınca şu hata geldi, valla konu da bulmaca gibi oldu cevaplarınız için teşekkür ederim:
Python:1102 17:51:32148 :: Traceback (most recent call last): 1102 17:51:32148 :: File "ui.py", line 1668, in CallEvent 1102 17:51:32148 :: File "ui.py", line 89, in __call__ 1102 17:51:32148 :: File "ui.py", line 71, in __call__ 1102 17:51:32148 :: File "uiMiniMap.py", line 254, in OnNewButtonClick 1102 17:51:32148 :: File "interfaceModule.py", line 1804, in OpenTimerWindow 1102 17:51:32148 :: AttributeError 1102 17:51:32148 :: : 1102 17:51:32148 :: 'NoneType' object has no attribute 'Open' 1102 17:51:32148 ::
Kullandığın sistemin python dosyasında Open diye bir fonksiyon yok sanırım. Dosyaya göz atıp load fonksiyonunun adına bak ve syserrda hata aldığın satırdaki Open kısmını aslolan fonksiyon adı ile değiştir. (Show olabilir, Load vb. olabilir.)
import ui
import app
import net
import localeInfo
import chat
DESCRIPTION = {
0 : [ "d:/ymir work/ui/game/dungeon_list/incoming.png", "Sertifika Etkinliði", "Her Gün", "|cff00FF7F23:00", "|cff00ccff00:00", 52701, None, None, None, None, None, None ], #img, title, level, group request, cooldown, item, dungeon desc
1 : [ "d:/ymir work/ui/game/dungeon_list/incoming.png", "Ramazan Etkinliði", "Her Gün", "|cff00FF7F01:00", "|cff00ccff05:00", 30315, None, None, None, None, None, None ],
2 : [ "d:/ymir work/ui/game/dungeon_list/incoming.png", "Ay Iþýðý Etkinliði", "Pazartesi", "|cff00FF7F20:00", "|cff00ccff21:00", 50011, None, None, None, None, None, None ],
3 : [ "d:/ymir work/ui/game/dungeon_list/incoming.png", "Derece Puan Etkinliði", "Salý", "|cff00FF7F20:00", "|cff00ccff21:00", 61424, None, None, None, None, None, None ],
4 : [ "d:/ymir work/ui/game/dungeon_list/incoming.png", "Evcil Hayvan Etkinliði", "Salý", "|cff00FF7F18:00", "|cff00ccff19:00", 38055, None, None, None, None, None, None ],
5 : [ "d:/ymir work/ui/game/dungeon_list/incoming.png", "Oyma Taþý Etkinliði", "Çarþamba", "|cff00FF7F19:00", "|cff00ccff20:00", 30178, None, None, None, None, None, None ],
6 : [ "d:/ymir work/ui/game/dungeon_list/incoming.png", "Okey Kart Etkinliði", "Çarþamba Ve Perþembe", "|cff00FF7F21:00", "|cff00ccff22:00", 79506, None, None, None, None, None, None ],
7 : [ "d:/ymir work/ui/game/dungeon_list/incoming.png", "Altýgen Paketi Etkinliði", "Perþembe", "|cff00FF7F19:00", "|cff00ccff20:00", 50037, None, None, None, None, None, None ],
8 : [ "d:/ymir work/ui/game/dungeon_list/incoming.png", "Futbol Topu Etkinliði", "Cuma", "|cff00FF7F21:00", "|cff00ccff22:00", 50096, None, None, None, None, None, None ],
9 : [ "d:/ymir work/ui/game/dungeon_list/incoming.png", "Amorun Sandýðý Etkinliði", "Pazar", "|cff00FF7F21:00", "|cff00ccff22:00", 71147, None, None, None, None, None, None ],
10 : [ "d:/ymir work/ui/game/dungeon_list/incoming.png", "Cadýlar Bayramý Etkinliði", "Pazar", "|cff00FF7F22:00", "|cff00ccff23:00", 30321, None, None, None, None, None, None ],
}
def load_dungeon_desc():
for x in xrange(11):
f = open("%s/dungeon_desc/%d.txt" % (app.GetLocalePath(), x), "r")
lines = [line.rstrip('\n') for line in f]
global DESCRIPTION
DESCRIPTION[x][11] = lines
class TimerBoard(ui.ImageBox):
def __init__(self, parent, index):
ui.ImageBox.__init__(self)
self.SetParent(parent)
self.index = index
self.parent = parent
self.__Build()
load_dungeon_desc()
def __del__(self):
ui.ImageBox.__del__(self)
def __Build(self):
self.LoadImage("d:/ymir work/ui/game/dungeon_list/available.tga")
self.Show()
self.image = ui.MakeImageBox(self, ("d:/ymir work/ui/game/dungeon_list/%d.tga" % self.index), 3, 3)
self.textLine = ui.MakeTextLine(self)
self.textLine.SetPosition(46, -10)
self.textLine.SetWindowHorizontalAlignLeft()
self.textLine.SetHorizontalAlignLeft()
self.textLine.SetText(DESCRIPTION[self.index][1])
self.incoming = ui.MakeTextLine(self)
self.incoming.SetPosition(150, 0)
self.incoming.SetWindowHorizontalAlignLeft()
self.incoming.SetHorizontalAlignLeft()
self.incoming.SetText("In curand")
self.endTime = 0
def SetTimeLeft(self, time):
self.endTime = app.GetGlobalTimeStamp() + time
def UpdateTime(self, indexNum):
if self.endTime - app.GetGlobalTimeStamp() > 0:
m, s = divmod(self.endTime - app.GetGlobalTimeStamp(), 60)
h, m = divmod(m, 60)
self.incoming.SetText("")
self.LoadImage("d:/ymir work/ui/game/dungeon_list/unavailable.tga")
else:
self.incoming.SetText("")
self.LoadImage("d:/ymir work/ui/game/dungeon_list/available.tga")
def OnMouseLeftButtonDown(self):
self.parent.SetDescription(self.index)
def Destroy(self):
self.image = None
self.textLine = None
class TimerWindow(ui.ScriptWindow):
def __init__(self):
ui.ScriptWindow.__init__(self)
def __del__(self):
ui.ScriptWindow.__del__(self)
def LoadWindow(self):
try:
pyScrLoader = ui.PythonScriptLoader()
pyScrLoader.LoadScriptFile(self, "uiscript/timerwindow.py")
except:
import exception
exception.Abort("TimerWindow.LoadWindow.LoadObject")
try:
self.titleBar = self.GetChild("TitleBar")
self.itemSlot = self.GetChild("ItemSlot")
self.listDesc = self.GetChild("ListDesc")
self.scrollBar = self.GetChild("ScrollBar")
except:
import exception
exception.Abort("TimerWindow.LoadWindow.BindObject")
self.titleBar.SetCloseEvent(ui.__mem_func__(self.Close))
self.itemSlot.SetOverInItemEvent(ui.__mem_func__(self.__OnOverInItem))
self.itemSlot.SetOverOutItemEvent(ui.__mem_func__(self.__OnOverOutItem))
self.listDesc.SetItemSize(225, 11)
self.listDesc.SetScrollBar(self.scrollBar)
self.timerBoards = []
for x in xrange(11):
board = TimerBoard(self, x)
board.SetPosition(23, 50 * (x + 1) - 7)
self.timerBoards.append(board)
self.tooltip = None
self.image = ui.ImageBox()
self.image.SetParent(self)
self.image.SetPosition(342, 36)
self.textLine = ui.MakeTextLine(self)
self.textLine.SetPosition(342 - 178, 36 - 85 - 142)
self.textLine2 = ui.MakeTextLine(self)
self.textLine2.SetPosition(28, -167)
self.textLine2.SetWindowHorizontalAlignRight()
self.textLine2.SetHorizontalAlignRight()
self.textLine3 = ui.MakeTextLine(self)
self.textLine3.SetPosition(28, -150)
self.textLine3.SetWindowHorizontalAlignRight()
self.textLine3.SetHorizontalAlignRight()
self.textLine4 = ui.MakeTextLine(self)
self.textLine4.SetPosition(28, -133)
self.textLine4.SetWindowHorizontalAlignRight()
self.textLine4.SetHorizontalAlignRight()
self.index = 0
self.SetDescription(0) #default
def SetDescription(self, index):
self.index = index
self.image.LoadImage(DESCRIPTION[index][0])
self.textLine.SetText(DESCRIPTION[index][1])
self.itemSlot.SetItemSlot(0, DESCRIPTION[index][5])
self.image.Show()
self.textLine2.SetText(str(DESCRIPTION[index][2]))
self.textLine3.SetText(str(DESCRIPTION[index][3]))
self.textLine4.SetText(str(DESCRIPTION[index][4]))
self.__ClearList()
for line in DESCRIPTION[index][11]:
textLine = ui.TextLine()
textLine.SetParent(self.listDesc)
textLine.Show()
textLine.SetText(line)
self.listDesc.AppendItem(textLine)
def __ClearList(self):
for item in self.listDesc.itemList:
item = None
self.listDesc.RemoveAllItems()
def SetTimeLeft(self, index, time):
self.timerBoards[index].SetTimeLeft(time);
def SetToolTip(self, tooltip):
self.tooltip = tooltip
self.tooltip.Hide()
def __OnOverInItem(self, slotIndex):
self.tooltip.SetItemToolTip(DESCRIPTION[self.index][5])
def __OnOverOutItem(self):
self.tooltip.HideToolTip()
def Open(self):
self.Show()
def Close(self):
self.Hide()
def OnUpdate(self):
for x in xrange(11):
self.timerBoards[x].UpdateTime(x)
def OnScrollWheel(self, len):
if len >= 0:
self.scrollBar.OnUp()
else:
self.scrollBar.OnDown()
return True
def OnRunMouseWheel(self, nLen):
if nLen > 0:
self.scrollBar.OnUp()
else:
self.scrollBar.OnDown()
def OnPressEscapeKey(self):
self.Close()
return True
def Destroy(self):
self.ClearDictionary()
self.image = None
self.textLine = None
self.textLine2 = None
self.textLine3 = None
self.textLine4 = None
self.titleBar = None
self.itemSlot = None
self.listDesc = None
self.scrollBar = None
for t in self.timerBoards:
t.Destroy()
t = None
del self.timerBoards[:]
def Open(self):
self.Show()
Bunu dene uiScript deki minimap dosyasına EventCalanderButton ekleuitimerwindow.py:import ui import app import net import localeInfo import chat DESCRIPTION = { 0 : [ "d:/ymir work/ui/game/dungeon_list/incoming.png", "Sertifika Etkinliði", "Her Gün", "|cff00FF7F23:00", "|cff00ccff00:00", 52701, None, None, None, None, None, None ], #img, title, level, group request, cooldown, item, dungeon desc 1 : [ "d:/ymir work/ui/game/dungeon_list/incoming.png", "Ramazan Etkinliði", "Her Gün", "|cff00FF7F01:00", "|cff00ccff05:00", 30315, None, None, None, None, None, None ], 2 : [ "d:/ymir work/ui/game/dungeon_list/incoming.png", "Ay Iþýðý Etkinliði", "Pazartesi", "|cff00FF7F20:00", "|cff00ccff21:00", 50011, None, None, None, None, None, None ], 3 : [ "d:/ymir work/ui/game/dungeon_list/incoming.png", "Derece Puan Etkinliði", "Salý", "|cff00FF7F20:00", "|cff00ccff21:00", 61424, None, None, None, None, None, None ], 4 : [ "d:/ymir work/ui/game/dungeon_list/incoming.png", "Evcil Hayvan Etkinliði", "Salý", "|cff00FF7F18:00", "|cff00ccff19:00", 38055, None, None, None, None, None, None ], 5 : [ "d:/ymir work/ui/game/dungeon_list/incoming.png", "Oyma Taþý Etkinliði", "Çarþamba", "|cff00FF7F19:00", "|cff00ccff20:00", 30178, None, None, None, None, None, None ], 6 : [ "d:/ymir work/ui/game/dungeon_list/incoming.png", "Okey Kart Etkinliði", "Çarþamba Ve Perþembe", "|cff00FF7F21:00", "|cff00ccff22:00", 79506, None, None, None, None, None, None ], 7 : [ "d:/ymir work/ui/game/dungeon_list/incoming.png", "Altýgen Paketi Etkinliði", "Perþembe", "|cff00FF7F19:00", "|cff00ccff20:00", 50037, None, None, None, None, None, None ], 8 : [ "d:/ymir work/ui/game/dungeon_list/incoming.png", "Futbol Topu Etkinliði", "Cuma", "|cff00FF7F21:00", "|cff00ccff22:00", 50096, None, None, None, None, None, None ], 9 : [ "d:/ymir work/ui/game/dungeon_list/incoming.png", "Amorun Sandýðý Etkinliði", "Pazar", "|cff00FF7F21:00", "|cff00ccff22:00", 71147, None, None, None, None, None, None ], 10 : [ "d:/ymir work/ui/game/dungeon_list/incoming.png", "Cadýlar Bayramý Etkinliði", "Pazar", "|cff00FF7F22:00", "|cff00ccff23:00", 30321, None, None, None, None, None, None ], } def load_dungeon_desc(): for x in xrange(11): f = open("%s/dungeon_desc/%d.txt" % (app.GetLocalePath(), x), "r") lines = [line.rstrip('\n') for line in f] global DESCRIPTION DESCRIPTION[x][11] = lines class TimerBoard(ui.ImageBox): def __init__(self, parent, index): ui.ImageBox.__init__(self) self.SetParent(parent) self.index = index self.parent = parent self.__Build() load_dungeon_desc() def __del__(self): ui.ImageBox.__del__(self) def __Build(self): self.LoadImage("d:/ymir work/ui/game/dungeon_list/available.tga") self.Show() self.image = ui.MakeImageBox(self, ("d:/ymir work/ui/game/dungeon_list/%d.tga" % self.index), 3, 3) self.textLine = ui.MakeTextLine(self) self.textLine.SetPosition(46, -10) self.textLine.SetWindowHorizontalAlignLeft() self.textLine.SetHorizontalAlignLeft() self.textLine.SetText(DESCRIPTION[self.index][1]) self.incoming = ui.MakeTextLine(self) self.incoming.SetPosition(150, 0) self.incoming.SetWindowHorizontalAlignLeft() self.incoming.SetHorizontalAlignLeft() self.incoming.SetText("In curand") self.endTime = 0 def SetTimeLeft(self, time): self.endTime = app.GetGlobalTimeStamp() + time def UpdateTime(self, indexNum): if self.endTime - app.GetGlobalTimeStamp() > 0: m, s = divmod(self.endTime - app.GetGlobalTimeStamp(), 60) h, m = divmod(m, 60) self.incoming.SetText("") self.LoadImage("d:/ymir work/ui/game/dungeon_list/unavailable.tga") else: self.incoming.SetText("") self.LoadImage("d:/ymir work/ui/game/dungeon_list/available.tga") def OnMouseLeftButtonDown(self): self.parent.SetDescription(self.index) def Destroy(self): self.image = None self.textLine = None class TimerWindow(ui.ScriptWindow): def __init__(self): ui.ScriptWindow.__init__(self) def __del__(self): ui.ScriptWindow.__del__(self) def LoadWindow(self): try: pyScrLoader = ui.PythonScriptLoader() pyScrLoader.LoadScriptFile(self, "uiscript/timerwindow.py") except: import exception exception.Abort("TimerWindow.LoadWindow.LoadObject") try: self.titleBar = self.GetChild("TitleBar") self.itemSlot = self.GetChild("ItemSlot") self.listDesc = self.GetChild("ListDesc") self.scrollBar = self.GetChild("ScrollBar") except: import exception exception.Abort("TimerWindow.LoadWindow.BindObject") self.titleBar.SetCloseEvent(ui.__mem_func__(self.Close)) self.itemSlot.SetOverInItemEvent(ui.__mem_func__(self.__OnOverInItem)) self.itemSlot.SetOverOutItemEvent(ui.__mem_func__(self.__OnOverOutItem)) self.listDesc.SetItemSize(225, 11) self.listDesc.SetScrollBar(self.scrollBar) self.timerBoards = [] for x in xrange(11): board = TimerBoard(self, x) board.SetPosition(23, 50 * (x + 1) - 7) self.timerBoards.append(board) self.tooltip = None self.image = ui.ImageBox() self.image.SetParent(self) self.image.SetPosition(342, 36) self.textLine = ui.MakeTextLine(self) self.textLine.SetPosition(342 - 178, 36 - 85 - 142) self.textLine2 = ui.MakeTextLine(self) self.textLine2.SetPosition(28, -167) self.textLine2.SetWindowHorizontalAlignRight() self.textLine2.SetHorizontalAlignRight() self.textLine3 = ui.MakeTextLine(self) self.textLine3.SetPosition(28, -150) self.textLine3.SetWindowHorizontalAlignRight() self.textLine3.SetHorizontalAlignRight() self.textLine4 = ui.MakeTextLine(self) self.textLine4.SetPosition(28, -133) self.textLine4.SetWindowHorizontalAlignRight() self.textLine4.SetHorizontalAlignRight() self.index = 0 self.SetDescription(0) #default def SetDescription(self, index): self.index = index self.image.LoadImage(DESCRIPTION[index][0]) self.textLine.SetText(DESCRIPTION[index][1]) self.itemSlot.SetItemSlot(0, DESCRIPTION[index][5]) self.image.Show() self.textLine2.SetText(str(DESCRIPTION[index][2])) self.textLine3.SetText(str(DESCRIPTION[index][3])) self.textLine4.SetText(str(DESCRIPTION[index][4])) self.__ClearList() for line in DESCRIPTION[index][11]: textLine = ui.TextLine() textLine.SetParent(self.listDesc) textLine.Show() textLine.SetText(line) self.listDesc.AppendItem(textLine) def __ClearList(self): for item in self.listDesc.itemList: item = None self.listDesc.RemoveAllItems() def SetTimeLeft(self, index, time): self.timerBoards[index].SetTimeLeft(time); def SetToolTip(self, tooltip): self.tooltip = tooltip self.tooltip.Hide() def __OnOverInItem(self, slotIndex): self.tooltip.SetItemToolTip(DESCRIPTION[self.index][5]) def __OnOverOutItem(self): self.tooltip.HideToolTip() def Open(self): self.Show() def Close(self): self.Hide() def OnUpdate(self): for x in xrange(11): self.timerBoards[x].UpdateTime(x) def OnScrollWheel(self, len): if len >= 0: self.scrollBar.OnUp() else: self.scrollBar.OnDown() return True def OnRunMouseWheel(self, nLen): if nLen > 0: self.scrollBar.OnUp() else: self.scrollBar.OnDown() def OnPressEscapeKey(self): self.Close() return True def Destroy(self): self.ClearDictionary() self.image = None self.textLine = None self.textLine2 = None self.textLine3 = None self.textLine4 = None self.titleBar = None self.itemSlot = None self.listDesc = None self.scrollBar = None for t in self.timerBoards: t.Destroy() t = None del self.timerBoards[:]
hocam içinde şöyle geçmiş:
open:def Open(self): self.Show()
aradığımız open burdaki değil mi
hocam sizin attığınız pylerde EventCalander isminde button yok yine de ekleyeyim miBunu dene uiScript deki minimap dosyasına EventCalanderButton ekle
senin attığını geri sana yüklemişim Düzenlediğimi attım şimdihocam sizin attığınız pylerde EventCalander isminde button yok yine de ekleyeyim mi
senin attığını geri sana yüklemişim Düzenlediğimi attım şimdi
1102 18:51:20612 :: Traceback (most recent call last):
1102 18:51:20612 :: File "networkModule.py", line 239, in SetGamePhase
1102 18:51:20612 :: File "game.py", line 87, in __init__
1102 18:51:20612 :: File "interfaceModule.py", line 878, in ShowDefaultWindows
1102 18:51:20613 :: File "uiMiniMap.py", line 314, in Show
1102 18:51:20613 :: File "uiMiniMap.py", line 382, in __LoadWindow
1102 18:51:20613 :: AttributeError
1102 18:51:20613 :: :
1102 18:51:20613 :: 'int' object has no attribute 'SetTooltipPosition'
1102 18:51:20613 ::
Init içine tooltip'ini eklePython:1102 18:51:20612 :: Traceback (most recent call last): 1102 18:51:20612 :: File "networkModule.py", line 239, in SetGamePhase 1102 18:51:20612 :: File "game.py", line 87, in __init__ 1102 18:51:20612 :: File "interfaceModule.py", line 878, in ShowDefaultWindows 1102 18:51:20613 :: File "uiMiniMap.py", line 314, in Show 1102 18:51:20613 :: File "uiMiniMap.py", line 382, in __LoadWindow 1102 18:51:20613 :: AttributeError 1102 18:51:20613 :: : 1102 18:51:20613 :: 'int' object has no attribute 'SetTooltipPosition' 1102 18:51:20613 ::
hocam bu sizin attığınızı atıp buttonu oluşturunca bu sys i verdi