return self.config.get(self.config_section, LowerThird.OPTION_FG, '#ffffff') def bg(self): return self.config.get(self.config_section, LowerThird.OPTION_BG, '#eda129') def templateData(self): return amcp.jsondata({ 'line1': self.line1.GetValue(), 'line2_l': self.line2_l.GetValue(), 'line2_c': self.line2_c.GetValue(), 'line2_r': self.line2_r.GetValue(), 'colourB': self.cp.get_bg(), 'colourA': self.cp.get_fg(), }) def got_colours(self): if self.cp: self.config.put(self.config_section, LowerThird.OPTION_BG, self.cp.get_bg()) self.config.put(self.config_section, LowerThird.OPTION_FG, self.cp.get_fg()) self.config.write() self.Refresh() if __name__ == '__main__': import wxclient wxclient.run_app([LowerThirdBanner])
self.team2.name.GetValue()) self.config.write() super(ScoreHistory, self).do_update(e) def colours_changed(self): self.config.put(self.config_section, ITEM_FG1, self.team1.picker.get_fg()) self.config.put(self.config_section, ITEM_BG1, self.team1.picker.get_bg()) self.config.put(self.config_section, ITEM_FG2, self.team2.picker.get_fg()) self.config.put(self.config_section, ITEM_BG2, self.team2.picker.get_bg()) self.config.write() class ScoreHistory1(ScoreHistory): ''' ScoreHistory using only 1 box (e.g. for bowls) ''' def __init__(self, parent, config): ''' Required: parent object, config object ''' super(ScoreHistory1, self).__init__(parent, config, nboxes=1) if __name__ == '__main__': import wxclient wxclient.run_app([ScoreHistory])
def fg(self): return self.config.get(self.config_section, LowerThird.OPTION_FG, '#ffffff') def bg(self): return self.config.get(self.config_section, LowerThird.OPTION_BG, '#eda129') def templateData(self): return amcp.jsondata({ 'name': self.line1.GetValue(), 'title': self.line2.GetValue(), 'colourB': self.cp.get_bg(), 'colourA': self.cp.get_fg(), }) def got_colours(self): if self.cp: self.config.put(self.config_section, LowerThird.OPTION_BG, self.cp.get_bg()) self.config.put(self.config_section, LowerThird.OPTION_FG, self.cp.get_fg()) self.config.write() self.Refresh() if __name__ == '__main__': import wxclient wxclient.run_app([LowerThird])
#!/usr/bin/env python3 # # This file is part of Mediary's Caspar Client. # Copyright (C) 2018 Mediary Limited. All rights reserved. # ''' Lawn bowls mode ''' import amcp import wx import sys from configurable import Configurable, FieldValidator import configurable from widget import Widget import datetime from scoreextra import ScoreExtra import scorebug import lowerthird import lt_banner import history if __name__ == '__main__': import wxclient wxclient.run_app([ history.ScoreHistory1, lowerthird.LowerThird, lt_banner.LowerThirdBanner ])
one-touch controls for +1, +2 and +3 points for each team. The +2 controls are in large text, as they're most commonly used. ''' config_section='basketball' ui_label='Basketball' def createSecondLine(self,sizer): line2 = wx.BoxSizer(wx.HORIZONTAL) self.addButton(line2, '+1', lambda e: self.score(1, 1)) line2.AddSpacer(10) self.addButton(line2, '+2', lambda e: self.score(1, 2), True) line2.AddSpacer(10) self.addButton(line2, '+3', lambda e: self.score(1, 3)) line2.AddStretchSpacer(1) self.addButton(line2, '+1', lambda e: self.score(2, 1)) line2.AddSpacer(10) self.addButton(line2, '+2', lambda e: self.score(2, 2), True) line2.AddSpacer(10) self.addButton(line2, '+3', lambda e: self.score(2, 3)) sizer.AddStretchSpacer(1) sizer.AddSpacer(10) sizer.Add(line2, 0, wx.EXPAND) if __name__=='__main__': import wxclient # This is the set of widgets to load when this script is invoked directly. wxclient.run_app([BasketballScore, timer.Timer, scoreextra.ScoreExtra, lowerthird.LowerThird, lt_banner.LowerThirdBanner])
def addAction(self, line, label, text): btn = self.addButton(line, label, lambda e: self.playAction(text)) btn.SetToolTip(text) #line.AddStretchSpacer(1) def playAction(self, actionText, sleepTime=5): self.current_action_text = actionText self.do_anim_on(None) if sleepTime is not None: t = threading.Timer(sleepTime, self.removeAction) t.start() def removeAction(self): self.do_remove(None) def templateData(self): return amcp.jsondata({ 'name': self.current_action_text, 'title': '', 'colourB': '#000000', 'colourA': '#ffffff', }) if __name__ == '__main__': import wxclient # This is the set of widgets to load when this script is invoked directly. wxclient.run_app( [BaseballScore, BaseballOuts, BaseballAction, BaseballRecorder])
#!/usr/bin/env python3 # # This file is part of Mediary's Caspar Client. # Copyright (C) 2018 Mediary Limited. All rights reserved. # ''' Entrypoint for the generic client window To make this work: * You MUST be using Caspar 2.1.0beta or later, 2.0 isn't good enough * Install the templates to the caspar server's template directory ''' import wxclient wxclient.run_app(None)
line1.AddStretchSpacer(1) self.addButton(line1, 'TAKE', self.do_anim_on) line1.AddStretchSpacer(1) self.addButton(line1, 'ANIM OFF', self.do_anim_off) line1.AddStretchSpacer(1) self.addButton(line1, 'CUT OFF', self.do_remove) line1.AddStretchSpacer(1) self.addButton(line1, 'Update', self.do_update) #line1.AddStretchSpacer(2) sizer.Add(line1, 0, wx.EXPAND) if sys.platform.startswith('linux'): sizer.AddSpacer(20) # sigh def createControl(self, sizer): self.text = wx.TextCtrl(self, 2, value='Text Goes Here') sizer.Add(self.text, 2, flag=wx.EXPAND) def templateData(self): rv = amcp.jsondata({ 'line1': str(self.text.GetValue()), }) return rv if __name__ == '__main__': import wxclient wxclient.run_app([ScoreExtra])
def got_colours(self): if self.team1cp: self.config.put(self.config_section, ITEM_FG1, self.team1cp.get_fg()) self.config.put(self.config_section, ITEM_BG1, self.team1cp.get_bg()) if self.team2cp: self.config.put(self.config_section, ITEM_FG2, self.team2cp.get_fg()) self.config.put(self.config_section, ITEM_BG2, self.team2cp.get_bg()) self.config.write() self.update_field_colours() def template(self): sel = self.bb_choices[self.bb_choice.GetSelection()] if sel == 'Bug': d = self.my_default_config[Template_bug.label] return self.config.get(self.config_section, Template_bug.label, self.my_default_config[Template_bug.label]) else: return self.config.get( self.config_section, Template_banner.label, self.my_default_config[Template_banner.label]) if __name__ == '__main__': import wxclient wxclient.run_app([ScoreBug])
self.addButton(line2, 'DROP', lambda e: self.score(2, 'dropgoal'), True) sizer.AddStretchSpacer(1) sizer.AddSpacer(10) sizer.Add(line2, 0, wx.EXPAND) def code(self): ''' Looks up the rugby code (League or Union) selected in the config. ''' return self.config.get( self.config_section, RugbyCode.label, RugbyScoreBug.my_default_config[RugbyCode.label]) def score(self, team, event): ''' Looks up the score table to find out the score for the event, then applies it to the correct team. ''' delta = ScoresByCode[self.code()][event] super(RugbyScoreBug, self).score(team, delta) if __name__ == '__main__': import wxclient wxclient.run_app([ RugbyScoreBug, timer.Timer, scoreextra.ScoreExtra, lowerthird.LowerThird, lt_banner.LowerThirdBanner ])