Code Duplication    Length = 16-19 lines in 10 locations

gui/pulsed/pulsed_maingui.py 6 locations

@@ 3515-3533 (lines=19) @@
3512
        self._mw.seq_editor_TableWidget.blockSignals(False)
3513
        self._update_current_pulse_sequence()
3514
3515
    def sequence_editor_add_row_after_last(self, insert_rows=1):
3516
        """ Add row after last row in the sequence editor. """
3517
3518
        self._mw.seq_editor_TableWidget.blockSignals(True)
3519
3520
        # the signal passes a boolean value, which overwrites the insert_rows
3521
        # parameter. Check that here and use the actual default value:
3522
        if type(insert_rows) is bool:
3523
            insert_rows = 1
3524
3525
        number_of_rows = self._mw.seq_editor_TableWidget.rowCount()
3526
3527
        self._mw.seq_editor_TableWidget.setRowCount(
3528
            number_of_rows + insert_rows)
3529
        self.initialize_cells_sequence_editor(start_row=number_of_rows,
3530
                                              stop_row=number_of_rows + insert_rows)
3531
3532
        self._mw.seq_editor_TableWidget.blockSignals(False)
3533
        self._update_current_pulse_sequence()
3534
3535
    def sequence_editor_delete_row_selected(self):
3536
        """ Delete row of selected element. """
@@ 3495-3513 (lines=19) @@
3492
                model.setData(index, ini_values[0], ini_values[1])
3493
3494
3495
    def sequence_editor_add_row_before_selected(self, insert_rows=1):
3496
        """ Add row before selected element. """
3497
3498
        self._mw.seq_editor_TableWidget.blockSignals(True)
3499
3500
        selected_row = self._mw.seq_editor_TableWidget.currentRow()
3501
3502
        # the signal passes a boolean value, which overwrites the insert_rows
3503
        # parameter. Check that here and use the actual default value:
3504
        if type(insert_rows) is bool:
3505
            insert_rows = 1
3506
3507
        for rows in range(insert_rows):
3508
            self._mw.seq_editor_TableWidget.insertRow(selected_row)
3509
        self.initialize_cells_sequence_editor(start_row=selected_row,
3510
                                              stop_row=selected_row + insert_rows)
3511
3512
        self._mw.seq_editor_TableWidget.blockSignals(False)
3513
        self._update_current_pulse_sequence()
3514
3515
    def sequence_editor_add_row_after_last(self, insert_rows=1):
3516
        """ Add row after last row in the sequence editor. """
@@ 1802-1819 (lines=18) @@
1799
1800
        return table
1801
1802
    def block_editor_add_row_before_selected(self, insert_rows=1):
1803
        """ Add row before selected element. """
1804
1805
        self._mw.block_editor_TableWidget.blockSignals(True)
1806
1807
        selected_row = self._mw.block_editor_TableWidget.currentRow()
1808
1809
        # the signal passes a boolean value, which overwrites the insert_rows
1810
        # parameter. Check that here and use the actual default value:
1811
        if type(insert_rows) is bool:
1812
            insert_rows = 1
1813
1814
        for rows in range(insert_rows):
1815
            self._mw.block_editor_TableWidget.insertRow(selected_row)
1816
        self.initialize_cells_block_editor(start_row=selected_row,
1817
                                           stop_row=selected_row + insert_rows)
1818
1819
        self._mw.block_editor_TableWidget.blockSignals(False)
1820
1821
    def block_editor_add_row_after_last(self, insert_rows=1):
1822
        """ Add row after last row in the block editor. """
@@ 1983-2000 (lines=18) @@
1980
        self._update_current_pulse_block_ensemble()
1981
1982
1983
    def block_organizer_add_row_after_last(self, insert_rows=1):
1984
        """ Add row after last row in the block editor. """
1985
        self._mw.block_organizer_TableWidget.blockSignals(True)
1986
1987
        # the signal of a QPushButton passes an optional boolean value to this
1988
        # method, which overwrites the insert_rows parameter. Check that here
1989
        # and use the actual default value:
1990
        if type(insert_rows) is bool:
1991
            insert_rows = 1
1992
1993
        number_of_rows = self._mw.block_organizer_TableWidget.rowCount()
1994
        self._mw.block_organizer_TableWidget.setRowCount(number_of_rows+insert_rows)
1995
1996
        self.initialize_cells_block_organizer(start_row=number_of_rows,
1997
                                              stop_row=number_of_rows + insert_rows)
1998
1999
        self._mw.block_organizer_TableWidget.blockSignals(False)
2000
        self._update_current_pulse_block_ensemble()
2001
2002
    def block_organizer_delete_row_selected(self):
2003
        """ Delete row of selected element. """
@@ 1821-1838 (lines=18) @@
1818
1819
        self._mw.block_editor_TableWidget.blockSignals(False)
1820
1821
    def block_editor_add_row_after_last(self, insert_rows=1):
1822
        """ Add row after last row in the block editor. """
1823
1824
        self._mw.block_editor_TableWidget.blockSignals(True)
1825
1826
        # the signal passes a boolean value, which overwrites the insert_rows
1827
        # parameter. Check that here and use the actual default value:
1828
        if type(insert_rows) is bool:
1829
            insert_rows = 1
1830
1831
        number_of_rows = self._mw.block_editor_TableWidget.rowCount()
1832
1833
        self._mw.block_editor_TableWidget.setRowCount(
1834
            number_of_rows + insert_rows)
1835
        self.initialize_cells_block_editor(start_row=number_of_rows,
1836
                                           stop_row=number_of_rows + insert_rows)
