~mvo/software-center/new-apps-icons

« back to all changes in this revision

Viewing changes to softwarecenter/app.py

* merged lp:~kiwinote/software-center/getting-the-small-things-right
  and tweaked it a little bit
* softwarecenter/app.py:
  - save/restore sidebar width (LP: #567128)
  - don't crash if active_pane doesn't have a searchentry (LP: #611718)
* softwarecenter/db/application.py:
  - add new "display_name" and "display_summary" - when app has no appname, 
    display the summary as primary text (per spec)
    LP: #537436
* softwarecenter/view/appdetailsview_gtk.py:
  - use "display_name" and "display_summary" (LP: #537436)
* softwarecenter/view/availablepane.py:
  - correctly update the status bar after filtering by support status 
    LP: #528062
* softwarecenter/view/basepane.py:
  - basepane doesn't contain a searchentry

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
import sys
32
32
import xapian
33
33
 
34
 
 
35
34
from SimpleGtkbuilderApp import SimpleGtkbuilderApp
36
35
 
37
36
from softwarecenter import Application
275
274
        self.view_switcher.show()
276
275
        self.view_switcher.connect("view-changed", 
277
276
                                   self.on_view_switcher_changed)
 
277
        self.view_switcher.width = self.scrolledwindow_viewswitcher.get_property('width-request')
 
278
        self.view_switcher.connect('size-allocate', self.on_viewswitcher_resized)
278
279
        self.view_switcher.set_view(VIEW_PAGE_AVAILABLE)
279
280
 
280
281
        # launchpad integration help, its ok if that fails
392
393
        self.update_status_bar()
393
394
        self.update_app_status_menu()
394
395
 
 
396
    def on_viewswitcher_resized(self, widget, allocation):
 
397
        self.view_switcher.width = allocation.width
 
398
 
395
399
    def _on_lp_login(self, lp, token):
396
400
        print "_on_lp_login"
397
401
        self._lp_login_successful = True
475
479
                           self.menuitem_search]
476
480
        for item in edit_menu_items:
477
481
            item.set_sensitive(False)
478
 
        if (self.active_pane and
 
482
        if (self.active_pane and self.active_pane.searchentry and
479
483
            self.active_pane.searchentry.flags() & gtk.VISIBLE):
480
484
            # undo, redo, cut, copy, paste, delete, select_all sensitive 
481
485
            # if searchentry is focused (and other more specific conditions)
797
801
        if (self.config.has_option("general", "installed-node-expanded") and
798
802
            self.config.getboolean("general", "installed-node-expanded")):
799
803
            self.view_switcher.expand_installed_node()
 
804
        if (self.config.has_option("general", "sidebar-width")):
 
805
            width = int(self.config.get("general", "sidebar-width"))
 
806
            self.scrolledwindow_viewswitcher.set_property('width_request', width)
800
807
 
801
808
    def save_state(self):
802
809
        self._logger.debug("save_state")
823
830
            self.config.set("general", "installed-node-expanded", "True")
824
831
        else:
825
832
            self.config.set("general", "installed-node-expanded", "False")
 
833
        width = self.view_switcher.width
 
834
        if width != 1:
 
835
            width += 2
 
836
        self.config.set("general", "sidebar-width", str(width))
826
837
        self.config.write()
827
838
 
828
839
    def run(self, args):