[game-data-packager] 05/06: doom2-masterlevels: make the "no data" message a modal dialog over the main window
Simon McVittie
smcv at debian.org
Mon Apr 27 22:40:25 UTC 2015
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to branch master
in repository game-data-packager.
commit e62b6e3634c66bea3e2c581bd710bd8d20b213a2
Author: Simon McVittie <smcv at debian.org>
Date: Mon Apr 27 23:12:18 2015 +0100
doom2-masterlevels: make the "no data" message a modal dialog over the main window
This is better Gtk style, avoiding this warning:
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.
and also makes it easier to get an idea of what the launcher looks like
even without having the wads installed.
---
runtime/doom2-masterlevels.py | 51 +++++++++++++++++++++----------------------
1 file changed, 25 insertions(+), 26 deletions(-)
diff --git a/runtime/doom2-masterlevels.py b/runtime/doom2-masterlevels.py
index d561063..bce6ab9 100755
--- a/runtime/doom2-masterlevels.py
+++ b/runtime/doom2-masterlevels.py
@@ -48,32 +48,6 @@ levels = {
}
description = dict()
-for level in levels.keys():
- level = os.path.splitext(level)[0]
- fullpath = '/usr/share/games/doom/%s.wad' % level
- if not os.path.isfile(fullpath):
- print('\n')
- message = fullpath + " is missing !\n\n" \
- "This launcher needs the .wad files from DOOM 2 Master Levels\n" \
- "These can be for example bought on Steam:\n" \
- "http://store.steampowered.com/app/9160/ ;\n" \
- "or found on 'Doom 3: Resurrection of Evil' Xbox game disc\n\n" \
- "The data then need to be put at the right location,\n" \
- "You can use game-data-packager(6) to automate this task.\n" \
- "It will also automatically pick up the data downloaded by a\n" \
- "windows Steam instance running through Wine."
- md = Gtk.MessageDialog(None, 0, Gtk.MessageType.WARNING,
- Gtk.ButtonsType.OK, message)
- md.run()
- exit(message)
- txt = '/usr/share/doc/doom2-masterlevels-wad/%s.txt' % level
- try:
- with open(txt, 'r', encoding='latin1') as f:
- description[level] = f.read()
- except (PermissionError, FileNotFoundError):
- description[level] = "failed to read " + txt
-
-
class Launcher:
def __init__(self):
self.game = None
@@ -246,6 +220,31 @@ class Launcher:
'-skill', '%d' % self.difficulty])
def main(self):
+ for level in levels.keys():
+ level = os.path.splitext(level)[0]
+ fullpath = '/usr/share/games/doom/%s.wad' % level
+ if not os.path.isfile(fullpath):
+ print('\n')
+ message = fullpath + " is missing !\n\n" \
+ "This launcher needs the .wad files from DOOM 2 Master Levels\n" \
+ "These can be for example bought on Steam:\n" \
+ "http://store.steampowered.com/app/9160/ ;\n" \
+ "or found on 'Doom 3: Resurrection of Evil' Xbox game disc\n\n" \
+ "The data then need to be put at the right location,\n" \
+ "You can use game-data-packager(6) to automate this task.\n" \
+ "It will also automatically pick up the data downloaded by a\n" \
+ "windows Steam instance running through Wine."
+ md = Gtk.MessageDialog(self.window, 0, Gtk.MessageType.WARNING,
+ Gtk.ButtonsType.OK, message)
+ md.run()
+ exit(message)
+ txt = '/usr/share/doc/doom2-masterlevels-wad/%s.txt' % level
+ try:
+ with open(txt, 'r', encoding='latin1') as f:
+ description[level] = f.read()
+ except (PermissionError, FileNotFoundError):
+ description[level] = "failed to read " + txt
+
Gtk.main()
if __name__ == "__main__":
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/game-data-packager.git
More information about the Pkg-games-commits
mailing list