Added character window to Diablo UI.
authorDanny Campbell <danny.campbell@gmail.com>
Tue, 20 Apr 2010 09:45:01 +0000 (03:45 -0600)
committerDanny Campbell <danny.campbell@gmail.com>
Tue, 20 Apr 2010 09:45:01 +0000 (03:45 -0600)
ui/diablo/ui.py

index 72b33d7..904c8fc 100644 (file)
@@ -34,12 +34,83 @@ class mEveMonUI():
         # will probably need to refer to http://maemo.org/community/maemo-developers/gtktreeview_issue/ for sample code again when we make these clickable --danny
         self.char_model = self.create_char_model()
         treeview = gtk.TreeView( model = self.char_model )
+        treeview.connect( 'row-activated', self.build_window )
         treeview.set_model(self.char_model)
         self.add_columns_to_treeview(treeview)
 
         win.add(treeview)
         win.show_all()
   
+    def build_window(self, treeview, path, view_column):
+        win = hildon.Window()
+        win.show_all() 
+        #hildon.hildon_gtk_window_set_progress_indicator(win, 1)
+
+        # Create menu
+        # NOTE: we probably want a window-specific menu for this page, but the
+        # main appmenu works for now
+        menu = self.create_menu(win)
+        # Attach menu to the window
+        win.set_menu(menu)
+
+        #pannable_area = hildon.PannableArea()
+
+        model = treeview.get_model()
+        miter = model.get_iter(path)
+        
+        # column 0 is the portrait, column 1 is name
+
+        char_name = model.get_value(miter, 1)
+        char_id = self.controller.char_name2id(char_name)
+
+        win.set_title(char_name)
+        
+        skillLabel = gtk.Label("Skills")
+
+        # TODO: replace these with api calls
+        corp_name = ""
+        skill_points = 0
+
+        name = gtk.Label("Name: %s" % char_name)
+        name.set_alignment(0, 0.5)
+
+        corp = gtk.Label("Corp: %s" % corp_name)
+        corp.set_alignment(0, 0.5)
+
+        balance = gtk.Label("Balance: %s ISK" % 
+                self.controller.get_account_balance(char_id))
+        balance.set_alignment(0, 0.5)
+
+        sp = gtk.Label("Skill points: %s" % skill_points)
+        sp.set_alignment(0, 0.5)
+
+        portrait = gtk.Image()
+        portrait.set_from_file(self.controller.get_portrait(char_name, 256))
+        portrait.show()
+        
+        hbox = gtk.HBox(False, 0)
+
+        info_vbox = gtk.VBox(False, 0)
+        info_vbox.pack_start(name, False, False, 1)
+        info_vbox.pack_start(corp, False, False, 1)
+        info_vbox.pack_start(balance, False, False, 1)
+        info_vbox.pack_start(sp, False, False, 1)
+
+        hbox.pack_start(portrait, False, False, 10)
+        hbox.pack_start(info_vbox, False, False, 5)
+        #hbox.pack_start(stats_vbox, False, False, 5)
+        
+        vbox = gtk.VBox(False, 0)
+        #pannable_area.add(vbox)
+
+        vbox.pack_start(hbox, False, False, 0)
+        vbox.pack_start(skillLabel, False, False, 5)
+
+        win.add(vbox)
+        win.show_all()
+
+        #hildon.hildon_gtk_window_set_progress_indicator(win, 0)
+
     def create_char_model(self):
         lstore = gtk.ListStore(gtk.gdk.Pixbuf, gobject.TYPE_STRING)