Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
several (small) improvements
move dgt to etc folder & games.pgn inside games folder
  • Loading branch information
LocutusOfPenguin committed Feb 10, 2017
1 parent 6f79776 commit 2a0d835
Show file tree
Hide file tree
Showing 15 changed files with 54 additions and 19 deletions.
29 changes: 29 additions & 0 deletions dgt/test/timer.py
@@ -0,0 +1,29 @@
#!/usr/bin/env python3
#
from threading import Timer
from time import sleep


def stopped_maxtimer():
print('stopped')


print('start')
maxtimer = Timer(5, stopped_maxtimer)
maxtimer.start()
print(maxtimer.is_alive())
print('sleep2')
print()
sleep(2)
print(maxtimer.is_alive())
maxtimer.cancel()
print('X')
print(maxtimer.is_alive())
maxtimer.join()
print('Y')
print(maxtimer.is_alive())
print('sleep5')
print()
sleep(5)
print(maxtimer.is_alive())
print('end')
14 changes: 7 additions & 7 deletions dgttranslate.py
Expand Up @@ -367,13 +367,6 @@ def text(self, str_code, msg='', devs={'ser', 'i2c', 'web'}):
frtxt = entxt
estxt = entxt
ittxt = entxt
# if text_id == 'menu_top_menu':
# entxt = Dgt.DISPLAY_TEXT(l='Top menu ', m='Top menu', s='topmen')
# detxt = Dgt.DISPLAY_TEXT(l='Haupt Menu ', m='Hpt Menu', s='topmen')
# nltxt = Dgt.DISPLAY_TEXT(l='Top menu ', m='Top menu', s='topmen')
# frtxt = Dgt.DISPLAY_TEXT(l='Top menu ', m='Top menu', s='topmen')
# estxt = Dgt.DISPLAY_TEXT(l='Top menu ', m='Top menu', s='topmen')
# ittxt = Dgt.DISPLAY_TEXT(l='Top menu ', m='Top menu', s='topmen')
if text_id == 'menu_mode_menu':
entxt = Dgt.DISPLAY_TEXT(l='Mode ', m='Mode ', s='mode ')
detxt = Dgt.DISPLAY_TEXT(l='Modus ', m='Modus ', s='modus ')
Expand Down Expand Up @@ -745,6 +738,13 @@ def text(self, str_code, msg='', devs={'ser', 'i2c', 'web'}):
frtxt = entxt
estxt = entxt
ittxt = entxt
if text_id == 'update':
entxt = Dgt.DISPLAY_TEXT(l='updating pc', m='updating', s='update')
detxt = entxt
nltxt = entxt
frtxt = entxt
estxt = entxt
ittxt = entxt

for txt in [entxt, detxt, nltxt, frtxt, estxt, ittxt]:
if txt:
Expand Down
4 changes: 2 additions & 2 deletions docs/installation.rst
Expand Up @@ -222,8 +222,8 @@ At start PicoChess looks at the file
* enable-revelation-leds = true
* log-level = debug
* log-file = /opt/picochess/picochess.log
* user-voice = en:Elsie
* computer-voice = en:Marvin
* user-voice = en:al
* computer-voice = en:christina
* disable-ok-message

To set a particular setting, simply include the appropriate line in the picochess.ini file.
Expand Down
4 changes: 2 additions & 2 deletions dgt/dgtpi.service → etc/dgtpi.service
Expand Up @@ -4,8 +4,8 @@ DefaultDependencies=false

[Service]
Type=oneshot
ExecStart=/opt/picochess/dgt/dgtpicom " DGT P| " 1
WorkingDirectory=/opt/picochess/dgt/
ExecStart=/opt/picochess/etc/dgtpicom " DGT P| " 1
WorkingDirectory=/opt/picochess/etc/

[Install]
WantedBy=basic.target
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion dgt/dgtpistandby.service → etc/dgtpistandby.service
Expand Up @@ -22,7 +22,7 @@ ExecStartPre=-/bin/plymouth quit
ExecStartPre=-/bin/umount /boot
ExecStartPre=-/bin/mount -no remount,ro /
#ExecStart=-/bin/sh -c "/sbin/sulogin; /bin/systemctl --fail --no-block default"
ExecStart=/bin/sh -c "/opt/picochess/dgt/dgtpicom; /bin/systemctl --fail --no-block default"
ExecStart=/bin/sh -c "/opt/picochess/etc/dgtpicom; /bin/systemctl --fail --no-block default"
Type=idle
StandardInput=tty-force
StandardOutput=inherit
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions games/.gitignore
@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore
2 changes: 1 addition & 1 deletion picochess.ini.example
Expand Up @@ -127,7 +127,7 @@
# user-voice = en:al
## computer-voice for computer moves announcement
# computer-voice = en:christina
## PicoChess writes pgn files at end of game.
## PicoChess writes pgn files at end of game. This file is created in the games folder
# pgn-file = games.pgn
# pgn-user = player
## Picochess will check for a new version at startup.
Expand Down
4 changes: 2 additions & 2 deletions picochess.py
Expand Up @@ -547,7 +547,7 @@ def get_engine_level_dict(engine_level):
smtp_server=args.smtp_server, smtp_user=args.smtp_user,
smtp_pass=args.smtp_pass, smtp_encryption=args.smtp_encryption, smtp_from=args.smtp_from)

PgnDisplay(args.pgn_file, emailer).start()
PgnDisplay('games' + os.sep + args.pgn_file, emailer).start()
if args.pgn_user:
user_name = args.pgn_user
else:
Expand Down Expand Up @@ -712,9 +712,9 @@ def get_engine_level_dict(engine_level):
last_computer_fen = None
time_control.reset()
searchmoves.reset()
DisplayMsg.show(Message.START_NEW_GAME(time_control=time_control, game=game.copy()))
game_declared = False
set_wait_state()
DisplayMsg.show(Message.START_NEW_GAME(time_control=time_control, game=game.copy(), newgame=True))
break

if case(EventApi.NEW_GAME):
Expand Down
2 changes: 1 addition & 1 deletion utilities.py
Expand Up @@ -845,7 +845,7 @@ def update_picochess(dgtpi, auto_reboot, dgttranslate):
stdout=subprocess.PIPE, env=force_en_env).communicate()[0].decode(encoding='UTF-8')
logging.debug(output)
if 'up-to-date' not in output:
DisplayDgt.show(dgttranslate.text('Y00_default', 'update'))
DisplayDgt.show(dgttranslate.text('Y00_update'))
# Update
logging.debug('updating picochess')
output = subprocess.Popen(['pip3', 'install', '-r', 'requirements.txt'],
Expand Down
8 changes: 5 additions & 3 deletions web/picoweb/static/js/app.js
Expand Up @@ -95,16 +95,18 @@ function setTitle(data) {
window.ip_info = data;
var ip = '';
if (window.ip_info.ext_ip) {
ip += ' ExtIP: ' + window.ip_info.ext_ip;
ip += ' ExtIP: ' + window.ip_info.ext_ip
}
if (window.ip_info.int_ip) {
ip += ' IntIP: ' + window.ip_info.int_ip
}
var version = '';
if (window.ip_info.version) {
version = window.ip_info.version;
version = window.ip_info.version
} else if (window.system_info.version) {
version = window.system_info.version
}
document.title = 'Webserver Picochess ' + version + ip;
document.title = 'Webserver Picochess ' + version + ip
}

// copied from loadGame()
Expand Down

0 comments on commit 2a0d835

Please sign in to comment.