Exemplo n.º 1
0
 def _displayed_forms_menu(self):
     return Menu(_("Available forms"),
                 [CheckItem(b.title(), help='',
                            command=self.COMMAND_TOGGLE_SIDEFORM(binding=b,
                                                                 _command_handler=self),
                            state=lambda b=b: b.id() in [f.binding().id() for f in self._forms])
                  for b in sorted(self._main_form.bindings(), key=lambda b: b.title())
                  if b.name() is None or has_access(b.name())])
Exemplo n.º 2
0
 def _create_subform(self, parent, binding):
     if binding.name() and not has_access(binding.name()):
         return None
     kwargs = dict(guardian=self, binding=binding, main_form=self._main_form)
     if binding.name() is None:
         form = self.TabbedWebForm
     elif binding.single():
         form = self.TabbedShowForm
     else:
         form = self.TabbedBrowseForm
     form_instance = form(parent, self._resolver, binding.name(), full_init=False, **kwargs)
     return form_instance
Exemplo n.º 3
0
 def _displayed_forms_menu(self):
     return Menu(_("Available forms"), [
         CheckItem(b.title(),
                   help='',
                   command=self.COMMAND_TOGGLE_SIDEFORM(
                       binding=b, _command_handler=self),
                   state=lambda b=b: b.id() in
                   [f.binding().id() for f in self._forms])
         for b in sorted(self._main_form.bindings(),
                         key=lambda b: b.title())
         if b.name() is None or has_access(b.name())
     ])
Exemplo n.º 4
0
 def _create_forms(self, parent):
     bindings = [binding for binding in self._main_form.bindings()
                 # TODO: Remove this condition to include inactive tabs in multi form.
                 # The wx.Notebook doesn't support inactive tabs and the workaround doesn't
                 # work correctly, so we rather exclude disabled tabs here for now.
                 # binding.name() is None for web forms.
                 # UPDATE: inactive tabs might work now with AuiNotebook.
                 if binding.name() is None or has_access(binding.name())]
     saved_order = self._get_saved_setting('binding_order')
     if saved_order:
         bdict = dict([(b.id(), b) for b in bindings])
         bindings = [bdict[binding_id] for binding_id in saved_order if binding_id in bdict]
     return [(binding.title(), self._create_subform(parent, binding)) for binding in bindings]
Exemplo n.º 5
0
 def _create_subform(self, parent, binding):
     if binding.name() and not has_access(binding.name()):
         return None
     kwargs = dict(guardian=self,
                   binding=binding,
                   main_form=self._main_form)
     if binding.name() is None:
         form = self.TabbedWebForm
     elif binding.single():
         form = self.TabbedShowForm
     else:
         form = self.TabbedBrowseForm
     form_instance = form(parent,
                          self._resolver,
                          binding.name(),
                          full_init=False,
                          **kwargs)
     return form_instance
Exemplo n.º 6
0
 def _create_forms(self, parent):
     bindings = [
         binding for binding in self._main_form.bindings()
         # TODO: Remove this condition to include inactive tabs in multi form.
         # The wx.Notebook doesn't support inactive tabs and the workaround doesn't
         # work correctly, so we rather exclude disabled tabs here for now.
         # binding.name() is None for web forms.
         # UPDATE: inactive tabs might work now with AuiNotebook.
         if binding.name() is None or has_access(binding.name())
     ]
     saved_order = self._get_saved_setting('binding_order')
     if saved_order:
         bdict = dict([(b.id(), b) for b in bindings])
         bindings = [
             bdict[binding_id] for binding_id in saved_order
             if binding_id in bdict
         ]
     return [(binding.title(), self._create_subform(parent, binding))
             for binding in bindings]