~ubuntu-branches/ubuntu/karmic/software-store/karmic

« back to all changes in this revision

Viewing changes to softwarestore/view/gbwidget.py

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt
  • Date: 2009-09-09 23:54:06 UTC
  • Revision ID: james.westby@ubuntu.com-20090909235406-kz21rix3vkozpkbs
Tags: 0.3.0
* merged from rugby471:
  - documentation updates
  - i18n fixes
* softwarestore/view/gbwidget.py:
  - add new Gtkbuilder widget base class
* softwarestore/view/appview.py:
  - allow a empty AppView
* softwarestore/view/installedpane.py:
  - composited widget that contains navigation, applist and search
    for the installed software
* softwarestore/view/availablepane.py:
  - composited widget that contains navigation, applist and search
    for the available software
* softwarestore/view/searchentry.py:
  - make the icon_theme optional
* make the status bar display the current number of items displayed
* center the status bar (LP: #424895)
* make menuitems "Copy", "Copy Weblink", "Software Sources" work
* updated po files from rosetta
* make the default size bigger (LP: #425862)
* merged the fixes from Murat Güneş (many thanks!)
* when using the navigation bar to navigate back one (or more)
  elements, remove the elements from the navigation bar 
  (LP: #425810)
* do not show "Search in Category", "Search in all" buttons. 
  Instead do the follwing: 
  - If the user clicks on "Get Free Software" while doing a search
    in a sub-Category clear the search and go to the Category screen.
  - If the user does click on the same button while doing a search
    that originates from the Category screen do not clear the search 
    and go back to the list of the search results (and not to the
    Category screen). The search must be cleared with the cleared
    via the search field in this case. 
  (LP: #425809)
* softwarestore/view/searchentry.py:
  - show/hide the clear item based on if there is text in it 
    or not
* help updates (thanks to Matthew Paul Thomas)
* make the progress bar less cramped (LP: #426281)
* make default icon size in category view 48px
* merged lp:~mpt/software-store/css branch (many thanks)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2009 Canonical
 
2
#
 
3
# Authors:
 
4
#  Michael Vogt
 
5
#
 
6
# This program is free software; you can redistribute it and/or modify it under
 
7
# the terms of the GNU General Public License as published by the Free Software
 
8
# Foundation; either version 3 of the License, or (at your option) any later
 
9
# version.
 
10
#
 
11
# This program is distributed in the hope that it will be useful, but WITHOUT
 
12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 
13
# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 
14
# details.
 
15
#
 
16
# You should have received a copy of the GNU General Public License along with
 
17
# this program; if not, write to the Free Software Foundation, Inc.,
 
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
19
 
 
20
 
 
21
import gobject
 
22
import gtk
 
23
import logging
 
24
import os
 
25
import sys
 
26
import string
 
27
 
 
28
class GtkbuilderWidget(gtk.HBox):
 
29
    """A widget that gets loaded from a Gtkbuilder UI file 
 
30
    
 
31
    If no "toplevel_name" paramter is given, the name of
 
32
    the class is used to find a UI file of that name and
 
33
    load the object with that name
 
34
    """
 
35
    def __init__(self, datadir, toplevel_name=None):
 
36
        gtk.HBox.__init__(self)
 
37
        if toplevel_name is None:
 
38
            toplevel_name = self.__class__.__name__
 
39
        ui_file = "%s/ui/%s.ui" % (datadir, toplevel_name)
 
40
        builder = gtk.Builder()
 
41
        builder.add_objects_from_file(ui_file, [toplevel_name])
 
42
        builder.connect_signals(self)
 
43
        for o in builder.get_objects():
 
44
            if issubclass(type(o), gtk.Buildable):
 
45
                name = gtk.Buildable.get_name(o)
 
46
                setattr(self, name, o)
 
47
            else:
 
48
                logging.warn("WARNING: can not get name for '%s'" % o)
 
49
        # parent
 
50
        w = getattr(self, self.__class__.__name__)
 
51
        self.add(w)
 
52
    def show(self):
 
53
        w = getattr(self, self.__class__.__name__)
 
54
        w.show_all()
 
55
 
 
56
# test widget that just loads the 
 
57
class GBTestWidget(GtkbuilderWidget):
 
58
 
 
59
    def on_button_clicked(self, button):
 
60
        print "on_button_clicked"
 
61
 
 
62
 
 
63
if __name__ == "__main__":
 
64
    logging.basicConfig(level=logging.DEBUG)
 
65
 
 
66
    if len(sys.argv) > 1:
 
67
        datadir = sys.argv[1]
 
68
    elif os.path.exists("./data"):
 
69
        datadir = "./data"
 
70
    else:
 
71
        datadir = "/usr/share/software-store"
 
72
 
 
73
    w = GBTestWidget(datadir)
 
74
    w.show()
 
75
 
 
76
    win = gtk.Window()
 
77
    win.add(w)
 
78
    #win.set_size_request(600,400)
 
79
    win.show_all()
 
80
 
 
81
    gtk.main()