Jump to content

[Python]Unrecognized function


Go to solution Solved by Frozen,

Recommended Posts

  • Premium

So, what is happening? I get this in syserr:

'MyDialog' object has no attribute '_Interface__OnRefresh'

That's the structure of the file which contains "MyDialog", BUT I deleted some parts of the script because is kinda big.

import app
import os
import chat
import ui
import locale
import uiScriptLocale
import uiCommon
import snd
import constInfo
import event
import net
import interfaceModule

class MyDialog(ui.ScriptWindow):
	def __init__(self):
		ui.ScriptWindow.__init__(self)

		self.isLoaded=0
		self.selectEvent=None
		self.fileListBox=None

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

	def Show(self):
		if self.isLoaded==0:
			self.isLoaded=1

		ui.ScriptWindow.Show(self)

	def Open(self):
		self.Show()
		self.SetCenterPosition()
		self.SetTop()

	def Close(self):
		self.popupDialog.Hide()
		self.Hide()

	def OnPressEscapeKey(self):
		self.Close()
		return TRUE

    def __OnRefresh(self):
        return

On the "interfacemodule.py" I have:

...
import uiMyDialog
...
	def __init__(self):
		...
		self.wndMyDialog = None
		...

	def RefreshMyDialog(self):
		self.wndMyDialog.__OnRefresh()

	def __MakeMessengerWindow(self):
		...
		self.wndMyDialog = uiMyDialog.MyDialog()
		...

So, when I call this function from game.py

self.interface.RefreshMyDialog()

I get the error I posted above. I really don't understand why...

Link to comment
https://metin2.dev/topic/5636-pythonunrecognized-function/
Share on other sites

  • Replies 7
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

  • Premium

ur fail is here:

 

8dba6f7e1515596f73ad2c06c775084c.png

def onrefresh 1 tab more ? u need delete 1 tab.

 

Regards.

 

No, the identation is ok. It's shown like that only here, on forum.

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
https://metin2.dev/topic/5636-pythonunrecognized-function/#findComment-35637
Share on other sites

when u execute the script:

    def RefreshMyDialog(self):
        self.wndMyDialog.__OnRefresh()
 
    def __MakeMessengerWindow(self):
        ...
        self.wndMyDialog = uiMyDialog.MyDialog()

u first load the

def __MakeMessengerWindow(self):

and then

def RefreshMyDialog(self):

?

Link to comment
https://metin2.dev/topic/5636-pythonunrecognized-function/#findComment-35638
Share on other sites

  • Premium

when u execute the script:

    def RefreshMyDialog(self):
        self.wndMyDialog.__OnRefresh()
 
    def __MakeMessengerWindow(self):
        ...
        self.wndMyDialog = uiMyDialog.MyDialog()

u first load the

def __MakeMessengerWindow(self):

and then

def RefreshMyDialog(self):

?

 

That's only declaration. I execute the function after it's being declared and things.

Link to comment
https://metin2.dev/topic/5636-pythonunrecognized-function/#findComment-35652
Share on other sites

  • Solution

I think the problem is that you didnt define the :

self.wndMyDialog

so when you do this:

self.interface.RefreshMyDialog()
 
The code dont run the:
 
__MakeMessengerWindow
So try putting the self.wndMyDialog defined in the init function, like this:
 def __init__(self):
     self.wndMyDialog = uiMyDialog.MyDialog()

Sorry for my bad english,...

 

#Edit 

Oh and if isnt that i think it is because the function has __ in the name, and i think that is only for functions that are not going to be called by another class..

 

So try to rename the funtion to 

def OnRefresh(self):

Kind Regards,

Frozen

 
Link to comment
https://metin2.dev/topic/5636-pythonunrecognized-function/#findComment-35662
Share on other sites

  • Premium

 

I think the problem is that you didnt define the :

self.wndMyDialog

so when you do this:

self.interface.RefreshMyDialog()
 
The code dont run the:
 
__MakeMessengerWindow
So try putting the self.wndMyDialog defined in the init function, like this:
 def __init__(self):
     self.wndMyDialog = uiMyDialog.MyDialog()

Sorry for my bad english,...

 

#Edit 

Oh and if isnt that i think it is because the function has __ in the name, and i think that is only for functions that are not going to be called by another class..

 

So try to rename the funtion to 

def OnRefresh(self):

Kind Regards,

Frozen

 

 

 

How the actual fuck?

The thing with "__" worked. HOW THE HELL? I can't believe it.

Thank you anyway.

Link to comment
https://metin2.dev/topic/5636-pythonunrecognized-function/#findComment-35669
Share on other sites

 

 

I think the problem is that you didnt define the :

self.wndMyDialog

so when you do this:

self.interface.RefreshMyDialog()
 
The code dont run the:
 
__MakeMessengerWindow
So try putting the self.wndMyDialog defined in the init function, like this:
 def __init__(self):
     self.wndMyDialog = uiMyDialog.MyDialog()

Sorry for my bad english,...

 

#Edit 

Oh and if isnt that i think it is because the function has __ in the name, and i think that is only for functions that are not going to be called by another class..

 

So try to rename the funtion to 

def OnRefresh(self):

Kind Regards,

Frozen

 

 

 

How the actual fuck?

The thing with "__" worked. HOW THE HELL? I can't believe it.

Thank you anyway.

 

Yeah i know ;) i was like that when the error occurred me for the first time...

Link to comment
https://metin2.dev/topic/5636-pythonunrecognized-function/#findComment-35675
Share on other sites

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • 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.