示例#1
0
	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"))
示例#2
0
 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)
示例#3
0
        align=ui.ALIGN_W,
        tooltip='This is a status bar which contains reports about...',
        layout=(0, 7, 6, 1),
    )
    app.statusBar = statusBar
    ui.Entry(
        win,
        align=ui.ALIGN_W,
        tooltip='Enter anything you like.',
        layout=(0, 8, 4, 1),
    ).subscribeAction('*', echoHandler)
    x = 0
    for align in (ui.ALIGN_N, ui.ALIGN_S, ui.ALIGN_E, ui.ALIGN_W):
        ui.ArrowButton(
            win,
            direction=align,
            layout=(x, 9, 1, 1),
        )
        x += 1
    slider = ui.ScrollSlider(win, shown=50, layout=(0, 10, 8, 1))
    ui.ScrollSlider(win, shown=10, layout=(0, 11, 8, 1))
    ui.ScrollSlider(win, shown=10, layout=(7, 0, 1, 10))
    ui.Scrollbar(win, layout=(0, 12, 8, 1)).subscribeAction('*', echoHandler)
    ui.Scrollbar(win, layout=(6, 0, 1, 10)).subscribeAction('*', echoHandler)

    for x in xrange(8, 20, 2):
        for y in xrange(0, 10):
            ui.Button(win,
                      text='%d,%d' % (x, y),
                      layout=(x, y, 2, 1),
                      font='small',