~nataliabidart/software-center/winged-migration

« back to all changes in this revision

Viewing changes to softwarecenter/ui/gtk3/views/appdetailsview.py

  • Committer: Natalia B. Bidart
  • Date: 2012-05-30 18:39:55 UTC
  • mto: This revision was merged to the branch mainline in revision 3030.
  • Revision ID: natalia.bidart@canonical.com-20120530183955-zbnjczayktmmg5tv
- Initial test cleanup:
  - Renamed test/ dir to tests/.
  - Isolated test code into tests/ directory, including moving all the
    get_test_window_foo from the gtk3 production modules to
    tests/gtk3/windows.py module.
  - Removed all the calls to Gtk.main() in gtk3 tests since that blocks the
    execution of the suite.
  - Pep8 and pyflakes fixes in the files already modified in this branch.
  - Minor bug fix in the softwarecenter/log.py module when trying to create a
    log dir with proper perms.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2040
2040
 
2041
2041
    def set_section(self, section):
2042
2042
        self.section = section
2043
 
 
2044
 
 
2045
 
def get_test_window_appdetails():
2046
 
 
2047
 
    from softwarecenter.db.pkginfo import get_pkg_info
2048
 
    cache = get_pkg_info()
2049
 
    cache.open()
2050
 
 
2051
 
    from softwarecenter.db.database import StoreDatabase
2052
 
    xapian_base_path = "/var/cache/software-center"
2053
 
    pathname = os.path.join(xapian_base_path, "xapian")
2054
 
    db = StoreDatabase(pathname, cache)
2055
 
    db.open()
2056
 
 
2057
 
    import softwarecenter.paths
2058
 
    datadir = softwarecenter.paths.datadir
2059
 
 
2060
 
    from softwarecenter.ui.gtk3.utils import get_sc_icon_theme
2061
 
    icons = get_sc_icon_theme(datadir)
2062
 
 
2063
 
    import softwarecenter.distro
2064
 
    distro = softwarecenter.distro.get_distro()
2065
 
 
2066
 
    # gui
2067
 
    win = Gtk.Window()
2068
 
    scroll = Gtk.ScrolledWindow()
2069
 
    view = AppDetailsView(db, distro, icons, cache, datadir)
2070
 
 
2071
 
    import sys
2072
 
    if len(sys.argv) > 1:
2073
 
        pkgname = sys.argv[1]
2074
 
    else:
2075
 
        pkgname = "totem"
2076
 
 
2077
 
    view.show_app(Application("", pkgname))
2078
 
    #view.show_app(Application("Pay App Example", "pay-app"))
2079
 
    #view.show_app(Application("3D Chess", "3dchess"))
2080
 
    #view.show_app(Application("Movie Player", "totem"))
2081
 
    #view.show_app(Application("ACE", "unace"))
2082
 
    #~ view.show_app(Application("", "apt"))
2083
 
 
2084
 
    #view.show_app("AMOR")
2085
 
    #view.show_app("Configuration Editor")
2086
 
    #view.show_app("Artha")
2087
 
    #view.show_app("cournol")
2088
 
    #view.show_app("Qlix")
2089
 
 
2090
 
    scroll.add(view)
2091
 
    scroll.show()
2092
 
    win.add(scroll)
2093
 
    win.set_size_request(600, 800)
2094
 
    win.show()
2095
 
    win.connect('destroy', Gtk.main_quit)
2096
 
    win.set_data("view", view)
2097
 
    return win
2098
 
 
2099
 
 
2100
 
if __name__ == "__main__":
2101
 
    def _show_app(view):
2102
 
        if view.app.pkgname == "totem":
2103
 
            view.show_app(Application("Pithos", "pithos"))
2104
 
        else:
2105
 
            view.show_app(Application("Movie Player", "totem"))
2106
 
        return True
2107
 
 
2108
 
    win = get_test_window_appdetails()
2109
 
 
2110
 
    # keep it spinning to test for re-draw issues and memleaks
2111
 
    #view = win.get_data("view")
2112
 
    #GObject.timeout_add_seconds(2, _show_app, view)
2113
 
 
2114
 
    # run it
2115
 
    Gtk.main()