Exemplo n.º 1
0
 def attrs_set(self, model, cell):
     if self.attrs.get('attrs',False):
         attrs_changes = eval(self.attrs.get('attrs',"{}"),{'uid':rpc.session.uid})
         for k,v in attrs_changes.items():
             result = False
             result = tools.calc_condition(self,model,v)
             model[self.field_name].get_state_attrs(model)[k] = result
Exemplo n.º 2
0
 def attrs_set(self, model, obj, att_obj, notebook, rank):
     try:
         attrs_changes = eval(att_obj.attrs.get('attrs',"{}"))
     except:
          model.value.update({'uid':rpc.session.uid})
          attrs_changes = eval(att_obj.attrs.get('attrs',"{}"),model.value)
          for k,v in attrs_changes.items():
             for i in range(0,len(v)):
                if v[i][2]:
                     if type(v[i][2])==type([]):
                         cond=()
                         cond=v[i][0],v[i][1],v[i][2][0]
                         attrs_changes[k][i]=cond
     for k,v in attrs_changes.items():
         result = tools.calc_condition(self, model, v)
         if result:
             if k=='invisible':
                 obj.hide()
             if k=='focus':
                 notebook.set_current_page(rank)
             elif k=='readonly':
                 obj.set_sensitive(False)
         else:
             if k=='invisible':
                 obj.show()
             if k=='readonly':
                 obj.set_sensitive(True)
Exemplo n.º 3
0
 def attrs_set(self, model, obj, att_obj):
     try:
         attrs_changes = eval(att_obj.attrs.get('attrs', "{}"))
     except:
         attrs_changes = eval(att_obj.attrs.get('attrs', "{}"), model.value)
         for k, v in attrs_changes.items():
             for i in range(0, len(v)):
                 if v[i][2]:
                     if type(v[i][2]) == type([]):
                         cond = ()
                         cond = v[i][0], v[i][1], v[i][2][0]
                         attrs_changes[k][i] = cond
     for k, v in attrs_changes.items():
         result = True
         for condition in v:
             result = result and tools.calc_condition(
                 self, model, condition)
         if result:
             if k == 'invisible':
                 obj.hide()
             elif k == 'readonly':
                 obj.set_sensitive(False)
         else:
             if k == 'invisible':
                 obj.show()
             if k == 'readonly':
                 obj.set_sensitive(True)
Exemplo n.º 4
0
 def attrs_set(self, model, obj, att_obj):
     try:
         attrs_changes = eval(att_obj.attrs.get('attrs',"{}"))
     except:
          attrs_changes = eval(att_obj.attrs.get('attrs',"{}"),model.value)
          for k,v in attrs_changes.items():
             for i in range(0,len(v)):
                if v[i][2]:
                     if type(v[i][2])==type([]):
                         cond=()
                         cond=v[i][0],v[i][1],v[i][2][0]
                         attrs_changes[k][i]=cond
     for k,v in attrs_changes.items():
         result = True
         for condition in v:
             result = result and tools.calc_condition(self,model,condition)
         if result:
             if k=='invisible':
                 obj.hide()
             elif k=='readonly':
                 obj.set_sensitive(False)
         else:
             if k=='invisible':
                 obj.show()
             if k=='readonly':
                 obj.set_sensitive(True)
Exemplo n.º 5
0
 def attrs_set(self, model, cell):
     if self.attrs.get('attrs', False):
         attrs_changes = eval(self.attrs.get('attrs', "{}"),
                              {'uid': rpc.session.uid})
         for k, v in attrs_changes.items():
             result = False
             result = tools.calc_condition(self, model, v)
             model[self.field_name].get_state_attrs(model)[k] = result
Exemplo n.º 6
0
 def attrs_set(self, model):
     if self.attrs.get('attrs',False):
         attrs_changes = eval(self.attrs.get('attrs',"{}"),{'uid':rpc.session.uid})
         for k,v in attrs_changes.items():
             result = False
             result = tools.calc_condition(self,model,v)
             if result:
                 if k == 'invisible':
                     return 'hide'
                 elif k == 'readonly':
                     return True
     return False
Exemplo n.º 7
0
 def attrs_set(self, model):
     if self.attrs.get("attrs", False):
         attrs_changes = eval(self.attrs.get("attrs", "{}"), {"uid": rpc.session.uid})
         for k, v in attrs_changes.items():
             result = False
             result = tools.calc_condition(self, model, v)
             if result:
                 if k == "invisible":
                     return "hide"
                 elif k == "readonly":
                     return True
     return False
Exemplo n.º 8
0
 def attrs_set(self, model,path):
     if path.attrs.get('attrs',False):
         attrs_changes = eval(path.attrs.get('attrs',"{}"),{'uid':rpc.session.uid})
         for k,v in attrs_changes.items():
             result = True
             result = tools.calc_condition(self,model,v)
             if result:
                 if k=='invisible':
                     return False
                 elif k=='readonly':
                     return False
     return True
Exemplo n.º 9
0
 def attrs_set(self, model):
     sa = getattr(self.widget, 'attrs') or {}
     attrs_changes = eval(sa.get('attrs',"{}"),{'uid':rpc.session.uid})
     for k,v in attrs_changes.items():
         result = True
         result = result and tools.calc_condition(self, model, v)
         if k == 'invisible':
             func = ['show_all', 'hide_all'][bool(result)]
             getattr(self.widget, func)()
             if self.label:
                 getattr(self.label, func)()
         elif k in ['readonly', 'required'] and model:
             if isinstance(self.widget, gtk.Frame):
                 for name, wid in self.group_child.iteritems():
                     model.mgroup.mfields[name].get_state_attrs(model)[k] = result
             elif k == 'readonly':
                 self.widget.set_sensitive(not result)
