示例#1
0
 def __on_preferenceshelp_clicked(self, widget):
     pagenum = self.w_preferences_notebook.get_current_page()
     if pagenum == PREFERENCES_NOTEBOOK_SIG_POL_PAGE:
         tag = "img-sig-policy"
     else:
         tag = "pkg-mgr-prefs"
     gui_misc.display_help(tag)
示例#2
0
 def __on_preferenceshelp_clicked(self, widget):
         pagenum = self.w_preferences_notebook.get_current_page()
         if pagenum == PREFERENCES_NOTEBOOK_SIG_POL_PAGE:
                 tag = "img-sig-policy"
         else:
                 tag = "pkg-mgr-prefs"
         gui_misc.display_help(tag)
示例#3
0
文件: pmlogging.py 项目: aszeszo/test
 def __on_log_help_button_clicked(widget):
         gui_misc.display_help("gkiod")
示例#4
0
    def __handle_link(self, document, link, handle_what=CLICK_LINK):
        query_dict = self.__urlparse_qs(link)

        action = None
        if query_dict.has_key(PM_ACTION):
            action = query_dict[PM_ACTION][0]
        elif handle_what == DISPLAY_LINK:
            return link

        search_action = None
        if action == ACTION_INTERNAL:
            if query_dict.has_key(INTERNAL_SEARCH):
                search_action = query_dict[INTERNAL_SEARCH][0]

        s1, e1 = self.parent.get_start_end_strings()

        # Browse a Publisher
        if search_action and search_action.find(INTERNAL_SEARCH_VIEW_PUB) > -1:
            pub = re.findall(r'<b>(.*)<\/b>', search_action)[0]
            if handle_what == DISPLAY_LINK:
                pub_name =  \
                    self.parent.get_publisher_display_name_from_prefix(
                    pub)
                return _("View packages in %(s1)s%(pub)s%(e1)s") % \
                        {"s1": s1, "pub": \
                        pub_name, "e1": e1}
            self.parent.browse_publisher(pub)
            return

        # Go to Search in All Publishers page
        if search_action and search_action == INTERNAL_SEARCH_ALL_PUBS_PAGE:
            if handle_what == DISPLAY_LINK:
                return _("Go to Search %(s1)sAll Publishers%(e1)s page")\
                        % {"s1": s1, "e1": e1}
            self.parent.pm_setup_search_all_page()
            return

        # Search in All Publishers
        if search_action and search_action == INTERNAL_SEARCH_ALL_PUBS:
            if handle_what == DISPLAY_LINK:
                return _("Search within %(s1)sAll Publishers%(e1)s") % \
                        {"s1": s1, "e1": e1}
            self.parent.handle_search_all_publishers()
            return

        # Change view to All Publishers (Installed)
        if search_action and search_action == INTERNAL_SEARCH_ALL_PUBS_INSTALLED:
            if handle_what == DISPLAY_LINK:
                return _("View %(s1)sAll Installed Packages%(e1)s") % \
                        {"s1": s1, "e1": e1}
            self.parent.handle_view_all_publishers_installed()
            return
        # Launch Search Help
        if search_action and search_action == INTERNAL_SEARCH_HELP:
            if handle_what == DISPLAY_LINK:
                return _("Display %(s1)sSearch Help%(e1)s") % \
                        {"s1": s1, "e1": e1}
            self.parent.update_statusbar_message(
                _("Loading %(s1)sSearch Help%(e1)s ...") % {
                    "s1": s1,
                    "e1": e1
                })
            gui_misc.display_help("search-pkg")
            return

        if search_action and search_action == INTERNAL_SEARCH_MNG_PUBS:
            if handle_what == DISPLAY_LINK:
                return _("Display %(s1)sManage Publishers%(e1)s") % \
                        {"s1": s1, "e1": e1}
            self.parent.update_statusbar_message(
                _("Loading %(s1)sManage Publishers%(e1)s ...") % {
                    "s1": s1,
                    "e1": e1
                })

            repository.Repository(self.parent,
                                  self.parent.image_directory,
                                  action=enumerations.MANAGE_PUBLISHERS,
                                  main_window=self.parent.w_main_window,
                                  gconf=self.parent.gconf)
            return

        # View Recent Search Results
        if search_action and \
                search_action.find(INTERNAL_SEARCH_VIEW_RESULTS) > -1:
            recent_search = \
                    re.findall(r'<span>(.*)<\/span>', search_action)[0]
            if handle_what == DISPLAY_LINK:
                return _("View results for %s") % recent_search
            self.parent.goto_recent_search(recent_search)
            return

    # Change View to All Packages
        if search_action and search_action == INTERNAL_SEARCH_VIEW_ALL:
            if handle_what == DISPLAY_LINK:
                return _("Change View to %(s1)sAll Packages%(e1)s") % \
                        {"s1": s1, "e1": e1}
            self.parent.set_view_all_packages()
            return
        # Internal Browse
        if action == ACTION_INTERNAL:
            if query_dict.has_key(INTERNAL_URI):
                int_uri = query_dict[INTERNAL_URI][0]
                if handle_what == DISPLAY_LINK:
                    return int_uri
            else:
                if handle_what == CLICK_LINK:
                    self.link_load_error(_("No URI specified"))
                return
            if handle_what == CLICK_LINK and \
                not self.__load_internal_uri(document, int_uri):
                self.link_load_error(int_uri)
            return
        # External browse
        elif action == ACTION_EXTERNAL:
            if query_dict.has_key(EXTERNAL_URI):
                ext_uri = query_dict[EXTERNAL_URI][0]
            else:
                if handle_what == CLICK_LINK:
                    self.link_load_error(_("No URI specified"))
                return
            if query_dict.has_key(EXTERNAL_PROTOCOL):
                protocol = query_dict[EXTERNAL_PROTOCOL][0]
            else:
                protocol = DEFAULT_PROTOCOL

            if handle_what == DISPLAY_LINK:
                return protocol + "://" + ext_uri
            self.parent.open_link(protocol + "://" + ext_uri)
            return
        elif handle_what == DISPLAY_LINK:
            return None
        elif action == None:
            if link and link.endswith(".p5i"):
                self.parent.invoke_webinstall(link)
                return
            self.parent.open_link(link)
            return
        # Handle empty and unsupported actions
        elif action == "":
            self.link_load_error(_("Empty Action not supported"))
            return
        elif action != None:
            self.link_load_error(_("Action not supported: %s") % action)
            return
