def createUI(self): w, h = gdata.scrnSize cols = 15 rows = 8 width = cols * 20 + 5 height = rows * 20 + 4 self.win = ui.Window(self.app, modal = 1, escKeyClose = 1, movable = 0, title = _('Rename Fleet'), rect = ui.Rect((w - width) / 2, (h - height) / 2, width, height), layoutManager = ui.SimpleGridLM(), ) self.win.subscribeAction('*', self) # rename ui.Label(self.win, layout = (0, 0, 5, 1), text = _('Name'), align = ui.ALIGN_W) ui.Entry(self.win, layout = (5, 0, 10, 1), id = 'vName', align = ui.ALIGN_E) ui.Check(self.win, layout = (0, 1, 15, 1), id = "vRetain", text = _("Retain name during fleet joins"), action = "onSelect", data = 2) ui.Check(self.win, layout = (0, 2, 15, 1), id = "vPrevent", text = _("Prevent all fleet joins"), action = "onSelect", data = 0) ui.Label(self.win, layout = (0, 4, 15, 1), text = _(' Note: Retaining name will prevent two'), align = ui.ALIGN_W) ui.Label(self.win, layout = (0, 5, 15, 1), text = _(' retain name fleets from joining.'), align = ui.ALIGN_W) # status bar + submit/cancel ui.TitleButton(self.win, layout = (10, 6, 5, 1), text = _('Rename'), action = 'onRename') ui.TitleButton(self.win, layout = (5, 6, 5, 1), text = _('Delete Name'), action = 'onDelete') ui.TitleButton(self.win, layout = (0, 6, 5, 1), text = _('Cancel'), action = 'onCancel')
def set_ui(self): titles = ['Organization', 'Genre', 'Title', 'Status', 'Volume'] [ self.add_child( ui.Label(create_rect(y=MARGIN + i * LABEL_HEIGHT), '{} :'.format(x), halign=ui.RIGHT)) for i, x in enumerate(titles) ] for i, x in enumerate(titles): setattr( self, LABEL_MASK.format(x.lower()), ui.Label(create_rect(MARGIN * 2 + TITLES_WIDTH, MARGIN + i * LABEL_HEIGHT, TITLES_WIDTH * 2), 'some_text_{}'.format(x.lower()), halign=ui.LEFT)) self.add_child(getattr(self, LABEL_MASK.format(x.lower()))) buttons = ['Previous', 'Play', 'Next', 'Random', 'VolDown', 'VolUp'] for i, x in enumerate(buttons): x_coord = BUTTON_MARGIN + (BUTTON_WIDTH + BUTTON_MARGIN) * i setattr( self, BUTTON_MASK.format(x.lower()), ui.Button( create_rect(x=x_coord, y=250, width=BUTTON_WIDTH, height=BUTTON_HEIGHT), x)) button = getattr(self, BUTTON_MASK.format(x.lower())) button.on_clicked.connect( getattr(self, BUTTON_CLICK_MASK.format(x.lower()))) self.add_child(button) self.set_playing()
def createUI(self): screenWidth, screenHeight = gdata.scrnSize # size of dialog in layout metrics (for SimpleGridLM) cols = 25 rows = 20 # dialog width and height in pixels width = cols * 20 + 5 height = rows * 20 + 4 #creating dialog window self.win = ui.Window(self.app, modal = 1, escKeyClose = 1, movable = 0, title = _("Galaxy finish"), rect = ui.Rect((screenWidth - width) / 2, (screenHeight - height) / 2, width, height), layoutManager = ui.SimpleGridLM(), ) self.win.subscribeAction('*', self) # first row is window title rows -= 1 ui.Label(self.win, layout = (0, 0, cols, 1), text = _("If you are sure to finish this galaxy, click on Finish button."), align = ui.ALIGN_W) ui.Label(self.win, layout = (0, 1, cols, 1), text = _("You can enter message visible in finish announcement below."), align = ui.ALIGN_W) s = ui.Scrollbar(self.win, layout = (cols - 1, 2, 1, rows - 3)) t = ui.Text(self.win, layout = (0, 2, cols - 1, rows - 3), id = 'vMsg') t.attachVScrollbar(s) # dialog bottom line ui.Title(self.win, layout = (0, rows - 1, cols - 10, 1)) ui.TitleButton(self.win, layout = (cols - 10, rows - 1, 5, 1), text = _("Finish"), action = 'onFinish') ui.TitleButton(self.win, layout = (cols - 5, rows - 1, 5, 1), text = _("Cancel"), action = 'onClose')
def createUI(self): screenWidth, screenHeight = gdata.scrnSize # size of dialog in layout metrics (for SimpleGridLM) cols = 20 rows = 6 # dialog width and height in pixels width = cols * 20 + 5 height = rows * 20 + 4 #creating dialog window self.win = ui.Window( self.app, modal=1, escKeyClose=1, movable=0, title=_("Search for system"), rect=ui.Rect(10, 25, width, height), layoutManager=ui.SimpleGridLM(), ) self.win.subscribeAction('*', self) # first row is window title rows -= 1 ui.Label( self.win, layout=(0, 0, cols, 1), text= _("Use wildcard search as with files (*ese* finds Presere and Shesed)" ), align=ui.ALIGN_W) ui.Label( self.win, layout=(0, 1, cols - 1, 1), text=_("* matches everything, ? matches any single character"), align=ui.ALIGN_W) ui.Label(self.win, layout=(0, 2, 6, 1), text=_("System name:"), align=ui.ALIGN_W) ui.Entry(self.win, layout=(6, 2, cols - 7, 1), id="vSystemName", align=ui.ALIGN_W) # dialog bottom line ui.Title(self.win, layout=(0, rows - 1, cols - 15, 1)) srchBtn = ui.TitleButton(self.win, layout=(cols - 15, rows - 1, 5, 1), text=_("Find"), action='onSearch', data=1) ui.TitleButton(self.win, layout=(cols - 10, rows - 1, 5, 1), text=_("Next"), action='onNext') ui.TitleButton(self.win, layout=(cols - 5, rows - 1, 5, 1), text=_("Cancel"), action='onClose') self.win.acceptButton = srchBtn
def createUI(self): w, h = gdata.scrnSize cols = 22 rows = 13 width = cols * 20 + 4 height = rows * 20 + 24 self.win = ui.Window( self.app, modal=1, escKeyClose=1, movable=0, title=_("Edit buoy"), rect=ui.Rect((w - width) / 2, (h - height) / 2, width, height), layoutManager=ui.SimpleGridLM(), ) # creating dialog window self.win.subscribeAction('*', self) ui.Label(self.win, text=_("Buoy text:"), align=ui.ALIGN_W, layout=(0, 0, 4, 1)) ui.Label(self.win, text=_("Visible to:"), align=ui.ALIGN_W, layout=(6, 0, 4, 1)) ui.Check(self.win, text=_("Allies"), align=ui.ALIGN_W, layout=(10.5, 0, 4, 1), id='vAllied', action="turnOff", data="vAllied") ui.Check(self.win, text=_("Scanner Share"), align=ui.ALIGN_W, layout=(15, 0, 6, 1), id='vScanner', action="turnOff", data="vScanner") s = ui.Scrollbar(self.win, layout=(cols - 1, 1, 1, rows - 3)) t = ui.Text( self.win, id='vText', align=ui.ALIGN_W, layout=(0, 1, cols - 1, rows - 2), ) t.attachVScrollbar(s) ui.Title(self.win, layout=(0, rows - 1, cols - 10, 1)) ui.TitleButton(self.win, layout=(cols - 10, rows - 1, 5, 1), text=_("Cancel"), action="onCancel") okBtn = ui.TitleButton(self.win, layout=(cols - 5, rows - 1, 5, 1), text=_("OK"), action='onOK') self.win.acceptButton = okBtn
def createUI(self): w, h = gdata.scrnSize self.win = ui.Window(self.app, modal = 1, movable = 0, title = _('Outer Space Login'), rect = ui.Rect((w - 424) / 2, (h - 164) / 2, 424, 164), layoutManager = ui.SimpleGridLM(), tabChange = True, ) self.win.subscribeAction('*', self) ui.Label(self.win, text = _('Universe'), align = ui.ALIGN_E, layout = (5, 0, 6, 1) ) ui.Button(self.win, id = 'vUniverse', align = ui.ALIGN_W, layout = (11, 0, 10, 1), action = "onUniverse", ) ui.Label(self.win, text = _('Login'), align = ui.ALIGN_E, layout = (5, 1, 6, 1) ) ui.Entry(self.win, id = 'vLogin', align = ui.ALIGN_W, layout = (11, 1, 10, 1), orderNo = 1 ) ui.Label(self.win, text = _('Password'), align = ui.ALIGN_E, layout = (5, 2, 6, 1), ) ui.Entry(self.win, id = 'vPassword', align = ui.ALIGN_W, showChar = '*', layout = (11, 2, 10, 1), orderNo = 2 ) ui.Check(self.win, layout = (16.5,3,5,1), text = _('Auto-login'), id = 'vAutoLogin', checked = 0, action = "onAutoLogin") ui.Check(self.win, layout = (11.25,3,5,1), text = _('Remember'), id = 'vSavePassword', checked = 0, action = "onSavePassword") ui.Button(self.win, layout = (11, 4, 10, 1), text = _("Options"), action = "onOptions", id = "vOptions") ui.Button(self.win, layout = (11, 5, 10, 1), text = _("New account"), action = "onCreateAccount", id = "vCreate") ui.Title(self.win, layout = (0, 6, 11, 1), id = 'vMessage', align = ui.ALIGN_W) ui.TitleButton(self.win, layout = (11, 6, 5, 1), text = _('Exit'), action = 'onCancel') loginBtn = ui.TitleButton(self.win, layout = (16, 6, 5, 1), text = _('Login'), action = 'onLogin') ui.Label(self.win, layout = (0, 0, 5, 4), icons = ((res.loginLogoImg, ui.ALIGN_W),)) self.win.acceptButton = loginBtn # Universe selection self.universeMenu = ui.Menu(self.app, title = _("Universes"), width = 10, ) self.universeMenu.subscribeAction("*", self)
def createUI(self): w, h = gdata.scrnSize self.win = ui.Window(self.app, modal=1, movable=0, title=_('Change password'), rect=ui.Rect((w - 324) / 2, (h - 104) / 2, 324, 104), layoutManager=ui.SimpleGridLM(), tabChange=True) self.win.subscribeAction('*', self) ui.Label(self.win, text=_('Old password'), align=ui.ALIGN_E, layout=(0, 0, 6, 1)) ui.Entry(self.win, id='vOld', align=ui.ALIGN_W, showChar='*', layout=(6, 0, 10, 1), orderNo=1) ui.Label( self.win, text=_('New password'), align=ui.ALIGN_E, layout=(0, 1, 6, 1), ) ui.Entry(self.win, id='vNew', align=ui.ALIGN_W, showChar='*', layout=(6, 1, 10, 1), orderNo=2) ui.Label( self.win, align=ui.ALIGN_E, text=_('Confirm'), layout=(0, 2, 6, 1), ) ui.Entry(self.win, id='vConfirm', align=ui.ALIGN_W, layout=(6, 2, 10, 1), showChar="*", orderNo=3) ui.Title(self.win, layout=(0, 3, 8, 1), id='vMessage', align=ui.ALIGN_W) ui.TitleButton(self.win, layout=(8, 3, 4, 1), text=_('Cancel'), action='onCancel') ui.TitleButton(self.win, layout=(12, 3, 4, 1), text=_('Apply'), action='onChange')
def __init__(self): ui.Scene.__init__(self) self.add_child(ui.Label(ui.Rect(0,0,320,50),'Raspberry Pi Sound Meter')) self.progress_view = ui.ProgressView(ui.Rect(20, 50, 280, 120)) self.add_child(self.progress_view) self.db_value = ui.Label(ui.Rect(110, 170, 100, 30), '00.00 dB') self.add_child(self.db_value) self.progress = 0
def createUI(self): w, h = gdata.scrnSize self.win = ui.Window( self.app, modal=1, escKeyClose=1, movable=0, title=_('Change quantity'), rect=ui.Rect((w - 264) / 2, (h - 104) / 2, 264, 104), layoutManager=ui.SimpleGridLM(), ) # creating dialog window self.win.subscribeAction('*', self) ui.Label(self.win, text=_("New quantity:"), align=ui.ALIGN_E, layout=(0, 1, 6, 1)) ui.Entry( self.win, id='vQuantity', align=ui.ALIGN_W, layout=(6, 1, 3, 1), #text = self.quantity, ) ui.Title(self.win, layout=(0, 3, 3, 1)) ui.TitleButton(self.win, layout=(3, 3, 5, 1), text=_("Cancel"), action="onCancel") okBtn = ui.TitleButton(self.win, layout=(8, 3, 5, 1), text=_("OK"), action='onOK') self.win.acceptButton = okBtn
def createUI(self): w, h = gdata.scrnSize self.win = ui.Window( self.app, modal=1, movable=0, title=_('Question'), rect=ui.Rect((w - 424) / 2, (h - 124) / 2, 424, 124), layoutManager=ui.SimpleGridLM(), ) self.win.subscribeAction('*', self) ui.Text(self.win, layout=(5, 0, 16, 4), id='vText', background=self.win.app.theme.themeBackground, editable=0) ui.Label(self.win, layout=(0, 0, 5, 4), icons=((res.loginLogoImg, ui.ALIGN_W), )) ui.Title(self.win, layout=(0, 4, 13, 1), id='vStatusBar', align=ui.ALIGN_W) ui.TitleButton(self.win, layout=(13, 4, 4, 1), id='vCancel', action='onCancel') ui.TitleButton(self.win, layout=(17, 4, 4, 1), id='vConfirm', action='onConfirm')
def __init__(self): ui.Scene.__init__(self) self.on17_button = ui.Button(ui.Rect(MARGIN, MARGIN, 130, 60), '17 on') self.on17_button.on_clicked.connect(self.gpi_button) self.add_child(self.on17_button) self.on4_button = ui.Button(ui.Rect(170, MARGIN, 130, 60), '4 on') self.on4_button.on_clicked.connect(self.gpi_button) self.add_child(self.on4_button) self.off17_button = ui.Button(ui.Rect(MARGIN, 100, 130, 60), '17 off') self.off17_button.on_clicked.connect(self.gpi_button) self.add_child(self.off17_button) self.off4_button = ui.Button(ui.Rect(170, 100, 130, 60), '4 off') self.off4_button.on_clicked.connect(self.gpi_button) self.add_child(self.off4_button) self.progress_view = ui.ProgressView(ui.Rect(MARGIN, 200, 280, 40)) self.add_child(self.progress_view) self.volts_value = ui.Label(ui.Rect(135, 170, 50, 30), 'Hi!') self.add_child(self.volts_value) self.progress = 0
def update_people(self): r = requests.get("https://meepo-api.herokuapp.com/people") items = [] for person in r.json()['people']: items.append(person['name']) label_height = ui.theme.current.label_height labels = [ ui.Label(ui.Rect(0, 0, LIST_WIDTH, label_height), item, halign=ui.LEFT) for item in items ] self.list_view.items = labels
def __init__(self): self.chan = 0 ui.Scene.__init__(self) self.previousChan_button = ui.Button(ui.Rect(MARGIN, MARGIN, 130, 60), 'Previous Chan') self.previousChan_button.on_clicked.connect(self.gpi_button) self.add_child(self.previousChan_button) self.nextChan_button = ui.Button(ui.Rect(170, MARGIN, 130, 60), 'Next Chan') self.nextChan_button.on_clicked.connect(self.gpi_button) self.add_child(self.nextChan_button) self.chan_value = ui.Label(ui.Rect(MARGIN, 170, 100, 30), '') self.add_child(self.chan_value) self.progress_view = ui.ProgressView(ui.Rect(MARGIN, 200, 280, 40)) self.add_child(self.progress_view) self.volts_value = ui.Label(ui.Rect(170, 170, 50, 30), '') self.add_child(self.volts_value)
def createUI(self): w, h = gdata.scrnSize self.win = ui.Window( self.app, modal=1, escKeyClose=1, movable=0, title=_('Rename system'), rect=ui.Rect((w - 404) / 2, (h - 164) / 2, 400 + 4, 164), layoutManager=ui.SimpleGridLM(), ) self.win.subscribeAction('*', self) # rename ui.Title(self.win, layout=(0, 0, 10, 1), text=_('System name'), font='normal-bold', align=ui.ALIGN_W) ui.Label(self.win, layout=(0, 1, 5, 1), text=_('Name'), align=ui.ALIGN_W) ui.Entry(self.win, layout=(5, 1, 5, 1), id='vName', align=ui.ALIGN_E) ui.Title(self.win, layout=(10, 0, 10, 1), text=_('Planet numbering'), font='normal-bold', align=ui.ALIGN_W) ui.Listbox(self.win, layout=(10, 1, 10, 5), id='vNumbers', columnLabels=0, columns=((None, 'text', 0, ui.ALIGN_W), )) # status bar + submit/cancel ui.TitleButton(self.win, layout=(15, 6, 5, 1), text=_('Rename'), action='onClose') ui.TitleButton(self.win, layout=(10, 6, 5, 1), text=_('Cancel'), action='onCancel') ui.Title(self.win, id='vStatusBar', layout=(0, 6, 10, 1), align=ui.ALIGN_W) #self.win.statusBar = self.win.vStatusBar
def createUI(self): w, h = gdata.scrnSize self.win = ui.Window(self.app, modal=1, movable=0, title=_('Select starting position'), rect=ui.Rect((w - 424) / 2, (h - 264) / 2, 424, 264), layoutManager=ui.SimpleGridLM(), tabChange=True) ui.Listbox(self.win, layout=(0, 0, 21, 10), id='vPos', columns=((_('Galaxy'), 'text', 5, ui.ALIGN_W), (_('Position'), 'tPos', 0, ui.ALIGN_W)), columnLabels=1) self.win.subscribeAction('*', self) ui.Label(self.win, layout=(0, 10, 5, 1), text=_("VIP Password:")) ui.Entry(self.win, layout=(5, 10, 5, 1), id='vPassword', align=ui.ALIGN_W, showChar='*', orderNo=1) ui.Title(self.win, layout=(0, 11, 13, 1), id='vStatusBar', align=ui.ALIGN_W) ui.TitleButton(self.win, layout=(13, 11, 4, 1), text=_('Exit'), action='onCancel') ui.TitleButton(self.win, layout=(17, 11, 4, 1), text=_('Select'), action='onSelect') self.win.statusBar = self.win.vStatusBar
def createUI(self): w, h = gdata.scrnSize self.win = ui.Window( self.app, modal=1, escKeyClose=1, titleOnly=w == 800 and h == 600, movable=0, rect=ui.Rect((w - 800 - 4 * (w != 800)) / 2, (h - 600 - 4 * (h != 600)) / 2, 800 + 4 * (w != 800), 580 + 4 * (h != 600)), layoutManager=ui.SimpleGridLM(), ) self.win.subscribeAction('*', self) ui.Title(self.win, layout=(0, 27, 35, 1), id='vStatusBar', align=ui.ALIGN_W) ui.TitleButton(self.win, layout=(35, 27, 5, 1), text=_('Close'), action='onCloseDlg') # fleet selection ui.Listbox(self.win, id='vShips', layout=(0, 0, 20, 12), columns=( (_('Name'), 'text', 6.5, ui.ALIGN_W), (_('Lvl'), 'tLevel', 1.5, ui.ALIGN_NONE), (_('Class'), 'tClass', 3, ui.ALIGN_E), (_('HP'), 'tHP', 4, ui.ALIGN_E), (_('Exp'), 'tExp', 2, ui.ALIGN_E), (_('Spd'), 'tSpeed', 2, ui.ALIGN_E), ), columnLabels=1, action='onShipSelected') # fleet data ui.Label(self.win, text=_('Coordinates'), layout=(20, 0, 5, 1), align=ui.ALIGN_W) ui.Label(self.win, id='vFCoordinates', layout=(25, 0, 5, 1), align=ui.ALIGN_E) ui.Label(self.win, text=_('Orbiting'), layout=(30, 0, 5, 1), align=ui.ALIGN_W) ui.Label(self.win, id='vFOrbiting', layout=(35, 0, 5, 1), align=ui.ALIGN_E) ui.Label(self.win, text=_('Max speed'), layout=(20, 1, 5, 1), align=ui.ALIGN_W) ui.Label(self.win, id='vFMaxSpeed', layout=(25, 1, 5, 1), align=ui.ALIGN_E) ui.Label(self.win, text=_('Signature'), layout=(30, 1, 5, 1), align=ui.ALIGN_W) ui.Label(self.win, id='vFSignature', layout=(35, 1, 5, 1), align=ui.ALIGN_E) # commands ui.Title(self.win, text=_('Commands'), align=ui.ALIGN_W, font='normal-bold', layout=(20, 12, 20, 1)) ui.Listbox(self.win, layout=(20, 13, 20, 10), id='vCommands', columns=(('', 'current', 1, 0), (_('#'), 'tIndex', 1, 0), (_('Command'), 'text', 5, ui.ALIGN_W), (_('Target'), 'targetName', 7, ui.ALIGN_W), (_('Info'), 'data', 7, ui.ALIGN_W)), columnLabels=1, action='onSelectCommand', sortable=False) ui.Button(self.win, text=_('New cmd'), layout=(20, 23, 4, 1), action='onNewCommand') ui.Button(self.win, text=_('Set active'), layout=(24, 23, 4, 1), id='vCommandSetActive', action='onSetActiveCommand') ui.Button(self.win, text=_('Delete cmd'), layout=(28, 23, 4, 1), id='vCommandDel', action='onDeleteCommand') ui.Button(self.win, text=_('Delete All'), layout=(32, 23, 4, 1), action='onDeleteAllCommands') ui.ArrowButton(self.win, layout=(36, 23, 1, 1), direction=ui.ALIGN_N, id='vCommandUp', action='onCommandMove', data=-1) ui.ArrowButton(self.win, layout=(37, 23, 1, 1), direction=ui.ALIGN_S, id='vCommandDown', action='onCommandMove', data=1) ui.Title(self.win, text=_('Other commands'), align=ui.ALIGN_W, font='normal-bold', layout=(20, 24, 20, 1)) ui.Button(self.win, text=_('Split fleet'), id='vSplitButton', layout=(20, 25, 5, 1), action='onSplitFleet') ui.Button(self.win, text=_('Rename fleet'), id='vRenameButton', layout=(25, 25, 5, 1), action='onRenameFleet') ui.Button(self.win, text=_('Fleet Specs'), id='vFleetSpecs', layout=(30, 25, 5, 1), action='onFleetSpecs') ui.Button(self.win, text=_('Auto delete'), id='vAutoDeleteButton', layout=(35, 25, 5, 1), action='onAutoDelete') ui.Button(self.win, text=_('Scout wave'), id='vScoutWaveButton', layout=(20, 26, 5, 1), action='onScoutWaveFleet') ui.Button(self.win, text=_('Scrap fleet'), id='vScrapButton', layout=(25, 26, 5, 1), action='onScrapFleet') # ship data ui.Title(self.win, text=_('Ship Data'), layout=(0, 12, 15, 1), align=ui.ALIGN_W, font='normal-bold') ui.Button(self.win, text=_("Scrap"), layout=(15, 12, 5, 1), action="onDeleteSelectedShip") ui.Label(self.win, text=_('Name'), layout=(0, 13, 5, 1), align=ui.ALIGN_W) ui.Label(self.win, id='vShipModel', layout=(5, 13, 5, 1), align=ui.ALIGN_E) ui.Label(self.win, text=_('Class'), layout=(10, 13, 5, 1), align=ui.ALIGN_W) ui.Label(self.win, id='vShipClass', layout=(15, 13, 5, 1), align=ui.ALIGN_E) ui.Label(self.win, text=_('Attack eff'), layout=(0, 14, 5, 1), align=ui.ALIGN_W) ui.Label(self.win, id='vShipAtt', layout=(5, 14, 5, 1), align=ui.ALIGN_E) ui.Label(self.win, text=_('Defence eff'), layout=(10, 14, 5, 1), align=ui.ALIGN_W) ui.Label(self.win, id='vShipDef', layout=(15, 14, 5, 1), align=ui.ALIGN_E) ui.Label(self.win, text=_('Max speed'), layout=(0, 15, 5, 1), align=ui.ALIGN_W) ui.Label(self.win, id='vShipMaxSpeed', layout=(5, 15, 5, 1), align=ui.ALIGN_E) ui.Label(self.win, text=_('Scanner Pwr'), layout=(10, 15, 5, 1), align=ui.ALIGN_W) ui.Label(self.win, id='vShipScannerPwr', layout=(15, 15, 5, 1), align=ui.ALIGN_E) ui.Label(self.win, text=_('Tanks'), layout=(0, 16, 5, 1), align=ui.ALIGN_W) ui.Label(self.win, id='vShipStorages', layout=(5, 16, 5, 1), align=ui.ALIGN_E) ui.Label(self.win, text=_('Signature'), layout=(10, 16, 5, 1), align=ui.ALIGN_W) ui.Label(self.win, id='vShipSignature', layout=(15, 16, 5, 1), align=ui.ALIGN_E) ui.Label(self.win, text=_('Support'), layout=(0, 17, 5, 1), align=ui.ALIGN_W) ui.Label(self.win, id='vShipSupport', layout=(5, 17, 5, 1), align=ui.ALIGN_E) ui.Label(self.win, text=_('Max HP'), layout=(10, 17, 5, 1), align=ui.ALIGN_W) ui.Label(self.win, id='vShipMaxHP', layout=(15, 17, 5, 1), align=ui.ALIGN_E) ui.Title(self.win, text=_("Equipment"), layout=(0, 18, 20, 1), align=ui.ALIGN_W, font='normal-bold') ui.Listbox(self.win, id='vShipEquipment', layout=(0, 19, 20, 8), columns=((_('Name'), 'text', 8, ui.ALIGN_W), (_('Data'), 'tData', 0, ui.ALIGN_W)), columnLabels=1)
def createUI(self): w, h = gdata.scrnSize self.win = ui.Window(self.app, modal = 1, escKeyClose = 1, titleOnly = w == 800 and h == 600, movable = 0, title = _('Construction Centre'), rect = ui.Rect((w - 800 - 4 * (w != 800)) / 2, (h - 600 - 4 * (h != 600)) / 2, 800 + 4 * (w != 800), 580 + 4 * (h != 600)), layoutManager = ui.SimpleGridLM(), ) self.win.subscribeAction('*', self) # player listing ui.Title(self.win, layout = (0, 0, 15, 1), text = _('Ship Designs'), font = 'normal-bold', align = ui.ALIGN_W) ui.Listbox(self.win, layout = (0, 1, 15, 25), id = 'vDesigns', columns = ( (_('#'), 'tNumber', 2, ui.ALIGN_E), (_('B'), 'tInBuild', 2, ui.ALIGN_E), (_('Name'), 'text', 8, ui.ALIGN_W), (_('Class'), 'tClass', 2, ui.ALIGN_W), ), columnLabels = 1, action = "onSelectDesign", ) ui.Button(self.win, layout = (0, 26, 7, 1), text = _("New design"), action = "onNewDesign") ui.Button(self.win, layout = (7, 26, 7, 1), text = _("Dupl. design"), action = "onDuplDesign", enabled = 0, id = "vDuplDesign") # current design ui.Title(self.win, layout = (15, 0, 25, 1), text = _('Design'), font = 'normal-bold', align = ui.ALIGN_W) # info ui.Label(self.win, layout = (15, 1, 5, 1), text = _("Name"), align = ui.ALIGN_W) ui.Entry(self.win, layout = (20, 1, 10, 1), id = "vName", align = ui.ALIGN_E) ui.Label(self.win, layout = (15, 2, 5, 1), text = _("Hull type"), align = ui.ALIGN_W) ui.ActiveLabel(self.win, layout = (20, 2, 10, 1), id = "vHull", align = ui.ALIGN_E, action = "onSelectHull") ui.Label(self.win, layout = (15, 3, 5, 1), text = _("Control unit"), align = ui.ALIGN_W) ui.ActiveLabel(self.win, layout = (20, 3, 10, 1), id = "vCtrl", align = ui.ALIGN_E, action = "onSelectCtrl") ui.Title(self.win, layout = (15, 4, 15, 1), text = _('Equipment'), font = 'normal-bold', align = ui.ALIGN_W) ui.Listbox(self.win, layout = (15, 5, 15, 19), id = 'vEquipment', columns = ( (_('#'), 'tNumber', 2, ui.ALIGN_E), (_('Name'), 'text', 8, ui.ALIGN_W), (_('Data'), 'tData', 4, ui.ALIGN_W), ), columnLabels = 1, action = "onEqSelectedInList" ) ui.Button(self.win, layout = (15, 24, 1.2, 1), text = _("++"), action = "onIncrEquipment5", rmbAction = "onIncrEquipment20") ui.Button(self.win, layout = (16.2, 24, 1.8, 1), text = _("+"), action = "onIncrEquipment") ui.Button(self.win, layout = (18, 24, 1.8, 1), text = _("-"), action = "onDecrEquipment") ui.Button(self.win, layout = (19.8, 24, 1.2, 1), text = _("--"), action = "onDecrEquipment5", rmbAction = "onDecrEquipment20") ui.Button(self.win, layout = (21, 24, 4.5, 1), text = _("Add"), action = "onAddEquipment") ui.Button(self.win, layout = (25.5, 24, 4.5, 1), text = _("Remove"), action = "onRemoveEquipment") # ship's attrs ui.Label(self.win, layout = (30, 1, 5, 1), text = _("Class"), align = ui.ALIGN_W) ui.Label(self.win, layout = (35, 1, 5, 1), id = "vAClass", align = ui.ALIGN_E) ui.Label(self.win, layout = (30, 2, 5, 1), text = _("Signature"), align = ui.ALIGN_W) ui.Label(self.win, layout = (35, 2, 5, 1), id = "vASignature", align = ui.ALIGN_E) ui.Label(self.win, layout = (30, 3, 5, 1), text = _("Speed"), align = ui.ALIGN_W) ui.Label(self.win, layout = (35, 3, 5, 1), id = "vASpeed", align = ui.ALIGN_E) ui.Label(self.win, layout = (30, 4, 5, 1), text = _("HP"), align = ui.ALIGN_W) ui.Label(self.win, layout = (35, 4, 5, 1), id = "vAHP", align = ui.ALIGN_E) ui.Label(self.win, layout = (30, 5, 5, 1), text = _("Base attack"), align = ui.ALIGN_W) ui.Label(self.win, layout = (35, 5, 5, 1), id = "vAAttack", align = ui.ALIGN_E) ui.Label(self.win, layout = (30, 6, 5, 1), text = _("Base defence"), align = ui.ALIGN_W) ui.Label(self.win, layout = (35, 6, 5, 1), id = "vADefence", align = ui.ALIGN_E) ui.Label(self.win, layout = (30, 7, 5, 1), text = _("Military power"), align = ui.ALIGN_W) ui.Label(self.win, layout = (35, 7, 5, 1), id = "vACombatPwr", align = ui.ALIGN_E) ui.Label(self.win, layout = (30, 8, 5, 1), text = _("Base exp pts"), align = ui.ALIGN_W) ui.Label(self.win, layout = (35, 8, 5, 1), id = "vABaseExp", align = ui.ALIGN_E) ui.Label(self.win, layout = (30, 10, 3, 1), text = _("Tanks"), align = ui.ALIGN_W) ui.Label(self.win, layout = (33, 10, 7, 1), id = "vATanks", align = ui.ALIGN_E) ui.Label(self.win, layout = (30, 11, 7, 1), text = _("Support (fuel)"), align = ui.ALIGN_W) ui.Label(self.win, layout = (37, 11, 3, 1), id = "vASupport", align = ui.ALIGN_E) ui.Label(self.win, layout = (30, 12, 7, 1), text = _("Support (const. pts)"), align = ui.ALIGN_W) ui.Label(self.win, layout = (37, 12, 3, 1), id = "vACSup", align = ui.ALIGN_E) ui.Label(self.win, layout = (30, 13, 5, 1), text = _("Max. range"), align = ui.ALIGN_W) ui.Label(self.win, layout = (35, 13, 5, 1), id = "vARange", align = ui.ALIGN_E) ui.Label(self.win, layout = (30, 15, 5, 1), text = _("Unused payload"), align = ui.ALIGN_W) ui.Label(self.win, layout = (35, 15, 5, 1), id = "vAPayload", align = ui.ALIGN_E) ui.Label(self.win, layout = (30, 16, 5, 1), text = _("Free slots"), align = ui.ALIGN_W) ui.Label(self.win, layout = (35, 16, 5, 1), id = "vASlots", align = ui.ALIGN_E) ui.Label(self.win, layout = (30, 18, 5, 1), text = _("Constr. pts"), align = ui.ALIGN_W) ui.Label(self.win, layout = (35, 18, 5, 1), id = "vACCPts", align = ui.ALIGN_E) ui.Label(self.win, layout = (30, 20, 5, 1), text = _("Upgrade to"), align = ui.ALIGN_W) ui.Label(self.win, layout = (35, 20, 5, 1), id = "vAUpgrade", align = ui.ALIGN_E) # actions ui.Title(self.win, layout = (15, 25, 25, 1), text = _('Design Actions'), font = 'normal-bold', align = ui.ALIGN_W) ui.Button(self.win, layout = (15, 26, 5, 1), text = _("Upgrade"), id = "vUpgrade", action = "onUpgrade") ui.Button(self.win, layout = (20, 26, 5, 1), text = _("Scrap"), id = "vScrap", action = "onScrap") ui.Button(self.win, layout = (35, 26, 5, 1), text = _("Construct"), id = "vConstruct", action = "onConstruct") # status bar + submit/cancel ui.TitleButton(self.win, layout = (35, 27, 5, 1), text = _('Close'), action = 'onClose') ui.Title(self.win, id = 'vStatusBar', layout = (0, 27, 35, 1), align = ui.ALIGN_W)
def createUI(self): w, h = gdata.scrnSize width = 764 # 38 * 20 + 4 height = 464 # 23 * 20 + 4 self.win = ui.Window(self.app, modal=1, escKeyClose=1, movable=0, title=_("New message"), rect=ui.Rect((w - width) / 2, (h - height) / 2, width, height), layoutManager=ui.SimpleGridLM(), tabChange=True) self.win.subscribeAction('*', self) # headers ui.Label(self.win, layout=(0, 0, 5, 1), text=_("Recipient"), align=ui.ALIGN_W) ui.ActiveLabel(self.win, layout=(5, 0, 33, 1), id="vRecipient", align=ui.ALIGN_W) ui.Label(self.win, layout=(0, 1, 5, 1), text=_("Subject"), align=ui.ALIGN_W) ui.Entry(self.win, layout=(5, 1, 33, 1), id="vTopic", align=ui.ALIGN_W, orderNo=1) ui.Title(self.win, layout=(0, 2, 38, 1), text=_("Message"), font="normal-bold", align=ui.ALIGN_W) s = ui.Scrollbar(self.win, layout=(37, 3, 1, 18)) t = ui.Text(self.win, layout=(0, 3, 37, 18), id="vText", orderNo=2) t.attachVScrollbar(s) # info ui.Title(self.win, layout=(0, 21, 28, 1), id='vStatusBar', align=ui.ALIGN_W) ui.TitleButton(self.win, layout=(28, 21, 5, 1), text=_("Cancel"), action='onCancel') ui.TitleButton(self.win, layout=(33, 21, 5, 1), text=_("Send"), action='onSend') # status bar #self.win.statusBar = self.win.vStatusBar # # contact window # width = 304 # 15 * 20 + 4 height = 264 # 13 * 20 + 4 self.cwin = ui.Window( self.app, modal=1, escKeyClose=1, titleOnly=0, movable=0, title=_("Select recipient"), rect=ui.Rect((w - width) / 2, (h - height) / 2, width, height), layoutManager=ui.SimpleGridLM(), ) self.cwin.subscribeAction('*', self) # rename ui.Listbox(self.cwin, layout=(0, 0, 15, 11), id='vContacts', columnLabels=0, columns=((None, 'text', 0, ui.ALIGN_W), ), multiselection=1, sortedBy=('text', 1)) # status bar + submit/cancel ui.TitleButton(self.cwin, layout=(10, 11, 5, 1), text=_("Select"), action='onContactSelected') ui.TitleButton(self.cwin, layout=(5, 11, 5, 1), text=_("Cancel"), action='onContactCancel') ui.Title(self.cwin, id='vStatusBar', layout=(0, 11, 5, 1), align=ui.ALIGN_W)
def createUI(self): w, h = gdata.scrnSize self.win = ui.Window(self.app, modal=1, escKeyClose=1, titleOnly=w == 800 and h == 600, movable=0, title=_('Construction Centre'), rect=ui.Rect((w - 800 - 4 * (w != 800)) / 2, (h - 600 - 4 * (h != 600)) / 2, 800 + 4 * (w != 800), 580 + 4 * (h != 600)), layoutManager=ui.SimpleGridLM()) self.win.subscribeAction('*', self) # player listing ui.Title(self.win, layout=(0, 0, 15, 1), text=_('Ship Designs'), font='normal-bold', align=ui.ALIGN_W) ui.Listbox(self.win, layout=(0, 1, 15, 25), id='vDesigns', columns=((_('#'), 'tNumber', 2, ui.ALIGN_E), (_('B'), 'tInBuild', 2, ui.ALIGN_E), (_('Name'), 'text', 8, ui.ALIGN_W), (_('Class'), 'tClass', 2, ui.ALIGN_W)), columnLabels=1, action="onSelectDesign", hoverAction="onHighlightDesign") ui.Button(self.win, layout=(0, 26, 7, 1), text=_("New design"), action="onNewDesign") ui.Button(self.win, layout=(7, 26, 7, 1), text=_("Dupl. design"), action="onDuplDesign", enabled=0, id="vDuplDesign") # current design ui.Title(self.win, layout=(15, 0, 25, 1), text=_('Design'), font='normal-bold', align=ui.ALIGN_W) # info ui.Label(self.win, layout=(15, 1, 5, 1), text=_("Name"), align=ui.ALIGN_W) ui.Entry(self.win, layout=(20, 1, 10, 1), id="vName", align=ui.ALIGN_E) ui.Label(self.win, layout=(15, 2, 5, 1), text=_("Hull type"), align=ui.ALIGN_W) ui.ActiveLabel(self.win, layout=(20, 2, 10, 1), id="vHull", align=ui.ALIGN_E, action="onSelectHull") ui.Label(self.win, layout=(15, 3, 5, 1), text=_("Control unit"), align=ui.ALIGN_W) ui.ActiveLabel(self.win, layout=(20, 3, 10, 1), id="vCtrl", align=ui.ALIGN_E, action="onSelectCtrl") ui.Button(self.win, layout=(15, 4, 6, 1), text=_('Engines'), id="vEnginesButton", font='normal-bold', action="onAddEngine") ui.Title( self.win, layout=(21, 4, 19, 1), ) ui.Listbox(self.win, layout=(15, 5, 25, 3), id='vEngines', columns=((_('#'), 'tNumber', 2, ui.ALIGN_E), (_('Name'), 'text', 8, ui.ALIGN_W), (_('Data'), 'tData', 14, ui.ALIGN_W)), columnLabels=0, action="onEqSelectedInListInc", rmbAction="onEqSelectedInListDec") ui.Button(self.win, layout=(15, 8, 6, 1), text=_('Weapons'), id="vWeaponsButton", font='normal-bold', action="onAddWeapon") ui.Title( self.win, layout=(21, 8, 19, 1), ) ui.Listbox(self.win, layout=(15, 9, 25, 4), id='vWeapons', columns=((_('#'), 'tNumber', 2, ui.ALIGN_E), (_('Name'), 'text', 8, ui.ALIGN_W), (_('Data'), 'tData', 14, ui.ALIGN_W)), columnLabels=0, action="onEqSelectedInListInc", rmbAction="onEqSelectedInListDec") ui.Button(self.win, layout=(15, 13, 6, 1), text=_('Equipment'), id="vEquipmentButton", font='normal-bold', action="onAddEquipment") ui.Title( self.win, layout=(21, 13, 19, 1), ) ui.Listbox(self.win, layout=(15, 14, 25, 5), id='vEquipment', columns=((_('#'), 'tNumber', 2, ui.ALIGN_E), (_('Name'), 'text', 8, ui.ALIGN_W), (_('Data'), 'tData', 14, ui.ALIGN_W)), columnLabels=0, action="onEqSelectedInListInc", rmbAction="onEqSelectedInListDec") ui.Button(self.win, layout=(15, 19, 6, 1), text=_("Upgrade to"), id="vUpgrade", font='normal-bold', action="onUpgrade") ui.Label(self.win, layout=(21, 19, 6, 1), id="vAUpgrade", align=ui.ALIGN_E) ui.Title(self.win, layout=(27.5, 19, 12.5, 1)) # ship's attrs ui.Label(self.win, layout=(30.5, 1, 4.5, 1), text=_("Class"), align=ui.ALIGN_W) ui.Label(self.win, layout=(35, 1, 4.75, 1), id="vAClass", align=ui.ALIGN_E) ui.Label(self.win, layout=(30.5, 2, 6.5, 1), text=_("Free slots"), align=ui.ALIGN_W) ui.Label(self.win, layout=(37, 2, 2.75, 1), id="vASlots", align=ui.ALIGN_E) ui.Label(self.win, layout=(30.5, 3, 6.5, 1), text=_("Unused payload"), align=ui.ALIGN_W) ui.Label(self.win, layout=(37, 3, 2.75, 1), id="vAPayload", align=ui.ALIGN_E) ui.Label(self.win, layout=(17, 21, 4, 1), text=_("HP"), align=ui.ALIGN_W) ui.Label(self.win, layout=(21, 21, 5, 1), id="vAHP", align=ui.ALIGN_E) ui.Label(self.win, layout=(17, 22, 4, 1), text=_("Base attack"), align=ui.ALIGN_W) ui.Label(self.win, layout=(21, 22, 5, 1), id="vAAttack", align=ui.ALIGN_E) ui.Label(self.win, layout=(17, 23, 3, 1), text=_("Base defence"), align=ui.ALIGN_W) ui.Label(self.win, layout=(20, 23, 6, 1), id="vADefence", align=ui.ALIGN_E) ui.Label(self.win, layout=(17, 24, 5, 1), text=_("Military power"), align=ui.ALIGN_W) ui.Label(self.win, layout=(22, 24, 4, 1), id="vACombatPwr", align=ui.ALIGN_E) ui.Label(self.win, layout=(28, 20, 5, 1), text=_("Signature"), align=ui.ALIGN_W) ui.Label(self.win, layout=(33, 20, 5, 1), id="vASignature", align=ui.ALIGN_E) ui.Label(self.win, layout=(28, 21, 5, 1), id="vSpeed", text=_("Speed"), align=ui.ALIGN_W) ui.Label(self.win, layout=(34, 21, 5, 1), id="vASpeed", align=ui.ALIGN_E) ui.Label(self.win, layout=(28, 22, 5, 1), text=_("Tanks"), align=ui.ALIGN_W) ui.Label(self.win, layout=(33, 22, 5, 1), id="vATanks", align=ui.ALIGN_E) ui.Label(self.win, layout=(28, 23, 5, 1), text=_("Max. range"), align=ui.ALIGN_W) ui.Label(self.win, layout=(33, 23, 5, 1), id="vARange", align=ui.ALIGN_E) ui.Label(self.win, layout=(28, 24, 5, 1), text=_("Constr. pts"), align=ui.ALIGN_W) ui.Label(self.win, layout=(33, 24, 5, 1), font='normal-bold', id="vACCPts", align=ui.ALIGN_E) # actions ui.Title(self.win, layout=(15, 25, 25, 1)) ui.Button(self.win, layout=(15, 26, 5, 1), text=_("Scrap"), id="vScrap", action="onScrap") ui.Button(self.win, layout=(35, 26, 5, 1), text=_("Construct"), id="vConstruct", action="onConstruct", enabled=0) # status bar + submit/cancel ui.TitleButton(self.win, layout=(35, 27, 5, 1), text=_('Close'), action='onClose') ui.Title(self.win, id='vStatusBar', layout=(0, 27, 35, 1), align=ui.ALIGN_W)
def createUI(self): w, h = gdata.scrnSize self.win = ui.Window(self.app, modal = 1, escKeyClose = 1, titleOnly = w == 800 and h == 600, movable = 0, title = _('Research'), rect = ui.Rect((w - 800 - 4 * (w != 800)) / 2, (h - 600 - 4 * (h != 600)) / 2, 800 + 4 * (w != 800), 580 + 4 * (h != 600)), layoutManager = ui.SimpleGridLM(), ) self.win.subscribeAction('*', self) ui.Title(self.win, layout = (0, 27, 35, 1), id = 'vStatusBar', align = ui.ALIGN_W) ui.TitleButton(self.win, layout = (35, 27, 5, 1), text = _('Close'), action = 'onCloseDlg') # TODO self.win.statusBar = self.win.vStatusBar # known techs ui.Title(self.win, layout = (0, 0, 20, 1), text = _('Known technologies'), align = ui.ALIGN_W, font = 'normal-bold') ui.Listbox(self.win, layout = (0, 1, 20, 25), id = 'vKTechs', columns = ((_('Name'), 'text', 10, ui.ALIGN_W), (_('Lvl'), 'tLevel', 1.5, 0), (_('Str'), 'tStruct', 1, 0), (_('Sh'), 'tShip', 1, 0), (_('ETC'), 'tETC', 0, ui.ALIGN_E)), columnLabels = 1, action = 'onSelectKTech') ui.Button(self.win, layout = (0, 26, 5, 1), text = _('Improve'), action = 'onStartImprovement') ui.Button(self.win, layout = (5, 26, 5, 1), id = "vSCompl", text = _('Show completed'), action = 'onToggleComleted', toggle = 1, pressed = 0) ui.Button(self.win, layout = (15, 26, 5, 1), text = _('Info'), action = 'onKTechInfo') # unknown techs ui.Title(self.win, layout = (20, 0, 20, 1), text = _('Researchable technologies'), align = ui.ALIGN_W, font = 'normal-bold') ui.Listbox(self.win, layout = (20, 1, 20, 12), id = 'vRTechs', columns = ((_('Name'), 'text', 10, ui.ALIGN_W), (_('Lvl'), 'tLevel', 1.5, 0), (_('Str'), 'tStruct', 1, 0), (_('Sh'), 'tShip', 1, 0), (_('ETC'), 'tETC', 0, ui.ALIGN_E)), columnLabels = 1, action = 'onSelectRTech') ui.Button(self.win, layout = (20, 13, 5, 1), text = _('Research'), action = 'onStartResearch') ui.Button(self.win, layout = (35, 13, 5, 1), text = _('Info'), action = 'onRTechInfo') # research queue ui.Title(self.win, layout = (20, 14, 20, 1), text = _('Research queue'), align = ui.ALIGN_W, id = 'vRQueueTitle', font = 'normal-bold') ui.Listbox(self.win, layout = (20, 15, 20, 11), id = 'vRQueue', columns = ( (_('R'), 'tImpToMax', 1, ui.ALIGN_NONE), (_('Name'), 'text', 10, ui.ALIGN_W), (_('Lvl'), 'tLevel', 1.5, 0), (_('Progress'), 'tProgress', 3.5, ui.ALIGN_E), (_('ETC'), 'tETC', 0, ui.ALIGN_E) ), columnLabels = 1, action = 'onSelectRQueueTech', sortable = False) ui.Button(self.win, layout = (20, 26, 2, 1), text =_("TOP"), id = 'vRQueueTop', action = 'onRTaskMove', data = -9999, tooltip = _("Move selected technology to the top of the queue.")) ui.ArrowButton(self.win, layout = (22, 26, 1, 1), direction = ui.ALIGN_N, id = 'vRQueueUp', action = 'onRTaskMove', data = -1) ui.ArrowButton(self.win, layout = (23, 26, 1, 1), direction = ui.ALIGN_S, id = 'vRQueueDown', action = 'onRTaskMove', data = 1) ui.Button(self.win, layout = (24, 26, 4, 1), text = _('Repeat'), id = 'vRQueueRepat', action = 'onRTaskRepeat', toggle = 1, tooltip = _("Repeat research of this technology until the technology is fully improved.")) ui.Button(self.win, layout = (28, 26, 3, 1), text = _('Abort'), id = 'vRQueueAbort', action = 'onRTaskAbort') ui.Button(self.win, layout = (31, 26, 4, 1), text = _('Info'), id = 'vRQueueInfo', action = 'onRQueueTechInfo') ui.Label(self.win, layout = (35, 26, 4, 1), id = "vRTotal", align = ui.ALIGN_E, tooltip = _("Total amount of time needed to research all technologies in the queue"))
app = ui.Application() win = ui.Window(app, title='Hello', rect=pygame.Rect(0, 0, 170, 120), layoutManager=ui.SimpleGridLM(), rightButtonClose=1) ui.Button(win, id='idButton', text='Press Me', layout=(1, 1, 6, 1), tooltip='This is tooltip.', action='action1') ui.Label( win, text='Press ESC to quit.', layout=(1, 3, 6, 1), ) win.subscribeAction('*', actionHandler) win.show() # event loop while 1: evt = pygame.event.wait() evt = app.processEvent(evt) if evt.type == pygame.QUIT: break if evt.type == pygame.KEYUP and evt.key == pygame.K_ESCAPE: break
def createUI(self): w, h = gdata.scrnSize self.win = ui.Window(self.app, modal = 1, escKeyClose = 1, titleOnly = w == 800 and h == 600, movable = 0, title = _('New Command'), rect = ui.Rect((w - 800 - 4 * (w != 800)) / 2, (h - 600 - 4 * (h != 600)) / 2, 800 + 4 * (w != 800), 580 + 4 * (h != 600)), layoutManager = ui.SimpleGridLM(), tabChange = True ) self.win.subscribeAction('*', self) StarMapWidget(self.win, layout = (0, 0, 40, 24), id = 'vStarMap', action = 'onSelectMapObj') # order buttons ui.Title(self.win, layout = (0, 24, 40, 1), text = _('Select command'), font = 'normal-bold', align = ui.ALIGN_W) ui.Button(self.win, layout = (0, 25, 5, 1), text = _('Move'), toggle = 1, id = 'vMoveBtn', action = 'onSelectCommand', data = Const.FLACTION_MOVE) ui.Button(self.win, layout = (5, 25, 5, 1), text = _('Refuel at'), toggle = 1, id = 'vRefuelBtn', action = 'onSelectCommand', data = Const.FLACTION_REFUEL) ui.Button(self.win, layout = (10, 25, 5, 1), text = _('Deploy'), toggle = 1, id = 'vDeplShipBtn', action = 'onSelectCommand', data = Const.FLACTION_DEPLOY) ui.Button(self.win, layout = (15, 25, 5, 1), text = _('Wait'), toggle = 1, id = 'vWaitBtn', action = 'onSelectCommand', data = Const.FLACTION_WAIT) ui.Button(self.win, layout = (20, 25, 5, 1), text = _('Declare War'), toggle = 1, id = 'vAttackBtn', action = 'onSelectCommand', data = Const.FLACTION_DECLAREWAR) ui.Button(self.win, layout = (25, 25, 5, 1), text = _('Repeat'), toggle = 1, id = 'vRepeatBtn', action = 'onSelectCommand', data = Const.FLACTION_REPEATFROM) ui.Button(self.win, layout = (30, 25, 5, 1), text = _('Use Wormhole'), toggle = 1, id = 'vWormholeBtn', action = 'onSelectCommand', data = Const.FLACTION_ENTERWORMHOLE) # Target indicator ui.Label(self.win, layout = (0, 26, 5, 1), text = _('Target'), align = ui.ALIGN_W, tags = [Const.FLACTION_MOVE, Const.FLACTION_DEPLOY, Const.FLACTION_REFUEL, Const.FLACTION_ENTERWORMHOLE]) ui.Label(self.win, layout = (0, 26, 5, 1), text = _('At commander'), align = ui.ALIGN_W, tags = [Const.FLACTION_DECLAREWAR]) ui.Label(self.win, layout = (5, 26, 10, 1), id = 'vTarget', align = ui.ALIGN_E, tags = [Const.FLACTION_MOVE, Const.FLACTION_DEPLOY, Const.FLACTION_DECLAREWAR, Const.FLACTION_REFUEL, Const.FLACTION_ENTERWORMHOLE]) # Delay indicator ui.Label(self.win, layout = (0, 26, 5, 1), text = _('Turns'), align = ui.ALIGN_W, tags = [Const.FLACTION_WAIT]) ui.Entry(self.win, layout = (5, 26, 5, 1), id = 'vTurns', text = '1', align = ui.ALIGN_E, tags = [Const.FLACTION_WAIT], orderNo = 1) # Ship to deploy ui.Label(self.win, layout = (15, 26, 5, 1), text = _('Ship'), align = ui.ALIGN_E, tags = [Const.FLACTION_DEPLOY]) ui.Button(self.win, layout = (20, 26, 10, 1), id = 'vDeplShip', align = ui.ALIGN_NONE, tags = [Const.FLACTION_DEPLOY], action = 'onDeplShipChange') # Repeat ui.Label(self.win, layout = (0, 26, 10, 1), text = _('Start from command #'), align = ui.ALIGN_W, tags = [Const.FLACTION_REPEATFROM]) ui.Entry(self.win, layout = (10, 26, 5, 1), id = 'vStartFrom', text = _('1'), align = ui.ALIGN_E, tags = [Const.FLACTION_REPEATFROM], orderNo = 2) ui.Label(self.win, layout = (36, 26, 2, 1), text = _("ETA:"), align = ui.ALIGN_W) ui.Label(self.win, layout = (38, 26, 2, 1), id = 'vEta', align = ui.ALIGN_E) # status bar + submit/cancel ui.TitleButton(self.win, layout = (35, 27, 5, 1), text = _('Order'), action = 'onOrder') ui.TitleButton(self.win, layout = (30, 27, 5, 1), text = _('Cancel'), action = 'onCancel') ui.Title(self.win, id = 'vStatusBar', layout = (0, 27, 30, 1), align = ui.ALIGN_W)
def __init__(self): ui.Scene.__init__(self) self.sceneId = 1 # label1Size = 32 # label2Size = 16 # ui.theme.current.set('Label', 'normal', 'background_color', (100, 255, 255)) # useful for seeing labels better ui.theme.current.set('Label', 'normal', 'padding', (0, 0)) label_height = ui.theme.current.label_height # frame = ui.Rect(MARGIN, MARGIN, 100, label_height) labels2 = [ ui.Label(ui.Rect(0, 0, 100, label_height), 'Item %d' % (i + 1)) for i in range(10) ] for l in labels2: l.halign = ui.LEFT self.select_view = ui.SelectView( ui.Rect(SMALL_MARGIN, SMALL_MARGIN, 180, label_height), labels2) # self.select_view.on_selection_changed.connect(self.selection_changed) self.add_child(self.select_view) #CURRENT DRYBULB self.lblCurBigLabel = ui.Label(ui.Rect(0, label_height + 2 * SMALL_MARGIN, 320, 90), "100 " + DEGREE_SIGN + "F", halign=ui.label.RIGHT) self.add_child(self.lblCurBigLabel) # HIGH PREDICTION self.lblHighDbLbl = ui.Label(ui.Rect( SMALL_MARGIN, self.lblCurBigLabel.frame.bottom + SMALL_MARGIN, 40, label_height), "High: ", halign=ui.label.LEFT) self.add_child(self.lblHighDbLbl) self.lblHighDb = ui.Label(ui.Rect(40 + SMALL_MARGIN, self.lblHighDbLbl.frame.top, 50, label_height), "100 " + DEGREE_SIGN + "F", halign=ui.label.LEFT) self.add_child(self.lblHighDb) # LOW PREDICTION self.lblLowDbLbl = ui.Label(ui.Rect( SMALL_MARGIN, self.lblHighDbLbl.frame.bottom + SMALL_MARGIN, 40, label_height), "Low: ", halign=ui.label.LEFT) self.add_child(self.lblLowDbLbl) self.lblLowDb = ui.Label(ui.Rect(40 + SMALL_MARGIN, self.lblLowDbLbl.frame.top, 50, label_height), "100 " + DEGREE_SIGN + "F", halign=ui.label.LEFT) self.add_child(self.lblLowDb) # dispImg = ui.get_image('/home/pi/JDrive/Utility_Meter_Tracking/Server_Polling/wthrStat/resources/partlycloudy.gif') dispImg = pygame.image.load('resources/partlycloudy.png') self.wthrImg = ui.ImageView( ui.Rect(self.lblHighDb.frame.right + SMALL_MARGIN, self.lblCurBigLabel.frame.bottom + SMALL_MARGIN, 50, 50), dispImg) self.add_child(self.wthrImg) # self.name_textfield = ui.TextField(frame, placeholder='Your name') # self.name_textfield.centerx = self.frame.centerx # self.add_child(self.name_textfield) # gridview = ui.GridView(ui.Rect(0, 0, 500, 500)) # self.scroll_gridview = ui.ScrollView(ui.Rect( # MARGIN, self.name_textfield.frame.bottom + MARGIN, # 200 - scrollbar_size, 250), gridview) # self.add_child(self.scroll_gridview) # # items = ['Apples', 'Bananas', 'Grapes', 'Cheese', 'Goats', 'Beer'] # labels = [ui.Label(ui.Rect(0, 0, LIST_WIDTH, label_height), item, halign=ui.LEFT) for item in items] # list_view = ui.ListView(ui.Rect(0, 0, LIST_WIDTH, 400), labels) # list_view.on_selected.connect(self.item_selected) # list_view.on_deselected.connect(self.item_deselected) # self.scroll_list = ui.ScrollView(ui.Rect( # MARGIN, self.scroll_gridview.frame.bottom + MARGIN, # LIST_WIDTH, 80), list_view) # self.add_child(self.scroll_list) # self.greet_button = ui.Button( ui.Rect(self.lblHighDb.frame.right + SMALL_MARGIN, self.wthrImg.frame.bottom + SMALL_MARGIN, 0, 0), 'blank') self.greet_button.on_clicked.connect(self.greet) self.add_child(self.greet_button)
def createUI(self): w, h = gdata.scrnSize cols = 32 rows = 20 dlgWidth = cols * 20 + 4 dlgHeight = rows * 20 + 4 self.win = ui.Window(self.app, modal=1, escKeyClose=1, movable=0, title=_('Select structure to construct'), rect=ui.Rect((w - dlgWidth) / 2, (h - dlgHeight) / 2, dlgWidth, dlgHeight), layoutManager=ui.SimpleGridLM()) self.win.subscribeAction('*', self) rows -= 1 # title ui.Title(self.win, layout=(0, 0, cols, 1), text=_('Production planet'), align=ui.ALIGN_W, font='normal-bold') ui.ButtonArray(self.win, layout=(0, 1, cols, 3), id='vPlanets', buttonSize=(8, 1), showSlider=0, action='onSelectPlanet') ui.Title(self.win, layout=(0, 4, cols - 10, 1), text=_('Structures to construct'), align=ui.ALIGN_W, font='normal-bold') ui.Title(self.win, layout=(cols - 10, 4, 10, 1), text=_('(right click for technology info)'), align=ui.ALIGN_E, font='normal') ui.ButtonArray(self.win, layout=(0, 5, cols, 9), id='vTechs', buttonSize=(2, 3), showSlider=0, action='onConstruct', rmbAction='onInfo') ui.Title(self.win, layout=(0, 14, 18, 1), text=_('Filters'), align=ui.ALIGN_W, font='normal-bold') ui.Label(self.win, layout=(0, 15, 6, 1), text=_('Technology levels:'), align=ui.ALIGN_W) ui.Button(self.win, layout=(6, 15, 1, 1), text=_('1'), id='vLevel1', toggle=1, action='onToggleLevel', data=1) ui.Button(self.win, layout=(7, 15, 1, 1), text=_('2'), id='vLevel2', toggle=1, action='onToggleLevel', data=2) ui.Button(self.win, layout=(8, 15, 1, 1), text=_('3'), id='vLevel3', toggle=1, action='onToggleLevel', data=3) ui.Button(self.win, layout=(9, 15, 1, 1), text=_('4'), id='vLevel4', toggle=1, action='onToggleLevel', data=4) ui.Button(self.win, layout=(10, 15, 1, 1), text=_('5'), id='vLevel5', toggle=1, action='onToggleLevel', data=5) ui.Button(self.win, layout=(11, 15, 1, 1), text=_('6'), id='vLevel6', toggle=1, action='onToggleLevel', data=6) ui.Button(self.win, layout=(12, 15, 1, 1), text=_('7'), id='vLevel7', toggle=1, action='onToggleLevel', data=7) ui.Button(self.win, layout=(13, 15, 1, 1), text=_('8'), id='vLevel8', toggle=1, action='onToggleLevel', data=8) ui.Button(self.win, layout=(14, 15, 1, 1), text=_('9'), id='vLevel9', toggle=1, action='onToggleLevel', data=9) ui.Check(self.win, layout=(0, 16, 6, 1), text=_('Bio production'), id='vBioProduction', checked=1, align=ui.ALIGN_W, action='onFilter') ui.Check(self.win, layout=(0, 17, 6, 1), text=_('En production'), id='vEnProduction', checked=1, align=ui.ALIGN_W, action='onFilter') ui.Check(self.win, layout=(6, 16, 6, 1), text=_('CP production'), id='vCPProduction', checked=1, align=ui.ALIGN_W, action='onFilter') ui.Check(self.win, layout=(6, 17, 6, 1), text=_('RP production'), id='vRPProduction', checked=1, align=ui.ALIGN_W, action='onFilter') ui.Check(self.win, layout=(12, 16, 6, 1), text=_('Military'), id='vMilitary', checked=1, align=ui.ALIGN_W, action='onFilter') ui.Check(self.win, layout=(12, 17, 6, 1), text=_('Morale'), id='vMorale', checked=1, align=ui.ALIGN_W, action='onFilter') ui.Title(self.win, layout=(18, 14, 6, 1), text=_('Sort'), align=ui.ALIGN_W, font='normal-bold') ui.Check(self.win, layout=(18, 15, 6, 1), text=_('Type'), id='vSortType', checked=1, align=ui.ALIGN_W, action='onSort', data='type') ui.Check(self.win, layout=(18, 16, 6, 1), text=_('Tech Level'), id='vSortTL', checked=0, align=ui.ALIGN_W, action='onSort', data='tl') ui.Check(self.win, layout=(18, 17, 6, 1), text=_('Name'), id='vSortNone', checked=0, align=ui.ALIGN_W, action='onSort', data='none') ui.Title(self.win, layout=(24, 14, 8, 1), text=_('Options'), align=ui.ALIGN_W, font='normal-bold') ui.Label(self.win, layout=(24, 15, 3, 1), text=_('Quantity'), align=ui.ALIGN_W) ui.Entry(self.win, layout=(27, 15, 5, 1), id='vQuantity', align=ui.ALIGN_E) ui.Check(self.win, layout=(26, 16, 8, 1), id='vReportFin', text=_('Report finalization'), align=ui.ALIGN_W) ui.Title(self.win, layout=(0, rows - 1, cols - 5, 1), align=ui.ALIGN_W) ui.TitleButton(self.win, layout=(cols - 5, rows - 1, 5, 1), text=_('Cancel'), action='onCancel')
def createUI(self): w, h = gdata.scrnSize cols = 14 rows = 8 width = cols * 20 + 5 height = rows * 20 + 4 self.win = ui.Window( self.app, modal=1, escKeyClose=1, movable=0, title=_('Color Definition'), rect=ui.Rect((w - width) / 2, (h - height) / 2, width, height), layoutManager=ui.SimpleGridLM(), tabChange=True, ) # creating dialog window self.win.subscribeAction('*', self) # R ui.Label(self.win, text=_("Red:"), align=ui.ALIGN_W, layout=(0, 0, 3, 1)) ui.Entry( self.win, id='vR', align=ui.ALIGN_W, layout=(7, 0, 3, 1), orderNo=1, reportValueChanged=True, ) ui.Scrollbar(self.win, layout=(0, 1, 10, 1), id='vRS', action="onChangeRed") # G ui.Label(self.win, text=_("Green:"), align=ui.ALIGN_W, layout=(0, 2, 3, 1)) ui.Entry( self.win, id='vG', align=ui.ALIGN_W, layout=(7, 2, 3, 1), orderNo=2, reportValueChanged=True, ) ui.Scrollbar(self.win, layout=(0, 3, 10, 1), id='vGS', action="onChangeGreen") # B ui.Label(self.win, text=_("Blue:"), align=ui.ALIGN_W, layout=(0, 4, 3, 1)) ui.Entry( self.win, id='vB', align=ui.ALIGN_W, layout=(7, 4, 3, 1), orderNo=3, reportValueChanged=True, ) ui.Scrollbar(self.win, layout=(0, 5, 10, 1), id='vBS', action="onChangeBlue") # color example ui.ColorBox(self.win, id='vColor', layout=(10, 0, 4, 6), margins=(4, 3, 4, 4)) #i.Title(self.win, layout = (0, 4, 2, 1)) ui.TitleButton(self.win, layout=(0, 6, 7, 1), text=_("Cancel"), action="onCancel") okBtn = ui.TitleButton(self.win, layout=(7, 6, 7, 1), text=_("OK"), action='onOK') self.win.acceptButton = okBtn
def __init__(self): ui.Scene.__init__(self) label_height = ui.theme.current.label_height scrollbar_size = ui.SCROLLBAR_SIZE frame = ui.Rect(MARGIN, MARGIN, 200, label_height) self.name_textfield = ui.TextField(frame, placeholder='Your name') self.name_textfield.centerx = self.frame.centerx self.add_child(self.name_textfield) gridview = ui.GridView(ui.Rect(0, 0, 500, 500)) self.scroll_gridview = ui.ScrollView(ui.Rect( MARGIN, self.name_textfield.frame.bottom + MARGIN, 200 - scrollbar_size, 250), gridview) self.add_child(self.scroll_gridview) items = ['Apples', 'Bananas', 'Grapes', 'Cheese', 'Goats', 'Beer'] labels = [ui.Label(ui.Rect( 0, 0, LIST_WIDTH, label_height), item, halign=ui.LEFT) for item in items] list_view = ui.ListView(ui.Rect(0, 0, LIST_WIDTH, 400), labels) list_view.on_selected.connect(self.item_selected) list_view.on_deselected.connect(self.item_deselected) self.scroll_list = ui.ScrollView(ui.Rect( MARGIN, self.scroll_gridview.frame.bottom + MARGIN, LIST_WIDTH, 80), list_view) self.add_child(self.scroll_list) self.greet_button = ui.Button(ui.Rect( self.name_textfield.frame.right + SMALL_MARGIN, self.name_textfield.frame.top, 0, 0), 'Submit') self.greet_button.on_clicked.connect(self.greet) self.add_child(self.greet_button) self.image_view = ui.view_for_image_named('logo') self.image_view.frame.right = self.frame.right - MARGIN self.image_view.frame.top = MARGIN self.add_child(self.image_view) self.checkbox = ui.Checkbox(ui.Rect( self.scroll_gridview.frame.right + MARGIN, self.scroll_gridview.frame.top, 200, label_height), 'I eat food') self.add_child(self.checkbox) self.checkbox1 = ui.Checkbox(ui.Rect( self.checkbox.frame.left, self.checkbox.frame.bottom + SMALL_MARGIN, 200, label_height), 'I drink water') self.add_child(self.checkbox1) self.checkbox2 = ui.Checkbox(ui.Rect( self.checkbox.frame.left, self.checkbox1.frame.bottom + SMALL_MARGIN, 200, label_height), 'I exercise regularly') self.add_child(self.checkbox2) info_image = ui.get_image('info') self.info_button = ui.ImageButton(ui.Rect( self.checkbox2.frame.left, self.checkbox2.frame.bottom + MARGIN, 0, 0), info_image) self.info_button.on_clicked.connect(self.show_alert) self.add_child(self.info_button) notify_image = ui.get_image('star') self.notify_button = ui.ImageButton(ui.Rect( self.info_button.frame.right + MARGIN, self.info_button.frame.top, 0, 0), notify_image) self.notify_button.on_clicked.connect(self.show_notification) self.add_child(self.notify_button) self.task_button = ui.Button(ui.Rect( self.info_button.frame.left, self.info_button.frame.bottom + MARGIN, 0, 0), 'Consume!') self.task_button.on_clicked.connect(self.run_fake_task) self.add_child(self.task_button) self.running_task = False self.progress_view = ui.ProgressView(ui.Rect( self.frame.right - MARGIN - 180, self.task_button.frame.centery - scrollbar_size // 2, 180, scrollbar_size)) self.add_child(self.progress_view) self.progress_view.hidden = True labels2 = [ui.Label( ui.Rect(0, 0, LIST_WIDTH, label_height), 'Item %d' % (i + 1)) for i in range(10)] for l in labels2: l.halign = ui.LEFT self.select_view = ui.SelectView(ui.Rect( self.task_button.frame.left, self.task_button.frame.bottom + MARGIN, LIST_WIDTH, label_height), labels2) self.select_view.on_selection_changed.connect(self.selection_changed) self.add_child(self.select_view) self.hslider = ui.SliderView(ui.Rect( self.select_view.frame.left, self.select_view.frame.bottom + MARGIN*2, 100, scrollbar_size), ui.HORIZONTAL, 0, 100) self.hslider.on_value_changed.connect(self.value_changed) self.add_child(self.hslider) self.vslider = ui.SliderView(ui.Rect( self.hslider.frame.right + SMALL_MARGIN, self.hslider.frame.centery, scrollbar_size, 100), ui.VERTICAL, 0, 100) self.vslider.on_value_changed.connect(self.value_changed) self.add_child(self.vslider) self.slider_value = ui.Label(ui.Rect( self.hslider.frame.centerx - 25, self.hslider.frame.bottom + MARGIN, 50, label_height), '') self.add_child(self.slider_value) self.spinner = ui.SpinnerView(ui.Rect( self.frame.right - MARGIN - ui.SpinnerView.size, self.frame.bottom - MARGIN - ui.SpinnerView.size, 0, 0)) self.add_child(self.spinner)
def createUI(self): w, h = gdata.scrnSize cols = 38 rows = 24 #was 23 dlgWidth = cols * 20 + 4 dlgHeight = rows * 20 + 4 self.win = ui.Window(self.app, modal=1, escKeyClose=1, movable=0, title=_('Select new task'), rect=ui.Rect((w - dlgWidth) / 2, (h - dlgHeight) / 2, dlgWidth, dlgHeight), layoutManager=ui.SimpleGridLM(), tabChange=True) self.win.subscribeAction('*', self) ui.Title(self.win, layout=(0, 0, 22, 1), text=_('Technology'), align=ui.ALIGN_W, font='normal-bold') ui.Listbox(self.win, layout=(0, 1, 22, 19), id='vTechs', columns=((_('Name'), 'text', 13, ui.ALIGN_W), (_('Lvl'), 'tLevel', 2, ui.ALIGN_E), (_('Constr'), 'tProd', 3, ui.ALIGN_E), (_('ETC'), 'tETC', 3, ui.ALIGN_E)), columnLabels=1, action='onSelectTech') # filter ui.Button(self.win, layout=(0, 20, 3, 1), text=_('Stucts'), toggle=1, id='vStructuresToggle', action='onToggleStructures') ui.Button(self.win, layout=(3, 20, 3, 1), text=_('Ships'), toggle=1, id='vShipsToggle', action='onToggleShips') ui.Button(self.win, layout=(6, 20, 3, 1), text=_('Misc'), toggle=1, id='vOtherToggle', action='onToggleOther') ui.Button(self.win, layout=(9, 20, 1, 1), text=_('1'), id='vLevel1', toggle=1, action='onToggleLevel', data=1) ui.Button(self.win, layout=(10, 20, 1, 1), text=_('2'), id='vLevel2', toggle=1, action='onToggleLevel', data=2) ui.Button(self.win, layout=(11, 20, 1, 1), text=_('3'), id='vLevel3', toggle=1, action='onToggleLevel', data=3) ui.Button(self.win, layout=(12, 20, 1, 1), text=_('4'), id='vLevel4', toggle=1, action='onToggleLevel', data=4) ui.Button(self.win, layout=(13, 20, 1, 1), text=_('5'), id='vLevel5', toggle=1, action='onToggleLevel', data=5) ui.Button(self.win, layout=(14, 20, 1, 1), text=_('6'), id='vLevel6', toggle=1, action='onToggleLevel', data=6) ui.Button(self.win, layout=(18, 20, 4, 1), text=_('Info'), action='onInfo', id='vInfo') # targets ui.Title(self.win, layout=(22, 0, 16, 1), text=_('Target planet'), align=ui.ALIGN_W, font='normal-bold') ui.Listbox(self.win, layout=(22, 1, 16, 10), id='vTargets', columns=((_('Planet'), 'text', 10, ui.ALIGN_W), (_('Owner'), 'plOwner', 5, ui.ALIGN_W)), columnLabels=1, action='onSelectPlanet') ui.Listbox(self.win, layout=(22, 11, 16, 7), id='vTSlots', columns=((_('Target slots'), 'text', 15, ui.ALIGN_W), ), columnLabels=1, action='onSelectSlot') # prod types ui.Check(self.win, layout=(0, 21, 6, 1), text=_('Bio production'), tags=['struct'], id='vBioProduction', checked=1, align=ui.ALIGN_W, action='onFilter') ui.Check(self.win, layout=(6, 21, 6, 1), text=_('En production'), tags=['struct'], id='vEnProduction', checked=1, align=ui.ALIGN_W, action='onFilter') ui.Check(self.win, layout=(12, 21, 6, 1), text=_('CP production'), tags=['struct'], id='vCPProduction', checked=1, align=ui.ALIGN_W, action='onFilter') ui.Check(self.win, layout=(18, 21, 6, 1), text=_('RP production'), tags=['struct'], id='vRPProduction', checked=1, align=ui.ALIGN_W, action='onFilter') ui.Check(self.win, layout=(24, 21, 6, 1), text=_('Military'), tags=['struct'], id='vMilitary', checked=1, align=ui.ALIGN_W, action='onFilter') ui.Check(self.win, layout=(30, 21, 6, 1), text=_('Morale'), tags=['struct'], id='vMorale', checked=1, align=ui.ALIGN_W, action='onFilter') # ship types ui.Check(self.win, layout=(0, 21, 6, 1), text=_('Small'), tags=['ship'], id='vSmall', checked=1, align=ui.ALIGN_W, action='onFilter') ui.Check(self.win, layout=(6, 21, 6, 1), text=_('Medium'), tags=['ship'], id='vMedium', checked=1, align=ui.ALIGN_W, action='onFilter') ui.Check(self.win, layout=(12, 21, 6, 1), text=_('Large'), tags=['ship'], id='vLarge', checked=1, align=ui.ALIGN_W, action='onFilter') ui.Check(self.win, layout=(18, 21, 6, 1), text=_('Civilian'), tags=['ship'], id='vCivShip', checked=1, align=ui.ALIGN_W, action='onFilter') ui.Check(self.win, layout=(24, 21, 6, 1), text=_('Military'), tags=['ship'], id='vMilShip', checked=1, align=ui.ALIGN_W, action='onFilter') # build ui.Title(self.win, layout=(22, 18, 16, 1), text=_('Options'), align=ui.ALIGN_W, font='normal-bold') ui.Label(self.win, layout=(22, 19, 10, 1), text=_('Quantity'), align=ui.ALIGN_W) ui.Entry(self.win, layout=(33, 19, 5, 1), id='vQuantity', align=ui.ALIGN_E, orderNo=1) ui.Check(self.win, layout=(31, 20, 7, 1), id='vReportFin', text=_('Report finalization')) ui.Title(self.win, layout=(0, 22, 28, 1), id='vStatusBar', align=ui.ALIGN_W) ui.TitleButton(self.win, layout=(28, 22, 5, 1), text=_('Cancel'), action='onCancel') ui.TitleButton(self.win, layout=(33, 22, 5, 1), text=_('Construct'), action='onConstruct')
def add_fullscreen_label(self, text): label = ui.Label(ui.Rect(0,0, window.rect.w, window.rect.h), text) self.add_child(label) return label
def createUI(self): w, h = gdata.scrnSize lw, lh = w / 20, h / 20 self.win = ui.Window( self.app, modal=1, decorated=0, alwaysInBackground=1, movable=0, rect=ui.Rect(0, 0, w, h), layoutManager=ui.SimpleGridLM(), ) self.win.subscribeAction('*', self) # map self.mapWidget = StarMapWidget(self.win, id='vStarMap', action='onSelectMapObj', layout=(0, 1, lw, lh - 2)) self.searchDlg.mapWidget = self.mapWidget self.win.callEventHandler = self.mapWidget self.mapWidget.callEventHandler = self # bottom ui.Label( self.win, id='vStatus', align=ui.ALIGN_W, layout=(0, lh - 1, lw - 16, 1), ) ui.Label( self.win, id='vTurn', align=ui.ALIGN_E, text='????.??', font='normal-bold', layout=(lw - 4, lh - 1, 4, 1), ) # top ui.Button(self.win, layout=(0, 0, 4, 1), text=_('Messages'), action='onMessages', id="vMessages") ui.Button(self.win, layout=(4, 0, 4, 1), text=_('Research'), action='onResearch') ui.Button(self.win, layout=(8, 0, 4, 1), text=_('Diplomacy'), id="vDiplomacy", action='onDiplomacy', enabled=0) ui.Button(self.win, layout=(12, 0, 4, 1), text=_('Constr'), id="vConstruction", action='onConstruction', enabled=0) ui.Button(self.win, layout=(16, 0, 4, 1), text=_('Planets'), id="vPlanetsMenu", action='onPlanetsMenu', enabled=1) ui.Button(self.win, layout=(20, 0, 4, 1), text=_('Fleets'), id="vFleetsMenu", action='onFleetsMenu', enabled=1) ui.Button(self.win, layout=(24, 0, 4, 1), text=_('Overview'), id="vOverview", action='onOverview', enabled=1) ui.Title(self.win, layout=(28, 0, lw - 37, 1)) ui.Button(self.win, layout=(lw - 9, 0, 4, 1), text=_('Problems'), action='onProblems') ui.Button(self.win, layout=(lw - 5, 0, 5, 1), text=_('Menu'), action='onMenu') self.app.statusBar = self.win.vStatus self.app.setStatus(_('Ready.')) # system menu self.systemMenu = ui.Menu( self.app, title=_("Menu"), width=5, items=[ ui.Item(_("Find system"), action="onSearch", hotkey=u'\x66'), # F ui.Item(_("Statistics"), action="onStats", hotkey=u'\x73'), # S ui.Item(_("Save View"), action="onSaveView", hotkey=u'\x76'), # V ui.Item(_("Save Starmap"), action="onSaveStarmap"), ui.Item(_("Options"), action="onOptions", hotkey=u'\x6F'), # O ui.Item(_("--------"), enabled=False), ui.Item( _("Finish galaxy"), action="galaxyFinishButton", enabled=False, data=True ), # no hotkey; if this position moved, you need to update finishGalaxy's "self.systemMenu.items" lines to reference new index position ui.Item(_("Resign"), action="onResign"), # no hotkey ui.Item(_("--------"), enabled=False), ui.Item(_("Exit"), action="onExit", hotkey=u'\x71'), # Q (also directly CTRL+F12) ]) self.systemMenu.subscribeAction("*", self) self.systemFleetMenu = ui.Menu( self.app, title=_("Fleets"), width=4, items=[ ui.Item(_("Fleet List"), action="onFleets", hotkey=u'\x66'), # F ui.Item(_("Analysis"), action="onFleetAnalysis", hotkey=u'\x61'), # A ]) self.systemFleetMenu.subscribeAction("*", self) self.systemPlanetMenu = ui.Menu( self.app, title=_("Planets"), width=5, items=[ ui.Item(_("Planet List"), action="onPlanets", hotkey=u'\x70'), # P ui.Item(_("System List"), action="onSystems", hotkey=u'\x73'), # S ui.Item(_("Global queues"), action="onGlobalQueues"), ui.Item(_("Analysis"), action="onPlanetAnalysis", hotkey=u'\x61'), #A ]) self.systemPlanetMenu.subscribeAction("*", self)
def createUI(self): w, h = gdata.scrnSize self.win = ui.Window(self.app, modal = 1, movable = 0, title = _('Select, which galaxy types do you want to play'), rect = ui.Rect((w - 564) / 2, (h - 404) / 2, 564, 404), layoutManager = ui.SimpleGridLM(), tabChange = True ) ui.Listbox(self.win, layout = (0, 0, 28, 7), id = 'vBookingPublic', sortedBy = ('text', 1), columns = ( ('', 'tChoice', 1, ui.ALIGN_NONE), (_('Galaxy type'), 'text', 6, ui.ALIGN_NONE), (_('Scenario'), 'tScenario', 6, ui.ALIGN_NONE), (_('Queue'), 'tCur', 3, ui.ALIGN_NONE), (_('Capacity'), 'tPos', 3, ui.ALIGN_NONE), (_('Last start'), 'tTime', 8, ui.ALIGN_E) ), columnLabels = 1, action = 'onSelect', ) ui.Listbox(self.win, layout = (0, 0, 28, 7), id = 'vBookingPrivate', sortedBy = ('tOwner', 1), columns = ( ('', 'tChoice', 1, ui.ALIGN_NONE), (_('Galaxy type'), 'text', 6, ui.ALIGN_NONE), (_('Scenario'), 'tScenario', 6, ui.ALIGN_NONE), (_('Queue'), 'tCur', 3, ui.ALIGN_NONE), (_('Capacity'), 'tPos', 3, ui.ALIGN_NONE), (_('Owner'), 'tOwner', 8, ui.ALIGN_E) ), columnLabels = 1, action = 'onSelect', ) self.win.subscribeAction('*', self) ui.Button(self.win, layout = (0, 7, 8, 1), id = "vPublicToggle", text = _('Show personal bookings'), action = 'onPublicToggle', tooltipTitle = _("Booking types"), tooltip = _("Public Bookings\nPublic bookings are recommended way how to jump into new game.\nWhen queue is full, galaxy creation is triggered, and you can start adventure with group of strangers.\n\nPrivate Bookings\nPrivate bookings are the way to start game with group of your friends.\nEvery private booking requires password chosen by the owner.\nSingle player games cannot be privately booked (as they are private by definition).") ) ui.Button(self.win, layout = (20, 7, 8, 1), id = "vCreatePrivate", text = _('Create private booking'), action = 'onCreatePrivate', tooltipTitle = _("Create Private Booking"), tooltip = _("Private bookings are way how to create games for group of friends.\n\ Every booking has to be created password protected, so you have to tell others\n\ what the password is.\n\n\ Account has limit of {0} private bookings at the time. Created galaxies\n\ no longers counts into the limit.".format(Const.BOOKING_PRIVATE_LIMIT)) ) ui.Button(self.win, layout = (20, 7, 8, 1), id = "vDeletePrivate", text = _('Delete private booking'), action = 'onDeletePrivate', tooltipTitle = _("Delete Private Booking"), tooltip = _("As the author of the booking, you can delete it at any time. No further warning will be issued.") ) ui.Button(self.win, layout = (7, 8.5, 14, 1.5), id = "vToggle", text = _('Toggle booking'), action = 'onToggleBooking') scrollBarInfo = ui.Scrollbar(self.win, layout = (27, 10.3, 1, 4.7)) textBox = ui.Text(self.win, layout = (9, 10.3, 18, 4.7), id = "vInfo", editable = 0) textBox.attachVScrollbar(scrollBarInfo) ui.Button(self.win, layout = (0.5, 10.5, 8, 1), id = "vGoalToggle", text = _('Display Goals'), action = 'onGoalToggle') ui.Label(self.win, layout = (0, 12, 4, 1), text = _("Planets:"), align = ui.ALIGN_W, tooltipTitle = _("Planets"), tooltip = _("Range of number of planets. About half of them is not colonizable at the beginning.") ) ui.Label(self.win, layout = (4, 12, 4.5, 1), id = "vPlanets", align = ui.ALIGN_E, tooltipTitle = _("Planets"), tooltip = _("Range of number of planets. About half of them is not colonizable at the beginning.") ) ui.Label(self.win, layout = (0, 13, 4, 1), text = _("Radius:"), align = ui.ALIGN_W, tooltipTitle = _("Radius"), tooltip = _("Galaxy radius, implies speed of game.") ) ui.Label(self.win, layout = (4, 13, 4.5, 1), id = "vRadius", align = ui.ALIGN_E, tooltipTitle = _("Radius"), tooltip = _("Galaxy radius, implies speed of game.") ) ui.Label(self.win, layout = (0, 14, 4, 1), text = _("Grouping:"), align = ui.ALIGN_W, tooltipTitle = _("Grouping"), tooltip = _("How many starting positions are grouped together in vicinity.") ) ui.Label(self.win, layout = (4, 14, 4.5, 1), id = "vPlayerGroup", align = ui.ALIGN_E, tooltipTitle = _("Grouping"), tooltip = _("How many starting positions are grouped together.") ) ui.Label(self.win, layout = (0, 15.2, 4, 1), text = _("Resources:"), align = ui.ALIGN_W) ui.Text (self.win, layout = (4, 15.2, 23, 1.6), id = "vResources", editable = 0) ui.Label(self.win, layout = (0, 17, 4, 1), text = _("Challenges:"), align = ui.ALIGN_W) ui.Label(self.win, layout = (4, 17, 24, 1), id = "vChallenges", align = ui.ALIGN_W) ui.Title(self.win, layout = (0, 18, 24, 1), id = 'vStatusBar', align = ui.ALIGN_W) ui.TitleButton(self.win, layout = (24, 18, 4, 1), text = _('Exit'), action = 'onCancel') self.win.statusBar = self.win.vStatusBar