Beispiel #1
0
            ui.Item('Nine', size=9)
        ],
        columns=[('Name', 'text', 6, 0), ('Size', 'size', 6, ui.F_EDITABLE)],
        layout=(8, 13, 12, 7),
        columnLabels=1,
    ).subscribeAction('*', echoHandler)

    items = []
    for i in xrange(0, 100):
        items.append(
            ui.Item(str(i),
                    tooltip='This is a tooltip',
                    statustip='This is a statustip'))
    ui.ButtonArray(
        win,
        items=items,
        layout=(20, 13, 9, 6),
        buttonSize=(2, 2),
    )
    ui.Title(win,
             text='This is a title',
             align=ui.ALIGN_W,
             layout=(8, 12, 12, 1))
    pBar = ui.ProgressBar(win, layout=(0, 20, 10, 1))
    progBars.append(pBar)
    scrlbar = ui.Scrollbar(win, layout=(28, 0, 1, 10))
    text = ui.Text(
        win,
        layout=(20, 0, 8, 10),
        text=[
            'This is a very looooong text which will be displayed in that text widget.',
            'And one more long line to show.', 'And another one.',
Beispiel #2
0
    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
     self.win = ui.Window(
         self.app,
         modal=1,
         escKeyClose=1,
         movable=0,
         title=_('Global production queues'),
         rect=ui.Rect((w - 400 - 4) / 2, (h - 440 - 4) / 2, 400 + 4,
                      420 + 4),
         layoutManager=ui.SimpleGridLM(),
     )
     self.win.subscribeAction('*', self)
     ui.Title(self.win,
              layout=(0, 0, 20, 1),
              text=_('Default global queue'),
              align=ui.ALIGN_W,
              font='normal-bold')
     ui.ButtonArray(self.win,
                    layout=(0, 1, 20, 2),
                    id='vPQueue0',
                    buttonSize=(2, 2),
                    showSlider=0,
                    tags=['pl'],
                    action='onQueueItemSelected',
                    orderNo=0)
     ui.Title(self.win,
              layout=(0, 3, 20, 1),
              text=_('Queue \"{0}\"'.format(res.globalQueueName(1))),
              align=ui.ALIGN_W,
              font='normal-bold')
     ui.ButtonArray(self.win,
                    layout=(0, 4, 20, 2),
                    id='vPQueue1',
                    buttonSize=(2, 2),
                    showSlider=0,
                    tags=['pl'],
                    action='onQueueItemSelected',
                    orderNo=1)
     ui.Title(self.win,
              layout=(0, 6, 20, 1),
              text=_('Queue \"{0}\"'.format(res.globalQueueName(2))),
              align=ui.ALIGN_W,
              font='normal-bold')
     ui.ButtonArray(self.win,
                    layout=(0, 7, 20, 2),
                    id='vPQueue2',
                    buttonSize=(2, 2),
                    showSlider=0,
                    tags=['pl'],
                    action='onQueueItemSelected',
                    orderNo=2)
     ui.Title(self.win,
              layout=(0, 9, 20, 1),
              text=_('Queue \"{0}\"'.format(res.globalQueueName(3))),
              align=ui.ALIGN_W,
              font='normal-bold')
     ui.ButtonArray(self.win,
                    layout=(0, 10, 20, 2),
                    id='vPQueue3',
                    buttonSize=(2, 2),
                    showSlider=0,
                    tags=['pl'],
                    action='onQueueItemSelected',
                    orderNo=3)
     ui.Title(self.win,
              layout=(0, 12, 20, 1),
              text=_('Queue \"{0}\"'.format(res.globalQueueName(4))),
              align=ui.ALIGN_W,
              font='normal-bold')
     ui.ButtonArray(self.win,
                    layout=(0, 13, 20, 2),
                    id='vPQueue4',
                    buttonSize=(2, 2),
                    showSlider=0,
                    tags=['pl'],
                    action='onQueueItemSelected',
                    orderNo=4)
     ui.Label(self.win,
              layout=(0, 16, 20, 1),
              id='vTaskName',
              align=ui.ALIGN_W,
              font='normal-bold',
              tags=['queue', 'data'])
     ui.Label(self.win,
              layout=(9, 17, 7, 1),
              text=_('Construction pts'),
              align=ui.ALIGN_W,
              tags=['queue'])
     ui.Label(self.win,
              layout=(16, 17, 4, 1),
              id='vTaskConstPoints',
              align=ui.ALIGN_E,
              tags=['queue', 'data'])
     ui.Label(self.win,
              layout=(0, 17, 5, 1),
              text=_('Quantity'),
              align=ui.ALIGN_W,
              tags=['queue'])
     ui.Label(self.win,
              layout=(5, 17, 3, 1),
              id='vTaskQuantity',
              align=ui.ALIGN_E,
              tags=['queue', 'data'])
     ui.Button(self.win,
               layout=(0, 18, 2, 1),
               id='vITFirst',
               text=_('<<'),
               tags=['queue'],
               action='onMoveTaskFirstLast',
               tooltipTitle=_('Move task to first position in queue'),
               data=-1)
     ui.Button(self.win,
               layout=(2, 18, 2, 1),
               id='vITPrev',
               text=_('<'),
               tags=['queue'],
               action='onMoveTask',
               data=-1,
               tooltipTitle=_('Move task to previous position in queue'))
     ui.Button(self.win,
               layout=(4, 18, 2, 1),
               id='vITNext',
               text=_('>'),
               tags=['queue'],
               action='onMoveTask',
               data=1,
               tooltipTitle=_('Move task to next position in queue'))
     ui.Button(self.win,
               layout=(6, 18, 2, 1),
               id='vITLast',
               text=_('>>'),
               tags=['queue'],
               action='onMoveTaskFirstLast',
               tooltipTitle=_('Move task to last position in queue'),
               data=1)
     ui.Button(self.win,
               layout=(8, 18, 4, 1),
               text=_('Quantity'),
               tags=['queue'],
               action='onQtyTask',
               tooltipTitle=_('Change task quantity'))
     ui.Button(self.win,
               layout=(12, 18, 4, 1),
               text=_('Info'),
               id="vITInfo",
               tags=['queue'],
               action='onTaskInfo',
               tooltipTitle=_('Show task informations'))
     ui.Button(self.win,
               layout=(16, 18, 4, 1),
               text=_('Abort'),
               tags=['queue'],
               action='onAbortTask',
               tooltipTitle=_('Abort task construction'))
     # status bar + submit/cancel
     ui.TitleButton(self.win,
                    layout=(15, 19, 5, 1),
                    text=_('Close'),
                    action='onClose')
     ui.Title(self.win,
              id='vStatusBar',
              layout=(0, 19, 15, 1),
              align=ui.ALIGN_W)