def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)
        self.controller = controller
        stat_label = tk.Label(self,
                              text="Student Interface:",
                              font=controller.title_font)
        stat_label.grid(row=1, column=1, pady=5, padx=10, sticky=tk.NSEW)
        self.has_list = False

        # Setup
        self.config = cT.load_config()
        self.moodle_site = ""
        self.php_my_admin_site = ""
        self.ftp_site = ""
        self.instanceIsReady = False
        self.waitTime = 240  # Four minutes

        # Start Section
        ins_label = tk.Label(self, text="Start Your VM Here")
        ins_label.grid(row=2, column=1, sticky="EW", padx=10)
        pro_label = tk.Label(self, text="Progress")
        pro_label.grid(row=2, column=2, sticky="W", padx=10)
        self.load_progress = Progressbar(self,
                                         orient='horizontal',
                                         length=165,
                                         mode='determinate')
        self.load_progress.grid(row=3, column=2, sticky="W", padx=10, pady=3)
        self.load_progress.place_forget()
        self.start_button = tk.Button(self,
                                      text="Start",
                                      command=self.start_check)
        self.start_button.grid(row=3, column=1, pady=3, padx=10)

        # Section Separation
        separator_line = Separator(self, orient="horizontal")
        separator_line.grid(row=4,
                            column=1,
                            columnspan=2,
                            padx=15,
                            pady=20,
                            sticky="EW")

        # Sites Sections
        link_label = tk.Label(self, text="VM Links")
        link_label.grid(row=5, column=1, sticky='NSEW')
        self.moo_button = tk.Button(
            self,
            text="Moodle",
            command=lambda: self.open_page(self.moodle_site),
            state=tk.DISABLED)
        self.moo_button.grid(row=6, column=1, pady=12)
        self.moo_info = tk.Message(self,
                                   text=self.config['mood_info'],
                                   width=165,
                                   font=(None, 10))
        self.moo_info.grid(row=6, column=2, sticky=tk.W)
        self.php_button = tk.Button(
            self,
            text="phpAdmin",
            command=lambda: self.open_page(self.php_my_admin_site),
            state=tk.DISABLED)
        self.php_button.grid(row=7, column=1, pady=12)
        self.php_info = tk.Message(self,
                                   text=self.config['php_info'],
                                   width=165,
                                   font=(None, 10))
        self.php_info.grid(row=7, column=2, sticky=tk.W)
        self.ftp_button = tk.Button(
            self,
            text="FTP",
            command=lambda: self.open_page(self.ftp_site),
            state=tk.DISABLED)
        self.ftp_button.grid(row=8, column=1, pady=12)
        self.ftp_info = tk.Message(self,
                                   text=self.config['ftp_info'],
                                   width=165,
                                   font=(None, 10))
        self.ftp_info.grid(row=8, column=2, sticky=tk.W)

        # Section Separation
        separator_line2 = Separator(self, orient="horizontal")
        separator_line2.grid(row=9,
                             column=1,
                             columnspan=2,
                             padx=15,
                             pady=20,
                             sticky="EW")

        # Guest Visit Section
        vis_label = tk.Label(self, text="Other Class VMs")
        vis_label.grid(row=10, column=2, sticky="W", padx=10, pady=12)
        self.vis_button = tk.Button(
            self,
            text="Visit",
            command=lambda: self.controller.show_frame("GuestManagementPage"))
        self.vis_button.grid(row=10, column=2, sticky="E", padx=10, pady=12)

        # Threads
        self.check = Thread(target=self.check_status)
        self.display = Thread(target=self.display_progress)
