예제 #1
0
    def __init__(self, parent, controller):

        """
        Parameters
        ----------

        :param parent: window
        :param controller: GUI controller
        """

        tk.Frame.__init__(self, parent)

        # Page init
        self.controller = controller
        self.menubar = Menubar(controller)
        # Disables ability to tear menu bar into own window
        self.controller.option_add('*tearOff', 'FALSE')
        system_logo = CROSS_WINDOWS_SETTINGS.get('LOGO')
        photo_location = os.path.join(system_logo)
        global logo_img
        logo_img = tk.PhotoImage(file=photo_location)

        # Page header
        self.logo_png = tk.Button(self)
        self.logo_png.place(relx=0.28, rely=0.029, height=172, width=300)
        set_logo_configuration(self.logo_png, image=logo_img)

        self.instructions = tk.Label(self)
        self.instructions.place(relx=0.015, rely=0.3, height=32, width=635)
        self.instructions.configure(text='''Tuning parameters, please wait...''')
        set_widget_to_left(self.instructions)

        # Page body
        loading_gif = LOADING_WINDOW_SETTINGS.get('LOADING_GIF')
        delay_between_frames = LOADING_WINDOW_SETTINGS.get('DELAY_BETWEEN_FRAMES')

        self.title_font = Font(family='Helvetica', size=12, weight="bold")

        self.loading_gif = AnimatedGif(self, loading_gif, delay_between_frames)
        self.loading_gif.place(relx=0.1, rely=0.35, height=330, width=600)

        self.clock_label = tk.Label(self, text="", font=self.title_font)
        self.clock_label.place(relx=0.38, rely=0.7, height=32, width=150)

        # Page footer
        self.stop_button = HoverButton(self, command=self.stop_model_process)
        self.stop_button.place(relx=0.813, rely=0.839, height=25, width=81)
        set_button_configuration(self.stop_button, text='''Stop''')

        self.back_button = HoverButton(self, command=self.back_window)
        self.back_button.place(relx=0.017, rely=0.839, height=25, width=81)
        set_button_configuration(self.back_button, text='''Back''')
        self.back_button.configure(state='disabled')

        self.copyright = tk.Label(self)
        self.copyright.place(relx=0, rely=0.958, height=25, width=750)
        set_copyright_configuration(self.copyright)

        # Page logic
        self.loading_gif.start()
