예제 #1
0
    def setup_slaves(self):
        BasePersonRoleEditor.setup_slaves(self)

        user_status = UserStatusSlave(self.store,
                                      self.model,
                                      visual_mode=self.visual_mode)
        self.main_slave.attach_person_slave(user_status)

        passwd_fields = not self.edit_mode
        self.user_details = UserDetailsSlave(
            self.store,
            self.model,
            show_password_fields=passwd_fields,
            visual_mode=self.visual_mode)
        tab_text = _('User Details')
        self.main_slave._person_slave.add_extra_tab(tab_text,
                                                    self.user_details,
                                                    self.USER_TAB_POSITION)

        tab_text = _('Branch Access')
        self.user_branches = UserBranchAccessSlave(self.store, self.model)
        # XXX: workaround border being to large
        self.user_branches.vbox1.set_border_width(0)
        self.main_slave._person_slave.add_extra_tab(tab_text,
                                                    self.user_branches)
예제 #2
0
파일: personeditor.py 프로젝트: romaia/stoq
    def setup_slaves(self):
        BasePersonRoleEditor.setup_slaves(self)

        user_status = UserStatusSlave(self.store, self.model,
                                      visual_mode=self.visual_mode)
        self.main_slave.attach_person_slave(user_status)

        passwd_fields = not self.edit_mode
        self.user_details = UserDetailsSlave(self.store, self.model,
                                             show_password_fields=passwd_fields,
                                             visual_mode=self.visual_mode)
        tab_text = _('User Details')
        self.main_slave._person_slave.attach_custom_slave(self.user_details,
                                                          tab_text)

        tab_child = self.main_slave._person_slave.custom_tab
        notebook = self.main_slave._person_slave.person_notebook
        notebook.reorder_child(tab_child, position=self.USER_TAB_POSITION)
        notebook.set_current_page(self.USER_TAB_POSITION)

        tab_text = _('Branch Access')
        self.user_branches = UserBranchAccessSlave(self.store, self.model)
        # XXX: workaround border being to large
        self.user_branches.vbox1.set_border_width(0)
        self.main_slave._person_slave.attach_extra_slave(self.user_branches,
                                                         tab_text)
예제 #3
0
class UserEditor(BasePersonRoleEditor):
    model_name = _('User')
    title = _('New User')
    model_type = LoginUser
    gladefile = 'BaseTemplate'
    USER_TAB_POSITION = 0

    help_section = 'user'
    ui_form_name = u'user'

    def create_model(self, store):
        person = BasePersonRoleEditor.create_model(self, store)
        return person.login_user or LoginUser(person=person,
                                              store=store,
                                              username=u"",
                                              password=u"",
                                              profile=None)

    def setup_slaves(self):
        BasePersonRoleEditor.setup_slaves(self)

        user_status = UserStatusSlave(self.store,
                                      self.model,
                                      visual_mode=self.visual_mode)
        self.main_slave.attach_person_slave(user_status)

        passwd_fields = not self.edit_mode
        self.user_details = UserDetailsSlave(
            self.store,
            self.model,
            show_password_fields=passwd_fields,
            visual_mode=self.visual_mode)
        tab_text = _('User Details')
        self.main_slave._person_slave.add_extra_tab(tab_text,
                                                    self.user_details,
                                                    self.USER_TAB_POSITION)

        tab_text = _('Branch Access')
        self.user_branches = UserBranchAccessSlave(self.store, self.model)
        # XXX: workaround border being to large
        self.user_branches.vbox1.set_border_width(0)
        self.main_slave._person_slave.add_extra_tab(tab_text,
                                                    self.user_branches)

    def validate_confirm(self):
        return (self.user_details.validate_confirm()
                and self.user_branches.validate_confirm())