示例#5
0
文件: beadmin.py 项目: aszeszo/test
 def __on_help_bebutton_clicked(self, widget):
         if self.parent != None:
                 gui_misc.display_help("manage-be")
         else:
                 gui_misc.display_help()
示例#6
0
 def __on_help_button_clicked(widget):
         gui_misc.display_help("webinstall")
示例#7
0
 def __on_info_help_button_clicked(widget):
     gui_misc.display_help("package-version")
示例#8
0
 def __on_help_bebutton_clicked(self, widget):
     if self.parent != None:
         gui_misc.display_help("manage-be")
     else:
         gui_misc.display_help()
示例#9
0
 def __on_confirm_help_button_clicked(widget):
         gui_misc.display_help("webinstall-export")
示例#10
0
 def __on_info_help_button_clicked(widget):
         gui_misc.display_help("package-version")
示例#11
0
 def __on_help_button_clicked(widget):
     gui_misc.display_help("webinstall")
示例#12
0
 def __on_confirm_help_button_clicked(widget):
     gui_misc.display_help("webinstall-export")
示例#13
0
 def __on_ua_help_button_clicked(widget):
         gui_misc.display_help("um_info")
示例#14
0
文件: pmlogging.py 项目: gbulfon/pkg5
 def __on_log_help_button_clicked(widget):
         gui_misc.display_help("gkiod")
示例#15
0
 def __on_ua_help_button_clicked(widget):
     gui_misc.display_help("um_info")
