Exemplo n.º 1
0
 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!")
Exemplo n.º 2
0
 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")
Exemplo n.º 3
0
 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!')
Exemplo n.º 4
0
 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')
Exemplo n.º 5
0
 def new_editor(self, lang="py"):
     if not self._reloading:
         editor = factory_editor(lang, self._central.actual_tab())
         self.add_tab(editor, "New Document")
Exemplo n.º 6
0
 def new_editor(self, lang='py'):
     if not self._reloading:
         editor = factory_editor(lang, self._central.actual_tab())
         self.add_tab(editor, 'New Document')