예제 #1
0
 def create_history_filename(self):
     """Create history_filename with INITHISTORY if it doesn't exist."""
     if self.history_filename and not osp.isfile(self.history_filename):
         try:
             encoding.writelines(self.INITHISTORY, self.history_filename)
         except EnvironmentError:
             pass
예제 #2
0
파일: mixins.py 프로젝트: pijyoi/spyder
 def create_history_filename(self):
     """Create history_filename with INITHISTORY if it doesn't exist."""
     if self.history_filename and not osp.isfile(self.history_filename):
         try:
             encoding.writelines(self.INITHISTORY, self.history_filename)
         except EnvironmentError:
             pass
예제 #3
0
파일: shell.py 프로젝트: wpfeder/spyder
    def load_history(self):
        """Load history from a .py file in user home directory"""
        if osp.isfile(self.history_filename):
            rawhistory, _ = encoding.readlines(self.history_filename)
            rawhistory = [line.replace('\n', '') for line in rawhistory]
            if rawhistory[1] != self.INITHISTORY[1]:
                rawhistory[1] = self.INITHISTORY[1]
        else:
            rawhistory = self.INITHISTORY
        history = [line for line in rawhistory \
                   if line and not line.startswith('#')]

        # Truncating history to X entries:
        while len(history) >= CONF.get('historylog', 'max_entries'):
            del history[0]
            while rawhistory[0].startswith('#'):
                del rawhistory[0]
            del rawhistory[0]

        # Saving truncated history:
        try:
            encoding.writelines(rawhistory, self.history_filename)
        except EnvironmentError:
            pass

        return history
예제 #4
0
파일: shell.py 프로젝트: cfanpc/spyder
    def load_history(self):
        """Load history from a .py file in user home directory"""
        if osp.isfile(self.history_filename):
            rawhistory, _ = encoding.readlines(self.history_filename)
            rawhistory = [line.replace('\n', '') for line in rawhistory]
            if rawhistory[1] != self.INITHISTORY[1]:
                rawhistory[1] = self.INITHISTORY[1]
        else:
            rawhistory = self.INITHISTORY
        history = [line for line in rawhistory \
                   if line and not line.startswith('#')]

        # Truncating history to X entries:
        while len(history) >= CONF.get('historylog', 'max_entries'):
            del history[0]
            while rawhistory[0].startswith('#'):
                del rawhistory[0]
            del rawhistory[0]

        # Saving truncated history:
        try:
            encoding.writelines(rawhistory, self.history_filename)
        except EnvironmentError:
            pass

        return history
예제 #5
0
파일: plugin.py 프로젝트: zerocewl/spyder
 def save_wdhistory(self):
     """Save history to a text file in user home directory"""
     text = [ to_text_string( self.pathedit.itemText(index) ) \
              for index in range(self.pathedit.count()) ]
     try:
         encoding.writelines(text, self.LOG_PATH)
     except EnvironmentError:
         pass
예제 #6
0
파일: plugin.py 프로젝트: impact27/spyder
 def save_wdhistory(self):
     """Save history to a text file in user home directory"""
     text = [ to_text_string( self.pathedit.itemText(index) ) \
              for index in range(self.pathedit.count()) ]
     try:
         encoding.writelines(text, self.LOG_PATH)
     except EnvironmentError:
         pass
예제 #7
0
파일: plugin.py 프로젝트: zhoufan766/spyder
 def save_history(self):
     """
     Save history to a text file located in Spyder configuration folder.
     """
     history = self.get_container().get_history()
     try:
         encoding.writelines(history, self.LOG_PATH)
     except EnvironmentError:
         pass
예제 #8
0
 def create_history_filename(self):
     """Create history_filename with INITHISTORY if it doesn't exist."""
     if self.history_filename and not osp.isfile(self.history_filename):
         encoding.writelines(self.INITHISTORY, self.history_filename)
예제 #9
0
파일: mixins.py 프로젝트: rlaverde/spyder
 def create_history_filename(self):
     """Create history_filename with INITHISTORY if it doesn't exist."""
     if self.history_filename and not osp.isfile(self.history_filename):
         encoding.writelines(self.INITHISTORY, self.history_filename)