예제 #1
0
파일: entityns.py 프로젝트: Schevo/schevo
 def __iter__(self):
     hidden = self._i._hidden_actions
     return (k for k, v in self._d.iteritems()
             if (k not in hidden
                 and isselectionmethod(v)
                 )
             )
예제 #2
0
파일: window.py 프로젝트: Schevo/schevogtk
 def _on_action_selected(self, widget, action):
     self.before_action(action)
     if action.type == 'relationship':
         entity = action.instance
         self.run_relationship_dialog(entity)
     elif action.type == 'transaction':
         if not isselectionmethod(action.method):
             tx = action.method()
         else:
             tx = action.method(action.selection)
         if action.related is not None:
             # Initialize the related field if the transaction
             # setup hasn't already done so or set it to readonly.
             field_name = action.related.field_name
             if (field_name in tx.f and not tx.f[field_name].readonly and
                 getattr(tx, field_name) is UNASSIGNED):
                 setattr(tx, field_name, action.related.entity)
         self.before_tx(tx, action)
         tx_result = self.run_tx_dialog(tx, action)
         if tx.s.executed:
             reflect_changes = getattr(widget, 'reflect_changes', None)
             if reflect_changes:
                 reflect_changes(tx_result, tx)
         self.reflect_changes(tx_result, tx)
         self.after_tx(tx, tx_result)
     elif action.type == 'view':
         entity = action.instance
         self.run_view_dialog(entity, action)
     self.after_action(action)
     # XXX Hack due to a bug where this window doesn't become
     # active when one modal dialog leads to another (including the
     # dialog used by FileChooserButton, or an error message).
     self.toplevel.present()
예제 #3
0
파일: viewns.py 프로젝트: Schevo/schevo
 def __init__(self, name, cls):
     NamespaceExtension.__init__(self, name, cls)
     for key in dir(cls):
         if key.startswith('t_'):
             method = getattr(cls, key)
             if isselectionmethod(method):
                 name = key[2:]
                 self._set(name, method)
예제 #4
0
파일: entityns.py 프로젝트: Schevo/schevo
 def __iter__(self):
     # Find hidden actions.
     instance = self._i
     hidden = instance._hidden_actions.copy()
     hidden_t_methods = getattr(instance, '_hidden_t_methods', None)
     if hidden_t_methods is not None:
         hidden.update(hidden_t_methods() or [])
     # Find instance methods.
     return (k for k, v in self._d.iteritems()
             if (k not in hidden
                 and not isselectionmethod(v)
                 )
             )