예제 #2
0
    def __init__(self, parent, controller):
        """
        Parameters
        ----------

        :param parent: window
        :param controller: GUI controller
        """

        tk.Frame.__init__(self, parent)

        # Page init
        self.controller = controller
        self.menubar = Menubar(controller)
        # Disables ability to tear menu bar into own window
        self.controller.option_add('*tearOff', 'FALSE')
        system_logo = CROSS_WINDOWS_SETTINGS.get('LOGO')
        photo_location = os.path.join(system_logo)
        global logo_img
        logo_img = tk.PhotoImage(file=photo_location)

        # Page header
        self.logo_png = tk.Button(self)
        self.logo_png.place(relx=0.28, rely=0.029, height=172, width=300)
        set_logo_configuration(self.logo_png, image=logo_img)

        self.instructions = tk.Label(self)
        self.instructions.place(relx=0.015, rely=0.3, height=32, width=635)
        self.instructions.configure(
            text=
            '''Please select the algorithms for which you want to build anomaly detection models.'''
        )
        set_widget_to_left(self.instructions)

        # Page body
        self.anomaly_detection_methods = Checkbar(
            self,
            picks=load_anomaly_detection_list(),
            editButtons=True,
            checkCallback=self.set_algorithm_checked)
        self.anomaly_detection_methods.place(relx=0.1,
                                             rely=0.35,
                                             height=400,
                                             width=700)

        # Page footer
        self.next_button = HoverButton(self, command=self.next_window)
        self.next_button.place(relx=0.813, rely=0.839, height=25, width=81)
        set_button_configuration(self.next_button, text='''Next''')

        self.back_button = HoverButton(
            self, command=lambda: controller.show_frame("NewModel"))
        self.back_button.place(relx=0.017, rely=0.839, height=25, width=81)
        set_button_configuration(self.back_button, text='''Back''')

        self.copyright = tk.Label(self)
        self.copyright.place(relx=0, rely=0.958, height=25, width=750)
        set_copyright_configuration(self.copyright)
    def __init__(self, parent=None, yaml_filename=None):
        """
        Parameters
        ----------

        parent : ParametersOptionsWindow
            The parent window which controls the current frame

        yaml_filename : str
            The file which suits a specific algorithm in order to construct the frame

        """

        tk.Frame.__init__(self, parent)
        self.parent = parent
        self.parameters = {}

        # Load all constant for a given algorithm
        self.parameters_lists = load_algorithm_constants(yaml_filename)
        self.parameters_lists_keys = list(self.parameters_lists.keys())

        # Set values for frame construction
        self.values_lists = []
        for key in self.parameters_lists_keys:
            self.values_lists.append(self.parameters_lists.get(key))

        # Pop keys of each list
        self.params_texts = self.values_lists.pop(0)
        self.params_keys = self.values_lists.pop(0)

        y_val = 0
        y_delta = 0.14

        index = 0

        # Create dynamic pairs of label and combo box for each algorithm param
        for param_description in self.params_texts:
            # Set generic param with suitable values according to suitable yaml file
            set_widget_for_param(frame=self,
                                 text=param_description,
                                 combobox_values=self.values_lists[index],
                                 param_key=self.params_keys[index],
                                 y_coordinate=y_val,
                                 filename=yaml_filename)
            y_val += y_delta
            index += 1

        # Side logo
        param_options_logo = CROSS_WINDOWS_SETTINGS.get('PARAMETERS_OPTIONS')
        param_options_photo_location = os.path.join(param_options_logo)
        global po_logo_img
        po_logo_img = tk.PhotoImage(file=param_options_photo_location)

        self.parameters_logo_png = tk.Button(self)
        self.parameters_logo_png.place(relx=0.75, rely=0.22, height=140, width=140)
        set_logo_configuration(self.parameters_logo_png, image=po_logo_img)