예제 #4
0
파일: personeditor.py 프로젝트: romaia/stoq
class UserEditor(BasePersonRoleEditor):
    model_name = _('User')
    title = _('New User')
    model_type = LoginUser
    gladefile = 'BaseTemplate'
    USER_TAB_POSITION = 0

    help_section = 'user'
    ui_form_name = u'user'

    def create_model(self, store):
        person = BasePersonRoleEditor.create_model(self, store)
        return person.login_user or LoginUser(person=person,
                                              store=store, username=u"",
                                              password=u"", profile=None)

    def setup_slaves(self):
        BasePersonRoleEditor.setup_slaves(self)

        user_status = UserStatusSlave(self.store, self.model,
                                      visual_mode=self.visual_mode)
        self.main_slave.attach_person_slave(user_status)

        passwd_fields = not self.edit_mode
        self.user_details = UserDetailsSlave(self.store, self.model,
                                             show_password_fields=passwd_fields,
                                             visual_mode=self.visual_mode)
        tab_text = _('User Details')
        self.main_slave._person_slave.attach_custom_slave(self.user_details,
                                                          tab_text)

        tab_child = self.main_slave._person_slave.custom_tab
        notebook = self.main_slave._person_slave.person_notebook
        notebook.reorder_child(tab_child, position=self.USER_TAB_POSITION)
        notebook.set_current_page(self.USER_TAB_POSITION)

        tab_text = _('Branch Access')
        self.user_branches = UserBranchAccessSlave(self.store, self.model)
        # XXX: workaround border being to large
        self.user_branches.vbox1.set_border_width(0)
        self.main_slave._person_slave.attach_extra_slave(self.user_branches,
                                                         tab_text)

    def validate_confirm(self):
        return (self.user_details.validate_confirm() and
                self.user_branches.validate_confirm())
예제 #5
0
    def setup_slaves(self):
        BasePersonRoleEditor.setup_slaves(self)

        user_status = UserStatusSlave(self.store, self.model,
                                      visual_mode=self.visual_mode)
        self.main_slave.attach_person_slave(user_status)

        passwd_fields = not self.edit_mode
        self.user_details = UserDetailsSlave(self.store, self.model,
                                             show_password_fields=passwd_fields,
                                             visual_mode=self.visual_mode)
        tab_text = _('User Details')
        self.main_slave._person_slave.add_extra_tab(tab_text, self.user_details,
                                                    self.USER_TAB_POSITION)

        tab_text = _('Branch Access')
        self.user_branches = UserBranchAccessSlave(self.store, self.model)
        self.main_slave._person_slave.add_extra_tab(tab_text, self.user_branches)
예제 #6
0
class UserEditor(BasePersonRoleEditor):
    model_name = _('User')
    title = _('New User')
    model_type = LoginUser
    gladefile = 'BaseTemplate'
    USER_TAB_POSITION = 0

    help_section = 'user'
    ui_form_name = u'user'

    def create_model(self, store):
        person = BasePersonRoleEditor.create_model(self, store)
        return person.login_user or LoginUser(person=person,
                                              store=store, username=u"",
                                              password=u"", profile=None)

    def setup_slaves(self):
        BasePersonRoleEditor.setup_slaves(self)

        user_status = UserStatusSlave(self.store, self.model,
                                      visual_mode=self.visual_mode)
        self.main_slave.attach_person_slave(user_status)

        passwd_fields = not self.edit_mode
        self.user_details = UserDetailsSlave(self.store, self.model,
                                             show_password_fields=passwd_fields,
                                             visual_mode=self.visual_mode)
        tab_text = _('User Details')
        self.main_slave._person_slave.add_extra_tab(tab_text, self.user_details,
                                                    self.USER_TAB_POSITION)

        tab_text = _('Branch Access')
        self.user_branches = UserBranchAccessSlave(self.store, self.model)
        self.main_slave._person_slave.add_extra_tab(tab_text, self.user_branches)

    def validate_confirm(self):
        return (self.user_details.validate_confirm() and
                self.user_branches.validate_confirm())
예제 #7
0
 def test_create(self):
     user = self.create_user()
     slave = UserBranchAccessSlave(self.store, user)
     self.check_slave(slave, 'user-branch-access-slave-create')