Jump to content

Call question dialog


Recommended Posts

  • Silver

Hey guys,

someone can help me call question dialog in this function? I'll be really glad.

Spoiler
def ExitSelect(self):
  
		if LEAVE_BUTTON_FOR_POTAL:
			if app.loggined:
				self.stream.SetPhaseWindow(0)
			else:
				self.stream.setloginphase()
		else:
			self.stream.SetLoginPhase()

		self.Hide()

 

Thanks for answers!

Sincerely,

ReFresh

I'll be always helpful! 👊 

Link to comment
Share on other sites

def ExitSelect(self):
	import uiCommon
	self.selectDialog = uiCommon.QuestionDialog()
	self.selectDialog.SetText("what do you want to do?")
	self.selectDialog.SetAcceptEvent(ui.__mem_func__(self.SelectPortal), 1)
	self.selectDialog.SetCancelEvent(ui.__mem_func__(self.SelectPortal), 0)
	self.selectDialog.Open()

def	SelectPortal(self, arg):
	if not arg == 0:
		if LEAVE_BUTTON_FOR_POTAL:
			if app.loggined:
				self.stream.SetPhaseWindow(0)
			else:
				self.stream.setloginphase()
		else:
			self.stream.SetLoginPhase()
		self.Hide()

 

Link to comment
Share on other sites

  • Silver

@bossy_maxThanks, but it doesn't work. Got some errors.

I edited it little bit, I think it's the same:

Spoiler
def ExitSelect(self, arg):
		if not arg == 0:
			if LEAVE_BUTTON_FOR_POTAL:
				if app.loggined:
					self.stream.SetPhaseWindow(0)
				else:
					self.stream.setloginphase()
			else:
				self.stream.SetLoginPhase()

			self.Hide()
	
	def ExitPopUp(self):
		import uiCommon
		
		self.selectDialog = uiCommon.QuestionDialog()
		self.selectDialog(localeInfo.SELECT_CAN_NOT_DELETE)
		self.selectDialog.SetAcceptEvent(ui.__mem_func__(self.ExitSelect), 1)
		self.selectDialog.SetCancelEvent(ui.__mem_func__(self.ExitSelect), 0)
		self.selectDialog.Open()

 

I just got this sysser error:

Spoiler
1031 03:25:06556 :: Traceback (most recent call last):

1031 03:25:06556 ::   File "ui.py", line 1072, in CallEvent

1031 03:25:06556 ::   File "ui.py", line 93, in __call__

1031 03:25:06556 ::   File "ui.py", line 84, in __call__

1031 03:25:06556 :: TypeError
1031 03:25:06556 :: : 
1031 03:25:06556 :: ExitSelect() takes exactly 2 arguments (1 given)
1031 03:25:06556 :: 

 

And when I tried this, it doesn't work too and sysser is clear:

Spoiler
def ExitPopUp(self, answer):
	
		if answer:
			self.selectDialog = uiCommon.QuestionDialog()
			self.selectDialog.SetText(localeInfo.DO_YOU_WANT_CLOSE)
			self.selectDialog.SetAcceptEvent(lambda arg=True: self.ExitSelect(arg))
			self.selectDialog.SetCancelEvent(lambda arg=False: self.ExitSelect(arg))
			self.selectDialog.Open()

	def ExitSelect(self):
		self.dlgQuestion.Hide()

		if LEAVE_BUTTON_FOR_POTAL:
			if app.loggined:
				self.stream.SetPhaseWindow(0)
			else:
				self.stream.setloginphase()
		else:
			if self.ExitPopUp == 1:
				self.stream.SetLoginPhase()
			else:
				return

		self.Hide()

 

This function must be called after you confirm dialog with true value: self.stream.SetLoginPhase()

Edited by ReFresh

I'll be always helpful! 👊 

Link to comment
Share on other sites

	def ExitSelect(self):
		self.dlgQuestion.Hide()
		self.exitPopupDlg = uiCommon.QuestionDialog()
		self.exitPopupDlg.SetText(localeInfo.DO_YOU_WANT_CLOSE)
		self.exitPopupDlg.SetAcceptEvent(lambda arg=True: self.ExitSelectAnswer(arg))
		self.exitPopupDlg.SetCancelEvent(lambda arg=False: self.ExitSelectAnswer(arg))
		self.exitPopupDlg.Open()

	def ExitSelectAnswer(self, arg):
		if self.exitPopupDlg:
			self.exitPopupDlg.Hide()
		if arg:
			self.ExitSelectConfirm()


	def ExitSelectConfirm(self):
		if LEAVE_BUTTON_FOR_POTAL:
			if app.loggined:
				self.stream.SetPhaseWindow(0)
			else:
				self.stream.setloginphase()
		else:
			self.stream.SetLoginPhase()
		self.Hide()

Try this, must work

Edited by PetePeter
  • Love 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

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.