Manage active field on search widget

issue4341
review40411002
This commit is contained in:
Sergi Almacellas Abellana committed 2018-03-26 14:26:33 +02:00
1 parent 047a1d3096
commit 266eb42fcc
4 files changed
+357 -2

No files matched your search

+1
View File
@@ -1,3 +1,4 @@
* Manage active field on search widget
* Reset record to its original state when discarding the popup window
* Add support of expand attribute on group tag
* Add the context model name in the screen context
@@ -0,0 +1,317 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="48px"
height="48px"
id="svg1288"
sodipodi:version="0.32"
inkscape:version="0.46"
sodipodi:docbase="/home/jimmac/src/cvs/tango-icon-theme/scalable/apps"
sodipodi:docname="system-file-manager.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape">
<defs
id="defs3">
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 24 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="48 : 24 : 1"
inkscape:persp3d-origin="24 : 16 : 1"
id="perspective43" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient5060"
id="radialGradient5031"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(-2.774389,0,0,1.969706,112.7623,-872.8854)"
cx="605.71429"
cy="486.64789"
fx="605.71429"
fy="486.64789"
r="117.14286" />
<linearGradient
inkscape:collect="always"
id="linearGradient5060">
<stop
style="stop-color:black;stop-opacity:1;"
offset="0"
id="stop5062" />
<stop
style="stop-color:black;stop-opacity:0;"
offset="1"
id="stop5064" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient5060"
id="radialGradient5029"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.774389,0,0,1.969706,-1891.633,-872.8854)"
cx="605.71429"
cy="486.64789"
fx="605.71429"
fy="486.64789"
r="117.14286" />
<linearGradient
id="linearGradient5048">
<stop
style="stop-color:black;stop-opacity:0;"
offset="0"
id="stop5050" />
<stop
id="stop5056"
offset="0.5"
style="stop-color:black;stop-opacity:1;" />
<stop
style="stop-color:black;stop-opacity:0;"
offset="1"
id="stop5052" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient5048"
id="linearGradient5027"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.774389,0,0,1.969706,-1892.179,-872.8854)"
x1="302.85715"
y1="366.64789"
x2="302.85715"
y2="609.50507" />
<linearGradient
id="linearGradient3085">
<stop
id="stop3087"
offset="0"
style="stop-color:#b47002;stop-opacity:1;" />
<stop
id="stop3089"
offset="1.0000000"
style="stop-color:#6b4301;stop-opacity:1.0000000;" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient2368">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop2370" />
<stop
style="stop-color:#ffffff;stop-opacity:0;"
offset="1"
id="stop2372" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient2182">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop2184" />
<stop
style="stop-color:#000000;stop-opacity:0;"
offset="1"
id="stop2186" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient2182"
id="radialGradient2188"
cx="25.357143"
cy="36.500000"
fx="25.357143"
fy="36.500000"
r="14.714286"
gradientTransform="matrix(1.000000,0.000000,0.000000,0.500000,-3.881442e-16,18.25000)"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2368"
id="linearGradient2374"
x1="14.680550"
y1="7.2187386"
x2="38.694427"
y2="57.468739"
gradientUnits="userSpaceOnUse" />
<linearGradient
gradientUnits="userSpaceOnUse"
y2="19.168869"
x2="25.249994"
y1="23.568451"
x1="25.249994"
id="linearGradient3091"
xlink:href="#linearGradient3085"
inkscape:collect="always" />
<linearGradient
gradientTransform="translate(0.000000,13.11256)"
y2="19.168869"
x2="25.249994"
y1="23.568451"
x1="25.249994"
gradientUnits="userSpaceOnUse"
id="linearGradient3095"
xlink:href="#linearGradient3085"
inkscape:collect="always" />
</defs>
<sodipodi:namedview
stroke="#e9b96e"
fill="#e9b96e"
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="0.14117647"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1"
inkscape:cx="-125.54594"
inkscape:cy="-13.769376"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:grid-bbox="true"
inkscape:document-units="px"
showborder="true"
inkscape:showpageshadow="false"
inkscape:window-width="878"
inkscape:window-height="818"
inkscape:window-x="370"
inkscape:window-y="30" />
<metadata
id="metadata4">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title>File Manager</dc:title>
<dc:creator>
<cc:Agent>
<dc:title>Jakub Steiner</dc:title>
</cc:Agent>
</dc:creator>
<dc:source>http://jimmac.musichall.cz</dc:source>
<dc:subject>
<rdf:Bag>
<rdf:li>file</rdf:li>
<rdf:li>manager</rdf:li>
<rdf:li>copy</rdf:li>
<rdf:li>move</rdf:li>
<rdf:li>filesystem</rdf:li>
</rdf:Bag>
</dc:subject>
<cc:license
rdf:resource="http://creativecommons.org/licenses/publicdomain/" />
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/publicdomain/">
<cc:permits
rdf:resource="http://creativecommons.org/ns#Reproduction" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#Distribution" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
</cc:License>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer">
<g
id="g5022"
transform="matrix(1.949531e-2,0,0,2.086758e-2,42.61888,39.78964)">
<rect
y="-150.69685"
x="-1559.2523"
height="478.35718"
width="1339.6335"
id="rect4173"
style="opacity:0.40206185;color:black;fill:url(#linearGradient5027);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
<path
sodipodi:nodetypes="cccc"
id="path5058"
d="M -219.61876,-150.68038 C -219.61876,-150.68038 -219.61876,327.65041 -219.61876,327.65041 C -76.744594,328.55086 125.78146,220.48075 125.78138,88.454235 C 125.78138,-43.572302 -33.655436,-150.68036 -219.61876,-150.68038 z "
style="opacity:0.40206185;color:black;fill:url(#radialGradient5029);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
<path
style="opacity:0.40206185;color:black;fill:url(#radialGradient5031);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
d="M -1559.2523,-150.68038 C -1559.2523,-150.68038 -1559.2523,327.65041 -1559.2523,327.65041 C -1702.1265,328.55086 -1904.6525,220.48075 -1904.6525,88.454235 C -1904.6525,-43.572302 -1745.2157,-150.68036 -1559.2523,-150.68038 z "
id="path5018"
sodipodi:nodetypes="cccc" />
</g>
<path
style="stroke-opacity:1.0000000;stroke-linejoin:round;stroke-linecap:round;stroke-width:1.0000000px;stroke:#444329;fill-rule:evenodd;fill-opacity:1.0;fill:#c17d11"
d="M 10.625000,11.625000 L 10.625000,42.625000 L 39.625000,42.625000 L 39.625000,11.625000 L 35.625000,7.6250000 L 14.625000,7.6250000 L 10.625000,11.625000 z "
id="path1414" />
<path
style="stroke-opacity:1.0000000;stroke-linejoin:miter;stroke-linecap:butt;stroke-width:1.0000000px;stroke:none;fill-rule:evenodd;fill-opacity:1.0000000;fill:#e9b96e"
d="M 14.849242,8.2252435 L 11.126209,12.041107 L 12.314694,12.291107 L 38.129165,12.291107 L 39.130150,12.041107 L 35.266951,8.2252435 L 14.849242,8.2252435 z "
id="path2380"
sodipodi:nodetypes="ccccccc" />
<rect
ry="0.92857140"
rx="0.92857140"
y="28.828430"
x="14.750000"
height="10.055458"
width="21.000000"
id="rect3083"
style="opacity:1.0000000;color:#000000;fill:#e9b96e;fill-opacity:1.0000000;fill-rule:evenodd;stroke:#e9b96e;stroke-width:1.0000000px;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;visibility:visible;display:inline;overflow:visible;font-family:Bitstream Vera Sans" />
<rect
style="opacity:1.0000000;color:#000000;fill:#b67610;fill-opacity:1.0000000;fill-rule:evenodd;stroke:#7b500b;stroke-width:1.0000000px;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;visibility:visible;display:inline;overflow:visible;font-family:Bitstream Vera Sans"
id="rect1416"
width="21.000000"
height="10.055458"
x="14.573223"
y="28.474876"
rx="0.92857140"
ry="0.92857140" />
<path
id="path2358"
d="M 11.680550,12.062494 L 11.680550,41.652758 L 38.569426,41.652758 L 38.569426,12.062494 L 35.166650,8.6597185 L 15.083327,8.6597185 L 11.680550,12.062494 z "
style="stroke-opacity:1.0000000;stroke-linejoin:miter;stroke-linecap:butt;stroke-width:1.0000000;stroke:url(#linearGradient2374);fill-rule:evenodd;fill-opacity:1.0;fill:none;stroke-dasharray:none;stroke-miterlimit:4.0000000"
sodipodi:nodetypes="ccccccc" />
<rect
style="opacity:1.0000000;color:#000000;fill:#e9b96e;fill-opacity:1.0000000;fill-rule:evenodd;stroke:#e9b96e;stroke-width:1.0000000px;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;visibility:visible;display:inline;overflow:visible;font-family:Bitstream Vera Sans"
id="rect3081"
width="21.000000"
height="10.055458"
x="14.750000"
y="15.715860"
rx="0.92857140"
ry="0.92857140" />
<rect
ry="0.92857140"
rx="0.92857140"
y="15.362308"
x="14.573223"
height="10.055458"
width="21.000000"
id="rect3077"
style="font-family:Bitstream Vera Sans;overflow:visible;display:inline;visibility:visible;stroke-opacity:1.0000000;stroke-dashoffset:0.0000000;stroke-dasharray:none;stroke-miterlimit:4.0000000;marker-end:none;marker-mid:none;marker-start:none;marker:none;stroke-linejoin:round;stroke-linecap:round;stroke-width:1.0000000px;stroke:#7b500b;fill-rule:evenodd;fill-opacity:1.0000000;fill:#b67610;color:#000000;opacity:1.0000000" />
<rect
style="opacity:1.0000000;color:#000000;fill:url(#linearGradient3091);fill-opacity:1.0000000;fill-rule:evenodd;stroke:#7b500b;stroke-width:0.99999923px;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;visibility:visible;display:inline;overflow:visible;font-family:Bitstream Vera Sans"
id="rect3079"
width="6.7473836"
height="3.8216934"
x="21.743721"
y="21.569220"
rx="0.28662863"
ry="0.33735332" />
<rect
ry="0.33735332"
rx="0.28662863"
y="34.681808"
x="21.743721"
height="3.8216934"
width="6.7473836"
id="rect3093"
style="opacity:1.0000000;color:#000000;fill:url(#linearGradient3095);fill-opacity:1.0000000;fill-rule:evenodd;stroke:#7b500b;stroke-width:0.99999923px;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;visibility:visible;display:inline;overflow:visible;font-family:Bitstream Vera Sans" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 14 KiB

