Skip to content

Commit

Permalink
Merge showhost into domlogo. (#99)
Browse files Browse the repository at this point in the history
There is no need that these two are separate and the fact that it is is
only a historical artifact.

Also add possibility to add an optional configuration, currently only
supporting the background color for the host, in order to use it for the
double finals.
  • Loading branch information
meisterT authored Sep 23, 2023
1 parent cfa14ba commit 3036725
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 30 deletions.
16 changes: 15 additions & 1 deletion domlogo/domlogo.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,21 @@
import requests
import re
import time
import platform
import yaml

font = ('Roboto', 14)
mono_font = ('Liberation Mono', 32)
host = platform.node()
host_bg_color = 'black'

config_file = 'domlogo-files/config.yaml'
if os.path.isfile(config_file) and os.access(config_file, os.R_OK):
with open(config_file, 'r') as f:
config = yaml.safe_load(f)
if 'host-bg-color' in config:
host_bg_color = config['host-bg-color']

team_image = sg.Image(filename='domlogo-files/photos/idle.png')
metadata_text = sg.Text('No submissions in queue.', font=font)
results_text = sg.Text('', font=font)
Expand All @@ -21,9 +34,10 @@
[sg.Image(filename=c[0]), sg.Text(c[1], font=font), sg.Canvas(size=(10,50))] for c in cache
]
layout = [
[sg.Push(), sg.Text(f'{host}', font=mono_font, background_color=host_bg_color), sg.Push()],
[sg.Column(current_column), sg.VerticalSeparator(), sg.Column(previous_column)],
]
window = sg.Window('DOMlogo', layout, location=(600,0), keep_on_top=True, no_titlebar=True)
window = sg.Window('DOMlogo', layout, location=(600,50), keep_on_top=True, no_titlebar=True)

with open('etc/restapi.secret', 'r') as secrets:
while True:
Expand Down
20 changes: 0 additions & 20 deletions provision-contest/ansible/roles/domlogo/files/showhost.py

This file was deleted.

8 changes: 3 additions & 5 deletions provision-contest/ansible/roles/domlogo/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
pkg:
- python3-tk

- name: Install domlogo and showhost
- name: Install domlogo
copy:
src: "{{ item }}.py"
dest: "{{ DJ_DIR }}"
Expand All @@ -16,16 +16,15 @@
mode: 0755
loop:
- domlogo
- showhost

- name: Install domlogo and showhost env
- name: Install domlogo
synchronize:
src: lib
dest: /home/domjudge/.local/
owner: false
use_ssh_args: true

- name: Fix ownership of domlogo and showhost env
- name: Fix ownership of domlogo env
file:
path: "/home/domjudge/.local/lib/python3.8"
recurse: true
Expand Down Expand Up @@ -55,4 +54,3 @@
mode: 0755
loop:
- domjudgelogo
- showhost

This file was deleted.

0 comments on commit 3036725

Please sign in to comment.