Merge lp:~mvo/software-center/path-cleansweep into lp:software-center

Proposed by Michael Vogt
Status: Merged
Merged at revision: 3191
Proposed branch: lp:~mvo/software-center/path-cleansweep
Merge into: lp:software-center
Diff against target: 978 lines (+95/-149)
27 files modified
software-center (+2/-2)
softwarecenter/db/categories.py (+2/-3)
softwarecenter/paths.py (+7/-4)
softwarecenter/ui/gtk3/app.py (+13/-17)
softwarecenter/ui/gtk3/dialogs/deauthorize_dialog.py (+1/-1)
softwarecenter/ui/gtk3/dialogs/dependency_dialogs.py (+8/-6)
softwarecenter/ui/gtk3/models/appstore2.py (+1/-3)
softwarecenter/ui/gtk3/panes/availablepane.py (+8/-18)
softwarecenter/ui/gtk3/panes/globalpane.py (+2/-2)
softwarecenter/ui/gtk3/panes/historypane.py (+1/-2)
softwarecenter/ui/gtk3/panes/installedpane.py (+4/-5)
softwarecenter/ui/gtk3/panes/softwarepane.py (+2/-4)
softwarecenter/ui/gtk3/panes/viewswitcher.py (+1/-1)
softwarecenter/ui/gtk3/session/appmanager.py (+2/-4)
softwarecenter/ui/gtk3/utils.py (+5/-2)
softwarecenter/ui/gtk3/views/appdetailsview.py (+2/-2)
softwarecenter/ui/gtk3/views/catview.py (+3/-8)
softwarecenter/ui/gtk3/views/lobbyview.py (+4/-5)
softwarecenter/ui/qml/categoriesmodel.py (+1/-3)
softwarecenter/utils.py (+1/-0)
tests/gtk3/test_app.py (+1/-4)
tests/gtk3/test_catview.py (+3/-7)
tests/gtk3/test_debfile_view.py (+1/-4)
tests/gtk3/test_memleak.py (+1/-4)
tests/gtk3/test_purchase.py (+1/-5)
tests/gtk3/windows.py (+16/-30)
tests/utils.py (+2/-3)
To merge this branch: bzr merge lp:~mvo/software-center/path-cleansweep
Reviewer Review Type Date Requested Status
Gary Lasker (community) Approve
Michael Vogt Needs Resubmitting
Review via email: mp+124646@code.launchpad.net

Description of the change

As discussed on irc on friday this branch eliminates the passing
around of datadir/desktopdir or xapian dir. The softwarecenter.paths
module is used for this information now.

To post a comment you must log in.
Revision history for this message
Gary Lasker (gary-lasker) wrote :

Hi Michael, at this point trunk has diverged somewhat dramatically. Would you mind fixing the conflicts, and then I will finish reviewing this? I don't mind doing it if you prefer, just let me know. Thanks!

Text conflict in softwarecenter/ui/gtk3/panes/availablepane.py
Text conflict in softwarecenter/ui/gtk3/views/lobbyview.py
Text conflict in tests/gtk3/test_catview.py
Text conflict in tests/gtk3/windows.py

review: Needs Fixing
3113. By Michael Vogt

merged trunk and resolved conflicts

Revision history for this message
Michael Vogt (mvo) wrote :

Conflicts resolved now.

