Fixes for Event Comparison tool

svn: r400
This commit is contained in:
Don Allingham 2001-09-10 02:16:39 +00:00
parent 7a528d9007
commit f17dd9e2c6
3 changed files with 18 additions and 26 deletions

View File

@ -127,12 +127,14 @@ def load_filters(dir):
# #
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def build_filter_menu(callback): def build_filter_menu(callback,fw):
myMenu = gtk.GtkMenu() myMenu = gtk.GtkMenu()
for filter in _filter_list: for filter in _filter_list:
menuitem = gtk.GtkMenuItem(filter[1]) menuitem = gtk.GtkMenuItem(filter[1])
myMenu.append(menuitem) myMenu.append(menuitem)
menuitem.set_data("filter",filter[0]) menuitem.set_data("filter",fw)
menuitem.set_data("name",filter[1])
menuitem.set_data("function",filter[0])
menuitem.set_data("qual",filter[2]) menuitem.set_data("qual",filter[2])
menuitem.connect("activate",callback) menuitem.connect("activate",callback)
menuitem.show() menuitem.show()

View File

@ -2028,7 +2028,7 @@ def on_apply_filter_clicked(obj):
invert_filter = gtop.get_widget("invert").get_active() invert_filter = gtop.get_widget("invert").get_active()
qualifer = gtop.get_widget("filter").get_text() qualifer = gtop.get_widget("filter").get_text()
menu = gtop.get_widget(FILTERNAME).get_menu() menu = gtop.get_widget(FILTERNAME).get_menu()
class_init = menu.get_active().get_data("filter") class_init = menu.get_active().get_data("function")
DataFilter = class_init(qualifer) DataFilter = class_init(qualifer)
DataFilter.set_invert(invert_filter) DataFilter.set_invert(invert_filter)
apply_filter() apply_filter()
@ -2039,7 +2039,8 @@ def on_apply_filter_clicked(obj):
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def on_filter_name_changed(obj): def on_filter_name_changed(obj):
gtop.get_widget("filter").set_sensitive(obj.get_data("qual")) filter = obj.get_data("filter")
filter.set_sensitive(obj.get_data("qual"))
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -2969,9 +2970,10 @@ def main(arg):
person_list.set_sort_column(sort_column) person_list.set_sort_column(sort_column)
person_list.set_sort_type(sort_direct) person_list.set_sort_type(sort_direct)
filter_list.set_menu(Filter.build_filter_menu(on_filter_name_changed)) fw = gtop.get_widget('filter')
filter_list.set_menu(Filter.build_filter_menu(on_filter_name_changed,fw))
gtop.get_widget("filter").set_sensitive(0) fw.set_sensitive(0)
# set the window icon # set the window icon
topWindow.set_icon(GtkPixmap(topWindow,const.logo)) topWindow.set_icon(GtkPixmap(topWindow,const.logo))

View File

@ -63,10 +63,10 @@ from OpenSpreadSheet import *
OBJECT = "o" OBJECT = "o"
INDEX = "i" INDEX = "i"
FUNCTION = "f" FILTER = "filter"
QUALIFIER= "q" FUNCTION = "function"
FILTER = "x" QUALIFIER= "qual"
NAME = "n" NAME = "name"
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
@ -198,16 +198,7 @@ class EventComparison:
self.filter_list = [] self.filter_list = []
myMenu = GtkMenu() myMenu = Filter.build_filter_menu(on_filter_name_changed,qualifier)
for filter in Filter.filterMap.keys():
menuitem = GtkMenuItem(filter)
myMenu.append(menuitem)
menuitem.set_data(FILTER,Filter.filterMap[filter])
menuitem.set_data(FUNCTION,Filter.filterEnb[filter])
menuitem.set_data(NAME,filter)
menuitem.set_data(QUALIFIER,qualifier)
menuitem.connect("activate",on_filter_name_changed)
menuitem.show()
self.filter_menu.set_menu(myMenu) self.filter_menu.set_menu(myMenu)
top.set_data(OBJECT,self) top.set_data(OBJECT,self)
@ -538,7 +529,7 @@ def on_add_clicked(obj):
qualifier = myobj.filterDialog.get_widget("qualifier").get_text() qualifier = myobj.filterDialog.get_widget("qualifier").get_text()
menu = myobj.filter_menu.get_menu() menu = myobj.filter_menu.get_menu()
function = menu.get_active().get_data(FILTER) function = menu.get_active().get_data(FUNCTION)
name = menu.get_active().get_data(NAME) name = menu.get_active().get_data(NAME)
myfilter = function(qualifier) myfilter = function(qualifier)
@ -554,7 +545,6 @@ def on_add_clicked(obj):
else: else:
invert_text = "no" invert_text = "no"
print name, qualifier, invert_text
myobj.filter_list_obj.append([name,qualifier,invert_text]) myobj.filter_list_obj.append([name,qualifier,invert_text])
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -563,9 +553,7 @@ def on_add_clicked(obj):
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def on_filter_name_changed(obj): def on_filter_name_changed(obj):
function = obj.get_data(FUNCTION) obj.get_data(FILTER).set_sensitive(obj.get_data(QUALIFIER))
qualifier = obj.get_data(QUALIFIER)
qualifier.set_sensitive(function())
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #