def test_desktop_file_path_conversion(self):
     # test 'normal' case
     app_install_desktop_path = ("./data/app-install/desktop/" +
                                 "deja-dup:deja-dup.desktop")
     installed_desktop_path = convert_desktop_file_to_installed_location(
             app_install_desktop_path, "deja-dup")
     self.assertEqual(installed_desktop_path,
                      "./data/applications/deja-dup.desktop")
     # test encoded subdirectory case, e.g. e.g. kde4_soundkonverter.desktop
     app_install_desktop_path = ("./data/app-install/desktop/" +
                                 "soundkonverter:" +
                                 "kde4__soundkonverter.desktop")
     installed_desktop_path = convert_desktop_file_to_installed_location(
             app_install_desktop_path, "soundkonverter")
     self.assertEqual(installed_desktop_path,
                      "./data/applications/kde4/soundkonverter.desktop")
     # test the for-purchase case (uses "software-center-agent" as its
     # appdetails.desktop_file value)
     # FIXME: this will only work if update-manager is installed
     app_install_desktop_path = "software-center-agent"
     installed_desktop_path = convert_desktop_file_to_installed_location(
             app_install_desktop_path, "update-manager")
     self.assertEqual(installed_desktop_path,
                      "/usr/share/applications/update-manager.desktop")
     # test case where we don't have a value for app_install_desktop_path
     # (e.g. for a local .deb install, see bug LP: #768158)
     installed_desktop_path = convert_desktop_file_to_installed_location(
             None, "update-manager")
     # FIXME: this will only work if update-manager is installed
     self.assertEqual(installed_desktop_path,
                      "/usr/share/applications/update-manager.desktop")
Пример #2
0
 def test_desktop_file_path_conversion(self):
     # test 'normal' case
     app_install_desktop_path = ("./data/app-install/desktop/" +
                                 "deja-dup:deja-dup.desktop")
     installed_desktop_path = convert_desktop_file_to_installed_location(
         app_install_desktop_path, "deja-dup")
     self.assertEqual(installed_desktop_path,
                      "./data/applications/deja-dup.desktop")
     # test encoded subdirectory case, e.g. e.g. kde4_soundkonverter.desktop
     app_install_desktop_path = ("./data/app-install/desktop/" +
                                 "soundkonverter:" +
                                 "kde4__soundkonverter.desktop")
     installed_desktop_path = convert_desktop_file_to_installed_location(
         app_install_desktop_path, "soundkonverter")
     self.assertEqual(installed_desktop_path,
                      "./data/applications/kde4/soundkonverter.desktop")
     # test the for-purchase case (uses "software-center-agent" as its
     # appdetails.desktop_file value)
     # FIXME: this will only work if update-manager is installed
     app_install_desktop_path = "software-center-agent"
     installed_desktop_path = convert_desktop_file_to_installed_location(
         app_install_desktop_path, "update-manager")
     self.assertEqual(installed_desktop_path,
                      "/usr/share/applications/update-manager.desktop")
     # test case where we don't have a value for app_install_desktop_path
     # (e.g. for a local .deb install, see bug LP: #768158)
     installed_desktop_path = convert_desktop_file_to_installed_location(
         None, "update-manager")
     # FIXME: this will only work if update-manager is installed
     self.assertEqual(installed_desktop_path,
                      "/usr/share/applications/update-manager.desktop")
