def check_version(self): nodepath = "/org.openoffice.Setup/Product" version = get_configvalue(self.ctx, nodepath, "ooSetupVersion") name = get_configvalue(self.ctx, nodepath, "ooName") if version >= "3.3": if name in ("OpenOffice", "Apache OpenOffice", "OpenOffice.org", "OOo-dev"): if version == "3.3": Config.TAB = 0 Config.GRID = 1 else: Config.TAB = 1 Config.GRID = 2 if version > "3.4": Config.GRID_UPDATE = False elif name == "LibreOffice": if version == "3.3": Config.TAB = 0 Config.GRID = 1 else: Config.TAB = 2 Config.GRID = 2 if version >= "4.0" else 3 else: pass if Config.TAB == 0: Config.use_tab = False if Config.GRID == 0: Config.grid = False
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)
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)
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)