示例#1
0
    def update_found_chip_files(self):
        self.chip_filenames_list = os.listdir(
            self.chip_file_dir
        )  # list of all chip files

        # put chip files into chipFile_list
        self.chip_files_listwidget = QtImport.QListWidget(
            self.ssx_widget_layout.chip_file_list
        )
        self.chip_files_listwidget.addItems(self.chip_filenames_list)

        # add connection to the chipFiles_widget
        self.chip_files_listwidget.itemClicked.connect(self.chip_selected)
示例#2
0
    def __init__(self, configuration):

        QtImport.QDialog.__init__(self, None)

        # Internal values -----------------------------------------------------
        self.has_changed = None
        self.configuration = configuration
        self.signalling_child_dict = {}
        self.receiving_child_dict = {}
        self.connecting_child_dict = {}

        # Signals ------------------------------------------------------------

        # Slots ---------------------------------------------------------------

        # Graphic elements ----------------------------------------------------
        main_splitter = QtImport.QSplitter(QtImport.Qt.Vertical, self)
        top_panel = QtImport.QWidget(main_splitter)
        bot_panel = QtImport.QWidget(main_splitter)

        emitter_panel = QtImport.QWidget(top_panel)
        self.emitter_windows_listwidget = QtImport.QListWidget(emitter_panel)
        self.emitter_objects_listwidget = QtImport.QListWidget(emitter_panel)
        self.emitter_signals_listwidget = QtImport.QListWidget(emitter_panel)
        self.emitter_objects_listwidget.setSortingEnabled(True)
        self.emitter_signals_listwidget.setSortingEnabled(True)

        receiver_panel = QtImport.QWidget(top_panel)
        self.receiver_windows_listwidget = QtImport.QListWidget(emitter_panel)
        self.receiver_objects_listwidget = QtImport.QListWidget(emitter_panel)
        self.receiver_slots_listwidget = QtImport.QListWidget(emitter_panel)
        self.receiver_objects_listwidget.setSortingEnabled(True)
        self.receiver_slots_listwidget.setSortingEnabled(True)

        self.add_connection_button = QtImport.QPushButton(
            "Add connection", self)

        self.connections_treewidget = QtImport.QTreeWidget(bot_panel)
        button_panel = QtImport.QWidget(bot_panel)
        self.remove_connection_button = QtImport.QPushButton(
            "Remove connection", button_panel)
        self.ok_button = QtImport.QPushButton("OK", button_panel)
        self.cancel_button = QtImport.QPushButton("Cancel", button_panel)

        # Layout --------------------------------------------------------------
        emitter_panel_layout = QtImport.QGridLayout(emitter_panel)
        emitter_panel_layout.addWidget(
            QtImport.QLabel("<h3>Emitters</h3>", self), 0, 1,
            QtImport.Qt.AlignHCenter)
        emitter_panel_layout.addWidget(QtImport.QLabel("Windows", self), 1, 0)
        emitter_panel_layout.addWidget(QtImport.QLabel("Objects", self), 1, 1)
        emitter_panel_layout.addWidget(QtImport.QLabel("Signals", self), 1, 2)
        emitter_panel_layout.addWidget(self.emitter_windows_listwidget, 2, 0)
        emitter_panel_layout.addWidget(self.emitter_objects_listwidget, 2, 1)
        emitter_panel_layout.addWidget(self.emitter_signals_listwidget, 2, 2)

        receiver_panel_layout = QtImport.QGridLayout(receiver_panel)
        receiver_panel_layout.addWidget(
            QtImport.QLabel("<h3>Receivers</h3>", self), 0, 1,
            QtImport.Qt.AlignHCenter)
        receiver_panel_layout.addWidget(QtImport.QLabel("Windows", self), 1, 0)
        receiver_panel_layout.addWidget(QtImport.QLabel("Objects", self), 1, 1)
        receiver_panel_layout.addWidget(QtImport.QLabel("Slots", self), 1, 2)
        receiver_panel_layout.addWidget(self.receiver_windows_listwidget, 2, 0)
        receiver_panel_layout.addWidget(self.receiver_objects_listwidget, 2, 1)
        receiver_panel_layout.addWidget(self.receiver_slots_listwidget, 2, 2)

        top_panel_layout = QtImport.QHBoxLayout(top_panel)
        top_panel_layout.addWidget(emitter_panel)
        top_panel_layout.addWidget(receiver_panel)
        top_panel_layout.addWidget(self.add_connection_button)
        top_panel_layout.setSpacing(0)
        top_panel_layout.setContentsMargins(0, 0, 0, 0)

        button_panel_layout = QtImport.QHBoxLayout(button_panel)
        button_panel_layout.addWidget(self.remove_connection_button)
        button_panel_layout.addStretch(0)
        button_panel_layout.addWidget(self.ok_button, QtImport.Qt.AlignRight)
        button_panel_layout.addWidget(self.cancel_button,
                                      QtImport.Qt.AlignRight)

        bot_panel_vlayout = QtImport.QVBoxLayout(bot_panel)
        bot_panel_vlayout.addWidget(
            QtImport.QLabel("<h3>Established connections</h3>", bot_panel))
        bot_panel_vlayout.addWidget(self.connections_treewidget)
        bot_panel_vlayout.addWidget(button_panel)

        main_splitter_vbox = QtImport.QVBoxLayout(main_splitter)
        main_splitter_vbox.addWidget(top_panel)
        main_splitter_vbox.addWidget(bot_panel)
        main_splitter_vbox.setSpacing(5)
        main_splitter_vbox.setContentsMargins(2, 2, 2, 2)

        main_layout = QtImport.QVBoxLayout(self)
        main_layout.addWidget(main_splitter)

        # SizePolicies --------------------------------------------------------
        self.add_connection_button.setSizePolicy(QtImport.QSizePolicy.Fixed,
                                                 QtImport.QSizePolicy.Fixed)
        self.remove_connection_button.setSizePolicy(QtImport.QSizePolicy.Fixed,
                                                    QtImport.QSizePolicy.Fixed)
        self.ok_button.setSizePolicy(QtImport.QSizePolicy.Fixed,
                                     QtImport.QSizePolicy.Fixed)
        self.cancel_button.setSizePolicy(QtImport.QSizePolicy.Fixed,
                                         QtImport.QSizePolicy.Fixed)
        self.connections_treewidget.setSizePolicy(
            QtImport.QSizePolicy.Expanding, QtImport.QSizePolicy.Expanding)

        # Qt signal/slot connections ------------------------------------------
        self.emitter_windows_listwidget.currentItemChanged.connect(
            self.emitter_window_changed)
        self.emitter_objects_listwidget.currentItemChanged.connect(
            self.emitter_object_changed)
        self.receiver_windows_listwidget.currentItemChanged.connect(
            self.receiver_window_changed)
        self.receiver_objects_listwidget.currentItemChanged.connect(
            self.receiver_object_changed)
        self.add_connection_button.clicked.connect(
            self.add_connection_button_clicked)
        self.remove_connection_button.clicked.connect(
            self.remove_connection_button_clicked)
        self.ok_button.clicked.connect(self.ok_button_clicked)
        self.cancel_button.clicked.connect(self.cancel_button_clicked)
        self.connections_treewidget.itemSelectionChanged.connect(
            self.connections_treewidget_selection_changed)

        # Other ---------------------------------------------------------------
        self.connections_treewidget.setColumnCount(7)
        self.connections_treewidget.setHeaderLabels([
            "",
            "Emitter window",
            "Emitter object",
            "Signal",
            "Receiver window",
            "Receiver object",
            "Slot",
        ])
        self.setWindowTitle("Connection Editor")
        self.connections_treewidget.setSortingEnabled(True)