610 and a tuple containing the index of the parent selected lexer |
610 and a tuple containing the index of the parent selected lexer |
611 entry and the index of the selected entry |
611 entry and the index of the selected entry |
612 @rtype list of int and tuple of (int, int) |
612 @rtype list of int and tuple of (int, int) |
613 """ |
613 """ |
614 itm = self.styleElementList.currentItem() |
614 itm = self.styleElementList.currentItem() |
615 parent = itm.parent() |
615 if itm: |
616 if parent is None: |
616 parent = itm.parent() |
617 currentData = ( |
617 if parent is None: |
618 None, self.styleElementList.indexOfTopLevelItem(itm)) |
618 currentData = ( |
|
619 None, self.styleElementList.indexOfTopLevelItem(itm)) |
|
620 else: |
|
621 currentData = ( |
|
622 self.styleElementList.indexOfTopLevelItem(parent), |
|
623 parent.indexOfChild(itm) |
|
624 ) |
|
625 |
|
626 savedState = [ |
|
627 self.lexerLanguageComboBox.currentIndex(), |
|
628 currentData, |
|
629 ] |
619 else: |
630 else: |
620 currentData = ( |
631 savedState = [] |
621 self.styleElementList.indexOfTopLevelItem(parent), |
|
622 parent.indexOfChild(itm) |
|
623 ) |
|
624 |
|
625 savedState = [ |
|
626 self.lexerLanguageComboBox.currentIndex(), |
|
627 currentData, |
|
628 ] |
|
629 return savedState |
632 return savedState |
630 |
633 |
631 def setState(self, state): |
634 def setState(self, state): |
632 """ |
635 """ |
633 Public method to set the state of the widget. |
636 Public method to set the state of the widget. |
634 |
637 |
635 @param state state data generated by saveState |
638 @param state state data generated by saveState |
636 """ |
639 """ |
637 self.lexerLanguageComboBox.setCurrentIndex(state[0]) |
640 if state: |
638 self.on_lexerLanguageComboBox_activated( |
641 self.lexerLanguageComboBox.setCurrentIndex(state[0]) |
639 self.lexerLanguageComboBox.currentText()) |
642 self.on_lexerLanguageComboBox_activated( |
640 |
643 self.lexerLanguageComboBox.currentText()) |
641 parentIndex, index = state[1] |
644 |
642 if parentIndex is None: |
645 parentIndex, index = state[1] |
643 itm = self.styleElementList.topLevelItem(index) |
646 if parentIndex is None: |
644 else: |
647 itm = self.styleElementList.topLevelItem(index) |
645 parent = self.styleElementList.topLevelItem(parentIndex) |
648 else: |
646 itm = parent.child(index) |
649 parent = self.styleElementList.topLevelItem(parentIndex) |
647 self.styleElementList.setCurrentItem(itm) |
650 itm = parent.child(index) |
|
651 self.styleElementList.setCurrentItem(itm) |
648 |
652 |
649 ####################################################################### |
653 ####################################################################### |
650 ## Methods to add, delete and edit sub-styles and their definitions |
654 ## Methods to add, delete and edit sub-styles and their definitions |
651 ####################################################################### |
655 ####################################################################### |
652 |
656 |