Skip to content

Commit

Permalink
quick fixes to smooth out everything
Browse files Browse the repository at this point in the history
  • Loading branch information
r2dev2 committed Jul 31, 2020
1 parent d50f9e5 commit da13b0f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 1 addition & 3 deletions core.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@ def new_file(self):


def save(self, file=None):
if not os.path.isfile(file):
if file is None or not os.path.isfile(file):
self.file = filesavebox("Save to which file?", "WayChess", filetypes=("pgn",))
if file is None:
file = self.file
with open(file, 'w+') as fout:
for game in self.games:
print(game, file=fout, end='\n\n')
Expand Down
10 changes: 7 additions & 3 deletions lib/textlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def __board_node_generator(beg):
@staticmethod
def __get_move_text_history(game, emphasis):
beg = game.variations[0]
tabbed = False
moves = []
# nodes will be tuple of either 2 nodes or 1 node
for counter, nodes in enumerate(
Expand All @@ -57,8 +58,11 @@ def __get_move_text_history(game, emphasis):

# Add a space if the move is the current move
if counter-1 == int(emphasis-.5):
s = ' ' + s
s = '\t' + s
tabbed = True
moves.append(s)
if not tabbed:
moves[-1] = '\t' + moves[-1]
return moves


Expand Down Expand Up @@ -105,7 +109,7 @@ def render_history(self):
# print("nothing")
moves = moves[-15:]
for move in moves:
if move.startswith(' '):
if move.startswith('\t'):
l = GUI.moves_panel[0][0]
r = GUI.moves_panel[1][0]
dy = -5
Expand All @@ -115,7 +119,7 @@ def render_history(self):
]
gfx.filled_polygon(self.screen, rect, (0, 0, 0))
self.render_text(move.lstrip(), (None, y), True,
(0, 0, 0) if move.startswith(' ') else (21, 21, 21))
(0, 0, 0) if move.startswith('\t') else (21, 21, 21))
y += 30


Expand Down

0 comments on commit da13b0f

Please sign in to comment.