import ui
import dbg
import app
import wndMgr
import net
import player
import localeInfo
import chr
import chat
class ProfileWindoww(ui.Window):
class TextToolTip(ui.Window):
def __init__(self):
ui.Window.__init__(self, "TOP_MOST")
textLine = ui.TextLine()
textLine.SetParent(self)
textLine.SetHorizontalAlignCenter()
textLine.SetOutline()
textLine.Show()
self.textLine = textLine
def __del__(self):
ui.Window.__del__(self)
def SetText(self, text):
self.textLine.SetText(text)
def OnRender(self):
(mouseX, mouseY) = wndMgr.GetMousePosition()
self.textLine.SetPosition(mouseX, mouseY - 15)
def __init__(self):
ui.Window.__init__(self)
self.BuildWindow()
def __del__(self):
ui.Window.__del__(self)
def BuildWindow(self):
self.Board = ui.BoardWithTitleBar()
self.Board.SetSize(400, 465)
self.Board.SetPosition(68, wndMgr.GetScreenHeight()-650)
self.Board.AddFlag('movable')
self.Board.SetTitleName("Vezi profilul")
self.Board.AddFlag('float')
self.Board.Hide()
self.comp = Component()
self.blockval=64
self.txtName = self.comp.TextLine(self.Board, 'Nume ', 90, 28+30, self.comp.RGB(255, 255, 255))
self.txtGander = self.comp.TextLine(self.Board, 'Sex ', 30, 28+10, self.comp.RGB(255, 255, 255))
self.txtDeeanh = self.comp.TextLine(self.Board, 'Religie ', 140, 28+(2*28), self.comp.RGB(255, 255, 255))
self.txtAge = self.comp.TextLine(self.Board, 'Varsta', 90, 28+(2*28), self.comp.RGB(255, 255, 255))
self.txtCity = self.comp.TextLine(self.Board, 'Oras', 140, 28+(3*28+14), self.comp.RGB(255, 255, 255))
self.txtCountry = self.comp.TextLine(self.Board, 'Tara', 120, 28+(3*28+14), self.comp.RGB(255, 255, 255))
self.txtFcbook = self.comp.TextLine(self.Board, 'Facebook', 60, 28+(5*28), self.comp.RGB(255, 255, 255))
self.txtWebsite = self.comp.TextLine(self.Board, 'Site-ul tau', 65, 28+(7*28), self.comp.RGB(255, 255, 255))
self.txtSkype = self.comp.TextLine(self.Board, 'Skype', 65, 28+(9*28), self.comp.RGB(255, 255, 255))
self.txtNote = self.comp.TextLine(self.Board, 'Nota', 50, 28+(11*28), self.comp.RGB(255, 255, 255))
self.Update_btn = ui.Button()
self.Update_btn.SetParent(self.Board)
self.Update_btn.SetPosition(50,28+(13*28)+18+18)
self.Update_btn.SetUpVisual('d:/ymir work/ui/public/XLarge_Button_01.sub')
self.Update_btn.SetOverVisual('d:/ymir work/ui/public/XLarge_Button_02.sub')
self.Update_btn.SetDownVisual('d:/ymir work/ui/public/XLarge_Button_03.sub')
self.Update_btn.SetText("Salveaza Profil")
self.Update_btn.SetEvent(ui.__mem_func__(self.UpdateEvent))
self.Update_btn.Show()
# self.blockBtn = self.comp.ToggleButton(self.Board, 'Block Profil', '', 20, 28+(13*28)+18+18, (lambda arg = 'off': self.btnblock_func(arg)), (lambda arg = 'on': self.btnblock_func(arg)), 'd:/ymir work/ui/public/middle_button_01.sub', 'd:/ymir work/ui/public/middle_button_02.sub', 'd:/ymir work/ui/public/middle_button_03.sub')
def OpenWindow(self,Name="",Gander="",Deeanh="",Age="",City="",Country="",Fcbook="",Website="",Skype="",Note=""):
name = player.GetName()
if Name != name:
self.editName = self.comp.EditLine(self.Board,str(Name), 147, 28+14+18, 100,20,24,False,False,"locale/ro/ui/profil/slot.tga")
self.editGander = self.comp.EditLine(self.Board,str(Gander), 35, 28+10, 55,20,6,False,False,"locale/ro/ui/profil/slot.tga")
self.editDeeanh = self.comp.EditLine(self.Board, str(Deeanh), 183, 28+(2*28)+18, 65,20,6,False,False,"locale/ro/ui/profil/slot.tga")
self.editAge = self.comp.EditLine(self.Board,str(Age), 57, 28+(2*28)+18, 55,20,6,False,False,"locale/ro/ui/profil/slot.tga")
self.editCity = self.comp.EditLine(self.Board, str(City), 183, 28+(3*28+14)+18, 65,20,11,False,False,"locale/ro/ui/profil/slot.tga")
self.editCountry = self.comp.EditLine(self.Board, str(Country), 27, 28+(3*28+14)+18, 100,20,11,False,False,"locale/ro/ui/profil/slot.tga")
self.editFcbook = self.comp.EditLine(self.Board,str(Fcbook), 83, 28+(5*28)+18, 170,20,24,False,False,"locale/ro/ui/profil/slot.tga")
self.editWebsite = self.comp.EditLine(self.Board, str(Website), 83, 28+(7*28)+18, 170,20,24,False,False,"locale/ro/ui/profil/slot.tga")
self.editSkype = self.comp.EditLine(self.Board, str(Skype), 83, 28+(9*28)+18, 170,20,24,False,False,"locale/ro/ui/profil/slot.tga")
self.editNote = self.comp.EditLine(self.Board, str(Note), 53, 28+(11*28)+18, 200,60,80,False,True,"locale/ro/ui/profil/slot.tga")
self.Update_btn.Hide()
# self.blockBtn.Hide()
else:
self.editName = self.comp.EditLine(self.Board,str(Name), 147, 28+14+18, 100,20,24,False,False,"locale/ro/ui/profil/slot.tga")
self.editGander = self.comp.EditLine(self.Board,str(Gander), 50, 25+10, 55,20,6,True,False,"locale/ro/ui/profil/slot.tga")
self.editDeeanh = self.comp.EditLine(self.Board, str(Deeanh), 183, 28+(2*28)+18, 65,20,6,True,False,"locale/ro/ui/profil/slot.tga")
self.editAge = self.comp.EditLine(self.Board,str(Age), 57, 28+(2*28)+18, 55,20,6,True,False,"locale/ro/ui/profil/slot.tga")
self.editCity = self.comp.EditLine(self.Board, str(City), 183, 28+(3*28+14)+18, 65,20,11,True,False,"locale/ro/ui/profil/slot.tga")
self.editCountry = self.comp.EditLine(self.Board, str(Country), 27, 28+(3*28+14)+18, 100,20,11,True,False,"locale/ro/ui/profil/slot.tga")
self.editFcbook = self.comp.EditLine(self.Board,str(Fcbook), 83, 28+(5*28)+18, 170,20,24,True,False,"locale/ro/ui/profil/slot.tga")
self.editWebsite = self.comp.EditLine(self.Board, str(Website), 83, 28+(7*28)+18, 170,20,24,True,False,"locale/ro/ui/profil/slot.tga")
self.editSkype = self.comp.EditLine(self.Board, str(Skype), 83, 28+(9*28)+18, 170,20,24,True,False,"locale/ro/ui/profil/slot.tga")
self.editNote = self.comp.EditLine(self.Board, str(Note), 53, 28+(11*28)+18, 200,60,80,True,True,"locale/ro/ui/profil/slot.tga")
self.Update_btn.Show()
#self.blockBtn.Show()
if self.Board.IsShow():
self.Board.Hide()
else:
self.Board.Show()
def UpdateEvent(self):
self.CheckInfo(str(self.editGander[1].GetText()),str(self.editDeeanh[1].GetText()),str(self.editAge[1].GetText()),str(self.editCity[1].GetText()),str(self.editCountry[1].GetText()),str(self.editFcbook[1].GetText()),str(self.editWebsite[1].GetText()),str(self.editSkype[1].GetText()),str(self.editNote[1].GetText()))
player.UpdateProfile(str(self.editName[1].GetText()),str(self.editGander[1].GetText()),str(self.editDeeanh[1].GetText()),str(self.editAge[1].GetText()),str(self.editCity[1].GetText()),str(self.editCountry[1].GetText()),str(self.editFcbook[1].GetText()),str(self.editWebsite[1].GetText()),str(self.editSkype[1].GetText()),str(self.editNote[1].GetText()))
chat.AppendChat(chat.CHAT_TYPE_INFO,"clickd")
#def btnblock_func(self, arg, do=1):
# if self.blockval == 64:
# net.SendChatPacket("/setblockmode " + str(self.blockval))
# self.blockBtn.Down()
# self.blockval = 32
# else:
# net.SendChatPacket("/setblockmode " + str(self.blockval))
# self.blockBtn.SetUp()
# self.blockval = 64
def CheckInfo(self,Gander,Deeanh,Age,City,Country,Fcbook,Website,Skype,Note):
if len(Gander)==0:
Gander = "..."
self.editGander[1].SetText(str(Gander))
if len(Deeanh)==0:
Deeanh = "..."
self.editDeeanh[1].SetText(str(Deeanh))
if len(Age)==0:
Age = "1"
self.editAge[1].SetText(str(Age))
if len(City)==0:
City = "...."
self.editCity[1].SetText(str(City))
if len(Country)==0:
Country = "...."
self.editCountry[1].SetText(str(Country))
if len(Fcbook)==0:
Fcbook = "fb.com/xxx"
self.editFcbook[1].SetText(str(Fcbook))
if len(Website)==0:
Website = "ww.xxx.com"
self.editWebsite[1].SetText(str(Website))
if len(Skype)==0:
Skype = "....."
self.editSkype[1].SetText(str(Skype))
if len(Note)==0:
Note = "................................"
self.editNote[1].SetText(str(Note))
def Close(self):
self.Board.Hide()
class Component:
def ToggleButton(self, parent, buttonName, tooltipText, x, y, funcUp, funcDown, UpVisual, OverVisual, DownVisual):
button = ui.ToggleButton()
if parent != None:
button.SetParent(parent)
button.SetPosition(x, y)
button.SetUpVisual(UpVisual)
button.SetOverVisual(OverVisual)
button.SetDownVisual(DownVisual)
button.SetText(buttonName)
button.SetToolTipText(tooltipText)
button.Show()
button.SetToggleUpEvent(funcUp)
button.SetToggleDownEvent(funcDown)
return button
def EditLine(self, parent, editlineText, x, y, width, heigh, max,isMe,isMulteLine, img):
SlotBar = ui.ImageBox()
SlotBar.LoadImage(img)
if parent != None:
SlotBar.SetParent(parent)
SlotBar.SetPosition(x, y)
SlotBar.Show()
if isMe==True:
Value = ui.EditLine()
else:
Value = ui.TextLine()
Value.SetParent(SlotBar)
Value.SetSize(width, heigh)
Value.SetPosition(1, 1)
Value.SetLimitWidth(width)
Value.SetMax(max)
Value.GetText()
Value.SetText(editlineText)
if isMulteLine == True:
Value.SetMultiLine()
Value.Show()
return SlotBar, Value
def TextLine(self, parent, textlineText, x, y, color):
textline = ui.TextLine()
if parent != None:
textline.SetParent(parent)
textline.SetPosition(x, y)
if color != None:
textline.SetFontColor(color[0], color[1], color[2])
textline.SetText(textlineText)
textline.Show()
return textline
def RGB(self, r, g, b):
return (r*255, g*255, b*255)
def ExpandedImage(self, parent, x, y, img):
image = ui.ExpandedImageBox()
if parent != None:
image.SetParent(parent)
image.SetPosition(x, y)
image.LoadImage(img)
image.Show()
return image
def Gauge(self, parent, width, color, x, y):
gauge = ui.Gauge()
if parent != None:
gauge.SetParent(parent)
gauge.SetPosition(x, y)
gauge.MakeGauge(width, color)
gauge.Show()
return gauge