def __init__(self, cache, db, distro, icons, datadir,
                 navhistory_back_action, navhistory_forward_action):
        # parent
        SoftwarePane.__init__(self, cache, db, distro, icons, datadir)
        self.searchentry.set_sensitive(False)
        # navigation history actions
        self.navhistory_back_action = navhistory_back_action
        self.navhistory_forward_action = navhistory_forward_action
        # configure any initial state attrs
        self.state.filter = AppFilter(db, cache)
        # the spec says we mix installed/not installed
        #self.apps_filter.set_not_installed_only(True)
        self.current_app_by_category = {}
        self.current_app_by_subcategory = {}
        self.pane_name = _("Get Software")

        # views to be created in init_view
        self.cat_view = None
        self.subcategories_view = None

        # integrate with the Unity launcher
        self.unity_launcher = UnityLauncher()
        # keep track of applications that are queued to be added
        # to the Unity launcher
        self.unity_launcher_transaction_queue = {}
        # flag to indicate whether applications should be added to the
        # unity launcher when installed (this value is initialized by
        # the config load in app.py)
        self.add_to_launcher_enabled = True
Exemple #2
0
    def test_apps_from_sc_agent(self, mock_dbus_iface):
        mock_iface = Mock()
        mock_dbus_iface.return_value = mock_iface
        launcher_info = UnityLauncherInfo(
            name="Meep", icon_name="icon-meep", 
            icon_file_path="/tmp/icon-meep.png", icon_x=15, icon_y=18,
            icon_size=48, installed_desktop_file_path="software-center-agent",
            trans_id="dkfjklsdf")
        unity_launcher = UnityLauncher()
        unity_launcher.send_application_to_launcher("meep-pkg", launcher_info)
        args = mock_iface.AddLauncherItemFromPosition.call_args[0]
        # basic verify
        self.assertEqual(args[0], "Meep")
        # ensure that the a app from software-center-agent got a temp desktop
        # file
        self.assertTrue(args[5].startswith("/tmp/"))
        self.assertEqual(open(args[5]).read(),"""
[Desktop Entry]
Name=Meep
Icon=/tmp/icon-meep.png
Type=Application""")