Jump to content

Recommended Posts

Hi all. I tried some times to customize my client's login windows by linking each visible button with a link to be opened in a new tab in web browser.

 

I've truly no idea about how to do that, so i would appreciate any kind of help you can give to me. 

 

Thank you in advance!

  • Love 1
Link to comment
https://metin2.dev/topic/6405-external-links-in-login-window/
Share on other sites

Hi cCorax, thank you so much for your reply. 

 

Buttons are already defined, but when pressed in the login windows, appears no further action.

 

I've looked in syserr and couldn't find an error in here about that problem.

 

Ty again!

  • Active+ Member

If you want open url in ingame browser

	def OpenWebWindow(self):
		width, height = int(max(wndMgr.GetScreenWidth() / 2, 800)), int(min(wndMgr.GetScreenHeight() / 1.5, 600))
		x, y = wndMgr.GetScreenWidth() / 2 - width / 2, wndMgr.GetScreenHeight() / 2 - height / 2
		self.webWindow = ui.BoardWithTitleBar()
		self.webWindow.AddFlag("movable")
		self.webWindow.AddFlag("attach")
		self.webWindow.SetSize(width, height)
		self.webWindow.SetPosition(x, y)
		app.ShowWebPage("http://google.com", (x+10, y+40, x+width-20, y+height-40))
		self.webWindow.Show()
		self.webWindow.SetTop()
		
	def HideWebWindow(self):
		self.webWindow.Hide()
		app.HideWebPage()

If you want open url in normal web browser

def OpenUrlWithBrowser(self):
	import os
	url="http://google.com"
	os.popen("start %s" % (url))
  • Premium

This is the my version:

loginwindow.py (in locale):

		{
			"name" : "WepPageButton",
			"type" : "button",

			"x" : , #write here the x coordinate
			"y" : , #write here the y coordinate

			"default_image" : "d:/ymir work/ui/public/large_button_01.sub",
			"over_image" : "d:/ymir work/ui/public/large_button_02.sub",
			"down_image" : "d:/ymir work/ui/public/large_button_03.sub",

			"text" : , #write here the button text
		},

intrologin.py (in root)

search:

import uiScriptLocale

Write under:

import webbrowser

Now search:

self.loginExitButton		= GetObject("LoginExitButton")

Write under:

self.WepPageButton			= GetObject("WepPageButton")

Now search:

self.loginExitButton.SetEvent(ui.__mem_func__(self.__OnClickExitButton))

Write under:

self.WepPageButton.SetEvent(ui.__mem_func__(self.__WebPageTest))

Now create this function:

	def __WebPageTest(self):
		webbrowser.open_new("write here your url")

The last thing put this, in the lib folder:

This is the hidden content, please

  • Metin2 Dev 27
  • Think 1
  • Love 14

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.