Esempio n. 1
0
class MergeDialog(QDialog):
    def __init__(self, track_panels, parent = None):
        QDialog.__init__(self, parent)
        self.track_panels = track_panels
        self.layout = QVBoxLayout(self)
        self.list = QListWidget(self)
        self.list.setSelectionMode(QAbstractItemView.MultiSelection)
        for tv in track_panels:
            name = tv.curve_source.name()
            self.list.addItem(QListWidgetItem(name, self.list))

        self.ok_button = QPushButton("ok", self)
        minimum_size_policy(self.ok_button)
        QWidget.connect(self.ok_button, SIGNAL("clicked()"),
                        self.accept)

        self.list.updateGeometry()
        self.layout.addWidget(self.list)
        self.layout.addWidget(self.ok_button)
        self.updateGeometry()
        self.adjustSize()

    def selected_track_panels(self):
        selected = self.list.selectedItems()
        names = [s.text() for s in selected]
        return [tv for tv in self.track_panels 
                if tv.curve_source.name() in names]        
Esempio n. 2
0
class IndexDialog(QDialog):
    def __init__(self, track_panel, parent = None):
        QDialog.__init__(self, parent)
        self.track_panel = track_panel
        self.layout = QVBoxLayout(self)
        self.list = QListWidget(self)
        curve_names = self.track_panel.curve_source.available_curves()
        for curve_name in curve_names:
            self.list.addItem(QListWidgetItem(curve_name, self.list))

        self.ok_button = QPushButton("ok", self)
        minimum_size_policy(self.ok_button)
        QWidget.connect(self.ok_button, SIGNAL("clicked()"),
                        self.accept)
        self.list.updateGeometry()
        self.layout.addWidget(self.list)
        self.layout.addWidget(self.ok_button)
        self.updateGeometry()
        self.adjustSize()

    def index(self):
        selected, = self.list.selectedItems()
        return selected.text()