Exemplo n.º 10
0
 def attrs_set(self, model):
     uid = rpc.session.uid
     try:
         attrs_changes = eval(self.attrs.get('attrs',"{}"))
     except:
         attrs_changes = eval(self.attrs.get('attrs',"{}"),model.value)
         for k,v in attrs_changes.items():
             for i in range(0,len(v)):
                if v[i][2]:
                     if type(v[i][2])==type([]):
                         cond=()
                         cond=v[i][0],v[i][1],v[i][2][0]
                         attrs_changes[k][i]=cond
     for k,v in attrs_changes.items():
         result = True
         result = tools.calc_condition(self, model, v)
         if result:
            self.get_state_attrs(model)[k]=True
Exemplo n.º 11
0
    def attrs_set(self, model):
        sa = getattr(self.widget, 'attrs') or {}

        attrs_changes = eval(sa.get('attrs', "{}"), {'uid': rpc.session.uid})
        for k, v in attrs_changes.items():
            result = True
            result = result and tools.calc_condition(self, model, v)
            if k == 'invisible':
                func = ['show', 'hide'][bool(result)]
                getattr(self.widget, func)()
                if self.label:
                    getattr(self.label, func)()
            elif k == 'readonly':
                if isinstance(self.widget, gtk.Frame):
                    for name, wid in self.frame_child.iteritems():
                        self.set_sensitive(wid, result)
                else:
                    self.set_sensitive(self.widget, result)
Exemplo n.º 12
0
 def attrs_set(self, model):
     uid = rpc.session.uid
     try:
         attrs_changes = eval(self.attrs.get('attrs', "{}"))
     except:
         attrs_changes = eval(self.attrs.get('attrs', "{}"), model.value)
         for k, v in attrs_changes.items():
             for i in range(0, len(v)):
                 if v[i][2]:
                     if type(v[i][2]) == type([]):
                         cond = ()
                         cond = v[i][0], v[i][1], v[i][2][0]
                         attrs_changes[k][i] = cond
     for k, v in attrs_changes.items():
         result = True
         result = tools.calc_condition(self, model, v)
         if result:
             self.get_state_attrs(model)[k] = True
Exemplo n.º 13
0
    def attrs_set(self, model):
        sa = getattr(self.widget, 'attrs') or {}

        attrs_changes = eval(sa.get('attrs',"{}"),{'uid':rpc.session.uid})
        for k,v in attrs_changes.items():
            result = True
            result = result and tools.calc_condition(self, model, v)
            if k == 'invisible':
                func = ['show', 'hide'][bool(result)]
                getattr(self.widget, func)()
                if self.label:
                    getattr(self.label, func)()
            elif k == 'readonly':
                if isinstance(self.widget, gtk.Frame):
                    for name, wid in self.frame_child.iteritems():
                        self.set_sensitive(wid, result)
                else:
                    self.set_sensitive(self.widget, result)
Exemplo n.º 14
0
 def attrs_set(self, model):
     sa = hasattr(self.widget, 'attrs') and self.widget.attrs or {}
     attrs_changes = eval(sa.get('attrs',"{}"))
     for k,v in attrs_changes.items():
         result = True
         for condition in v:
             result = result and tools.calc_condition(self,model,condition)
                 
         if result:
             if k=='invisible':
                 self.widget.hide()
             elif k=='readonly':
                 self.widget.set_sensitive(False)
             else:
                 self.widget.set_sensitive(False and sa.get('readonly',False))
         else:
             if k=='readonly':
                 self.widget.set_sensitive(True)
             if k=='invisible':
                 self.widget.show()        
Exemplo n.º 15
0
    def attrs_set(self, model):
        sa = hasattr(self.widget, 'attrs') and self.widget.attrs or {}
        attrs_changes = eval(sa.get('attrs', "{}"))
        for k, v in attrs_changes.items():
            result = True
            for condition in v:
                result = result and tools.calc_condition(
                    self, model, condition)

            if result:
                if k == 'invisible':
                    self.widget.hide()
                elif k == 'readonly':
                    self.widget.set_sensitive(False)
                else:
                    self.widget.set_sensitive(False
                                              and sa.get('readonly', False))
            else:
                if k == 'readonly':
                    self.widget.set_sensitive(True)
                if k == 'invisible':
                    self.widget.show()
Exemplo n.º 16
0
 def attrs_set(self, model, widget=None):
     uid = rpc.session.uid
     try:
         attrs_changes = eval(self.attrs.get("attrs", "{}"))
     except:
         attrs_changes = eval(self.attrs.get("attrs", "{}"), model.value)
         for k, v in attrs_changes.items():
             for i in range(0, len(v)):
                 if v[i][2]:
                     if type(v[i][2]) == type([]):
                         cond = ()
                         cond = v[i][0], v[i][1], v[i][2][0]
                         attrs_changes[k][i] = cond
     for k, v in attrs_changes.items():
         result = True
         result = tools.calc_condition(self, model, v)
         if k == "invisible" and widget:
             func = ["show_all", "hide_all"][bool(result)]
             getattr(widget, func)()
             if widget.label_ebox:
                 getattr(widget.label_ebox, func)()
         elif k in ["readonly", "required"]:
             self.get_state_attrs(model)[k] = result