Added an icon and about dialog to player app
authorHarishankar <v.harishankar@gmail.com>
Wed, 8 Dec 2010 11:20:46 +0000 (16:50 +0530)
committerHarishankar <v.harishankar@gmail.com>
Wed, 8 Dec 2010 11:20:46 +0000 (16:50 +0530)
Added an icon and about dialog information to the player app.

player_mainwindow.py
playerwindow.glade
resources/getaclue.svg [new file with mode: 0644]

index 8234893..24fabf6 100644 (file)
@@ -4,6 +4,8 @@
 
 # Main window class for GetAClue player
 
+import sys
+import os.path
 import cPickle
 import pygtk
 pygtk.require20 ()
@@ -16,6 +18,19 @@ class MainWindow:
        # typing mode constants
        ACROSS = 1
        DOWN = 2
+       # license text to be displayed in the about dialog
+       LICENSE_TEXT = """GetAClue is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+GetAClue is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GetAClue.  If not, see <http://www.gnu.org/licenses/>."""
 
        # quit verification
        def verify_quit (self):
@@ -161,6 +176,10 @@ class MainWindow:
                                        puzgrid.queue_draw ()
                                dlg.destroy ()
 
+       # callback for menu help about activated event
+       def on_about_activate (self, menu_item):
+               # display the about dialog
+               self.about ()
 
        # function to set the selected row/col based on the number clicked
        # on the clues list and also set the typing mode
@@ -508,10 +527,28 @@ class MainWindow:
                        dlg.run ()
                        dlg.destroy ()
 
+       # about dialog
+       def about (self):
+               dlg = gtk.AboutDialog ()
+               dlg.set_name ("GetAClue Player")
+               dlg.set_copyright ("Copyright 2010 V.Harishankar")
+               dlg.set_website ("http://harishankar.org/software")
+               dlg.set_authors (("Harishankar",))
+               dlg.set_logo (self.window.get_icon())
+               dlg.set_license (self.LICENSE_TEXT)
+               dlg.set_comments ("Create and play Crossword puzzles")
+               dlg.run ()
+               dlg.destroy ()
+
        def __init__ (self, file_to_play = None):
                # load the user interface
                self.ui = gtk.Builder ()
-               self.ui.add_from_file ("playerwindow.glade")
+
+               # Path for the interface file - change this if you are distributing
+               # the application and put the icon, interface file in a different
+               # location!!
+               gladepath = os.path.join (sys.path[0], "playerwindow.glade")
+               self.ui.add_from_file (gladepath)
 
                # window object
                self.window = self.ui.get_object ("mainwindow")
index 32dc750..36dd5a6 100644 (file)
@@ -25,6 +25,7 @@
     <property name="title" translatable="yes">GetAClue player</property>
     <property name="default_width">640</property>
     <property name="default_height">480</property>
+    <property name="icon">resources/getaclue.svg</property>
     <signal name="destroy" handler="on_mainwindow_destroy"/>
     <signal name="delete_event" handler="on_mainwindow_delete_event"/>
     <child>
                         <property name="visible">True</property>
                         <property name="label" translatable="yes">_About</property>
                         <property name="use_underline">True</property>
+                        <signal name="activate" handler="on_about_activate"/>
                       </object>
                     </child>
                   </object>
diff --git a/resources/getaclue.svg b/resources/getaclue.svg
new file mode 100644 (file)
index 0000000..5d9ec9b
--- /dev/null
@@ -0,0 +1,134 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="64px"
+   height="64px"
+   id="svg2985"
+   version="1.1"
+   inkscape:version="0.48.0 r9654"
+   sodipodi:docname="getaclue.svg"
+   inkscape:export-filename="/home/hari/Projects/GetAClue/resources/getaclue.png"
+   inkscape:export-xdpi="96"
+   inkscape:export-ydpi="96">
+  <defs
+     id="defs2987" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="5.5"
+     inkscape:cx="32"
+     inkscape:cy="32"
+     inkscape:current-layer="layer1"
+     showgrid="true"
+     inkscape:document-units="px"
+     inkscape:grid-bbox="true"
+     inkscape:window-width="1280"
+     inkscape:window-height="725"
+     inkscape:window-x="0"
+     inkscape:window-y="25"
+     inkscape:window-maximized="1" />
+  <metadata
+     id="metadata2990">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     id="layer1"
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer">
+    <rect
+       style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.50000000000000000;stroke-linecap:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
+       id="rect2993"
+       width="60.18182"
+       height="60.363636"
+       x="2.1818182"
+       y="2" />
+    <path
+       style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.5;stroke-linecap:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
+       d="m 22.727273,2.5454545 0,59.6363635"
+       id="path2995"
+       inkscape:connector-curvature="0" />
+    <path
+       style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.5;stroke-linecap:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
+       d="M 42.545455,2.3636367 42.545455,62"
+       id="path2995-2"
+       inkscape:connector-curvature="0" />
+    <path
+       style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.5;stroke-linecap:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
+       d="M 2.5454545,22.363636 62,22.363636"
+       id="path3022"
+       inkscape:connector-curvature="0" />
+    <path
+       style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.5;stroke-linecap:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
+       d="m 3.2727273,42.545455 59.9999997,0"
+       id="path3024"
+       inkscape:connector-curvature="0" />
+    <path
+       style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.5;stroke-linecap:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
+       d="m 43.345455,12.236364 0,-9.3636367 9.090909,0 9.090909,0 0,9.3636367 0,9.363636 -9.090909,0 -9.090909,0 0,-9.363636 z"
+       id="path3028"
+       inkscape:connector-curvature="0" />
+    <path
+       style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.5;stroke-linecap:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
+       d="m 43.345455,32.509091 0,-9.272727 9.090909,0 9.090909,0 0,9.272727 0,9.272727 -9.090909,0 -9.090909,0 0,-9.272727 z"
+       id="path3030"
+       inkscape:connector-curvature="0" />
+    <path
+       style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.5;stroke-linecap:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
+       d="m 23.527273,32.509091 0,-9.272727 9.090909,0 9.090909,0 0,9.272727 0,9.272727 -9.090909,0 -9.090909,0 0,-9.272727 z"
+       id="path3032"
+       inkscape:connector-curvature="0" />
+    <text
+       xml:space="preserve"
+       style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:FreeSans;-inkscape-font-specification:FreeSans"
+       x="6.909091"
+       y="16.181818"
+       id="text3034"
+       sodipodi:linespacing="100%"><tspan
+         sodipodi:role="line"
+         id="tspan3036"
+         x="6.909091"
+         y="16.181818">G</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:FreeSans;-inkscape-font-specification:FreeSans"
+       x="7.454545"
+       y="37.090912"
+       id="text3038"
+       sodipodi:linespacing="100%"><tspan
+         sodipodi:role="line"
+         id="tspan3040"
+         x="7.454545"
+         y="37.090912">E</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:FreeSans;-inkscape-font-specification:FreeSans"
+       x="7.8181815"
+       y="57.272728"
+       id="text3042"
+       sodipodi:linespacing="100%"><tspan
+         sodipodi:role="line"
+         id="tspan3044"
+         x="7.8181815"
+         y="57.272728">T</tspan></text>
+  </g>
+</svg>