|
38 | 38 | from AnyQt.QtWidgets import QWidget, QToolButton, QVBoxLayout, QHBoxLayout, QGridLayout, QMenu, QAction,\ |
39 | 39 | QDialog, QSizePolicy, QPushButton, QListView, QLabel |
40 | 40 | from AnyQt.QtGui import QIcon, QKeySequence |
41 | | -from AnyQt.QtCore import Qt, pyqtSignal, QPoint, QSize |
| 41 | +from AnyQt.QtCore import Qt, pyqtSignal, QPoint, QSize, QObject |
42 | 42 |
|
43 | 43 | from .owconstants import NOTHING, ZOOMING, SELECT, SELECT_POLYGON, PANNING, SELECTION_ADD,\ |
44 | 44 | SELECTION_REMOVE, SELECTION_TOGGLE, SELECTION_REPLACE |
|
49 | 49 |
|
50 | 50 |
|
51 | 51 | class AddVariablesDialog(QDialog): |
| 52 | + add = pyqtSignal() |
| 53 | + |
52 | 54 | def __init__(self, master, model): |
53 | 55 | QDialog.__init__(self) |
54 | 56 |
|
@@ -131,10 +133,16 @@ def add_variables(self): |
131 | 133 | del model[i] |
132 | 134 |
|
133 | 135 | self.master.model_selected.extend(variables) |
| 136 | + self.add.emit() |
| 137 | + |
134 | 138 |
|
| 139 | +class VariablesSelection(QObject): |
| 140 | + added = pyqtSignal() |
| 141 | + removed = pyqtSignal() |
135 | 142 |
|
136 | | -class VariablesSelection: |
137 | | - def __init__(self, master, model_selected, model_other, widget=None): |
| 143 | + def __init__(self, master, model_selected, model_other, |
| 144 | + widget=None, parent=None): |
| 145 | + super().__init__(parent) |
138 | 146 | self.master = master |
139 | 147 | self.model_selected = model_selected |
140 | 148 | self.model_other = model_other |
@@ -194,9 +202,11 @@ def __deactivate_selection(self): |
194 | 202 | del model[i] |
195 | 203 |
|
196 | 204 | self.model_other.extend(variables) |
| 205 | + self.removed.emit() |
197 | 206 |
|
198 | 207 | def _action_add(self): |
199 | 208 | self.add_variables_dialog = AddVariablesDialog(self, self.model_other) |
| 209 | + self.add_variables_dialog.add.connect(lambda: self.added.emit()) |
200 | 210 |
|
201 | 211 |
|
202 | 212 | class OrientedWidget(QWidget): |
|
0 commit comments