예제 #4
0
    def __init__(self, parent, controller):
        """
        Parameters
        ----------

        :param parent: window
        :param controller: GUI controller
        """

        tk.Frame.__init__(self, parent)

        # Page init
        self.controller = controller
        self.menubar = Menubar(controller)
        # Disables ability to tear menu bar into own window
        self.controller.option_add('*tearOff', 'FALSE')
        system_logo = CROSS_WINDOWS_SETTINGS.get('LOGO')
        comparison_logo = CROSS_WINDOWS_SETTINGS.get('RESULTS')
        photo_location = os.path.join(system_logo)
        comparison_location = os.path.join(comparison_logo)
        global logo_img, comparison_img
        logo_img = tk.PhotoImage(file=photo_location)
        comparison_img = tk.PhotoImage(file=comparison_location)

        # Page header
        self.logo_png = tk.Button(self)
        self.logo_png.place(relx=0.28, rely=0.029, height=172, width=300)
        set_logo_configuration(self.logo_png, image=logo_img)

        # Page body
        self.results_table = Table(self,
                                   columns=[
                                       "Metric", "Down attack", "Up attack",
                                       "Fore attack", "Random attack"
                                   ],
                                   header_anchor=CENTER,
                                   column_minwidths=[1, 1, 1],
                                   pady=2)
        self.results_table.pack(fill=X, padx=18, pady=182)

        self.comparison_png = tk.Button(self)
        self.comparison_png.place(relx=0.65, rely=0.7, height=150, width=145)
        set_logo_configuration(self.comparison_png, image=comparison_img)

        # Page footer
        self.back_button = HoverButton(self, command=self.back_window)
        self.back_button.place(relx=0.017, rely=0.839, height=25, width=81)
        set_button_configuration(self.back_button, text='''Back''')

        self.copyright = tk.Label(self)
        self.copyright.place(relx=0, rely=0.958, height=25, width=750)
        set_copyright_configuration(self.copyright)
    def __init__(self, parent, controller):
        """
        Parameters
        ----------

        :param parent: window
        :param controller: GUI controller
        """

        tk.Frame.__init__(self, parent)

        # Page init
        self.controller = controller
        self.menubar = Menubar(controller)
        # Disables ability to tear menu bar into own window
        self.controller.option_add('*tearOff', 'FALSE')
        system_logo = CROSS_WINDOWS_SETTINGS.get('LOGO')
        photo_location = os.path.join(system_logo)
        global logo_img
        logo_img = tk.PhotoImage(file=photo_location)

        # Page header
        self.logo_png = tk.Button(self)
        self.logo_png.place(relx=0.28, rely=0.029, height=172, width=300)
        set_logo_configuration(self.logo_png, image=logo_img)

        self.instructions = tk.Label(self)
        self.instructions.place(relx=0.015, rely=0.3, height=32, width=635)
        self.instructions.configure(
            text='''Please select your choice for parameters tuning:''')
        set_widget_to_left(self.instructions)

        # Page body
        self.reinitialize()

        # Page footer
        self.next_button = HoverButton(self, command=self.next_window)
        self.next_button.place(relx=0.813, rely=0.839, height=25, width=81)
        set_button_configuration(self.next_button, text='''Next''')

        self.back_button = HoverButton(self, command=self.back_window)
        self.back_button.place(relx=0.017, rely=0.839, height=25, width=81)
        set_button_configuration(self.back_button, text='''Back''')

        self.copyright = tk.Label(self)
        self.copyright.place(relx=0, rely=0.958, height=25, width=750)
        set_copyright_configuration(self.copyright)
    def __init__(self, parent, controller):
        """
        Parameters
        ----------

        :param parent: window
        :param controller: GUI controller
        """

        tk.Frame.__init__(self, parent)

        # Page init
        self.controller = controller
        self.menubar = Menubar(controller)
        # Disables ability to tear menu bar into own window
        self.controller.option_add('*tearOff', 'FALSE')
        system_logo = CROSS_WINDOWS_SETTINGS.get('LOGO')
        photo_location = os.path.join(system_logo)
        global logo_img
        logo_img = tk.PhotoImage(file=photo_location)

        # Page header
        self.logo_png = HoverButton(self)
        self.logo_png.place(relx=0.28, rely=0.029, height=172, width=300)
        set_logo_configuration(self.logo_png, image=logo_img)

        # Page body
        self.toggle_results_button = HoverButton(self,
                                                 command=self.toggle_results)
        self.toggle_results_button.place(relx=0.68,
                                         rely=0.5,
                                         height=25,
                                         width=81)
        set_button_configuration(self.toggle_results_button,
                                 text='''Show results''')

        # Page footer
        self.back_button = HoverButton(self, command=self.back_window)
        self.back_button.place(relx=0.017, rely=0.839, height=25, width=81)
        set_button_configuration(self.back_button, text='''Home page''')

        self.copyright = tk.Label(self)
        self.copyright.place(relx=0, rely=0.958, height=25, width=750)
        set_copyright_configuration(self.copyright)
예제 #7
0
    def stop_model_process(self):
        """
        Handle stop button click
        :return: freeze state
        """

        if self.event.isSet():  # check if the event flag is True or False
            self.event.clear()
            self.stop_button.configure(text='Resume')
            self.loading_gif.place_forget()
            self.stop_png.place(relx=0.385, rely=0.5, height=132, width=132)
            set_logo_configuration(self.stop_png, image=stop_img)
        else:
            self.event.set()
            self.stop_button.configure(text='Stop')
            self.stop_png.place_forget()
            self.loading_gif.place(relx=0.1, rely=0.35, height=330, width=600)

        self.start_time = timer() - self.prev_saved_time
        self.update_clock()