Esempio n. 2
0
    def __init__(self, parent, controller):

        tk.Frame.__init__(self, parent)
        self.controller = controller
        label = tk.Label(self,
                         text="Teacher Interface:",
                         font=controller.title_font)
        label.grid(row=1, column=1, pady=3, padx=10, sticky=tk.W)
        self.config = cT.load_config()
        self.has_list = False

        # Management Buttons
        man_label = tk.Label(self, text="Manage", font="none 12 bold")
        man_label.grid(row=2, column=1, sticky=tk.W, padx=10)
        manage_buttons = tk.Frame(self)
        manage_buttons.grid(row=3, column=1, sticky=tk.EW, padx=10)
        self.users_button = tk.Button(
            manage_buttons,
            text="Users",
            command=lambda: self.controller.show_frame("UserManagementPage"))
        self.VM_button = tk.Button(
            manage_buttons,
            text="VMs",
            command=lambda: self.controller.show_frame("VMManagementPage"))
        self.settings_button = tk.Button(
            manage_buttons,
            text="Settings",
            command=lambda: self.controller.show_frame("SettingsPage"))
        self.VM_button.pack(side=tk.LEFT)
        self.users_button.pack(side=tk.LEFT)
        self.settings_button.pack(side=tk.LEFT)

        # Add Single Student Section
        add_label = tk.Label(self,
                             text="Add Single Student",
                             font="none 12 bold")
        add_label.grid(row=4, column=1, sticky=tk.W, pady=10, padx=10)
        id_label = tk.Label(self, text="Student ID")
        id_label.grid(row=5, column=1, sticky=tk.W, padx=10)
        em_label = tk.Label(self, text="Email")
        em_label.grid(row=5, column=2, sticky=tk.W, padx=10)
        self.id_entry = tk.Entry(self,
                                 width=20,
                                 font="none 12 bold",
                                 highlightthickness=0)
        self.id_entry.grid(row=6, column=1, padx=10, sticky=tk.W)
        self.em_entry = tk.Entry(self,
                                 width=20,
                                 font="none 12 bold",
                                 highlightthickness=0)
        self.em_entry.grid(row=6, column=2, padx=10, sticky=tk.W)
        fn_label = tk.Label(self, text="First Name")
        fn_label.grid(row=7, column=1, sticky=tk.W, padx=10)
        ln_label = tk.Label(self, text="Last Name")
        ln_label.grid(row=7, column=2, sticky=tk.W, padx=10)
        self.fn_entry = tk.Entry(self,
                                 width=20,
                                 font="none 12 bold",
                                 highlightthickness=0)
        self.fn_entry.grid(row=8, column=1, padx=10, sticky=tk.W)
        self.ln_entry = tk.Entry(self,
                                 width=20,
                                 font="none 12 bold",
                                 highlightthickness=0)
        self.ln_entry.grid(row=8, column=2, padx=10, sticky=tk.W)

        # Add Student Via CSV
        add_mul_label = tk.Label(self,
                                 text="Add Multiple",
                                 font="none 12 bold")
        add_mul_label.grid(row=10, column=1, sticky=tk.W, pady=10, padx=10)
        csv_label = tk.Label(self, text="CSV File")
        csv_label.grid(row=11, column=1, sticky=tk.W, padx=10)
        pro_label = tk.Label(self, text="Progress")
        pro_label.grid(row=11, column=2, sticky=tk.W, padx=10)
        self.csv_entry = tk.Entry(self,
                                  width=20,
                                  font="none 12 bold",
                                  highlightthickness=0)
        self.csv_entry.insert(0, "Add file via button bellow.")
        self.csv_entry.grid(row=12, column=1, sticky=tk.W, padx=10, pady=3)
        self.csv_progress = Progressbar(self,
                                        orient='horizontal',
                                        length=165,
                                        mode='determinate')
        self.csv_progress.grid(row=12, column=2, sticky=tk.W, padx=10, pady=3)
        self.add_button = tk.Button(self,
                                    text="Add",
                                    command=lambda: self.add_one_user())
        self.add_button.grid(row=9, column=2, sticky="E", padx=10, pady=3)
        self.open_button = tk.Button(self,
                                     text="File",
                                     command=lambda: self.open_file())
        self.open_button.grid(row=13, column=1, sticky="E", padx=10, pady=5)
        self.start_button = tk.Button(self,
                                      text="Start",
                                      command=lambda: self.create_multi_user())
        self.start_button.grid(row=13, column=2, sticky="E", padx=10, pady=5)

        # List of buttons for enabling and disabling
        self.buttons_list = [
            self.add_button, self.open_button, self.start_button,
            self.users_button, self.VM_button, self.settings_button
        ]