fix a bug in service screen, add service_init
This commit is contained in:
@@ -205,21 +205,32 @@ def service_construct(w):
|
||||
w - Widget instance '''
|
||||
|
||||
# first refresh service state
|
||||
ri_data.Service.change_state()
|
||||
wit = w.widgets.pop()
|
||||
for i in ri_data.Service.list:
|
||||
wi = copy.deepcopy(wit)
|
||||
wi.attr['text'] = i.name
|
||||
vn = "service_%s" %(i.name)
|
||||
# process widget name
|
||||
wi.name = vn
|
||||
ri_widget.Widget.dict[vn] = wi
|
||||
wi.attr['text'] = i.name
|
||||
wi.attr['variable'] = vn
|
||||
wi.variables = [(vn, 'StringVar', i.start=='yes' and 'yes' or 'no')]
|
||||
if i.start == 'disable':
|
||||
wi.attr['state'] = 'disable'
|
||||
wi.variables = [(vn, 'StringVar', '')]
|
||||
idx = ri_data.Service.list.index(i)
|
||||
wi.grid_location.dict['column'] = idx % int(w.grid_management.columns)
|
||||
wi.grid_location.dict['row'] = idx / int(w.grid_management.columns)
|
||||
w.add_sub_widget(wi)
|
||||
|
||||
def service_init():
|
||||
''' initialize service checkboxes, based on package selection '''
|
||||
# first refresh service state
|
||||
ri_data.Service.change_state()
|
||||
for i in ri_data.Service.list:
|
||||
vn = "service_%s" %(i.name)
|
||||
win = ri_widget.Widget.dict[vn].tk_widget
|
||||
if i.start == 'disable':
|
||||
win.configure(state = 'disable')
|
||||
display.var_dict[vn].set(value=i.start=='yes' and 'yes' or 'no')
|
||||
|
||||
def service_quit():
|
||||
''' record service state '''
|
||||
for i in ri_data.Service.list:
|
||||
|
||||
@@ -75,7 +75,6 @@ class Widget:
|
||||
self.action = Action(node)
|
||||
elif node.nodeName == 'binding':
|
||||
seq = node.attributes["sequence"].value
|
||||
print seq
|
||||
self.bindings.append((seq, \
|
||||
node.attributes["function"].value))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user