def init_page_btns(self):
"""
Create the start page and pages to scrape buttons along
with their corresponding labels. Each label and spinbox
is first grouped together vertically, then put together
with the other spinbox horizontally and finally into the
main layout of our window.
"""
self.pg_spinboxes = QtGui.QHBoxLayout()
# START PG: spinbox to indicate the page to start scraping on
self.start_pg_group = QtGui.QVBoxLayout()
self.start_pg_group.setAlignment(QtCore.Qt.AlignTop)
self.start_lbl = QtGui.QLabel(self)
self.start_lbl.setText("start page")
self.start_pg_spn = QtGui.QSpinBox(self)
self.start_pg_spn.valueChanged[int].connect(self.set_start_pg)
self.start_pg_group.addWidget(self.start_lbl) # "start page"
self.start_pg_group.addWidget(self.start_pg_spn) # <spinbox>
self.pg_spinboxes.addLayout(self.start_pg_group)
self.pg_spinboxes.addSpacing(20)
# NUM PGS: spinbox to indicate the number of pages to scrape
self.n_pgs_group = QtGui.QVBoxLayout()
self.n_pgs_group.setAlignment(QtCore.Qt.AlignTop)
self.n_pgs_lbl = QtGui.QLabel(self)
self.n_pgs_lbl.setText("pages to scrape")
self.n_pgs_spn = QtGui.QSpinBox(self)
self.n_pgs_spn.valueChanged[int].connect(self.set_max_pgs)
self.n_pgs_spn.setMinimum(1)
self.n_pgs_group.addWidget(self.n_pgs_lbl) # "pages to scrape"
self.n_pgs_group.addWidget(self.n_pgs_spn) # <spinbox>
self.n_pgs_group.setAlignment(QtCore.Qt.Vertical)
self.pg_spinboxes.addLayout(self.n_pgs_group)
# Combine both in a box.
self.pg_spinboxes.setAlignment(QtCore.Qt.AlignTop)
self.left_pane.addLayout(self.pg_spinboxes)
评论列表
文章目录