1837
1838
        self._mw.block_editor_TableWidget.blockSignals(False)
1839
1840
    def block_editor_delete_row_selected(self):
1841
        """ Delete row of selected element. """
@@ 1965-1980 (lines=16) @@
1962
1963
1964
1965
    def block_organizer_add_row_before_selected(self,insert_rows=1):
1966
        """ Add row before selected element. """
1967
        self._mw.block_organizer_TableWidget.blockSignals(True)
1968
        selected_row = self._mw.block_organizer_TableWidget.currentRow()
1969
1970
        # the signal passes a boolean value, which overwrites the insert_rows
1971
        # parameter. Check that here and use the actual default value:
1972
        if type(insert_rows) is bool:
1973
            insert_rows = 1
1974
1975
        for rows in range(insert_rows):
1976
            self._mw.block_organizer_TableWidget.insertRow(selected_row)
1977
1978
        self.initialize_cells_block_organizer(start_row=selected_row)
1979
        self._mw.block_organizer_TableWidget.blockSignals(False)
1980
        self._update_current_pulse_block_ensemble()
1981
1982
1983
    def block_organizer_add_row_after_last(self, insert_rows=1):

gui/pulsed/pulse_editor.py 4 locations

@@ 1506-1523 (lines=18) @@
1503
        self._update_current_pulse_block_ensemble()
1504
1505
1506
    def block_organizer_add_row_after_last(self, insert_rows=1):
1507
        """ Add row after last row in the block editor. """
1508
        self._pe.block_organizer_TableWidget.blockSignals(True)
1509
1510
        # the signal of a QPushButton passes an optional boolean value to this
1511
        # method, which overwrites the insert_rows parameter. Check that here
1512
        # and use the actual default value:
1513
        if type(insert_rows) is bool:
1514
            insert_rows = 1
1515
1516
        number_of_rows = self._pe.block_organizer_TableWidget.rowCount()
1517
        self._pe.block_organizer_TableWidget.setRowCount(number_of_rows+insert_rows)
1518
1519
        self.initialize_cells_block_organizer(start_row=number_of_rows,
1520
                                              stop_row=number_of_rows + insert_rows)
1521
1522
        self._pe.block_organizer_TableWidget.blockSignals(False)
1523
        self._update_current_pulse_block_ensemble()
1524
1525
    def block_organizer_delete_row_selected(self):
1526
        """ Delete row of selected element. """
@@ 1344-1361 (lines=18) @@
1341
1342
        self._pe.block_editor_TableWidget.blockSignals(False)
1343
1344
    def block_editor_add_row_after_last(self, insert_rows=1):
1345
        """ Add row after last row in the block editor. """
1346
1347
        self._pe.block_editor_TableWidget.blockSignals(True)
1348
1349
        # the signal passes a boolean value, which overwrites the insert_rows
1350
        # parameter. Check that here and use the actual default value:
1351
        if type(insert_rows) is bool:
1352
            insert_rows = 1
1353
1354
        number_of_rows = self._pe.block_editor_TableWidget.rowCount()
1355
1356
        self._pe.block_editor_TableWidget.setRowCount(
1357
            number_of_rows + insert_rows)
1358
        self.initialize_cells_block_editor(start_row=number_of_rows,
1359
                                           stop_row=number_of_rows + insert_rows)
1360
1361
        self._pe.block_editor_TableWidget.blockSignals(False)
1362
1363
    def block_editor_delete_row_selected(self):
1364
        """ Delete row of selected element. """
@@ 1325-1342 (lines=18) @@
1322
1323
        return table
1324
1325
    def block_editor_add_row_before_selected(self, insert_rows=1):
1326
        """ Add row before selected element. """
1327
1328
        self._pe.block_editor_TableWidget.blockSignals(True)
1329
1330
        selected_row = self._pe.block_editor_TableWidget.currentRow()
1331
1332
        # the signal passes a boolean value, which overwrites the insert_rows
1333
        # parameter. Check that here and use the actual default value:
1334
        if type(insert_rows) is bool:
1335
            insert_rows = 1
1336
1337
        for rows in range(insert_rows):
1338
            self._pe.block_editor_TableWidget.insertRow(selected_row)
1339
        self.initialize_cells_block_editor(start_row=selected_row,
1340
                                           stop_row=selected_row + insert_rows)
1341
1342
        self._pe.block_editor_TableWidget.blockSignals(False)
1343
1344
    def block_editor_add_row_after_last(self, insert_rows=1):
1345
        """ Add row after last row in the block editor. """
@@ 1488-1503 (lines=16) @@
1485
1486
1487
1488
    def block_organizer_add_row_before_selected(self,insert_rows=1):
1489
        """ Add row before selected element. """
1490
        self._pe.block_organizer_TableWidget.blockSignals(True)
1491
        selected_row = self._pe.block_organizer_TableWidget.currentRow()
1492
1493
        # the signal passes a boolean value, which overwrites the insert_rows
1494
        # parameter. Check that here and use the actual default value:
1495
        if type(insert_rows) is bool:
1496
            insert_rows = 1
1497
1498
        for rows in range(insert_rows):
1499
            self._pe.block_organizer_TableWidget.insertRow(selected_row)
1500
1501
        self.initialize_cells_block_organizer(start_row=selected_row)
1502
        self._pe.block_organizer_TableWidget.blockSignals(False)
1503
        self._update_current_pulse_block_ensemble()
1504
1505
1506
    def block_organizer_add_row_after_last(self, insert_rows=1):