Пример #3
0
 def test_purchase_via_software_center_agent(self):
     # test the for-purchase case (uses "software-center-agent" as its
     # appdetails.desktop_file value)
     # FIXME: this will only work if update-manager is installed
     app_install_desktop_path = "software-center-agent"
     installed_desktop_path = convert_desktop_file_to_installed_location(app_install_desktop_path, "update-manager")
     self.assertEqual(installed_desktop_path, "/usr/share/applications/update-manager.desktop")
    def _add_application_to_unity_launcher(self, transaction_details):
        app = Application(pkgname=transaction_details.pkgname,
                          appname=transaction_details.appname)
        appdetails = app.get_details(self.db)
        # convert the app-install desktop file location to the actual installed
        # desktop file location (or in the case of a purchased item from the
        # agent, generate the correct installed desktop file location)
        installed_desktop_file_path = (
            convert_desktop_file_to_installed_location(appdetails.desktop_file,
                                                       app.pkgname))
        # we only add items to the launcher that have a desktop file
        if not installed_desktop_file_path:
            return
        # do not add apps that have no Exec entry in their desktop file
        # (e.g. wine, see LP: #848437 or ubuntu-restricted-extras,
        # see LP: #913756), also, don't add the item if NoDisplay is
        # specified (see LP: #1006483)
        if (os.path.exists(installed_desktop_file_path) and
            (not get_exec_line_from_desktop(installed_desktop_file_path)
             or is_no_display_desktop_file(installed_desktop_file_path))):
            return

        # now gather up the unity launcher info items and send the app to the
        # launcher service
        launcher_info = self._get_unity_launcher_info(
            app, appdetails, installed_desktop_file_path,
            transaction_details.trans_id)
        self.unity_launcher.send_application_to_launcher(
            transaction_details.pkgname, launcher_info)
    def _add_application_to_unity_launcher(self, transaction_details):
        app = Application(pkgname=transaction_details.pkgname,
                          appname=transaction_details.appname)
        appdetails = app.get_details(self.db)
        # convert the app-install desktop file location to the actual installed
        # desktop file location (or in the case of a purchased item from the
        # agent, generate the correct installed desktop file location)
        installed_desktop_file_path = (
            convert_desktop_file_to_installed_location(appdetails.desktop_file,
                                                       app.pkgname))
        # we only add items to the launcher that have a desktop file
        if not installed_desktop_file_path:
            return
        # do not add apps that have no Exec entry in their desktop file
        # (e.g. wine, see LP: #848437 or ubuntu-restricted-extras,
        # see LP: #913756), also, don't add the item if NoDisplay is
        # specified (see LP: #1006483)
        if (os.path.exists(installed_desktop_file_path) and
            (not get_exec_line_from_desktop(installed_desktop_file_path) or
            is_no_display_desktop_file(installed_desktop_file_path))):
            return

        # now gather up the unity launcher info items and send the app to the
        # launcher service
        launcher_info = self._get_unity_launcher_info(app, appdetails,
                installed_desktop_file_path,
                transaction_details.trans_id)
        self.unity_launcher.send_application_to_launcher(
                transaction_details.pkgname,
                launcher_info)
Пример #6
0
 def test_no_value(self):
     # test case where we don't have a value for app_install_desktop_path
     # (e.g. for a local .deb install, see bug LP: #768158)
     installed_desktop_path = convert_desktop_file_to_installed_location(
         None, "update-manager")
     # FIXME: this will only work if update-manager is installed
     self.assertEqual(installed_desktop_path,
                      "/usr/share/applications/update-manager.desktop")
 def test_no_value(self):
     # test case where we don't have a value for app_install_desktop_path
     # (e.g. for a local .deb install, see bug LP: #768158)
     installed_desktop_path = convert_desktop_file_to_installed_location(
             None, "update-manager")
     # FIXME: this will only work if update-manager is installed
     self.assertEqual(installed_desktop_path,
                      "/usr/share/applications/update-manager.desktop")
 def test_normal(self):
     # test 'normal' case
     app_install_desktop_path = ("./data/app-install/desktop/" +
                                 "deja-dup:deja-dup.desktop")
     installed_desktop_path = convert_desktop_file_to_installed_location(
             app_install_desktop_path, "deja-dup")
     self.assertEqual(installed_desktop_path,
                      "./data/applications/deja-dup.desktop")
Пример #9
0
 def test_normal(self):
     # test 'normal' case
     app_install_desktop_path = ("./data/app-install/desktop/" +
                                 "deja-dup:deja-dup.desktop")
     installed_desktop_path = convert_desktop_file_to_installed_location(
         app_install_desktop_path, "deja-dup")
     self.assertEqual(installed_desktop_path,
                      "./data/applications/deja-dup.desktop")
Пример #10
0
 def test_purchase_via_software_center_agent(self):
     # test the for-purchase case (uses "software-center-agent" as its
     # appdetails.desktop_file value)
     # FIXME: this will only work if update-manager is installed
     app_install_desktop_path = "software-center-agent"
     installed_desktop_path = convert_desktop_file_to_installed_location(
         app_install_desktop_path, "update-manager")
     self.assertEqual(installed_desktop_path,
                      "/usr/share/applications/update-manager.desktop")
 def test_encoded_subdir(self):
     # test encoded subdirectory case, e.g. e.g. kde4_soundkonverter.desktop
     app_install_desktop_path = ("./data/app-install/desktop/" +
                                 "soundkonverter:" +
                                 "kde4__soundkonverter.desktop")
     installed_desktop_path = convert_desktop_file_to_installed_location(
             app_install_desktop_path, "soundkonverter")
     self.assertEqual(installed_desktop_path,
                      "./data/applications/kde4/soundkonverter.desktop")
Пример #12
0
 def test_encoded_subdir(self):
     # test encoded subdirectory case, e.g. e.g. kde4_soundkonverter.desktop
     app_install_desktop_path = os.path.join(
         DATA_DIR, "app-install", "desktop", "soundkonverter:kde4__soundkonverter.desktop"
     )
     installed_desktop_path = convert_desktop_file_to_installed_location(app_install_desktop_path, "soundkonverter")
     self.assertEqual(
         installed_desktop_path, os.path.join(DATA_DIR, "applications", "kde4", "soundkonverter.desktop")
     )
