def __init__(self, root, gui, status=None): PopUp.__init__(self, root, gui, "Tests finished.", "Done running tests.") report_button = tk.Button(self.buttons_frame, text="Report".center(BT_TXT_LEN), command=self.report, compound="left", image=self.gui.button_img["report"], state="disable") report_button.pack(side="left") Tooltip(report_button, text="Open generated report") self.gui.buttons_refs["report"].append(report_button) close_button = tk.Button(self.buttons_frame, text="Quit".center(BT_TXT_LEN), command=self.quit, compound="left", image=self.gui.button_img["quit"]) close_button.pack(side="left") Tooltip(close_button, text="Close GUI") self.ok_button.config(text=" Ok ") self.show_statuses()
def __init__(self, root, gui, status=None): PopUp.__init__(self, root, gui, "Tests paused.", "Tests execution\nhas been paused.") play_button = tk.Button(self.buttons_frame, text="Play".center(BT_TXT_LEN), command=self.play, compound="left", image=self.gui.button_img["play"]) play_button.pack(side="left") Tooltip(play_button, text="Start or resume testing") self.gui.buttons_refs["play"].append(play_button) stop_button = tk.Button(self.buttons_frame, text="Abort".center(BT_TXT_LEN), command=self.abort, compound="left", image=self.gui.button_img["stop"]) stop_button.pack(side="left") Tooltip(stop_button, text="Abort testing\nNo report generated") self.gui.buttons_refs["stop"].append(stop_button) self.ok_button.config(text="Ok".center(BT_TXT_LEN)) self.show_statuses()
def __init__(self, root, gui, status=None): super(EndTestsPopUp, self).__init__(root, gui, "Tests finished.", "Done running tests.") report_button = tk.Button( self.buttons_frame, text="Report".center(BT_TXT_LEN), command=self.report, compound="left", image=self.gui.button_img["report"], ) report_button.pack(side="left") Tooltip(report_button, text="Open generated report") if self.gui.report_path is None: report_button["state"] = "disable" close_button = tk.Button( self.buttons_frame, text="Quit".center(BT_TXT_LEN), command=self.quit, compound="left", image=self.gui.button_img["quit"], ) close_button.pack(side="left") Tooltip(close_button, text="Close GUI") self.ok_button.config(text=" Ok ") self.show_statuses()
def __init__(self, root, gui, title, message, width=None, height=None, centered=True): self.root = root self.gui = gui self.top = tk.Toplevel() self.top.title(title) # set window icon self.root.tk.call('wm', 'iconphoto', self.top._w, self.gui.favicon) # display text self.text_frame = tk.Frame(self.top) self.text_frame.pack(fill="both", expand=1) tk.Label(self.text_frame).pack() # mock label for space msg = tk.Label(self.text_frame, text=message) #, wraplength=width*0.9) msg.pack(fill="x", expand=1, padx=PADDING_X_LABEL) tk.Label(self.text_frame).pack() # mock label for space # prepare for status self.status_frame = tk.Frame(self.top) # self.status_frame.pack(fill="both", expand=1) self.status_frame.pack(expand=1) # display buttons self.footer_frame = tk.Frame(self.top) self.footer_frame.pack(side="bottom", fill="both") self.buttons_frame = tk.Frame(self.footer_frame) self.buttons_frame.pack() self.ok_button = tk.Button(self.buttons_frame, text="Ok".center(BT_TXT_LEN), command=self.top.destroy, compound="left", image=self.gui.button_img["ok"]) self.ok_button.pack(side="left") Tooltip(self.ok_button, text="Close PopUp") # place window # self.top.minsize(200, 140) top_x = self.top.winfo_rootx() if centered: root_x = self.root.winfo_rootx() root_y = self.root.winfo_rooty() root_h = self.root.winfo_height() root_w = self.root.winfo_width() position = "+%d+%d" % (root_x + root_w / 2 - top_x / 2, root_y + root_h / 3) self.top.geometry(position)
def __init__(self, master, suite, configs, naming, update_queue, request_queue, file_validation): # initialise attributes self.master = master self.suite = suite self.configs = copy.deepcopy(configs) self.naming = naming self.subtests_ref = dict() self.update_queue = update_queue self.request_queue = request_queue self.current_test_id = None self.current_test_retrying = False self.playing = False # tests are currently running (dactivate play action) self.finished = True # discriminate between start and resume for play button self.buttons_refs = { "play": [], "pause": [], "stop": [], "report": [], } self.report_software = "evince" self.report_path = None # set title and main window size self.master.title("WeTest GUI") self.master.geometry(str(WIN_X) + "x" + str(WIN_Y)) # window icon self.favicon = ImageTk.PhotoImage( Image.open( resource_filename("wetest", "resources/logo/wetest-icon.png"))), self.master.tk.call('wm', 'iconphoto', self.master._w, self.favicon) # debug window if DEBUG_QUEUE: self.debugQueue = QueueDebug() # extract suite title suite_title = self.configs.pop(0)["name"] logger.debug("file_validation %s", file_validation) warning = [x.rstrip() for x in file_validation] display_warning = False for line in warning: if not line.startswith("Validation of YAML s"): display_warning = True break if not display_warning: warning = None # generate suite frame self.suite_frame = tk.Frame(self.master) self.suite_frame.pack(side="top", fill="both", expand=True) if suite_title is not None: self.suite_gui = Suite(self.suite_frame, self.subtests_ref, naming=self.naming, title=suite_title, warning=warning) else: self.suite_gui = Suite(self.suite_frame, self.subtests_ref, naming=self.naming, warning=warning) # check same number of scenarios configs and scenario in tests_info if self.suite is None: self.test_infos = {} else: self.test_infos = reorganise_subtests(self.suite.tests_infos) if len(self.test_infos) != len(self.configs): logger.info( "Not the same number of configs(%d) and scenarios(%d)" % (len(self.configs), len(self.test_infos))) # add scenario, tests and subtests for sc_id, sc_config in enumerate(self.configs): sc = self.suite_gui.add_scenario(config=sc_config) if sc_id not in self.test_infos: sc.add_traceback("UNEXPECTED", "", "No tests in this scenario.") for test_id in sorted(self.test_infos.get(sc_id, [])): test_title = value_from_subtest("test_title", self.test_infos, sc_id, test_id) test_desc = [ value_from_subtest("test_message", self.test_infos, sc_id, test_id) ] if test_desc[0] is None: test_desc.pop(0) test = sc.add_test(test_title, test_desc) for st_id in sorted(self.test_infos[sc_id][test_id], key=file_order_sort): subtest_title = value_from_subtest("desc", self.test_infos, sc_id, test_id, st_id) test.add_subtest(st_id, subtest_title, self.test_infos[sc_id][test_id][st_id]) # if only one scenario for expand it if len(self.configs) == 1: sc.tests_expand() sc.bind_title_frame("<Button-1>", sc.subtests_click) sc.toogle_label.config(state="disable") # Add play/pause and stop buttons self.footer_frame = tk.Frame(self.master, borderwidth=1, relief="raised") self.footer_frame.pack(side="bottom", fill="both") self.buttons_frame = tk.Frame(self.footer_frame) self.buttons_frame.pack() self.button_img = { "play": ImageTk.PhotoImage( Image.open( resource_filename( "wetest", "resources/icons/iconmonstr-media-control-48-24.png")) ), "pause": ImageTk.PhotoImage( Image.open( resource_filename( "wetest", "resources/icons/iconmonstr-media-control-49-24.png")) ), "stop": ImageTk.PhotoImage( Image.open( resource_filename( "wetest", "resources/icons/iconmonstr-media-control-50-24.png")) ), "report": ImageTk.PhotoImage( Image.open( resource_filename( "wetest", "resources/icons/iconmonstr-clipboard-6-24.png"))), "quit": ImageTk.PhotoImage( Image.open( resource_filename( "wetest", "resources/icons/iconmonstr-log-out-7-24.png"))), "ok": ImageTk.PhotoImage( Image.open( resource_filename( "wetest", "resources/icons/iconmonstr-speech-bubble-35-24.png")) ), } self.button_gif = { "processing": ImageGif( self.master, resource_filename( "wetest", "resources/icons/iconmonstr-time-15-24.gif")), } play_button = tk.Button(self.buttons_frame, text="Play".center(BT_TXT_LEN), command=self.play, compound="left", image=self.button_img["play"]) Tooltip(play_button, text="Start or resume testing") play_button.pack(side="left") self.buttons_refs["play"].append(play_button) pause_button = tk.Button(self.buttons_frame, text="Pause".center(BT_TXT_LEN), command=self.pause, compound="left", image=self.button_img["pause"], state="disable") pause_button.pack(side="left") Tooltip(pause_button, text="Pause testing") self.buttons_refs["pause"].append(pause_button) stop_button = tk.Button(self.buttons_frame, text="Abort".center(BT_TXT_LEN), command=self.abort, compound="left", image=self.button_img["stop"], state="disable") stop_button.pack(side="left") Tooltip(stop_button, text="Abort testing\nNo report generated") self.buttons_refs["stop"].append(stop_button) report_button = tk.Button(self.buttons_frame, text="Report".center(BT_TXT_LEN), command=self.report, compound="left", image=self.button_img["report"], state="disable") report_button.pack(side="left") Tooltip(report_button, text="Open generated report") self.buttons_refs["report"].append(report_button) close_button = tk.Button(self.buttons_frame, text="Quit".center(BT_TXT_LEN), command=self.quit, compound="left", image=self.button_img["quit"], state="normal") close_button.pack(side="left") Tooltip(close_button, text="Abort testing\nNo report generated\nClose GUI") # if no tests disable play button and enlarge PV frame if self.suite is None: self.disable("play") self.suite_gui.toogle_pvs(show=True) # run update function self.update_status()