コード例 #1
0
ファイル: main_window.py プロジェクト: calpe20/PYTHONIZANDO
 def open_file(self):
     fileName = str(QFileDialog.getOpenFileName(self, "Open File", "", "(*.py);;(*.*)"))
     if not fileName:
         return
     try:
         self._central.actual_tab().notOpening = False
         content = self.read_file_content(fileName)
         editor = factory_editor(fileName, self._central.actual_tab())
         editor.setPlainText(content)
         editor.path = fileName
         # self.add_tab(editor, self.get_file_name(fileName))
         if not editor.has_write_permission():
             fileName += " (Read-Only)"
         self.add_tab(editor, self.get_file_name(fileName))
         self.change_window_title(fileName)
     except Exception, reason:
         print reason
         QMessageBox.information(self, "Incorrect File", "The file does not exist!")
コード例 #2
0
ファイル: main_window.py プロジェクト: calpe20/PYTHONIZANDO
 def open_document(self, fileName, project=None):
     try:
         if not self._central.actual_tab().is_open(fileName):
             self._central.actual_tab().notOpening = False
             editor = factory_editor(fileName, self._central.actual_tab(), project)
             content = self.read_file_content(fileName)
             editor.setPlainText(content)
             editor.path = fileName
             editor.ask_if_externally_modified = True
             # self.add_tab(editor, self.get_file_name(fileName))
             if not editor.has_write_permission():
                 fileName += " (Read-Only)"
             self.add_tab(editor, self.get_file_name(fileName))
             self.change_window_title(fileName)
         else:
             self._central.actual_tab().move_to_open(fileName)
     except Exception, reason:
         print reason
         QMessageBox.information(self, "Incorrect File", "The file couldn't be open")
コード例 #3
0
ファイル: main_window.py プロジェクト: calpe20/PYTHONIZANDO
 def open_file(self):
     fileName = str(
         QFileDialog.getOpenFileName(self, 'Open File', '',
                                     '(*.py);;(*.*)'))
     if not fileName:
         return
     try:
         self._central.actual_tab().notOpening = False
         content = self.read_file_content(fileName)
         editor = factory_editor(fileName, self._central.actual_tab())
         editor.setPlainText(content)
         editor.path = fileName
         #self.add_tab(editor, self.get_file_name(fileName))
         if not editor.has_write_permission():
             fileName += ' (Read-Only)'
         self.add_tab(editor, self.get_file_name(fileName))
         self.change_window_title(fileName)
     except Exception, reason:
         print reason
         QMessageBox.information(self, 'Incorrect File',
                                 'The file does not exist!')
コード例 #4
0
ファイル: main_window.py プロジェクト: calpe20/PYTHONIZANDO
 def open_document(self, fileName, project=None):
     try:
         if not self._central.actual_tab().is_open(fileName):
             self._central.actual_tab().notOpening = False
             editor = factory_editor(fileName, self._central.actual_tab(),
                                     project)
             content = self.read_file_content(fileName)
             editor.setPlainText(content)
             editor.path = fileName
             editor.ask_if_externally_modified = True
             #self.add_tab(editor, self.get_file_name(fileName))
             if not editor.has_write_permission():
                 fileName += ' (Read-Only)'
             self.add_tab(editor, self.get_file_name(fileName))
             self.change_window_title(fileName)
         else:
             self._central.actual_tab().move_to_open(fileName)
     except Exception, reason:
         print reason
         QMessageBox.information(self, 'Incorrect File',
                                 'The file couldn\'t be open')
コード例 #5
0
ファイル: main_window.py プロジェクト: calpe20/PYTHONIZANDO
 def new_editor(self, lang="py"):
     if not self._reloading:
         editor = factory_editor(lang, self._central.actual_tab())
         self.add_tab(editor, "New Document")
コード例 #6
0
ファイル: main_window.py プロジェクト: calpe20/PYTHONIZANDO
 def new_editor(self, lang='py'):
     if not self._reloading:
         editor = factory_editor(lang, self._central.actual_tab())
         self.add_tab(editor, 'New Document')