예제 #8
0
    def __init__(self, parent, controller):
        """
        Parameters
        ----------

        :param parent: window
        :param controller: GUI controller
        """

        tk.Frame.__init__(self, parent)

        # Page init
        self.controller = controller
        self.menubar = Menubar(controller)
        # Disables ability to tear menu bar into own window
        self.controller.option_add('*tearOff', 'FALSE')
        system_logo = CROSS_WINDOWS_SETTINGS.get('LOGO')
        photo_location = os.path.join(system_logo)
        global logo_img
        logo_img = tk.PhotoImage(file=photo_location)

        # Page header
        self.logo_png = tk.Button(self)
        self.logo_png.place(relx=0.28, rely=0.029, height=172, width=300)
        set_logo_configuration(self.logo_png, image=logo_img)

        self.instructions = tk.Label(self)
        self.instructions.place(relx=0.015, rely=0.3, height=32, width=635)
        self.instructions.configure(
            text='''Please choose both input and target features:''')
        set_widget_to_left(self.instructions)

        # Page body

        # initialize features columns options
        self.features_columns_options = {}
        self.features_columns_options = self.get_features_columns_options()

        self.csv_features = tk.StringVar()
        self.csv_features.set(self.features_columns_options)

        self.features_instructions = tk.Label(self)
        self.features_instructions.place(relx=0.05,
                                         rely=0.34,
                                         height=22,
                                         width=100)
        self.features_instructions.configure(text='''Input features:''')
        set_widget_to_left(self.features_instructions)

        self.features_listbox = tk.Listbox(
            self,
            font=tkfont.Font(size=9),
            listvariable=self.csv_features,
            selectmode=tk.MULTIPLE,
            exportselection=
            0,  # Fix : ComboBox clears unrelated ListBox selection
            width=120,
            height=180,
            bd=3,
            bg='antique white',
            selectbackground='sandy brown')
        self.features_listbox.place(relx=0.05,
                                    rely=0.42,
                                    height=230,
                                    width=140)

        self.target_instructions = tk.Label(self)
        self.target_instructions.place(relx=0.35,
                                       rely=0.34,
                                       height=22,
                                       width=100)
        self.target_instructions.configure(text='''Target features:''')
        set_widget_to_left(self.target_instructions)

        self.target_features_listbox = tk.Listbox(
            self,
            font=tkfont.Font(size=9),
            listvariable=self.csv_features,
            selectmode=tk.MULTIPLE,
            exportselection=0,
            # Fix : ComboBox clears unrelated ListBox selection
            width=120,
            height=180,
            bd=3,
            bg='antique white',
            selectbackground='sandy brown')
        self.target_features_listbox.place(relx=0.35,
                                           rely=0.42,
                                           height=230,
                                           width=140)

        # Side logo
        feature_selection_logo = CROSS_WINDOWS_SETTINGS.get(
            'FEATURE_SELECTION')
        feature_selection_photo_location = os.path.join(feature_selection_logo)
        global fs_logo_img
        fs_logo_img = tk.PhotoImage(file=feature_selection_photo_location)

        self.features_logo_png = tk.Button(self)
        self.features_logo_png.place(relx=0.6,
                                     rely=0.28,
                                     height=200,
                                     width=200)
        set_logo_configuration(self.features_logo_png, image=fs_logo_img)

        # Page footer
        self.next_button = HoverButton(self, command=self.next_window)
        self.next_button.place(relx=0.813, rely=0.839, height=25, width=81)
        set_button_configuration(self.next_button, text='''Next''')

        self.back_button = HoverButton(self, command=self.back_window)
        self.back_button.place(relx=0.017, rely=0.839, height=25, width=81)
        set_button_configuration(self.back_button, text='''Back''')

        self.copyright = tk.Label(self)
        self.copyright.place(relx=0, rely=0.958, height=25, width=750)
        set_copyright_configuration(self.copyright)
