Пример #1
0
 def commitData(self, editor):
     """Change tree based on results of edit operation"""
     text = unicode(editor.text())
     item = globalref.docRef.selection[0]
     if text and text != item.title() and item == self.editedItem and \
                 item.setTitle(text, True):
         QtGui.QListWidget.commitData(self, editor)
         globalref.updateRightView()
     self.editedItem = None
Пример #2
0
 def commitData(self, editor):
     """Change tree based on results of edit operation"""
     text = unicode(editor.text())
     item = self.editedItem
     if text and text != item.title() and item.setTitle(text, True):
         QtGui.QTreeWidget.commitData(self, editor)
         self.resizeColumnToContents(0)
         globalref.updateRightView()
     self.editedItem = None
Пример #3
0
 def commitData(self, editor):
     """Change tree based on results of edit operation"""
     text = unicode(editor.text())
     item = self.editedItem
     if text and text != item.title() and item.setTitle(text, True):
         QtGui.QTreeWidget.commitData(self, editor)
         self.resizeColumnToContents(0)
         globalref.updateRightView()
     self.editedItem = None
Пример #4
0
 def commitData(self, editor):
     """Change tree based on results of edit operation"""
     text = unicode(editor.text())
     item = globalref.docRef.selection[0]
     if text and text != item.title() and item == self.editedItem and \
                 item.setTitle(text, True):
         QtGui.QListWidget.commitData(self, editor)
         globalref.updateRightView()
     self.editedItem = None
Пример #5
0
 def changeSelected(self):
     """Set selection based on signal"""
     selections = self.selectedItems()[:]
     if len(selections) > 1 and \
             globalref.options.strData('SelectOrder') == 'tree':
         for item in selections:
             item.loadTempSortKey()
         selections.sort(lambda x, y: cmp(x.tempSortKey, y.tempSortKey))
     globalref.docRef.selection.replace(
         [item.docItemRef for item in selections])
     globalref.updateRightView()
Пример #6
0
 def changeSelected(self):
     """Set selection based on signal"""
     selections = self.selectedItems()[:]
     if len(selections) > 1 and \
             globalref.options.strData('SelectOrder') == 'tree':
         for item in selections:
             item.loadTempSortKey()
         selections.sort(lambda x,y: cmp(x.tempSortKey, y.tempSortKey))
     globalref.docRef.selection.replace([item.docItemRef for item in
                                         selections])
     globalref.updateRightView()
Пример #7
0
 def changeSelected(self):
     """Set selection based on signal"""
     selections = self.selectedItems()[:]
     if len(selections) > 1 and (
         globalref.options.strData("SelectOrder") == "tree" or len(selections) > len(globalref.docRef.selection) + 1
     ):
         # sort if tree order or always for shift-select
         for item in selections:
             item.loadTempSortKey()
         selections.sort(lambda x, y: cmp(x.tempSortKey, y.tempSortKey))
     globalref.docRef.selection.replace([item.docItemRef for item in selections])
     globalref.updateRightView()
Пример #8
0
 def updateSelect(self):
     """Update view selection"""
     self.blockSignals(True)
     self.clearSelection()
     selectList = []
     for item in globalref.docRef.selection:
         if hasattr(item.viewData, 'listWidget'):
             try:
                 item.viewData.text()
                 selectList.append(item)
             except RuntimeError:
                 pass
     if len(selectList) < len(globalref.docRef.selection):
         if not selectList and self.item(0):
             selectList = [self.item(0).docItemRef]
         globalref.docRef.selection.replace(selectList)
         globalref.updateRightView()
     if selectList:
         self.setCurrentItem(selectList[-1].viewData)
         globalref.docRef.selection.currentItem = selectList[-1]
         self.scrollToItem(selectList[-1].viewData)
         for node in selectList:
             self.setItemSelected(node.viewData, True)
     self.blockSignals(False)
Пример #9
0
 def updateSelect(self):
     """Update view selection"""
     self.blockSignals(True)
     self.clearSelection()
     selectList = []
     for item in globalref.docRef.selection:
         if hasattr(item.viewData, 'listWidget'):
             try:
                 item.viewData.text()
                 selectList.append(item)
             except RuntimeError:
                 pass
     if len(selectList) < len(globalref.docRef.selection):
         if not selectList and self.item(0):
             selectList = [self.item(0).docItemRef]
         globalref.docRef.selection.replace(selectList)
         globalref.updateRightView()
     if selectList:
         self.setCurrentItem(selectList[-1].viewData)
         globalref.docRef.selection.currentItem = selectList[-1]
         self.scrollToItem(selectList[-1].viewData)
         for node in selectList:
             self.setItemSelected(node.viewData, True)
     self.blockSignals(False)