Beispiel #1
0
    def __init__(self, root=None, width=0.6, height=0.75, size=10,
                 use_factor=True):
        self.__root = root
        Frame.__init__(self, self.__root)
        # MainWindow size
        w, h, x, y = get_geometry(self, width, height, use_factor)

        self.__root.geometry('%dx%d+%d+%d' % (w, h, x, y))
        self.__root.minsize(int(w), int(h))
        self.lift()

        # select frame
        self.__test_select_frame = TestSelectFrame(self)
        self.__test_select_frame.pack(fill=BOTH, anchor=NW, expand=YES,
                                      padx=5, pady=5)

        # comment label
        comment_label = Label(self, text=COMMENT_LABEL,
                              font=(FONT_NAME, size-2, BOLD))
        comment_label.pack(anchor=NE, padx=5, pady=0)

        # console
        self.__console = ScrolledText(self, font=(CONSOLE_FONT_NAME, size),
                                      height=1)
        self.__console.configure(state=DISABLED)
        self.__console.pack(fill=BOTH, anchor=NW, expand=YES, padx=5, pady=5)

        # Progressbar
        self.__pg_bar = ttk.Progressbar(self, orient=HORIZONTAL,
                                        mode=DETERMINATE)
        self.__pg_bar.configure(maximum=100, value=0)
        self.__pg_bar.pack(anchor=SE, padx=5, pady=5)

        self.__root.title(TOOL_NAME)

        self.pack(side=TOP, fill=BOTH, expand=YES)

        self.__main_menu = MainMenu(self.__root)
        self.__root.configure(menu=self.__main_menu)

        # Console output color
        self.__console.tag_configure(INFO, foreground=BLACK,
                                     font=(CONSOLE_FONT_NAME, size))
        self.__console.tag_configure(WARN, foreground=GOLDENROD,
                                     font=(CONSOLE_FONT_NAME, size))
        self.__console.tag_configure(ERROR, foreground=RED,
                                     font=(CONSOLE_FONT_NAME, size, BOLD))

        self.is_running = False
        self.__root.protocol(WM_DELETE_WINDOW, self.__close)

        self.__user = TOOL_NAME
Beispiel #2
0
    def __init__(self,
                 master=None,
                 view_mode=False,
                 select_mode=EXTENDED,
                 width=0.2,
                 height=0.45,
                 size=10,
                 use_factor=True):

        Toplevel.__init__(self, master=master)

        w, h, x, y = get_geometry(self, width, height, use_factor)

        self.geometry('%dx%d+%d+%d' % (w, h, x, y))
        # self.minsize(int(w), int(h))
        # self.maxsize(int(w), int(h))

        # EnvSetup List
        self.__env_setup_frame = EnvListFrame(self,
                                              select_mode=select_mode,
                                              size=size)

        # Pack widget
        self.__env_setup_frame.pack(fill=BOTH, anchor=NW, expand=YES, side=TOP)

        if not view_mode:
            # Select Check event
            self.__env_setup_frame.bind_treeview(TREE_VIEW_SELECT_EVENT,
                                                 self.__check_select)
            # Button
            self.__ok_btn = Button(self,
                                   text=OK,
                                   width=6,
                                   command=self.__select_ok)
            self.__ok_btn.configure(state=DISABLED)

            self.__cancel_btn = Button(self,
                                       text=CANCEL,
                                       width=6,
                                       command=self.__select_cancel)

            self.__cancel_btn.pack(anchor=NE, side=RIGHT, padx=5, pady=5)
            self.__ok_btn.pack(anchor=NE, side=RIGHT, padx=5, pady=5)

        self.__env_setup_id = []
Beispiel #3
0
    def __view_conf(self):
        try:
            with open(self.conf_path, encoding=UTF8) as rs:
                j_data = json.load(rs)

        except json.JSONDecodeError:
            return

        msg_wizard = Toplevel(master=self.master)

        w, h, x, y = get_geometry(msg_wizard, 0.5, 0.35)

        msg_wizard.geometry('%dx%d+%d+%d' % (w, h, x, y))
        msg_wizard.minsize(int(w), int(h))

        viewer = ScrolledText(msg_wizard, font=(FONT_NAME, 15), height=1)
        viewer.insert(END, json.dumps(j_data, indent=2))
        viewer.configure(state=DISABLED)
        viewer.pack(fill=BOTH, anchor=NW, expand=YES, padx=5, pady=5)

        self.__viewing = True
        show_wizard(msg_wizard, 'Configuration(%s)' % self.conf_path)
        self.__viewing = False
