~mmcg069/software-center/Bug833697

« back to all changes in this revision

Viewing changes to AppCenter/AppCenter.py

  • Committer: Michael Vogt
  • Date: 2009-07-31 13:56:41 UTC
  • Revision ID: michael.vogt@ubuntu.com-20090731135641-s4fihta5teyhywlg
initialĀ UI

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
import gtk
 
3
import os
 
4
import xapian
 
5
 
 
6
 
 
7
from SimpleGtkbuilderApp import SimpleGtkbuilderApp
 
8
 
 
9
from view.appview import AppView, AppStore
 
10
from view.catview import CategoriesView
 
11
from view.viewswitcher import ViewSwitcher
 
12
 
 
13
 
 
14
XAPIAN_BASE_PATH = "/var/cache/app-install"
 
15
APP_INSTALL_PATH = "/usr/share/app-install"
 
16
ICON_PATH = APP_INSTALL_PATH+"/icons/"
 
17
 
 
18
class AppCenter(SimpleGtkbuilderApp):
 
19
    
 
20
    def __init__(self, datadir):
 
21
        SimpleGtkbuilderApp.__init__(self, datadir+"/ui/MptCenter.ui")
 
22
 
 
23
        # xapian
 
24
        xapian_base_path = XAPIAN_BASE_PATH
 
25
        pathname = os.path.join(xapian_base_path, "xapian")
 
26
        db = xapian.Database(pathname)
 
27
 
 
28
        # additional icons come from app-install-data
 
29
        icons = gtk.icon_theme_get_default()
 
30
        icons.append_search_path(ICON_PATH)
 
31
 
 
32
        # view switcher
 
33
        self.view_switcher = ViewSwitcher()
 
34
        self.scrolledwindow_viewswitcher.add(self.view_switcher)
 
35
        self.view_switcher.show()
 
36
 
 
37
        # categories
 
38
        self.cat_view = CategoriesView(APP_INSTALL_PATH, db, icons)
 
39
        self.scrolledwindow_categories.add(self.cat_view)
 
40
        self.cat_view.show()
 
41
        
 
42
        # apps
 
43
        store = AppStore(db, icons)
 
44
        self.app_view = AppView(store)
 
45
        self.scrolledwindow_applist.add(self.app_view)
 
46
        self.app_view.show()
 
47
 
 
48
    def run(self):
 
49
        self.window_main.show_all()
 
50
        SimpleGtkbuilderApp.run(self)