コード例 #1
0
 def _open_file(self, item, val):
     if item.childCount() == 0 and not item.isFolder:
         fileName = os.path.join(item.path, str(item.text(val)))
         if (manage_files.get_file_extension(fileName)) in ('.jpg', '.png'):
             self._main.open_image(fileName)
         elif (manage_files.get_file_extension(fileName)).endswith('.ui'):
             self.w = uic.loadUi(fileName)
             self.w.show()
         else:
             item = self._get_project_root()
             self._main.open_document(fileName, self.projects[item])
コード例 #2
0
 def _show_follow_mode(self):
     if type(self._tabs.obtain_editor()) is not Editor:
         return
     if self._tabs2.isVisible() and not self._follow_mode:
         self.show_split(self.orientation())
     if self._follow_mode:
         self._follow_mode = False
         self._tabs2._close_tab(0)
         self._tabs2.hide()
         self._tabs2.setTabsClosable(True)
         self._tabs._follow_mode = False
         self._tabs2._follow_mode = False
     else:
         #check if is instance of Editor
         self._follow_mode = True
         self.setOrientation(Qt.Horizontal)
         editor = self._tabs.obtain_editor()
         name = str(self._tabs.tabText(self._tabs.currentIndex()))
         editor2 = factory_editor(
             manage_files.get_file_extension(name)[1:], self._tabs2)
         editor2.setPlainText(editor.get_text())
         editor2.setReadOnly(True)
         self._tabs2.add_tab(editor2, name)
         if editor.textModified:
             self._tabs2.mark_as_changed(True)
         self._tabs._follow_mode = True
         self._tabs2._follow_mode = True
         self._tabs2.show()
         editor2.verticalScrollBar().setRange(
             editor.sidebarWidget.highest_line - 2, 0)
         self._tabs2.setTabsClosable(False)
         self.setSizes([1, 1])
コード例 #3
0
ファイル: central_widget.py プロジェクト: aztli/Traducciones
 def _show_follow_mode(self):
     if type(self._tabs.obtain_editor()) is not Editor:
         return
     if self._tabs2.isVisible() and not self._follow_mode:
         self.show_split(self.orientation())
     if self._follow_mode:
         self._follow_mode = False
         self._tabs2._close_tab(0)
         self._tabs2.hide()
         self._tabs2.setTabsClosable(True)
         self._tabs._follow_mode = False
         self._tabs2._follow_mode = False
     else:
         #check if is instance of Editor
         self._follow_mode = True
         self.setOrientation(Qt.Horizontal)
         editor = self._tabs.obtain_editor()
         name = str(self._tabs.tabText(self._tabs.currentIndex()))
         editor2 = factory_editor(
             manage_files.get_file_extension(name)[1:], self._tabs2)
         editor2.setPlainText(editor.get_text())
         editor2.setReadOnly(True)
         self._tabs2.add_tab(editor2, name)
         if editor.textModified:
             self._tabs2.mark_as_changed(True)
         self._tabs._follow_mode = True
         self._tabs2._follow_mode = True
         self._tabs2.show()
         editor2.verticalScrollBar().setRange(editor.sidebarWidget.highest_line - 2, 0)
         self._tabs2.setTabsClosable(False)
         self.setSizes([1, 1])
コード例 #4
0
 def _refresh_symbols(self):
     editor = self._central.obtain_editor()
     if editor:
         #we only show symbols for Python!
         if manage_files.get_file_extension(editor.path) == ".py" and \
           editor.get_project_folder() is not None:
             path = os.path.dirname(editor.path)
             fileName = os.path.basename(editor.path)
             self._properties._treeSymbols.refresh(path, fileName)
コード例 #5
0
 def get_file_extension(self, fileName):
     return manage_files.get_file_extension(fileName)[1:]
コード例 #6
0
 def lang(self):
     if self.mainFile != '':
         return manage_files.get_file_extension(self.mainFile)[1:]
コード例 #7
0
 def obtain_icon(self, fileName):
     return QIcon(self.images.get(manage_files.get_file_extension(fileName), resources.images['tree-generic']))
コード例 #8
0
 def get_file_extension(self, fileName):
     return manage_files.get_file_extension(fileName)[1:]