Beispiel #4
0
    def __init__(self, root=None, width=0.3, height=0.2, use_factor=True):
        self.root = root

        Frame.__init__(self, self.root)

        # size
        w, h, x, y = get_geometry(self, width, height, use_factor)

        self.root.geometry('%dx%d+%d+%d' % (w, h, x, y))

        self.root.overrideredirect(True)
        self.lift()

        self.config(bg=SP_SCREEN_COLOR)

        # Title Label
        title = Label(self, text=TOOL_NAME)
        title.config(bg=SP_SCREEN_COLOR,
                     justify=CENTER,
                     font=(FONT_NAME, int(w / 10), BOLD))
        title.pack(side=TOP, fill=BOTH, expand=YES, pady=int(w / 35))

        # Progressbar
        self.pg_bar = ttk.Progressbar(self,
                                      orient=HORIZONTAL,
                                      mode=DETERMINATE,
                                      length=w)
        self.pg_bar.pack(side=BOTTOM, anchor=SW, expand=YES)

        # copyright
        copy_right = Label(self, text=COPY_RIGHT)
        copy_right.config(bg=SP_SCREEN_COLOR,
                          justify=LEFT,
                          font=(FONT_NAME, int(w / 50)))
        copy_right.pack(side=BOTTOM, anchor=SW, expand=YES, padx=5)

        self.pack(side=TOP, fill=BOTH, expand=YES)
Beispiel #5
0
    def __init__(self,
                 master=None,
                 conf_path='',
                 width=0.35,
                 height=0.1,
                 use_factor=True):

        Toplevel.__init__(self, master=master)

        w, h, x, y = get_geometry(self, width, height, use_factor)

        self.geometry('%dx%d+%d+%d' % (w, h, x, y))

        self.grid_rowconfigure(0, weight=1)
        self.grid_columnconfigure(0, weight=1)

        self.minsize(int(w), int(h))
        self.maxsize(int(w), int(h))

        # Top Frame
        self.__start_frame = Frame(self)
        # Description og the configuration file
        for msg in SELECT_CONF_LABEL.splitlines(False):
            label = Label(self.__start_frame, text=msg)
            label.config(font=(FONT_NAME, int(w / 50)))
            # Deploy
            label.pack(anchor=NW, side=TOP, padx=5)

        # Buttons
        next_btn = Button(self.__start_frame,
                          text=NEXT,
                          width=6,
                          command=self.__next_frame)

        top_run_btn = Button(self.__start_frame,
                             text=RUN,
                             width=6,
                             command=self.__run)

        top_cancel_btn = Button(self.__start_frame,
                                text=CANCEL,
                                width=6,
                                command=self.__cancel)

        # Deploy
        top_cancel_btn.pack(anchor=NE, side=RIGHT, padx=5, pady=3)
        top_run_btn.pack(anchor=NE, side=RIGHT, padx=5, pady=3)
        next_btn.pack(anchor=NE, side=RIGHT, padx=5, pady=3)

        # Selection Frame
        self.__conf_select_frame = Frame(self)
        # Description
        select_title_label = Label(self.__conf_select_frame,
                                   text=SELECT_USE_CONF_LABEL)
        select_title_label.config(font=(FONT_NAME, int(w / 50)))
        select_title_label.pack(anchor=NW, side=TOP, padx=5, pady=5)

        # Conf entry
        entry_frame = Frame(self.__conf_select_frame)
        self.__conf_path_var = StringVar()
        self.__conf_path_var.set(conf_path)
        self.__save_path = conf_path
        conf_entry = Entry(entry_frame, textvariable=self.__conf_path_var)
        conf_entry.config(font=(FONT_NAME, int(w / 50)))
        conf_entry.bind(KEY_RELEASE_EVENT, self.__on_change)

        refer_btn = Button(entry_frame,
                           text=SELECT,
                           width=6,
                           command=self.__select_conf)

        # Deploy
        refer_btn.pack(side=RIGHT, padx=5, pady=5)
        conf_entry.pack(side=RIGHT, fill=X, expand=YES, padx=5, pady=5)

        entry_frame.pack(side=TOP, fill=X)

        # Buttons
        prev_btn = Button(self.__conf_select_frame,
                          text=PREV,
                          width=6,
                          command=self.__prev_frame)
        select_cancel_btn = Button(self.__conf_select_frame,
                                   text=CANCEL,
                                   width=6,
                                   command=self.__cancel)
        self.__select_run_btn = Button(self.__conf_select_frame,
                                       text=RUN,
                                       width=6,
                                       command=self.__run)
        self.__view_btn = Button(self.__conf_select_frame,
                                 text=VIEW,
                                 width=6,
                                 command=self.__view_conf)

        # Deploy
        select_cancel_btn.pack(anchor=NE, side=RIGHT, padx=5, pady=3)
        self.__select_run_btn.pack(anchor=NE, side=RIGHT, padx=5, pady=3)
        self.__view_btn.pack(anchor=NE, side=RIGHT, padx=5, pady=3)
        if not conf_path:
            prev_btn.pack(anchor=NE, side=RIGHT, padx=5, pady=3)

        # Deploy
        frame = Frame(self.__conf_select_frame)
        self.__start_frame.grid(row=0, column=0, sticky=NSEW)
        frame.pack()
        self.__conf_select_frame.grid(row=0, column=0, sticky=NSEW)

        self.__is_run = False
        self.__viewing = False

        # If it has already been selected, a selection frame is displayed
        self.__check_conf_path()
        if not conf_path:
            self.__start_frame.tkraise()
        else:
            self.__conf_select_frame.tkraise()

        self.protocol(WM_DELETE_WINDOW, self.__close)
