127
128
primary = "primary text"
128
129
button_text = "button_text"
129
130
dia = dependency_dialogs._get_confirm_internal_dialog(
130
parent=None, datadir=softwarecenter.paths.datadir, app=app,
131
parent=None, app=app,
131
132
db=db, icons=icons, primary=primary, button_text=button_text,
132
133
depends=depends, cache=db._aptcache)
139
140
db = get_test_db()
140
141
app = application.Application("", "p7zip-full")
141
142
return dependency_dialogs.confirm_remove(None,
142
softwarecenter.paths.datadir, app, db, icons)
145
146
def get_query_from_search_entry(search_term):
265
265
navhistory_forward_action = Gtk.Action("navhistory_forward_action",
266
266
"Forward", "Forward", None)
268
w = availablepane.AvailablePane(cache, db, 'Ubuntu', icons, datadir,
268
w = availablepane.AvailablePane(cache, db, 'Ubuntu', icons,
269
269
navhistory_back_action, navhistory_forward_action)
281
281
vm = get_test_gtk3_viewmanager()
282
282
db = get_test_db()
283
283
cache = get_test_pkg_info()
284
datadir = get_test_datadir()
285
284
icons = get_test_gtk3_icon_cache()
287
p = globalpane.GlobalPane(vm, datadir, db, cache, icons)
286
p = globalpane.GlobalPane(vm, db, cache, icons)
289
288
win = get_test_window(child=p)
290
289
win.set_data("pane", p)
310
309
cache = get_test_pkg_info()
311
310
db = get_test_db()
312
311
icons = get_test_gtk3_icon_cache()
313
datadir = get_test_datadir()
314
312
manager = get_test_gtk3_viewmanager()
316
view = viewswitcher.ViewSwitcher(manager, datadir, db, cache, icons)
314
view = viewswitcher.ViewSwitcher(manager, db, cache, icons)
318
316
scroll = Gtk.ScrolledWindow()
330
328
vm # make pyflakes happy
331
329
db = get_test_db()
332
330
cache = get_test_pkg_info()
333
datadir = get_test_datadir()
334
331
icons = get_test_gtk3_icon_cache()
336
w = installedpane.InstalledPane(cache, db, 'Ubuntu', icons, datadir)
333
w = installedpane.InstalledPane(cache, db, 'Ubuntu', icons)
342
339
w.state.channel = channel.AllInstalledChannel()
343
view_state = softwarepane.DisplayState()
340
view_state = displaystate.DisplayState()
344
341
view_state.channel = channel.AllInstalledChannel()
345
342
w.display_overview_page(view_state)
357
354
cache = get_test_pkg_info()
358
355
icons = get_test_gtk3_icon_cache()
360
widget = historypane.HistoryPane(cache, db, None, icons, None)
357
widget = historypane.HistoryPane(cache, db, None, icons)
363
360
win = get_test_window(child=widget)
368
365
def get_test_window_recommendations(panel_type="lobby"):
369
# this is *way* too complicated we should *not* need a CatView
370
# here! see FIXME in RecommendationsPanel.__init__()
371
366
cache = get_test_pkg_info()
372
367
db = get_test_db()
373
368
icons = get_test_gtk3_icon_cache()
374
catview = catview_gtk.CategoriesViewGtk(softwarecenter.paths.datadir,
375
softwarecenter.paths.APP_INSTALL_PATH, cache, db, icons)
369
from softwarecenter.ui.gtk3.models.appstore2 import AppPropertiesHelper
370
properties_helper = AppPropertiesHelper(db, cache, icons)
377
372
if panel_type is "lobby":
378
view = recommendations.RecommendationsPanelLobby(catview)
373
view = recommendations.RecommendationsPanelLobby(
374
db, properties_helper)
379
375
elif panel_type is "category":
380
376
cats = get_test_categories(db)
381
view = recommendations.RecommendationsPanelCategory(catview, cats[0])
377
view = recommendations.RecommendationsPanelCategory(
378
db, properties_helper, cats[0])
382
379
else: # panel_type is "details":
383
view = recommendations.RecommendationsPanelDetails(catview)
380
view = recommendations.RecommendationsPanelDetails(
381
db, properties_helper)
385
win = get_test_window(child=view)
383
win = get_test_window(child=view, width=600, height=300)
386
384
win.set_data("rec_panel", view)
390
def get_test_window_catview(db=None):
388
def get_test_window_catview(db=None, selected_category="Internet"):
390
Note that selected_category must specify a category that includes
391
subcategories, else a ValueError will be raised.
392
393
def on_category_selected(view, cat):
393
394
print("on_category_selected view: ", view)
394
395
print("on_category_selected cat: ", cat)
405
406
cache = db._aptcache
407
datadir = softwarecenter.paths.datadir
408
icons = get_sc_icon_theme(datadir)
408
icons = get_sc_icon_theme()
409
409
distro = softwarecenter.distro.get_distro()
410
410
apps_filter = appfilter.AppFilter(db, cache)
413
413
notebook = Gtk.Notebook()
415
lobby_view = catview_gtk.LobbyViewGtk(softwarecenter.paths.datadir,
416
softwarecenter.paths.APP_INSTALL_PATH,
417
cache, db, icons, distro, apps_filter)
415
lobby_view = lobbyview.LobbyView(cache, db, icons, distro, apps_filter)
419
417
scroll = Gtk.ScrolledWindow()
420
418
scroll.add(lobby_view)
421
419
notebook.append_page(scroll, Gtk.Label(label="Lobby"))
423
# find a cat in the LobbyView that has subcategories
424
421
subcat_cat = None
425
for cat in reversed(lobby_view.categories):
426
if cat.subcategories:
422
for cat in lobby_view.categories:
423
if cat.name == selected_category:
424
if not cat.subcategories:
425
raise ValueError('The value specified for selected_category '
427
'category that contains subcategories!!')
430
subcat_view = catview_gtk.SubCategoryViewGtk(datadir,
431
softwarecenter.paths.APP_INSTALL_PATH, cache, db, icons, apps_filter)
431
subcat_view = catview.SubCategoryView(cache, db, icons, apps_filter)
432
432
subcat_view.connect("category-selected", on_category_selected)
433
433
subcat_view.set_subcategory(subcat_cat)
455
455
db = database.StoreDatabase(pathname, cache)
458
datadir = softwarecenter.paths.datadir
459
icons = get_sc_icon_theme(datadir)
458
icons = get_sc_icon_theme()
460
459
distro = softwarecenter.distro.get_distro()
461
460
apps_filter = appfilter.AppFilter(db, cache)
463
cat_view = catview_gtk.LobbyViewGtk(softwarecenter.paths.datadir,
464
softwarecenter.paths.APP_INSTALL_PATH,
465
cache, db, icons, distro, apps_filter)
462
cat_view = lobbyview.LobbyView(cache, db, icons, distro, apps_filter)
476
473
db = database.StoreDatabase(pathname, cache)
479
datadir = softwarecenter.paths.datadir
480
icons = get_sc_icon_theme(datadir)
476
icons = get_sc_icon_theme()
481
477
distro = softwarecenter.distro.get_distro()
484
480
scroll = Gtk.ScrolledWindow()
485
view = appdetailsview.AppDetailsView(db, distro, icons, cache, datadir)
481
view = appdetailsview.AppDetailsView(db, distro, icons, cache)
487
483
if pkgname is None:
488
484
pkgname = "totem"
517
513
db = database.StoreDatabase(pathname, cache)
520
datadir = softwarecenter.paths.datadir
521
icons = get_sc_icon_theme(datadir)
516
icons = get_sc_icon_theme()
522
517
pkgs = ["apt", "software-center"]
523
518
view = pkgnamesview.PackageNamesView("header", cache, pkgs, icons, 32, db)
557
def get_test_backforward_window():
552
def get_test_backforward_window(*args, **kwargs):
558
553
backforward_button = backforward.BackForwardButton()
559
win = get_test_window(child=backforward_button)
554
win = get_test_window(child=backforward_button, *args, **kwargs)
1044
1039
def get_test_screenshot_thumbnail_window():
1041
class CycleState(object):
1044
self.apps = [application.Application("Movie Player", "totem"),
1045
application.Application("Comix", "comix"),
1046
application.Application("Gimp", "gimp"),
1047
#application.Application("ACE", "uace"),
1050
def testing_cycle_apps(widget, thumb, db, cycle_state):
1051
d = cycle_state.apps[cycle_state.app_n].get_details(db)
1053
if cycle_state.app_n + 1 < len(cycle_state.apps):
1054
cycle_state.app_n += 1
1056
cycle_state.app_n = 0
1058
thumb.fetch_screenshots(d)
1061
cycle_state = CycleState()
1045
1063
vb = Gtk.VBox(spacing=6)
1046
1064
win = get_test_window(child=vb)
1048
icons = Gtk.IconTheme.get_default()
1049
icons.append_search_path("/usr/share/app-install/icons/")
1066
icons = get_test_gtk3_icon_cache()
1051
1067
distro = softwarecenter.distro.get_distro()
1053
init_sc_css_provider(win, Gtk.Settings.get_default(),
1054
Gdk.Screen.get_default(), "data")
1056
1069
t = thumbnail.ScreenshotGallery(distro, icons)
1057
1070
t.connect('draw', t.draw)
1058
1071
frame = containers.FramedBox()
1061
1074
win.set_data("screenshot_thumbnail_widget", t)
1063
b = Gtk.Button('A button for focus testing')
1064
vb.pack_start(b, True, True, 0)
1076
b = Gtk.Button('A button for cycle testing')
1077
vb.pack_start(b, False, False, 8)
1065
1078
win.set_data("screenshot_button_widget", b)
1066
1079
vb.pack_start(frame, True, True, 0)
1068
cache = pkginfo.get_pkg_info()
1071
xapian_base_path = "/var/cache/software-center"
1072
pathname = os.path.join(xapian_base_path, "xapian")
1073
db = database.StoreDatabase(pathname, cache)
1076
apps = [application.Application("Movie Player", "totem"),
1077
application.Application("Comix", "comix"),
1078
application.Application("Gimp", "gimp"),
1079
application.Application("ACE", "uace")]
1083
def testing_cycle_apps(_, thumb, apps, db):
1085
d = apps[app_n].get_details(db)
1087
if app_n + 1 < len(apps):
1092
thumb.fetch_screenshots(d)
1095
b.connect("clicked", testing_cycle_apps, t, apps, db)
1080
win.set_data("screenshot_thumbnail_cycle_test_button", b)
1085
testing_cycle_apps(None, t, db, cycle_state)
1086
b.connect("clicked", testing_cycle_apps, t, db, cycle_state)