+15 -2
View File
@@ -187,6 +187,11 @@ class Screen(SignalEvent):
fields = collections.OrderedDict(
(name, fields[name]) for name in xml_fields)
if 'active' in view_tree['fields']:
self.screen_container.but_active.show()
else:
self.screen_container.but_active.hide()
# Add common fields
for name, string, type_ in (
('id', _('ID'), 'integer'),
@@ -254,16 +259,19 @@ class Screen(SignalEvent):
if tab_domain:
domain = ['AND', domain, tab_domain]
context = self.context
if self.screen_container.but_active.get_active():
context['active_test'] = False
try:
ids = RPCExecute('model', self.model_name, 'search', domain,
self.offset, self.limit, self.order, context=self.context)
self.offset, self.limit, self.order, context=context)
except RPCException:
ids = []
if not only_ids:
if self.limit is not None and len(ids) == self.limit:
try:
self.search_count = RPCExecute('model', self.model_name,
'search_count', domain, context=self.context)
'search_count', domain, context=context)
except RPCException:
self.search_count = 0
else:
@@ -302,6 +310,11 @@ class Screen(SignalEvent):
else:
domain = self.domain
if self.screen_container.but_active.get_active():
if domain:
domain = [domain, ('active', '=', False)]
else:
domain = [('active', '=', False)]
if self.current_view and self.current_view.view_type == 'calendar':
if domain:
domain = ['AND', domain, self.current_view.current_domain()]
@@ -192,6 +192,18 @@ class ScreenContainer(object):
def deactivate(menuitem, togglebutton):
togglebutton.props.active = False
but_active = gtk.ToggleButton()
self.but_active = but_active
self._set_active_tooltip()
img_active = gtk.Image()
img_active.set_from_stock(
'tryton-archive', gtk.ICON_SIZE_SMALL_TOOLBAR)
img_active.set_alignment(0.5, 0.5)
but_active.add(img_active)
but_active.set_relief(gtk.RELIEF_NONE)
but_active.connect('toggled', self.search_active)
hbox.pack_start(but_active, expand=False, fill=False)
but_bookmark = gtk.ToggleButton()
self.but_bookmark = but_bookmark
tooltips.set_tip(but_bookmark, _('Show bookmarks of filters'))
@@ -383,6 +395,18 @@ class ScreenContainer(object):
def search_prev(self, widget=None):
self.screen.search_prev(self.get_text())
def search_active(self, widget=None):
self._set_active_tooltip()
self.screen.search_filter(self.get_text())
def _set_active_tooltip(self):
if self.but_active.get_active():
tooltip = _('Show active records')
else:
tooltip = _('Show inactive records')
tooltips = common.Tooltips()
tooltips.set_tip(self.but_active, tooltip)
def switch_page(self, notebook, page, page_num):
current_page = notebook.get_nth_page(notebook.get_current_page())
current_page.remove(self.viewport)