コード例 #1
0
ファイル: listeners.py プロジェクト: hanya/MRI
 def file_menu(self, menu, mid, cmd):
     if cmd.startswith('f_doc_'):
         tg = cmd[6:]
         name = {'swriter': 'Text Document', 'scalc': 'Spreadsheet', 
             'simpress': 'Presentation', 'sdraw': 'Drawing'}.get(tg, None)
         if tg:
             self.cast.execute_macro("bundle.py", "inspect_new_document", "extension", tg)
     elif cmd == 'f_mri':
         if self.cast.main.current == None: return
         self.cast.execute_macro("bundle.py", "duplicate_mri_window", "extension")
     elif cmd == 'f_basicide':
         status = call_dispatch(
             self.cast.ctx, self.cast.desktop, '.uno:BasicIDEAppear')
     elif cmd == 'f_calc':
         import mytools_Mri.output
         mytools_Mri.output.Mri_output_calc(self.cast)
     elif cmd == 'f_html':
         import mytools_Mri.output
         mytools_Mri.output.Mri_output_html(self.cast.main)
     elif cmd == 'f_close':
         try:
             status = call_dispatch(
                 self.cast.ctx, self.cast.frame, '.uno:CloseWin')
         except Exception as e:
             print(e)
             traceback.print_exc()
コード例 #2
0
 def file_menu(self, menu, mid, cmd):
     if cmd.startswith('f_doc_'):
         tg = cmd[6:]
         name = {
             'swriter': 'Text Document',
             'scalc': 'Spreadsheet',
             'simpress': 'Presentation',
             'sdraw': 'Drawing'
         }.get(tg, None)
         if tg:
             self.cast.execute_macro("bundle.py", "inspect_new_document",
                                     "extension", tg)
     elif cmd == 'f_mri':
         if self.cast.main.current == None: return
         self.cast.execute_macro("bundle.py", "duplicate_mri_window",
                                 "extension")
     elif cmd == 'f_basicide':
         status = call_dispatch(self.cast.ctx, self.cast.desktop,
                                '.uno:BasicIDEAppear')
     elif cmd == 'f_calc':
         import mytools_Mri.output
         mytools_Mri.output.Mri_output_calc(self.cast)
     elif cmd == 'f_html':
         import mytools_Mri.output
         mytools_Mri.output.Mri_output_html(self.cast.main)
     elif cmd == 'f_close':
         try:
             status = call_dispatch(self.cast.ctx, self.cast.frame,
                                    '.uno:CloseWin')
         except Exception as e:
             print(e)
             traceback.print_exc()
コード例 #3
0
ファイル: listeners.py プロジェクト: hanya/MRI
 def help_menu(self, menu, mid, cmd):
     if cmd == 'h_about':
         self.about_MRI()
     elif cmd == 'h_doc':
         self.open_help()
     elif cmd == 'h_what':
         call_dispatch(self.cast.ctx, self.cast.desktop, '.uno:ExtendedHelp')
コード例 #4
0
ファイル: listeners.py プロジェクト: kikili/MRI
 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)
コード例 #5
0
ファイル: listeners.py プロジェクト: billyoc/MRI
 def disposing(self, ev):
     try:
         cast = self.cast
         config = cast.config
         removeListeners(cast, config.grid, config.use_tab)
         cast.listeners = None
         cast.splitter.dispose()
         if config.use_tab:
             subcont = self.cast.cont.getControl("subcont")
             try:
                 self.cast.cont.removeControl(subcont)
             except Exception as e:
                 print(e)
         cast.config = None
         cast.engine = None
         cast.cont = None
         cast.pages = None
         menu = cast.menu
         menu.getPopupMenu(0).setPopupMenu(0, None)
         menu.getPopupMenu(0).setPopupMenu(1, None)
         menu.getPopupMenu(1).setPopupMenu(5, None)
         for i in range(7):
             menu.setPopupMenu(i, None)
         cast.menu = None
         cast.window.setMenuBar(None) # !
         cast.window = None
         cast.dlg = None
         cast.splitter = None
         call_dispatch(self.cast.ctx, self.cast.frame, '.uno:CloseDoc')
         cast.frame = None
         self.cast = None
         if cast.status_eraser:
             cast.status_eraser.cancel()
     except Exception as e:
         print(e)
コード例 #6
0
 def help_menu(self, menu, mid, cmd):
     if cmd == 'h_about':
         self.about_MRI()
     elif cmd == 'h_doc':
         self.open_help()
     elif cmd == 'h_what':
         call_dispatch(self.cast.ctx, self.cast.desktop,
                       '.uno:ExtendedHelp')
コード例 #7
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)
コード例 #8
0
ファイル: listeners.py プロジェクト: hanya/MRI
 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)
コード例 #9
0
 def disposing(self, ev):
     try:
         cast = self.cast
         config = cast.config
         removeListeners(cast, config.grid, config.use_tab)
         cast.listeners = None
         cast.splitter.dispose()
         if config.use_tab:
             subcont = self.cast.cont.getControl("subcont")
             try:
                 for control in subcont.getControls():
                     for c in control.getControls():
                         control.removeControl(c)
                         c.dispose()
                     subcont.removeControl(control)
                     control.dispose()
                 self.cast.cont.removeControl(subcont)
                 subcont.dispose()
             except Exception as e:
                 print(e)
         cast.config = None
         cast.engine = None
         cast.cont = None
         cast.pages = None
         menu = cast.menu
         menu.getPopupMenu(0).setPopupMenu(0, None)
         menu.getPopupMenu(0).setPopupMenu(1, None)
         menu.getPopupMenu(1).setPopupMenu(5, None)
         for i in range(7):
             menu.setPopupMenu(i, None)
         cast.menu = None
         cast.window.setMenuBar(None)  # !
         cast.window = None
         cast.dlg = None
         cast.splitter = None
         call_dispatch(self.cast.ctx, self.cast.frame, '.uno:CloseDoc')
         cast.frame = None
         self.cast = None
         if cast.status_eraser:
             cast.status_eraser.cancel()
     except Exception as e:
         print(e)