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
Share on other sites

  • Replies 7
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

  • 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
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
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
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
Share on other sites

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.