def update(self): gobjs = savage.getActiveObjects(); myteam = savage.getLocalPlayer().getTeam(); self.buttons.erase(); for go in gobjs: if go.isSpawnPoint() and ((cvar_getvalue("sv_allowWarmupAllSpawnLocs") == 1 and savage.getGameStatus()<=GAME_STATUS_WARMUP) or go.getTeam() == myteam): pos = go.getPosition(); #create a button with the appropriate color and image button = glass.ImageButton(); #and place it in the correct position button.setImage(go.getMapIcon()); button.setSize(screenWidthPct(0.025),screenWidthPct(0.025)); if go.getTeam() == myteam: button.setForegroundColor(white); if go.isComplete() == False: button.setForegroundColor(glass.Color(0,255,0)); else: button.setClickAction("CL_RequestSpawn("+str(go.objectId)+")"); else: if cvar_getvalue("sv_allowWarmupAllSpawnLocs") == 1 and savage.getGameStatus()<=GAME_STATUS_WARMUP: button.setClickAction("CL_RequestSpawn("+str(go.objectId)+")"); else: button.setForegroundColor(glass.Color(255,0,0)); scale = float(World_GetGridSize()*100.0); button.setX(int( self.minimap.getWidth()* pos[0]/scale - button.getWidth()/2 )); button.setY(int( self.minimap.getHeight()*(1-pos[1]/scale) - button.getHeight()/2 )); self.buttons.add(button);
def __init__(self, confirmMessage, okAction=None, okLabel="Ok", cancelLabel="Cancel"): DefaultWindow.__init__(self, "Confirm") self.setBackgroundColor(glass.Color(0, 0, 0, 191)) width = 350 # add padding and border manually self.padding = 10 self.border = 5 self.setPadding(0) self.setWidth(width + self.padding * 2 + self.border * 2) self.centerWindow() self.setY(self.getY() - 190) self.setBackgroundColor(glass.Color(0, 0, 0, 191)) self.setVisible(False) self.msg = DefaultTextBox() self.msg.setForegroundColor(glass.Color(238, 238, 238)) self.msg.setOpaque(False) self.msg.setFocusable(False) self.msg.setSize(width, self.msg.getHeight()) self.msg.setText(confirmMessage) #self.msg.setAlignment(glass.Graphics.CENTER); self.add(self.msg) self.buttons = DefaultContainer() self.ok = DefaultButton(okLabel) self.ok.setSize(80, 30) if okAction is not None: self.ok.setClickAction(okAction) self.buttons.add(self.ok) self.cancel = DefaultButton(cancelLabel) self.cancel.setSize(80, 30) self.cancel.addActionListener(self) self.buttons.add(self.cancel, self.ok.getWidth() + 20) self.buttons.setWidth(self.ok.getWidth() + self.cancel.getWidth() + 20) self.add(self.buttons, "center", self.msg.getHeight() + 15) self.hr = DefaultLabel("") self.hr.setBackgroundColor(glass.Color(255, 255, 255, 100)) self.hr.setSize(width, 1) self.hr.setOpaque(True) self.add(self.hr, 0, self.msg.getHeight() + 5) self.setHeight(self.msg.getHeight() + self.ok.getHeight() + 15 + self.padding * 2 + self.border * 2) self.addTempHackyBorder()
def refresh(self): self.httpHandle = HTTP_Get(ApiUrl + "/serverlist/") #now do crappy newerth serverlist... f = File_Open("gamelist_full.dat", "rb") ip = [192, 168, 1, 1] port = 11235 cursor = 5 length = File_Size(f) File_Read(f, 5) try: while cursor < length: official = " ^222[XR]" ip[0] = struct.unpack("B", File_Read(f, 1))[0] ip[1] = struct.unpack("B", File_Read(f, 1))[0] ip[2] = struct.unpack("B", File_Read(f, 1))[0] ip[3] = struct.unpack("B", File_Read(f, 1))[0] if ip[0] != 0: port = struct.unpack("<H", File_Read(f, 2))[0] else: break address = "%d.%d.%d.%d:%d" % (ip[0], ip[1], ip[2], ip[3], port) con_println("address: " + address) if address not in self.listCache: row = self.list.nextRow("", official, address, "N/A", "0/0 ", "N/A ", "N/A") row.setId(address) row.setBaseColor(glass.Color(28, 27, 23)) row.setForegroundColor(glass.Color(19, 13, 13)) #used for alternating colors self.listCache[address] = row Host_GetInfo("%d.%d.%d.%d" % (ip[0], ip[1], ip[2], ip[3]), port) finally: File_Close(f)
def __init__(self, team, side, w, h): DefaultContainer.__init__(self) #self.setBackgroundColor(glass.Color(0,0,0,128)); self.team = team self.setSize(w, h) self.side = side #Is it on the left or right? self.rowPlayerDict = {} # {row: player} self.kills = DefaultLabel("^icon ../../gui/game/images/kills^^g999") #str(self.team.getKills())); #self.kills.setWidth(int(self.getWidth()*0.15)); self.add(self.kills) self.description = DefaultLabel("") self.add(self.description) if self.team.getRace() == "human": self.description.setCaption("The Legion of Man") else: self.description.setCaption("The Beast Horde") self.scrollTeamsArrow = glass.ImageButton() self.scrollTeamsArrow.setClickAction("spechud.lobby.switchTeams('" + self.side + "')") self.add(self.scrollTeamsArrow) self.comm = DefaultLabel("Comm: ^rNO COMMANDER") self.listContainer = DefaultContainer() self.listContainer.setBackgroundColor(glass.Color(0, 0, 0, 128)) self.add(self.listContainer) self.listContainer.setSizePct(0.8, 0.9) self.list = DefaultTableList() self.list.padding = 5 self.list.setSelectionColor(glass.Color(70, 40, 40)) self.listContainer.add(self.list, 0, 0) self.enlist = DefaultButton("Enlist now!") self.enlist.setClickAction("CL_RequestTeam(" + str(team.teamId) + ");CL_RequestLoadout();") self.enlist.setHeight(self.list.getRowHeight()) self.enlist.setWidth(self.listContainer.getWidth()) self.scroll = glass.GlassScrollArea(self.list) self.scroll.setBackgroundColor(transparency) self.scroll.setSize(self.listContainer.getWidth(), self.listContainer.getHeight()) self.scroll.setHorizontalScrollPolicy(glass.GlassScrollArea.SHOW_NEVER) self.listContainer.add(self.scroll, 0, 0) # build and position everything: self.build() self.changeSide(self.side)
def __init__(self, notificationId, title, msg, command = None, arg = None): DefaultContainer.__init__(self); self.notificationId = notificationId; self.title = title; self.msg = msg; self.arg = arg; self.command = command; self.setSize(327, Notification.ACTUAL_HEIGHT - 10); self.setBackgroundColor(transparency); content = DefaultWindow(); content.setBackgroundColor(glass.Color(70, 21, 11, 180)); content.setSize(300, 50) self.add(content, 8, 8); left = DefaultWindow(); left.setBackgroundColor(glass.Color(0,0,0,220)); self.add(left, 8, 8); left.setSize(50, 50); pic = DefaultImage(); pic.setImage("todo.png"); pic.setSize(left.getHeight(), left.getHeight()); left.add(pic, 0,0); self.titleLabel = DefaultLabel(title); content.add(self.titleLabel, left.getWidth() + 10, 0); text = DefaultTextBox(""); text.setSize(content.getWidth() - left.getWidth() - 20, 35); text.setBackgroundColor(transparency); text.setForegroundColor(glass.Color(211, 201, 168)); text.setFont(fontSizeSmall); text.setEditable(0); text.setText(msg); content.add(text, self.titleLabel.getX(), 17); close = DefaultImageButton(); close.setImage("icons/decline.png"); close.setSize(24, 24); self.add(close, "right", "center"); close.setCaption("Close"); close.addActionListener(self); if self.command != None: close.setCaption("No"); close.setY(5); accept = DefaultImageButton(); accept.setImage("icons/accept.png"); accept.setSize(24, 24); self.add(accept, close.getX(), 32); accept.setCaption("Yes"); accept.addActionListener(self);
def __init__(self): DefaultWindow.__init__(self); self.action = None; self.key = None; self.profiles = []; self.setSizePct(.3,.3); self.setBackgroundColor(glass.Color(0,0,0,128)) self.info = DefaultTextBox(); self.info.setForegroundColor(glass.Color(238, 238, 238)); self.info.setOpaque(False); self.info.setFocusable(False); self.info.setText("To choose a new bind key press a key or click on the current bind key label"); self.info.setWidth(screenWidthPct(.25)); self.add(self.info, "center", "top"); self.cancel = glass.ImageButton("", "/gui/main/images/canceltr.s2g"); self.cancel.setSize(32,32) self.add(self.cancel, "left", "bottom"); self.cancel.addActionListener(self); self.ok = glass.ImageButton("", "/gui/main/images/yestr.s2g"); self.ok.setSize(32,32) self.add(self.ok, "right", "bottom"); self.ok.addActionListener(self); self.clear = DefaultButton("Clear"); self.add(self.clear, "center", "bottom"); self.clear.addActionListener(self); c = DefaultContainer(); c.setSize(100,100); c.setFrameSize(1); self.add(c, "center", "center"); self.keyLabel = DefaultLabel("Not Set"); c.add(self.keyLabel, "center", "center"); self.canvas = glass.GlassCanvas(); self.canvas.setBackgroundColor(glass.Color(0, 0, 0, 0)); self.canvas.setVisible(False); self.canvas.setOpaque(True); self.canvas.invisTextField = DefaultTextField(); self.canvas.invisTextField.setVisible(False); c.add(self.canvas.invisTextField); c.add(self.canvas); self.canvas.setSizePct(1, 1); self.canvas.addMouseListener(self); self.canvas.addKeyListener(self); self.canvas.invisTextField.addKeyListener(self); # TODO: add button to set to default self.setVisible(False);
def buildUnauthedContainer(self): notAuthed = DefaultContainer() notAuthed.setSize(self.sectionWidth * 3, self.sectionHeight) #notAuthed.setVisible(False); self.add(notAuthed, self.sectionWidth) notAuthed.right = DefaultContainer() notAuthed.right.setSize(self.sectionWidth * 2, self.sectionHeight) notAuthed.add(notAuthed.right) autoLogin = DefaultCheckBox() autoLogin.linkCvar("autologin") notAuthed.right.add(autoLogin, 5, 2, "right", "center") autoLoginLabel = DefaultLabel("Auto Login: "******"center", "right") plus = autoLogin.getWidth() + autoLoginLabel.getWidth() bgColor = glass.Color(18, 5, 4) fgColor = glass.Color(180, 180, 180) self.username = DefaultTextField(cvar_get("username")) self.username.setPlaceHolder("Username...") self.username.setBackgroundColor(bgColor) self.username.setForegroundColor(fgColor) self.username.setSize(110, 20) self.username.addKeyListener(self) notAuthed.right.add(self.username, 171 + plus, "center", "right") self.password = DefaultTextField(cvar_get("password")) self.password.setPlaceHolder("password...") self.password.setBackgroundColor(bgColor) self.password.setForegroundColor(fgColor) self.password.setSize(110, 20) self.password.addKeyListener(self) self.password.setHidden(True) notAuthed.right.add(self.password, 51 + plus, "center", "right") submit = MainIcon("go") submit.setCaption("login") submit.addActionListener(self) notAuthed.right.add(submit, 20 + plus, "center", "right") label = DefaultLabel("Login:"******"center", "right") return notAuthed
def __init__(self): DefaultWindow.__init__(self); self.setTitleVisible(False); self.setBackgroundColor(transparency); self.setSize(int(screenWidth*0.75), int(screenHeight*0.041667)); container = DefaultContainer(); container.setSize(int(screenWidth*0.65), int(screenHeight*0.03125)); #experience/level self.level = glass.GlassProgressBar(); self.level.setSize(int(screenWidth*0.65), int(screenHeight*0.03125)); self.level.setForegroundColor(glass.Color(52, 101, 164, 128)); self.level.setBackgroundColor(white); self.level.setBackgroundImage("gui/base/images/progress_bg.tga"); container.add(self.level); self.levelLabel = DefaultLabel("LEVEL: 000"); container.add(self.levelLabel, "center", "center"); self.add(container); #kills/losses self.kills = DefaultLabel("000"); self.kills.setFont(fontSizeLarge); self.add(self.kills); self.kills.setX(self.level.getWidth()+24); self.losses = DefaultLabel(); self.losses.setFont(fontSizeSmall); self.add(self.losses); self.losses.setX(self.kills.getX()+self.kills.getWidth());
def __init__(self, scopeList): self.scopeList = scopeList glass.GlassContainer.__init__(self) self.setOpaque(False) self.buffer = MessageBuffer(self.scopeList) for i in range(10): self.buffer.addRow(" ") self.buffer.setEditable(False) self.buffer.showTime(True) self.buffer.addListener(self) self.scroll = glass.GlassScrollArea(self.buffer) self.scroll.setScrollPolicy(glass.GlassScrollArea.SHOW_NEVER, glass.GlassScrollArea.SHOW_ALWAYS) self.scroll.setAutoscroll(True) self.add(self.scroll) self.buffer.parentScroll = self.scroll self.input = glass.GlassTextField() self.input.setForegroundColor(white) self.input.setBackgroundColor(glass.Color(0, 0, 0, 128)) self.add(self.input) self.input.addKeyListener(self) self.bShowInput = False
def onValueChanged(self, e): for group, jidList in self.widgets.items(): jidList.setSelectionColor(transparency); if jidList == e.widget: e.widget.setSelectionColor(glass.Color(20,0,0,128)); self.activeList = group; self.updateControlBar();
def addTempHackyBorder(self): color = glass.Color(0, 0, 0, 100) top = DefaultLabel() top.setSize(self.getWidth(), self.border) top.setOpaque(True) top.setBackgroundColor(color) self.add(top, 0, 0, "left", "top", True) right = DefaultLabel() right.setSize(self.border, self.getHeight() - self.border * 2) right.setOpaque(True) right.setBackgroundColor(color) self.add(right, 0, self.border, "right", "top", True) bottom = DefaultLabel() bottom.setSize(self.getWidth(), self.border) bottom.setOpaque(True) bottom.setBackgroundColor(color) self.add(bottom, 0, 0, "left", "bottom", True) left = DefaultLabel() left.setSize(self.border, self.getHeight() - self.border * 2) left.setOpaque(True) left.setBackgroundColor(color) self.add(left, 0, self.border, "left", "top", True) self.borderObjs = [top, right, bottom, left]
def __init__(self, playerName): glass.GlassWindow.__init__(self, playerName + " Stats & Rankings") self.httpHandle = -1 self.player = playerName self.setBackgroundColor(glass.Color(0, 0, 0, 128)) self.spinner = glass.GlassLabel() self.spinner.setImage("textures/econs/loading/loading0000.s2g") self.spinner.setSize(32, 32) self.add(self.spinner) self.title = glass.GlassLabel(self.player + " Stats & Rankings") self.add(self.title) #create the tabs self.tabs = glass.GlassTabbedContainer() self.tabs.setOpaque(0) self.add(self.tabs) self.tabs.setSizePct(1, .9) self.setTitleVisible(0) button = glass.GlassButton("Close") self.add(button) button.addActionListener(self) gblEventHandler.addHttpListener(self)
def __init__(self): DefaultContainer.__init__(self) #self.setFrameStyle("Shadow"); self.minimap = glass.GlassMiniMap() self.minimap.setSize(screenHeightPct(.25), screenHeightPct(.25)) self.minimap.addMouseListener(self) self.add(self.minimap, 2, 12) self.setBackgroundColor(glass.Color(0, 0, 0, 128)) self.color = DefaultLabel() self.color.setImage("/gui/game/images/colorbar.tga") self.color.setSize(self.minimap.getWidth(), 10) self.color.addMouseListener(self) self.add(self.color, 2, 2) self.clear = DefaultImageButton() self.clear.setImage("canceltr.s2g") self.clear.setSize(16, 16) self.clear.setClickAction("CL_MinimapClear()") self.add(self.clear, self.minimap.getWidth() + 2, 12) self.hue = 0.0 self.val = 1.0 self.fit() self.setPosition(1, screenHeight - (self.getHeight() + 1))
def __init__(self): DefaultTable.__init__(self) self.horizontalJustification = glass.Graphics.CENTER self.status = self.STATUS_INACTIVE self._alpha = 1 self.lastObject = None self.makeBlank() self.setCellPadding(0) barWidth = int(screenHeight * self.barWidthPct) barHeight = barWidth // 8 self.teamNum = glass.GlassLabel(" Team 0 ") self.addRow(self.teamNum) self.targetName = glass.GlassLabel("LOOKIHAVEARidiculouslyLongName") self.targetName.setAlignment(glass.Graphics.CENTER) self.addRow(self.targetName) self.health = glass.GlassProgressBar() self.health.setSize(barWidth, barHeight) self.health.setBackgroundColor(glass.Color(133, 11, 10)) self.health.setForegroundColor(glass.Color(255, 21, 22)) self.addRow(self.health) self.build = glass.GlassProgressBar() self.build.setSize(barWidth, barHeight) self.build.setOpaque(True) self.build.setBackgroundColor(glass.Color(10, 115, 110)) self.build.setForegroundColor(glass.Color(20, 255, 248)) self.build.setVisible(False) self.addRow(self.build) self.crosshair = glass.GlassLabel() self.crosshair.setImage("/gui/standard/crosshair.png") self.crosshair.setOpaque(False) self.crosshair_row = self.addRow(self.crosshair) self.alphaWidgets = [ self.teamNum, self.targetName, self.health, self.build ] self.reposition()
def __init__(self): glass.GlassWindow.__init__(self, "Research") self.setVisible(False) self.setAlpha(0) self.setMovable(0) self.setFocusable(False) self.setTitleVisible(0) self.setTitleBarHeight(0) self.setBackgroundColor(glass.Color(255, 255, 255, 127)) self.table = GlassTablePlus() self.add(self.table) self.table.setPosition(self.PADDING, self.PADDING + 1) self.table.makeBlank() self.table.autoAdjust = False self.table.setCellPadding(self.PADDING // 2) self.teamObj = None header_beast = [ "/gui/standard/comm/upgrade_stronghold.s2g", "/models/beast/buildings/icons/nexus.s2g", "/models/beast/buildings/icons/entropy.s2g", "/models/beast/buildings/icons/strata.s2g", "/models/beast/buildings/icons/fire.s2g", "/models/beast/buildings/icons/lair.s2g", "/models/beast/buildings/icons/siege.s2g", "/models/beast/buildings/icons/sanctuary.s2g" ] header_human = [ "/gui/standard/comm/upgrade_stronghold.s2g", "/models/human/buildings/icons/arsenal.s2g", "/models/human/buildings/icons/magnetic.s2g", "/models/human/buildings/icons/electric.s2g", "/models/human/buildings/icons/chemical.s2g", "/models/human/buildings/icons/selectionstronghold.s2g", "/models/human/buildings/icons/siege.s2g", "/models/human/buildings/icons/monastery.s2g" ] levels = [1, 2, 3, 1, 2] def makeHeaderWidget(x): w = glass.GlassLabel("") if x != None: w.setImage(x) w.setSize(self.HEADER_ICON_SIZE, self.HEADER_ICON_SIZE) return w def makeLevelWidget(x): w = glass.GlassLabel(str(x)) w.setSize(self.ICON_SIZE, self.ICON_SIZE) w.setFont(fontSizeLarge) w.setAlignment(glass.Graphics.CENTER) return w self.header_beast = [makeHeaderWidget(x) for x in header_beast] self.header_human = [makeHeaderWidget(x) for x in header_human] self.levels = [makeLevelWidget(x) for x in levels]
def __init__(self): glass.GlassWindow.__init__(self) self.setSizePct(.9, .9) self.setPositionPct(.05, 0.05) self.build() self.setTitleVisible(0) self.setTitleBarHeight(0) self.setBackgroundColor(glass.Color(0, 0, 0, 100)) self.setVisible(False)
def buildAuthedContainer(self): authed = DefaultContainer() authed.setSize(self.sectionWidth * 3, self.sectionHeight) authed.setVisible(False) self.add(authed, self.sectionWidth) middle = DefaultContainer() middle.setSize(self.sectionWidth * 2, self.sectionHeight) authed.add(middle) username = DefaultContainer() username.setBackgroundColor(glass.Color(0, 0, 0, 70)) username.setOpaque(True) username.setSize(150, 19) middle.add(username, "center", "center") middle.logout = MainIcon("logout") middle.logout.setCaption("logoutConfirm") middle.logout.addActionListener(self) middle.add(middle.logout, 95, "center", "center") stats = MainIcon("stats") stats.setClickAction( "mainmenu.showModule('stats');mainmenu.modules['stats'].createStats(cvar_get('auth_sessionid'))" ) middle.add(stats, 125, "center", "center") clans = MainIcon("clans") clans.setClickAction("mainmenu.showModule('clans')") middle.add(clans, username.getX() - clans.getWidth() - 9, "center") middle.demos = MainIcon("demos") middle.demos.setClickAction("mainmenu.showModule('demos')") middle.add(middle.demos, username.getX() - middle.demos.getWidth() * 2 - 18, "center") self.confirmLogout = DefaultConfirm("Are you sure you want to logout?", None, "Logout") self.confirmLogout.ok.addActionListener(self) import mainmenu mainmenu.add(self.confirmLogout) right = DefaultContainer() right.setSize(self.sectionWidth, self.sectionHeight) authed.add(right, self.sectionWidth * 2) right.chat = MainIcon("chat") right.chat.setClickAction("mainmenu.topBar.openChat()") right.add(right.chat, right.getWidth() - right.chat.getWidth() - 10, "center") authed.middle = middle authed.right = right return authed
def clearList(self): self.list.erase() self.headingRow = self.list.nextRow("", "", "^lName", "^lGame Type", "^lPlayers", "^lMap ", "^lPing") self.headingRow.setId("header") #self.headingRow.setBackgroundColor(glass.Color(70, 40, 40, 220)); self.headingRow.setBaseColor(glass.Color(28, 27, 23)) self.headingRow.setFocusable(False)
def __init__(self): DefaultContainer.__init__(self) #self.setFrameStyle("Shadow"); self.setBackgroundColor(glass.Color(0, 0, 0, 128)) self.setSize(120, 20) self.label = DefaultLabel() self.label.setFont(fontSizeSmall) self.add(self.label, 5, 3) self.alwaysUpdate = True
def __init__(self): self.httpHandle = -1 DefaultContainer.__init__(self) # loggin in = 1 # logging out = 2 # not working = 0 self.status = 0 self.setSize(screenWidth, 40) bg = DefaultImage() bg.setImage("top_bar.s2g") bg.setSize(screenWidth, 32) self.add(bg) self.sectionWidth = screenWidth // 4 self.sectionHeight = 35 self.left = self.buildLeftContainer() self.authed = self.buildAuthedContainer() self.notAuthed = self.buildUnauthedContainer() self.loginOverlay = DefaultContainer() self.loginOverlay.setBackgroundColor(glass.Color(0, 0, 0, 153)) self.loginOverlay.setSize(screenWidth, 31) self.loginOverlay.setOpaque(True) self.loginOverlay.setVisible(False) self.loginOverlayLabel = DefaultLabel("Logging in...") self.loginOverlay.add(self.loginOverlayLabel, "center", "center") self.add(self.loginOverlay) # chat roster stuff, will get added later to the screen, even if it is a bit hacky... self.buddyRoster = BuddyRoster() self.buddyRoster.setVisible(False) self.buddyRoster.setOpaque(True) self.chatBox = JabberChatBox() self.chatBox.setId("chat") self.chatBox.setVisible(False) self.addChat() gblEventHandler.addHttpListener(self) #self.doAutoLogin(); self.notehandler = NotificationHandler() glass.GUI_GetScreen(glass.GUI_CurrentScreen()).add(self.notehandler) self.notehandler.setPosition( screenWidth - self.notehandler.getWidth() - 10, self.getHeight() + 10)
def __init__(self): DefaultWindow.__init__(self) self.setSize(470, 275) self.setPositionPct(0.2, 0.25) self.setTitleVisible(False) self.setTitleBarHeight(0) self.setBackgroundColor(glass.Color(0, 0, 0, 180)) self.setVisible(False) self.create()
def __init__(self, name, scopeList, isConference=False): glass.GlassContainer.__init__(self) self.setOpaque(False) self.jid = name self.isConference = isConference self.scopeList = scopeList self.buffer = MessageBuffer(self.scopeList) self.buffer.setEditable(False) self.buffer.showTime(True) self.scroll = glass.GlassScrollArea(self.buffer) self.scroll.setScrollPolicy(glass.GlassScrollArea.SHOW_NEVER, glass.GlassScrollArea.SHOW_ALWAYS) self.scroll.setAutoscroll(False) self.add(self.scroll) self.buffer.parentScroll = self.scroll # extending the input box to make it look a bit better: self.inputContainer = DefaultContainer() self.inputContainer.setBackgroundColor(glass.Color(23, 14, 13)) self.add(self.inputContainer) self.div = DefaultContainer() self.div.setBackgroundColor(glass.Color(30, 26, 25)) self.inputContainer.add(self.div) self.input = glass.GlassTextField() self.input.setForegroundColor(white) self.input.setBackgroundColor(glass.Color(0, 0, 0, 128)) self.inputContainer.add(self.input) self.input.addKeyListener(self) self.bShowInput = False gblXMPPHandler.addListener(self)
def onMouseClick(self, e): if isinstance(e.widget, glass.GlassWindow): w = glass.GUI_GetWindow("mainmenu:binder"); w.erase(); w.close(); bindKeyAction(e.button+199, self.action, self.profile); #ain't I a stinker? self.controlwidget.setText(makePretty(self.action, self.profile)); else: self.action = e.widget.getId(); self.controlwidget = e.widget; w = glass.GlassWindow('binder'); glass.GUI_ScreenAddWidget("mainmenu", w); label = glass.GlassLabel("Press a key to bind..."); label.setForegroundColor(glass.Color(255,255,255)); w.add(label); w.addMouseListener(self); w.addKeyListener(self); w.setTitleVisible(0); w.setBackgroundColor(glass.Color(0,0,0,50)); w.setSizePct(.25,.1); w.requestModalFocus(); w.centerWindow();
def __init__(self): glass.GlassWindow.__init__(self, 'Options'); self.first=True; #build the restart window w = glass.GlassWindow('Restart'); glass.GUI_ScreenAddWidget("mainmenu", w); w.setSizePct(.4, .15); w.centerWindow(); w.setBackgroundColor(glass.Color(0,0,0,128)); w.setMovable(0); w.setTitleVisible(0); w.setVisible(False); l = glass.GlassLabel("This change will not take effect until you restart.\nWould you like to restart now?"); w.add(l, 10, 10); b = glass.GlassButton("Restart"); b.setClickAction("shutdown(1);"); w.add(b, 50, 60); b = glass.GlassButton("Cancel"); b.setClickAction("w=glass.GUI_GetWindow('mainmenu:Restart');w.setVisible(False);w.releaseModalFocus()"); w.add(b, 150, 60); self.setBackgroundColor(glass.Color(0,0,0,128)) self.setTitleVisible(0) self.nickname = None;
def rebuildMenu(self): #use after the menu has been clear() -ed self.bg = glass.GlassLabel() self.bg.addMouseListener(self) self.bg.setImage("/gui/standard/contextmenu_bg.s2g") self.bg.setForegroundColor(glass.Color(255, 255, 255, 150)) self.add(self.bg) #self.main = glass.GlassButton("Default Action"); #self.main.setWidth(int(0.8*self.RADIUS)); #self.main.setPosition( (self.getWidth()-self.main.getWidth())//2, (self.getWidth()-self.main.getHeight())//2 ); #self.main.setClickAction("commhud.defaultAction(); commhud.contextmenu.close();"); #self.add(self.main); self.currentButtons = []
def get8Col(self, width): colWidth = width // 8; x = []; for i in range(8): x.append(colWidth * i); # debug: draw columns for when creating stuff if 0: c = DefaultContainer(); c.setBackgroundColor(glass.Color(60, 0, 0, 50)); c.setSize(colWidth - 2, 400); self.add(c, 15 + colWidth * i + 1, 80); l = DefaultLabel(str(i)); self.add(l, colWidth * i + colWidth // 2 + l.getWidth() // 2, 70); return (colWidth, x);
def __init__(self): DefaultWindow.__init__(self) self.setFrameStyle("TrimmedEight") self.httpHandle = -1 gblEventHandler.addHttpListener(self) self.setSize(265, 200) self.setVisible(False) self.setTitleVisible(False) self.setBackgroundColor(windowBackground) top = DefaultContainer() self.add(top, 0, 0) top.setSize(self.getWidth(), 35) top.setBackgroundColor(windowTop) """ title = DefaultImage(); title.setImage("txt_savagenews.png"); top.add(title, "center", "center"); content = DefaultContainer(); self.add(content, 10, 42); content.setSize(245, 148); self.heading = DefaultLabel("Savage Rebirth Pre-Beta has begun!") content.add(self.heading, 0, 0); self.heading.setFont(fontSizeSmall); """ title = DefaultLabel("Important Bulletin") title.setForegroundColor(tangoYellowDark) title.setFont(fontSizeLarge) top.add(title, "center", "center") self.text = DefaultTextBox("No News.") self.text.setSize(245, 200) self.text.setBackgroundColor(transparency) self.text.setForegroundColor(glass.Color(211, 201, 168)) self.text.setFont(fontSizeSmall) self.text.setEditable(False) self.add(self.text, 10, 50) """
def __init__(self, slot): DefaultContainer.__init__(self); self.setSize(screenWidthPct(0.0625), screenWidthPct(0.0625)); self.setBackgroundColor(glass.Color(0,0,0,128)); self.slot = slot; self.image = DefaultImageButton(); self.add(self.image); self.image.setSizePct(1,1); self.ammo = DefaultLabel(); self.ammo.setForegroundColor(tangoGreen); self.add(self.ammo); button = glass.ImageButton("textures/econs/transparent.s2g"); self.add( button ); button.setSizePct(1,1); button.addActionListener(self);
def __init__(self): DefaultWindow.__init__(self) self.setBackgroundColor(glass.Color(0, 0, 0, 128)) self.setVisible(False) self.addKeyListener(self) self.setTitleBarHeight(0) self.setTitleVisible(False) self.table = DefaultTable() self.table.makeBlank() self.table.horizontalJustification = glass.Graphics.LEFT self.table.autoAdjust = False self.table.stretchWidgets = True self.add(self.table) for i in range(10): self.table.addRow(" ") self.status = self.INACTIVE self.categoryNumber = -1 self.currentVoiceDict = ""
def __init__(self): DefaultWindow.__init__(self); self.setTitleVisible(False); self.setSizePct(1,1); self.setBackgroundColor(glass.Color(0,0,0,128)); self.setVisible(False); self.minimap = glass.GlassMiniMap(); self.minimap.setSize(screenHeightPct(0.667),screenHeightPct(0.667)); self.add(self.minimap, "center", "center"); self.buttons = glass.GlassContainer(); self.buttons.setSize(self.minimap.getWidth(), self.minimap.getHeight()); self.add(self.buttons, "center", "center"); back = DefaultButton("BACK"); back.setClickAction("loadout.mapWindow.hide();CL_RequestLoadout()"); self.add(back); back.setX(self.minimap.getX() + self.minimap.getWidth()-back.getWidth()); back.setY(self.minimap.getY() + self.minimap.getHeight() +5 );