How to use getWindowSize method in Webdriverio

Best JavaScript code snippet using webdriverio-monorepo

MainWindow.py

Source:MainWindow.py Github

copy

Full Screen

...49 self.editor.minsize(1000,720)50 self.editor.pack_propagate(False)51 self.editor.grid_propagate(False)52 self.editor.iconbitmap("others/img/icon.ico")53 self.__originalW = self.getWindowSize()[0]54 self.__originalH = self.getWindowSize()[1]55 self.__lastW = self.getWindowSize()[0]56 self.__lastH = self.getWindowSize()[1]57 from FontManager import FontManager58 self.__fontManager = FontManager(self.__loader)59 self.__fontSize = int(self.__screenSize[0]/1300 * self.__screenSize[1]/1050*14)60 self.__normalFont = self.__fontManager.getFont(self.__fontSize, False, False, False)61 self.__smallFont = self.__fontManager.getFont(int(self.__fontSize*0.80), False, False, False)62 self.__miniFont = self.__fontManager.getFont(int(self.__fontSize*0.65), False, False, False)63 self.__tinyFont = self.__fontManager.getFont(int(self.__fontSize*0.45), False, False, False)64 self.__halfFont = self.__fontManager.getFont(int(self.__fontSize*0.57), False, False, False)65 self.__createFrames()66 #self.selectedItem = ["bank1", "global_variables"]67 self.bindThings()68 from threading import Thread69 self.__soundPlayer.playSound("Start")70 #align = Thread(target=self.__scales)71 #align.daemon = True72 #align.start()73 self.editor.deiconify()74 self.editor.focus()75 self.__loader.tk.iconify()76 t = Thread(target=self.__loopColorThread)77 t.daemon = True78 t.start()79 self.__loader.tk.deiconify()80 self.__loader.tk.focus()81 def getLoopColor(self):82 return self.__loopColor83 def bindThings(self):84 self.__pressedHome = False85 self.__pressedShiftL = False86 self.editor.bind("<Key>", self.pressed)87 self.editor.bind("<KeyRelease>", self.released)88 t = Thread(target=self.__checkBinded)89 t.daemon = True90 t.start()91 def __setProjectPath(self, path):92 self.projectPath=path93 self.__loader.bindedVariables["projectPath"] = path94 def __closeWindow(self):95 self.editor.destroy()96 def getWindowSize(self):97 return (self.editor.winfo_width(), self.editor.winfo_height())98 def __scales(self):99 from time import sleep100 while self.dead == False:101 if self.__mainFocus == None:102 self.__mainFocus = self.editor.focus_get()103 if self.editor.focus_get() == self.__mainFocus:104 if self.__loader.subMenuDict == {} and self.__subMenuOpened == True:105 self.__subMenuOpened = False106 self.__killRemaining()107 else:108 self.__subMenuOpened = True109 if (self.__lastW==self.getWindowSize()[0] and self.__lastH==self.getWindowSize()[1]):110 sleep(0.05)111 continue112 self.__lastW = self.getWindowSize()[0]113 self.__lastH = self.getWindowSize()[1]114 self.__scaleX = self.__lastW / self.__originalW115 self.__scaleY = self.__lastH / self.__originalH116 sleep(0.025)117 def __killRemaining(self):118 import gc119 self.__loader.subMenus = []120 for item in gc.get_objects():121 if "filedialog" in str(type(item)):122 print(str(type(item)))123 def getScales(self):124 return([self.__scaleX, self.__scaleY])125 def __createFrames(self):126 self.__fullEditor = Frame(self.editor, width=self.getWindowSize()[0],127 height=self.getWindowSize()[1],128 bg=self.__colors.getColor("window"))129 self.__fullEditor.pack_propagate(False)130 self.__fullEditor.pack(side=TOP, anchor = N, fill=BOTH)131 self.__buttonMenu = Frame(self.__fullEditor, width=self.getWindowSize()[0],132 height=self.getWindowSize()[1]//11.25,133 bg=self.__colors.getColor("window"))134 self.__buttonMenu.pack_propagate(False)135 self.__buttonMenu.pack(side=TOP, anchor = N, fill=X)136 self.__createMenuFrame()137 self.__controllerMenu = Frame(self.__fullEditor, width=self.getWindowSize()[0],138 height=self.getWindowSize()[1]//30,139 bg=self.__colors.getColor("window"))140 self.__controllerMenu.pack_propagate(False)141 self.__controllerMenu.pack(side=TOP, anchor = N, fill=X)142 self.__changerButtons = []143 for num in range(1,9):144 f = Frame(self.__controllerMenu, width=self.getWindowSize()[0]//8,145 height=self.getWindowSize()[1]//30,146 bg=self.__colors.getColor("window"))147 f.pack_propagate(False)148 f.pack(side=LEFT, anchor = E, fill=Y)149 if num == 1:150 name = "global"151 else:152 name = 'bank'+str(num)153 b = Button(f, bg=self.__loader.colorPalettes.getColor("window"),154 text = name[0].upper()+name[1:], name = name,155 fg = self.__loader.colorPalettes.getColor("font"),156 width=99999, font=self.__normalFont,157 state=DISABLED, command = None)158 b.pack_propagate(False)159 b.pack(side=LEFT, anchor=E, fill=BOTH)160 self.__changerButtons.append(b)161 __keys = list(self.__loader.virtualMemory.codes["bank2"].keys())162 __keys.remove('local_variables')163 __keys.remove('special_read_only')164 __keys.remove('screen_top')165 __keys.remove('screen_bottom')166 self.__controllerMenu2 = Frame(self.__fullEditor, width=self.getWindowSize()[0],167 height=self.getWindowSize()[1]//30,168 bg=self.__colors.getColor("window"))169 self.__controllerMenu2.pack_propagate(False)170 self.__controllerMenu2.pack(side=TOP, anchor = N, fill=X)171 self.__sectionButtons = []172 for num in range(0, len(__keys)):173 f = Frame(self.__controllerMenu2, width=self.getWindowSize()[0]//len(__keys),174 height=self.getWindowSize()[1]//30,175 bg=self.__colors.getColor("window"))176 f.pack_propagate(False)177 f.pack(side=LEFT, anchor = E, fill=Y)178 try:179 text = self.__dictionaries.getWordFromCurrentLanguage(__keys[num])180 except:181 text = __keys[num][0].upper() + __keys[num][1:]182 b = Button(f, bg=self.__loader.colorPalettes.getColor("window"),183 text = text, name = __keys[num],184 fg = self.__loader.colorPalettes.getColor("font"),185 width=99999, font=self.__normalFont,186 state=DISABLED, command = None)187 b.pack_propagate(False)188 b.pack(side=LEFT, anchor=E, fill=BOTH)189 self.__changerButtons.append(b)190 from EditorBigFrame import EditorBigFrame191 self.__bigFrame = EditorBigFrame(self.__loader, self.__fullEditor)192 self.__loader.bigFrame = self.__bigFrame193#self.__createSelectorFrame()194 #from BFG9000 import BFG9000195 #self.__BFG9000 = BFG9000(self.__loader, self.editor, self,196 # self.__buttonMenu.getFrameSize()[1]+self.__selectMenu1.getFrameSize()[1]197 # )198 def __createMenuFrame(self):199 #self.__buttonMenu = FrameContent(self.__loader, "buttonMenu",200 # self.getWindowSize()[0]/3*2, self.getWindowSize()[1]/11.25, 5, 5,201 # 99999, 150, 400, 60)202 self.__places = {}203 __vals = [0, 6.5, 11, 18.5]204 self.__buttonMaker = ButtonMaker(self.__loader, self.__buttonMenu, self.__createLabel, self.__destroyLabel)205 self.__newButton = self.__buttonMaker.createButton("new", 0,206 self.__newButtonFunction, "projectPath" ,207 True, None, self.__places, __vals[0])208 self.__openButton = self.__buttonMaker.createButton("open", 1,209 self.__openButtonFunction, "projectPath",210 True, None, self.__places, __vals[0])211 self.__saveButton = self.__buttonMaker.createButton("save", 2,212 self.__saveButtonFunction, "projectPath",213 False, None, self.__places, __vals[0])214 self.__saveAllButton = self.__buttonMaker.createButton("saveAll", 3,215 self.__saveAllButtonFunction, "projectPath",216 False, None, self.__places, __vals[0])217 self.__closeProjectButton = self.__buttonMaker.createButton("closeProject", 4,218 self.__closeProjectButtonFunction, "projectPath",219 False, None, self.__places, __vals[0])220 self.__archiveButton = self.__buttonMaker.createButton("archive", 5,221 self.__achiveButtonFunction, "projectPath",222 False, None, self.__places, __vals[0])223 self.__copyButton = self.__buttonMaker.createButton("copy", 6.5,224 self.__copyButtonFunction, None,225 False, self.setCopyButton, self.__places, __vals[1])226 self.__pasteButton = self.__buttonMaker.createButton("paste", 7.5,227 self.__pasteButtonFunction, None,228 False, self.setPasteButton, self.__places, __vals[1])229 self.__undoButton = self.__buttonMaker.createButton("undo", 8.5,230 self.__undoButtonFunction, None,231 False, self.__undoButtonHandler, self.__places, __vals[1])232 self.__redoButton = self.__buttonMaker.createButton("redo", 9.5,233 self.__redoButtonFunction, None,234 False, self.__redoButtonHandler, self.__places, __vals[1])235 self.__spriteButton = self.__buttonMaker.createButton("spriteEditor", 11,236 self.__openSpriteEditor, "projectPath",237 False, None, self.__places, __vals[2])238 self.__pfButton = self.__buttonMaker.createButton("playfieldEditor", 12,239 self.__openPFEditor, "projectPath",240 False, None, self.__places, __vals[2])241 self.__musicButton = self.__buttonMaker.createButton("music", 13,242 self.__openMusicComposer, "projectPath",243 False, None, self.__places, __vals[2])244 self.__64pxPictureButton = self.__buttonMaker.createButton("64pxPicture", 14,245 self.__openPictureConverter, "projectPath",246 False, None, self.__places, __vals[2])247 self.__soundPlayerButton = self.__buttonMaker.createButton("soundPlayer", 15,248 self.__openSoundPlayer, "projectPath",249 False, None, self.__places, __vals[2])250 self.__bigSpriteButton = self.__buttonMaker.createButton("bigSprite", 16,251 self.__openBigSpriteEditor, "projectPath",252 False, None, self.__places, __vals[2])253 self.__menuMaker = self.__buttonMaker.createButton("menuMaker", 17,254 self.__openMenuMaker, "projectPath",255 False, None, self.__places, __vals[2])256 self.__lockManagerButton = self.__buttonMaker.createButton("lockManager", 18.5,257 self.__openLockManager, "projectPath",258 False, None, self.__places, __vals[3])259 self.__memoryManagerButton = self.__buttonMaker.createButton("memoryManager", 19.5,260 self.openMemoryManager, "projectPath",261 False, None, self.__places, __vals[3])262 self.__screenTopBottomButton = self.__buttonMaker.createButton("screenTopBottom", 20.5,263 self.__openScreenTopBottom, "projectPath",264 False, None, self.__places, __vals[3])265 self.__menuLabel = [None]266 self.__menuLabel[0] = MenuLabel(self.__loader, self.__buttonMenu, "", 0, self.__fontManager)267 """268 def __createSelectorFrame(self):269 self.__selectMenu1 = FrameContent(self.__loader, "bankMenu",270 self.getWindowSize()[0] / 7, self.getWindowSize()[1] / 5, 5,271 self.__buttonMenu.getFrameSize()[1]+10,272 99999, 550, 80, 100)273 from SelectLabel import SelectLabel274 from NewListBoxInFrame import NewListBoxInFrame275 self.__bankLabel = SelectLabel(self.__loader, self.__selectMenu1,276 self.__dictionaries.getWordFromCurrentLanguage("selectedBank"),277 self.__fontManager278 )279 listBoxItems = []280 for num in range(1,9):281 listBoxItems.append("bank"+str(num))282 self.__bankBox = NewListBoxInFrame("bankBox", self.__loader,283 self.__selectMenu1, listBoxItems, self.checkIfBankChanged, LEFT)284 self.__selectMenu2 = FrameContent(self.__loader, "sectionMenu",285 self.getWindowSize()[0] / 6, self.getWindowSize()[1] / 5,286 self.__selectMenu1.getFrameSize()[0]+10 ,287 self.__buttonMenu.getFrameSize()[1]+10,288 99999, 550, 80, 100)289 self.__sectionLabel = SelectLabel(self.__loader, self.__selectMenu2,290 self.__dictionaries.getWordFromCurrentLanguage("selectedSection"),291 self.__fontManager292 )293 self.__tempList = []294 for item in self.__loader.sections:295 if item != "special_read_only":296 self.__tempList.append(item)297 self.__sectionBox = NewListBoxInFrame("sectionBox", self.__loader,298 self.__selectMenu2, self.__tempList, self.checkIfSectionChanged, LEFT)299 self.__lockMenu = FrameContent(self.__loader, "lockMenu",300 self.getWindowSize()[0] / 8, self.getWindowSize()[1] / 5,301 (self.__selectMenu1.getFrameSize()[0]+10)*2.25 ,302 self.__buttonMenu.getFrameSize()[1]+10,303 99999, 550, 80, 100)304 from LockFrame import LockFrame305 self.__lockFrame = LockFrame(self.__loader, self, self.__lockMenu, self.__fontManager)306 self.__changedSelection = Thread(target=self.__listBoxChanges)307 self.__changedSelection.daemon = True308 self.__changedSelection.start()309 """310 def __loopColorThread(self):311 from time import sleep312 colorNum = 0313 while self.__loader.mainWindow.dead == False and self.dead == False:314 try:315 colorNum += 1316 if colorNum == 256: colorNum = 0317 hexaNum = hex(colorNum-colorNum%2).replace("0x", "$")318 if len(hexaNum) == 2: hexaNum = "$0"+hexaNum[1]319 self.__loopColor = self.__colorDict.getHEXValueFromTIA(hexaNum)320 except:321 pass322 for item in self.__loader.stopThreads:323 try:324 if item.stopThread == True:325 self.__loader.stopThreads.remove(item)326 break327 except:328 self.__loader.stopThreads.remove(item)329 break330 sleep(0.025)331 def __createLabel(self, event):332 try:333 name = str(event.widget).split(".")[-1]334 button = self.__loader.menuButtons[name].getButton()335 if button.cget("state") == DISABLED:336 self.__menuLabel[0].changeColor(self.__loader.colorPalettes.getColor("fontDisabled"))337 else:338 self.__menuLabel[0].changeColor(self.__loader.colorPalettes.getColor("font"))339 self.__menuLabel[0].setText(self.__dictionaries.getWordFromCurrentLanguage(name))340 self.__menuLabel[0].changePlace(self.__places[name])341 except:342 try:343 self.__menuLabel[0].setText("")344 self.__menuLabel[0].dead = True345 except:346 pass347 self.__menuLabel[0] = MenuLabel(self.__loader, self.__buttonMenu, "", 0, self.__fontManager)348 def setMode(self, mode):349 self.__bigFrame.setMode(mode)350 def __destroyLabel(self, event):351 try:352 self.__menuLabel[0].setText("")353 except:354 try:355 self.__menuLabel[0].setText("")356 self.__menuLabel[0].dead = True357 except:358 pass359 self.__menuLabel[0] = MenuLabel(self.__loader, self.__buttonMenu, "", 0, self.__fontManager)360 def __newButtonFunction(self):361 from NewProjectWindow import NewProjectWindow362 NewProjectWindow(self.__loader)363 def projectOpenedWantToSave(self):364 if self.projectPath!=None and self.__getIfThereIsUnsavedItem() == True:365 return(self.__fileDialogs.askYesOrNo("unsaved","unsavedText"))366 else:367 return("No")368 def __getIfThereIsUnsavedItem(self):369 for bank in self.__loader.virtualMemory.codes.keys():370 for item in self.__loader.virtualMemory.codes[bank].keys():371 if self.__loader.virtualMemory.codes[bank][item].changed == True:372 return True373 return False374 def checkIfBankChanged(self, listBox):375 if self.projectPath == None:376 self.__loader.listBoxes["bankBox"].getListBoxAndScrollBar()[0].config(state=DISABLED)377 else:378 self.__loader.listBoxes["bankBox"].getListBoxAndScrollBar()[0].config(state=NORMAL)379 num = 0380 for bank in self.__loader.virtualMemory.codes.keys():381 num += 1382 color1 = self.__loader.colorPalettes.getColor("boxBackNormal")383 color2 = self.__loader.colorPalettes.getColor("boxFontNormal")384 for item in self.__loader.virtualMemory.codes[bank].keys():385 if self.__loader.virtualMemory.codes[bank][item].changed == True:386 color1=self.__loader.colorPalettes.getColor("boxBackUnSaved")387 color2=self.__loader.colorPalettes.getColor("boxFontUnSaved")388 break389 listBox.itemconfig(num-1, {"bg": color1})390 listBox.itemconfig(num-1, {"fg": color2})391 def checkIfSectionChanged(self, listBox):392 if (self.__loader.listBoxes["bankBox"].getSelectedName() == "bank1" or393 self.projectPath == None or394 self.__loader.virtualMemory.locks[self.__loader.listBoxes["bankBox"].getSelectedName()]!=None):395 self.__loader.listBoxes["sectionBox"].getListBoxAndScrollBar()[0].config(state=DISABLED)396 else:397 self.__loader.listBoxes["sectionBox"].getListBoxAndScrollBar()[0].config(state=NORMAL)398 num=0399 bank =self.__loader.listBoxes["bankBox"].getSelectedName()400 for item in self.__loader.virtualMemory.codes[bank].keys():401 if item == "special_read_only":402 continue403 num += 1404 if self.__loader.virtualMemory.codes[bank][item].changed == True:405 color1 = self.__loader.colorPalettes.getColor("boxBackUnSaved")406 color2 = self.__loader.colorPalettes.getColor("boxFontUnSaved")407 else:408 color1 = self.__loader.colorPalettes.getColor("boxBackNormal")409 color2 = self.__loader.colorPalettes.getColor("boxFontNormal")410 listBox.itemconfig(num-1, {"bg": color1})411 listBox.itemconfig(num-1, {"fg": color2})412 def __listBoxChanges(self):413 bankBox = self.__loader.listBoxes["bankBox"]414 sectionBox = self.__loader.listBoxes["sectionBox"]415 self.__bankSelected = bankBox.getSelectedName()416 self.__sectionSelected = sectionBox.getSelectedName()417 while self.dead == False:418 from time import sleep419 if self.__bankSelected != bankBox.getSelectedName() or self.__sectionSelected != sectionBox.getSelectedName():420 self.__bankSelected = bankBox.getSelectedName()421 try:422 self.__sectionSelected = sectionBox.getSelectedName()423 except:424 continue425 sleep(0.05)426 def changeAliasInCodes(self):427 for bank in self.__loader.virtualMemory.codes.keys():428 for section in self.__loader.virtualMemory.codes[bank].keys():429 for command in self.__loader.syntaxList.keys():430 self.__loader.virtualMemory.codes[bank][section].code = (431 self.__loader.syntaxList[command].changeAliasToName(432 command, self.__loader.virtualMemory.codes[bank][section].code433 ))434 def openProject(self, path):435 try:436 projectPath=path.replace("\\", "/")437 from re import sub438 projectPath = sub("/+", "/", projectPath)439 self.__setProjectPath(projectPath)440 #file = open(self.projectPath+os.sep+name+".project2600", "w")441 #file.write(self.projectPath)442 #file.close()443 self.__loader.config.addProjectPath(projectPath)444 self.__setVirtualMemoryItem("bank1", "bank_configurations")445 self.__setVirtualMemoryItem("bank1", "global_variables")446 for num in range(2,9):447 bank = "bank"+str(num)448 for section in self.__loader.sections:449 self.__setVirtualMemoryItem(bank, section)450 self.__loader.virtualMemory.setLocksAfterLoading()451 self.__loader.virtualMemory.setVariablesFromMemory("all")452 self.__loader.virtualMemory.archieve()453 self.__soundPlayer.playSound("Success")454 self.__bigFrame.setMode("empty")455 except Exception as e:456 self.__fileDialogs.displayError("projectOpenError", "projectOpenErrorText",457 {458 "name": self.projectPath.split("/")[-2]459 },460 str(e)461 )462 try:463 self.__closeProject()464 except Exception as e:465 print(str(e))466 self.projectPath=""467 def __setVirtualMemoryItem(self, bank, variable):468 path = str(self.projectPath+bank+os.sep+variable+".a26")469 item = self.__loader.virtualMemory.codes[bank][variable]470 item.code = self.__loader.io.loadWholeText(path).replace("%DELIMINATOR%", self.__config.getValueByKey("deliminator"))471 if bank=="bank1" and variable =="bank_configurations":472 old = self.__loader.virtualMemory.kernel473 for line in item.code.split(os.linesep):474 if line.startswith("bank1"):475 new = line.split("=")[1].replace("\n", "").replace("\r", "")476 if old != new:477 self.__loader.virtualMemory.changeKernelMemory(old, new)478 item.changed = False479 def __saveOnlyOne(self, bank, variable):480 try:481 if bank == "bank1":482 variable = "global_variables"483 path = self.projectPath+bank+os.sep+variable+".a26"484 file = open(path, "w", encoding="latin-1")485 BFG9000 = self.__loader.BFG9000.saveFrameToMemory(bank, variable)486 if bank == "bank1" or variable == "local_variables":487 self.__loader.virtualMemory.setVariablesFromMemory(bank)488 file.write(self.__changeFirstValidDeliminator(self.__loader.virtualMemory.codes[bank][variable].code, variable))489 file.close()490 self.__loader.virtualMemory.codes[bank][variable].changed = False491 #self.__loader.virtualMemory.emptyArchieved()492 #item.archived = []493 #item.cursor = 0494 except Exception as e:495 self.__fileDialogs.displayError("projectOpenError", "projectOpenErrorText",496 {497 "name": variable,498 "bank": bank499 },500 str(e)501 )502 def __changeFirstValidDeliminator(self, text, section):503 if section not in ["subroutines","vblank", "enter", "leave", "overscan", "screen_bottom"]:504 return (text)505 newText=[]506 delimiter = self.__config.getValueByKey("deliminator")507 for line in text.split("\n"):508 if line.startswith("*") or line.startswith("#"):509 newText.append(line)510 else:511 valid = 0512 for position in range(0, len(line)-len(delimiter)+1):513 if line[position] == "(":514 valid+=1515 elif line[position] == ")":516 valid-=1517 elif valid == 0:518 if line[position:position+len(delimiter)] == delimiter:519 line = line[:position] + "%DELIMINATOR%" + line[position+len(delimiter):]520 break521 newText.append(line)522 return(os.linesep.join(newText))523 #return(self.__config.getValueByKey("deliminator"))524 def __saveProject(self):525 self.__saveOnlyOne("bank1", "bank_configurations")526 self.__saveOnlyOne("bank1", "global_variables")527 for num in range(2, 9):528 bank = "bank" + str(num)529 for section in self.__loader.sections:530 self.__saveOnlyOne(bank, section)531 self.__soundPlayer.playSound("Success")532 def closeProject(self):533 self.__soundPlayer.playSound("Close")534 self.__setProjectPath(None)535 self.__loader.virtualMemory.emptyArchieved()536 self.__loader.virtualMemory.resetMemory()537 self.stopThreads()538 self.__bigFrame.setMode("intro")539 def stopThreads(self):540 for item in self.__loader.stopThreads:541 item.stopThread=True542 self.__loader.stopThreads = []543 def __openButtonFunction(self):544 if self.projectOpenedWantToSave()=="Yes":545 self.__saveProject()546 from OpenProjectWindow import OpenProjectWindow547 OpenProjectWindow(self.__loader, self, self.openProject)548 def __openMusicComposer(self):549 from MusicComposer import MusicComposer550 MusicComposer(self.__loader, self, None)551 def __openPictureConverter(self):552 from PictureToCode import PictureToCode553 PictureToCode(self.__loader, "common", "64pxPicture" , None, None)554 def __openSoundPlayer(self):555 from SoundPlayerEditor import SoundPlayerEditor556 SoundPlayerEditor(self.__loader, self)557 def __openPFEditor(self):558 from PlayfieldEditor import PlayfieldEditor559 PlayfieldEditor(self.__loader, self)560 def __openSpriteEditor(self):561 from SpriteEditor import SpriteEditor562 SpriteEditor(self.__loader, self)563 def __openBigSpriteEditor(self):564 from BigSpriteMaker import BigSpriteMaker565 BigSpriteMaker(self.__loader)566 def __openScreenTopBottom(self):567 from TopBottomEditor import TopBottomEditor568 TopBottomEditor(self.__loader)569 def __openMenuMaker(self):570 from MenuMaker import MenuMaker571 MenuMaker(self.__loader)572 def __saveButtonFunction(self):573 #self.__saveOnlyOne(self.selectedItem[0], self.selectedItem[1])574 self.__saveOnlyOne(self.__loader.listBoxes["bankBox"].getSelectedName(),575 self.__loader.listBoxes["sectionBox"].getSelectedName())576 def __saveAllButtonFunction(self):577 self.__saveProject()578 def __closeProjectButtonFunction(self):579 if self.projectOpenedWantToSave()=="Yes":580 self.__saveProject()581 self.closeProject()582 def __achiveButtonFunction(self):583 from ArchiveWindow import ArchiveWindow584 ArchiveWindow(self.__loader)585 def __copyButtonFunction(self):586 import clipboard587 clipboard.copy(self.focused.selection_get())588 self.clipBoardText = clipboard.paste()589 def __pasteButtonFunction(self):590 self.focused.insert(INSERT, self.clipBoardText)591 def __undoButtonFunction(self):592 self.__loader.virtualMemory.getArcPrev()593 def __redoButtonFunction(self):594 self.__loader.virtualMemory.getArcNext()595 def __undoButtonHandler(self, button):596 from time import sleep597 while self.dead==False:598 try:599 if len(self.__loader.virtualMemory.archieved)>0 and self.__loader.virtualMemory.cursor>0:600 self.__undoButton.getButton().config(state=NORMAL)601 else:602 self.__undoButton.getButton().config(state=DISABLED)603 except:604 pass605 sleep(0.0025)606 def __redoButtonHandler(self, button):607 from time import sleep608 while self.dead==False:609 try:610 if self.__loader.virtualMemory.cursor<len(self.__loader.virtualMemory.archieved)-1:611 self.__redoButton.getButton().config(state=NORMAL)612 else:613 self.__redoButton.getButton().config(state=DISABLED)614 except:615 pass616 sleep(0.0025)617 def getConstant(self):618 scalerX = self.getWindowSize()[0]/1300619 scalerY = self.getWindowSize()[1]/1150620 num = round(32*scalerX*scalerY)621 if num>32:622 num=32623 elif num<18:624 num=18625 return(num)626 def focusIn(self, event):627 self.focused = event.widget628 def focusOut(self, event):629 self.focused = None630 def setCopyButton(self, button):631 from time import sleep632 sleep(2)633 while self.dead==False:...

