def Network_error(self, data): self.SetMessage(data) self.DeleteElement("LoadingA") self.DeleteElement("Reject") rejectButton = RejectButton("Exit") rejectButton.y = 290 rejectButton.x = self.width / 2 - rejectButton.imageA.get_size()[0] / 2 self.AddElement(rejectButton, "Reject")
def Network_error(self,data): self.SetMessage(data) self.DeleteElement("LoadingA") self.DeleteElement("Reject") rejectButton = RejectButton("Exit") rejectButton.y = 290 rejectButton.x = self.width/2 - rejectButton.imageA.get_size()[0]/2 self.AddElement(rejectButton,"Reject")
def AddAcceptReject(self): self.status = "accept-reject" self.DeleteElement("Reject") ##### BUTTON ACCEPT ##### acceptButton = AcceptButton("Proceed") acceptButton.y = 290 acceptButton.x = self.width*3/4 - acceptButton.imageA.get_size()[0]/2 self.AddElement(acceptButton,"Accept") ##### BUTTON REJECT ##### rejectButton = RejectButton("Cancel") rejectButton.y = 290 rejectButton.x = self.width/4 - rejectButton.imageA.get_size()[0]/2 self.AddElement(rejectButton,"Reject")
def __init__(self, parent, save): self.save = save Window.__init__(self, "Login", (36, 107, 97), (43, 76, 111), 0, 0, 400, 160, (255, 255, 255)) self.parent = parent font = fonts.AldoTheApache UserText = Text(font.c30, "Username:"******"User Text") PassText = Text(font.c30, "Password:"******"Pass Text") UserInput = Input() UserInput.AllowAll() UserInput.SetParent(self) UserInput.SetSize(150, 30) UserInput.x = self.width / 2 + 5 UserInput.y = self.height / 2 - UserInput.size[1] - 2 - 15 self.AddElement(UserInput, "User Input") PassInput = copy.copy(UserInput) PassInput.y += PassInput.size[1] + 5 PassInput.password = True self.AddElement(PassInput, "Pass Input") UserInput.SetNextInput(PassInput) Accept = AcceptButton("Login", 150, (0, 0), font) Accept.x = self.width / 2 + 10 Accept.y = PassInput.y + PassInput.size[1] + 20 self.AddElement(Accept, "Accept") Reject = RejectButton("Cancel", 150, (0, 0), font) Reject.x = self.width / 2 - 10 - Reject.size[0] Reject.y = Accept.y self.AddElement(Reject, "Cancel") self.was_pressed1 = False self.was_pressed2 = False self.parent.SetLoginDef(self.Login) self.loging_in = False self.username = "" self.password = ""
def __init__(self,parent,save): self.save = save Window.__init__(self,"Login",(36, 107, 97),(43, 76, 111),0,0,400,160,(255,255,255)) self.parent = parent font = fonts.AldoTheApache UserText = Text(font.c30,"Username:"******"User Text") PassText = Text(font.c30,"Password:"******"Pass Text") UserInput = Input() UserInput.AllowAll() UserInput.SetParent(self) UserInput.SetSize(150,30) UserInput.x = self.width/2 + 5 UserInput.y = self.height/2 - UserInput.size[1] - 2-15 self.AddElement(UserInput,"User Input") PassInput = copy.copy(UserInput) PassInput.y += PassInput.size[1] + 5 PassInput.password = True self.AddElement(PassInput,"Pass Input") UserInput.SetNextInput(PassInput) Accept = AcceptButton("Login",150,(0,0),font) Accept.x = self.width/2+10 Accept.y = PassInput.y + PassInput.size[1] + 20 self.AddElement(Accept,"Accept") Reject = RejectButton("Cancel",150,(0,0),font) Reject.x = self.width/2 - 10 - Reject.size[0] Reject.y = Accept.y self.AddElement(Reject,"Cancel") self.was_pressed1 = False self.was_pressed2 = False self.parent.SetLoginDef(self.Login) self.loging_in = False self.username = "" self.password = ""
def __init__(self, x, y, server_name, server_ip, parent): self.ip = server_ip Window.__init__(self, server_name, (36, 107, 97), (43, 76, 111), x, y, 500, 330, (255, 255, 255), 250) self.parent = parent textIP = Text(fonts.BebasNeue.c30, server_ip, (255, 255, 255)) textIP.y = 30 textIP.x = self.width / 2 - textIP.surface.get_size()[0] / 2 self.AddElement(textIP) textDetails = Text(fonts.BebasNeue.c20, "DETAILS:", (255, 255, 255)) textDetails.y = 70 textDetails.x = self.width / 2 - textDetails.surface.get_size()[0] / 2 self.AddElement(textDetails) Mode = Text(fonts.BebasNeue.c20, "MODE:", (255, 255, 255)) Mode.y = 100 Mode.x = self.width / 4 - Mode.surface.get_size()[0] / 2 self.AddElement(Mode) Players = Text(fonts.BebasNeue.c20, "PLAYERS:", (255, 255, 255)) Players.y = 140 Players.x = self.width / 4 - Players.surface.get_size()[0] / 2 self.AddElement(Players) Ping = Text(fonts.BebasNeue.c20, "TCP PING:", (255, 255, 255)) Ping.y = 180 Ping.x = self.width / 4 - Ping.surface.get_size()[0] / 2 self.AddElement(Ping) PingUDP = Text(fonts.BebasNeue.c20, "UDP PING:", (255, 255, 255)) PingUDP.y = 200 PingUDP.x = self.width / 4 - PingUDP.surface.get_size()[0] / 2 self.AddElement(PingUDP) ModeContent = Text(fonts.BebasNeue.c20, "NN", (255, 255, 255)) ModeContent.y = 100 ModeContent.x = self.width * 3 / 4 - ModeContent.surface.get_size( )[0] / 2 self.AddElement(ModeContent, "ModeShown") PlayersContent = Text(fonts.BebasNeue.c20, "NN", (255, 255, 255)) PlayersContent.y = 140 PlayersContent.x = self.width * 3 / 4 - PlayersContent.surface.get_size( )[0] / 2 self.AddElement(PlayersContent, "PlayersShown") PingContent = Text(fonts.BebasNeue.c20, "NN", (255, 255, 255)) PingContent.y = 180 PingContent.x = self.width * 3 / 4 - PingContent.surface.get_size( )[0] / 2 self.AddElement(PingContent, "PingShown") PingUDPcontent = Text(fonts.BebasNeue.c20, "NN", (255, 255, 255)) PingUDPcontent.y = 200 PingUDPcontent.x = self.width / 4 * 3 - PingUDPcontent.surface.get_size( )[0] / 2 self.AddElement(PingUDPcontent, "PingUDP") self.status = "reject" ##### LOADING #### loadingText = Text(fonts.BebasNeue.c15, "Connecting...", (255, 255, 255)) loadingText.y = 230 loadingText.x = self.width / 2 - loadingText.surface.get_size()[0] / 2 self.AddElement(loadingText, "LoadingText") loadingA = LoadingAnimation(squares=4) loadingA.y = 250 loadingA.x = self.width / 2 - loadingA.width / 2 self.AddElement(loadingA, "LoadingA") ##### BUTTON REJECT ##### rejectButton = RejectButton("Cancel") rejectButton.y = 290 rejectButton.x = self.width / 2 - rejectButton.imageA.get_size()[0] / 2 self.AddElement(rejectButton, "Reject") ##### NETWORK ##### self.parent.SetErrorDef(self.Network_error) self.parent.SetConnectDef(self.Network_connected) self.parent.SetRBasicDef(self.Network_RBasic) self.parent.SetUDPsignalDef(self.UDPsignal) self.allowConnect = False self.Connect()
def __init__(self, parent, save): Window.__init__(self, "Sign up", (36, 107, 97), (43, 76, 111), 0, 0, 400, 210, (255, 255, 255)) self.parent = parent self.save = save font = fonts.BebasNeue.c25 y_act = 29 ### User text ### UserText = Text(font, "Username:"******"User Text") ### User input ### UserInput = Input() UserInput.AllowAll() UserInput.SetParent(self) UserInput.SetSize(150, 30) UserInput.x = self.width / 2 + 5 UserInput.y = UserText.y + (UserText.surface.get_size()[1] / 2 - UserInput.size[1] / 2) self.AddElement(UserInput, "User Input") ### Password text ### y_act += UserText.surface.get_size()[1] + 5 PassText = Text(font, "Password:"******"Pass Text") ### Password input ### PassInput = copy.copy(UserInput) PassInput.y = PassText.y + (PassText.surface.get_size()[1] / 2 - PassInput.size[1] / 2) PassInput.password = True self.AddElement(PassInput, "Pass Input") ### Pass Confirm text ### y_act += PassText.surface.get_size()[1] + 5 PassConfText = Text(font, "Confirm password:"******"Confirm Password Text") ### Pass Confirm input ### PassConfInput = copy.copy(PassInput) PassConfInput.y = PassConfText.y + ( PassConfText.surface.get_size()[1] / 2 - PassConfInput.size[1] / 2) self.AddElement(PassConfInput, "Confirm Password Input") ### Email text ### y_act += PassConfText.surface.get_size()[1] + 5 EmailText = Text(font, "Email:", (0, 0, 0)) EmailText.x = self.width / 2 - EmailText.surface.get_size()[0] - 5 EmailText.y = y_act self.AddElement(EmailText, "Email Text") ### Email input ### EmailInput = copy.copy(PassConfInput) EmailInput.password = False EmailInput.y = EmailText.y - (EmailText.surface.get_size()[1] / 2 - EmailInput.size[1] / 2) self.AddElement(EmailInput, "Email Input") ### Setting next inputs ### UserInput.next_input = PassInput PassInput.next_input = PassConfInput PassConfInput.next_input = EmailInput EmailInput.next_input = UserInput ### Accept button ### y_act += EmailText.surface.get_size()[1] + 10 Accept = AcceptButton("Sign up", 150, (0, 0), font) Accept.x = self.width / 2 + 10 Accept.y = y_act self.AddElement(Accept, "Accept") ### Reject button ### Reject = RejectButton("Cancel", 150, (0, 0), font) Reject.x = self.width / 2 - 10 - Reject.size[0] Reject.y = y_act self.AddElement(Reject, "Cancel") ### Extra variables ### self.pressed = False self.pressed2 = False self.parent.SetRegisterDef(self.RegisterConfirm) self.sending_data = False
def __init__(self,parent,save): Window.__init__(self,"Sign up",(36, 107, 97),(43, 76, 111),0,0,400,210,(255,255,255)) self.parent = parent self.save = save font = fonts.BebasNeue.c25 y_act = 29 ### User text ### UserText = Text(font,"Username:"******"User Text") ### User input ### UserInput = Input() UserInput.AllowAll() UserInput.SetParent(self) UserInput.SetSize(150,30) UserInput.x = self.width/2 + 5 UserInput.y = UserText.y + (UserText.surface.get_size()[1]/2 - UserInput.size[1]/2) self.AddElement(UserInput,"User Input") ### Password text ### y_act += UserText.surface.get_size()[1] + 5 PassText = Text(font,"Password:"******"Pass Text") ### Password input ### PassInput = copy.copy(UserInput) PassInput.y = PassText.y + (PassText.surface.get_size()[1]/2 - PassInput.size[1]/2) PassInput.password = True self.AddElement(PassInput,"Pass Input") ### Pass Confirm text ### y_act += PassText.surface.get_size()[1] + 5 PassConfText = Text(font,"Confirm password:"******"Confirm Password Text") ### Pass Confirm input ### PassConfInput = copy.copy(PassInput) PassConfInput.y = PassConfText.y + (PassConfText.surface.get_size()[1]/2 - PassConfInput.size[1]/2) self.AddElement(PassConfInput,"Confirm Password Input") ### Email text ### y_act += PassConfText.surface.get_size()[1] + 5 EmailText = Text(font,"Email:",(0,0,0)) EmailText.x = self.width/2 - EmailText.surface.get_size()[0] - 5 EmailText.y = y_act self.AddElement(EmailText,"Email Text") ### Email input ### EmailInput = copy.copy(PassConfInput) EmailInput.password = False EmailInput.y = EmailText.y - (EmailText.surface.get_size()[1]/2 - EmailInput.size[1]/2) self.AddElement(EmailInput,"Email Input") ### Setting next inputs ### UserInput.next_input = PassInput PassInput.next_input = PassConfInput PassConfInput.next_input = EmailInput EmailInput.next_input = UserInput ### Accept button ### y_act += EmailText.surface.get_size()[1] + 10 Accept = AcceptButton("Sign up",150,(0,0),font) Accept.x = self.width/2+10 Accept.y = y_act self.AddElement(Accept,"Accept") ### Reject button ### Reject = RejectButton("Cancel",150,(0,0),font) Reject.x = self.width/2 - 10 - Reject.size[0] Reject.y = y_act self.AddElement(Reject,"Cancel") ### Extra variables ### self.pressed = False self.pressed2 = False self.parent.SetRegisterDef(self.RegisterConfirm) self.sending_data = False
def __init__(self,x,y,server_name,server_ip,parent): self.ip = server_ip Window.__init__(self,server_name,(36, 107, 97),(43, 76, 111),x,y,500,330,(255,255,255),250) self.parent = parent textIP = Text(fonts.BebasNeue.c30,server_ip,(255,255,255)) textIP.y = 30 textIP.x = self.width / 2 - textIP.surface.get_size()[0]/2 self.AddElement(textIP) textDetails = Text(fonts.BebasNeue.c20,"DETAILS:",(255,255,255)) textDetails.y = 70 textDetails.x = self.width / 2 - textDetails.surface.get_size()[0]/2 self.AddElement(textDetails) Mode = Text(fonts.BebasNeue.c20,"MODE:",(255,255,255)) Mode.y = 100 Mode.x = self.width/4 - Mode.surface.get_size()[0]/2 self.AddElement(Mode) Players = Text(fonts.BebasNeue.c20,"PLAYERS:",(255,255,255)) Players.y = 140 Players.x = self.width/4 - Players.surface.get_size()[0]/2 self.AddElement(Players) Ping = Text(fonts.BebasNeue.c20,"TCP PING:",(255,255,255)) Ping.y = 180 Ping.x = self.width/4 - Ping.surface.get_size()[0]/2 self.AddElement(Ping) PingUDP = Text(fonts.BebasNeue.c20,"UDP PING:",(255,255,255)) PingUDP.y = 200 PingUDP.x = self.width/4- PingUDP.surface.get_size()[0]/2 self.AddElement(PingUDP) ModeContent = Text(fonts.BebasNeue.c20,"NN",(255,255,255)) ModeContent.y = 100 ModeContent.x = self.width*3/4 - ModeContent.surface.get_size()[0]/2 self.AddElement(ModeContent,"ModeShown") PlayersContent = Text(fonts.BebasNeue.c20,"NN",(255,255,255)) PlayersContent.y = 140 PlayersContent.x = self.width*3/4 - PlayersContent.surface.get_size()[0]/2 self.AddElement(PlayersContent,"PlayersShown") PingContent = Text(fonts.BebasNeue.c20,"NN",(255,255,255)) PingContent.y = 180 PingContent.x = self.width*3/4 - PingContent.surface.get_size()[0]/2 self.AddElement(PingContent,"PingShown") PingUDPcontent = Text(fonts.BebasNeue.c20,"NN",(255,255,255)) PingUDPcontent.y = 200 PingUDPcontent.x = self.width/4*3 - PingUDPcontent.surface.get_size()[0]/2 self.AddElement(PingUDPcontent,"PingUDP") self.status = "reject" ##### LOADING #### loadingText = Text(fonts.BebasNeue.c15,"Connecting...",(255,255,255)) loadingText.y = 230 loadingText.x = self.width/2-loadingText.surface.get_size()[0]/2 self.AddElement(loadingText,"LoadingText") loadingA = LoadingAnimation(squares=4) loadingA.y = 250 loadingA.x = self.width/2-loadingA.width/2 self.AddElement(loadingA,"LoadingA") ##### BUTTON REJECT ##### rejectButton = RejectButton("Cancel") rejectButton.y = 290 rejectButton.x = self.width/2 - rejectButton.imageA.get_size()[0]/2 self.AddElement(rejectButton,"Reject") ##### NETWORK ##### self.parent.SetErrorDef(self.Network_error) self.parent.SetConnectDef(self.Network_connected) self.parent.SetRBasicDef(self.Network_RBasic) self.parent.SetUDPsignalDef(self.UDPsignal) self.allowConnect = False self.Connect()