Best Python code snippet using devtools-proxy_python
boom_view.py
Source:boom_view.py
...68 QtGui.QTableWidgetItem(str(it.price) + u' â¬'))69 self.table.item(i, 0).setTextAlignment(Qt.AlignLeft)70 self.table.item(i, 1).setTextAlignment(Qt.AlignRight)71 self.total.setText('Summe: ' + str(tab.calc_total()) + u' â¬')72 def update_tab(self):73 """Method called if current_tab changed."""74 if controller.current_tab:75 self.render_tab(controller.current_tab)76 def selection_changed(self, sel):77 """Handler if selection in table changes, updates subtotal"""78 rows = self.table.selectionModel().selectedRows()79 tab = controller.current_tab80 sel = [tab.tab[i.row()] for i in rows]81 sub_total = (tab.calc_subtotal(sel))82 self.sub_total.setText('Teilsumme: ' + str(sub_total) + u' â¬')83 def paybut_clicked(self):84 """85 Calls msg-box if payment is made, if so process payment and86 deletes tab....
Writer.py
Source:Writer.py
...95 self.append_file.close()96 def clear(self):97 with open(self.file_path, "w") as f:98 f.write("")99 def update_tab(self, amount=0):100 self.tab = amount101 self.tab_str = " " * 4 * amount102 def comment(self, text: str):103 self.write("# " + text + "\n")104 def blank(self, amount: int = 1):105 self.write("\n" * amount)106 @staticmethod107 def deter_type(string):108 try:109 value = eval(string)110 type_ = type(value).__name__111 return type_, string112 except NameError:113 return None, string114 """115 @staticmethod116 def safe_deter_type(string):117 value = string118 if any([(a in string) for a in "+,-,*,/,//,%".split(",")]):119 return 'float', value120 if '.' in string:121 if string.replace('.', '', 1).replace('-', '', 1).isdigit():122 value = float(string)123 return 'float', value124 try:125 value = int(string)126 return 'int', value127 except ValueError:128 pass129 if string in ["True", "False"] or any([a in string for a in ">,<,>=,<=,==,and,or".split(",")]):130 return 'bool', value131 return 'str', value132 133 """134 def write(self, string, no_tab=False):135 ts = self.tab_str if not no_tab else ""136 self.f.write(ts + string)137 def print_(self, *args, end=None, sep=' ', write=True):138 thing = ', '.join(args)139 p = f"print({thing}" + str(f", end={end}" if end is not None else "") + str(140 f", sep={sep}" if sep != ' ' else "") + ")\n"141 if write:142 self.write(p)143 return p144 def end_tab(self):145 self.update_tab(self.tab - 1)146 def if_(self, statement):147 self.write(f'if {statement}:\n')148 self.update_tab(self.tab + 1)149 def while_(self, statement):150 self.write(f'while {statement}:\n')151 self.update_tab(self.tab + 1)152 def functions(self, name, *args):153 arguments = ", ".join(args)154 self.write(f'def {name}({arguments}):\n')155 self.update_tab(self.tab + 1)156 def return_(self, output):157 self.write(f'return {output}\n')158 def callFunction(self, name, *args):159 arguments = ", ".join(args)160 self.write(f'{name}({arguments})')161 # str, int, float, bool - 4 var types, automatically, its string162 # always accepts strings as input, even if its a int or a boolean163 # var_value must be in '"2"' form if string form when input!164 def assign_var(self, var_name, var_value):165 type_, value = self.deter_type(var_value)...
main.py
Source:main.py
1# Import module2from tkinter import Button, Canvas, Frame, PhotoImage, Tk, ttk3from tkinter.constants import BOTH, CENTER, NSEW, NW, SOLID, TOP, W4from tkinter.ttk import Notebook5from tkinter.font import BOLD, Font6from selenium import webdriver7from Enums.GuidParameter import GuidParameter8from Guid_elements.BottomFrame import BottomFrame9from Guid_elements.LeftFrame import LeftFrame10from Guid_elements.MiddleFrame import MiddleFrame11from Guid_elements.TopFrame import TopFrame12def openbrowser():13 webdriver.Firefox().get("http://localhost:8080/cstlmonthlyticketreportview/home")14# The master root15root = Tk()16root.title("CSTL-WHD")17# The notebook(<root)18notebook = Notebook(root, padding=0)19# Style20style = ttk.Style()21style.theme_create("MyStyle", parent="alt", settings={22 "TNotebook": {"configure": {"tabmargins": [0,0,0,0], "background": GuidParameter.BLACK} },23 "TNotebook.Tab": {"configure": {"padding": [10, 10], "background": GuidParameter.PINK_RED, "foreground": GuidParameter.WHITE, "font": ("Helvetica", 12), "shape": "rectangle"}}})24style.theme_use("MyStyle")25# Tabs (<notebook)26update_tab = Frame(notebook)27view_tab = Frame(notebook)28web_tab = Frame(notebook)29notebook.add(update_tab, text='Update')30notebook.add(view_tab, text = 'View')31notebook.add(web_tab, text="Web")32notebook.pack(expand = 1, fill = BOTH)33# UPDATE TAB:34update_tab_top_frame = TopFrame(update_tab)35update_tab_bottom_frame = BottomFrame(update_tab)36update_tab_left_frame = LeftFrame(root, update_tab_bottom_frame.frame, "update_tab")37update_tab_middle_frame = MiddleFrame(root, update_tab_bottom_frame.frame)38update_tab_left_frame.set_middle_frame(update_tab_middle_frame)39# VIEW TAB40view_tab_top_frame = TopFrame(view_tab)41view_tab_bottom_frame = BottomFrame(view_tab)42view_tab_left_frame = LeftFrame(root, view_tab_bottom_frame.frame, "view_tab")43view_tab_middle_frame = MiddleFrame(root, view_tab_bottom_frame.frame)44view_tab_left_frame.set_middle_frame(view_tab_middle_frame)45# WEB TAB46canvas = Canvas(web_tab, width=GuidParameter.SCREEN_WIDTH, height=GuidParameter.SCREEN_HEIGHT)47image =PhotoImage(file="images/semo_campus.png")48canvas.create_image(0, 0, image = image, anchor=NW)49font1 = Font(root, family="adobe-garamond-pro", size = 30, slant="italic", weight="bold")50canvas.create_text(GuidParameter.SCREEN_WIDTH/2, GuidParameter.SCREEN_HEIGHT/6, font=font1, text="Southeast Missouri State University", fill=GuidParameter.ORANGE)51font2 = Font(root, family="proxima-nova", size=42, weight="bold")52canvas.create_text(GuidParameter.SCREEN_WIDTH/2, GuidParameter.SCREEN_HEIGHT/6+80, font=font2, text="Center for Teaching and Learning", fill=GuidParameter.WHITE)53font3 = Font(root, family="arial black", size=32, weight="bold")54canvas.create_text(GuidParameter.SCREEN_WIDTH/2, GuidParameter.SCREEN_HEIGHT/6+170, font=font3, text="WHD MONTHLY TICKET REPORT", fill=GuidParameter.BEAUTIFUL_RED)55btn = Button(56 web_tab, 57 text = 'WEB VIEW',58 command= openbrowser,59 width=10,60 height=1,61 relief=SOLID,62 font=('arial', 22)63)64btn_canvas = canvas.create_window(65 GuidParameter.SCREEN_WIDTH/2-40, 66 GuidParameter.SCREEN_HEIGHT/6+250,67 anchor = "center",68 window = btn,69 )70canvas.grid(row=0, column=0)...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!