Full Screen

Full Screen

EditorBigFrame.py

Source:EditorBigFrame.py Github

copy

Full Screen

...23 self.__miniFont = self.__fontManager.getFont(int(self.__fontSize*0.65), False, False, False)24 self.__tinyFont = self.__fontManager.getFont(int(self.__fontSize*0.45), False, False, False)25 self.__halfFont = self.__fontManager.getFont(int(self.__fontSize*0.57), False, False, False)26 self.__changed = False27 self.__frame = Frame(frame, width=self.__editor.getWindowSize()[0],28 height=self.__editor.getWindowSize()[1],29 bg=self.__colors.getColor("window"))30 self.__frame.pack_propagate(False)31 self.__frame.pack(side=TOP, anchor = N, fill=BOTH)32 sizes = (0.20, 0.60, 0.20)33 self.__leftFrame = Frame(self.__frame, width=round(self.__editor.getWindowSize()[0]*sizes[0]),34 height=self.__editor.getWindowSize()[1],35 bg=self.__colors.getColor("window"))36 self.__leftFrame.pack_propagate(False)37 self.__leftFrame.pack(side=LEFT, anchor = E, fill=Y)38 self.__mainFrame = Frame(self.__frame, width=round(self.__editor.getWindowSize()[0]*sizes[1]),39 height=self.__editor.getWindowSize()[1],40 bg=self.__colors.getColor("window"))41 self.__mainFrame.pack_propagate(False)42 self.__mainFrame.pack(side=LEFT, anchor = E, fill=Y)43 self.__rightFrame = Frame(self.__frame, width=round(self.__editor.getWindowSize()[0]*sizes[2]),44 height=self.__editor.getWindowSize()[1],45 bg=self.__colors.getColor("window"))46 self.__rightFrame.pack_propagate(False)47 self.__rightFrame.pack(side=LEFT, anchor = E, fill=Y)48 self.activeMode = None49 # Valid modes: intro, editor, locked, empty50 self.__selectedMode = "intro"51 from threading import Thread52 t = Thread(target=self.loop)53 t.daemon = True54 t.start()55 def loop(self):56 from time import sleep57 while self.__editor.dead == False:58 if self.activeMode != self.__selectedMode:...