示例#16
0
文件: startpage.py 项目: aszeszo/test
    def __handle_link(self, document, link, handle_what=CLICK_LINK):
        query_dict = self.__urlparse_qs(link)

        action = None
        if query_dict.has_key(PM_ACTION):
            action = query_dict[PM_ACTION][0]
        elif handle_what == DISPLAY_LINK:
            return link

        search_action = None
        if action == ACTION_INTERNAL:
            if query_dict.has_key(INTERNAL_SEARCH):
                search_action = query_dict[INTERNAL_SEARCH][0]

        s1, e1 = self.parent.get_start_end_strings()

        # Browse a Publisher
        if search_action and search_action.find(INTERNAL_SEARCH_VIEW_PUB) > -1:
            pub = re.findall(r"<b>(.*)<\/b>", search_action)[0]
            if handle_what == DISPLAY_LINK:
                pub_name = self.parent.get_publisher_display_name_from_prefix(pub)
                return _("View packages in %(s1)s%(pub)s%(e1)s") % {"s1": s1, "pub": pub_name, "e1": e1}
            self.parent.browse_publisher(pub)
            return

        # Go to Search in All Publishers page
        if search_action and search_action == INTERNAL_SEARCH_ALL_PUBS_PAGE:
            if handle_what == DISPLAY_LINK:
                return _("Go to Search %(s1)sAll Publishers%(e1)s page") % {"s1": s1, "e1": e1}
            self.parent.pm_setup_search_all_page()
            return

        # Search in All Publishers
        if search_action and search_action == INTERNAL_SEARCH_ALL_PUBS:
            if handle_what == DISPLAY_LINK:
                return _("Search within %(s1)sAll Publishers%(e1)s") % {"s1": s1, "e1": e1}
            self.parent.handle_search_all_publishers()
            return

        # Change view to All Publishers (Installed)
        if search_action and search_action == INTERNAL_SEARCH_ALL_PUBS_INSTALLED:
            if handle_what == DISPLAY_LINK:
                return _("View %(s1)sAll Installed Packages%(e1)s") % {"s1": s1, "e1": e1}
            self.parent.handle_view_all_publishers_installed()
            return
        # Launch Search Help
        if search_action and search_action == INTERNAL_SEARCH_HELP:
            if handle_what == DISPLAY_LINK:
                return _("Display %(s1)sSearch Help%(e1)s") % {"s1": s1, "e1": e1}
            self.parent.update_statusbar_message(_("Loading %(s1)sSearch Help%(e1)s ...") % {"s1": s1, "e1": e1})
            gui_misc.display_help("search-pkg")
            return

        if search_action and search_action == INTERNAL_SEARCH_MNG_PUBS:
            if handle_what == DISPLAY_LINK:
                return _("Display %(s1)sManage Publishers%(e1)s") % {"s1": s1, "e1": e1}
            self.parent.update_statusbar_message(_("Loading %(s1)sManage Publishers%(e1)s ...") % {"s1": s1, "e1": e1})

            repository.Repository(
                self.parent,
                self.parent.image_directory,
                action=enumerations.MANAGE_PUBLISHERS,
                main_window=self.parent.w_main_window,
                gconf=self.parent.gconf,
            )
            return

        # View Recent Search Results
        if search_action and search_action.find(INTERNAL_SEARCH_VIEW_RESULTS) > -1:
            recent_search = re.findall(r"<span>(.*)<\/span>", search_action)[0]
            if handle_what == DISPLAY_LINK:
                return _("View results for %s") % recent_search
            self.parent.goto_recent_search(recent_search)
            return

        # Change View to All Packages
        if search_action and search_action == INTERNAL_SEARCH_VIEW_ALL:
            if handle_what == DISPLAY_LINK:
                return _("Change View to %(s1)sAll Packages%(e1)s") % {"s1": s1, "e1": e1}
            self.parent.set_view_all_packages()
            return
        # Internal Browse
        if action == ACTION_INTERNAL:
            if query_dict.has_key(INTERNAL_URI):
                int_uri = query_dict[INTERNAL_URI][0]
                if handle_what == DISPLAY_LINK:
                    return int_uri
            else:
                if handle_what == CLICK_LINK:
                    self.link_load_error(_("No URI specified"))
                return
            if handle_what == CLICK_LINK and not self.__load_internal_uri(document, int_uri):
                self.link_load_error(int_uri)
            return
        # External browse
        elif action == ACTION_EXTERNAL:
            if query_dict.has_key(EXTERNAL_URI):
                ext_uri = query_dict[EXTERNAL_URI][0]
            else:
                if handle_what == CLICK_LINK:
                    self.link_load_error(_("No URI specified"))
                return
            if query_dict.has_key(EXTERNAL_PROTOCOL):
                protocol = query_dict[EXTERNAL_PROTOCOL][0]
            else:
                protocol = DEFAULT_PROTOCOL

            if handle_what == DISPLAY_LINK:
                return protocol + "://" + ext_uri
            self.parent.open_link(protocol + "://" + ext_uri)
            return
        elif handle_what == DISPLAY_LINK:
            return None
        elif action == None:
            if link and link.endswith(".p5i"):
                self.parent.invoke_webinstall(link)
                return
            self.parent.open_link(link)
            return
        # Handle empty and unsupported actions
        elif action == "":
            self.link_load_error(_("Empty Action not supported"))
            return
        elif action != None:
            self.link_load_error(_("Action not supported: %s") % action)
            return