Skip to content

Commit

Permalink
Split learn data into subdirs
Browse files Browse the repository at this point in the history
  • Loading branch information
gbtami committed Feb 23, 2018
1 parent a96c928 commit 4f59a42
Show file tree
Hide file tree
Showing 45 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ include glade/*.glade glade/background.jpg glade/*.png glade/*.svg glade/16x16/*
recursive-include pieces *
include README.md AUTHORS ARTISTS DOCUMENTERS LICENSE INSTALL TRANSLATORS
include sounds/*.ogg
include lectures/*.txt lectures/*.pgn
include learn/lectures/*.txt learn/lessons/*.pgn learn/puzzles/*.pgn learn/puzzles/*.olv
include manpages/pychess.1.gz
include menu/pychess
include gtksourceview-3.0/language-specs/pgn.lang
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/pychess/perspectives/learn/LecturesPanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def row_activated(self, widget, path, col):
if path is None:
return
lecnum = path[0] + 1
self.lecture = addDataPrefix("lectures/lec%s.txt" % lecnum)
self.lecture = addDataPrefix("learn/lectures/lec%s.txt" % lecnum)

# connection.client.run_command("examine")
gamemodel = self.start_lecture_game()
Expand Down
2 changes: 1 addition & 1 deletion lib/pychess/perspectives/learn/LessonsPanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def row_activated(self, widget, path, col):


def start_lesson_from(filename, index):
chessfile = PGNFile(protoopen(addDataPrefix("lectures/%s" % filename)))
chessfile = PGNFile(protoopen(addDataPrefix("learn/lessons/%s" % filename)))
chessfile.limit = 1000
importer = PgnImport(chessfile)
chessfile.init_tag_database(importer)
Expand Down
4 changes: 2 additions & 2 deletions lib/pychess/perspectives/learn/PuzzlesPanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ def row_activated(self, widget, path, col):

def start_puzzle_from(filename):
if filename.lower().endswith(".pgn"):
chessfile = PGNFile(protoopen(addDataPrefix("lectures/%s" % filename)))
chessfile = PGNFile(protoopen(addDataPrefix("learn/puzzles/%s" % filename)))
chessfile.limit = 1000
importer = PgnImport(chessfile)
chessfile.init_tag_database(importer)
elif filename.lower().endswith(".olv"):
chessfile = OLVFile(protoopen(addDataPrefix("lectures/%s" % filename), encoding="utf-8"))
chessfile = OLVFile(protoopen(addDataPrefix("learn/puzzles/%s" % filename), encoding="utf-8"))

records, plys = chessfile.get_records()

Expand Down
10 changes: 6 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from distutils.command.register import register
from glob import glob
from os import listdir
from os.path import isdir, isfile
from os.path import isdir
import os
import site
import sys
Expand Down Expand Up @@ -168,9 +168,11 @@ def run(self):
DATA_FILES += [("share/pychess/pieces", glob('pieces/*.png'))]
DATA_FILES += [("share/pychess/pieces/ttf", glob('pieces/ttf/*.ttf'))]

# Lectures, puzzles
DATA_FILES += [("share/pychess/lectures", glob('lectures/*.pgn'))]
DATA_FILES += [("share/pychess/lectures", glob('lectures/*.txt'))]
# Lectures, puzzles, lessons
DATA_FILES += [("share/pychess/learn/puzzles", glob('learn/puzzles/*.olv'))]
DATA_FILES += [("share/pychess/learn/puzzles", glob('learn/puzzles/*.pgn'))]
DATA_FILES += [("share/pychess/learn/lessons", glob('learn/lessons/*.pgn'))]
DATA_FILES += [("share/pychess/learn/lectures", glob('learn/lectures/*.txt'))]

for dir in [d for d in listdir('pieces') if isdir(os.path.join('pieces', d)) and d != 'ttf']:
DATA_FILES += [("share/pychess/pieces/" + dir, glob('pieces/' + dir + '/*.svg'))]
Expand Down

0 comments on commit 4f59a42

Please sign in to comment.