예제 #9
0
    def __init__(self, parent, controller):
        """
        Parameters
        ----------

        :param parent: window
        :param controller: GUI controller
        """

        tk.Frame.__init__(self, parent)

        # Page init
        self.controller = controller
        self.menubar = Menubar(controller)
        # Disables ability to tear menu bar into own window
        self.controller.option_add('*tearOff', 'FALSE')
        system_logo = CROSS_WINDOWS_SETTINGS.get('LOGO')
        photo_location = os.path.join(system_logo)
        global logo_img
        logo_img = tk.PhotoImage(file=photo_location)

        # Page header
        self.logo_png = tk.Button(self)
        self.logo_png.place(relx=0.28, rely=0.029, height=172, width=300)
        set_logo_configuration(self.logo_png, image=logo_img)

        self.instructions = tk.Label(self)
        self.instructions.place(relx=0.015, rely=0.3, height=32, width=635)
        self.instructions.configure(
            text=
            '''Please choose similarity functions from the following options.'''
        )
        set_widget_to_left(self.instructions)

        # Page body
        self.similarity_functions = Checkbar(
            self,
            load_similarity_list(),
            checkCallback=self.set_similarity_score)
        self.similarity_functions.place(relx=0.1,
                                        rely=0.36,
                                        height=400,
                                        width=700)

        self.save_model_var = tk.IntVar()
        self.save_model_check_button = tk.Checkbutton(
            self,
            text="Save model",
            variable=self.save_model_var,
            command=self.set_saving_model)

        self.note = tk.Label(self)
        self.note.place(relx=0.015, rely=0.7, height=32, width=635)
        self.note.configure(
            text=
            '''Note: Similarity function is used for calculating a score for each record''',
            font=Font(size=9, weight=BOLD))
        set_widget_to_left(self.note)

        # Page footer
        self.next_button = HoverButton(self, command=self.next_window)
        self.next_button.place(relx=0.813, rely=0.839, height=25, width=81)
        set_button_configuration(self.next_button, text='''Run''')

        self.back_button = HoverButton(self, command=self.back_window)
        self.back_button.place(relx=0.017, rely=0.839, height=25, width=81)
        set_button_configuration(self.back_button, text='''Back''')

        self.copyright = tk.Label(self)
        self.copyright.place(relx=0, rely=0.958, height=25, width=750)
        set_copyright_configuration(self.copyright)