Beispiel #6
0
    def __init__(self,
                 master=None,
                 list_frame=None,
                 item_id=None,
                 select_mode=EXTENDED,
                 width=0.45,
                 height=0.45,
                 size=10,
                 use_factor=True):

        Toplevel.__init__(self, master=master)

        w, h, x, y = get_geometry(self, width, height, use_factor)

        self.geometry('%dx%d+%d+%d' % (w, h, x, y))

        self.list_frame = list_frame
        self.item_id = item_id

        if isinstance(self.list_frame, TestFuncListFrame):
            # select Verification script
            identifier = self.list_frame.get_item_value(self.item_id, 0)
            self.__script = TestFuncInfo.get_data(identifier)
        elif isinstance(self.list_frame, ModelScriptListFrame):
            # select Model script
            identifier = self.list_frame.get_item_value(self.item_id, 0)
            self.__script = ModelScriptInfo.get_data(identifier)
        elif isinstance(self.list_frame, DataScriptListFrame):
            # select Data script
            identifier = self.list_frame.get_item_value(self.item_id, 0)
            self.__script = DataScriptInfo.get_data(identifier)
        else:
            return

        # Linked env id
        self.__linked_env = [
            item for item in EnvSetupInfo.data_values()
            if item.id in self.__script.env_id
        ]

        # Non-linked env id
        self.__non_linked_env = [
            item for item in EnvSetupInfo.data_values()
            if item.id not in self.__script.env_id
        ]

        # Linked Env list Frame
        linked_frame = Frame(self)
        self.__linked_env_list_frame = EnvListFrame(linked_frame,
                                                    LINKED_ENV,
                                                    self.__linked_env,
                                                    select_mode=select_mode,
                                                    size=size)
        # Delete button select command
        self.__del_btn = Button(linked_frame,
                                text=DEL,
                                width=6,
                                command=self.__del_env)

        self.__linked_env_list_frame.pack(fill=BOTH,
                                          anchor=NW,
                                          expand=YES,
                                          side=TOP)
        self.__del_btn.pack(anchor=NE, side=RIGHT, padx=5, pady=3)

        # Non-linked Env list Frame
        non_linked_frame = Frame(self)
        self.__non_linked_env_list_frame = EnvListFrame(
            non_linked_frame,
            NON_LINKED_ENV,
            self.__non_linked_env,
            select_mode=select_mode,
            size=size)
        # Add button select command
        self.__add_btn = Button(non_linked_frame,
                                text=ADD,
                                width=6,
                                command=self.__add_env)

        self.__non_linked_env_list_frame.pack(fill=BOTH,
                                              anchor=NW,
                                              expand=YES,
                                              side=TOP)
        self.__add_btn.pack(anchor=NE, side=RIGHT, padx=5, pady=3)

        linked_frame.pack(fill=BOTH, expand=YES, side=LEFT)
        non_linked_frame.pack(fill=BOTH, expand=YES, side=LEFT)

        if len(self.__linked_env) == 1:
            self.__del_btn.configure(state=DISABLED)