~ubuntu-branches/ubuntu/lucid/software-store/lucid

« back to all changes in this revision

Viewing changes to softwarestore/app.py

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt, Andrew Higginson, Michael Vogt
  • Date: 2009-09-15 11:35:48 UTC
  • Revision ID: james.westby@ubuntu.com-20090915113548-rj13zzz8kgtk9zkk
Tags: 0.3.3
[ Andrew Higginson ]
* softwarestore/view/widgets/searchentry.py:
  - Included clearing of the main pane timeout
    when clicking the clear button in the search
    entry (LP: #423747)
  - Added correct behaviour when the search icon
    in the search entry is clicked
* softwarestore/data/ui/SoftwareStore.ui:
  - Made menu items have images (if they are enabled)
  - Added Undo, Redo, Cut, Copy, Paste, Delete Menu 
    items (LP: #426218)
  - Version bump and correct logo in about 
    dialog (LP: #428677)
* softwarestore/app.py:
  - Added functions for when the Edit menu items are 
    clicked (but not for Undo/Redo yet).
  - Added code to hide the Edit menu items when the 
    search entry is not focused
* data/icons/scalable/apps/software-store.svg:
  - removed obselete file
* data/icons/*/status/softwarestore-progress-*.png:
  - re-exported icons to be 24x24 and optimised
* software-store:
  - version bump
* data/templates/AppDetailsView.html:
  - made install/remove button disable itself 
    after click
* softwarestore/view/appdetailsview.py:
  - removed implemented FIXME

[ Michael Vogt ]
* softwarestore/view/appdetailsview.py:
  - ensure the gnome debconf frontend is used
  - make screenshot loading url configurable
  - cleanup
  - use internal viewer for large screenshot display 
    (thanks to Andrew Higginson)
  - made install/remove button enable again if the user
    cancels the action
  - use the new ShowImageDialog
  - detect if a package is not available for the given 
    architecture
  - add maintainance time to the status (LP: #427266)
* softwarestore/view/widgets/imagedialog.py:
  - new widget for the large screenshot display
* merged the help xml fixes from Matthew East (many thanks!)
  LP: #429897
* fix icon display in the progress view (LP: #428679)
* softwarestore/view/appview.py:
  - fix crash for applications with no summary
* softwarestore/view/widgets/searchentry.py:
  - add undo/redo (LP: #428291)
* softwarestore/app.py:
  - simply the copy/cut/paste
  - use undo/redo from searchentry 
  - fix crash for packages not available in cache (LP #428356)

Show diffs side-by-side

added added

removed removed

Lines of Context:
179
179
        self._selected_pkgname_for_page[page] = pkgname
180
180
        self.menuitem_copy.set_sensitive(True)
181
181
        self.menuitem_copy_web_link.set_sensitive(True)
182
 
 
183
 
    def on_menuitem_help_activate(self, menuitem):
184
 
        # run yelp
185
 
        p = subprocess.Popen(["yelp","ghelp:software-store"])
186
 
        # collect the exit status (otherwise we leave zombies)
187
 
        glib.timeout_add(1000, lambda p: p.poll() == None, p)
188
 
 
189
 
    def on_menuitem_close_activate(self, widget):
190
 
        gtk.main_quit()
191
 
 
192
 
    def on_menuitem_about_activate(self, widget):
193
 
        #print "about"
194
 
        self.aboutdialog.run()
195
 
        self.aboutdialog.hide()
196
 
 
 
182
    
197
183
    def on_window_main_delete_event(self, widget, event):
198
184
        gtk.main_quit()
199
 
 
 
185
        
200
186
    def on_view_switcher_changed(self, view_switcher, action):
201
187
        logging.debug("view_switcher_activated: %s %s" % (view_switcher,action))
202
188
        if action == self.NOTEBOOK_PAGE_AVAILABLE:
223
209
        self.update_status_bar()
224
210
        self.update_app_status_menu()
225
211
 
226
 
    def on_menuitem_view_all_activate(self, widget):
227
 
        if self._block_menuitem_view:
228
 
            return
229
 
        self.active_pane.apps_filter.set_supported_only(False)
230
 
        self.active_pane.refresh_apps()
231
 
 
232
 
    def on_menuitem_view_supported_only_activate(self, widget):
233
 
        if self._block_menuitem_view: 
234
 
            return
235
 
        self.active_pane.apps_filter.set_supported_only(True)
236
 
        self.active_pane.refresh_apps()
 
212
    # Menu Items
 
213
 
 
214
    def on_menuitem_install_activate(self, menuitem):
 
215
        self.active_pane.app_details.install()
 
216
 
 
217
    def on_menuitem_remove_activate(self, menuitem):
 
218
        self.active_pane.app_details.remove()
 
219
        
 
220
    def on_menuitem_close_activate(self, widget):
 
221
        gtk.main_quit()
 
222
 
 
223
    def on_menu_edit_activate(self, menuitem):
 
224
        """
 
225
        Check whether the search field is focused and if so, focus some items
 
226
        """
 
227
        state = self.active_pane.searchentry.is_focus()
 
228
        edit_menu_items = [self.menuitem_undo, 
 
229
                           self.menuitem_redo, 
 
230
                           self.menuitem_cut, 
 
231
                           self.menuitem_copy, 
 
232
                           self.menuitem_paste, 
 
233
                           self.menuitem_delete, 
 
234
                           self.menuitem_select_all]
 
235
        for item in edit_menu_items:
 
236
            item.set_sensitive(state)
 
237
 
 
238
    def on_menuitem_undo_activate(self, menuitem):
 
239
        self.active_pane.searchentry.undo()
 
240
        
 
241
    def on_menuitem_redo_activate(self, menuitem):
 
242
        self.active_pane.searchentry.redo()
 
243
 
 
244
    def on_menuitem_cut_activate(self, menuitem):
 
245
        self.active_pane.searchentry.cut_clipboard()
 
246
 
 
247
    def on_menuitem_copy_activate(self, menuitem):
 
248
        self.active_pane.searchentry.copy_clipboard()
 
249
 
 
250
    def on_menuitem_paste_activate(self, menuitem):
 
251
        self.active_pane.searchentry.paste_clipboard()
 
252
 
 
253
    def on_menuitem_delete_activate(self, menuitem):
 
254
        self.active_pane.searchentry.set_text("")
 
255
 
 
256
    def on_menuitem_select_all_activate(self, menuitem):
 
257
        self.active_pane.searchentry.select_region(0, -1)
 
258
 
 
259
    def on_menuitem_copy_web_link_activate(self, menuitem):
 
260
        page = self.notebook_view.get_current_page()
 
261
        try:
 
262
            pkg = self._selected_pkgname_for_page[page]
 
263
        except KeyError, e:
 
264
            return
 
265
        clipboard = gtk.Clipboard()
 
266
        clipboard.set_text(self.WEBLINK_URL % pkg)
237
267
 
238
268
    def on_menuitem_search_activate(self, widget):
239
 
        #print "on_menuitem_search_activate"
240
269
        if self.active_pane:
241
270
            self.active_pane.searchentry.grab_focus()
242
271
            self.active_pane.searchentry.select_region(0, -1)
263
292
            self.run_update_cache()
264
293
        self.window_main.set_sensitive(True)
265
294
 
266
 
    def on_menuitem_install_activate(self, menuitem):
267
 
        self.active_pane.app_details.install()
268
 
 
269
 
    def on_menuitem_remove_activate(self, menuitem):
270
 
        self.active_pane.app_details.remove()
271
 
 
272
 
    def on_menuitem_copy_activate(self, menuitem):
273
 
        page = self.notebook_view.get_current_page()
274
 
        try:
275
 
            app = self._selected_appname_for_page[page]
276
 
        except KeyError, e:
277
 
            return
278
 
        clipboard = gtk.Clipboard()
279
 
        clipboard.set_text(app)
280
 
 
281
 
    def on_menuitem_copy_web_link_activate(self, menuitem):
282
 
        page = self.notebook_view.get_current_page()
283
 
        try:
284
 
            pkg = self._selected_pkgname_for_page[page]
285
 
        except KeyError, e:
286
 
            return
287
 
        clipboard = gtk.Clipboard()
288
 
        clipboard.set_text(self.WEBLINK_URL % pkg)
 
295
    def on_menuitem_about_activate(self, widget):
 
296
        self.aboutdialog.run()
 
297
        self.aboutdialog.hide()
 
298
 
 
299
    def on_menuitem_help_activate(self, menuitem):
 
300
        # run yelp
 
301
        p = subprocess.Popen(["yelp","ghelp:software-store"])
 
302
        # collect the exit status (otherwise we leave zombies)
 
303
        glib.timeout_add(1000, lambda p: p.poll() == None, p)
 
304
 
 
305
    def on_menuitem_view_all_activate(self, widget):
 
306
        if self._block_menuitem_view:
 
307
            return
 
308
        self.active_pane.apps_filter.set_supported_only(False)
 
309
        self.active_pane.refresh_apps()
 
310
 
 
311
    def on_menuitem_view_supported_only_activate(self, widget):
 
312
        if self._block_menuitem_view: 
 
313
            return
 
314
        self.active_pane.apps_filter.set_supported_only(True)
 
315
        self.active_pane.refresh_apps()
289
316
 
290
317
    # helper
291
318
 
327
354
        except KeyError, e:
328
355
            self.menuitem_install.set_sensitive(False)
329
356
            self.menuitem_remove.set_sensitive(False)
330
 
            self.menuitem_copy.set_sensitive(False)
331
357
            self.menuitem_copy_web_link.set_sensitive(False)
332
358
            return False
333
359
        # wait for the cache to become ready (if needed)
340
366
            self.menuitem_remove.set_sensitive(False)
341
367
            self.menuitem_copy_web_link.set_sensitive(False)
342
368
        # update File menu status
343
 
        pkg = self.cache[pkgname]
344
 
        installed = bool(pkg.installed)
345
 
        self.menuitem_install.set_sensitive(not installed)
346
 
        self.menuitem_remove.set_sensitive(installed)
 
369
        if self.cache.has_key(pkgname):
 
370
            pkg = self.cache[pkgname]
 
371
            installed = bool(pkg.installed)
 
372
            self.menuitem_install.set_sensitive(not installed)
 
373
            self.menuitem_remove.set_sensitive(installed)
 
374
        else:
 
375
            self.menuitem_install.set_sensitive(False)
 
376
            self.menuitem_remove.set_sensitive(False)
347
377
        # return False to ensure that a possible glib.timeout_add ends
348
378
        return False
349
379
 
384
414
        self.window_main.show_all()
385
415
        SimpleGtkbuilderApp.run(self)
386
416
 
387
 
    #FIXME: dead-code in multi-view
388
 
    def on_button_home_clicked(self, widget):
389
 
        logging.debug("on_button_home_clicked")
390
 
        # we get the clicked signal when the radio-group toggles
391
 
        # so we do not react unless we were not already pressed in
392
 
        if not widget.get_active():
393
 
            return
394
 
        self.apps_category_query = None
395
 
        # HACK: ensure that no signal term-changed is send, otherwise
396
 
        #       self.on_search_entry_changed() is called and that
397
 
        #       moves to a new notebook page 
398
 
        # FIXME: deal with it in a cleaner way
399
 
        self.entry_search.clear_with_no_signal()
400
 
        self.change_notebook_view(self.NOTEBOOK_PAGE_CATEGORIES)
401
417
 
402
418