317
318
for x in self.widgets.values():
318
319
x[0].sig_activate(self.sig_activate)
320
self.invisible_widgets = []
320
322
def xml_process(self,xml_arch):
321
323
root = etree.fromstring(xml_arch)
364
366
def remove_custom(self, button, panel):
365
367
button.parent.destroy()
366
368
# Removing the Destroyed widget from Domain calculation
367
for element in self.custom_widgets.keys():
368
if self.custom_widgets[element][0] == panel:
369
del self.custom_widgets[element]
369
## also removing the field from the list of invisible fields
370
## so that they dont reappear and as the childs are deleted for the panel
371
## that has to be deleted we need to do a reverse process for removing the
372
## the invisible fields from the list of invisible fields.
374
if isinstance(widget, gtk.HBox):
375
for child in widget.get_children():
377
inv_childs = self.invisible_widgets
378
for inv_child in inv_childs:
379
if inv_child != widget:
380
self.invisible_widgets.remove(inv_child)
383
custom_panel = copy.copy(self.custom_widgets)
384
for key, wid in custom_panel.iteritems():
385
for child in wid[0].widget.get_children():
386
if not isinstance(child, (gtk.ComboBox, gtk.Button)):
389
del self.custom_widgets[key]
373
392
def add_custom(self, widget, table, fields):
374
393
new_table = gtk.Table(1,1,False)
375
panel = widgets_type['custom_filter'][0]('', self.parent,{'fields':fields},call=self.remove_custom)
394
panel = widgets_type['custom_filter'][0]('', self.parent, fields, callback=self.remove_custom, search_callback=self.call[1])
377
396
new_table.attach(panel.widget,0, 1, x, x+1, xoptions=gtk.FILL, yoptions=gtk.FILL , ypadding=2, xpadding=0)
378
397
panelx = 'panel' + str(x)
380
399
self.custom_widgets[panelx] = (panel, new_table, 1)
381
400
table.attach(new_table, 1, 9, x, x+1)
402
## Store the widgets original visible attribute because as they are
403
## attached to the table as a child widgets and the table.show_all() will
404
## set all child widgets to visible inspite of their visibility is set to FALSE
405
## so make them invisible again after the table.show_all()
407
if isinstance(widget, gtk.HBox):
408
for sub_child in widget.get_children():
410
if widget.get_visible():
411
if widget in self.invisible_widgets:
412
self.invisible_widgets.remove(widget)
414
if not widget in self.invisible_widgets:
415
self.invisible_widgets.append(widget)
418
for key, wid in self.custom_widgets.iteritems():
419
for child in wid[0].widget.get_children():
420
if not isinstance(child, (gtk.ComboBox, gtk.Button)):
423
for wid in self.invisible_widgets:
424
wid.set_visible(False)
386
427
def toggle(self, widget, event=None):
414
455
context.update({'group_by':self.groupby})
416
if len(domain)>1 and domain[-2] in ['&','|']:
457
if '&' in domain or '|' in domain:
458
if domain[-2] in ['&','|']:
460
elif len(domain) >= 4 and domain[-4] in ['&','|']:
462
if len(domain) == 4 and domain[1] in ['&','|']:
466
res2 = domain[-(pos-1):]
422
467
domain = res1 + res2
423
468
return {'domain':domain, 'context':context}