review: Needs Resubmitting
Revision history for this message
Gary Lasker (gary-lasker) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'software-center'
2--- software-center 2012-09-18 00:08:10 +0000
3+++ software-center 2012-09-18 06:40:24 +0000
4@@ -118,7 +118,7 @@
5 Gtk.Widget.set_default_direction(Gtk.TextDirection.RTL)
6
7 # check if running locally
8- (datadir, xapian_base_path) = mangle_paths_if_running_in_local_checkout()
9+ mangle_paths_if_running_in_local_checkout()
10
11 # ensure we can actually run
12 Gtk.init_check(sys.argv)
13@@ -127,7 +127,7 @@
14 with ExecutionTime("import SoftwareCenterApp"):
15 from softwarecenter.ui.gtk3.app import SoftwareCenterAppGtk3
16 with ExecutionTime("create SoftwareCenterApp"):
17- app = SoftwareCenterAppGtk3(datadir, xapian_base_path, options, args)
18+ app = SoftwareCenterAppGtk3(options, args)
19
20 # DEBUG/PROFILE mode
21 if options.measure_startup_time:
22
23=== modified file 'softwarecenter/db/categories.py'
24--- softwarecenter/db/categories.py 2012-09-11 12:56:28 +0000
25+++ softwarecenter/db/categories.py 2012-09-18 06:40:24 +0000
26@@ -43,7 +43,6 @@
27 from softwarecenter.db.appfilter import AppFilter
28 from softwarecenter.db.enquire import AppEnquire
29 from softwarecenter.db.utils import get_query_for_pkgnames
30-from softwarecenter.paths import APP_INSTALL_PATH
31 from softwarecenter.region import get_region_cached
32 from softwarecenter.utils import utf8
33
34@@ -81,7 +80,7 @@
35
36 def get_query_for_category(db, untranslated_category_name):
37 cat_parser = CategoriesParser(db)
38- categories = cat_parser.parse_applications_menu(APP_INSTALL_PATH)
39+ categories = cat_parser.parse_applications_menu()
40 for c in categories:
41 if untranslated_category_name == c.untranslated_name:
42 query = c.query
43@@ -254,7 +253,7 @@
44 """ parse a application menu and return a list of Category objects """
45
46 if datadir is None:
47- datadir = softwarecenter.paths.APP_INSTALL_PATH
48+ datadir = softwarecenter.paths.desktopdir
49
50 # the DB must be part of the cache key because different DBs may
51 # yield different results (e.g. in the tests)
52
53=== modified file 'softwarecenter/paths.py'
54--- softwarecenter/paths.py 2012-08-23 14:35:48 +0000
55+++ softwarecenter/paths.py 2012-09-18 06:40:24 +0000
56@@ -34,9 +34,6 @@
57 # xdg_cache_home=os.path.expanduser("~/.cache"))
58 from xdg import BaseDirectory as xdg
59
60-# global datadir, this maybe overriden at startup
61-datadir = "/usr/share/software-center/"
62-
63 # system pathes
64 APP_INSTALL_PATH = "/usr/share/app-install"
65 APP_INSTALL_DESKTOP_PATH = APP_INSTALL_PATH + "/desktop/"
66@@ -70,10 +67,16 @@
67 APT_XAPIAN_INDEX_UPDATE_STAMP_PATH = (APT_XAPIAN_INDEX_BASE_PATH +
68 "/update-timestamp")
69
70+
71+# global datadirs, this maybe overriden at startup
72+datadir = "/usr/share/software-center/"
73+desktopdir = APP_INSTALL_PATH
74+xapiandir = XAPIAN_BASE_PATH
75+
76+
77 # OEM
78 OEM_CHANNEL_DESCRIPTOR = "/var/lib/ubuntu-dist-channel"
79
80-
81 # apport
82 APPORT_RECOVERABLE_ERROR = "/usr/share/apport/recoverable_problem"
83
84
85=== modified file 'softwarecenter/ui/gtk3/app.py'
86--- softwarecenter/ui/gtk3/app.py 2012-09-14 13:44:38 +0000
87+++ softwarecenter/ui/gtk3/app.py 2012-09-18 06:40:24 +0000
88@@ -257,16 +257,16 @@
89
90 START_DBUS = True
91
92- def __init__(self, datadir, xapian_base_path, options, args=None):
93+ def __init__(self, options, args=None):
94 self.dbusControler = None
95 if self.START_DBUS:
96 # setup dbus and exit if there is another instance already running
97 self.setup_dbus_or_bring_other_instance_to_front(args)
98
99- self.datadir = datadir
100+ self.datadir = softwarecenter.paths.datadir
101 super(SoftwareCenterAppGtk3, self).__init__(
102- datadir + "/ui/gtk3/SoftwareCenter.ui",
103- "software-center")
104+ os.path.join(self.datadir, "ui", "gtk3", "SoftwareCenter.ui"),
105+ "software-center")
106 gettext.bindtextdomain("software-center", "/usr/share/locale")
107 gettext.textdomain("software-center")
108
109@@ -291,6 +291,7 @@
110 # cache is opened later in run()
111 self.cache.connect("cache-broken", self._on_apt_cache_broken)
112
113+ xapian_base_path = softwarecenter.paths.XAPIAN_BASE_PATH
114 with ExecutionTime("opening the xapiandb"):
115 pathname = os.path.join(xapian_base_path, "xapian")
116 self._use_axi = not options.disable_apt_xapian_index
117@@ -314,13 +315,13 @@
118 dialogs.error(None,
119 _("Sorry, can not open the software database"),
120 _("Please re-install the 'software-center' "
121- "package."))
122+ "package."))
123 # FIXME: force rebuild by providing a dbus service for this
124 sys.exit(1)
125
126 # additional icons come from app-install-data
127 with ExecutionTime("building the icon cache"):
128- self.icons = get_sc_icon_theme(self.datadir)
129+ self.icons = get_sc_icon_theme()
130
131 # backend
132 with ExecutionTime("creating the backend"):
133@@ -352,23 +353,21 @@
134 # initial css loading
135 init_sc_css_provider(self.window_main,
136 settings,
137- Gdk.Screen.get_default(),
138- datadir)
139+ Gdk.Screen.get_default())
140
141 # wire up the css provider to reconfigure on theme-changes
142 self.window_main.connect("style-updated",
143 self._on_style_updated,
144 init_sc_css_provider,
145 settings,
146- Gdk.Screen.get_default(),
147- datadir)
148+ Gdk.Screen.get_default())
149
150 # register view manager and create view panes/widgets
151 self.view_manager = ViewManager(self.notebook_view, options)
152
153 with ExecutionTime("building panes"):
154- self.global_pane = GlobalPane(self.view_manager, self.datadir,
155- self.db, self.cache, self.icons)
156+ self.global_pane = GlobalPane(self.view_manager, self.db,
157+ self.cache, self.icons)
158 self.vbox1.pack_start(self.global_pane, False, False, 0)
159 self.vbox1.reorder_child(self.global_pane, 1)
160
161@@ -381,7 +380,6 @@
162 self.db,
163 self.distro,
164 self.icons,
165- self.datadir,
166 self.navhistory_back_action,
167 self.navhistory_forward_action)
168 self.available_pane.connect("available-pane-created",
169@@ -393,8 +391,7 @@
170 self.installed_pane = InstalledPane(self.cache,
171 self.db,
172 self.distro,
173- self.icons,
174- self.datadir)
175+ self.icons)
176 self.installed_pane.connect("installed-pane-created",
177 self.on_installed_pane_created)
178 self.view_manager.register(self.installed_pane,
179@@ -404,8 +401,7 @@
180 self.history_pane = HistoryPane(self.cache,
181 self.db,
182 self.distro,
183- self.icons,
184- self.datadir)
185+ self.icons)
186 self.view_manager.register(self.history_pane, ViewPages.HISTORY)
187
188 # pending pane
189
190=== modified file 'softwarecenter/ui/gtk3/dialogs/deauthorize_dialog.py'
191--- softwarecenter/ui/gtk3/dialogs/deauthorize_dialog.py 2012-03-15 01:39:09 +0000
192+++ softwarecenter/ui/gtk3/dialogs/deauthorize_dialog.py 2012-09-18 06:40:24 +0000
193@@ -95,7 +95,7 @@
194 datadir = "/usr/share/software-center"
195
196 from softwarecenter.ui.gtk3.utils import get_sc_icon_theme
197- icons = get_sc_icon_theme(datadir)
198+ icons = get_sc_icon_theme()
199
200 Gtk.Window.set_default_icon_name("softwarecenter")
201
202
203=== modified file 'softwarecenter/ui/gtk3/dialogs/dependency_dialogs.py'
204--- softwarecenter/ui/gtk3/dialogs/dependency_dialogs.py 2012-05-30 18:39:55 +0000
205+++ softwarecenter/ui/gtk3/dialogs/dependency_dialogs.py 2012-09-18 06:40:24 +0000
206@@ -21,6 +21,7 @@
207
208 from gettext import gettext as _
209
210+import softwarecenter.paths
211 from softwarecenter.ui.gtk3.dialogs import SimpleGtkbuilderDialog
212
213 from softwarecenter.distro import get_distro
214@@ -36,7 +37,7 @@
215 _DIALOG = None
216
217
218-def confirm_install(parent, datadir, app, db, icons):
219+def confirm_install(parent, app, db, icons):
220 """Confirm install of the given app
221
222 (currently only shows a dialog if a installed app needs to be removed
223@@ -53,11 +54,11 @@
224 return True
225 (primary, button_text) = distro.get_install_warning_text(cache,
226 appdetails.pkg, app.name, depends)
227- return _confirm_internal(parent, datadir, app, db, icons, primary,
228+ return _confirm_internal(parent, app, db, icons, primary,
229 button_text, depends, cache)
230
231
232-def confirm_remove(parent, datadir, app, db, icons):
233+def confirm_remove(parent, app, db, icons):
234 """ Confirm removing of the given app """
235 cache = db._aptcache
236 distro = get_distro()
237@@ -73,13 +74,14 @@
238 return True
239 (primary, button_text) = distro.get_removal_warning_text(
240 db._aptcache, appdetails.pkg, app.name, depends)
241- return _confirm_internal(parent, datadir, app, db, icons, primary,
242+ return _confirm_internal(parent, app, db, icons, primary,
243 button_text, depends, cache)
244
245
246-def _get_confirm_internal_dialog(parent, datadir, app, db, icons, primary,
247+def _get_confirm_internal_dialog(parent, app, db, icons, primary,
248 button_text, depends, cache):
249- glade_dialog = SimpleGtkbuilderDialog(datadir, domain="software-center")
250+ glade_dialog = SimpleGtkbuilderDialog(
251+ softwarecenter.paths.datadir, domain="software-center")
252 dialog = glade_dialog.dialog_dependency_alert
253 dialog.set_resizable(True)
254 dialog.set_transient_for(parent)
255
256=== modified file 'softwarecenter/ui/gtk3/models/appstore2.py'
257--- softwarecenter/ui/gtk3/models/appstore2.py 2012-09-11 04:16:01 +0000
258+++ softwarecenter/ui/gtk3/models/appstore2.py 2012-09-18 06:40:24 +0000
259@@ -40,7 +40,6 @@
260 from softwarecenter.backend.reviews import get_review_loader
261 from softwarecenter.paths import SOFTWARE_CENTER_ICON_CACHE_DIR
262
263-import softwarecenter.paths
264 from softwarecenter.db.categories import (
265 category_subcat, category_cat, CategoriesParser)
266
267@@ -106,8 +105,7 @@
268 # get all categories
269 cat_parser = CategoriesParser(db)
270 with ExecutionTime("cat_parser.parse_applications_menu()"):
271- self.all_categories = cat_parser.parse_applications_menu(
272- softwarecenter.paths.APP_INSTALL_PATH)
273+ self.all_categories = cat_parser.parse_applications_menu()
274
275 # reviews stats loader
276 self.review_loader = get_review_loader(cache, db)
277
278=== modified file 'softwarecenter/ui/gtk3/panes/availablepane.py'
279--- softwarecenter/ui/gtk3/panes/availablepane.py 2012-09-17 15:15:32 +0000
280+++ softwarecenter/ui/gtk3/panes/availablepane.py 2012-09-18 06:40:24 +0000
281@@ -37,8 +37,6 @@
282 DEFAULT_SEARCH_LIMIT,
283 TransactionTypes,
284 )
285-from softwarecenter.paths import APP_INSTALL_PATH
286-
287 from softwarecenter.utils import (
288 convert_desktop_file_to_installed_location,
289 is_no_display_desktop_file,
290@@ -97,11 +95,10 @@
291 db,
292 distro,
293 icons,
294- datadir,
295 navhistory_back_action,
296 navhistory_forward_action):
297 # parent
298- SoftwarePane.__init__(self, cache, db, distro, icons, datadir)
299+ SoftwarePane.__init__(self, cache, db, distro, icons)
300 self.searchentry.set_sensitive(False)
301 # navigation history actions
302 self.navhistory_back_action = navhistory_back_action
303@@ -171,25 +168,18 @@
304 self.scroll_categories = Gtk.ScrolledWindow()
305 self.scroll_categories.set_policy(Gtk.PolicyType.AUTOMATIC,
306 Gtk.PolicyType.AUTOMATIC)
307- with ExecutionTime("create LobbyView"):
308- self.cat_view = LobbyView(self.datadir, APP_INSTALL_PATH,
309- self.cache,
310- self.db,
311- self.icons,
312- self.apps_filter)
313+ with ExecutionTime("create LobbyViewGtk"):
314+ self.cat_view = LobbyView(
315+ self.cache, self.db, self.icons, self.apps_filter)
316 self.scroll_categories.add(self.cat_view)
317 self.notebook.append_page(self.scroll_categories,
318 Gtk.Label(label="categories"))
319
320 # sub-categories view
321- with ExecutionTime("create SubCategoryView"):
322- self.subcategories_view = SubCategoryView(self.datadir,
323- APP_INSTALL_PATH,
324- self.cache,
325- self.db,
326- self.icons,
327- self.apps_filter,
328- root_category=self.cat_view.categories[0])
329+ with ExecutionTime("create SubCategoryViewGtk"):
330+ self.subcategories_view = SubCategoryView(
331+ self.cache, self.db, self.icons, self.apps_filter,
332+ root_category=self.cat_view.categories[0])
333 self.subcategories_view.connect(
334 "category-selected", self.on_subcategory_activated)
335 self.subcategories_view.connect(
336
337=== modified file 'softwarecenter/ui/gtk3/panes/globalpane.py'
338--- softwarecenter/ui/gtk3/panes/globalpane.py 2012-05-30 18:39:55 +0000
339+++ softwarecenter/ui/gtk3/panes/globalpane.py 2012-09-18 06:40:24 +0000
340@@ -14,7 +14,7 @@
341
342 class GlobalPane(Gtk.Toolbar):
343
344- def __init__(self, view_manager, datadir, db, cache, icons):
345+ def __init__(self, view_manager, db, cache, icons):
346 Gtk.Toolbar.__init__(self)
347 context = self.get_style_context()
348 context.add_class(Gtk.STYLE_CLASS_PRIMARY_TOOLBAR)
349@@ -42,7 +42,7 @@
350 self._insert_as_tool_item(self.back_forward, 0)
351
352 # this is what actually draws the All Software, Installed etc buttons
353- self.view_switcher = ViewSwitcher(view_manager, datadir, db, cache,
354+ self.view_switcher = ViewSwitcher(view_manager, db, cache,
355 icons)
356 self._insert_as_tool_item(self.view_switcher, 1)
357
358
359=== modified file 'softwarecenter/ui/gtk3/panes/historypane.py'
360--- softwarecenter/ui/gtk3/panes/historypane.py 2012-08-22 06:49:53 +0000
361+++ softwarecenter/ui/gtk3/panes/historypane.py 2012-09-18 06:40:24 +0000
362@@ -58,13 +58,12 @@
363 (PAGE_HISTORY_VIEW,
364 PAGE_SPINNER) = range(2)
365
366- def __init__(self, cache, db, distro, icons, datadir):
367+ def __init__(self, cache, db, distro, icons):
368 Gtk.VBox.__init__(self)
369 self.cache = cache
370 self.db = db
371 self.distro = distro
372 self.icons = icons
373- self.datadir = datadir
374
375 self.apps_filter = None
376 self.state = DisplayState()
377
378=== modified file 'softwarecenter/ui/gtk3/panes/installedpane.py'
379--- softwarecenter/ui/gtk3/panes/installedpane.py 2012-08-30 12:37:38 +0000
380+++ softwarecenter/ui/gtk3/panes/installedpane.py 2012-09-18 06:40:24 +0000
381@@ -43,7 +43,6 @@
382 from softwarecenter.ui.gtk3.panes.softwarepane import SoftwarePane
383 from softwarecenter.backend.oneconfhandler import get_oneconf_handler
384 from softwarecenter.db.appfilter import AppFilter
385-from softwarecenter.paths import APP_INSTALL_PATH
386
387 LOG = logging.getLogger(__name__)
388
389@@ -89,11 +88,11 @@
390 None,
391 ())}
392
393- def __init__(self, cache, db, distro, icons, datadir):
394+ def __init__(self, cache, db, distro, icons):
395
396 # parent
397- SoftwarePane.__init__(self, cache, db, distro, icons, datadir,
398- show_ratings=False)
399+ SoftwarePane.__init__(self, cache, db, distro, icons,
400+ show_ratings=False)
401 CategoriesParser.__init__(self, db)
402
403 self.current_appview_selection = None
404@@ -200,7 +199,7 @@
405 self.app_view.tree_view.connect("row-collapsed",
406 self._on_row_collapsed)
407
408- self._all_cats = self.parse_applications_menu(APP_INSTALL_PATH)
409+ self._all_cats = self.parse_applications_menu()
410 self._all_cats = categories_sorted_by_name(self._all_cats)
411
412 # we do not support the search aid feature in the installedview
413
414=== modified file 'softwarecenter/ui/gtk3/panes/softwarepane.py'
415--- softwarecenter/ui/gtk3/panes/softwarepane.py 2012-08-31 03:43:19 +0000
416+++ softwarecenter/ui/gtk3/panes/softwarepane.py 2012-09-18 06:40:24 +0000
417@@ -68,7 +68,7 @@
418 }
419 PADDING = 6
420
421- def __init__(self, cache, db, distro, icons, datadir, show_ratings=True):
422+ def __init__(self, cache, db, distro, icons, show_ratings=True):
423
424 Gtk.VBox.__init__(self)
425 BasePane.__init__(self)
426@@ -82,7 +82,6 @@
427 self.db = db
428 self.distro = distro
429 self.icons = icons
430- self.datadir = datadir
431 self.show_ratings = show_ratings
432 self.backend = get_install_backend()
433 self.nonapps_visible = NonAppVisibility.MAYBE_VISIBLE
434@@ -159,8 +158,7 @@
435 self.app_details_view = AppDetailsView(self.db,
436 self.distro,
437 self.icons,
438- self.cache,
439- self.datadir)
440+ self.cache)
441 self.app_details_view.connect(
442 "different-application-selected", self.on_application_activated)
443 self.scroll_details.add(self.app_details_view)
444
445=== modified file 'softwarecenter/ui/gtk3/panes/viewswitcher.py'
446--- softwarecenter/ui/gtk3/panes/viewswitcher.py 2012-05-30 18:39:55 +0000
447+++ softwarecenter/ui/gtk3/panes/viewswitcher.py 2012-09-18 06:40:24 +0000
448@@ -44,7 +44,7 @@
449
450 ICON_SIZE = Gtk.IconSize.LARGE_TOOLBAR
451
452- def __init__(self, view_manager, datadir, db, cache, icons):
453+ def __init__(self, view_manager, db, cache, icons):
454 # boring stuff
455 self.view_manager = view_manager
456
457
458=== modified file 'softwarecenter/ui/gtk3/session/appmanager.py'
459--- softwarecenter/ui/gtk3/session/appmanager.py 2012-04-16 21:51:02 +0000
460+++ softwarecenter/ui/gtk3/session/appmanager.py 2012-09-18 06:40:24 +0000
461@@ -34,7 +34,6 @@
462 from softwarecenter.backend.transactionswatcher import (
463 TransactionFinishedResult,
464 )
465-import softwarecenter.paths
466
467 _appmanager = None # the global AppManager instance
468
469@@ -59,7 +58,6 @@
470 self.db = db
471 self.backend = backend
472 self.distro = get_distro()
473- self.datadir = softwarecenter.paths.datadir
474 self.icons = icons
475 self.oauth_token = ""
476
477@@ -86,7 +84,7 @@
478 appdetails = app.get_details(self.db)
479 if action == AppActions.REMOVE:
480 if not dependency_dialogs.confirm_remove(
481- None, self.datadir, app, self.db, self.icons):
482+ None, app, self.db, self.icons):
483 # craft an instance of TransactionFinishedResult to send
484 # with the transaction-stopped signal
485 result = TransactionFinishedResult(None, False)
486@@ -98,7 +96,7 @@
487 # also be removed and show a dialog for confirmation
488 # generic removal text (fixing LP bug #554319)
489 if not dependency_dialogs.confirm_install(
490- None, self.datadir, app, self.db, self.icons):
491+ None, app, self.db, self.icons):
492 # craft an instance of TransactionFinishedResult to send
493 # with the transaction-stopped signal
494 result = TransactionFinishedResult(None, False)
495
496=== modified file 'softwarecenter/ui/gtk3/utils.py'
497--- softwarecenter/ui/gtk3/utils.py 2012-08-07 13:15:08 +0000
498+++ softwarecenter/ui/gtk3/utils.py 2012-09-18 06:40:24 +0000
499@@ -23,6 +23,7 @@
500
501 from gi.repository import Gtk
502
503+import softwarecenter.paths
504 from softwarecenter.paths import ICON_PATH, SOFTWARE_CENTER_ICON_CACHE_DIR
505
506 LOG = logging.getLogger(__name__)
507@@ -47,7 +48,8 @@
508 rect.y <= py <= rect.y + rect.height)
509
510
511-def init_sc_css_provider(toplevel, settings, screen, datadir):
512+def init_sc_css_provider(toplevel, settings, screen):
513+ datadir = softwarecenter.paths.datadir
514 context = toplevel.get_style_context()
515 theme_name = settings.get_property("gtk-theme-name").lower()
516
517@@ -89,8 +91,9 @@
518 return css_path
519
520
521-def get_sc_icon_theme(datadir):
522+def get_sc_icon_theme():
523 # additional icons come from app-install-data
524+ datadir = softwarecenter.paths.datadir
525 icons = Gtk.IconTheme.get_default()
526 icons.append_search_path(ICON_PATH)
527 icons.append_search_path(os.path.join(datadir, "icons"))
528
529=== modified file 'softwarecenter/ui/gtk3/views/appdetailsview.py'
530--- softwarecenter/ui/gtk3/views/appdetailsview.py 2012-09-05 20:36:07 +0000
531+++ softwarecenter/ui/gtk3/views/appdetailsview.py 2012-09-18 06:40:24 +0000
532@@ -803,7 +803,7 @@
533 (GObject.TYPE_PYOBJECT, )),
534 }
535
536- def __init__(self, db, distro, icons, cache, datadir):
537+ def __init__(self, db, distro, icons, cache):
538 Viewport.__init__(self)
539 # basic stuff
540 self.db = db
541@@ -815,7 +815,7 @@
542 self.backend = get_install_backend()
543 self.cache.connect("cache-ready", self._on_cache_ready)
544 self.connect("destroy", self._on_destroy)
545- self.datadir = datadir
546+ self.datadir = softwarecenter.paths.datadir
547 self.app = None
548 self.appdetails = None
549 self.addons_to_install = []
550
551=== modified file 'softwarecenter/ui/gtk3/views/catview.py'
552--- softwarecenter/ui/gtk3/views/catview.py 2012-09-17 15:17:48 +0000
553+++ softwarecenter/ui/gtk3/views/catview.py 2012-09-18 06:40:24 +0000
554@@ -80,8 +80,6 @@
555 "ui/gtk3/art/stipple.png")
556
557 def __init__(self,
558- datadir,
559- desktopdir,
560 cache,
561 db,
562 icons,
563@@ -90,14 +88,11 @@
564
565 """ init the widget, takes
566
567- datadir - the base directory of the app-store data
568- desktopdir - the dir where the applications.menu file can be found
569 db - a Database object
570 icons - a Gtk.IconTheme
571 apps_filter - ?
572 apps_limit - the maximum amount of items to display to query for
573 """
574-
575 self.cache = cache
576 self.db = db
577 self.icons = icons
578@@ -193,10 +188,10 @@
579
580 class SubCategoryView(CategoriesView):
581
582- def __init__(self, datadir, desktopdir, cache, db, icons,
583+ def __init__(self, cache, db, icons,
584 apps_filter, apps_limit=0, root_category=None):
585- CategoriesView.__init__(self, datadir, desktopdir, cache, db, icons,
586- apps_filter, apps_limit)
587+ CategoriesView.__init__(self, cache, db, icons, apps_filter,
588+ apps_limit)
589 # state
590 self._built = False
591 # data
592
593=== modified file 'softwarecenter/ui/gtk3/views/lobbyview.py'
594--- softwarecenter/ui/gtk3/views/lobbyview.py 2012-09-17 15:17:48 +0000
595+++ softwarecenter/ui/gtk3/views/lobbyview.py 2012-09-18 06:40:24 +0000
596@@ -62,10 +62,10 @@
597
598 class LobbyView(CategoriesView):
599
600- def __init__(self, datadir, desktopdir, cache, db, icons,
601+ def __init__(self, cache, db, icons,
602 apps_filter, apps_limit=0):
603- CategoriesView.__init__(self, datadir, desktopdir, cache, db, icons,
604- apps_filter, apps_limit=0)
605+ CategoriesView.__init__(self, cache, db, icons, apps_filter,
606+ apps_limit=0)
607 self.top_rated = None
608 self.exhibit_banner = None
609
610@@ -75,8 +75,7 @@
611
612 # get categories
613 self.categories_parser = CategoriesParser(db)
614- self.categories = self.categories_parser.parse_applications_menu(
615- desktopdir)
616+ self.categories = self.categories_parser.parse_applications_menu()
617
618 # build before connecting the signals to avoid race
619 self.build()
620
621=== modified file 'softwarecenter/ui/qml/categoriesmodel.py'
622--- softwarecenter/ui/qml/categoriesmodel.py 2012-03-07 20:08:53 +0000
623+++ softwarecenter/ui/qml/categoriesmodel.py 2012-09-18 06:40:24 +0000
624@@ -33,7 +33,6 @@
625 from softwarecenter.db.database import StoreDatabase
626 from softwarecenter.db.pkginfo import get_pkg_info
627 from softwarecenter.paths import XAPIAN_BASE_PATH
628-import softwarecenter.paths
629
630
631 class CategoriesModel(QAbstractListModel):
632@@ -55,8 +54,7 @@
633 db.open()
634 # /FIXME
635 self.catparser = CategoriesParser(db)
636- self._categories = self.catparser.parse_applications_menu(
637- softwarecenter.paths.APP_INSTALL_PATH)
638+ self._categories = self.catparser.parse_applications_menu()
639
640 # QAbstractListModel code
641 def rowCount(self, parent=QModelIndex()):
642
643=== modified file 'softwarecenter/utils.py'
644--- softwarecenter/utils.py 2012-09-11 04:16:01 +0000
645+++ softwarecenter/utils.py 2012-09-18 06:40:24 +0000
646@@ -729,6 +729,7 @@
647 xapian_base_path = datadir
648 # set new global datadir
649 softwarecenter.paths.datadir = datadir
650+ softwarecenter.paths.XAPIAN_BASE_PATH = xapian_base_path
651 # also alter the app-install path
652 path = "./build/share/app-install/desktop/software-center.menu"
653 if os.path.exists(path):
654
655=== modified file 'tests/gtk3/test_app.py'
656--- tests/gtk3/test_app.py 2012-07-19 09:29:16 +0000
657+++ tests/gtk3/test_app.py 2012-09-18 06:40:24 +0000
658@@ -16,7 +16,6 @@
659
660 setup_test_env()
661
662-import softwarecenter.paths
663 from softwarecenter.db import DebFileApplication, DebFileOpenError
664 from softwarecenter.enums import PkgStates, SearchSeparators
665 from softwarecenter.ui.gtk3 import app
666@@ -210,10 +209,8 @@
667 self.addCleanup(setattr, app, 'get_pkg_info', orig)
668 app.get_pkg_info = lambda: FakedCache()
669
670- datadir = softwarecenter.paths.datadir
671- xapianpath = softwarecenter.paths.XAPIAN_BASE_PATH
672 options = get_mock_options()
673- self.app = app.SoftwareCenterAppGtk3(datadir, xapianpath, options)
674+ self.app = app.SoftwareCenterAppGtk3(options)
675 self.addCleanup(self.app.destroy)
676
677 self.app.cache.open()
678
679=== modified file 'tests/gtk3/test_catview.py'
680--- tests/gtk3/test_catview.py 2012-09-18 00:08:10 +0000
681+++ tests/gtk3/test_catview.py 2012-09-18 06:40:24 +0000
682@@ -91,8 +91,7 @@
683
684 apps_filter = AppFilter(db, cache)
685
686- view = lobbyview.LobbyView(softwarecenter.paths.datadir,
687- softwarecenter.paths.APP_INSTALL_PATH, cache, db, icons,
688+ view = lobbyview.LobbyView(cache, db, icons,
689 softwarecenter.distro.get_distro(), apps_filter)
690 view.show()
691
692@@ -377,13 +376,10 @@
693 """The test suite for the exhibits carousel."""
694
695 def setUp(self):
696- self.datadir = softwarecenter.paths.datadir
697- self.desktopdir = softwarecenter.paths.APP_INSTALL_PATH
698 self.cache = FakedCache()
699 self.db = StoreDatabase(cache=self.cache)
700- self.lobby = lobbyview.LobbyView(datadir=self.datadir,
701- desktopdir=self.desktopdir, cache=self.cache, db=self.db,
702- icons=None, apps_filter=None)
703+ self.lobby = lobbyview.LobbyView(cache=self.cache, db=self.db,
704+ icons=None, apps_filter=None)
705 self.addCleanup(self.lobby.destroy)
706
707 def _get_banner_from_lobby(self):
708
709=== modified file 'tests/gtk3/test_debfile_view.py'
710--- tests/gtk3/test_debfile_view.py 2012-05-30 18:39:55 +0000
711+++ tests/gtk3/test_debfile_view.py 2012-09-18 06:40:24 +0000
712@@ -8,7 +8,6 @@
713 )
714 setup_test_env()
715
716-import softwarecenter.paths
717 from softwarecenter.ui.gtk3.app import SoftwareCenterAppGtk3
718 from softwarecenter.ui.gtk3.panes.availablepane import AvailablePane
719
720@@ -17,9 +16,7 @@
721
722 def test_deb_file_view_error(self):
723 mock_options = get_mock_options()
724- xapianpath = softwarecenter.paths.XAPIAN_BASE_PATH
725- app = SoftwareCenterAppGtk3(
726- softwarecenter.paths.datadir, xapianpath, mock_options)
727+ app = SoftwareCenterAppGtk3(mock_options)
728 app.run(["./data/test_debs/gdebi-test1.deb"])
729 # give it time
730 for i in range(10):
731
732=== modified file 'tests/gtk3/test_memleak.py'
733--- tests/gtk3/test_memleak.py 2012-09-07 13:34:37 +0000
734+++ tests/gtk3/test_memleak.py 2012-09-18 06:40:24 +0000
735@@ -20,7 +20,6 @@
736 TraceMemoryUsage,
737 )
738
739-from softwarecenter import paths
740 from tests.gtk3.windows import (
741 get_test_window_appdetails,
742 get_test_window_catview,
743@@ -90,15 +89,13 @@
744 do_events_with_sleep()
745
746 def test_memleak_app(self):
747- datadir = paths.datadir
748- xapian_base_path = paths.XAPIAN_BASE_PATH
749 options = Mock()
750 options.display_navlog = False
751 args = []
752 # ensure the cache is fully ready before taking the baseline
753 cache = get_pkg_info()
754 cache.open(blocking=True)
755- app = SoftwareCenterAppGtk3(datadir, xapian_base_path, options, args)
756+ app = SoftwareCenterAppGtk3(options, args)
757 app.window_main.show_all()
758 do_events_with_sleep()
759 with TraceMemoryUsage("app._on_transaction_finished"):
760
761=== modified file 'tests/gtk3/test_purchase.py'
762--- tests/gtk3/test_purchase.py 2012-09-14 13:31:29 +0000
763+++ tests/gtk3/test_purchase.py 2012-09-18 06:40:24 +0000
764@@ -9,8 +9,6 @@
765 )
766 setup_test_env()
767
768-import softwarecenter.paths
769-
770 from softwarecenter.ui.gtk3.views import purchaseview
771 from softwarecenter.ui.gtk3.app import SoftwareCenterAppGtk3
772 from softwarecenter.ui.gtk3.panes.availablepane import AvailablePane
773@@ -79,9 +77,7 @@
774 def test_reinstall_previous_purchase_display(self, mock_find_token):
775 mock_find_token.return_value = { 'not': 'important' }
776 mock_options = get_mock_options()
777- xapiandb = "/var/cache/software-center/"
778- app = SoftwareCenterAppGtk3(
779- softwarecenter.paths.datadir, xapiandb, mock_options)
780+ app = SoftwareCenterAppGtk3(mock_options)
781 self.addCleanup(app.destroy)
782 # real app opens cache async
783 app.cache.open()
784
785=== modified file 'tests/gtk3/windows.py'
786--- tests/gtk3/windows.py 2012-09-18 04:37:10 +0000
787+++ tests/gtk3/windows.py 2012-09-18 06:40:24 +0000
788@@ -74,7 +74,6 @@
789 from tests.utils import (
790 do_events,
791 get_test_categories,
792- get_test_datadir,
793 get_test_db,
794 get_test_gtk3_icon_cache,
795 get_test_gtk3_viewmanager,
796@@ -130,7 +129,7 @@
797 primary = "primary text"
798 button_text = "button_text"
799 dia = dependency_dialogs._get_confirm_internal_dialog(
800- parent=None, datadir=softwarecenter.paths.datadir, app=app,
801+ parent=None, app=app,
802 db=db, icons=icons, primary=primary, button_text=button_text,
803 depends=depends, cache=db._aptcache)
804 return dia
805@@ -142,7 +141,7 @@
806 db = get_test_db()
807 app = application.Application("", "p7zip-full")
808 return dependency_dialogs.confirm_remove(None,
809- softwarecenter.paths.datadir, app, db, icons)
810+ app, db, icons)
811
812
813 def get_query_from_search_entry(search_term):
814@@ -254,7 +253,6 @@
815 assert vm is not None
816 db = get_test_db()
817 cache = get_test_pkg_info()
818- datadir = get_test_datadir()
819 icons = get_test_gtk3_icon_cache()
820 backend = get_test_install_backend()
821
822@@ -268,7 +266,7 @@
823 navhistory_forward_action = Gtk.Action("navhistory_forward_action",
824 "Forward", "Forward", None)
825
826- w = availablepane.AvailablePane(cache, db, 'Ubuntu', icons, datadir,
827+ w = availablepane.AvailablePane(cache, db, 'Ubuntu', icons,
828 navhistory_back_action, navhistory_forward_action)
829 w.init_view()
830 w.show()
831@@ -284,10 +282,9 @@
832 vm = get_test_gtk3_viewmanager()
833 db = get_test_db()
834 cache = get_test_pkg_info()
835- datadir = get_test_datadir()
836 icons = get_test_gtk3_icon_cache()
837
838- p = globalpane.GlobalPane(vm, datadir, db, cache, icons)
839+ p = globalpane.GlobalPane(vm, db, cache, icons)
840
841 win = get_test_window(child=p)
842 win.set_data("pane", p)
843@@ -313,10 +310,9 @@
844 cache = get_test_pkg_info()
845 db = get_test_db()
846 icons = get_test_gtk3_icon_cache()
847- datadir = get_test_datadir()
848 manager = get_test_gtk3_viewmanager()
849
850- view = viewswitcher.ViewSwitcher(manager, datadir, db, cache, icons)
851+ view = viewswitcher.ViewSwitcher(manager, db, cache, icons)
852
853 scroll = Gtk.ScrolledWindow()
854 box = Gtk.VBox()
855@@ -333,10 +329,9 @@
856 vm # make pyflakes happy
857 db = get_test_db()
858 cache = get_test_pkg_info()
859- datadir = get_test_datadir()
860 icons = get_test_gtk3_icon_cache()
861
862- w = installedpane.InstalledPane(cache, db, 'Ubuntu', icons, datadir)
863+ w = installedpane.InstalledPane(cache, db, 'Ubuntu', icons)
864 w.show()
865
866 # init the view
867@@ -360,7 +355,7 @@
868 cache = get_test_pkg_info()
869 icons = get_test_gtk3_icon_cache()
870
871- widget = historypane.HistoryPane(cache, db, None, icons, None)
872+ widget = historypane.HistoryPane(cache, db, None, icons)
873 widget.show()
874
875 win = get_test_window(child=widget)
876@@ -411,17 +406,14 @@
877 else:
878 cache = db._aptcache
879
880- datadir = softwarecenter.paths.datadir
881- icons = get_sc_icon_theme(datadir)
882+ icons = get_sc_icon_theme()
883 distro = softwarecenter.distro.get_distro()
884 apps_filter = appfilter.AppFilter(db, cache)
885
886 # gui
887 notebook = Gtk.Notebook()
888
889- lobby_view = lobbyview.LobbyView(softwarecenter.paths.datadir,
890- softwarecenter.paths.APP_INSTALL_PATH,
891- cache, db, icons, distro, apps_filter)
892+ lobby_view = lobbyview.LobbyView(cache, db, icons, distro, apps_filter)
893
894 scroll = Gtk.ScrolledWindow()
895 scroll.add(lobby_view)
896@@ -437,8 +429,7 @@
897 subcat_cat = cat
898 break
899
900- subcat_view = catview.SubCategoryView(datadir,
901- softwarecenter.paths.APP_INSTALL_PATH, cache, db, icons, apps_filter)
902+ subcat_view = catview.SubCategoryView(cache, db, icons, apps_filter)
903 subcat_view.connect("category-selected", on_category_selected)
904 subcat_view.set_subcategory(subcat_cat)
905
906@@ -465,14 +456,11 @@
907 db = database.StoreDatabase(pathname, cache)
908 db.open()
909
910- datadir = softwarecenter.paths.datadir
911- icons = get_sc_icon_theme(datadir)
912+ icons = get_sc_icon_theme()
913 distro = softwarecenter.distro.get_distro()
914 apps_filter = appfilter.AppFilter(db, cache)
915
916- cat_view = lobbyview.LobbyView(softwarecenter.paths.datadir,
917- softwarecenter.paths.APP_INSTALL_PATH,
918- cache, db, icons, distro, apps_filter)
919+ cat_view = lobbyview.LobbyView(cache, db, icons, distro, apps_filter)
920
921 return cat_view
922
923@@ -486,13 +474,12 @@
924 db = database.StoreDatabase(pathname, cache)
925 db.open()
926
927- datadir = softwarecenter.paths.datadir
928- icons = get_sc_icon_theme(datadir)
929+ icons = get_sc_icon_theme()
930 distro = softwarecenter.distro.get_distro()
931
932 # gui
933 scroll = Gtk.ScrolledWindow()
934- view = appdetailsview.AppDetailsView(db, distro, icons, cache, datadir)
935+ view = appdetailsview.AppDetailsView(db, distro, icons, cache)
936
937 if pkgname is None:
938 pkgname = "totem"
939@@ -527,8 +514,7 @@
940 db = database.StoreDatabase(pathname, cache)
941 db.open()
942
943- datadir = softwarecenter.paths.datadir
944- icons = get_sc_icon_theme(datadir)
945+ icons = get_sc_icon_theme()
946 pkgs = ["apt", "software-center"]
947 view = pkgnamesview.PackageNamesView("header", cache, pkgs, icons, 32, db)
948 view.show()
949@@ -1061,7 +1047,7 @@
950 distro = softwarecenter.distro.get_distro()
951
952 init_sc_css_provider(win, Gtk.Settings.get_default(),
953- Gdk.Screen.get_default(), "data")
954+ Gdk.Screen.get_default())
955
956 t = thumbnail.ScreenshotGallery(distro, icons)
957 t.connect('draw', t.draw)
958
959=== modified file 'tests/utils.py'
960--- tests/utils.py 2012-09-12 07:27:54 +0000
961+++ tests/utils.py 2012-09-18 06:40:24 +0000
962@@ -149,7 +149,7 @@
963
964
965 def get_test_gtk3_icon_cache():
966- icons = get_sc_icon_theme(softwarecenter.paths.datadir)
967+ icons = get_sc_icon_theme()
968 return icons
969
970
971@@ -165,8 +165,7 @@
972
973 def get_test_categories(db):
974 parser = CategoriesParser(db)
975- cats = parser.parse_applications_menu(
976- softwarecenter.paths.APP_INSTALL_PATH)
977+ cats = parser.parse_applications_menu()
978 return cats
979
980

Subscribers

People subscribed via source and target branches