Register for your free account! | Forgot your password?

You last visited: Today at 22:02

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[MiniRLS] TitleBar upgrade

Discussion on [MiniRLS] TitleBar upgrade within the Metin2 PServer Guides & Strategies forum part of the Metin2 Private Server category.

Reply
 
Old   #1
 
xP3NG3Rx's Avatar
 
elite*gold: 50
Join Date: May 2011
Posts: 270
Received Thanks: 991
[MiniRLS] TitleBar upgrade

Hi,

I came with a python modification this time.
With this little stuff you can add the minimize button and hide the close button on your custom windows if you have a little knowledge about python, but if you have not, you could see in this post some examples below. The new images(2) what need for this, are attached.

On this picture you can see, the minimize button, and the hidden close button:

And here is my notion why I did this (:

Replace your TitleBar class in the ui.py with this or compare with yours and implement it by yourself:
Code:
class TitleBar(Window):

	BLOCK_WIDTH = 32
	BLOCK_HEIGHT = 23

	def __init__(self):
		Window.__init__(self)
		self.AddFlag("attach")

	def __del__(self):
		Window.__del__(self)

	def MakeTitleBar(self, width, color):

		## ÇöŔç Color´Â »çżëÇϰí ŔÖÁö ľĘŔ˝

		width = max(64, width)

		imgLeft = ImageBox()
		imgCenter = ExpandedImageBox()
		imgRight = ImageBox()

		imgLeft.AddFlag("not_pick")
		imgCenter.AddFlag("not_pick")
		imgRight.AddFlag("not_pick")

		imgLeft.SetParent(self)
		imgCenter.SetParent(self)
		imgRight.SetParent(self)

		if localeInfo.IsARABIC():
			imgLeft.LoadImage("locale/ae/ui/pattern/titlebar_left.tga")
			imgCenter.LoadImage("locale/ae/ui/pattern/titlebar_center.tga")
			imgRight.LoadImage("locale/ae/ui/pattern/titlebar_right.tga")
		else:
			imgLeft.LoadImage("d:/ymir work/ui/pattern/titlebar_left.tga")
			imgCenter.LoadImage("d:/ymir work/ui/pattern/titlebar_center.tga")
			imgRight.LoadImage("d:/ymir work/ui/pattern/titlebar_right.tga")

		imgLeft.Show()
		imgCenter.Show()
		imgRight.Show()

		btnClose = Button()
		btnClose.SetParent(self)
		btnClose.SetUpVisual("d:/ymir work/ui/public/close_button_01.sub")
		btnClose.SetOverVisual("d:/ymir work/ui/public/close_button_02.sub")
		btnClose.SetDownVisual("d:/ymir work/ui/public/close_button_03.sub")
		btnClose.SetToolTipText(localeInfo.UI_CLOSE, 0, -23)
		btnClose.Show()

		#Minimize Baseframe
		btnMinimize = ImageBox()
		btnMinimize.AddFlag("not_pick")
		btnMinimize.SetParent(self)
		btnMinimize.LoadImage("d:/ymir work/ui/pattern/titlebar_minimize_baseframe.tga")
		btnMinimize.Hide()

		#Minimize Button
		btnMinimize.Button = Button()
		btnMinimize.Button.SetParent(btnMinimize)
		btnMinimize.Button.SetPosition(3, 3)
		btnMinimize.Button.SetUpVisual("d:/ymir work/ui/public/minimize_button_01.sub")
		btnMinimize.Button.SetOverVisual("d:/ymir work/ui/public/minimize_button_02.sub")
		btnMinimize.Button.SetDownVisual("d:/ymir work/ui/public/minimize_button_03.sub")
		btnMinimize.Button.SetToolTipText(localeInfo.UI_MINIMIZE, 0, -23)
		btnMinimize.Button.Show()

		self.imgLeft = imgLeft
		self.imgCenter = imgCenter
		self.imgRight = imgRight
		self.btnClose = btnClose
		self.btnMinimize = btnMinimize

		self.SetWidth(width)

	def AdjustButtonsPosition(self):
		if localeInfo.IsARABIC():
			self.btnClose.SetPosition(3, 3)
			if self.btnClose.IsShow():
				self.btnMinimize.SetPosition(3 + self.btnClose.GetWidth(), 3)
			else:
				self.btnMinimize.SetPosition(3, 3)
		else:
			self.btnClose.SetPosition(self.GetWidth() - self.btnClose.GetWidth() - 3, 3)
			if self.btnClose.IsShow():
				self.btnMinimize.SetPosition(self.GetWidth() - self.btnClose.GetWidth() - self.btnMinimize.GetWidth() - 6, 0)
			else:
				self.btnMinimize.SetPosition(self.GetWidth() - self.btnMinimize.GetWidth(), 0)

	def SetWidth(self, width):
		self.imgCenter.SetRenderingRect(0.0, 0.0, float((width - self.BLOCK_WIDTH*2) - self.BLOCK_WIDTH) / self.BLOCK_WIDTH, 0.0)
		self.imgCenter.SetPosition(self.BLOCK_WIDTH, 0)
		self.imgRight.SetPosition(width - self.BLOCK_WIDTH, 0)

		self.SetSize(width, self.BLOCK_HEIGHT)

		self.AdjustButtonsPosition()

	def SetCloseEvent(self, event):
		self.btnClose.SetEvent(event)

	def SetMinimizeEvent(self, event):
		self.btnMinimize.Button.SetEvent(event)

	def CloseButtonHide(self):
		self.imgRight.LoadImage("d:/ymir work/ui/pattern/titlebar_right_02.tga")
		self.btnClose.SetEvent(lambda *args,**kwargs:None)
		self.btnClose.Hide()

		self.AdjustButtonsPosition()

	def MinimizeButtonShow(self):
		if not self.btnClose.IsShow():
			self.imgRight.LoadImage("d:/ymir work/ui/pattern/titlebar_right.tga")

		self.btnMinimize.Show()

		self.AdjustButtonsPosition()
As I said, here are some tips how to use it:
1. If you want to do only one act like hiding the close button or showing the minimize button:
Code:
	self.GetChild("TitleBar").CloseButtonHide()
or
	self.GetChild("TitleBar").MinimizeButtonShow()
2. If you want to do multiple acts like show close button with setevent and show minimize button I recommend to store the titlebar in a variable to call more methods of it.
Code:
			self.TitleBar = self.GetChild("TitleBar")
			self.TitleBar.SetCloseEvent(ui.__mem_func__(self.Close))
			self.TitleBar.MinimizeButtonShow()
			self.TitleBar.SetMinimizeEvent(ui.__mem_func__(self.Minimize))

or, what I never use:
			self.GetChild("TitleBar").SetCloseEvent(ui.__mem_func__(self.Close))
			self.GetChild("TitleBar").MinimizeButtonShow()
			self.GetChild("TitleBar").SetMinimizeEvent(ui.__mem_func__(self.Minimize))

	def Minimize(self):
		import chat
		chat.AppendChat(chat.CHAT_TYPE_INFO, "Minimize Button...")
3. Add this line into your locale/$$/locale_game.txt
Code:
UI_MINIMIZE	Minimize
I hope you like it, and sorry for my bad english, I hope it is understandable.
Attached Files
File Type: rar minimize.rar (3.2 KB, 145 views)
xP3NG3Rx is offline  
Thanks
13 Users
Old 05/26/2016, 16:38   #2
 
DasSchwarzeT's Avatar
 
elite*gold: 399
Join Date: Sep 2011
Posts: 5,323
Received Thanks: 3,937
Pretty useful
DasSchwarzeT is offline  
Thanks
1 User
Old 05/26/2016, 17:29   #3

 
UnluckyPadan's Avatar
 
elite*gold: 80
Join Date: May 2016
Posts: 52
Received Thanks: 22
Köszi and many thank you for the nice Release !



Kind regards,
UnluckyPadan
UnluckyPadan is offline  
Thanks
1 User
Old 06/14/2016, 14:54   #4
 
1stAntonio's Avatar
 
elite*gold: 0
Join Date: Jan 2013
Posts: 208
Received Thanks: 5
I change in ui.py and have this problem
0614 15:53:21600 :: File "networkModule.py", line 247, in SetGamePhase

0614 15:53:21600 :: File "game.py", line 97, in __init__

0614 15:53:21600 :: File "switchbot.py", line 1286, in __init__

0614 15:53:21600 :: File "ui.py", line 1860, in __init__

0614 15:53:21600 :: File "ui.py", line 1587, in MakeTitleBar

0614 15:53:21600 :: AttributeError
0614 15:53:21600 :: :
0614 15:53:21600 :: 'module' object has no attribute 'UI_MINIMIZE'
0614 15:53:21600 ::
1stAntonio is offline  
Thanks
1 User
Old 06/15/2016, 02:33   #5
 
xP3NG3Rx's Avatar
 
elite*gold: 50
Join Date: May 2011
Posts: 270
Received Thanks: 991
I forget to say something about locale_*.txt stuff.
You should to add a newline in your locale_interface.txt

UI_MINIMIZE<TAB>Minimize
xP3NG3Rx is offline  
Thanks
1 User
Old 06/16/2016, 12:24   #6
 
gerald500's Avatar
 
elite*gold: 150
Join Date: Sep 2010
Posts: 1,049
Received Thanks: 275
Very cool i needed This

Gesendet von meinem S30 mit Hilfe von Elitepvpers, bereitgestellt von appyet.com
gerald500 is offline  
Thanks
1 User
Old 06/18/2016, 11:10   #7
 
elite*gold: 2
Join Date: Jun 2013
Posts: 1,063
Received Thanks: 1,724
Wow this is a good idea. Nice
ProfessorEnte is offline  
Thanks
1 User
Old 06/19/2016, 17:40   #8
 
xP3NG3Rx's Avatar
 
elite*gold: 50
Join Date: May 2011
Posts: 270
Received Thanks: 991
Thanks for your feedbacks and I'm glad to like it. I made a little video to show why I wrote this little stuff which you can find in the main post.
xP3NG3Rx is offline  
Old 06/21/2016, 14:58   #9
 
elite*gold: 0
Join Date: Oct 2011
Posts: 14
Received Thanks: 2
Nice

Gesendet von meinem SM-N9005 mit Hilfe von Elitepvpers, bereitgestellt von appyet.com
N1nJa2011 is offline  
Reply

Tags
metin2, minimize, python, titlebar


Similar Threads Similar Threads
[Release] War Commander Hack Upgrade Free + Instant Upgrade 09/02/2015
12/27/2019 - Facebook - 10 Replies
Features contained in War Commander Hack Complete: 1.Hack Instant Upgrade 2. Hack Free Upgrade War Commander Hack Upgrade Free + Instant Upgrade 09/02/2015 - Zone Cheat Game War Commander Hack Upgrade Free + Instant Upgrade - Vidéo Dailymotion
[MiniRLS] MD5 Hash Generator - BY DEEEEECAYYYYY
12/11/2015 - Metin2 PServer Guides & Strategies - 15 Replies
kori papa hat gesagt soll weg machen :(
[RELEASE] BACKYARD MONSTERS - FREE UPGRADE - INSTANT UPGRADE {NOVEMBER 2014}
05/03/2015 - Facebook - 12 Replies
I made a website that explains it all for you guys. Enjoy. Backyard monsters Exploits



All times are GMT +1. The time now is 22:06.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.