Permalink
Browse files

Initial commit

  • Loading branch information...
0 parents commit 7226198fbc22b255a1e5d4ed437e6ec8f553bce6 Luke Benstead committed Jan 24, 2012
Showing with 92 additions and 0 deletions.
  1. +29 −0 SPEC
  2. +63 −0 trophy-maker/main.py
29 SPEC
@@ -0,0 +1,29 @@
+Trophy Files
+
+Trophy files define the trophies that can be awarded by an application. These trophies must be installed to:
+
+/usr/share/trophies/app-name/
+
+Where app-name must have an associated .desktop file in /usr/share/applications
+
+Trophy files must have a .trophy extension and have the following settings
+
+[Trophy]
+ID=123456 # (required) A unique UUID specific to this trophy
+Name=My Trophy # (required) A short name for this trophy
+Description=My Trophy # (optional - defaults to Name) A longer description of this trophy
+Is-Secret=True # (optional - defaults to false) Whether or not this is a secret trophy
+Score=10 #(optional - defaults to zero) The number of points this trophy is worth
+Icon=/usr/share/app-name/trophy-icons/my_trophy.png #(required) An absolute path to the trophy icon on the system
+Depends=2345,3456,7890 #(optional) a list of trophy IDs that must be unlocked before this one is
+Unlock-Automatically=True #(optional - defaults to false) Unlock this trophy automatically if all trophies in Depends have been
+
+Unlocking a trophy
+
+When a trophy is unlocked, a new file is created in $XDG_DATA_HOME/trophies/app-name/$ID.unlocked where ID
+is the unique ID from the .trophy file. This file is another ini file that contains information about the unlock:
+
+[Unlock]
+Time=%Y-%m-%d %H:%M:%S
+
+
63 trophy-maker/main.py
@@ -0,0 +1,63 @@
+#!/usr/bin/env python
+
+import sys
+import uuid
+from gi.repository import Gtk
+
+class MainWindow(object):
+ LABEL_WIDTH = 100
+
+ def __init__(self, *args, **kwargs):
+ self._window = Gtk.Window()
+ self._window.connect("destroy", self.on_window_close)
+
+ self._construct_form()
+
+ self._window.set_title("Trophy Maker")
+ self._window.show_all()
+
+
+ def _construct_id_row(self):
+ self._id_label = Gtk.Label("ID")
+ self._id_label.set_size_request(self.LABEL_WIDTH, -1)
+ self._id_label.set_alignment(1.0, 0.5)
+
+ self._id_value = Gtk.Entry()
+ self._id_value.set_text(uuid.uuid1().hex)
+ self._id_value.set_sensitive(False)
+
+ self._id_box = Gtk.HBox()
+ self._id_box.pack_start(self._id_label, False, False, 5)
+ self._id_box.pack_start(self._id_value, False, False, 5)
+
+ return self._id_box
+
+ def _construct_name_row(self):
+ self._name_label = Gtk.Label("Name")
+ self._name_label.set_size_request(self.LABEL_WIDTH, -1)
+ self._name_label.set_alignment(1.0, 0.5)
+ self._name_value = Gtk.Entry()
+ self._name_box = Gtk.HBox()
+ self._name_box.pack_start(self._name_label, False, False, 5)
+ self._name_box.pack_start(self._name_value, False, False, 5)
+
+ return self._name_box
+
+ def _construct_form(self):
+ self._vbox = Gtk.VBox()
+ self._vbox.pack_start(self._construct_id_row(), False, False, 5)
+ self._vbox.pack_start(self._construct_name_row(), False, False, 5)
+
+ self._window.add(self._vbox)
+
+ def on_window_close(self, window):
+ Gtk.main_quit()
+
+def main():
+ window = MainWindow()
+ Gtk.main()
+
+ return 0
+
+if __name__ == '__main__':
+ sys.exit(main())

0 comments on commit 7226198

Please sign in to comment.