def __init__(self, adj, hop, parent=None):
        QDialog.__init__(self, parent)
        self.setWindowTitle('Check Clock Adjustments')
        self.setWindowIcon(QIcon('img/Avianz.ico'))
        self.setWindowFlags((self.windowFlags() ^ Qt.WindowContextHelpButtonHint) | Qt.WindowMaximizeButtonHint | Qt.WindowCloseButtonHint)

        self.parent = parent

        # list of dicts for each pair: {overlaps for each t, best overlap, best shift, (rec pair names)}
        self.shifts = adj
        self.xs = np.arange(-300*hop, 301*hop, hop)

        # top section
        self.labelCurrPage = QLabel("Page %s of %s" %(1, len(self.shifts)))
        self.labelRecs = QLabel()

        # middle section
        # The buttons to move through the overview
        self.leftBtn = QToolButton()
        self.leftBtn.setArrowType(Qt.LeftArrow)
        self.leftBtn.clicked.connect(self.moveLeft)
        self.leftBtn.setToolTip("View previous pair")
        self.rightBtn = QToolButton()
        self.rightBtn.setArrowType(Qt.RightArrow)
        self.rightBtn.clicked.connect(self.moveRight)
        self.rightBtn.setToolTip("View next pair")
        self.leftBtn.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.MinimumExpanding)
        self.rightBtn.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.MinimumExpanding)

        self.connectCheckbox = QCheckBox("Recorders are connected")
        self.connectCheckbox.setChecked(bool(self.parent.recConnections[0,1]==1))
        self.connectCheckbox.toggled.connect(self.connectToggled)

        # main graphic
        mainpl = pg.PlotWidget()
        self.p1 = mainpl.plot()
        self.p1.setPen(pg.mkPen('k', width=1))
        col = pg.mkColor(20, 255, 20, 150)
        self.bestLineO = pg.InfiniteLine(angle=0, movable=False, pen={'color': col, 'width': 2})
        self.bestLineSh = pg.InfiniteLine(angle=90, movable=False, pen={'color': col, 'width': 2})
        mainpl.addItem(self.bestLineO)
        mainpl.addItem(self.bestLineSh)

        # init plot with page 1 data
        self.currpage = 1
        self.leftBtn.setEnabled(False)
        if len(self.shifts)==1:
            self.rightBtn.setEnabled(False)
        self.setData()

        # accept / close
        closeBtn = QPushButton("Close")
        closeBtn.clicked.connect(self.accept)
        # cancelBtn = QPushButton("Cancel")
        # cancelBtn.clicked.connect(self.reject)

        # Layouts
        box = QVBoxLayout()
        topHBox = QHBoxLayout()
        topHBox.addWidget(self.labelCurrPage, stretch=1)
        topHBox.addWidget(self.labelRecs, stretch=3)
        box.addLayout(topHBox)

        midHBox = QHBoxLayout()
        midHBox.addWidget(self.leftBtn)
        midHBox.addWidget(mainpl, stretch=10)
        midHBox.addWidget(self.rightBtn)
        box.addLayout(midHBox)
        box.addWidget(self.connectCheckbox)

        bottomHBox = QHBoxLayout()
        bottomHBox.addWidget(closeBtn)
        # bottomHBox.addWidget(cancelBtn)
        box.addLayout(bottomHBox)
        self.setLayout(box)