Exemplo n.º 1
0
 def open_help(self):
     """ Try to open the window of online help. """
     help_exists = get_configvalue(
         self.cast.ctx, '/org.openoffice.Office.SFX', 'Help')
     if not help_exists:
         return self.cast.error(
             'Faild to open help files. \n' + \
                 'Help system is not supported by the application.')
     system_type = get_configvalue(self.cast.ctx,
         '/org.openoffice.Office.Common/Help', 'System')
     lang_type = get_configvalue(self.cast.ctx,
         '/org.openoffice.Setup/L10N', 'ooLocale')
     if not system_type:
         system_type = 'WIN'
     if not lang_type:
         lang_type = get_configvalue(self.cast.ctx,
             '/org.openoffice.Office.Linguistic/General', 'DefaultLocale')
     from mytools_Mri.values import MRI_ID
     hpage = ('vnd.sun.star.help://shared/%s%%2Findex.xhp?Language=' % MRI_ID) + \
                 "%s&System=%s#bm_idindex" % (lang_type, system_type)
     help_frame = open_help(self.cast.desktop,hpage)
     if not help_frame:
         call_dispatch(self.cast.ctx,self.cast.desktop, '.uno:HelpIndex')
         help_frame = open_help(self.cast.desktop,hpage)
         if not help_frame:
             return self.cast.error("Faild to open help files. \n" + \
                 " Help system is not supported by the application.")
     call_dispatch(self.cast.ctx,help_frame,hpage)
Exemplo n.º 2
0
    def open_help(self):
        """ Try to open the window of online help. """
        help_exists = get_configvalue(self.cast.ctx,
                                      '/org.openoffice.Office.SFX', 'Help')

        lang_type = get_configvalue(self.cast.ctx,
                                    '/org.openoffice.Setup/L10N', 'ooLocale')
        if not lang_type:
            lang_type = get_configvalue(
                self.cast.ctx, '/org.openoffice.Office.Linguistic/General',
                'DefaultLocale')

        if not help_exists:
            # check existence of help files on LibreOffice
            path = get_configvalue(
                self.cast.ctx, "/org.openoffice.Office.Common/Path/Current",
                "Help")
            try:
                path = create_service(
                    self.cast.ctx,
                    "com.sun.star.util.PathSubstitution").substituteVariables(
                        path, True)
                sfa = create_service(self.cast.ctx,
                                     "com.sun.star.ucb.SimpleFileAccess")
                help_exists = sfa.exists(path + "/main_transform.xsl") and \
                              sfa.getFolderContents(path + "/" + lang_type, False)
            except Exception as e:
                print(e)
                pass
        if not help_exists or \
            (isinstance(help_exists, tuple) and \
                any((i.endswith("contents.js") for i in help_exists))):
            # show external webpage in the local webbrowser
            self.cast.main.web.open_url("https://github.com/hanya/MRI/wiki")
            return
        system_type = get_configvalue(self.cast.ctx,
                                      '/org.openoffice.Office.Common/Help',
                                      'System')
        if not system_type:
            system_type = 'WIN'
        from mytools_Mri.values import MRI_ID
        hpage = ('vnd.sun.star.help://shared/%s%%2Findex.xhp?Language=' % MRI_ID) + \
                    "%s&System=%s#bm_idindex" % (lang_type, system_type)
        help_frame = open_help(self.cast.desktop, hpage)
        if not help_frame:
            call_dispatch(self.cast.ctx, self.cast.desktop, '.uno:HelpIndex')
            help_frame = open_help(self.cast.desktop, hpage)
            if not help_frame:
                return self.cast.error("Faild to open help files. \n" + \
                    " Help system is not supported by the application.")
        call_dispatch(self.cast.ctx, help_frame, hpage)
Exemplo n.º 3
0
 def open_help(self):
     """ Try to open the window of online help. """
     help_exists = get_configvalue(
         self.cast.ctx, '/org.openoffice.Office.SFX', 'Help')
     
     lang_type = get_configvalue(self.cast.ctx,
         '/org.openoffice.Setup/L10N', 'ooLocale')
     if not lang_type:
         lang_type = get_configvalue(self.cast.ctx,
             '/org.openoffice.Office.Linguistic/General', 'DefaultLocale')
     
     if not help_exists:
         # check existence of help files on LibreOffice
         path = get_configvalue(
             self.cast.ctx, "/org.openoffice.Office.Common/Path/Current", "Help")
         try:
             path = create_service(self.cast.ctx, 
                 "com.sun.star.util.PathSubstitution").substituteVariables(path, True)
             sfa = create_service(self.cast.ctx, "com.sun.star.ucb.SimpleFileAccess")
             help_exists = sfa.exists(path + "/main_transform.xsl") and \
                           sfa.getFolderContents(path + "/" + lang_type, False)
         except Exception as e:
             print(e)
             pass
     if not help_exists or \
         (isinstance(help_exists, tuple) and \
             any((i.endswith("contents.js") for i in help_exists))):
         # show external webpage in the local webbrowser
         self.cast.main.web.open_url("https://github.com/hanya/MRI/wiki")
         return
     system_type = get_configvalue(self.cast.ctx,
         '/org.openoffice.Office.Common/Help', 'System')
     if not system_type:
         system_type = 'WIN'
     from mytools_Mri.values import MRI_ID
     hpage = ('vnd.sun.star.help://shared/%s%%2Findex.xhp?Language=' % MRI_ID) + \
                 "%s&System=%s#bm_idindex" % (lang_type, system_type)
     help_frame = open_help(self.cast.desktop,hpage)
     if not help_frame:
         call_dispatch(self.cast.ctx,self.cast.desktop, '.uno:HelpIndex')
         help_frame = open_help(self.cast.desktop,hpage)
         if not help_frame:
             return self.cast.error("Faild to open help files. \n" + \
                 " Help system is not supported by the application.")
     call_dispatch(self.cast.ctx,help_frame,hpage)