Commit b32c5e3c authored by David Boddie's avatar David Boddie

Ran pep8 over two files and fixed things that are possible to fix.

parent 56106435
......@@ -5,7 +5,9 @@
# SPDX-License-Identifier: GPL-3.0+
# Author: David Boddie <david.boddie@puri.sm>
import os, random, sys
import os
import random
import sys
from . import config
import gi
......@@ -17,6 +19,7 @@ gi.require_version('Handy', '0.0')
from gi.repository import Handy
Handy.init()
class Application(Gtk.Application):
_images = ['dug1.svg', 'dug2.svg', 'ground.svg', 'treasure.svg']
......@@ -80,8 +83,9 @@ class Application(Gtk.Application):
def on_quit(self, action, parameter):
self.quit()
def on_new_game(self, action, parameter):
# Remove all the widgets in the grid if present.
if self.cells != {}:
while self.rows > 0:
......@@ -142,6 +146,7 @@ class Application(Gtk.Application):
self.turns_label.set_text(_('Turns: {0}').format(self.turns))
def on_clicked(self, widget, event):
if self.won:
return
......@@ -154,9 +159,12 @@ class Application(Gtk.Application):
self.update_turns_label()
if pos == self.treasure_pos:
widget.set_image(Gtk.Image.new_from_pixbuf(self.pixbufs['treasure.svg']))
self.turns_label.set_text(_('Well done! You found the treasure in {0} turns.').format(self.turns))
self.won = True
widget.set_image(Gtk.Image.new_from_pixbuf(
self.pixbufs['treasure.svg']))
self.turns_label.set_text(
_('Well done! You found the treasure in {0} turns.').format(
self.turns))
else:
if random.randint(0, 1) == 0:
pixbuf = self.pixbufs['dug1.svg']
......
......@@ -5,8 +5,11 @@
# SPDX-License-Identifier: GPL-3.0+
# Author: David Boddie <david.boddie@puri.sm>
import gettext, locale
import os, signal, sys
import gettext
import locale
import os
import signal
import sys
VERSION = '@VERSION@'
pkgdatadir = '@pkgdatadir@'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment