50 @pyqtSlot() |
50 @pyqtSlot() |
51 def on_addButton_clicked(self): |
51 def on_addButton_clicked(self): |
52 """ |
52 """ |
53 Private slot to add a patch to the list of selected patches. |
53 Private slot to add a patch to the list of selected patches. |
54 """ |
54 """ |
55 row = self.sourcePatches.indexOfTopLevelItem(self.sourcePatches.currentItem()) |
55 row = self.sourcePatches.indexOfTopLevelItem( |
|
56 self.sourcePatches.currentItem()) |
56 itm = self.sourcePatches.takeTopLevelItem(row) |
57 itm = self.sourcePatches.takeTopLevelItem(row) |
57 |
58 |
58 curItm = self.selectedPatches.currentItem() |
59 curItm = self.selectedPatches.currentItem() |
59 if curItm is not None: |
60 if curItm is not None: |
60 row = self.selectedPatches.indexOfTopLevelItem(curItm) + 1 |
61 row = self.selectedPatches.indexOfTopLevelItem(curItm) + 1 |
67 @pyqtSlot() |
68 @pyqtSlot() |
68 def on_removeButton_clicked(self): |
69 def on_removeButton_clicked(self): |
69 """ |
70 """ |
70 Private slot to remove a patch from the list of selected patches. |
71 Private slot to remove a patch from the list of selected patches. |
71 """ |
72 """ |
72 row = self.selectedPatches.indexOfTopLevelItem(self.selectedPatches.currentItem()) |
73 row = self.selectedPatches.indexOfTopLevelItem( |
|
74 self.selectedPatches.currentItem()) |
73 itm = self.selectedPatches.takeTopLevelItem(row) |
75 itm = self.selectedPatches.takeTopLevelItem(row) |
74 self.sourcePatches.addTopLevelItem(itm) |
76 self.sourcePatches.addTopLevelItem(itm) |
75 self.sourcePatches.sortItems(0, Qt.AscendingOrder) |
77 self.sourcePatches.sortItems(0, Qt.AscendingOrder) |
76 |
78 |
77 self.__updateOkButton() |
79 self.__updateOkButton() |
79 @pyqtSlot() |
81 @pyqtSlot() |
80 def on_upButton_clicked(self): |
82 def on_upButton_clicked(self): |
81 """ |
83 """ |
82 Private slot to move a patch up in the list. |
84 Private slot to move a patch up in the list. |
83 """ |
85 """ |
84 row = self.selectedPatches.indexOfTopLevelItem(self.selectedPatches.currentItem()) |
86 row = self.selectedPatches.indexOfTopLevelItem( |
|
87 self.selectedPatches.currentItem()) |
85 if row > 0: |
88 if row > 0: |
86 targetRow = row - 1 |
89 targetRow = row - 1 |
87 itm = self.selectedPatches.takeTopLevelItem(row) |
90 itm = self.selectedPatches.takeTopLevelItem(row) |
88 self.selectedPatches.insertTopLevelItem(targetRow, itm) |
91 self.selectedPatches.insertTopLevelItem(targetRow, itm) |
89 self.selectedPatches.setCurrentItem(itm) |
92 self.selectedPatches.setCurrentItem(itm) |
91 @pyqtSlot() |
94 @pyqtSlot() |
92 def on_downButton_clicked(self): |
95 def on_downButton_clicked(self): |
93 """ |
96 """ |
94 Private slot to move a patch down in the list. |
97 Private slot to move a patch down in the list. |
95 """ |
98 """ |
96 row = self.selectedPatches.indexOfTopLevelItem(self.selectedPatches.currentItem()) |
99 row = self.selectedPatches.indexOfTopLevelItem( |
|
100 self.selectedPatches.currentItem()) |
97 if row < self.selectedPatches.topLevelItemCount() - 1: |
101 if row < self.selectedPatches.topLevelItemCount() - 1: |
98 targetRow = row + 1 |
102 targetRow = row + 1 |
99 itm = self.selectedPatches.takeTopLevelItem(row) |
103 itm = self.selectedPatches.takeTopLevelItem(row) |
100 self.selectedPatches.insertTopLevelItem(targetRow, itm) |
104 self.selectedPatches.insertTopLevelItem(targetRow, itm) |
101 self.selectedPatches.setCurrentItem(itm) |
105 self.selectedPatches.setCurrentItem(itm) |
104 def on_sourcePatches_currentItemChanged(self, current, previous): |
108 def on_sourcePatches_currentItemChanged(self, current, previous): |
105 """ |
109 """ |
106 Private slot to react on changes of the current item of source patches. |
110 Private slot to react on changes of the current item of source patches. |
107 |
111 |
108 @param current reference to the new current item (QTreeWidgetItem) |
112 @param current reference to the new current item (QTreeWidgetItem) |
109 @param previous reference to the previous current item (QTreeWidgetItem) |
113 @param previous reference to the previous current item |
|
114 (QTreeWidgetItem) |
110 """ |
115 """ |
111 self.addButton.setEnabled(current is not None) |
116 self.addButton.setEnabled(current is not None) |
112 |
117 |
113 @pyqtSlot(QTreeWidgetItem, QTreeWidgetItem) |
118 @pyqtSlot(QTreeWidgetItem, QTreeWidgetItem) |
114 def on_selectedPatches_currentItemChanged(self, current, previous): |
119 def on_selectedPatches_currentItemChanged(self, current, previous): |
115 """ |
120 """ |
116 Private slot to react on changes of the current item of selected patches. |
121 Private slot to react on changes of the current item of selected |
|
122 patches. |
117 |
123 |
118 @param current reference to the new current item (QTreeWidgetItem) |
124 @param current reference to the new current item (QTreeWidgetItem) |
119 @param previous reference to the previous current item (QTreeWidgetItem) |
125 @param previous reference to the previous current item |
|
126 (QTreeWidgetItem) |
120 """ |
127 """ |
121 self.removeButton.setEnabled(current is not None) |
128 self.removeButton.setEnabled(current is not None) |
122 |
129 |
123 row = self.selectedPatches.indexOfTopLevelItem(current) |
130 row = self.selectedPatches.indexOfTopLevelItem(current) |
124 self.upButton.setEnabled(row > 0) |
131 self.upButton.setEnabled(row > 0) |
125 self.downButton.setEnabled(row < self.selectedPatches.topLevelItemCount() - 1) |
132 self.downButton.setEnabled( |
|
133 row < self.selectedPatches.topLevelItemCount() - 1) |
126 |
134 |
127 def getData(self): |
135 def getData(self): |
128 """ |
136 """ |
129 Public method to retrieve the entered data. |
137 Public method to retrieve the entered data. |
130 |
138 |