예제 #10
0
    def __init__(self, parent, controller):
        """
        Parameters
        ----------

        :param parent: window
        :param controller: GUI controller
        """

        ttk.Frame.__init__(self, parent)

        # Page init
        self.controller = controller
        self.menubar = Menubar(controller)
        # Disables ability to tear menu bar into own window
        self.controller.option_add('*tearOff', 'FALSE')

        system_logo = CROSS_WINDOWS_SETTINGS.get('LOGO')
        bgu_logo = CROSS_WINDOWS_SETTINGS.get('BGU')
        israel_innovation_authority_logo = CROSS_WINDOWS_SETTINGS.get(
            'ISRAEL_INNOVATION_AUTHORITY')
        ministry_of_defense_logo = CROSS_WINDOWS_SETTINGS.get(
            'MINISTRY_OF_DEFENSE')
        mobilicom_logo = CROSS_WINDOWS_SETTINGS.get('MOBILICOM')

        photo_location = os.path.join(system_logo)
        bgu_location = os.path.join(bgu_logo)
        israel_innovation_authority_location = os.path.join(
            israel_innovation_authority_logo)
        ministry_of_defense_location = os.path.join(ministry_of_defense_logo)
        mobilicom_location = os.path.join(mobilicom_logo)

        global logo_img, bgu_img, israel_innovation_authority_img, ministry_of_defense_img, mobilicom_img

        logo_img = tk.PhotoImage(file=photo_location)
        bgu_img = tk.PhotoImage(file=bgu_location)
        israel_innovation_authority_img = tk.PhotoImage(
            file=israel_innovation_authority_location)
        ministry_of_defense_img = tk.PhotoImage(
            file=ministry_of_defense_location)
        mobilicom_img = tk.PhotoImage(file=mobilicom_location)

        self.controller.geometry("700x550")
        self.controller.minsize(700, 550)
        self.controller.maxsize(700, 550)
        self.controller.resizable(1, 1)
        self.controller.title("Anomaly Detection System")
        self.controller.configure(background="#eeeeee")

        # Page header
        self.logo_png = tk.Button(self)
        self.logo_png.place(relx=0.28, rely=0.029, height=172, width=300)
        set_logo_configuration(self.logo_png, image=logo_img)

        # Page body
        self.create_model_btn = HoverButton(self, command=self.new_flow)
        self.create_model_btn.place(relx=0.41, rely=0.35, height=42, width=120)
        set_button_configuration(self.create_model_btn,
                                 text='''Create model''')

        self.load_model_btn = HoverButton(self, command=self.load_flow)
        self.load_model_btn.place(relx=0.41, rely=0.52, height=42, width=120)
        set_button_configuration(self.load_model_btn, text='''Load model''')

        # self.tune_model_btn = HoverButton(self, command=self.tune_flow)
        # self.tune_model_btn.place(relx=0.395, rely=0.65, height=42, width=140)
        # set_button_configuration(self.tune_model_btn, text='''Tune model parameters''')

        self.bgu_png = tk.Button(self)
        self.bgu_png.place(relx=0, rely=0, height=35, width=186)
        set_logo_configuration(self.bgu_png, image=bgu_img)

        self.israel_innovation_authority_png = tk.Button(self)
        self.israel_innovation_authority_png.place(relx=0.04,
                                                   rely=0.78,
                                                   height=61,
                                                   width=200)
        set_logo_configuration(self.israel_innovation_authority_png,
                               image=israel_innovation_authority_img)

        self.ministry_of_defense_png = tk.Button(self)
        self.ministry_of_defense_png.place(relx=0.7,
                                           rely=0.67,
                                           height=119,
                                           width=136)
        set_logo_configuration(self.ministry_of_defense_png,
                               image=ministry_of_defense_img)

        self.mobilicom_png = tk.Button(self)
        self.mobilicom_png.place(relx=0.41, rely=0.75, height=116, width=116)
        set_logo_configuration(self.mobilicom_png, image=mobilicom_img)

        # Page footer
        self.copyright = tk.Label(self)
        self.copyright.place(relx=0, rely=0.958, height=25, width=750)
        set_copyright_configuration(self.copyright)
    def __init__(self, parent, controller):

        """
        Parameters
        ----------

        :param parent: window
        :param controller: GUI controller
        """

        tk.Frame.__init__(self, parent)

        # Page init
        self.controller = controller
        self.menubar = Menubar(controller)
        # Disables ability to tear menu bar into own window
        self.controller.option_add('*tearOff', 'FALSE')
        system_logo = CROSS_WINDOWS_SETTINGS.get('LOGO')
        photo_location = os.path.join(system_logo)
        global logo_img
        logo_img = tk.PhotoImage(file=photo_location)

        # Page header
        self.logo_png = tk.Button(self)
        self.logo_png.place(relx=0.28, rely=0.029, height=172, width=300)
        set_logo_configuration(self.logo_png, image=logo_img)

        self.instructions = tk.Label(self)
        self.instructions.place(relx=0.015, rely=0.3, height=32, width=635)
        self.instructions.configure(
            text='''Please insert input files for existing model.''')
        set_widget_to_left(self.instructions)

        # Page body

        # Testing input directory
        self.test_label = tk.Label(self)
        self.test_label.place(relx=0.015, rely=0.4, height=32, width=146)
        self.test_label.configure(text='''Test directory''')
        set_widget_to_left(self.test_label)

        self.test_input = tk.Entry(self)
        self.test_input.place(relx=0.195, rely=0.4, height=25, relwidth=0.624)

        self.test_btn = HoverButton(self, command=self.set_test_path)
        self.test_btn.place(relx=0.833, rely=0.4, height=25, width=60)
        set_button_configuration(self.test_btn, text='''Browse''')

        # Results output directory
        self.results_label = tk.Label(self)
        self.results_label.place(relx=0.015, rely=0.5, height=32, width=146)
        self.results_label.configure(text='''Results directory''')
        set_widget_to_left(self.results_label)

        self.results_input = tk.Entry(self)
        self.results_input.place(relx=0.195, rely=0.5, height=25, relwidth=0.624)

        self.results_btn = HoverButton(self, command=self.set_results_path)
        self.results_btn.place(relx=0.833, rely=0.5, height=25, width=60)
        set_button_configuration(self.results_btn, text='''Browse''')

        # Page footer
        self.next_button = HoverButton(self, command=self.next_window)
        self.next_button.place(relx=0.813, rely=0.839, height=25, width=81)
        set_button_configuration(self.next_button, text='''Next''')

        self.back_button = HoverButton(self, command=self.back_window)
        self.back_button.place(relx=0.017, rely=0.839, height=25, width=81)
        set_button_configuration(self.back_button, text='''Back''')

        self.copyright = tk.Label(self)
        self.copyright.place(relx=0, rely=0.958, height=25, width=750)
        set_copyright_configuration(self.copyright)
    def __init__(self, parent, controller):

        """
        Parameters
        ----------

        :param parent: window
        :param controller: GUI controller
        """

        tk.Frame.__init__(self, parent)

        # Page init
        self.controller = controller
        self.menubar = Menubar(controller)
        # Disables ability to tear menu bar into own window
        self.controller.option_add('*tearOff', 'FALSE')
        system_logo = CROSS_WINDOWS_SETTINGS.get('LOGO')
        photo_location = os.path.join(system_logo)
        global logo_img
        logo_img = tk.PhotoImage(file=photo_location)

        # Page header
        self.logo_png = tk.Button(self)
        self.logo_png.place(relx=0.28, rely=0.029, height=172, width=300)
        set_logo_configuration(self.logo_png, image=logo_img)

        self.instructions = tk.Label(self)
        self.instructions.place(relx=0.015, rely=0.3, height=32, width=635)
        self.instructions.configure(
            text='''Please insert paths for existing models.''')
        set_widget_to_left(self.instructions)

        # Page body
        self.algorithms = dict()
        self.browse_buttons = dict()
        self.input_entries = dict()

        # LSTM existing algorithm
        self.lstm_var = tk.IntVar()
        self.lstm_check_button = tk.Checkbutton(self)
        self.lstm_check_button.place(relx=0.015, rely=0.38, height=32, width=146)
        self.lstm_check_button.configure(text="LSTM",
                                         variable=self.lstm_var,
                                         command=lambda: self.set_input_entry("LSTM", self.lstm_var.get()))
        set_widget_to_left(self.lstm_check_button)

        self.lstm_input = tk.Entry(self)
        self.lstm_input.place(relx=0.195, rely=0.38, height=25, relwidth=0.624)
        self.lstm_input.configure(state='disabled')

        self.lstm_btn = HoverButton(self, command=lambda: self.set_algorithm_path("LSTM"))
        self.lstm_btn.place(relx=0.833, rely=0.38, height=25, width=60)
        self.lstm_btn.configure(state='disabled')
        set_button_configuration(self.lstm_btn, text='''Browse''')

        self.browse_buttons["LSTM"] = self.lstm_btn
        self.input_entries["LSTM"] = self.lstm_input

        # SVR existing algorithm
        self.svr_var = tk.IntVar()
        self.svr_check_button = tk.Checkbutton(self)
        self.svr_check_button.place(relx=0.015, rely=0.47, height=32, width=146)
        self.svr_check_button.configure(text="SVR",
                                        variable=self.svr_var,
                                        command=lambda: self.set_input_entry("SVR", self.svr_var.get()))
        set_widget_to_left(self.svr_check_button)

        self.svr_input = tk.Entry(self)
        self.svr_input.place(relx=0.195, rely=0.47, height=25, relwidth=0.624)
        self.svr_input.configure(state='disabled')

        self.svr_btn = HoverButton(self, command=lambda: self.set_algorithm_path("SVR"))
        self.svr_btn.place(relx=0.833, rely=0.47, height=25, width=60)
        self.svr_btn.configure(state='disabled')
        set_button_configuration(self.svr_btn, text='''Browse''')

        self.browse_buttons["SVR"] = self.svr_btn
        self.input_entries["SVR"] = self.svr_input

        # MLP existing algorithm
        self.mlp_var = tk.IntVar()
        self.mlp_check_button = tk.Checkbutton(self)
        self.mlp_check_button.place(relx=0.015, rely=0.56, height=32, width=146)
        self.mlp_check_button.configure(text="MLP",
                                        variable=self.mlp_var,
                                        command=lambda: self.set_input_entry("MLP",
                                                                             self.mlp_var.get()))
        set_widget_to_left(self.mlp_check_button)

        self.mlp_input = tk.Entry(self)
        self.mlp_input.place(relx=0.195, rely=0.56, height=25, relwidth=0.624)
        self.mlp_input.configure(state='disabled')

        self.mlp_btn = HoverButton(self, command=lambda: self.set_algorithm_path("MLP"))
        self.mlp_btn.place(relx=0.833, rely=0.56, height=25, width=60)
        self.mlp_btn.configure(state='disabled')
        set_button_configuration(self.mlp_btn, text='''Browse''')

        self.browse_buttons["MLP"] = self.mlp_btn
        self.input_entries["MLP"] = self.mlp_input

        # Random Forest existing algorithm
        self.random_forest_var = tk.IntVar()
        self.random_forest_check_button = tk.Checkbutton(self)
        self.random_forest_check_button.place(relx=0.015, rely=0.65, height=32, width=146)
        self.random_forest_check_button.configure(text="Random Forest",
                                                  variable=self.random_forest_var,
                                                  command=lambda: self.set_input_entry("Random Forest",
                                                                                       self.random_forest_var.get()))
        set_widget_to_left(self.random_forest_check_button)

        self.random_forest_input = tk.Entry(self)
        self.random_forest_input.place(relx=0.195, rely=0.65, height=25, relwidth=0.624)
        self.random_forest_input.configure(state='disabled')

        self.random_forest_btn = HoverButton(self, command=lambda: self.set_algorithm_path("Random Forest"))
        self.random_forest_btn.place(relx=0.833, rely=0.65, height=25, width=60)
        self.random_forest_btn.configure(state='disabled')
        set_button_configuration(self.random_forest_btn, text='''Browse''')

        self.browse_buttons["Random Forest"] = self.random_forest_btn
        self.input_entries["Random Forest"] = self.random_forest_input

        # Page footer
        self.next_button = HoverButton(self, command=self.next_window)
        self.next_button.place(relx=0.813, rely=0.839, height=25, width=81)
        set_button_configuration(self.next_button, text='''Next''')

        self.back_button = HoverButton(self, command=self.back_window)
        self.back_button.place(relx=0.017, rely=0.839, height=25, width=81)
        set_button_configuration(self.back_button, text='''Back''')

        self.copyright = tk.Label(self)
        self.copyright.place(relx=0, rely=0.958, height=25, width=750)
        set_copyright_configuration(self.copyright)
