~jonobacon/ubuntu-accomplishments-daemon/ubuntu-accomplishments-daemon

« back to all changes in this revision

Viewing changes to accomplishments/gui/TrophyinfoWindow.py

  • Committer: Jono Bacon
  • Date: 2012-04-08 17:21:44 UTC
  • Revision ID: jono@ubuntu.com-20120408172144-leas1ghodiohy943
 * Refined accomplishment info design from Brandon. :-)

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
from accomplishments.daemon import dbusapi
21
21
from accomplishments.gui.base import Window
22
 
from accomplishments.gui.base.helpers import get_media_file
 
22
from accomplishments.gui.base.helpers import get_media_file, get_data_path
23
23
from accomplishments.gui.AboutTrophyinfoDialog import AboutTrophyinfoDialog
24
24
from accomplishments.gui.PreferencesTrophyinfoDialog import (
25
25
    PreferencesTrophyinfoDialog)
144
144
        if self.connected is False:
145
145
            self.run_daemon()
146
146
 
 
147
        self.datapath = get_data_path()
 
148
 
147
149
        self.update_widgets_sensitivity()
148
150
 
149
151
        #self._load_accomplishments()
626
628
            a = self.libaccom.listTrophyInfo(accomplishment)
627
629
        else:
628
630
            a = self.libaccom.listAccomplishmentInfo(accomplishment)
629
 
 
630
 
        # not sure if this will be an issue when we package, but for
631
 
        # now this seems to work fine
632
 
        datadir = os.path.join(os.getcwd(), "accomplishments", "gui")
633
631
        
634
632
        title = None
635
633
        description = None
650
648
            if title in accom["title"]:
651
649
                iconpath = accom["iconpath"]
652
650
 
653
 
 
654
651
        html = "<!DOCTYPE html> \
655
652
        <html lang='en'> \
656
653
        <head> \
657
654
            <link href='http://fonts.googleapis.com/css?family=Ubuntu:400,700,400italic' rel='stylesheet' type='text/css'> \
658
 
            <link href='file://" + os.path.join(datadir, "information.css") + "' rel='stylesheet' type='text/css'></head> \
659
 
        <body class='container_8' background='http://www.ubuntu.com/sites/www.ubuntu.com/files/active/images/home-bkg.gif'>"
 
655
            <link href='file://" + os.path.join(self.datapath, "css", "information.css") + "' rel='stylesheet' type='text/css'></head> \
 
656
            <link href='file://" + os.path.join(self.datapath, "css", "font.css") + "' rel='stylesheet' type='text/css'> \
 
657
        <body class='container_8' background='" + get_media_file("home-bkg.gif") + "'>"
660
658
 
661
659
        if "title" in a[0]:
662
660
            html = html + "<div id='header' class='grid_8'> \
719
717
                            for depa in self.accomdb:
720
718
                                if depapp == depa["application"] and depaccom == depa["accomplishment"]:
721
719
                                    print depa["title"]
722
 
                                    html = html + "<li><img src='" + str(get_media_file("lock-icon.png")) + "' height='20' /> \
 
720
                                    html = html + "<li ><i class='icon-key icon-large'></i> \
723
721
                                    This is locked. You need to complete <strong>" + depa["title"] + "</strong> from <strong>" + depa["application-human"] + "</strong> first.</li>"
724
722
 
725
723
        if achieved is 1:
754
752
            #not achieved
755
753
            if "needs-signing" in a[0]:
756
754
                if a[0]["needs-signing"] == "true":
757
 
                    html = html + "<li><img src='" + str(get_media_file("verify-icon.png")) + "' height='20' /> \
 
755
                    html = html + "<li><i class='icon-trophy icon-large'></i> \
758
756
                        This accomplishment requires verification.</li> \
759
757
                        </ul>"
760
758
                        
776
774
            if "steps" in a[0]:
777
775
 
778
776
                html = html + "<div id='howto' class='grid_8'> \
 
777
                    <i class='icon-list'></i> \
779
778
                    <h2>How to achieve this trophy</h2> \
780
779
                    <ol>"
781
780
                
782
781
                steps = a[0]["steps"]
783
782
                for l in steps.split('\n'):
784
 
                    html = html + "<li>" + l + "</li>"
 
783
                    html = html + "<li class='icon-pushpin'>" + l + "</li>"
785
784
                html = html + "</ol> \
786
785
                    </div>"
787
786
 
794
793
                steps = a[0]["tips"]
795
794
                html = html + "<ul>"
796
795
                for l in steps.split('\n'):
797
 
                    html = html + "<li>" + l + "</li>"
 
796
                    html = html + "<li class='icon-ok'>" + l + "</li>"
798
797
                html = html + "</ul>"
799
798
                html = html + "</div>"
800
799
 
801
800
            if "pitfalls" in a[0]:
 
801
                html = html + "<div id='divider' class='left'>&nbsp;</div>"
802
802
                html = html + "<div class='grid_3 block left' id='pitfals'>"
803
803
                html = html + "<h2>Pitfalls To Avoid:</h2>"
804
804
                steps = a[0]["pitfalls"]
805
805
                html = html + "<ul>"
806
806
                for l in steps.split('\n'):
807
 
                    html = html + "<li>" + l + "</li>"
 
807
                    html = html + "<li class='icon-remove'>" + l + "</li>"
808
808
                html = html + "</ul>"
809
809
                html = html + "</div>"
810
810
 
817
817
                    <h2>Further Reading</h2>"
818
818
                html = html + "<ul>"
819
819
                for l in links.split('\n'):
820
 
                    html = html + "<li><a href='" + l + "'>" + l+ "</a></li>"
 
820
                    html = html + "<li><a href='" + l + "'><i class='icon-external-link icon-large'></i>" + l + "</a></li>"
821
821
                html = html + "</ul> \
822
822
                    </div>"
823
823
            # end of "if not achieved"