From 8178235fb21779eed3615e502f2c4fdebd42150e Mon Sep 17 00:00:00 2001 From: Harishankar Date: Mon, 6 Dec 2010 18:29:06 +0530 Subject: [PATCH] Began working on the player application Began working on the player application using PyGtk --- crosswordpuzzlecreator.py | 1 + getaclue | 2 +- getaclue_player | 16 +++ player_mainwindow.py | 50 ++++++++++ playerwindow.glade | 202 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 270 insertions(+), 1 deletion(-) create mode 100755 getaclue_player create mode 100644 player_mainwindow.py create mode 100644 playerwindow.glade diff --git a/crosswordpuzzlecreator.py b/crosswordpuzzlecreator.py index a0676c7..4ffffb3 100644 --- a/crosswordpuzzlecreator.py +++ b/crosswordpuzzlecreator.py @@ -3,6 +3,7 @@ # Licensed under the GNU GPL v3 # Cross puzzle creator class + import sys import cPickle import readline diff --git a/getaclue b/getaclue index f950a89..5cc5fe7 100755 --- a/getaclue +++ b/getaclue @@ -4,7 +4,7 @@ # Crossword puzzle maker program # Licensed under the GNU GPL v3 -# Main script +# GetAClue creator main script import crosswordpuzzlecreator diff --git a/getaclue_player b/getaclue_player new file mode 100755 index 0000000..f13b52d --- /dev/null +++ b/getaclue_player @@ -0,0 +1,16 @@ +#!/usr/bin/env python + +# Get A Clue (C) 2010 V. Harishankar +# Crossword puzzle maker program +# Licensed under the GNU GPL v3 + +# GetAClue player main script + +import sys +import player_mainwindow + +# if file is given as argument load the puzzle +if len (sys.argv) > 1: + player_mainwindow.MainWindow (sys.argv[1]) +else: + player_mainwindow.MainWindow () \ No newline at end of file diff --git a/player_mainwindow.py b/player_mainwindow.py new file mode 100644 index 0000000..58de825 --- /dev/null +++ b/player_mainwindow.py @@ -0,0 +1,50 @@ +# Get A Clue (C) 2010 V. Harishankar +# Crossword puzzle maker program +# Licensed under the GNU GPL v3 + +# Main window class for GetAClue player + +import pygtk +pygtk.require20 () +import gtk + +class MainWindow: + def gtk_main_quit (self, *args): + gtk.main_quit () + + def __init__ (self, file_to_play = None): + # load the user interface + self.ui = gtk.Builder () + self.ui.add_from_file ("playerwindow.glade") + + # window object + self.window = self.ui.get_object ("mainwindow") + self.window.show () + + # set the cell renderer + cell = gtk.CellRendererText () + tree_acol1 = self.ui.get_object ("tree_clues_across").get_column (0) + tree_acol2 = self.ui.get_object ("tree_clues_across").get_column (1) + tree_acol1.pack_start (cell) + tree_acol1.add_attribute (cell, "text", 0) + tree_acol2.pack_start (cell) + tree_acol2.add_attribute (cell, "text", 1) + + tree_down = self.ui.get_object ("tree_clues_down") + tree_dcol1 = self.ui.get_object ("tree_clues_down").get_column (0) + tree_dcol2 = self.ui.get_object ("tree_clues_down").get_column (1) + tree_dcol1.pack_start (cell) + tree_dcol1.add_attribute (cell, "text", 0) + tree_dcol2.pack_start (cell) + tree_dcol2.add_attribute (cell, "text", 1) + + # connect the signals + self.ui.connect_signals (self) + + # set the window title + if file_to_play: + self.window.set_title ("GetAClue player - " + file_to_play) + + gtk.main () + + diff --git a/playerwindow.glade b/playerwindow.glade new file mode 100644 index 0000000..a52e5ef --- /dev/null +++ b/playerwindow.glade @@ -0,0 +1,202 @@ + + + + + + + + + + + + + + + + + + + + + + 480 + 360 + True + GetAClue player + + + + True + + + True + True + + + True + _File + True + + + True + True + + + True + Open... + True + + + + + True + + + + + True + Save _As... + True + + + + + True + _Quit + True + + + + + + + + + True + _View + True + + + True + True + + + True + Reveal _word... + True + + + + + True + Reveal _solution... + True + + + + + + + + + True + _Help + True + + + True + True + + + True + _About + True + + + + + + + + + False + 0 + + + + + True + + + 120 + 120 + True + + + 0 + + + + + True + True + + + 80 + 150 + True + True + clues_across + + + Number + + + + + Clue Across + + + + + False + True + + + + + 80 + 150 + True + True + clues_down + + + Number + + + + + Clue Down + + + + + True + True + + + + + 1 + + + + + 1 + + + + + + -- 2.20.1