Jump to content

aeldra button on inventory


Recommended Posts

I tried to add this system Adalet-CsWork-Fast Menu System(Hızlı Menü Sistemi) , i don't have switchbot  and change code but i have this error. 

Someone can show me or example how to put any function on button ?

1217 21:18:14697 :: 
uiPickMoney.py(line:20) LoadDialog
ui.py(line:3290) LoadScriptFile
ui.py(line:3409) LoadChildren
ui.py(line:2145) __init__

MoneyDialog.LoadDialog.LoadScript - <type 'exceptions.AttributeError'>:'BoardWithTitleBar' object has no attribute 'SetCloseEvent'

1217 21:18:14697 :: ============================================================================================================
1217 21:18:14697 :: Abort!!!!

My change code 

		def __LoadWindow(self):
			if self.isLoaded == 1:
				return
			self.isLoaded = 1
			try:
				pyScrLoader = ui.PythonScriptLoader()
				pyScrLoader.LoadScriptFile(self, "UIScript/FastInventoryWindow.py")
			except:
				import exception
				exception.Abort("FastInventoryWindow.LoadWindow.LoadObject")
			try:
				self.wndFastInventoryLayer = self.GetChild("FastInventoryLayer")
				self.GetChild("Menu_1").SetEvent(ui.__mem_func__(self.ClickMenu1))
				self.GetChild("Menu_2").SetEvent(ui.__mem_func__(self.ClickMenu2))
				self.GetChild("Menu_3").SetEvent(ui.__mem_func__(self.ClickMenu1))
				self.GetChild("Menu_4").SetEvent(ui.__mem_func__(self.ClickMenu1))
				self.GetChild("Menu_5").SetEvent(ui.__mem_func__(self.ClickMenu1))
				self.GetChild("Menu_6").SetEvent(ui.__mem_func__(self.ClickMenu1))
			except:
				import exception
				exception.Abort("FastInventoryWindow.LoadWindow.BindObject")
		def ClickMenu1(self):
			return True
		def ClickMenu2(self):
			if self.wndInventory.interface:
				self.wndInventory.interface()
			return True

 

Original code

		def __LoadWindow(self):
			if self.isLoaded == 1:
				return
			self.isLoaded = 1
			try:
				pyScrLoader = ui.PythonScriptLoader()
				pyScrLoader.LoadScriptFile(self, "UIScript/FastInventoryWindow.py")
			except:
				import exception
				exception.Abort("FastInventoryWindow.LoadWindow.LoadObject")
			try:
				self.wndFastInventoryLayer = self.GetChild("FastInventoryLayer")
				self.GetChild("Menu_1").SetEvent(ui.__mem_func__(self.ClickMenu1))
				self.GetChild("Menu_2").SetEvent(ui.__mem_func__(self.ToggleSwitchbotClick))
				self.GetChild("Menu_3").SetEvent(ui.__mem_func__(self.ClickMenu1))
				self.GetChild("Menu_4").SetEvent(ui.__mem_func__(self.ClickMenu1))
				self.GetChild("Menu_5").SetEvent(ui.__mem_func__(self.ClickMenu1))
				self.GetChild("Menu_6").SetEvent(ui.__mem_func__(self.ClickMenu1))
			except:
				import exception
				exception.Abort("FastInventoryWindow.LoadWindow.BindObject")
			try:
				import uiSwitchbot
				self.wndSwitchbot = uiSwitchbot.SwitchbotWindow()
			except:
				import exception
				exception.Abort("FastInventoryWindow.LoadWindow.BindObject")
		def ToggleOfflineShopClick(self):
			return True
		def ToggleSwitchbotClick(self):
			if self.wndSwitchbot.IsShow(): self.wndSwitchbot.Close()
			else: self.wndSwitchbot.Open()
		def ClickMenu1(self):
			if self.wndInventory.interface:
				self.wndInventory.interface.ToggleSwitchbotWindow()
			return True

 

Link to comment
Share on other sites

Y dont expert in pyhton but read you self. (line 20-21 stared) and see your lines:

self.GetChild("Menu_2").SetEvent(ui.__mem_func__(self.ClickMenu2))

 

No is Menu1??

self.GetChild("Menu_2").SetEvent(ui.__mem_func__(self.ClickMenu1))

 

 

Sorry, my english not is good 

Edited by gideon18
Link to comment
Share on other sites

58 minutes ago, gideon18 said:

Y dont expert in pyhton but read you self. (line 20-21 stared) and see your lines:

self.GetChild("Menu_2").SetEvent(ui.__mem_func__(self.ClickMenu2))

 

No is Menu1??

self.GetChild("Menu_2").SetEvent(ui.__mem_func__(self.ClickMenu1))

 

 

Sorry, my english not is good 

Menu_1 is for display buton and menu1 is for funcțion 

def ClickMenu1(self):

return True

def ClickMenu2(self):

Link to comment
Share on other sites

7 minutes ago, gideon18 said:

I mean that menu2 does not exist, you should create the menu2 function, since the previous menu2 was the switchbot function, if you have not done the menu2 function, it does not exist and you will not be able to read it and it gives you, as it says, a loading error , try changing the switchbot function that you don't use for the one in menu2, looking at that data is the only thing I see or I'm sorry I can't be of more help, I'm also a novice

I know what you mean, but the problem was from ui.py ,not because of the menu, because I tried without functions on the buttons and put something like that

		def ClickMenu1(self):
			return True
		def ClickMenu2(self):
			if self.wndInventory.interface:
				self.wndInventory.interface()
			return True

now to make the buttons function

 

EDIT: 

in order to solve it, I had to make certain functions in ui.py and define SetCloseEvent in the BoardWithTitleBar class, in addition to other definitions that were required of me

Edited by Tr3l
answer for the solution
  • Good 1
Link to comment
Share on other sites

On 12/18/2023 at 6:33 PM, Tr3l said:

I know what you mean, but the problem was from ui.py ,not because of the menu, because I tried without functions on the buttons and put something like that

		def ClickMenu1(self):
			return True
		def ClickMenu2(self):
			if self.wndInventory.interface:
				self.wndInventory.interface()
			return True

now to make the buttons function

 

EDIT: 

in order to solve it, I had to make certain functions in ui.py and define SetCloseEvent in the BoardWithTitleBar class, in addition to other definitions that were required of me

exactly, setcloseevent asked you inside the ui.py

Link to comment
Share on other sites

  • 4 weeks later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.