Пример #13
0
 def test_encoded_subdir(self):
     # test encoded subdirectory case, e.g. e.g. kde4_soundkonverter.desktop
     app_install_desktop_path = ("./data/app-install/desktop/" +
                                 "soundkonverter:" +
                                 "kde4__soundkonverter.desktop")
     installed_desktop_path = convert_desktop_file_to_installed_location(
         app_install_desktop_path, "soundkonverter")
     self.assertEqual(installed_desktop_path,
                      "./data/applications/kde4/soundkonverter.desktop")
Пример #14
0
 def test_normal(self):
     # test 'normal' case
     app_install_desktop_path = os.path.join(DATA_DIR, "app-install",
                                             "desktop",
                                             "deja-dup:deja-dup.desktop")
     installed_desktop_path = convert_desktop_file_to_installed_location(
         app_install_desktop_path, "deja-dup")
     self.assertEqual(
         installed_desktop_path,
         os.path.join(DATA_DIR, "applications", "deja-dup.desktop"))
Пример #15
0
 def test_encoded_subdir(self):
     # test encoded subdirectory case, e.g. e.g. kde4_soundkonverter.desktop
     app_install_desktop_path = os.path.join(
         DATA_DIR, "app-install", "desktop",
         "soundkonverter:kde4__soundkonverter.desktop")
     installed_desktop_path = convert_desktop_file_to_installed_location(
         app_install_desktop_path, "soundkonverter")
     self.assertEqual(
         installed_desktop_path,
         os.path.join(DATA_DIR, "applications", "kde4",
                      "soundkonverter.desktop"))
Пример #16
0
 def _check_unity_launcher_transaction_finished(self, result):
     # add the completed transaction details to the corresponding
     # launcher_item
     if result.pkgname in self.unity_launcher_items:
         launcher_info = self.unity_launcher_items[result.pkgname]
         launcher_info.icon_file_path = get_file_path_from_iconname(
             self.icons, launcher_info.icon_name)
         installed_path = convert_desktop_file_to_installed_location(
             launcher_info.app_install_desktop_file_path, result.pkgname)
         launcher_info.installed_desktop_file_path = installed_path
         # if the request to add to launcher has already been made, do it now
         if launcher_info.add_to_launcher_requested:
             if result.success:
                 self._send_dbus_signal_to_unity_launcher(launcher_info)
             self.unity_launcher_items.pop(result.pkgname)
             self.action_bar.clear()
Пример #17
0
 def _check_unity_launcher_transaction_finished(self, result):
     # add the completed transaction details to the corresponding
     # launcher_item
     if result.pkgname in self.unity_launcher_items:
         launcher_info = self.unity_launcher_items[result.pkgname]
         launcher_info.icon_file_path = get_file_path_from_iconname(
             self.icons, launcher_info.icon_name)
         installed_path = convert_desktop_file_to_installed_location(
             launcher_info.app_install_desktop_file_path, result.pkgname)
         launcher_info.installed_desktop_file_path = installed_path
         # if the request to add to launcher has already been made, do it now
         if launcher_info.add_to_launcher_requested:
             if result.success:
                 self._send_dbus_signal_to_unity_launcher(launcher_info)
             self.unity_launcher_items.pop(result.pkgname)
             self.action_bar.clear()
Пример #18
0
        def guess_final_desktop_file(self):
            if self.__real_desktop:
                return self.__real_desktop

            # convert the app-install desktop file location to the actual installed
            # desktop file location (or in the case of a purchased item from the
            # agent, generate the correct installed desktop file location)
            desktop_file = (
                convert_desktop_file_to_installed_location(self.desktop_file,
                                                           self.app.pkgname))
            # we only add items to the launcher that have a desktop file
            if not desktop_file:
                return
            # do not add apps that have no Exec entry in their desktop file
            # (e.g. wine, see LP: #848437 or ubuntu-restricted-extras,
            # see LP: #913756), also, don't add the item if NoDisplay is
            # specified (see LP: #1006483)
            if (os.path.exists(desktop_file) and
                    (not get_exec_line_from_desktop(desktop_file) or
                    is_no_display_desktop_file(desktop_file))):
                return

            self.__real_desktop = desktop_file
            return self.__real_desktop
Пример #19
0
 def test_normal(self):
     # test 'normal' case
     app_install_desktop_path = os.path.join(DATA_DIR, "app-install", "desktop", "deja-dup:deja-dup.desktop")
     installed_desktop_path = convert_desktop_file_to_installed_location(app_install_desktop_path, "deja-dup")
     self.assertEqual(installed_desktop_path, os.path.join(DATA_DIR, "applications", "deja-dup.desktop"))