Project/FiletypeAssociationDialog.py

changeset 564
b3d966393ba9
parent 97
c4086afea02b
child 791
9ec2ac20e54e
equal deleted inserted replaced
563:e35d2cda9a74 564:b3d966393ba9
97 Private slot to add the association displayed to the list. 97 Private slot to add the association displayed to the list.
98 """ 98 """
99 pattern = self.filePatternEdit.text() 99 pattern = self.filePatternEdit.text()
100 filetype = self.filetypeCombo.currentText() 100 filetype = self.filetypeCombo.currentText()
101 if pattern: 101 if pattern:
102 items = self.filetypeAssociationList.findItems(\ 102 items = self.filetypeAssociationList.findItems(
103 pattern, Qt.MatchFlags(Qt.MatchExactly), 0) 103 pattern, Qt.MatchFlags(Qt.MatchExactly), 0)
104 for itm in items: 104 for itm in items:
105 itm = self.filetypeAssociationList.takeTopLevelItem(\ 105 itm = self.filetypeAssociationList.takeTopLevelItem(
106 self.filetypeAssociationList.indexOfTopLevelItem(itm)) 106 self.filetypeAssociationList.indexOfTopLevelItem(itm))
107 del itm 107 del itm
108 itm = self.__createItem(pattern, filetype) 108 itm = self.__createItem(pattern, filetype)
109 self.__resort() 109 self.__resort()
110 self.__reformat() 110 self.__reformat()
116 def on_deleteAssociationButton_clicked(self): 116 def on_deleteAssociationButton_clicked(self):
117 """ 117 """
118 Private slot to delete the currently selected association of the listbox. 118 Private slot to delete the currently selected association of the listbox.
119 """ 119 """
120 for itm in self.filetypeAssociationList.selectedItems(): 120 for itm in self.filetypeAssociationList.selectedItems():
121 itm = self.filetypeAssociationList.takeTopLevelItem(\ 121 itm = self.filetypeAssociationList.takeTopLevelItem(
122 self.filetypeAssociationList.indexOfTopLevelItem(itm)) 122 self.filetypeAssociationList.indexOfTopLevelItem(itm))
123 del itm 123 del itm
124 124
125 self.filetypeAssociationList.clearSelection() 125 self.filetypeAssociationList.clearSelection()
126 self.filePatternEdit.clear() 126 self.filePatternEdit.clear()
138 else: 138 else:
139 self.addAssociationButton.setEnabled(True) 139 self.addAssociationButton.setEnabled(True)
140 if len(self.filetypeAssociationList.selectedItems()) == 0: 140 if len(self.filetypeAssociationList.selectedItems()) == 0:
141 self.deleteAssociationButton.setEnabled(False) 141 self.deleteAssociationButton.setEnabled(False)
142 else: 142 else:
143 self.deleteAssociationButton.setEnabled(\ 143 self.deleteAssociationButton.setEnabled(
144 self.filetypeAssociationList.selectedItems()[0].text(0) == txt) 144 self.filetypeAssociationList.selectedItems()[0].text(0) == txt)
145 145
146 def transferData(self): 146 def transferData(self):
147 """ 147 """
148 Public slot to transfer the associations into the projects data structure. 148 Public slot to transfer the associations into the projects data structure.

eric ide

mercurial