~mblayman/entertainer/summer-cleaning

« back to all changes in this revision

Viewing changes to entertainerlib/frontend/gui/screens/movie.py

  • Committer: Paul Hummer
  • Date: 2009-06-05 02:46:52 UTC
  • mfrom: (378.2.4 bug_380745)
  • Revision ID: paul@eventuallyanyway.com-20090605024652-pizf9wfgx4e9sor3
Movie screen handles empty data for genres, actors, directors or writters. (Fixes Bug 380745)

Show diffs side-by-side

added added

removed removed

Lines of Context:
72
72
        self.add(year)
73
73
 
74
74
        # Show only 2 genres (or one if there is only one)
75
 
        genres = self.movie.get_genres()
76
 
        if len(genres) > 1:
77
 
            genre = genres[0] + "/" + genres[1]
 
75
        genres_list = self.movie.get_genres()
 
76
        if len(genres_list) == 0:
 
77
            genres_text = _("Unknown")
78
78
        else:
79
 
            genre = genres[0]
 
79
            genres_text = "/".join(genres_list[:2])
80
80
 
81
81
        # Runtime and genres
82
82
        info_text = _("%(runtime)s min, %(genre)s") % \
83
 
            {'runtime': self.movie.get_runtime(), 'genre': genre}
 
83
            {'runtime': self.movie.get_runtime(), 'genre': genres_text}
84
84
        info = Label(0.032, "subtitle", 0.47, 0.24, info_text)
85
85
        info.set_ellipsize(pango.ELLIPSIZE_END)
86
86
        info.set_size(0.5124, 0.05208)
116
116
        self.add(self.scroll_area)
117
117
 
118
118
        # Actors
119
 
        act_title = Label(0.032, "title", 0.33, 0.8, _("Starring"))
120
 
        self.add(act_title)
 
119
        self.add(Label(0.032, "title", 0.33, 0.8, _("Starring")))
121
120
 
122
 
        actors_text = ", ".join(self.movie.get_actors()[:3])
 
121
        actors_list = self.movie.get_actors()
 
122
        if len(actors_list) == 0:
 
123
            actors_text = _("Unknown")
 
124
        else:
 
125
            actors_text = ", ".join(actors_list[:5])
123
126
        actors = Label(0.032, "subtitle", 0.46, 0.8, actors_text)
124
127
        actors.set_ellipsize(pango.ELLIPSIZE_END)
125
128
        actors.set_size(0.5124, 0.05208)
126
129
        self.add(actors)
127
130
 
128
131
        # Directors
129
 
        dict_title = Label(0.032, "title", 0.33, 0.86, _("Directed by"))
130
 
        self.add(dict_title)
 
132
        self.add(Label(0.032, "title", 0.33, 0.86, _("Directed by")))
131
133
 
132
 
        dlist = self.movie.get_directors()
133
 
        if len(dlist) > 1:
134
 
            director = dlist[0] + ", " + dlist[1]
 
134
        directors_list = self.movie.get_directors()
 
135
        if len(directors_list) == 0:
 
136
            directors_text = _("Unknown")
135
137
        else:
136
 
            director = dlist[0]
137
 
        directors = Label(0.032, "subtitle", 0.46, 0.86, director)
 
138
            directors_text = ", ".join(directors_list[:2])
 
139
        directors = Label(0.032, "subtitle", 0.46, 0.86, directors_text)
138
140
        directors.set_ellipsize(pango.ELLIPSIZE_END)
139
141
        directors.set_size(0.5124, 0.05208)
140
142
        self.add(directors)
141
143
 
142
144
        # Writers
143
 
        wri_title = Label(0.032, "title", 0.33, 0.92, _("Written by"))
144
 
        self.add(wri_title)
 
145
        self.add(Label(0.032, "title", 0.33, 0.92, _("Written by")))
145
146
 
146
 
        wlist = self.movie.get_writers()
147
 
        if len(wlist) > 1:
148
 
            writer = wlist[0] + ", " + wlist[1]
 
147
        writers_list = self.movie.get_writers()
 
148
        if len(directors_list) == 0:
 
149
            writers_text = _("Unknown")
149
150
        else:
150
 
            writer = wlist[0]
151
 
        writers = Label(0.032, "subtitle", 0.46, 0.92, writer)
 
151
            writers_text = ", ".join(writers_list[:2])
 
152
        writers = Label(0.032, "subtitle", 0.46, 0.92, writers_text)
152
153
        writers.set_ellipsize(pango.ELLIPSIZE_END)
153
154
        writers.set_size(0.5124, 0.05208)
154
155
        self.add(writers)