def __init__(self, inputfield, **params): self.inpField = inputfield self._count = 1 title = gui.Label("Map Selector") t = gui.Table() t.tr() t.td(gui.Label('Select a map:'), colspan=2) t.tr() t.td(gui.Spacer(10, 20)) t.tr() self.mapList = gui.List(width=200, height=140) t.td(self.mapList, colspan=2) t.tr() t.td(gui.Spacer(10, 20)) t.tr() e = gui.Button('Choose map') e.connect(gui.CLICK, self.setInput, None) t.td(e) e = gui.Button('Cancel') e.connect(gui.CLICK, self.close, None) t.td(e) t.tr() t.td(gui.Spacer(10, 10)) gui.Dialog.__init__(self, title, t)
def __init__(self, **params): gui.Table.__init__(self, **params) self.value = gui.Form() self.engine = None def btnLogin(btn): self.engine.doLogin() def btnRegister(btn): g.gameState = MENU_REGISTER if g.tcpConn is None: g.gameEngine.initConnection() self.tr() self.td(gui.Input(name="username", value="Username")) self.tr() self.td(gui.Password(name="password", value="password")) self.tr() self.td(gui.Spacer(0, 30)) self.tr() btn = gui.Button("Login", width=120) btn.connect(gui.CLICK, btnLogin, None) self.td(btn) self.tr() self.td(gui.Spacer(0, 5)) self.tr() btn = gui.Button("Register", width=120) btn.connect(gui.CLICK, btnRegister, None) self.td(btn)
def __init__(self, **params): title = gui.Label(_("Exit Game")) t = gui.Table() t.tr() t.td(gui.Label(_("Are you sure you want to quit?")), colspan=2) t.tr() t.td(gui.Spacer(10, 20)) def btnQuit(value): g.gameEngine.quitGame() t.tr() e = gui.Button(_("Quit")) e.connect(gui.CLICK, btnQuit, None) t.td(e) e = gui.Button(_("Cancel")) e.connect(gui.CLICK, self.close, None) t.td(e) t.tr() t.td(gui.Spacer(10, 10)) gui.Dialog.__init__(self, title, t)
def __init__(self, engine, **params): self.engine = engine self._count = 0 title = gui.Label("Open Item") t = gui.Table() t.tr() t.td(gui.Label('Select an item:'), colspan=2) t.tr() t.td(gui.Spacer(10, 20)) t.tr() self.itemList = gui.List(width=200, height=140) t.td(self.itemList, colspan=2) t.tr() t.td(gui.Spacer(10, 20)) t.tr() e = gui.Button('Open item') e.connect(gui.CLICK, self.openItem, None) t.td(e) e = gui.Button('Cancel') e.connect(gui.CLICK, self.close, None) t.td(e) t.tr() t.td(gui.Spacer(10, 10)) gui.Dialog.__init__(self, title, t)
def __init__(self, **params): gui.Table.__init__(self, **params) self.value = gui.Form() # item information self.itemNum = 0 self.itemVal = 0 # dialogs openItemDialog = OpenItemDialog(self) self.tr() e = gui.Button("Open item...", width=100) e.connect(gui.CLICK, openItemDialog.openDialog, None) self.td(e) self.tr() self.td(gui.Spacer(10, 20)) self.tr() self.td( gui.Label('Select an item to spawn', color=UI_FONT_COLOR, name='lblItemName')) self.tr() self.td(gui.Spacer(10, 80))
def __init__(self, pSize, pApp): tbl = gui.Table(width=pSize['w'], height=pSize['c_h']) # text on the left tbl2 = gui.Table() tbl2.tr() txt = _("To ckeck operation\n" "Aim gun sight at monitor\n" "Move gun within monitor boundary.\n" "Ensure IR point is visible\n" "to the gun when aimed\n" "at all areas of the screen.") lines = txt.split("\n") for line in lines: tbl2.tr() tbl2.td(gui.Label(str(line))) txtTbl = gui.Table(height=pSize['ir_h']) txtTbl.tr() txtTbl.td(tbl2, style={'border':1}) # legend tbl2 = gui.Table() tbl2.tr() tbl2.td(gui.Color(width=30,height=30, value=(255,0,0))) tbl2.td(gui.Label(" "+_('IR Good')), align=-1) tbl2.tr() tbl2.td(gui.Spacer(10,10)) tbl2.tr() tbl2.td(gui.Color(width=30,height=30, value=(255,165,0))) tbl2.td(gui.Label(" "+_('IR Good but faint')), align=-1) tbl2.tr() tbl2.td(gui.Spacer(10,10)) tbl2.tr() tbl2.td(gui.Color(width=30,height=30, value=(0,0,0))) tbl2.td(gui.Label(" "+_('IR Not visible')), align=-1) txtTbl.tr() txtTbl.td(gui.Spacer(10,10)) txtTbl.tr() txtTbl.td(tbl2, style={'border':1}) # test area self.tstArea = IrTest(width=pSize['ir_w'], height=pSize['ir_h']) # calibrate button btn = gui.Button(_('Calibrate')) btn.connect(gui.CLICK, pApp.startCal, None) tbl.tr() tbl.td(txtTbl) tbl.td(self.tstArea) tbl.tr() tbl.td(btn, colspan=2) self.widget = tbl
def add_labels(self): self.tr() self.td(gui.Spacer(self.rect.w/2, 0)) self.td(gui.Spacer(self.rect.w/2, 0)) self._counter_col = 0 self.add_counter(icons.GROATS_ICON, self.cash_counter) self.add_counter(icons.WOOD_ICON, self.wood_counter) self.add_counter(icons.CHKN_ICON, self.chicken_counter) self.add_counter(icons.EGG_ICON, self.egg_counter) self.add_counter(icons.KILLED_FOX, self.killed_foxes) self.add_counter(icons.DAY_ICON, self.day_counter) self.add_spacer(5)
def __init__(self,**params): self.task = gui.Form() # widget values get added to this dict self.state = None title = gui.Label("Task Dialog") table = gui.Table(width=400) # Name input table.tr() table.td(gui.Label("Name:"), colspan=1) table.td(gui.Input(name="name"), colspan=3) table.tr() table.td(gui.Spacer(width=1,height=5)) # Notes input table.tr() table.td(gui.Label("Notes:"), colspan=1) table.td(gui.Input(name="notes"), colspan=3) table.tr() table.td(gui.Spacer(width=1,height=5)) # Due date input table.tr() table.td(gui.Label("Due Date:"), colspan=1) table.td(gui.Input(name="dueDate"), colspan=3) table.tr() table.td(gui.Spacer(width=1,height=5)) # tags checkbox table.tr() table.td(gui.Label("Tags:"), colspan=4, align=0) tagGroup = gui.Group(name="tags") table.tr() table.td(gui.Label("School"), colspan=2, align=1) table.td(gui.Checkbox(tagGroup,value="school")) table.tr() table.td(gui.Label("Work"), colspan=2, align=1) table.td(gui.Checkbox(tagGroup,value="work")) table.tr() table.td(gui.Label("Health"), colspan=2, align=1) table.td(gui.Checkbox(tagGroup,value="health")) table.tr() table.td(gui.Spacer(width=1,height=10)) table.tr() self.saveBtn = gui.Button("Add Task") self.saveBtn.connect(gui.CLICK,self.send,gui.CHANGE) table.td(self.saveBtn, colspan=4) gui.Dialog.__init__(self,title,table)
def __init__(self,**params): fga = (255,25,0) title = gui.Label(u"游戏设置",font=psubfts) self.dfstr=[u'普 通',u'高 级',u'专 家',u'大 师'] self.value=gui.Form() tab=gui.Table() tab.tr() tab.td(gui.Spacer(width=8,height=16)) tab.tr() tab.td(gui.Label(u"难 度:",font=psubfts), align=1,valign=1) tt=gui.Table(width=200) sld=gui.HSlider(0,0,3,size=32,width=180,height=25,name='dif') dflb=gui.Label(self.dfstr[sld.value],width=180,font=psubfts,color=fga) sld.connect(gui.CHANGE, self.ajust,(sld,dflb)) tt.tr() tt.td(dflb) tt.tr() tt.td(sld,align=0,width=240) tab.td(tt) tab.tr() tab.td(gui.Spacer(width=8,height=16)) g = gui.Group(name='gstyle',value='style 1') tab.tr() tab.td(gui.Label(u"样 式:",font=psubfts),align=1) tt=gui.Table(width=200) tt.tr() tt.td(gui.Radio(g,value="style 1"),align=1) tt.td(gui.Image('data/s1.gif',width=36,height=36),align=-1) #tt.td(gui.Label(u"一",font=psubfts),align=-1) tt.td(gui.Radio(g,value="style 2"),align=1) tt.td(gui.Image('data/s2.gif',width=36,height=36),align=-1) tt.td(gui.Radio(g,value="style 3"),align=1) tt.td(gui.Image('data/s3.png',width=36,height=36),align=-1) tab.td(tt) tab.tr() tab.td(gui.Spacer(width=8,height=16)) tab.tr() bv=gui.Label(u"确定",font=psubfts,color=fga) bt=gui.Button(bv) bt.connect(gui.CLICK, self.send, gui.CHANGE) tab.td(bt,width=120,align=1) bv=gui.Label(u"取消",font=psubfts,color=fga) bt=gui.Button(bv) bt.connect(gui.CLICK, self.close,None) tab.td(bt) tab.tr() tab.td(gui.Spacer(width=8,height=16)) gui.Dialog.__init__(self, title, tab)
def __init__(self, **params): gui.Table.__init__(self, **params) self.value = gui.Form() self.tr() self.td(gui.Label("Map ID: ", color=UI_FONT_COLOR), colspan=2) self.tr() self.inpMapID = gui.Input('0', size=8, name='inpWarpMapID') self.td(self.inpMapID, colspan=2) # used for selecting the map - todo ''' mapDialog = MapSelectorDialog(self.inpMapID) self.tr() e = gui.Button('Choose map...') e.connect(gui.CLICK, mapDialog.openDialog, None) self.td(e, colspan=2) ''' self.tr() self.td(gui.Spacer(10, 20)) self.tr() self.td(gui.Label("Warp-To Position", color=UI_FONT_COLOR), colspan=2) self.tr() self.td(gui.Label("X: ", color=UI_FONT_COLOR)) self.td(gui.Input("0", size=4, name="inpWarpX")) self.tr() self.td(gui.Label("Y: ", color=UI_FONT_COLOR)) self.td(gui.Input("0", size=4, name="inpWarpY")) self.tr() self.td(gui.Spacer(10, 20)) self.tr() label = gui.Label("Left click to add warp", color=UI_FONT_COLOR) self.td(label, colspan=2) self.tr() label = gui.Label("Right click to remove warp", color=UI_FONT_COLOR) self.td(label, colspan=2) # initialize the alert dialog self.alertDialog = EmptyFieldAlertDialog()
def setup_sliders(self): table = gui.Table() table.tr() table.td(gui.Label('Двигатели:', font=self.font), align=-1) self.left_engine_slider = gui.VSlider(value=0, min=-100, max=100, size=10, width=16, height=200) self.right_engine_slider = gui.VSlider(value=0, min=-100, max=100, size=10, width=16, height=200) table.tr() container = gui.Container() table.td(container) left_input = gui.Input('0', font=self.font, size=4) right_input = gui.Input('0', font=self.font, size=4) def sliders_changed(): left_input.value = str(-self.left_engine_slider.value) right_input.value = str(-self.right_engine_slider.value) self.change_engine_power(-self.left_engine_slider.value, -self.right_engine_slider.value) def inputs_changed(): try: left = int(left_input.value) right = int(right_input.value) if abs(left) <= 100 and abs(right) <= 100: self.left_engine_slider.value = -left self.right_engine_slider.value = -right self.change_engine_power(left, right) except: pass self.left_engine_slider.connect(gui.CHANGE, sliders_changed) self.right_engine_slider.connect(gui.CHANGE, sliders_changed) left_input.connect(gui.KEYDOWN, inputs_changed) right_input.connect(gui.KEYDOWN, inputs_changed) lt = gui.Table(width=35) lt.tr() lt.td(left_input, align=1) gt = gui.Table() gt.tr() gt.td(right_input, align=-1) container.add(left_input, 20, 90) container.add(self.left_engine_slider, 70, 0) container.add(self.right_engine_slider, 120, 0) container.add(right_input, 140, 90) table.tr() table.td(gui.Spacer(height=20, width=0)) return table
def genCardTbl(self, cards): # create a talbe(widget) to place all cards tbl = gui.Table(name='table') self.cardsGroup = gui.Group(value=None) # generate all cards included in the input argument stacks # and place them on the table amountCards = len(cards) if amountCards > 0: card = [None] * amountCards vcard = [None] * amountCards for i in range(amountCards): vcard[i] = general.genVcard(cards[i]) tbl.td(gui.Tool(self.cardsGroup, vcard[i], value=i)) tbl.td(gui.Spacer(width=10, height=20)) # monitor the event whether the selection change self.selected = False self.cardsGroup.send(gui.CHANGE) def getGv(self): print(cards[self.cardsGroup.value].getName(), ' is selected') self.selected = True self._click.play() self.cardsGroup.connect(gui.CHANGE, getGv, self) return tbl
def open_dialog(self, widget, x=None, y=None, close_callback=None): """Open a dialog for the given widget. Add close button.""" tbl = gui.Table() def close_dialog(): self.disp.close(tbl) if close_callback is not None: close_callback() close_button = gui.Button("Close") close_button.connect(gui.CLICK, close_dialog) tbl = gui.Table() tbl.tr() tbl.td(widget, colspan=2) tbl.tr() tbl.td(gui.Spacer(100, 0)) tbl.td(close_button, align=1) if x: offset = (self.disp.rect.center[0] + x, self.disp.rect.center[1] + y) else: offset = None self.disp.open(tbl, pos=offset) return tbl
def __init__(self, **params): gui.Table.__init__(self, **params) self.value = gui.Form() self.tr() self.td(gui.Label("Map ID: ", color=UI_FONT_COLOR), colspan=2) self.tr() self.inpMapID = gui.Input('', size=8, name='inpWarpMapID') self.td(self.inpMapID, colspan=2) # used for selecting the map mapDialog = MapSelectorDialog(self.inpMapID) self.tr() e = gui.Button('Choose map...') e.connect(gui.CLICK, mapDialog.openDialog, None) self.td(e, colspan=2) self.tr() self.td(gui.Spacer(10, 20)) self.tr() self.td(gui.Label("Warp-To Position", color=UI_FONT_COLOR), colspan=2) self.tr() self.td(gui.Label("X: ", color=UI_FONT_COLOR)) self.td(gui.Input("0", size=4, name="inpWarpX")) self.tr() self.td(gui.Label("Y: ", color=UI_FONT_COLOR)) self.td(gui.Input("0", size=4, name="inpWarpY"))
def __init__(self, **params): gui.Table.__init__(self, **params) self.tr() self.lblItemNum = gui.Label(_('Item: 0'), color=UI_FONT_COLOR) self.td(self.lblItemNum) self.tr() self.sliItemNum = gui.HSlider(value=0, min=0, max=99, size=10, width=120, name='selDataItemNum') self.sliItemNum.connect(gui.CHANGE, self.updateLabelItemNum, self.sliItemNum) self.td(self.sliItemNum) self.tr() self.td(gui.Spacer(10, 20)) self.tr() self.lblStr = gui.Label(_('Item Value: 0'), color=UI_FONT_COLOR) self.td(self.lblStr) self.tr() e = gui.HSlider(value=0, min=0, max=99, size=10, width=120, name='selDataItemVal') e.connect(gui.CHANGE, self.updateLabelStr, e) self.td(e)
def __init__(self, **params): gui.Table.__init__(self, **params) self.tr() self.lblDur = gui.Label('Durability: 0', color=UI_FONT_COLOR) self.td(self.lblDur) self.tr() e = gui.HSlider(value=0, min=0, max=99, size=10, width=120, name='selDataDur') e.connect(gui.CHANGE, self.updateLabelDur, e) self.td(e) self.tr() self.td(gui.Spacer(10, 20)) self.tr() self.lblStr = gui.Label('Strength: 0', color=UI_FONT_COLOR) self.td(self.lblStr) self.tr() e = gui.HSlider(value=0, min=0, max=99, size=10, width=120, name='selDataStr') e.connect(gui.CHANGE, self.updateLabelStr, e) self.td(e)
def __init__(self, bckg="None", port=None, **params): self.bckg = bckg self.port = port title = gui.Label("Setting sensor for port %d" % int(self.port)) self.value = gui.Form() self.container = gui.Container() table = gui.Table() table.tr() self.sensors_img = gui.Image(p('icons/sensors.jpg')) table.td(self.sensors_img, cellspan=3) spacer = gui.Spacer(200, 100) self.box = gui.ScrollArea(spacer) table.tr() table.td(self.box, style={'border': 1}) save = gui.Button('Save') save.connect(gui.CLICK, self.send, gui.CHANGE) table.tr() table.td(save, align=1) self.container.add(table, 0, 0) self.init_ports() self.change() gui.Dialog.__init__(self, title, self.container)
def __init__(self, **params): gui.Table.__init__(self, **params) self.value = gui.Form() '''self.content = gui.Table() self.scrollArea = gui.ScrollArea(self.content, width=270, height=372, hscrollbar=False) self.tr() self.td(self.scrollArea) self.tr() g = gui.Group(name="grpTileType") self.content.td(gui.Label("Ground", color=UI_FONT_COLOR)) self.content.td(gui.Spacer(10, 0)) e = gui.Radio(g, value=1) e.click() self.content.td(e) self.content.tr() self.content.td(gui.Label("Fringe", color=UI_FONT_COLOR)) self.content.td(gui.Spacer(10, 0)) self.content.td(gui.Radio(g, value=2)) ''' self.tr() g = gui.Group(name="grpTileType") self.td(gui.Label("Ground", color=UI_FONT_COLOR)) self.td(gui.Spacer(10, 0)) e = gui.Radio(g, value=1) e.click() self.td(e) self.tr() self.td(gui.Label("Fringe", color=UI_FONT_COLOR)) self.td(gui.Spacer(10, 0)) self.td(gui.Radio(g, value=2)) e = gui.Select(name='selTileType') e.add('Layer 1', 0) e.add('Layer 2', 1) e.add('Layer 3', 2) e.add('Fringe', 3) e.value = 0 self.td(e)
def __init__(self, title, message, **params): title = gui.Label(title) body = gui.Table() body.tr() body.td(gui.Label(message), colspan=3) body.tr() body.td(gui.Spacer(0, 15), colspan=3) ok_button = gui.Button("Ok") ok_button.connect(gui.CLICK, self.clicked) body.tr() body.td(gui.Spacer(0, 0), colspan=2) body.td(ok_button, align=-1) gui.Dialog.__init__(self, title, body, **params)
def __init__(self, **params): gui.Table.__init__(self, **params) self.value = gui.Form() self.tr() g = gui.Group(name="grpTileType") self.td(gui.Label("Ground", color=UI_FONT_COLOR)) self.td(gui.Spacer(10, 0)) e = gui.Radio(g, value=1) e.click() self.td(e) self.tr() self.td(gui.Label("Fringe", color=UI_FONT_COLOR)) self.td(gui.Spacer(10, 0)) self.td(gui.Radio(g, value=2))
def alertMessageDialog(msg='', title=''): # show an alert message if title is '': title = gui.Label('Alert Message') else: title = gui.Label(title) mainTable = gui.Table() mainTable.tr() mainTable.td(gui.Spacer(10, 10)) mainTable.tr() mainTable.td(gui.Label(msg)) mainTable.tr() mainTable.td(gui.Spacer(10, 20)) d = gui.Dialog(title, mainTable) # handle alert messages differently on some alerts if msg == 'Your account has been created!': def btnAccountCreated(btn): g.gameEngine.setState(MENU_LOGIN) d.close() btn = gui.Button('OK', width=120) btn.connect(gui.CLICK, btnAccountCreated, None) else: # simple close button def btnOk(btn): d.close() btn = gui.Button('OK', width=120) btn.connect(gui.CLICK, btnOk, None) # add button to alert message mainTable.tr() mainTable.td(btn) # show the message d.open()
def __init__(self, **params): gui.Table.__init__(self, **params) self.value = gui.Form() # dialogs openNpcDialog = OpenNPCDialog(self) self.tr() self.td(gui.Spacer(10, 70)) self.tr() e = gui.Button("Open NPC...", width=100) e.connect(gui.CLICK, openNpcDialog.openDialog, None) self.td(e, colspan=2) self.tr() self.td(gui.Spacer(10, 20)) self.tr() self.td(gui.Label('Name:', color=UI_FONT_COLOR), colspan=2) self.tr() self.td(gui.Input('', size=26, name='inpNpcName'), colspan=2, valign=-1) self.tr() self.td(gui.Spacer(10, 20)) self.tr() self.td(gui.Label('Behaviour:', color=UI_FONT_COLOR), colspan=2) self.tr() e = gui.Select(name='selBehaviour') e.add('Attack on sight', 0) e.add('Attack when attacked', 1) e.add('Friendly', 2) e.add('Shopkeeper', 3) e.add('Guard', 4) e.value = 0 #e.connect(gui.CHANGE, self.updateType, None) self.td(e, colspan=2)
def display_worlds(optionchange=False): worldtable.clear() x = 0 for w in worlds: if x % cache["columns"] == 0: worldtable.tr() wtab = gui.Table() wtab.td(w.info, colspan=2) wtab.tr() if thumbsize: wtab.td(w.image, colspan=2) else: wtab.td(gui.Spacer(1, 20)) wtab.tr() wtab.td(gui.Spacer(pad, pad)) wtab.tr() wtab.td(gui.Spacer(420, 25), colspan=2) wtab.tr() worldtable.td(gui.Spacer(pad, 1)) worldtable.td(wtab) x += 1 if x % cache["columns"] == 0: worldtable.tr() worldtable.td(gui.Spacer(12, 12)) if app.widget: print("Window Reset!") app.resize() app.repaint() size = pygame.display.get_surface().get_size() data = { "size": size, "w": size[0], "h": size[1], "reload": True if optionchange else False } pygame.event.post(pygame.event.Event(pygame.VIDEORESIZE, data))
def __init__(self, title_txt, button_txt, allow_new, cls="dialog"): self.value = None self.save_folder = config.config.save_folder self.save_games = {} self._populate_save_games() if allow_new: self.name_input = gui.Input() else: self.name_input = None td_style = { 'padding_left': 4, 'padding_right': 4, 'padding_top': 2, 'padding_bottom': 2, } self.save_list = gui.List(width=350, height=250) games = self.save_games.keys() games.sort() for name in games: self.save_list.add(name, value=name) self.save_list.set_vertical_scroll(0) self.save_list.connect(gui.CHANGE, self._save_list_change) self.image_container = gui.Container() button_ok = gui.Button(button_txt) button_ok.connect(gui.CLICK, self._click_ok) button_cancel = gui.Button("Cancel") button_cancel.connect(gui.CLICK, self._click_cancel) body = gui.Table() body.tr() body.td(self.save_list, style=td_style, colspan=2) body.td(self.image_container, style=td_style, colspan=2) body.tr() if self.name_input: body.td(gui.Label("Save as:"), style=td_style, align=1) body.td(self.name_input, style=td_style) else: body.td(gui.Spacer(0, 0), style=td_style, colspan=2) body.td(button_ok, style=td_style, align=1) body.td(button_cancel, style=td_style, align=1) title = gui.Label(title_txt, cls=cls + ".title.label") gui.Dialog.__init__(self, title, body) if games: self.save_list.group.value = games[0]
def __init__(self, **params): gui.Table.__init__(self, **params) self.value = gui.Form() self.engine = None def btnNextChar(btn): self.engine.charIndex += 1 self.engine.updateCharSelection() def btnPrevChar(btn): self.engine.charIndex -= 1 self.engine.updateCharSelection() def btnUseChar(btn): if self.lblPlayerName.value != 'Create a new character': g.tcpConn.sendUseChar(self.engine.charIndex - 1) g.gameState = MENU_INGAME else: # new char g.tcpConn.sendGetClasses() g.gameState = MENU_NEWCHAR def btnDelChar(btn): print "lawl" self.tr() self.lblPlayerName = gui.Label('PLAYER NAME', color=(255, 0, 0)) self.td(self.lblPlayerName, colspan=3, valign=1) self.tr() self.lblPlayerExtra = gui.Label('PLAYER LEVEL/CLASS', color=(255, 0, 0)) self.td(self.lblPlayerExtra, colspan=3) self.tr() btn = gui.Button("Previous", width=160, height=40) btn.connect(gui.CLICK, btnPrevChar, None) self.td(btn) self.td(gui.Spacer(300, 160)) btn = gui.Button("Next", width=160, height=40) btn.connect(gui.CLICK, btnNextChar, None) self.td(btn) self.tr() self.td(gui.Spacer(0, 0)) self.btnSelChar = gui.Button("Use Character", width=160, height=30) self.btnSelChar.connect(gui.CLICK, btnUseChar, None) self.td(self.btnSelChar) self.td(gui.Spacer(0, 0)) self.tr() self.td(gui.Spacer(0, 20)) self.tr() self.td(gui.Spacer(0, 0)) btn = gui.Button("Delete Character", width=160, height=30) btn.connect(gui.CLICK, btnDelChar, None) self.td(btn) self.td(gui.Spacer(0, 0))
def __init__(self, **params): title = gui.Label("Alert") t = gui.Table() t.tr() t.td( gui.Label( "Your name and password must be at least three characters in length!" )) t.tr() t.td(gui.Spacer(10, 20)) e = gui.Button("OK") e.connect(gui.CLICK, self.close, None) t.td(e) t.tr() t.td(gui.Spacer(10, 10)) gui.Dialog.__init__(self, title, t)
def __init__(self, **params): gui.Table.__init__(self, **params) self.value = gui.Form() self.engine = None def btnNextClass(btn): self.engine.classIndex += 1 self.engine.updateClassSelection() def btnPrevClass(btn): self.engine.classIndex -= 1 self.engine.updateClassSelection() def btnCreateChar(btn): self.engine.createCharacter() def btnCancel(btn): g.gameState = MENU_CHAR self.tr() self.lblCharName = gui.Label(_('Character Name'), color=(255, 255, 255)) self.td(self.lblCharName, colspan=3, valign=1) self.tr() self.inpCharName = gui.Input(name='inpCharName', value='') self.td(self.inpCharName, colspan=3) self.tr() self.lblClassName = gui.Label(_('CLASS NAME'), color=(255, 255, 255)) self.td(self.lblClassName, colspan=3, valign=1) self.tr() btn = gui.Button(_("Previous"), width=160, height=40) btn.connect(gui.CLICK, btnPrevClass, None) self.td(btn) self.td(gui.Spacer(300, 160)) btn = gui.Button(_("Next"), width=160, height=40) btn.connect(gui.CLICK, btnNextClass, None) self.td(btn) self.tr() self.td(gui.Spacer(0, 0)) self.btnSelChar = gui.Button(_("Create Character"), width=160, height=30) self.btnSelChar.connect(gui.CLICK, btnCreateChar, None) self.td(self.btnSelChar) self.td(gui.Spacer(0, 0)) self.tr() self.td(gui.Spacer(0, 20)) self.tr() self.td(gui.Spacer(0, 0)) btn = gui.Button("Cancel", width=160, height=30) btn.connect(gui.CLICK, btnCancel, None) self.td(btn) self.td(gui.Spacer(0, 0))
def renderView(view, states, width, height, EventHandler): container = gui.Table(width=width, vpadding=0, hpadding=0, cls="desktop") for entity in view.attributes["entity_id"]: if entity in states: state = states[entity] if state.domain == "group": row = renderGroup(state, states, width, height, EventHandler) container.td(row) container.tr() container.td(gui.Spacer(cls="desktop", width=width, height=5)) container.tr() else: row = renderEntity(state, states, width, height, EventHandler) if row: container.td(row) container.td(gui.Spacer(cls="desktop", width=width, height=20)) container.tr() container.tr() else: log.info("Cannot find any state for {}. Skipping".format(entity)) return container
def __init__(self, **params): gui.Table.__init__(self, **params) self.value = gui.Form() self.engine = None def btnNextChar(btn): self.engine.charIndex += 1 self.engine.updateCharSelection() def btnPrevChar(btn): self.engine.charIndex -= 1 self.engine.updateCharSelection() def btnUseChar(btn=None): if self.lblPlayerName.value != 'Empty': g.tcpConn.sendUseChar(self.engine.charIndex-1) g.gameEngine.setState(MENU_INGAME) else: # new char g.tcpConn.sendGetClasses() g.gameEngine.setState(MENU_NEWCHAR) def btnDelChar(btn): print ("not yet implemented") self.tr() self.lblPlayerName = gui.Label('#PLAYER_NAME', antialias=1, color=UI_NAME_FONT_COLOR, font=g.charSelFont) self.td(self.lblPlayerName, colspan=3, valign=1, align=0) self.tr() self.lblPlayerExtra = gui.Label('#PLAYER_LEVEL_CLASS', antialias=1, color=UI_NAME_FONT_COLOR, font=g.charSelFont, name='lblExtra') self.td(self.lblPlayerExtra, colspan=3, align=0) self.tr() btn = gui.Button(_("Previous"), width=160, height=40) btn.connect(gui.CLICK, btnPrevChar, None) self.td(btn) self.td(gui.Spacer(300, 160)) btn = gui.Button(_("Next"), width=160, height=40) btn.connect(gui.CLICK, btnNextChar, None) self.td(btn) self.tr() self.td(gui.Spacer(0, 0)) self.btnSelChar = gui.Button(_("Use Character"), width=160, height=30) self.btnSelChar.connect(gui.CLICK, btnUseChar, None) self.td(self.btnSelChar) self.td(gui.Spacer(0, 0)) self.tr() self.td(gui.Spacer(0, 20)) self.tr() self.td(gui.Spacer(0, 0)) btn = gui.Button(_("Delete Character"), width=160, height=30) btn.connect(gui.CLICK, btnDelChar, None) self.td(btn) self.td(gui.Spacer(0, 0))
def paintRevealedCard(revealCard): table = gui.Table() table.tr() # create the player name part as a button nameBlock = gui.Button(revealCard[0], width=70, height=25) table = tbl.td(nameBlock) table = tbl.tr() table = tbl.td(gui.Spacer(width=1, height=5)) table = tr() # create the card part as a table group = gui.Group(value=None) cardBlock = createCardView(revealCard[1]) table.td(gui.Tool(group, cardBlock, None)) return table