~kelemeng/software-center/bug625859

« back to all changes in this revision

Viewing changes to softwarecenter/view/softwarepane.py

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt, Gary Lasker, Michael Vogt
  • Date: 2010-04-13 22:57:30 UTC
  • Revision ID: james.westby@ubuntu.com-20100413225730-swipvdrstx0jxn5z
Tags: 1.1.26
[ Gary Lasker ]
* softwarecenter/app.py,
  softwarecenter/view/softwarepane.py:
  - correctly refresh the availablepane view on a
    change to software sources (LP: #559539)
* softwarecenter/app.py,
  softwarecenter/view/availablepane.py,
  softwarecenter/view/navhistory.py:
  - clear navigation history on a software channel refresh
    because packages in the history stack might no longer
    be available

[ Michael Vogt ]
* softwarecenter/view/appdetailsview.py:
  - fix displaying removal warning when listview interface buttons
    are used (LP: #561018)

Show diffs side-by-side

added added

removed removed

Lines of Context:
151
151
    def on_application_request_action(self, appview, app, action):
152
152
        """callback when an app action is requested from the appview"""
153
153
        logging.debug("on_application_action_requested: '%s' %s" % (app, action))
 
154
        # FIXME: move the action-code below out of the appdetails and
 
155
        #        into some controller class
 
156
        # init the app_details here with the given app because we
 
157
        # reuse it 
154
158
        self.app_details.init_app(app)
 
159
        # action_func is "install" or "remove" of self.app_details
155
160
        action_func = getattr(self.app_details, action)
156
161
        if callable(action_func):
157
162
            action_func()
165
170
        first app in the list is selected.  If a row is already selected,
166
171
        nothing is done.
167
172
        """
 
173
        selected_iter = None
168
174
        selection = self.app_view.get_selection()
169
 
        (model, it) = selection.get_selected()
 
175
        model = self.app_view.get_model()
 
176
        if selection:
 
177
            selected_iter = selection.get_selected()[1]
170
178
        current_app = self.get_current_app()
171
 
        if (model is not None and
172
 
            model.get_iter_root() is not None
173
 
            and it is None):
 
179
        if (model is not None and 
 
180
            model.get_iter_root() is not None 
 
181
            and selected_iter is None):
174
182
            index=0
175
183
            vadj = self.scroll_app_list.get_vadjustment()
176
184
            if current_app:
177
 
                app_map = self.app_view.get_model().app_index_map
178
 
                if current_app in app_map:
179
 
                    index = app_map.get(current_app)
 
185
                if current_app in model.app_index_map:
 
186
                    index = model.app_index_map.get(current_app)
180
187
            # re-select item
181
188
            if vadj:
182
189
                self.app_view.set_cursor(index)