Exemple #1
0
    def gotResults_fileswitch(self, words, fullResults):
        """switch file to the named application

        mark cursor
        close in current app
        open in new app
        goto top
        goto cursor
        
        if filename cannot be got the process is stopped

        """
        fileName = actions.getPathOfOpenFile()
        if fileName:
            print 'fileName: %s' % fileName
        else:
            self.DisplayMessage(
                'cannot switch, filename cannot be established')
            return

        while fileName.endswith("*"):
            fileName = fileName[:-1]
        actions.putCursor()
        action("<<filesave>>")
        action("W")
        print "saved, now close: %s" % fileName
        action("<<documentclose>>")
        newApp = words[-1]
        newApp = self.ini.get('application', newApp, newApp)

        if not action("BRINGUP %s" % newApp):
            self.DisplayMessage(
                'cannot switch, application %s cannot be brought to front' %
                newApp)
            return

        # fileopen in emacs relies on maximised state of emacs, cannot be sure here:
        if newApp in ('emacs', 'voicecode'):
            action("{ctrl+x}{ctrl+f}; {shift+home}{del}")
        else:
            action("<<fileopen>>")
        action("W")
        keystroke(os.path.normpath(fileName))
        action("VW")
        keystroke("{enter}")
        action("<<topdocument>>")
        actions.findCursor()
        action("<<filesave>>")
Exemple #2
0
    def gotResults_fileswitch(self, words, fullResults):
        """switch file to the named application

        mark cursor
        close in current app
        open in new app
        goto top
        goto cursor
        
        if filename cannot be got the process is stopped

        """
        fileName = actions.getPathOfOpenFile()
        if fileName:
            print 'fileName: %s'% fileName
        else:
            self.DisplayMessage('cannot switch, filename cannot be established')
            return
            
        while fileName.endswith("*"):
              fileName = fileName[:-1]
        actions.putCursor()
        action("<<filesave>>")
        action("W")
        print "saved, now close: %s"% fileName
        action("<<documentclose>>")
        newApp = words[-1]
        newApp = self.ini.get('application', newApp, newApp)
           
        if not action("BRINGUP %s"% newApp):
            self.DisplayMessage('cannot switch, application %s cannot be brought to front'% newApp)
            return

        # fileopen in emacs relies on maximised state of emacs, cannot be sure here:
        if newApp in ('emacs', 'voicecode'):
            action("{ctrl+x}{ctrl+f}; {shift+home}{del}")
        else:
            action("<<fileopen>>")
        action("W")
        keystroke(os.path.normpath(fileName))
        action("VW")
        keystroke("{enter}")
        action("<<topdocument>>")
        actions.findCursor()
        action("<<filesave>>")
Exemple #3
0
    def gotResults_convertfile(self, words, fullResults):
        """copy file and change \n\r in \n or vice versa

        mark cursor
          cut all
          convert clipboard
        paste 
        goto home
        goto cursor

        """
        actions.putCursor()
        action("CLIPSAVE")
        action("<<selectall>><<cut>>")
        t = natlink.getClipboard()
        t = self.convertString(t, words[-1])
        natqh.setClipboard(t)
        action("<<paste>>")
        action("<<topdocument>>")
        actions.findCursor()
        action("<<filesave>>")
Exemple #4
0
    def gotResults_convertfile(self, words, fullResults):
        """copy file and change \n\r in \n or vice versa

        mark cursor
          cut all
          convert clipboard
        paste 
        goto home
        goto cursor

        """
        actions.putCursor()
        action("CLIPSAVE")
        action("<<selectall>><<cut>>")
        t = natlink.getClipboard()
        t = self.convertString(t, words[-1])
        natqh.setClipboard(t)
        action("<<paste>>")
        action("<<topdocument>>")
        actions.findCursor()
        action("<<filesave>>")
    def changeFileToProg(self,fromHndle, toProg):
        """try getting file and folder in pythonwin <CURSOR> and emacs"""
        actions.putCursor()
        action("<<filesave>>")
        fileName =actions.getPathOfOpenFile()
        if fileName:
            print 'fileName: %s'% fileName
        else:
            print 'no filename found'
            return
        print "closing and return to: %s"% fileName
        action("<<documentclose>>")
        if not self.startEditProgram(prog=toProg):
            print 'did not find emacs'
            return

        action("<<fileopen>>")
        action("W")
        keystroke(fileName)
        keystroke("{enter}")
        actions.findCursor()
Exemple #6
0
 def gotResults_removecursor(self, words, fullResults):
     """goto marked cursor, in case is was left in file switch actions"""
     actions.findCursor()
Exemple #7
0
 def gotResults_removecursor(self, words, fullResults):
     """goto marked cursor, in case is was left in file switch actions"""
     actions.findCursor()