Toggle window hide on time popup-show

This prevent the search window to be hidden when the time drop down is opened.

issue7747
review56411002
This commit is contained in:
Cédric Krier committed 2018-09-29 20:38:03 +02:00
1 parent 9480bc8993
commit 3b576e29d2
1 file changed
+18 -12
@@ -47,9 +47,21 @@ class Dates(gtk.HBox):
elif to:
return '<=%s' % quote(to)
@property
def _widgets(self):
return [self.from_, self.to]
def connect_activate(self, callback):
self.from_.connect('activate', callback)
self.to.connect('activate', callback)
for widget in self._widgets:
if isinstance(widget, Date):
widget.connect('activate', callback)
elif isinstance(widget, Time):
widget.get_child().connect('activate', callback)
def connect_combo(self, callback):
for widget in self._widgets:
if isinstance(widget, Time):
widget.connect('notify::popup-shown', callback)
def set_values(self, from_, to):
self.from_.props.value = from_
@@ -66,10 +78,6 @@ class Times(Dates):
if value:
return datetime.time.strftime(value, widget.props.format)
def connect_activate(self, callback):
for widget in self.from_.get_children() + self.to.get_children():
widget.connect('activate', callback)
class DateTimes(Dates):
@@ -86,12 +94,9 @@ class DateTimes(Dates):
return common.datetime_strftime(value,
widget.props.date_format + ' ' + widget.props.time_format)
def connect_activate(self, callback):
for widget in self.from_.get_children() + self.to.get_children():
if isinstance(widget, Date):
widget.connect('activate', callback)
elif isinstance(widget, Time):
widget.get_child().connect('activate', callback)
@property
def _widgets(self):
return self.from_.get_children() + self.to.get_children()
class Selection(gtk.ScrolledWindow):
@@ -590,6 +595,7 @@ class ScreenContainer(object):
elif field['type'] == 'datetime':
entry = DateTimes(date_format, time_format)
entry.connect_activate(lambda *a: search())
entry.connect_combo(toggle_window_hide)
else:
entry = gtk.Entry()
entry.connect('activate', lambda *a: search())