Best Python code snippet using localstack_python
gui.py
Source:gui.py
...35 isRefresh = False36 dpg.set_viewport_title(title=f'mp3Suite - {file_path}')37 #Delete Existing Windows38 try:39 dpg.delete_item('file_info')40 dpg.delete_item('edit_tags')41 except: pass42 #Find Filetype43 file_ending = file_path[len(file_path)-3:].lower()44 print(file_ending)45 ## File Info46 if file_ending == 'mp3':47 with dpg.window(label='File Info', no_close=True, no_move=True, no_collapse=True, pos=(0,20), tag='file_info', width=600, height=400, no_resize=True): #theme=currentTheme48 with dpg.tab_bar():49 with dpg.tab(label='ID3v1'):50 dpg.add_text(f'File: {file_path}')51 dpg.add_text(f"Artist: {main.getTag(file_path,'artist',1)}")52 dpg.add_text(f"Album: {main.getTag(file_path,'album',1)}")53 dpg.add_text(f"Song: {main.getTag(file_path,'song',1)}")54 dpg.add_text(f"Track: {main.getTag(file_path,'track',1)}")55 dpg.add_text(f"Comment: {main.getTag(file_path,'comment',1)}")56 dpg.add_text(f"Year: {main.getTag(file_path,'year',1)}")57 dpg.add_text(f"Genre: {main.getTag(file_path,'genre',1)}")58 dpg.add_button(label='Refresh', callback=callbackFileInfoButtonRefresh)59 with dpg.tab(label='ID3v2'):60 dpg.add_text(f'File: {file_path}')61 dpg.add_text(f"Artist: {main.getTag(file_path,'artist',2)}")62 dpg.add_text(f"Album: {main.getTag(file_path,'album',2)}")63 dpg.add_text(f"Song: {main.getTag(file_path,'song',2)}")64 dpg.add_text(f"Track: {main.getTag(file_path,'track',2)}")65 dpg.add_text(f"Comment: {main.getTag(file_path,'comment',2)}")66 dpg.add_text(f"Year: {main.getTag(file_path,'year',2)}")67 dpg.add_text(f"Genre: {main.getTag(file_path,'genre',2)}")68 dpg.add_text(f"Band: {main.getTag(file_path,'band',2)}")69 dpg.add_text(f"Composer: {main.getTag(file_path,'composer',2)}")70 dpg.add_text(f"Copyright: {main.getTag(file_path,'copyright',2)}")71 dpg.add_text(f"URL: {main.getTag(file_path,'url',2)}")72 dpg.add_text(f"Publisher: {main.getTag(file_path,'publisher',2)}")73 dpg.add_button(label='Refresh', callback=callbackFileInfoButtonRefresh)74 #dpg.add_button(label='Refresh', callback=callbackFileInfoButtonRefresh)75 76 else:77 with dpg.window(label='File Info', no_close=True, no_move=True, no_collapse=True, pos=(0,20), tag='file_info', width=600, no_resize=True): #theme=currentTheme78 dpg.add_text(f'File: {file_path}')79 ## Edit Tags80 if file_ending == 'mp3':81 with dpg.window(label='Edit Tags', no_close=True, no_move=True, no_collapse=True, pos=(600,20), tag='edit_tags', width=300, height=400, no_resize=True):82 with dpg.tab_bar():83 with dpg.tab(label='ID3v1'):84 dpg.add_button(label='Edit Tag: Artist', callback=callbackChangeTagArtist1)85 dpg.add_button(label='Edit Tag: Album', callback=callbackChangeTagAlbum1)86 dpg.add_button(label='Edit Tag: Song', callback=callbackChangeTagSong1)87 dpg.add_button(label='Edit Tag: Track', callback=callbackChangeTagTrack1)88 dpg.add_button(label='Edit Tag: Comment', callback=callbackChangeTagComment1)89 dpg.add_button(label='Edit Tag: Year', callback=callbackChangeTagYear1)90 dpg.add_button(label='Edit Tag: Genre', callback=callbackChangeTagGenre1)91 with dpg.tab(label='ID3v2'):92 dpg.add_button(label='Edit Tag: Artist', callback=callbackChangeTagArtist2)93 dpg.add_button(label='Edit Tag: Album', callback=callbackChangeTagAlbum2)94 dpg.add_button(label='Edit Tag: Song', callback=callbackChangeTagSong2)95 dpg.add_button(label='Edit Tag: Track', callback=callbackChangeTagTrack2)96 dpg.add_button(label='Edit Tag: Comment', callback=callbackChangeTagComment2)97 dpg.add_button(label='Edit Tag: Year', callback=callbackChangeTagYear2)98 dpg.add_button(label='Edit Tag: Genre', callback=callbackChangeTagGenre2)99 dpg.add_button(label='Edit Tag: Band', callback=callbackChangeTagBand2)100 dpg.add_button(label='Edit Tag: Composer', callback=callbackChangeTagComposer2)101 dpg.add_button(label='Edit Tag: Copyright', callback=callbackChangeTagCopyright2)102 dpg.add_button(label='Edit Tag: URL', callback=callbackChangeTagURL2)103 dpg.add_button(label='Edit Tag: Publisher', callback=callbackChangeTagPublisher2)104 dpg.add_button(label='Edit Tag: Image', callback=callbackChangeTagImage2)105def callbackFileInfoButtonRefresh():106 dpg.delete_item('file_info')107 dpg.delete_item('edit_tags')108 try:109 dpg.delete_item('changeTagArtist1_window')110 dpg.delete_item('changeTagAlbum1_window')111 dpg.delete_item('changeTagSong1_window')112 dpg.delete_item('changeTagTrack1_window')113 dpg.delete_item('changeTagComment1_window')114 dpg.delete_item('changeTagYear1_window')115 dpg.delete_item('changeTagGenre1_window')116 dpg.delete_item('changeTagArtist2_window')117 dpg.delete_item('changeTagAlbum2_window')118 dpg.delete_item('changeTagSong2_window')119 dpg.delete_item('changeTagTrack2_window')120 dpg.delete_item('changeTagComment2_window')121 dpg.delete_item('changeTagYear2_window')122 dpg.delete_item('changeTagGenre2_window')123 dpg.delete_item('changeTagBand2_window')124 dpg.delete_item('changeTagComposer2_window')125 dpg.delete_item('changeTagCopyright2_window')126 dpg.delete_item('changeTagURL2_window')127 dpg.delete_item('changeTagPublisher2_window')128 dpg.delete_item('changeTagImage2_window')129 except: pass130 callbackMenubarOpen(True)131## Artist 1132def callbackChangeTagArtist1():133 try: dpg.delete_item('changeTagArtist1_window')134 except: pass135 with dpg.window(label='Edit Tag: Artist - ID3v1', pos=(300,200), tag='changeTagArtist1_window', width=250, on_close=onCloseTagArtist1):136 dpg.add_text(f'Current Value: '+main.getTag(file_path, 'artist', 1))137 with dpg.group(horizontal=True):138 dpg.add_input_text(hint='New Value', tab_input=True, callback=loggerChangeTagArtist1)139 dpg.add_button(label='Save', callback=saveChangeTagArtist1)140def loggerChangeTagArtist1(sender, app_data, user_data):141 print(app_data)142 global logChangeTagArtist1143 logChangeTagArtist1 = app_data144def saveChangeTagArtist1():145 main.newChangeTagArtist(1,file_path,str(logChangeTagArtist1))146 try: dpg.delete_item('changeTagArtist1_window')147 except: pass148def onCloseTagArtist1():149 try: dpg.delete_item('changeTagArtist1_window')150 except: pass151## Album 1152def callbackChangeTagAlbum1():153 try: dpg.delete_item('changeTagAlbum1_window')154 except: pass155 with dpg.window(label='Edit Tag: Album - ID3v1', pos=(300,200), tag='changeTagAlbum1_window', width=250, on_close=onCloseTagAlbum1):156 dpg.add_text(f'Current Value: '+main.getTag(file_path, 'album', 1))157 with dpg.group(horizontal=True):158 dpg.add_input_text(hint='New Value', tab_input=True, callback=loggerChangeTagAlbum1)159 dpg.add_button(label='Save', callback=saveChangeTagAlbum1)160def loggerChangeTagAlbum1(sender, app_data, user_data):161 print(app_data)162 global logChangeTagAlbum1163 logChangeTagAlbum1 = app_data164def saveChangeTagAlbum1():165 main.newChangeTagAlbum(1,file_path,str(logChangeTagAlbum1))166 try: dpg.delete_item('changeTagAlbum1_window')167 except: pass168def onCloseTagAlbum1():169 try: dpg.delete_item('changeTagAlbum1_window')170 except: pass171## Song 1172def callbackChangeTagSong1():173 try: dpg.delete_item('changeTagSong1_window')174 except: pass175 with dpg.window(label='Edit Tag: Song - ID3v1', pos=(300,200), tag='changeTagSong1_window', width=250, on_close=onCloseTagSong1):176 dpg.add_text(f'Current Value: '+main.getTag(file_path, 'song', 1))177 with dpg.group(horizontal=True):178 dpg.add_input_text(hint='New Value', tab_input=True, callback=loggerChangeTagSong1)179 dpg.add_button(label='Save', callback=saveChangeTagSong1)180def loggerChangeTagSong1(sender, app_data, user_data):181 print(app_data)182 global logChangeTagSong1183 logChangeTagSong1 = app_data184def saveChangeTagSong1():185 main.newChangeTagSong(1,file_path,str(logChangeTagSong1))186 try: dpg.delete_item('changeTagSong1_window')187 except: pass188def onCloseTagSong1():189 try: dpg.delete_item('changeTagSong1_window')190 except: pass191## Track 1192def callbackChangeTagTrack1():193 try: dpg.delete_item('changeTagTrack1_window')194 except: pass195 with dpg.window(label='Edit Tag: Track - ID3v1', pos=(300,200), tag='changeTagTrack1_window', width=280, on_close=onCloseTagTrack1):196 dpg.add_text(f'Current Value: '+main.getTag(file_path, 'track', 1))197 with dpg.group(horizontal=True):198 dpg.add_input_text(hint='New Value (Only Integers)', tab_input=True, callback=loggerChangeTagTrack1, no_spaces=True, decimal=True)199 dpg.add_button(label='Save', callback=saveChangeTagTrack1)200def loggerChangeTagTrack1(sender, app_data, user_data):201 print(app_data)202 global logChangeTagTrack1203 try: logChangeTagTrack1 = int(app_data)204 except: logChangeTagTrack1 = app_data205def saveChangeTagTrack1():206 main.newChangeTagTrack(1,file_path,str(logChangeTagTrack1))207 try: dpg.delete_item('changeTagTrack1_window')208 except: pass209def onCloseTagTrack1():210 try: dpg.delete_item('changeTagTrack1_window')211 except: pass212## Comment 1213def callbackChangeTagComment1():214 try: dpg.delete_item('changeTagComment1_window')215 except: pass216 with dpg.window(label='Edit Tag: Comment - ID3v1', pos=(300,200), tag='changeTagComment1_window', width=250, on_close=onCloseTagComment1):217 dpg.add_text(f'Current Value: '+main.getTag(file_path, 'comment', 1))218 with dpg.group(horizontal=True):219 dpg.add_input_text(hint='New Value', tab_input=True, callback=loggerChangeTagComment1)220 dpg.add_button(label='Save', callback=saveChangeTagComment1)221def loggerChangeTagComment1(sender, app_data, user_data):222 print(app_data)223 global logChangeTagComment1224 logChangeTagComment1 = app_data225def saveChangeTagComment1():226 main.newChangeTagComment(1,file_path,str(logChangeTagComment1))227 try: dpg.delete_item('changeTagComment1_window')228 except: pass229def onCloseTagComment1():230 try: dpg.delete_item('changeTagComment1_window')231 except: pass232## Year 1233def callbackChangeTagYear1():234 try: dpg.delete_item('changeTagYear1_window')235 except: pass236 with dpg.window(label='Edit Tag: Year - ID3v1', pos=(300,200), tag='changeTagYear1_window', width=325, on_close=onCloseTagYear1):237 dpg.add_text(f'Current Value: '+main.getTag(file_path, 'year', 1))238 with dpg.group(horizontal=True):239 dpg.add_input_text(hint='New Value (max. 4 Characters)', tab_input=True, callback=loggerChangeTagYear1, )240 dpg.add_button(label='Save', callback=saveChangeTagYear1)241def loggerChangeTagYear1(sender, app_data, user_data):242 print(app_data)243 global logChangeTagYear1244 logChangeTagYear1 = app_data245def saveChangeTagYear1():246 main.newChangeTagYear(1,file_path,str(logChangeTagYear1))247 try: dpg.delete_item('changeTagYear1_window')248 except: pass249def onCloseTagYear1():250 try: dpg.delete_item('changeTagYear1_window')251 except: pass252## Genre 1253def callbackChangeTagGenre1():254 try: dpg.delete_item('changeTagGenre1_window')255 except: pass256 with dpg.window(label='Edit Tag: Genre - ID3v1', pos=(300,200), tag='changeTagGenre1_window', width=420, on_close=onCloseTagGenre1):257 dpg.add_text(f'Current Value: '+main.getTag(file_path, 'genre', 1))258 with dpg.group(horizontal=True):259 dpg.add_input_text(hint='New Value (Only Numbers from 0 to 255)', tab_input=True, callback=loggerChangeTagGenre1, no_spaces=True, decimal=True)260 dpg.add_button(label='Save', callback=saveChangeTagGenre1)261def loggerChangeTagGenre1(sender, app_data, user_data):262 print(app_data)263 global logChangeTagGenre1264 try: logChangeTagGenre1 = int(app_data)265 except: logChangeTagGenre1 = app_data266def saveChangeTagGenre1():267 main.newChangeTagGenre(1,file_path,str(logChangeTagGenre1))268 try: dpg.delete_item('changeTagGenre1_window')269 except: pass270def onCloseTagGenre1():271 try: dpg.delete_item('changeTagGenre1_window')272 except: pass273## Artist 2274def callbackChangeTagArtist2():275 try: dpg.delete_item('changeTagArtist2_window')276 except: pass277 with dpg.window(label='Edit Tag: Artist - ID3v2', pos=(300,200), tag='changeTagArtist2_window', width=250, on_close=onCloseTagArtist2):278 dpg.add_text(f'Current Value: '+main.getTag(file_path, 'artist', 2))279 with dpg.group(horizontal=True):280 dpg.add_input_text(hint='New Value', tab_input=True, callback=loggerChangeTagArtist2)281 dpg.add_button(label='Save', callback=saveChangeTagArtist2)282def loggerChangeTagArtist2(sender, app_data, user_data):283 print(app_data)284 global logChangeTagArtist2285 logChangeTagArtist2 = app_data286def saveChangeTagArtist2():287 main.newChangeTagArtist(2,file_path,str(logChangeTagArtist2))288 try: dpg.delete_item('changeTagArtist2_window')289 except: pass290def onCloseTagArtist2():291 try: dpg.delete_item('changeTagArtist2_window')292 except: pass293## Album 2294def callbackChangeTagAlbum2():295 try: dpg.delete_item('changeTagAlbum2_window')296 except: pass297 with dpg.window(label='Edit Tag: Album - ID3v2', pos=(300,200), tag='changeTagAlbum2_window', width=250, on_close=onCloseTagAlbum2):298 dpg.add_text(f'Current Value: '+main.getTag(file_path, 'album', 2))299 with dpg.group(horizontal=True):300 dpg.add_input_text(hint='New Value', tab_input=True, callback=loggerChangeTagAlbum2)301 dpg.add_button(label='Save', callback=saveChangeTagAlbum2)302def loggerChangeTagAlbum2(sender, app_data, user_data):303 print(app_data)304 global logChangeTagAlbum2305 logChangeTagAlbum2 = app_data306def saveChangeTagAlbum2():307 main.newChangeTagAlbum(2,file_path,str(logChangeTagAlbum2))308 try: dpg.delete_item('changeTagAlbum2_window')309 except: pass310def onCloseTagAlbum2():311 try: dpg.delete_item('changeTagAlbum2_window')312 except: pass313## Song 2314def callbackChangeTagSong2():315 try: dpg.delete_item('changeTagSong2_window')316 except: pass317 with dpg.window(label='Edit Tag: Song - ID3v2', pos=(300,200), tag='changeTagSong2_window', width=250, on_close=onCloseTagSong2):318 dpg.add_text(f'Current Value: '+main.getTag(file_path, 'song', 2))319 with dpg.group(horizontal=True):320 dpg.add_input_text(hint='New Value', tab_input=True, callback=loggerChangeTagSong2)321 dpg.add_button(label='Save', callback=saveChangeTagSong2)322def loggerChangeTagSong2(sender, app_data, user_data):323 print(app_data)324 global logChangeTagSong2325 logChangeTagSong2 = app_data326def saveChangeTagSong2():327 main.newChangeTagSong(2,file_path,str(logChangeTagSong2))328 try: dpg.delete_item('changeTagSong2_window')329 except: pass330def onCloseTagSong2():331 try: dpg.delete_item('changeTagSong2_window')332 except: pass333## Track 2334def callbackChangeTagTrack2():335 try: dpg.delete_item('changeTagTrack2_window')336 except: pass337 with dpg.window(label='Edit Tag: Track - ID3v2', pos=(300,200), tag='changeTagTrack2_window', width=280, on_close=onCloseTagTrack2):338 dpg.add_text(f'Current Value: '+main.getTag(file_path, 'track', 2))339 with dpg.group(horizontal=True):340 dpg.add_input_text(hint='New Value (Only Integers)', tab_input=True, callback=loggerChangeTagTrack2, no_spaces=True, decimal=True)341 dpg.add_button(label='Save', callback=saveChangeTagTrack2)342def loggerChangeTagTrack2(sender, app_data, user_data):343 print(app_data)344 global logChangeTagTrack2345 try: logChangeTagTrack2 = int(app_data)346 except: logChangeTagTrack2 = app_data347def saveChangeTagTrack2():348 main.newChangeTagTrack(2,file_path,str(logChangeTagTrack2))349 try: dpg.delete_item('changeTagTrack2_window')350 except: pass351def onCloseTagTrack2():352 try: dpg.delete_item('changeTagTrack2_window')353 except: pass354## Comment 2355def callbackChangeTagComment2():356 try: dpg.delete_item('changeTagComment2_window')357 except: pass358 with dpg.window(label='Edit Tag: Comment - ID3v2', pos=(300,200), tag='changeTagComment2_window', width=250, on_close=onCloseTagComment2):359 dpg.add_text(f'Current Value: '+main.getTag(file_path, 'comment', 2))360 with dpg.group(horizontal=True):361 dpg.add_input_text(hint='New Value', tab_input=True, callback=loggerChangeTagComment2)362 dpg.add_button(label='Save', callback=saveChangeTagComment2)363def loggerChangeTagComment2(sender, app_data, user_data):364 print(app_data)365 global logChangeTagComment2366 logChangeTagComment2 = app_data367def saveChangeTagComment2():368 main.newChangeTagComment(2,file_path,str(logChangeTagComment2))369 try: dpg.delete_item('changeTagComment2_window')370 except: pass371def onCloseTagComment2():372 try: dpg.delete_item('changeTagComment2_window')373 except: pass374## Year 2375def callbackChangeTagYear2():376 try: dpg.delete_item('changeTagYear2_window')377 except: pass378 with dpg.window(label='Edit Tag: Year - ID3v2', pos=(300,200), tag='changeTagYear2_window', width=325, on_close=onCloseTagYear2):379 dpg.add_text(f'Current Value: '+main.getTag(file_path, 'year', 2))380 with dpg.group(horizontal=True):381 dpg.add_input_text(hint='New Value (max. 4 Characters)', tab_input=True, callback=loggerChangeTagYear2, )382 dpg.add_button(label='Save', callback=saveChangeTagYear2)383def loggerChangeTagYear2(sender, app_data, user_data):384 print(app_data)385 global logChangeTagYear2386 logChangeTagYear2 = app_data387def saveChangeTagYear2():388 main.newChangeTagYear(2,file_path,str(logChangeTagYear2))389 try: dpg.delete_item('changeTagYear2_window')390 except: pass391def onCloseTagYear2():392 try: dpg.delete_item('changeTagYear2_window')393 except: pass394## Genre 2395def callbackChangeTagGenre2():396 try: dpg.delete_item('changeTagGenre2_window')397 except: pass398 with dpg.window(label='Edit Tag: Genre - ID3v2', pos=(300,200), tag='changeTagGenre2_window', width=420, on_close=onCloseTagGenre2):399 dpg.add_text(f'Current Value: '+main.getTag(file_path, 'genre', 2))400 with dpg.group(horizontal=True):401 dpg.add_input_text(hint='New Value (Only Numbers from 0 to 255)', tab_input=True, callback=loggerChangeTagGenre2, no_spaces=True, decimal=True)402 dpg.add_button(label='Save', callback=saveChangeTagGenre2)403def loggerChangeTagGenre2(sender, app_data, user_data):404 print(app_data)405 global logChangeTagGenre2406 try: logChangeTagGenre2 = int(app_data)407 except: logChangeTagGenre2 = app_data408def saveChangeTagGenre2():409 main.newChangeTagGenre(2,file_path,str(logChangeTagGenre2))410 try: dpg.delete_item('changeTagGenre2_window')411 except: pass412def onCloseTagGenre2():413 try: dpg.delete_item('changeTagGenre2_window')414 except: pass415## Band 2416def callbackChangeTagBand2():417 try: dpg.delete_item('changeTagBand2_window')418 except: pass419 with dpg.window(label='Edit Tag: Band - ID3v2', pos=(300,200), tag='changeTagBand2_window', width=420, on_close=onCloseTagBand2):420 dpg.add_text(f'Current Value: '+main.getTag(file_path, 'band', 2))421 with dpg.group(horizontal=True):422 dpg.add_input_text(hint='New Value (Only Numbers from 0 to 255)', tab_input=True, callback=loggerChangeTagBand2)423 dpg.add_button(label='Save', callback=saveChangeTagBand2)424def loggerChangeTagBand2(sender, app_data, user_data):425 print(app_data)426 global logChangeTagBand2427 try: logChangeTagBand2 = int(app_data)428 except: logChangeTagBand2 = app_data429def saveChangeTagBand2():430 main.newChangeTagBand(2,file_path,str(logChangeTagBand2))431 try: dpg.delete_item('changeTagBand2_window')432 except: pass433def onCloseTagBand2():434 try: dpg.delete_item('changeTagBand2_window')435 except: pass436## Composer 2437def callbackChangeTagComposer2():438 try: dpg.delete_item('changeTagComposer2_window')439 except: pass440 with dpg.window(label='Edit Tag: Composer - ID3v2', pos=(300,200), tag='changeTagComposer2_window', width=420, on_close=onCloseTagComposer2):441 dpg.add_text(f'Current Value: '+main.getTag(file_path, 'composer', 2))442 with dpg.group(horizontal=True):443 dpg.add_input_text(hint='New Value (Only Numbers from 0 to 255)', tab_input=True, callback=loggerChangeTagComposer2)444 dpg.add_button(label='Save', callback=saveChangeTagComposer2)445def loggerChangeTagComposer2(sender, app_data, user_data):446 print(app_data)447 global logChangeTagComposer2448 try: logChangeTagComposer2 = int(app_data)449 except: logChangeTagComposer2 = app_data450def saveChangeTagComposer2():451 main.newChangeTagComposer(2,file_path,str(logChangeTagComposer2))452 try: dpg.delete_item('changeTagComposer2_window')453 except: pass454def onCloseTagComposer2():455 try: dpg.delete_item('changeTagComposer2_window')456 except: pass457## Copyright 2458def callbackChangeTagCopyright2():459 try: dpg.delete_item('changeTagCopyright2_window')460 except: pass461 with dpg.window(label='Edit Tag: Copyright - ID3v2', pos=(300,200), tag='changeTagCopyright2_window', width=420, on_close=onCloseTagCopyright2):462 dpg.add_text(f'Current Value: '+main.getTag(file_path, 'copyright', 2))463 with dpg.group(horizontal=True):464 dpg.add_input_text(hint='New Value (Only Numbers from 0 to 255)', tab_input=True, callback=loggerChangeTagCopyright2)465 dpg.add_button(label='Save', callback=saveChangeTagCopyright2)466def loggerChangeTagCopyright2(sender, app_data, user_data):467 print(app_data)468 global logChangeTagCopyright2469 try: logChangeTagCopyright2 = int(app_data)470 except: logChangeTagCopyright2 = app_data471def saveChangeTagCopyright2():472 main.newChangeTagCopyright(2,file_path,str(logChangeTagCopyright2))473 try: dpg.delete_item('changeTagCopyright2_window')474 except: pass475def onCloseTagCopyright2():476 try: dpg.delete_item('changeTagCopyright2_window')477 except: pass478## URL 2479def callbackChangeTagURL2():480 try: dpg.delete_item('changeTagURL2_window')481 except: pass482 with dpg.window(label='Edit Tag: URL - ID3v2', pos=(300,200), tag='changeTagURL2_window', width=420, on_close=onCloseTagURL2):483 dpg.add_text(f'Current Value: '+main.getTag(file_path, 'url', 2))484 with dpg.group(horizontal=True):485 dpg.add_input_text(hint='New Value (Only Numbers from 0 to 255)', tab_input=True, callback=loggerChangeTagURL2)486 dpg.add_button(label='Save', callback=saveChangeTagURL2)487def loggerChangeTagURL2(sender, app_data, user_data):488 print(app_data)489 global logChangeTagURL2490 try: logChangeTagURL2 = int(app_data)491 except: logChangeTagURL2 = app_data492def saveChangeTagURL2():493 main.newChangeTagURL(2,file_path,str(logChangeTagURL2))494 try: dpg.delete_item('changeTagURL2_window')495 except: pass496def onCloseTagURL2():497 try: dpg.delete_item('changeTagURL2_window')498 except: pass499## Publisher 2500def callbackChangeTagPublisher2():501 try: dpg.delete_item('changeTagPublisher2_window')502 except: pass503 with dpg.window(label='Edit Tag: Publisher - ID3v2', pos=(300,200), tag='changeTagPublisher2_window', width=420, on_close=onCloseTagPublisher2):504 dpg.add_text(f'Current Value: '+main.getTag(file_path, 'publisher', 2))505 with dpg.group(horizontal=True):506 dpg.add_input_text(hint='New Value (Only Numbers from 0 to 255)', tab_input=True, callback=loggerChangeTagPublisher2)507 dpg.add_button(label='Save', callback=saveChangeTagPublisher2)508def loggerChangeTagPublisher2(sender, app_data, user_data):509 print(app_data)510 global logChangeTagPublisher2511 try: logChangeTagPublisher2 = int(app_data)512 except: logChangeTagPublisher2 = app_data513def saveChangeTagPublisher2():514 main.newChangeTagPublisher(2,file_path,str(logChangeTagPublisher2))515 try: dpg.delete_item('changeTagPublisher2_window')516 except: pass517def onCloseTagPublisher2():518 try: dpg.delete_item('changeTagPublisher2_window')519 except: pass520## Image 2521def callbackChangeTagImage2():522 try: dpg.delete_item(item='changeTagImage2_window'); dpg.delete_item(item='image')523 except: pass524 with dpg.window(label='Edit Tag: Image', pos=(300,200), tag='changeTagImage2_window', on_close=onCloseTagImage2, autosize=True):525 width, height, channels, data = dpg.load_image(main.getImage(file_path, main.get_random_string(16)+'.jpg'))526 with dpg.texture_registry():527 texture_id = dpg.add_static_texture(width, height, data)528 529 dpg.add_image(texture_id)530def onCloseTagImage2():531 try: dpg.delete_item(item='changeTagImage2_window'); dpg.delete_item(item='image')532 except: pass533def callbackShowLicence():534 print('callbackShowLicence')535 webbrowser.open('https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode')536def callbackShowAbout():537 print('callbackShowAbout')538 with dpg.window(label='About', pos=(300,200)): 539 dpg.add_text('© Lion Dannhorn - All Rights Reserved')540def callbackExit():541 print('callbackExit')542 time.sleep(0.05)543 quit()544def messageBox(title, text):545 print('callbackMessageBox')...
database.py
Source:database.py
...160161 drop_item(item_id, item_name, compartment, x_pos, height, stock)162163164def delete_item(item_id, item_name, compartment, x_pos, height, stock):165 conn = sqlite3.connect('sqlite_test.db')166 cursor = conn.cursor()167168 delete_item = '''DELETE FROM TEST1 WHERE Item_ID= '''169 delete_item = delete_item + str(item_id)170 delete_item = delete_item + ''' AND Item_Name= "'''171 delete_item = delete_item + item_name172 delete_item = delete_item + '''" AND Compartment= "'''173 delete_item = delete_item + compartment174 delete_item = delete_item + '''" AND X_Pos= '''175 delete_item = delete_item + str(x_pos)176 delete_item = delete_item + ''' AND Height= '''177 delete_item = delete_item + str(height)178 delete_item = delete_item + ''' AND Stock= '''
...
pipelines.py
Source:pipelines.py
1from scrapy import log2import json3import codecs4from apple3.models import Person5a=[]6class JsonWithEncodingPipeline(object):7 def __init__(self):8 self.file = codecs.open('aqaq.json', 'w', encoding='utf-8')9 def process_item(self, item, spider):10 if item['title']:11 a.append(item['title']) 12 delete_item=Person.objects.filter(title=item['title'])13 if delete_item:14 delete_item=delete_item[0]15 delete_item.cost=item['cost']16 delete_item.size=item['size']17 delete_item.color=item['color']18 delete_item.fit=item['fit']19 delete_item.fabric=item['fabric']20 delete_item.save()21 else:22 item.save()23# k=Person.objects.filter(advertiser=item['advertiser'])24# for i in k:25# if i.title not in a:26# i.delete()27#delete_item.delete()28 def spider_closed(self, spider):29 delete_item=Person.objects.filter(advertiser='bloomingdale')30 for i in delete_item:31 if i not in a:32 i.delete()...
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!!