Exemplo n.º 1
0
 def collapse_all(self):
     """
     Collapses all triggers and makes all blocks with fold level > 0
     invisible.
     """
     self._clear_block_deco()
     block = self.editor.document().firstBlock()
     last = self.editor.document().lastBlock()
     while block.isValid():
         lvl = TextBlockHelper.get_fold_lvl(block)
         trigger = TextBlockHelper.is_fold_trigger(block)
         if trigger:
             if lvl == 0:
                 self._show_previous_blank_lines(block)
             TextBlockHelper.set_collapsed(block, True)
         block.setVisible(lvl == 0)
         if block == last and block.text().strip() == '':
             block.setVisible(True)
             self._show_previous_blank_lines(block)
         block = block.next()
     self._refresh_editor_and_scrollbars()
     tc = self.editor.textCursor()
     tc.movePosition(tc.Start)
     self.editor.setTextCursor(tc)
     self.collapse_all_triggered.emit()
Exemplo n.º 2
0
 def collapse_all(self):
     """
     Collapses all triggers and makes all blocks with fold level > 0
     invisible.
     """
     self._clear_block_deco()
     block = self.editor.document().firstBlock()
     last = self.editor.document().lastBlock()
     while block.isValid():
         lvl = TextBlockHelper.get_fold_lvl(block)
         trigger = TextBlockHelper.is_fold_trigger(block)
         if trigger:
             if lvl == 0:
                 self._show_previous_blank_lines(block)
             TextBlockHelper.set_collapsed(block, True)
         block.setVisible(lvl == 0)
         if block == last and block.text().strip() == '':
             block.setVisible(True)
             self._show_previous_blank_lines(block)
         block = block.next()
     self._refresh_editor_and_scrollbars()
     tc = self.editor.textCursor()
     tc.movePosition(tc.Start)
     self.editor.setTextCursor(tc)
     self.collapse_all_triggered.emit()
Exemplo n.º 3
0
 def expand_all(self):
     """
     Expands all fold triggers.
     """
     block = self.editor.document().firstBlock()
     while block.isValid():
         TextBlockHelper.set_collapsed(block, False)
         block.setVisible(True)
         block = block.next()
     self._clear_block_deco()
     self._refresh_editor_and_scrollbars()
     self.expand_all_triggered.emit()
Exemplo n.º 4
0
 def expand_all(self):
     """
     Expands all fold triggers.
     """
     block = self.editor.document().firstBlock()
     while block.isValid():
         TextBlockHelper.set_collapsed(block, False)
         block.setVisible(True)
         block = block.next()
     self._clear_block_deco()
     self._refresh_editor_and_scrollbars()
     self.expand_all_triggered.emit()