def __init__(self): ui.Scene.__init__(self) self.add_child(ui.Label(ui.Rect(0,0,320,50),'Raspberry Pi Sound Meter')) self.progress_view = ui.ProgressView(ui.Rect(20, 50, 280, 120)) self.add_child(self.progress_view) self.db_value = ui.Label(ui.Rect(110, 170, 100, 30), '00.00 dB') self.add_child(self.db_value) self.progress = 0
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 __init__(self): ui.Scene.__init__(self) self.lastUpdate = datetime.now() scrollbar_size = ui.SCROLLBAR_SIZE self.list_view = ui.ListView(ui.Rect(0, 0, LIST_WIDTH, 400), []) self.update_people() self.list_view.on_selected.connect(self.item_selected) self.list_view.on_deselected.connect(self.item_deselected) self.scroll_list = ui.ScrollView( ui.Rect(MARGIN, MARGIN, LIST_WIDTH, 80), self.list_view) self.add_child(self.scroll_list)
def createUI(self): screenWidth, screenHeight = gdata.scrnSize # size of dialog in layout metrics (for SimpleGridLM) cols = 25 rows = 20 # dialog width and height in pixels width = cols * 20 + 5 height = rows * 20 + 4 #creating dialog window self.win = ui.Window(self.app, modal = 1, escKeyClose = 1, movable = 0, title = _("Galaxy finish"), rect = ui.Rect((screenWidth - width) / 2, (screenHeight - height) / 2, width, height), layoutManager = ui.SimpleGridLM(), ) self.win.subscribeAction('*', self) # first row is window title rows -= 1 ui.Label(self.win, layout = (0, 0, cols, 1), text = _("If you are sure to finish this galaxy, click on Finish button."), align = ui.ALIGN_W) ui.Label(self.win, layout = (0, 1, cols, 1), text = _("You can enter message visible in finish announcement below."), align = ui.ALIGN_W) s = ui.Scrollbar(self.win, layout = (cols - 1, 2, 1, rows - 3)) t = ui.Text(self.win, layout = (0, 2, cols - 1, rows - 3), id = 'vMsg') t.attachVScrollbar(s) # dialog bottom line ui.Title(self.win, layout = (0, rows - 1, cols - 10, 1)) ui.TitleButton(self.win, layout = (cols - 10, rows - 1, 5, 1), text = _("Finish"), action = 'onFinish') ui.TitleButton(self.win, layout = (cols - 5, rows - 1, 5, 1), text = _("Cancel"), action = 'onClose')
def createUI(self): w, h = gdata.scrnSize cols = 15 rows = 8 width = cols * 20 + 5 height = rows * 20 + 4 self.win = ui.Window(self.app, modal = 1, escKeyClose = 1, movable = 0, title = _('Rename Fleet'), rect = ui.Rect((w - width) / 2, (h - height) / 2, width, height), layoutManager = ui.SimpleGridLM(), ) self.win.subscribeAction('*', self) # rename ui.Label(self.win, layout = (0, 0, 5, 1), text = _('Name'), align = ui.ALIGN_W) ui.Entry(self.win, layout = (5, 0, 10, 1), id = 'vName', align = ui.ALIGN_E) ui.Check(self.win, layout = (0, 1, 15, 1), id = "vRetain", text = _("Retain name during fleet joins"), action = "onSelect", data = 2) ui.Check(self.win, layout = (0, 2, 15, 1), id = "vPrevent", text = _("Prevent all fleet joins"), action = "onSelect", data = 0) ui.Label(self.win, layout = (0, 4, 15, 1), text = _(' Note: Retaining name will prevent two'), align = ui.ALIGN_W) ui.Label(self.win, layout = (0, 5, 15, 1), text = _(' retain name fleets from joining.'), align = ui.ALIGN_W) # status bar + submit/cancel ui.TitleButton(self.win, layout = (10, 6, 5, 1), text = _('Rename'), action = 'onRename') ui.TitleButton(self.win, layout = (5, 6, 5, 1), text = _('Delete Name'), action = 'onDelete') ui.TitleButton(self.win, layout = (0, 6, 5, 1), text = _('Cancel'), action = 'onCancel')
def createUI(self): w, h = gdata.scrnSize cols = 22 rows = 13 width = cols * 20 + 4 height = rows * 20 + 24 self.win = ui.Window( self.app, modal=1, escKeyClose=1, movable=0, title=_("Key Command Help"), rect=ui.Rect((w - width) / 2, (h - height) / 2, width, height), layoutManager=ui.SimpleGridLM(), ) # creating dialog window self.win.subscribeAction('*', self) t = ui.Text(self.win, id='vText', align=ui.ALIGN_W, layout=(0, 0, cols - 1, rows - 2), editable=0) s = ui.Scrollbar(self.win, layout=(cols - 1, 0, 1, rows - 2)) t.attachVScrollbar(s) ui.Title(self.win, layout=(0, rows - 1, cols - 16, 1)) ui.TitleButton(self.win, layout=(cols - 4, rows - 1, 4, 1), text=_("OK"), action="onCancel") ui.TitleButton(self.win, layout=(cols - 16, rows - 1, 12, 1), text=_("Do not show help/tooltip again"), action="onOK")
def createUI(self): w, h = gdata.scrnSize self.win = ui.Window( self.app, modal=1, escKeyClose=1, movable=0, title=_('Select component'), rect=ui.Rect((w - 764) / 2, (h - 304) / 2, 764, 304), layoutManager=ui.SimpleGridLM(), ) self.win.subscribeAction('*', self) # component list ui.Listbox(self.win, layout=(0, 0, 38, 13), id="vList", columns=( (_('Name'), 'text', 9, ui.ALIGN_W), (_('Type'), 'tType', 4, ui.ALIGN_W), (_('Data'), 'tData', 0, ui.ALIGN_W), ), sortedBy=('tType', 1), action="onSelect", rmbAction="onCancel") # status bar + submit/cancel ui.TitleButton(self.win, layout=(33, 13, 5, 1), text=_('Cancel'), action='onCancel') ui.Title(self.win, id='vStatusBar', layout=(0, 13, 33, 1), align=ui.ALIGN_W)
def createUI(self): w, h = GData.scrnSize self.win = ui.Window.Window( self.app, modal=1, movable=0, title=_('Question'), rect=ui.Rect((w - 424) / 2, (h - 124) / 2, 424, 124), layoutManager=ui.SimpleGridLM.SimpleGridLM(), ) self.win.subscribeAction('*', self) ui.Text.Text(self.win, layout=(5, 1, 15, 1), id='vText', background=self.win.app.theme.themeBackground, editable=0) ui.ProgressBar.ProgressBar(self.win, layout=(5, 2, 15, 1), id='vProgress') ui.Label.Label(self.win, layout=(0, 0, 5, 4), icons=((res.loginLogoImg, ui.ALIGN_W), )) ui.Title.Title(self.win, layout=(0, 4, 21, 1), id='vStatusBar', align=ui.ALIGN_W)
def createUI(self): w, h = gdata.scrnSize self.win = ui.Window( self.app, modal=1, escKeyClose=1, movable=0, title=_('Change quantity'), rect=ui.Rect((w - 264) / 2, (h - 104) / 2, 264, 104), layoutManager=ui.SimpleGridLM(), ) # creating dialog window self.win.subscribeAction('*', self) ui.Label(self.win, text=_("New quantity:"), align=ui.ALIGN_E, layout=(0, 1, 6, 1)) ui.Entry( self.win, id='vQuantity', align=ui.ALIGN_W, layout=(6, 1, 3, 1), #text = self.quantity, ) ui.Title(self.win, layout=(0, 3, 3, 1)) ui.TitleButton(self.win, layout=(3, 3, 5, 1), text=_("Cancel"), action="onCancel") okBtn = ui.TitleButton(self.win, layout=(8, 3, 5, 1), text=_("OK"), action='onOK') self.win.acceptButton = okBtn
def createUI(self): w, h = gdata.scrnSize self.win = ui.Window( self.app, modal=1, escKeyClose=1, titleOnly=w == 800 and h == 600, movable=0, title=_('Mass Redirect Fleets to This System'), 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) StarMapWidget(self.win, layout=(0, 0, 40, 27), id='vStarMap', action='onSelectMapObj') # status bar + submit/cancel ui.TitleButton(self.win, layout=(35, 27, 5, 1), text=_('Done'), action='onFinish') ui.Title(self.win, id='vStatusBar', layout=(0, 27, 35, 1), align=ui.ALIGN_W)
def createUI(self): w, h = gdata.scrnSize self.win = ui.Window( self.app, modal=1, movable=0, title=_('Question'), rect=ui.Rect((w - 424) / 2, (h - 124) / 2, 424, 124), layoutManager=ui.SimpleGridLM(), ) self.win.subscribeAction('*', self) ui.Text(self.win, layout=(5, 0, 16, 4), id='vText', background=self.win.app.theme.themeBackground, editable=0) ui.Label(self.win, layout=(0, 0, 5, 4), icons=((res.loginLogoImg, ui.ALIGN_W), )) ui.Title(self.win, layout=(0, 4, 13, 1), id='vStatusBar', align=ui.ALIGN_W) ui.TitleButton(self.win, layout=(13, 4, 4, 1), id='vCancel', action='onCancel') ui.TitleButton(self.win, layout=(17, 4, 4, 1), id='vConfirm', action='onConfirm')
def createUI(self): w, h = gdata.scrnSize self.win = ui.Window( self.app, modal=1, escKeyClose=1, movable=0, title=_('Select design to upgrade to'), rect=ui.Rect((w - 404) / 2, (h - 463) / 2, 404, 463), layoutManager=ui.SimpleGridLM(), ) self.win.subscribeAction('*', self) # component list ui.Listbox(self.win, layout=(0, 0, 20, 21), id="vList", columns=( (_('Name'), 'text', 11, ui.ALIGN_W), (_('Per ship'), 'tDiff', 4, ui.ALIGN_E), (_('Total'), 'tTotal', 4, ui.ALIGN_E), ), columnLabels=1, action="onSelect", rmbAction="onCancel") # status bar + submit/cancel ui.TitleButton(self.win, layout=(15, 21, 5, 1), text=_('Cancel'), action='onCancel') ui.Title(self.win, id='vStatusBar', layout=(0, 21, 15, 1), align=ui.ALIGN_W)
def createUI(self): self.win = ui.Window( self.app, modal=1, rect=ui.Rect(0, 20, 400, 600), layoutManager=ui.SimpleGridLM(), )
def createUI(self): w, h = gdata.scrnSize cols = 20 rows = 13 width = cols * 20 + 4 height = rows * 20 + 24 self.win = ui.Window( self.app, modal=1, escKeyClose=1, movable=0, title=_("Show buoy text"), rect=ui.Rect((w - width) / 2, (h - height) / 2, width, height), layoutManager=ui.SimpleGridLM(), ) # creating dialog window self.win.subscribeAction('*', self) s = ui.Scrollbar(self.win, layout=(cols - 1, 0, 1, rows - 1)) t = ui.Text(self.win, id='vText', align=ui.ALIGN_W, layout=(0, 0, cols - 1, rows - 1), editable=0) t.attachVScrollbar(s) ui.Title(self.win, layout=(0, rows - 1, cols - 5, 1)) okBtn = ui.TitleButton(self.win, layout=(cols - 5, rows - 1, 5, 1), text=_("OK"), action='onOK')
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 createUI(self): screenWidth, screenHeight = gdata.scrnSize # size of dialog in layout metrics (for SimpleGridLM) cols = 20 rows = 6 # dialog width and height in pixels width = cols * 20 + 5 height = rows * 20 + 4 #creating dialog window self.win = ui.Window( self.app, modal=1, escKeyClose=1, movable=0, title=_("Search for system"), rect=ui.Rect(10, 25, width, height), layoutManager=ui.SimpleGridLM(), ) self.win.subscribeAction('*', self) # first row is window title rows -= 1 ui.Label( self.win, layout=(0, 0, cols, 1), text= _("Use wildcard search as with files (*ese* finds Presere and Shesed)" ), align=ui.ALIGN_W) ui.Label( self.win, layout=(0, 1, cols - 1, 1), text=_("* matches everything, ? matches any single character"), align=ui.ALIGN_W) ui.Label(self.win, layout=(0, 2, 6, 1), text=_("System name:"), align=ui.ALIGN_W) ui.Entry(self.win, layout=(6, 2, cols - 7, 1), id="vSystemName", align=ui.ALIGN_W) # dialog bottom line ui.Title(self.win, layout=(0, rows - 1, cols - 15, 1)) srchBtn = ui.TitleButton(self.win, layout=(cols - 15, rows - 1, 5, 1), text=_("Find"), action='onSearch', data=1) ui.TitleButton(self.win, layout=(cols - 10, rows - 1, 5, 1), text=_("Next"), action='onNext') ui.TitleButton(self.win, layout=(cols - 5, rows - 1, 5, 1), text=_("Cancel"), action='onClose') self.win.acceptButton = srchBtn
def createUI(self): w, h = gdata.scrnSize 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 cols = 22 rows = 13 width = cols * 20 + 4 height = rows * 20 + 24 self.win = ui.Window( self.app, modal=1, escKeyClose=1, movable=0, title=_("Edit buoy"), rect=ui.Rect((w - width) / 2, (h - height) / 2, width, height), layoutManager=ui.SimpleGridLM(), ) # creating dialog window self.win.subscribeAction('*', self) ui.Label(self.win, text=_("Buoy text:"), align=ui.ALIGN_W, layout=(0, 0, 4, 1)) ui.Label(self.win, text=_("Visible to:"), align=ui.ALIGN_W, layout=(6, 0, 4, 1)) ui.Check(self.win, text=_("Allies"), align=ui.ALIGN_W, layout=(10.5, 0, 4, 1), id='vAllied', action="turnOff", data="vAllied") ui.Check(self.win, text=_("Scanner Share"), align=ui.ALIGN_W, layout=(15, 0, 6, 1), id='vScanner', action="turnOff", data="vScanner") s = ui.Scrollbar(self.win, layout=(cols - 1, 1, 1, rows - 3)) t = ui.Text( self.win, id='vText', align=ui.ALIGN_W, layout=(0, 1, cols - 1, rows - 2), ) t.attachVScrollbar(s) ui.Title(self.win, layout=(0, rows - 1, cols - 10, 1)) ui.TitleButton(self.win, layout=(cols - 10, rows - 1, 5, 1), text=_("Cancel"), action="onCancel") okBtn = ui.TitleButton(self.win, layout=(cols - 5, rows - 1, 5, 1), text=_("OK"), action='onOK') self.win.acceptButton = okBtn
def __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 __init__(self): ui.Scene.__init__(self) self.on17_button = ui.Button(ui.Rect(MARGIN, MARGIN, 130, 90), '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, 90), '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, 130, 130, 90), '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, 130, 130, 90), '4 off') self.off4_button.on_clicked.connect(self.gpi_button) self.add_child(self.off4_button)
def createUI(self): w, h = gdata.scrnSize self.win = ui.Window(self.app, modal=1, movable=0, title=_('Change password'), rect=ui.Rect((w - 324) / 2, (h - 104) / 2, 324, 104), layoutManager=ui.SimpleGridLM(), tabChange=True) self.win.subscribeAction('*', self) ui.Label(self.win, text=_('Old password'), align=ui.ALIGN_E, layout=(0, 0, 6, 1)) ui.Entry(self.win, id='vOld', align=ui.ALIGN_W, showChar='*', layout=(6, 0, 10, 1), orderNo=1) ui.Label( self.win, text=_('New password'), align=ui.ALIGN_E, layout=(0, 1, 6, 1), ) ui.Entry(self.win, id='vNew', align=ui.ALIGN_W, showChar='*', layout=(6, 1, 10, 1), orderNo=2) ui.Label( self.win, align=ui.ALIGN_E, text=_('Confirm'), layout=(0, 2, 6, 1), ) ui.Entry(self.win, id='vConfirm', align=ui.ALIGN_W, layout=(6, 2, 10, 1), showChar="*", orderNo=3) ui.Title(self.win, layout=(0, 3, 8, 1), id='vMessage', align=ui.ALIGN_W) ui.TitleButton(self.win, layout=(8, 3, 4, 1), text=_('Cancel'), action='onCancel') ui.TitleButton(self.win, layout=(12, 3, 4, 1), text=_('Apply'), action='onChange')
def __init__(self): ui.Scene.__init__(self) self.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 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 __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): screenWidth, screenHeight = gdata.scrnSize # size of dialog in layout metrics (for SimpleGridLM) cols = 23 rows = 27 # 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=_("Empire Overview"), rect=ui.Rect((screenWidth - width) / 2, (screenHeight - height) / 2, width, height), layoutManager=ui.SimpleGridLM(), ) self.win.subscribeAction('*', self) # first row is window title rows -= 1 s = ui.Scrollbar(self.win, layout=(cols - 1, 0, 1, rows - 1)) t = ui.Text(self.win, layout=(0, 0, cols - 1, rows - 1), id="vText", editable=0) self._textRows = rows - 1 t.attachVScrollbar(s) # dialog bottom line ui.Title(self.win, layout=(0, rows - 1, cols - 10, 1)) ui.TitleButton(self.win, layout=(cols - 10, rows - 1, 5, 1), text=_("Analysis"), action="onMenu") ui.TitleButton(self.win, layout=(cols - 5, rows - 1, 5, 1), text=_("Close"), action="onClose") # analysis menu self.analysisMenu = ui.Menu(self.app, title=_("Field of analysis"), width=5, items=[ ui.Item(_("Planets"), action="onPlanetsAnalysis"), ui.Item(_("Fleets"), action="onFleetsAnalysis"), ]) self.analysisMenu.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)
def __init__(self): ui.Scene.__init__(self) self.on17_button = ui.Button(ui.Rect(MARGIN, MARGIN, 130, 60), '17 on') self.on17_button.on_clicked.connect(self.gpi_button) self.add_child(self.on17_button) self.on4_button = ui.Button(ui.Rect(170, MARGIN, 130, 60), '4 on') self.on4_button.on_clicked.connect(self.gpi_button) self.add_child(self.on4_button) self.off17_button = ui.Button(ui.Rect(MARGIN, 100, 130, 60), '17 off') self.off17_button.on_clicked.connect(self.gpi_button) self.add_child(self.off17_button) self.off4_button = ui.Button(ui.Rect(170, 100, 130, 60), '4 off') self.off4_button.on_clicked.connect(self.gpi_button) self.add_child(self.off4_button) self.progress_view = ui.ProgressView(ui.Rect(MARGIN, 200, 280, 40)) self.add_child(self.progress_view) self.volts_value = ui.Label(ui.Rect(135, 170, 50, 30), 'Hi!') self.add_child(self.volts_value) self.progress = 0
def update_people(self): r = requests.get("https://meepo-api.herokuapp.com/people") items = [] for person in r.json()['people']: items.append(person['name']) label_height = ui.theme.current.label_height labels = [ ui.Label(ui.Rect(0, 0, LIST_WIDTH, label_height), item, halign=ui.LEFT) for item in items ] self.list_view.items = labels
def 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