Full Screen

Full Screen

functions.js

Source:functions.js Github

copy

Full Screen

1function getWindowSize() {2 return $(window).width()3}4function getLang() {5 return $('html').attr('lang');6}7function getPageDirection() {8 let lang = getLang();9 return lang = 'ar' ? 'rtl' : 'ltr';10}11function openSidebar(sidebar) {12 if (getWindowSize() <= 576) {13 sidebar.animate({14 width: '100vw'15 }, 600, function () {16 $(".sidebar-header").fadeIn(300)17 setTimeout(function () {18 $(".sidebar-body").fadeIn(300)19 }, 400)20 })21 }22 else if (getWindowSize() > 576 && getWindowSize() <= 768) {23 sidebar.animate({24 width: '75vw'25 }, 600, function () {26 $(".sidebar-header").fadeIn(300)27 setTimeout(function () {28 $(".sidebar-body").fadeIn(300)29 }, 400)30 })31 }32 else if (getWindowSize() > 768 && getWindowSize() <= 992) {33 sidebar.animate({34 width: '40vw'35 }, 600, function () {36 $(".sidebar-header").fadeIn(300)37 setTimeout(function () {38 $(".sidebar-body").fadeIn(300)39 }, 400)40 })41 }42 else if (getWindowSize() > 992 && getWindowSize() <= 1200) {43 sidebar.animate({44 width: '30vw'45 }, 600, function () {46 $(".sidebar-header").fadeIn(300)47 setTimeout(function () {48 $(".sidebar-body").fadeIn(300)49 }, 400)50 })51 }52 else if (getWindowSize() > 1200) {53 sidebar.animate({54 width: '20vw'55 }, 600, function () {56 $(".sidebar-header").fadeIn(300)57 setTimeout(function () {58 $(".sidebar-body").fadeIn(300)59 }, 400)60 })61 }62}63function closeSidebar(sidebar) {64 $(".sidebar-body").fadeOut(300)65 setTimeout(function () {66 $(".sidebar-header").fadeOut(300)...

Full Screen

Full Screen

test-tty-window-size.js

Source:test-tty-window-size.js Github

copy

Full Screen

...56 });57 stream._refreshSize();58}59{60 // WriteStream.prototype.getWindowSize() returns the current columns and rows.61 monkeyPatchGetWindowSize(function(size) {62 size[0] = 99;63 size[1] = 32;64 return 0;65 });66 const stream = WriteStream(1);67 assert.strictEqual(stream.columns, 99);68 assert.strictEqual(stream.rows, 32);69 assert.deepStrictEqual(stream.getWindowSize(), [99, 32]);...

Full Screen

Full Screen

tty.js

Source:tty.js Github

copy

Full Screen

1const tty = require('tty')2const terminalSize = require('./terminal-size')3// polyfills node's getWindowSize4// by returning an array of columns/rows5function getWindowSize () {6 const { columns, rows } = terminalSize.get()7 return [columns, rows]8}9function patchStream (patched, name) {10 const stream = process[name]11 stream.isTTY = true12 patched[stream.fd] = true13}14const override = () => {15 const isatty = tty.isatty16 const patched = {17 0: false,18 1: false,19 2: false,20 }21 // polyfill in node's getWindowSize22 // if it doesn't exist on stdout and stdin23 // (if we are a piped process) or we are24 // in windows on electron25 ;['stdout', 'stderr'].forEach((fn) => {26 if (!process[fn].getWindowSize) {27 process[fn].getWindowSize = getWindowSize28 }29 })30 tty.isatty = function (fd) {31 if (patched[fd]) {32 // force stderr to return true33 return true34 }35 // else pass through36 return isatty.call(tty, fd)37 }38 if (process.env.FORCE_STDIN_TTY === '1') patchStream(patched, 'stdin')39 if (process.env.FORCE_STDOUT_TTY === '1') patchStream(patched, 'stdout')40 if (process.env.FORCE_STDERR_TTY === '1') patchStream(patched, 'stderr')41 return42}43module.exports = {44 override,45 getWindowSize,...

Full Screen

Full Screen

getWindowSize.js

Source:getWindowSize.js Github

copy

Full Screen

...7 * The `getWindowRect` command returns both dimensions and position of the window, using the `windowRect` protocol command.8 *9 * @example10 * module.exports = {11 * 'demo test .getWindowSize()': function(browser) {12 * // Retrieve the attributes13 * browser.getWindowSize(function(value) {14 * console.log(value);15 * });16 * },17 *18 * 'getWindowSize ES6 demo test': async function(browser) {19 * const value = await browser.getWindowSize();20 * console.log('value', value);21 * }22 * }23 *24 *25 * @method getWindowSize26 * @syntax .getWindowSize([callback])27 * @param {function} callback Callback function to be called when the command finishes.28 * @see windowRect29 * @api protocol.contexts30 */31class GetWindowSize extends ClientCommand {32 get returnsFullResultObject() {33 return false;34 }35 get resolvesWithFullResultObject() {36 return false;37 }38 performAction(callback) {39 this.api.windowSize('current', callback);40 }...

Full Screen

Full Screen

index.js

Source:index.js Github

copy

Full Screen

...13 var height;1415 if(tty.isatty(1) && tty.isatty(2)) {16 if(process.stdout.getWindowSize) {17 width = process.stdout.getWindowSize(1)[0];18 height = process.stdout.getWindowSize(1)[1];19 } else if (tty.getWindowSize) {20 width = tty.getWindowSize()[1];21 height = tty.getWindowSize()[0];22 } else if (process.stdout.columns && process.stdout.rows) {23 height = process.stdout.columns;24 width = process.stdout.rows;25 }26 } else {27 new Error('Error: could not get window size with tty or process.stdout');28 }29 return {30 height: height,31 width: width32 } ...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriverio = require('webdriverio');2var options = {3 desiredCapabilities: {4 }5};6 .remote(options)7 .init()8 .getWindowSize().then(function(size) {9 console.log(size);10 })11 .end();12{ width: 1920, height: 1080 }

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriverio = require('webdriverio');2var options = {3 desiredCapabilities: {4 }5};6 .remote(options)7 .init()8 .getTitle().then(function(title) {9 console.log('Title was: ' + title);10 })11 .end();12var webdriverio = require('webdriverio');13var options = {14 desiredCapabilities: {15 }16};17 .remote(options)18 .init()19 .getWindowSize().then(function(size) {20 console.log('Size was: ' + size);21 })22 .end();23var webdriverio = require('webdriverio');24var options = {25 desiredCapabilities: {26 }27};28 .remote(options)29 .init()30 .setWindowSize(100, 100)31 .end();32var webdriverio = require('webdriverio');33var options = {34 desiredCapabilities: {35 }36};37 .remote(options)38 .init()39 .maximizeWindow()40 .end();41var webdriverio = require('webdriverio');42var options = {43 desiredCapabilities: {44 }45};46 .remote(options)47 .init()48 .getOrientation().then(function(orientation) {49 console.log('Orientation was: ' + orientation);50 })51 .end();52var webdriverio = require('webdriverio');53var options = {54 desiredCapabilities: {55 }56};57 .remote(options)58 .init()59 .setOrientation('landscape')60 .end();61var webdriverio = require('webdriverio');62var options = {

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriverio = require('webdriverio');2var options = { desiredCapabilities: { browserName: 'chrome' } };3 .remote(options)4 .init()5 .getTitle().then(function(title) {6 console.log('Title was: ' + title);7 })

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriverio = require('webdriverio');2var options = {3 desiredCapabilities: {4 }5};6var client = webdriverio.remote(options);7client.init()8 .getTitle().then(function(title) {9 console.log('Title was: ' + title);10 })11 .getWindowSize().then(function(size) {12 console.log('Size was: ' + size);13 })14 .end();15getViewportSize() method16var webdriverio = require('webdriverio');17var options = {18 desiredCapabilities: {19 }20};21var client = webdriverio.remote(options);22client.init()23 .getTitle().then(function(title) {24 console.log('Title was: ' + title);25 })26 .getViewportSize().then(function(size) {27 console.log('Size was: ' + size);28 })29 .end();30getHTML() method31var webdriverio = require('webdriverio');32var options = {33 desiredCapabilities: {34 }35};36var client = webdriverio.remote(options);37client.init()38 .getTitle().then(function(title) {39 console.log('Title was: ' + title);40 })41 .getHTML().then(function(html) {42 console.log('HTML was: ' + html);43 })44 .end();45getHTML()

Full Screen

Using AI Code Generation

copy

Full Screen

1const size = browser.getWindowSize();2console.log(size);3browser.setWindowSize(1000, 600);4browser.maximizeWindow();5browser.refresh();6const url = browser.getUrl();7console.log(url);8const title = browser.getTitle();9console.log(title);10browser.pause(5000);11browser.waitForVisible(‘#elementId’, 5000);12browser.waitForExist(‘#elementId’, 5000);13browser.waitForEnabled(‘#elementId’, 5000);14browser.waitForSelected(‘#elementId’, 5000);15browser.waitForText(‘#elementId’, 5000);16browser.waitForValue(‘#elementId’, 5000);17browser.waitForVisible(‘#elementId’, 5000);18browser.waitForVisible(‘#elementId’, 5000);19browser.waitForVisible(‘#elementId’, 5000);20browser.waitForVisible(‘#elementId’, 5000);21browser.waitForVisible(‘#elementId’, 5000);22browser.waitForVisible(‘#elementId’, 5000);23browser.waitForVisible(‘#elementId’, 5000);24browser.waitForVisible(‘#elementId’, 5000);25browser.waitForVisible(‘#elementId’, 5000);

Full Screen

Using AI Code Generation

copy

Full Screen

1 .getWindowSize('width')2 .then(function(size) {3 console.log(size);4 });5 .getWindowSize('height')6 .then(function(size) {7 console.log(size);8 });9 .getWindowSize('width', 'height')10 .then(function(size) {11 console.log(size);12 });13browser.setWindowSize(width, height);14 .setWindowSize(1920, 1080);15browser.setViewportSize(width, height);16 .setViewportSize(1920, 1080);17browser.setWindowRect(x, y, width, height);18 .setWindowRect(0, 0, 1920, 1080);19browser.maximizeWindow();

Full Screen

WebdriverIO Tutorial

Wondering what could be a next-gen browser and mobile test automation framework that is also simple and concise? Yes, that’s right, it's WebdriverIO. Since the setup is very easy to follow compared to Selenium testing configuration, you can configure the features manually thereby being the center of attraction for automation testing. Therefore the testers adopt WedriverIO to fulfill their needs of browser testing.

Learn to run automation testing with WebdriverIO tutorial. Go from a beginner to a professional automation test expert with LambdaTest WebdriverIO tutorial.

Chapters

  1. Running Your First Automation Script - Learn the steps involved to execute your first Test Automation Script using WebdriverIO since the setup is very easy to follow and the features can be configured manually.

  2. Selenium Automation With WebdriverIO - Read more about automation testing with WebdriverIO and how it supports both browsers and mobile devices.

  3. Browser Commands For Selenium Testing - Understand more about the barriers faced while working on your Selenium Automation Scripts in WebdriverIO, the ‘browser’ object and how to use them?

  4. Handling Alerts & Overlay In Selenium - Learn different types of alerts faced during automation, how to handle these alerts and pops and also overlay modal in WebdriverIO.

  5. How To Use Selenium Locators? - Understand how Webdriver uses selenium locators in a most unique way since having to choose web elements very carefully for script execution is very important to get stable test results.

  6. Deep Selectors In Selenium WebdriverIO - The most popular automation testing framework that is extensively adopted by all the testers at a global level is WebdriverIO. Learn how you can use Deep Selectors in Selenium WebdriverIO.

  7. Handling Dropdown In Selenium - Learn more about handling dropdowns and how it's important while performing automated browser testing.

  8. Automated Monkey Testing with Selenium & WebdriverIO - Understand how you can leverage the amazing quality of WebdriverIO along with selenium framework to automate monkey testing of your website or web applications.

  9. JavaScript Testing with Selenium and WebdriverIO - Speed up your Javascript testing with Selenium and WebdriverIO.

  10. Cross Browser Testing With WebdriverIO - Learn more with this step-by-step tutorial about WebdriverIO framework and how cross-browser testing is done with WebdriverIO.

Run Webdriverio automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful