~ubuntu-branches/ubuntu/lucid/software-center/lucid

« back to all changes in this revision

Viewing changes to softwarecenter/view/navhistory.py

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt, Gary Lasker, Michael Vogt
  • Date: 2010-03-11 16:58:00 UTC
  • Revision ID: james.westby@ubuntu.com-20100311165800-t1x7nerqb5dxjyeq
Tags: 1.1.17
[ Gary Lasker ]
* softwarecenter/view/navhistory.py:
  - unescape the nav button label text (LP: #531689)
  - fix up and just use a single __str__ method (LP: #531780)
* softwarecenter/view/availablepane.py,
  softwarecenter/view/channelpane.py:
  - fix intermittent AttributeError when a previous
    model does not exist when refreshing the apps view
    (LP: #531820)

[ Michael Vogt ]
* merged lp:~mpt/software-center/bug-499893 (thanks)
* merged lp:~mpt/software-center/categorization (thanks)
* merged lp:~michaelforrest/software-center/ui-changes (thanks)
* data/icons/scalable/apps/partner.svg:
  - add partner icon (LP: #531694)
* softwarecenter/view/catview.py:
  - do not show header in subsection view
* softwarecenter/view/availablepane.py:
  - fix race in initial part creation (LP: #531798)
* debian/control:
  - add gnome-app-install transitional package (closes: #572941)

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
import copy
19
19
import logging
20
20
 
 
21
from xml.sax.saxutils import unescape
 
22
 
 
23
# define additional entities for the nav button unescape, needed
 
24
# because only '&', '<', and '>' are included by default
 
25
ESCAPE_ENTITIES = {"'":"'",
 
26
                   '"':'"'}
 
27
 
21
28
# FIXME: sucks, move elsewhere
22
29
in_replay_history_mode = False
23
30
 
24
31
class NavigationHistory(object):
25
32
    """
26
 
    Class to manage navigation history in the "Get Software" section (the
 
33
    class to manage navigation history in the "Get Software" section (the
27
34
    available pane).
28
35
    """
29
36
    
80
87
        
81
88
class NavigationItem(object):
82
89
    """
83
 
    interface class to represent navigation points for use with the
84
 
    NavigationHistory class
 
90
    class to implement navigation points to be managed in the history queues
85
91
    """
86
92
 
87
93
    def __init__(self, available_pane):
94
100
    
95
101
    def navigate_to(self):
96
102
        """
97
 
        stub implementation - navigate to the view that corresponds
98
 
        to this NavigationItem
 
103
        navigate to the view that corresponds to this NavigationItem
99
104
        """
100
105
        global in_replay_history_mode
101
106
        in_replay_history_mode = True
108
113
        # first part is special and kept in remove_all
109
114
        self.available_pane.navigation_bar.remove_all()
110
115
        for part in self.parts[1:]:
111
 
            self.available_pane.navigation_bar.add_with_id(part.label, part.callback, part.id, do_callback=False, animate=False)
 
116
            self.available_pane.navigation_bar.add_with_id(unescape(part.label, ESCAPE_ENTITIES),
 
117
                                                           part.callback,
 
118
                                                           part.id,
 
119
                                                           do_callback=False,
 
120
                                                           animate=False)
112
121
        self.parts[-1].activate()
113
122
        in_replay_history_mode = False
114
123
        
 
124
    def __str__(self):
 
125
        details = []
 
126
        details.append("\n%s" % type(self))
 
127
        category_name = ""
 
128
        if self.apps_category:
 
129
            category_name = self.apps_category.name
 
130
        details.append("  apps_category.name: %s" % category_name)
 
131
        subcategory_name = ""
 
132
        if self.apps_subcategory:
 
133
            subcategory_name = self.apps_subcategory.name
 
134
        details.append("  apps_subcategory.name: %s" % subcategory_name)
 
135
        details.append("  current_app: %s" % self.current_app)
 
136
        details.append("  apps_search_term: %s" % self.apps_search_term)
 
137
        return '\n'.join(details)
 
138
        
115
139
class CategoryViewNavigationItem(NavigationItem):
116
140
    """
117
141
    navigation item that corresponds to the main category view
 
142
    Note: all subclasses of NavigationItem are for debug use only and
 
143
          can be collapsed to the NavigationItem class if desired
118
144
    """
119
 
 
120
 
    def __str__(self):
121
 
        return "* CategoryViewNavigationItem"
122
145
        
123
146
class AppListNavigationItem(NavigationItem):
124
147
    """
125
148
    navigation item that corresponds to the application list for the
126
149
    specified category
 
150
    Note: all subclasses of NavigationItem are for debug use only and
 
151
          can be collapsed to the NavigationItem class if desired
127
152
    """
128
 
        
129
 
    def __str__(self):
130
 
        details = []
131
 
        details.append("* AppListNavigationItem")
132
 
        details.append("\n")
133
 
        details.append("  apps_category.name: %s" % self.apps_category.name)
134
 
        details.append("\n")
135
 
        if (self.apps_subcategory):
136
 
            details.append("  apps_subcategory.name: %s" % self.apps_category.name)
137
 
        else:
138
 
            details.append("  apps_subcategory.name: none")
139
 
        details.append("\n")
140
 
        details.append("  apps_search_term: %s" % self.apps_search_term)
141
 
        return ''.join(details)
142
153
            
143
154
class AppListSubcategoryNavigationItem(NavigationItem):
144
155
    """
145
156
    navigation item that corresponds to the application list for the
146
157
    specified category and subcategory
 
158
    Note: all subclasses of NavigationItem are for debug use only and
 
159
          can be collapsed to the NavigationItem class if desired
147
160
    """
148
161
        
149
 
    def __str__(self):
150
 
        details = []
151
 
        details.append("* AppListSubcategoryNavigationItem")
152
 
        details.append("\n")
153
 
        details.append("  apps_category.name: %s" % self.apps_category.name)
154
 
        details.append("\n")
155
 
        if (self.apps_subcategory):
156
 
            details.append("  apps_subcategory.name: %s" % self.apps_subcategory.name)
157
 
        else:
158
 
            details.append("  apps_subcategory.name: none")
159
 
        details.append("\n")
160
 
        details.append("  apps_search_term: %s" % self.apps_search_term)
161
 
        return ''.join(details)
162
 
        
163
162
class AppDetailsNavigationItem(NavigationItem):
164
163
    """
165
164
    navigation item that corresponds to the details view for the
166
165
    specified application
 
166
    Note: all subclasses of NavigationItem are for debug use only and
 
167
          can be collapsed to the NavigationItem class if desired
167
168
    """
168
 
    def __str__(self):
169
 
        details = []
170
 
        details.append("* AppDetailsNavigationItem")
171
 
        details.append("\n")
172
 
        details.append("  apps_category.name: %s" % self.apps_category.name)
173
 
        details.append("\n")
174
 
        if (self.apps_subcategory):
175
 
            details.append("  apps_subcategory.name: %s" % self.apps_category.name)
176
 
        else:
177
 
            details.append("  apps_subcategory.name: none")
178
 
        details.append("\n")
179
 
        details.append("  current_app: %s" % self.current_app)
180
 
        return ''.join(details)
181
169
        
182
 
# TODO: remove this class if not needed
183
170
class SearchNavigationItem(NavigationItem):
184
171
    """
185
172
    navigation item that corresponds to a search in progress
 
173
    Note: all subclasses of NavigationItem are for debug use only and
 
174
          can be collapsed to the NavigationItem class if desired
186
175
    """