コード例 #1
0
    def __init__(self, parent, controller, prj):
        Frame.__init__(self, parent)

        self.prj = prj
        self.controller = controller
        self.model = ModelDatabase(Database())

        self.model = ModelDatabase(Database())
        self.log_pwd_msg = Label(text="", font='Arial 12', fg='red')

        self.name_text = Label(text="Project name*", font='Arial 12')
        self.name_input = Entry(font='Arial 12')
        self.name_input.insert(END, self.prj.name)

        self.author_text = Label(text="Author*", font='Arial 12')
        self.author_input = Entry(font='Arial 12')
        self.author_input.insert(END, self.prj.author)

        self.desc_text = Label(text="Description", font='Arial 12')
        self.desc_input = Text(font='Arial 12', width=20, height=6)
        self.desc_input.insert(END, self.prj.description)

        self.users_list = Label(text="Members",
                                font='Arial 12',
                                borderwidth=0,
                                highlightthickness=0)
        self.lb_user = Listbox(font='Arial 12', selectmode="multiple")

        for numb, user in enumerate(self.model.get_users()):
            self.lb_user.insert(numb, user.login)

        self.add_btn = Button(text="Save",
                              font='Arial 12',
                              command=lambda: self.save_project())
        self.cancel_btn = Button(
            text="Cancel",
            font='Arial 12',
            command=lambda: controller.create_projects_page())

        # dispose element on widget\

        self.name_text.grid(row=1, columnspan=2, pady=10)
        self.name_input.grid(row=2, columnspan=2)

        self.author_text.grid(row=3, columnspan=2)
        self.author_input.grid(row=4, columnspan=2, pady=10, padx=10)

        self.desc_text.grid(row=7, columnspan=2, pady=6)
        self.desc_input.grid(row=8, columnspan=2, padx=10)

        self.users_list.grid(row=1, column=2, columnspan=2)
        self.lb_user.grid(row=1, rowspan=8, column=2, columnspan=2, padx=10)

        self.add_btn.grid(row=9, column=1, sticky="w", pady=10)
        self.cancel_btn.grid(row=9, column=1, sticky="e", padx=10)
コード例 #2
0
    def __init__(self, parent, controller):
        Frame.__init__(self, parent)

        self.controller = controller
        self.model = ModelDatabase(Database())
        self.log_pwd_msg = Label(text="", font='Arial 12', fg='red')

        # Creating the username & password entry boxes
        self.login_text = Label(text="Username*", font='Arial 12')
        self.login_input = Entry(font='Arial 12')
        self.login_input.bind("<Key>", self.hide_login_password_message)

        self.password_text = Label(text="Password*", font='Arial 12')
        self.password_input = Entry(show="*", font='Arial 12')
        self.password_input.bind("<Key>", self.hide_login_password_message)

        # attempt to login button
        self.attempt_login = Button(
            text="Enter",
            font='Arial 12',
            command=lambda: self.login_password_message())
        self.register = Button(text=" New register",
                               font='Arial 12',
                               command=lambda: controller.create_reg_page())

        self.login_text.grid(row=1, columnspan=2, pady=10)
        self.login_input.grid(row=2, columnspan=2)
        self.password_text.grid(row=3, columnspan=2)
        self.password_input.grid(row=4, columnspan=2, pady=10)
        self.attempt_login.grid(row=5, column=0, sticky="e", pady=10, padx=15)
        self.register.grid(row=5, column=1, sticky="w", pady=10, padx=15)
コード例 #3
0
 def __init__(self):
     self.logger = logging.getLogger('session')
     self.db = Database()
     self.generateSessions(
     )  #Run through last session logs and generate state information
     self.eventThread = threading.Thread(target=self.eventLoop, args=(()))
     self.eventThread.daemon = True
     self.eventThread.start()
コード例 #4
0
    def __init__(self, parent, controller):
        Frame.__init__(self, parent)
        self.controller = controller
        self.model = ModelDatabase(Database())

        self.model = ModelDatabase(Database())
        self.log_pwd_msg = Label(text="", font='Arial 12', fg='red')

        self.log_text = Label(text="Username*", font='Arial 12')
        self.log_input = Entry(font='Arial 12')

        self.email_text = Label(text="Email*", font='Arial 12')
        self.email_input = Entry(font='Arial 12')

        self.pwd_text = Label(text="Password*", font='Arial 12')
        self.pwd_input = Entry(show="*", font='Arial 12')

        self.cfm_pwd_text = Label(text="Repeat Password*", font='Arial 12')
        self.cfm_pwd_input = Entry(show="*", font='Arial 12')

        self.attempt_login = Button(
            text="Login",
            font='Arial 12',
            command=lambda: self.controller.create_log_page())
        self.register = Button(text="Register",
                               font='Arial 12',
                               command=lambda: self.register_validation())

        # dispose element on widget
        self.log_text.grid(row=1, columnspan=2, pady=10)
        self.log_input.grid(row=2, columnspan=2)

        self.email_text.grid(row=3, columnspan=2, pady=10)
        self.email_input.grid(row=4, columnspan=2)

        self.pwd_text.grid(row=5, columnspan=2)
        self.pwd_input.grid(row=6, columnspan=2, pady=10)

        self.cfm_pwd_text.grid(row=7, columnspan=2)
        self.cfm_pwd_input.grid(row=8, columnspan=2, pady=10)

        self.attempt_login.grid(row=9, column=0, sticky="e", pady=10, padx=15)
        self.register.grid(row=9, column=1, sticky="w", pady=10, padx=15)
コード例 #5
0
 def __init__(self):
     self.model = ModelDatabase(Database())
     self.command_set = {
         '1': self.create_user,
         '2': self.create_project,
         '3': self.update_user,
         '4': self.update_project,
         '5': self.delete_user,
         '6': self.delete_project,
         '7': self.show_users,
         '8': self.show_projects,
         'exit': None,
         'q': None
     }
     self.connect()
コード例 #6
0
    def __init__(self, parent, controller):
        Frame.__init__(self, parent)

        self.model = ModelDatabase(Database())

        self.projects_list = Label(text="Projects",
                                   font='Arial 12',
                                   borderwidth=0,
                                   highlightthickness=0)
        self.lb_projects = Listbox(font='Arial 12')

        for numb, project in enumerate(self.model.get_projects()):
            self.lb_projects.insert(numb, project.name)

        self.update_project = Button(text="Update project", font='Arial 12')
        self.create_project = Button(
            text="New project",
            font='Arial 12',
            command=lambda: controller.create_add_project_page())

        self.update_project.grid(row=9, column=0, sticky="e", pady=10, padx=15)
        self.create_project.grid(row=9, column=1, sticky="w", pady=10, padx=15)
        self.projects_list.grid(row=1, columnspan=2, pady=5)
        self.lb_projects.grid(row=2, columnspan=2, pady=10)
コード例 #7
0
            if user_name == user.login:
                self.data['users'].remove(user)

        self.db.update_data(self.data)

    @update_user_validation
    def update_user(self, user_name, property):

        if property[0] == "login":
            for project in self.data['projects']:
                if user_name in project.members:
                    project.remove_member(user_name)
                    project.add_member(property[1])

                if user_name == project.author:
                    project.author = property[1]

        for user in self.data['users']:
            if user_name == user.login:
                user.update_property(*property)

        self.db.update_data(self.data)


if __name__ == "__main__":
    a = ModelDatabase(Database())
    user = User('*****@*****.**', 'masha', '789')
    print(a.get_users())
    a.update_user('tom', ('email', '*****@*****.**'))
    print(a.get_users())