def createUI(self): w, h = gdata.scrnSize self.win = ui.Window( self.app, title=_('Unhandled exception'), modal=1, escKeyClose=1, movable=0, rect=ui.Rect((w - 724) / 2, (h - 443) / 2, 724, 443), layoutManager=ui.SimpleGridLM(), ) self.win.subscribeAction('*', self) s = ui.Scrollbar(self.win, layout=(35, 0, 1, 20)) t = ui.Text(self.win, layout=(0, 0, 35, 20), id="vText") t.attachVScrollbar(s) ui.Button(self.win, layout=(0, 20, 9, 1), text=_('Continue'), action='onContinue') ui.Button(self.win, layout=(9, 20, 9, 1), text=_('Close Application'), action='onClose') ui.Button(self.win, layout=(18, 20, 9, 1), text=_('Abort Application'), action='onAbort') ui.Button(self.win, layout=(27, 20, 9, 1), text=_('Send to server'), action='onSend', id='vSend', enabled=0)
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 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, escKeyClose = 1, titleOnly = w == 800 and h == 600, movable = 0, title = _("Messages and events"), 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) # forums ui.Listbox(self.win, layout = (0, 0, 10, 27), id = "vForums", columns = ((_("Channel"), "text", 5.5, ui.ALIGN_W), (_("#"), "tMsgs", 4.5, ui.ALIGN_E)), columnLabels = 1, action = "onForumSelected", sortable = 0) # topics ui.Listbox(self.win, layout = (10, 0, 30, 15), id = "vMessages", columns = ( (_(" "), "tState", 1, ui.ALIGN_NONE), (_("Date"), "tDate", 4, ui.ALIGN_W), (_("Sender"), "tSender", 7, ui.ALIGN_W), (_("Subject"), "text", 0, ui.ALIGN_W), ), columnLabels = 1, action = "onMessageSelected", rmbAction = "onPostMenu") # messages ui.Title(self.win, layout = (10, 15, 5, 1), font = "normal-bold", align = ui.ALIGN_W) ui.Button(self.win, layout = (15, 15, 5, 1), text = _("New subject"), action = "onNewTopic", id = "vNewTopic", enabled = 0) ui.Button(self.win, layout = (20, 15, 5, 1), text = _("Reply"), action = "onReply", id = "vReply", enabled = 0) ui.Button(self.win, layout = (25, 15, 5, 1), text = _("Read all"), action = "onAllReaded", id = "vAllReaded", enabled = 0) ui.Button(self.win, layout = (30, 15, 5, 1), text = _("Delete"), action = "onDelete", id = "vDelete", enabled = 0) ui.Button(self.win, layout = (35, 15, 5, 1), text = _("Delete all"), action = "onDeleteAll", id = "vDeleteAll", enabled = 0) s = ui.Scrollbar(self.win, layout = (39, 16, 1, 11)) t = ui.Text(self.win, layout = (10, 16, 29, 11), id = "vMessage", editable = 0) t.attachVScrollbar(s) # status bar ui.TitleButton(self.win, layout = (30, 27, 5, 1), text = _('Refresh'), action = 'onRefresh') ui.TitleButton(self.win, layout = (35, 27, 5, 1), text = _('Close'), action = 'onClose') ui.Title(self.win, id = 'vStatusBar', layout = (0, 27, 30, 1), align = ui.ALIGN_W) #@self.win.statusBar = self.win.vStatusBar # event menu self.eventPopup = ui.Menu(self.app, title = _("Message actions"), items = [ ui.Item(_("Show location"), action = "onShowLoc"), ui.Item(_("Show source"), action = "onShowSource"), ui.Item(_("Show location and delete msg"), action = "onShowLocDel"), ui.Item(_("Show source and delete msg"), action = "onShowSourceDel"), ui.Item(_("Delete"), action = "onDelete"), ] ) self.eventPopup.subscribeAction("*", self)
def createUI(self): screenWidth, screenHeight = gdata.scrnSize # size of dialog in layout metrics (for SimpleGridLM) cols = 20 rows = 24 # 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=_("Fleet Details"), rect=ui.Rect((screenWidth - width) / 2, (screenHeight - height) / 2, width, height), layoutManager=ui.SimpleGridLM(), ) self.win.subscribeAction('*', self) # playets listbox ui.Listbox(self.win, layout=(0, 0, cols, rows - 3), id='vClassData', columns=[(_('Class'), 'text', 8, ui.ALIGN_W), (_('Small'), 'tSm', 4, ui.ALIGN_E), (_('Medium'), 'tMed', 4, ui.ALIGN_E), (_('Large'), 'tLg', 4, ui.ALIGN_E)], columnLabels=1, sortable=0) ui.Button(self.win, layout=(0, rows - 3, 10, 1), text=_('Use Dmg Inheritance'), id="vInherit", toggle=1, action="onToggleCondition", data="showInheritance") ui.Button(self.win, layout=(10, rows - 3, 10, 1), text=_('Use Max HPs'), id="vMaxHP", toggle=1, action="onToggleCondition", data="showMaxHPs") # status bar + submit/cancel ui.TitleButton(self.win, layout=(cols - 5, rows - 2, 5, 1), text=_('Close'), action='onClose') ui.Title(self.win, id='vStatusBar', layout=(0, rows - 2, cols - 5, 1), align=ui.ALIGN_W)
class PiTft(ui.Scene): def __init__(self): ui.Scene.__init__(self) #Double-click button self.motor_button = ui.Button(ui.Rect(MARGIN, MARGIN, 130, 90), 'DOUBLE') self.motor_button.on_clicked.connect(self.gpi_button) self.add_child(self.motor_button) #Single-click button self.pmd_button = ui.Button(ui.Rect(170, MARGIN, 130, 90), 'SINGLE') self.pmd_button.on_clicked.connect(self.gpi_button) self.add_child(self.pmd_button) #Back button self.back_button = ui.Button(ui.Rect(MARGIN, 130, 130, 90), '<--') self.back_button.on_clicked.connect(self.gpi_button) self.add_child(self.back_button) #Play button self.play_button = ui.Button(ui.Rect(170, 130, 130, 90), 'PLAY') self.play_button.on_clicked.connect(self.gpi_button) self.add_child(self.play_button) #Haptic effects effects = (5, 25, 35, 36) current_effect = effect[0] def gpi_button(self, btn, mbtn): logger.info(btn.text) if btn.text == 'DOUBLE': #print("double click") if current_effect in [5, 25, 35]: current_effect = effects[3] elif current_effect in [5, 25, 36]: current_effect = effects[2] drv.drv_effect_run(current_effect) elif btn.text == 'SINGLE': #print("single click") if current_effect in [5, 35, 36]: current_effect = effects[1] elif current_effect in [25, 35, 36]: current_effect = effects[0] drv.drv_effect_run(current_effect) elif btn.text == '<--': #print("BACK") drv.drv_effect_run(effects[0]) pygame.quit() elif btn.text == 'PLAY': #print("PLAY") drv.drv_effect_run(current_effect)
def createUI(self): w, h = gdata.scrnSize self.win = ui.Window(self.app, modal=1, movable=0, title=_('Select gaming session'), rect=ui.Rect((w - 564) / 2, (h - 264) / 2, 564, 264), layoutManager=ui.SimpleGridLM(), tabChange=True) ui.Listbox(self.win, layout=(0, 0, 28, 10), id='vPos', columns=((_('Type'), 'type', 4, ui.ALIGN_W), (_('Galaxy'), 'text', 8, ui.ALIGN_W), (_('Position'), 'tPos', 0, ui.ALIGN_W)), action='onListSelect', columnLabels=1) self.win.subscribeAction('*', self) ui.Button( self.win, layout=(20, 10, 8, 1), text=_('Book New Game'), action='onBooking', tooltipTitle=_("New galaxy"), tooltip= _("Allows you to either start new single player galaxy, or get in a queue for\ngame with other players. That game will start when queue fills the capacity,\nand will show up in this dialog as active.\n\nYou can queue for multiple galaxies. Only single player games has account limit." )) ui.Button( self.win, layout=(0, 10, 8, 1), id='vToggle', text=_('Show Open Slots'), action='onToggleNew', tooltipTitle=_("Open slots"), tooltip= _("Slots available in already running galaxies, there is no telling\nwhat state the game or the empire is in." )) ui.Title(self.win, layout=(0, 11, 20, 1), id='vStatusBar', align=ui.ALIGN_W) ui.TitleButton(self.win, layout=(20, 11, 4, 1), text=_('Exit'), action='onCancel') ui.TitleButton(self.win, layout=(24, 11, 4, 1), text=_('Select'), action='onSelect') self.win.statusBar = self.win.vStatusBar
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 __init__(self): ui.Scene.__init__(self) self.sceneId = 2 self.greet_button = ui.Button(ui.Rect(140, 110, 40, 20), 'back') self.greet_button.on_clicked.connect(self.greet) self.add_child(self.greet_button)
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=_('Systems Overview'), 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) # playets listbox ui.Listbox(self.win, layout=(0, 0, 40, 26), id='vPlanets', columns=[(_('System'), 'text', 5.75, ui.ALIGN_W), (_('# Pl'), 'tSyPnum', 2, ui.ALIGN_E), (_('Mine'), 'tSyPYnum', 2, ui.ALIGN_E), (_('Other'), 'tSyPTnum', 2, ui.ALIGN_E), (_('Biomatter'), 'tSyBioRes', 3, ui.ALIGN_E), (_('Bio+-'), 'tSyBio', 2, ui.ALIGN_E), (_('En'), 'tSyEnRes', 3, ui.ALIGN_E), (_('En+-'), 'tSyEn', 2, ui.ALIGN_E), (_('%Fuel'), 'tSyRefuel', 2.25, ui.ALIGN_E), (_('%Max'), 'tSyRefuelMax', 2.25, ui.ALIGN_E), (_('%Repair'), 'tSyRepair', 3, ui.ALIGN_E), (_('Upgrade'), 'tSyUpgrade', 3, ui.ALIGN_E), (_('+Gate %'), 'tSyGate', 3, ui.ALIGN_E), (_('Strat Res'), 'tStRes', 3.75, ui.ALIGN_E)], columnLabels=1, action='onSelectSystem', rmbAction="onShowLocation") ui.Button(self.win, layout=(0, 26, 5, 1), text=_('My Systems'), id="vMine", toggle=1, action="onToggleCondition", data="showMine") ui.Button(self.win, layout=(5, 26, 5, 1), text=_('Other Cmdrs'), id="vOtherPlayers", toggle=1, action="onToggleCondition", data="showOtherPlayers") ui.Button(self.win, layout=(10, 26, 5, 1), text=_('Colonizable'), id="vColonizable", toggle=1, action="onToggleCondition", data="showColonizable") ui.Button(self.win, layout=(15, 26, 5, 1), text=_('Uncolonizable'), id="vUncolonizable", toggle=1, action="onToggleCondition", data="showUncolonizable") ui.Button(self.win, layout=(20, 26, 5, 1), text=_('Show Problems'), id="vProblems", toggle=1, action="onToggleCondition", data="showProblems") # 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 __init__(self): ui.Scene.__init__(self) self.one_button = ui.Button(ui.Rect(MARGIN, MARGIN, 130, 90), '1') self.one_button.on_clicked.connect(self.print_button) self.add_child(self.one_button) self.two_button = ui.Button(ui.Rect(170, MARGIN, 130, 90), '2') self.two_button.on_clicked.connect(self.print_button) self.add_child(self.two_button) self.three_button = ui.Button(ui.Rect(MARGIN, 130, 130, 90), '3') self.three_button.on_clicked.connect(self.print_button) self.add_child(self.three_button) self.four_button = ui.Button(ui.Rect(170, 130, 130, 90), '4') self.four_button.on_clicked.connect(self.print_button) self.add_child(self.four_button)
def __init__(self): ui.Scene.__init__(self) self.on17_button = ui.Button(ui.Rect(MARGIN, MARGIN, 130, 90), 'Next') 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, 90), 'red') self.on4_button.on_clicked.connect(self.gpi_button) self.add_child(self.on4_button) self.off17_button = ui.Button(ui.Rect(MARGIN, 130, 130, 90), 'green') self.off17_button.on_clicked.connect(self.gpi_button) self.add_child(self.off17_button) self.off4_button = ui.Button(ui.Rect(170, 130, 130, 90), 'off') self.off4_button.on_clicked.connect(self.gpi_button) self.add_child(self.off4_button) logger.info("Finished Init")
def __init__(self, a, b, c, d, e): ui.Scene.__init__(self) self.callback = e self.off_button = ui.Button(ui.Rect(MARGIN, MARGIN, 130, 90), a) self.off_button.on_clicked.connect(self.gpi_button) self.add_child(self.off_button) self.quit_button = ui.Button(ui.Rect(170, MARGIN, 130, 90), b) self.quit_button.on_clicked.connect(self.gpi_button) self.add_child(self.quit_button) self.x_button = ui.Button(ui.Rect(MARGIN, 130, 130, 90), c) self.x_button.on_clicked.connect(self.gpi_button) self.add_child(self.x_button) self.menu_button = ui.Button(ui.Rect(170, 130, 130, 90), d) self.menu_button.on_clicked.connect(self.gpi_button) self.add_child(self.menu_button)
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=_('Planets Overview'), 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) # playets listbox ui.Listbox(self.win, layout=(0, 0, 40, 26), id='vPlanets', columns=[(_('Planet'), 'text', 6, ui.ALIGN_W), (_('Type'), 'tPlType', 3.5, ui.ALIGN_W), (_('Env'), 'tPlBio', 1.5, ui.ALIGN_E), (_('Min'), 'tPlMin', 1.5, ui.ALIGN_E), (_('En'), 'tPlEn', 1.5, ui.ALIGN_E), (_('Bio+-'), 'tChangeBio', 2.0, ui.ALIGN_E), (_('En+-'), 'tChangeEn', 2.0, ui.ALIGN_E), (_('Free'), 'tFree', 2.0, ui.ALIGN_E), (_('Sl.'), 'tSpace', 1.5, ui.ALIGN_E), (_('D.'), 'tDiam', 1.5, ui.ALIGN_E), (_('Mrl'), 'tMorale', 2, ui.ALIGN_E), (_('CP'), 'tProd', 2, ui.ALIGN_E), (_('RP'), 'tSci', 2, ui.ALIGN_E), (_('ETC'), 'tETC', 2.5, ui.ALIGN_E), (_('Tot.ETC'), 'tTotalETC', 2.5, ui.ALIGN_E), (_('Constructing'), 'tConstrInfo', 7.0, ui.ALIGN_W)], columnLabels=1, action='onSelectPlanet', rmbAction="onShowLocation") ui.Button(self.win, layout=(0, 26, 5, 1), text=_('My planets'), id="vMine", toggle=1, action="onToggleCondition", data="showMine") ui.Button(self.win, layout=(5, 26, 5, 1), text=_('Other cmdrs'), id="vOtherPlayers", toggle=1, action="onToggleCondition", data="showOtherPlayers") ui.Button(self.win, layout=(10, 26, 5, 1), text=_('Colonizable'), id="vColonizable", toggle=1, action="onToggleCondition", data="showColonizable") ui.Button(self.win, layout=(15, 26, 5, 1), text=_('Uncolonizable'), id="vUncolonizable", toggle=1, action="onToggleCondition", data="showUncolonizable") # 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 __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 __init__(self): ui.Scene.__init__(self) LEFT = 5 TOP = 5 COUNT = 0 for switch in GetDevices(): if "..." not in switch['name']: COUNT += 1 LEFT = LEFT + 35 if COUNT > 8: TOP = TOP + 320 LEFT = 40 relays[switch['name']] = Relay(switch['name'], switch['id'], switch['state']) self.buttonas = ui.Button(ui.Rect(TOP, LEFT, 300, 30), switch['name']) if switch['state'] == 0: logger.info(switch['name'] + ' yra ijungtas') self.buttonas.background_color = ( 64, 64, 62 ) # FIXME, does not change the color as necesarry self.buttonas.on_clicked.connect(self.gpi_button) self.add_child(self.buttonas)
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 = _('Split Fleet'), 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) # tech data ui.Title(self.win, layout = (0, 0, 18, 1), text = _('Data'), align = ui.ALIGN_W, font = 'normal-bold') ui.Listbox(self.win, layout = (0, 1, 18, 25), id = 'vData', columns = ((_('Property'), 'text', 11, ui.ALIGN_W), (_('Value'), 'tValue', 7, ui.ALIGN_E)), columnLabels = 0) ui.Button(self.win, layout = (1, 26, 4, 1), text = _('Structure'), id = 'vStruct', toggle = 1, action = 'onShowType', data = V_STRUCT) ui.Button(self.win, layout = (5, 26, 4, 1), text = _('Ship Hull'), id = 'vHull', toggle = 1, action = 'onShowType', data = V_HULL) ui.Button(self.win, layout = (9, 26, 4, 1), text = _('Ship Eq.'), id = 'vSEquip', toggle = 1, action = 'onShowType', data = V_SEQUIP) ui.Button(self.win, layout = (13, 26, 4, 1), text = _('Project'), id = 'vProject', toggle = 1, action = 'onShowType', data = V_PROJECT) ui.Button(self.win, layout = (17, 26, 1, 1), text = '', id = 'vEmpty1', toggle = 0) ui.Button(self.win, layout = (0, 26, 1, 1), text = '', id = 'vEmpty2', toggle = 0) # text field ui.Title(self.win, layout = (18, 0, 22, 1), text = _('Description'), align = ui.ALIGN_W, font = 'normal-bold') s = ui.Scrollbar(self.win, layout = (39, 1, 1, 26)) t = ui.Text(self.win, layout = (18, 1, 21, 26), id = 'vDescr', editable = 0) t.attachVScrollbar(s) # 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 __init__(self): ui.Scene.__init__(self) label_height = ui.theme.current.label_height scrollbar_size = ui.SCROLLBAR_SIZE self.controller = SwitchController(self) # Light Color Buttons self.day_button = ui.Button( ui.Rect(MARGIN, 88, BUTTON_WIDTH, BUTTON_HEIGHT), 'Day') self.day_button.on_clicked.connect(self.controller.day) self.add_child(self.day_button) self.night_button = ui.Button( ui.Rect((MARGIN) + 120, 88, BUTTON_WIDTH, BUTTON_HEIGHT), 'Night') self.night_button.on_clicked.connect(self.controller.night) self.add_child(self.night_button) self.theater_button = ui.Button( ui.Rect(MARGIN, (MARGIN) + 60 + 88, BUTTON_WIDTH, BUTTON_HEIGHT), 'Theater') self.theater_button.on_clicked.connect(self.controller.theater) self.add_child(self.theater_button) self.chill_button = ui.Button( ui.Rect((MARGIN) + 120, (MARGIN) + 60 + 88, BUTTON_WIDTH, BUTTON_HEIGHT), 'Chill') self.chill_button.on_clicked.connect(self.controller.chill) self.add_child(self.chill_button) # Power Button self.power_button = ui.Button(ui.Rect(MARGIN, MARGIN, 80, 60), "Power") self.power_button.on_clicked.connect(self.controller.power) self.add_child(self.power_button) # Brightness Buttons self.brightness_up_button = ui.Button( ui.Rect(self.chill_button.frame.right + 2 * MARGIN, self.night_button.frame.top, BUTTON_HEIGHT, BUTTON_HEIGHT), '+') self.brightness_up_button.on_clicked.connect( self.controller.brightness_up) self.add_child(self.brightness_up_button) self.brightness_down_button = ui.Button( ui.Rect(self.chill_button.frame.right + 2 * MARGIN, self.chill_button.frame.top, BUTTON_HEIGHT, BUTTON_HEIGHT), '-') self.brightness_down_button.on_clicked.connect( self.controller.brightness_down) self.add_child(self.brightness_down_button) # Light Enabled Checkboxes self.enabled_box = ui.Checkbox( ui.Rect(self.power_button.frame.right + 15, 3 * MARGIN, 20, 40), "1") self.add_child(self.enabled_box) self.enabled_box.on_checked.connect(self.controller.toggle_light0) self.enabled_box.on_unchecked.connect(self.controller.toggle_light0) self.enabled_box.stylize() self.enabled_box1 = ui.Checkbox( ui.Rect(self.enabled_box.frame.right + 15, 3 * MARGIN, 20, 40), "2") self.add_child(self.enabled_box1) self.enabled_box1.on_checked.connect(self.controller.toggle_light1) self.enabled_box1.on_unchecked.connect(self.controller.toggle_light1) self.enabled_box1.stylize() self.enabled_box2 = ui.Checkbox( ui.Rect(self.enabled_box1.frame.right + 15, 3 * MARGIN, 20, 40), "3") self.add_child(self.enabled_box2) self.enabled_box2.on_checked.connect(self.controller.toggle_light2) self.enabled_box2.on_unchecked.connect(self.controller.toggle_light2) self.enabled_box2.stylize() self.checkboxes = [ self.enabled_box, self.enabled_box1, self.enabled_box2 ] self.controller.initialize_checkboxes()
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 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)
win.idButton.text = 'Oh, thank you' win.idButton.tooltip = 'Press ESC to quit.' win.idButton.action = 'action1' ui.SkinableTheme.setSkin("../OSSkin") 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)
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 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 = 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 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 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