Began working on the player application
authorHarishankar <v.harishankar@gmail.com>
Mon, 6 Dec 2010 12:59:06 +0000 (18:29 +0530)
committerHarishankar <v.harishankar@gmail.com>
Mon, 6 Dec 2010 12:59:06 +0000 (18:29 +0530)
Began working on the player application using PyGtk

crosswordpuzzlecreator.py
getaclue
getaclue_player [new file with mode: 0755]
player_mainwindow.py [new file with mode: 0644]
playerwindow.glade [new file with mode: 0644]

index a0676c7..4ffffb3 100644 (file)
@@ -3,6 +3,7 @@
 # Licensed under the GNU GPL v3
 
 # Cross puzzle creator class
+
 import sys
 import cPickle
 import readline
index f950a89..5cc5fe7 100755 (executable)
--- 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 (executable)
index 0000000..f13b52d
--- /dev/null
@@ -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 (file)
index 0000000..58de825
--- /dev/null
@@ -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 (file)
index 0000000..a52e5ef
--- /dev/null
@@ -0,0 +1,202 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <requires lib="gtk+" version="2.16"/>
+  <!-- interface-naming-policy project-wide -->
+  <object class="GtkListStore" id="clues_across">
+    <columns>
+      <!-- column-name Number -->
+      <column type="gchararray"/>
+      <!-- column-name Across -->
+      <column type="gchararray"/>
+    </columns>
+  </object>
+  <object class="GtkListStore" id="clues_down">
+    <columns>
+      <!-- column-name Number -->
+      <column type="gchararray"/>
+      <!-- column-name Down -->
+      <column type="gchararray"/>
+    </columns>
+  </object>
+  <object class="GtkWindow" id="mainwindow">
+    <property name="width_request">480</property>
+    <property name="height_request">360</property>
+    <property name="visible">True</property>
+    <property name="title" translatable="yes">GetAClue player</property>
+    <signal name="destroy" handler="gtk_main_quit"/>
+    <child>
+      <object class="GtkVBox" id="vbox1">
+        <property name="visible">True</property>
+        <child>
+          <object class="GtkMenuBar" id="menubar1">
+            <property name="visible">True</property>
+            <property name="ubuntu_local">True</property>
+            <child>
+              <object class="GtkMenuItem" id="file">
+                <property name="visible">True</property>
+                <property name="label" translatable="yes">_File</property>
+                <property name="use_underline">True</property>
+                <child type="submenu">
+                  <object class="GtkMenu" id="menu1">
+                    <property name="visible">True</property>
+                    <property name="ubuntu_local">True</property>
+                    <child>
+                      <object class="GtkMenuItem" id="open">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">Open...</property>
+                        <property name="use_underline">True</property>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkSeparatorMenuItem" id="sep1">
+                        <property name="visible">True</property>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkMenuItem" id="save_as">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">Save _As...</property>
+                        <property name="use_underline">True</property>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkMenuItem" id="quit">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">_Quit</property>
+                        <property name="use_underline">True</property>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <child>
+              <object class="GtkMenuItem" id="view">
+                <property name="visible">True</property>
+                <property name="label" translatable="yes">_View</property>
+                <property name="use_underline">True</property>
+                <child type="submenu">
+                  <object class="GtkMenu" id="menu2">
+                    <property name="visible">True</property>
+                    <property name="ubuntu_local">True</property>
+                    <child>
+                      <object class="GtkMenuItem" id="revealword">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">Reveal _word...</property>
+                        <property name="use_underline">True</property>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkMenuItem" id="revealsolution">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">Reveal _solution...</property>
+                        <property name="use_underline">True</property>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <child>
+              <object class="GtkMenuItem" id="help">
+                <property name="visible">True</property>
+                <property name="label" translatable="yes">_Help</property>
+                <property name="use_underline">True</property>
+                <child type="submenu">
+                  <object class="GtkMenu" id="menu3">
+                    <property name="visible">True</property>
+                    <property name="ubuntu_local">True</property>
+                    <child>
+                      <object class="GtkMenuItem" id="about">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">_About</property>
+                        <property name="use_underline">True</property>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkHBox" id="hbox1">
+            <property name="visible">True</property>
+            <child>
+              <object class="GtkDrawingArea" id="puzzlegrid">
+                <property name="width_request">120</property>
+                <property name="height_request">120</property>
+                <property name="visible">True</property>
+              </object>
+              <packing>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkVPaned" id="vpaned1">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <child>
+                  <object class="GtkTreeView" id="tree_clues_across">
+                    <property name="width_request">80</property>
+                    <property name="height_request">150</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="model">clues_across</property>
+                    <child>
+                      <object class="GtkTreeViewColumn" id="number">
+                        <property name="title">Number</property>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkTreeViewColumn" id="clueacross">
+                        <property name="title">Clue Across</property>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="resize">False</property>
+                    <property name="shrink">True</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkTreeView" id="tree_clues_down">
+                    <property name="width_request">80</property>
+                    <property name="height_request">150</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="model">clues_down</property>
+                    <child>
+                      <object class="GtkTreeViewColumn" id="downnum">
+                        <property name="title">Number</property>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkTreeViewColumn" id="cluedown">
+                        <property name="title">Clue Down</property>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="resize">True</property>
+                    <property name="shrink">True</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>