mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Hide date conditions when match type is set/unset
This commit is contained in:
parent
7c59955b54
commit
8423f761af
@ -164,8 +164,21 @@ def create_simple_tab(self, db):
|
||||
self.general_combo.findText(self.box_last_values['general_index']))
|
||||
|
||||
|
||||
def toggle_date_conditions_visibility(self):
|
||||
dcl = self.date_tab.date_condition_layouts
|
||||
op = current_dateop(self.dateop_date)
|
||||
visible = op not in 'su'
|
||||
for l in dcl:
|
||||
for i in range(l.count()):
|
||||
x = l.itemAt(i)
|
||||
w = x.widget()
|
||||
if w is not None:
|
||||
w.setVisible(visible)
|
||||
|
||||
|
||||
def create_date_tab(self, db):
|
||||
self.date_tab = w = QWidget(self.tab_widget)
|
||||
w.date_condition_layouts = dcl = []
|
||||
self.tab_widget.addTab(w, _("&Date search"))
|
||||
w.l = l = QVBoxLayout(w)
|
||||
|
||||
@ -192,11 +205,13 @@ def create_date_tab(self, db):
|
||||
h.addWidget(df)
|
||||
self.dateop_date = dd = add(_("date column for books whose &date is "), QComboBox(w))
|
||||
init_dateop(dd)
|
||||
connect_lambda(dd.currentIndexChanged, self, toggle_date_conditions_visibility)
|
||||
w.la3 = la = QLabel('...')
|
||||
h.addWidget(la)
|
||||
h.addStretch(10)
|
||||
|
||||
w.h2 = h = QHBoxLayout()
|
||||
dcl.append(h)
|
||||
l.addLayout(h)
|
||||
self.sel_date = a(QRadioButton(_('&year'), w))
|
||||
self.date_year = dy = a(QSpinBox(w))
|
||||
@ -211,6 +226,7 @@ def create_date_tab(self, db):
|
||||
h.addStretch(10)
|
||||
|
||||
w.h3 = h = QHBoxLayout()
|
||||
dcl.append(h)
|
||||
l.addLayout(h)
|
||||
self.sel_daysago = a(QRadioButton('', w))
|
||||
self.date_daysago = da = a(QSpinBox(w))
|
||||
@ -222,6 +238,7 @@ def create_date_tab(self, db):
|
||||
|
||||
w.h4 = h = QHBoxLayout()
|
||||
l.addLayout(h)
|
||||
dcl.append(h)
|
||||
self.sel_human = a(QRadioButton('', w))
|
||||
self.date_human = dh = a(QComboBox(w))
|
||||
for val, text in [('today', _('Today')), ('yesterday', _('Yesterday')), ('thismonth', _('This month'))]:
|
||||
@ -235,6 +252,7 @@ def create_date_tab(self, db):
|
||||
h.addStretch(10)
|
||||
|
||||
l.addStretch(10)
|
||||
toggle_date_conditions_visibility(self)
|
||||
|
||||
|
||||
def create_template_tab(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user