예제 #13
0
    def __init__(self, parent, controller):
        """
        Parameters
        ----------

        :param parent: window
        :param controller: GUI controller
        """

        tk.Frame.__init__(self, parent)

        # Page init
        self.controller = controller
        self.menubar = Menubar(controller)
        # Disables ability to tear menu bar into own window
        self.controller.option_add('*tearOff', 'FALSE')
        system_logo = CROSS_WINDOWS_SETTINGS.get('LOGO')
        photo_location = os.path.join(system_logo)
        global logo_img
        logo_img = tk.PhotoImage(file=photo_location)

        # Page header
        self.logo_png = tk.Button(self)
        self.logo_png.place(relx=0.28, rely=0.029, height=172, width=300)
        set_logo_configuration(self.logo_png, image=logo_img)

        self.instructions = tk.Label(self)
        self.instructions.place(relx=0.015, rely=0.3, height=32, width=635)
        self.instructions.configure(
            text=
            '''Please select the values for each of the following parameters:'''
        )
        set_widget_to_left(self.instructions)

        # Page body

        # Dynamic algorithm options
        self.algorithms_files = load_anomaly_detection_list()
        self.current_algorithm = self.controller.get_current_algorithm_to_edit(
        )
        self.current_yaml = self.set_suitable_yaml_file(self.current_algorithm)

        self.height_options_frame = 268
        self.width_options_frame = 620

        self.options_to_show = AlgorithmFrameOptions(
            self, yaml_filename=self.current_yaml)
        self.options_to_show.place(relx=0.05,
                                   rely=0.35,
                                   height=self.height_options_frame,
                                   width=self.width_options_frame)

        # Page footer
        self.next_button = HoverButton(self, command=self.handle_next_button)
        self.next_button.place(relx=0.813, rely=0.839, height=25, width=81)
        set_button_configuration(self.next_button, text='''Save''')

        self.back_button = HoverButton(
            self,
            command=lambda: self.controller.show_frame("AlgorithmsWindow"))
        self.back_button.place(relx=0.017, rely=0.839, height=25, width=81)
        set_button_configuration(self.back_button, text='''Cancel''')

        self.copyright = tk.Label(self)
        self.copyright.place(relx=0, rely=0.958, height=25, width=750)
        set_copyright_configuration(self.copyright)