Set screen to ScreenContainer at instantiation
Many methods of ScreenContainer relies on the screen being set. And there is no reason to not set the screen at instantiation as long as show filter refresh the bookmarks. Closes #13757
This commit is contained in:
1 parent
43014db8ac
commit
030305ec49
3 files changed
+11
-16
No files matched your search
+6
-9
@@ -4,7 +4,8 @@
|
||||
'use strict';
|
||||
|
||||
Sao.ScreenContainer = Sao.class_(Object, {
|
||||
init: function(tab_domain) {
|
||||
init: function(screen, tab_domain) {
|
||||
this.screen = screen;
|
||||
this.alternate_viewport = jQuery('<div/>', {
|
||||
'class': 'screen-container'
|
||||
});
|
||||
@@ -389,13 +390,10 @@
|
||||
do_search: function() {
|
||||
return this.screen.search_filter(this.get_text());
|
||||
},
|
||||
set_screen: function(screen) {
|
||||
this.screen = screen;
|
||||
this.but_bookmark.prop('disabled',
|
||||
jQuery.isEmptyObject(this.bookmarks()));
|
||||
this.bookmark_match();
|
||||
},
|
||||
show_filter: function() {
|
||||
this.but_bookmark.prop(
|
||||
'disabled', jQuery.isEmptyObject(this.bookmarks()));
|
||||
this.bookmark_match();
|
||||
this.filter_box.show();
|
||||
if (this.tab) {
|
||||
this.tab.show();
|
||||
@@ -815,7 +813,7 @@
|
||||
this.new_group(attributes.context || {});
|
||||
this.current_record = null;
|
||||
this.screen_container = new Sao.ScreenContainer(
|
||||
attributes.tab_domain);
|
||||
this, attributes.tab_domain);
|
||||
this.breadcrumb = attributes.breadcrumb || [];
|
||||
|
||||
this.context_screen = null;
|
||||
@@ -1750,7 +1748,6 @@
|
||||
},
|
||||
search_active: function(active) {
|
||||
if (active && !this.group.parent) {
|
||||
this.screen_container.set_screen(this);
|
||||
this.screen_container.show_filter();
|
||||
} else {
|
||||
this.screen_container.hide_filter();
|
||||
|
||||
@@ -75,7 +75,8 @@ class Screen:
|
||||
self.__current_record = None
|
||||
self.new_group(context or {})
|
||||
self.current_record = None
|
||||
self.screen_container = ScreenContainer(attributes.get('tab_domain'))
|
||||
self.screen_container = ScreenContainer(
|
||||
self, attributes.get('tab_domain'))
|
||||
self.screen_container.alternate_view = attributes.get(
|
||||
'alternate_view', False)
|
||||
self.widget = self.screen_container.widget_get()
|
||||
@@ -163,7 +164,6 @@ class Screen:
|
||||
|
||||
def search_active(self, active=True):
|
||||
if active and not self.parent:
|
||||
self.screen_container.set_screen(self)
|
||||
self.screen_container.show_filter()
|
||||
else:
|
||||
self.screen_container.hide_filter()
|
||||
|
||||
@@ -185,7 +185,8 @@ class Selection(Gtk.ScrolledWindow):
|
||||
|
||||
class ScreenContainer(object):
|
||||
|
||||
def __init__(self, tab_domain):
|
||||
def __init__(self, screen, tab_domain):
|
||||
self.screen = screen
|
||||
self.viewport = Gtk.Viewport()
|
||||
self.viewport.set_shadow_type(Gtk.ShadowType.NONE)
|
||||
self.vbox = Gtk.VBox(spacing=3)
|
||||
@@ -351,12 +352,9 @@ class ScreenContainer(object):
|
||||
def widget_get(self):
|
||||
return self.vbox
|
||||
|
||||
def set_screen(self, screen):
|
||||
self.screen = screen
|
||||
def show_filter(self):
|
||||
self.but_bookmark.set_sensitive(bool(list(self.bookmarks())))
|
||||
self.bookmark_match()
|
||||
|
||||
def show_filter(self):
|
||||
if self.filter_vbox:
|
||||
self.filter_vbox.show()
|
||||
if self.notebook:
|
||||
|
||||
Reference in new issue
Block a user