How to use scrollup method in pyatom

Best Python code snippet using pyatom_python

ComicVisorGui.py

Source:ComicVisorGui.py Github

copy

Full Screen

1import zipfile2from tkinter import *3from PIL import Image, ImageTk4from tkinter import Tk,ttk5from tkinter import filedialog6import Entidades.Init7from Entidades.ComicBooks.ComicBook import ComicBook8from Entidades.ComicBooks.ComicBookDetail import ComicBookDetails9class ComicVisorGui(Toplevel):10 def __init__(self,master,comicBook=None, session = None,cnf={},**kw):11 Toplevel.__init__(self,master,cnf,**kw)12 if session is None:13 self.session = Entidades.Init.Session()14 else:15 self.session = session16 if not comicBook:17 self.comicBook = ComicBook('BabelComics.cbz')18 else:19 self.comicBook = comicBook20 self.idImagen = None21 self.tipoAjuste = IntVar()22 self.tipoAjuste.set(3)23 self.title('Babel Comic Visor')24 self.crearMenu()25 self.mainframe = ttk.Frame(self)26 self.scrollbarY = Scrollbar(self.mainframe)27 self.scrollbarX = Scrollbar(self.mainframe)28 self.canvas = Canvas(self.mainframe, yscrollcommand=self.scrollbarY.set, xscrollcommand=self.scrollbarX.set)29 self.comicBook.openCbFile()30 #self.fImage= self.comicBook.getImagePage()31 self.im = self.comicBook.getImagePage()32 self.myimg = ImageTk.PhotoImage(self.im)33 self.contadorFondo = 034 self.cargarPagina()35 self.update()36 self.ajustarAncho()37 ##canvas.create_image(0,0,image=myimg)38 self.canvas.bind('<MouseWheel>', self.scrollupMouse)39 self.bind('<Up>', self.scrollupKeyboard)40 self.bind('<Down>', self.scrollupKeyboard)41 self.bind('<Left>', self.scrollupKeyboard)42 self.bind('<Right>', self.scrollupKeyboard)43 self.bind('<Prior>', self.scrollupKeyboard)44 self.bind('<Next>', self.scrollupKeyboard)45 self.bind('<Key>', self.scrollupKeyboard)46 self.bind('<Key>', self.scrollupKeyboard)47 self.bind('<space >', self.scrollupKeyboard)48 self.scrollbarY.config(command=self.canvas.yview)49 self.scrollbarX.config(command=self.canvas.xview)50 self.bind("<Button-1>",self.click)51 self.canvas.pack(side=BOTTOM, expand=YES, fill=BOTH)52 ##Tener cuidado cuando se hace el pack no se puede hacer en cualquier orden53 self.mainframe.pack(side=BOTTOM, expand=YES, fill=BOTH)54 self.canvas.config(scrollregion=self.canvas.bbox(ALL))55 def click(self,event):56 if (event.x>self.winfo_width()/2):57 event.keycode=11758 self.scrollupKeyboard(event)59 else:60 event.keycode=11261 self.scrollupKeyboard(event)62 print(self.winfo_width())63 print("clicked: "+str(event.x))64 def abrirComic(self):65 global comic,indicePaginaActual,paginas66 cbz = filedialog.askopenfile('r',initialdir='/home/pedro/Descargas/ftp/',filetypes = [("comic","*.cbz")])67 ## cbz = filedialog.askopenfile('r',initialdir='.',filetypes = [("comic","*.cbz")])68 print(cbz)69 if cbz:70 comic = zipfile.ZipFile(cbz.name,'r')71 paginas.clear()72 paginas = [x for x in comic.namelist() if(x[-3:]=='jpg' or x[-3:]=='png')]73 indicePaginaActual=074 self.cargarPagina()75 def salir(self):76 comic.close()77 root.destroy()78 def ajustarAncho(self):79 #global tipoAjuste80 self.tipoAjuste.set(1)81 self.cargarPagina()82 def ajustarAlto(self):83 #global tipoAjuste84 self.tipoAjuste.set(2)85 self.cargarPagina()86 def ajustarNormal(self):87 #global tipoAjuste88 self.tipoAjuste.set(3)89 self.cargarPagina()90 def crearMenu(self):91 #global tipoAjuste92 self.menu = Menu(self)93 self.submenuArchivo = Menu(self.menu, tearoff=0)94 self.submenuArchivo.add_command(label = 'Abrir Comic', command = self.abrirComic, accelerator = 'o')95 self.submenuArchivo.add_command(label = 'Salir', command = self.salir, accelerator = 'q')96 self.submenuImagen = Menu(self.menu, tearoff=0)97 self.submenuImagen.add('radiobutton',variable=self.tipoAjuste,label='ajustar al ancho',command=self.ajustarAncho,accelerator = 'w',value=1)98 self.submenuImagen.add('radiobutton',variable=self.tipoAjuste,label='ajustar al alto',command=self.ajustarAlto,accelerator = 'h',value=2)99 self.submenuImagen.add('radiobutton',variable=self.tipoAjuste,label='tamaño normal',command=self.ajustarNormal,accelerator = 'n',value=3)100 self.menu.add_cascade(label = 'Archivo',menu=self.submenuArchivo)101 self.menu.add_cascade(label = 'Imagen',menu=self.submenuImagen)102 self.config(menu=self.menu)103 def scrollupMouse(self,event):104 self.canvas.yview_scroll(-1*(int)(event.delta/120), "units")105 def scrollupKeyboard(self,event):106 print(event.keycode)107 #si es spacebar108 print(self.scrollbarY.get()[1])109 if((event.keycode== 65 or event.keycode==116) and self.scrollbarY.get()[1]==1):110 print(self.contadorFondo)111 self.contadorFondo+=1112 if self.contadorFondo>2:113 print('cambiamos el event')114 event.keycode = 117115 print('cambiamos el event')116 if (event.keycode== 111)|(event.keycode== 38):117 self.canvas.yview_scroll(-1, "units")118 self.contadorFondo = 0119 elif (event.keycode== 116)|(event.keycode== 40)|(event.keycode== 65):120 self.canvas.yview_scroll(1, "units")121 elif (event.keycode== 113)|(event.keycode== 37):122 self.canvas.xview_scroll(-1, "units")123 self.contadorFondo = 0124 elif (event.keycode== 114)|(event.keycode== 39):125 self.canvas.xview_scroll(1, "units")126 elif (event.keycode == 117)|(event.keycode == 34):127 #pag down128 self.contadorFondo = 0129 self.comicBook.indicePaginaActual+=1130 self.comicBook.goto(self.comicBook.indicePaginaActual)131 self.cargarPagina()132 elif (event.keycode == 112)|(event.keycode == 33):133 # pag up134 self.comicBook.indicePaginaActual-=1135 self.comicBook.goto(self.comicBook.indicePaginaActual)136 self.cargarPagina()137 ## q Key normal138 elif (event.keysym == 'q'):139 self.salir()140 ## w Key ancho141 elif (event.keysym == 'w'):142 self.ajustarAncho()143 ## h Key altura144 elif (event.keysym == 'h'):145 self.ajustarAlto()146 ## n Key quit147 elif (event.keysym == 'n'):148 self.ajustarNormal()149 ## o Key open150 elif (event.keysym == 'o'):151 self.abrirComic()152 ## g Key open153 elif (event.keycode == 1):154 print(event.keycode)155 elif (event.keysym == 'c'):156 self.setCover()157 print(event.keysym)158 def setCover(self):159 self.session.query(ComicBookDetails).filter(ComicBookDetails.comicId==self.comicBook.comicId).filter(ComicBookDetails.tipoPagina==ComicBookDetails.COVER).delete()160 self.session.commit()161 comicBookDetail = ComicBookDetails()162 comicBookDetail.comicId = self.comicBook.comicId163 comicBookDetail.indicePagina = self.comicBook.indicePaginaActual164 comicBookDetail.tipoPagina = ComicBookDetails.COVER165 self.session.add(comicBookDetail)166 self.session.commit()167 def cargarPagina(self):168 # global canvas,myimg,idImagen,mainframe169 alturaImagen=anchoImagen=0170 self.canvas.update()171 self.alturaFrame=self.winfo_height()172 self.anchoFrame=self.winfo_width()173 print('indice pagina:',self.comicBook.indicePaginaActual)174 fImage = self.comicBook.getImagePage()175 im = self.comicBook.getImagePage()176 tasa = 1177 if (self.tipoAjuste.get()==2):178 tasa= self.alturaFrame/im.height179 elif (self.tipoAjuste.get()==1):180 tasa= self.anchoFrame/im.width181 elif (self.tipoAjuste.get()==3):182 tasa=1183 size = (int)(im.width*tasa),(int)(im.height*tasa)184 im=im.resize(size,Image.BICUBIC)185 self.myimg = ImageTk.PhotoImage(im)186 if self.idImagen:187 self.canvas.delete(self.idImagen)188 self.idImagen = self.canvas.create_image(0,0,image=self.myimg,anchor=CENTER)189 ##cuidado cuando seteamos esto. Si lo ponemodes despues de cargar una imagen,190 ##es como que el box se fija al tamañio de la imagen191 self.canvas.config(scrollregion=self.canvas.bbox(ALL))192 self.canvas.yview_moveto(0.0)193if __name__=='__main__':194 root = Tk()195 path='E:\\Comics\\All Elseworlds\\Batman Elseworlds\\Batman_ Scar of the Bat V1996 #1 (1996).cbz'196 session = Entidades.Init.Session()197 comicBook = session.query(ComicBook).filter(ComicBook.path==path).first()198 visor = ComicVisorGui(root,comicBook,session=session)199 visor.title = ('Babel Comics Visor')...

Full Screen

Full Screen

toolbox.py

Source:toolbox.py Github

copy

Full Screen

1ICON_SIZE = (16,16)2TOOLBOX_TITLEHEIGHT = 5+FONT_SIZE[1]3TOOLBOX_LINE = (17+TOOLBOX_RADAR[0],6+TOOLBOX_TITLEHEIGHT)4TOOLBOX_LINES = int((TOOLBOX_RADAR[1]-2) / TOOLBOX_LINEHEIGHT)5TOOLBOX_LINEHEIGHT = max(ICON_SIZE[0],FONT_SIZE[1])6TOOLBOX_LINEWIDTH = FONT.size('W' * 15)[0]7TOOLBOX_AMMOWIDTH = FONT.size('999')[0]8TOOLBOX_LINESDIM = (ICON_SIZE[0]+TOOLBOX_LINEWIDTH[0]+TOOLBOX_AMMOWIDTH[0],TOOLBOX_LINEHEIGHT*TOOLBOX_LINES)9TOOLBOX_RADAR = (100,100)10TOOLBOX_DIALLENGTH = 2011TOOLBOX_DIAL = (8+TOOLBOX_DIALLENGTH,12+TOOLBOX_TITLEHEIGHT+TOOLBOX_RADAR[1]+TOOLBOX_DIALLENGTH)12TOOLBOX_DIALWIDTH = FONT.size('90')[0] + 613TOOLBOX_POWERDIM = (40,10)14TOOLBOX_POWER = (20+TOOLBOX_DIAL[0]+TOOLBOX_DIALLENGTH+TOOLBOX_DIALWIDTH,12+TOOLBOX_TITLEHEIGHT+TOOLBOX_RADAR[1]+(TOOLBOX_DIALLENGTH/2)-(TOOLBOX_POWERDIM[1]/2))15TOOLBOX_POWERBAR = (12,TOOLBOX_TITLEHEIGHT+TOOLBOX_LINESIZE*3+1)16TOOLBOX_POWERWIDTH = FONT.size('1000/1000')[0]17TOOLBOX_SCROLBUTTON = (10,10)18TOOLBOX_SCROLLUP = (3+TOOLBOX_LINE[0]+ICON_SIZE[0]+TOOLBOX_LINEWIDTH[0]+TOOLBOX_AMMOWIDTH[0],TOOLBOX_LINE[1]+1)19TOOLBOX_SCROLLDOWN = (TOOLBOX_SCROLLUP[0],TOOLBOX_SCROLLUP[1]+TOOLBOX_LINEHEIGHT*TOOLBOX_LINES-TOOLBOX_SCROLLDIM[1])20TOOLBOX_SCROLL = (TOOLBOX_SCROLLUP[0],TOOLBOX_SCROLLUP[1]+TOOLBOX_SCROLLDIM[1])21TOOLBOX_SCROLLDIM = (TOOLBOX_SCROLLDOWN[0],TOOLBOX_SCROLLDOWN[1]-TOOLBOX_SCROLL[1]-1)22TOOLBOX_SIZE = (9+TOOLBOX_SCROLLUP[0]+TOOLBOX_SCROLLDIM[0],8+TOOLBOX_DIAL[1])23class Toolbox(Object,pygame.Rect):24 def __init__(self, screen, player):25 self.player = player26 self.topweapon = 027 Object.__init__(self, screen, 0, player.toolboxposition, -1, 0, 0)28 self.listbox = pygame.Rect(gwglob.TOOLBOX_LINE,gwglob.TOOLBOX_LINESDIM)29 self.up = pygame.Rect(gwglob.TOOLBOX_SCROLLUP,gwglob.TOOLBOX_SCROLLBUTTON)30 self.down = pygame.Rect(gwglob.TOOLBOX_SCROLLDOWN,gwglob.TOOLBOX_SCROLLBUTTON)31 self.scroll = pygame.Rect(gwglob.TOOLBOX_SCROLL,gwglob.TOOLBOX_SCROLLDIM)32 self.update_static()33 pygame.Rect.__init__(self, list(self.position), gwglob.TOOLBOX_SIZE)34 def click(self, point):35 if self.collidepoint(point):36 if self.listbox.collidepoint(point):37 self.player.weapon = self.topweapon + (point[1]-self.listbox.topleft[1])/gwglob.TOOLBOX_LINEHEIGHT38 return39 if self.up.collidepoint(point):40 self.topweapon = max(0,self.topweapon-1)41 return42 if self.down.collidepoint(point):43 self.topweapon = min(len(self.player.weapons)-3,self.topweapon+1)44 return45 if self.scroll.collidepoint(point):46 self.topweapon = min(len(self.player.weapons)-3,int(len(self.player.weapons) * ((point[1] - self.scroll.topleft[1]) / float(self.scroll.height))))47 return48 return True49 def move(self, position):50 self.position = position51 self.player.toolboxposition = list(position)52 self.topleft = list(position)53 self.listbox.topleft = (self.position[0]+gwglob.TOOLBOX_LINE[0],self.position[1]+gwglob.TOOLBOX_LINE[1])54 self.up.topleft = (self.position[0]+gwglob.TOOLBOX_SCROLLUP[0],self.position[1]+ggwglob.TOOLBOX_SCROLLUP[1])55 self.down.topleft = (self.position[0]+gwglob.TOOLBOX_SCROLLDOWN[0],self.position[1]+gwglob.TOOLBOX_SCROLLDOWN[1])56 self.scroll.topleft = (self.position[0]+gwglob.TOOLBOX_SCROLL[0],self.position[1]+gwglob.TOOLBOX_SCROLL[1])57 def update_static(self, player=None):58 self.player.topweapon = self.topweapon59 if player:60 self.player = player61 if self.player.toolbox:62 self.static = self.player.toolbox63 self.topweapon = self.player.topweapon64 self.move(list(self.player.toolboxposition))65 else:66 self.topweapon = 067 self.static = pygame.Surface(gwglob.TOOLBOX_SIZE)68 self.static.lock()69 self.static.fill(self.player.color)70 pygame.draw.circle(self.static, (0,0,0), gwglob.TOOLBOX_DIAL, 20, 0)71 pygame.draw.rect(self.static, self.player.color, ((gwglob.TOOLBOX_DIAL[0]-gwglob.TOOLBOX_DIALLENGTH,gwglob.TOOLBOX_DIAL[1]),(gwglob.TOOLBOX_DIALLENGTH*2,gwglob.TOOLBOX_DIALLENGTH)), 0)72 pygame.draw.rect(self.static, (0,0,0), ((1,1),(gwglob.TOOLBOX_SIZE[0]-2,gwglob.TOOLBOX_SIZE[1]-2)), 1)73 pygame.draw.line(self.static, (0,0,0), (1,gwglob.TOOLBOX_TITLEHEIGHT), (gwglob.TOOLBOX_SIZE[0]-2,gwglob.TOOLBOX_TITLEHEIGHT), 1)74 pygame.draw.rect(self.static, (0,0,0), ((gwglob.TOOLBOX_POWERBAR[0]-1,gwglob.TOOLBOX_POWERBAR[1]-1),(gwglob.TOOLBOX_POWERDIM[0]+2,gwglob.TOOLBOX_POWERDIM[1]+2)), 0)75 pygame.draw.rect(self.static, (0,0,0), ((gwglob.TOOLBOX_LINE[0]-1,gwglob.TOOLBOX_LINE[1]-1),(gwglob.TOOLBOX_LINESDIM[0]+gwglob.TOOLBOX_SCROLLBUTTON[0]+2,gwglob.TOOLBOX_LINESDIM[0]+2)), 1)76 # pygame.draw.rect(self.static, (0,0,0), ((gwglob.TOOLBOX_SIZE[0]-24,gwglob.TOOLBOX_TITLEHEIGHT+11),(12,gwglob.TOOLBOX_LINESIZE*3+2)), 1)77 # pygame.draw.rect(self.static, (0,0,0), ((gwglob.TOOLBOX_SIZE[0]-24,gwglob.TOOLBOX_TITLEHEIGHT+22),(12,gwglob.TOOLBOX_LINESIZE*3-20)), 0)78 self.static.unlock()79 self.static.blit(gwglob.FONT.render(self.player.name, gwglob.ANTI_ALIAS, (0,0,0), self.player.color), (3,3))80 self.player.toolbox = self.static81 self.move([gwglob.SIZE[0]-50-gwglob.TOOLBOX_SIZE[0],50])82 def draw(self):83 self.screen.screen.blit(self.static, self.position)84 # v = Vector(magnitude=20, angle=self.player.aiming-pi/2.0)85 # dial = (gwglob.TOOLBOX_DIAL[0]+self.position[0],gwglob.TOOLBOX_DIAL[1]+self.position[1])86 # pygame.draw.line(self.screen.screen, (255,255,255), dial, v.project(dial))87 # size = gwglob.FONT.size('%d' % degrees(self.player.aiming))88 # degree = (dial[0]+25,dial[1]-10-gwglob.FONT_SIZE[1]/2)89 # self.screen.screen.blit(gwglob.FONT.render('%d' % degrees(self.player.aiming), gwglob.ANTI_ALIAS, (0,0,0), self.player.color), degree)90 # pygame.draw.circle(self.screen.screen, (0,0,0), (degree[0]+size[0]+3,degree[1]+3), 2, 1)91 # powerbar = (gwglob.TOOLBOX_POWERBAR[0]+1+self.position[0],gwglob.TOOLBOX_POWERBAR[1]+1+self.position[1])92 # power,maxpower = int(38 * (self.player.power / gwglob.PLAYER_MAXPOWER)),int(38 * (self.player.maxpower / gwglob.PLAYER_MAXPOWER))93 # if power < maxpower:94 # pygame.draw.rect(self.screen.screen, self.player.color, (powerbar, (maxpower,8)), 1)95 # pygame.draw.rect(self.screen.screen, self.player.color, (powerbar, (power,8)), 0)96 # self.screen.screen.blit(gwglob.FONT.render('%d/%d' % (self.player.power,self.player.maxpower), gwglob.ANTI_ALIAS, (0,0,0), self.player.color), (powerbar[0]+45,powerbar[1]+4-gwglob.FONT_SIZE[1]/2))97 # if len(self.player.weapons) > 3:98 # n = gwglob.TOOLBOX_SCROLLHEIGHT / float(len(self.player.weapons))99 # pygame.draw.rect(self.screen.screen, self.player.color, ((self.position[0]+gwglob.TOOLBOX_SIZE[0]-23,self.position[1]+gwglob.TOOLBOX_TITLEHEIGHT+23+n*self.topweapon),(10,n*3)), 0)100 # for n,d in enumerate(zip(self.player.weapons[self.topweapon:self.topweapon+3],self.player.ammo[self.topweapon:self.topweapon+3])):101 # w,a = d102 # h = gwglob.FONT.size(str(a))[0]103 # p = (gwglob.TOOLBOX_WEAPONS[0]+self.position[0]+1,gwglob.TOOLBOX_WEAPONS[1]+self.position[1]+1+gwglob.TOOLBOX_LINESIZE*n)104 # self.screen.screen.blit(weapons[w][0].icon, p)105 # self.screen.screen.blit(weapons[w][2], (p[0]+17,p[1]), ((0,0),(gwglob.TOOLBOX_WEAPONS_WIDTH-3-h,p[1])))106 # self.screen.screen.blit(gwglob.FONT.render(str(a), gwglob.ANTI_ALIAS, (0,0,0)), (p[0]+gwglob.TOOLBOX_WEAPONS_WIDTH-3-h,p[1]))107 # if self.topweapon + n == self.player.weapon:...

Full Screen

Full Screen

smooth-scroll-up.js

Source:smooth-scroll-up.js Github

copy

Full Screen

1jQuery(document).ready(2 function($){3 jQuery('#scrollup_upload_image_preview').attr('src', jQuery('#scrollup_upload_image').val());4 if(jQuery('#scrollup_type').val()=="image") {5 jQuery('#scrollup_custom_image_section').parent().parent().show();6 jQuery('#scrollup_custom_text_section').parent().parent().hide();7 jQuery('.scrollup_custom_icon_section').parent().parent().hide();8 }9 else if(jQuery('#scrollup_type').val()=="icon") {10 jQuery('#scrollup_custom_image_section').parent().parent().hide();11 jQuery('#scrollup_custom_text_section').parent().parent().hide();12 jQuery('.scrollup_custom_icon_section').parent().parent().show();13 }14 else{15 jQuery('#scrollup_custom_image_section').parent().parent().hide();16 jQuery('#scrollup_custom_text_section').parent().parent().show();17 jQuery('.scrollup_custom_icon_section').parent().parent().hide();18 }19 $('#scrollup_custom_icon_button').click(function() {20 $('#scrollup_custom_icon_dialog').dialog({21 title: 'Select Icon',22 modal: true,23 width: 800,24 height: 40025 });26 return false;27 });28 $('.scrollup-custom-icon-list-icon').click(function() {29 jQuery('#scrollup_custom_icon').attr('value', $(this).attr('name'));30 jQuery('#scrollup_custom_icon_preview').attr('class', 'fa ' + jQuery( "#scrollup_custom_icon" ).val() +' ' + jQuery( "#scrollup_custom_icon_size option:selected" ).val());31 $('#scrollup_custom_icon_dialog').dialog('close')32 return false;33 });34 jQuery('#scrollup_type').change(35 function(){36 var i= jQuery('#scrollup_type').val();37 if(i=="image") {38 jQuery('#scrollup_custom_image_section').parent().parent().fadeIn(100);39 jQuery('#scrollup_custom_text_section').parent().parent().fadeOut(100);40 jQuery('.scrollup_custom_icon_section').parent().parent().fadeOut(100);41 }42 else if(i=="icon") {43 jQuery('#scrollup_custom_image_section').parent().parent().fadeOut(100);44 jQuery('#scrollup_custom_text_section').parent().parent().fadeOut(100);45 jQuery('.scrollup_custom_icon_section').parent().parent().fadeIn(100);46 }47 else48 {49 jQuery('#scrollup_custom_image_section').parent().parent().fadeOut(100);50 jQuery('#scrollup_custom_text_section').parent().parent().fadeIn(100);51 jQuery('.scrollup_custom_icon_section').parent().parent().fadeOut(100);52 }53 }54 );55 jQuery('#scrollup_custom_icon_size').change(56 function(){57 jQuery('#scrollup_custom_icon_preview').attr('class', 'fa ' + jQuery( "#scrollup_custom_icon" ).val() +' ' + jQuery( "#scrollup_custom_icon_size option:selected" ).val());58 }59 );60 61 jQuery('.scrollup_upload_image_button').click(62 function(e) {63 e.preventDefault();64 var image = wp.media(65 { 66 title: 'Upload Image',67 // mutiple: true if you want to upload multiple files at once68 multiple: false69 }70 ).open()71 .on(72 'select', function(e){73 // This will return the selected image from the Media Uploader, the result is an object74 var uploaded_image = image.state().get('selection').first();75 // We convert uploaded_image to a JSON object to make accessing it easier76 var image_url = uploaded_image.toJSON().url;77 // Let's assign the url value to the input field78 jQuery('#scrollup_upload_image').val(image_url);79 jQuery('#scrollup_upload_image_preview').attr('src', image_url);80 }81 );82 }83 );84 }...

Full Screen

Full Screen

gwglob.py

Source:gwglob.py Github

copy

Full Screen

1import pygame,os2BASE_DIR = os.path.abspath(os.path.dirname(__file__))3try:4 SETTINGS = eval(file(os.path.join(BASE_DIR,'settings.txt'), 'r').read().strip().replace('\n',''))5except IOError, e:6 if e.args[0] == 2:7 SETTINGS = {}8 else:9 raise10VERSION = (0,-1,-5)11LONG_VERSION = 'v%s.%s.%s' % VERSION12SIZE = (800,600)13MOVE_SIZE = 5014SCREEN_RECT = pygame.Rect((0,0),SIZE)15FULLSCREEN = True16FONT = pygame.font.Font(None,16)17MID_FONT = pygame.font.Font(None,24)18BIG_FONT = pygame.font.Font(None,32)19FONT_SIZE = FONT.size(''.join([chr(x) for x in range(256)]))20MID_FONT_SIZE = MID_FONT.size(''.join([chr(x) for x in range(256)]))21BIG_FONT_SIZE = BIG_FONT.size(''.join([chr(x) for x in range(256)]))22ANTI_ALIAS = True23CACHE_IMAGES = True24REPEAT_DELAY = 10025REPEAT_INTERVAL = 1026FPS_MAX = 3027CLOCK = pygame.time.Clock()28GRAV_CONST = 3.347529MASS_MAX = 75030MASS_HABITABLE = 60031EXPLOSION_RANGE = (0.16666666666666666,0)32PARTICLES = 10033PARTICLE_AMOUNTS = {34 'debry':10,35 'star fields':2,36 'stars per field':100,37}38def particles(type):39 return int(PARTICLE_AMOUNTS[type] * (PARTICLES / 100.0))40DEBRY_LIFE = 15.041STAR_COLORS = [42 (255,255,255),43 (255,255,0),44 (255,200,200),45 (200,255,255),46 (150,150,150)47]48PLAYER_MAX = 849PLAYER_MAXNAME = 1550PLAYER_MAXPOWER = 1000.051PLAYER_COLORS = [52 (255,0,0),53 (0,0,255),54 (0,255,0),55 (255,255,0),56 (0,255,255),57 (255,255,255),58 (255,0,255),59 (128,0,255),60 (192,192,192),61 (128,64,0),62]63PLAYER = [(0,-7),(5,-7),(8,-4),(8,4),(5,7),(0,7)]64PLAYER_TURRET_BASE = (8,0)65SHOT_VELOCITY = 1566SHOT_OUTSIDE_LIFE = 25067# TOOLBOX_TITLEHEIGHT = 5+FONT_SIZE[1]68# TOOLBOX_LINESIZE = max(16,FONT_SIZE[1])69# TOOLBOX_SIZE = [200+FONT.size('1000/1000')[0],24+TOOLBOX_TITLEHEIGHT+TOOLBOX_LINESIZE*3]70# TOOLBOX_WEAPONS = (TOOLBOX_SIZE[0]-138,TOOLBOX_TITLEHEIGHT+11)71# TOOLBOX_WEAPONS_WIDTH = 11572# TOOLBOX_DIAL = (32,TOOLBOX_TITLEHEIGHT+31)73# TOOLBOX_POWERBAR = (12,TOOLBOX_TITLEHEIGHT+TOOLBOX_LINESIZE*3+1)74# TOOLBOX_SCROLLHEIGHT = TOOLBOX_LINESIZE*3-2275# ICON_SIZE = (16,16)76ICON_SIZE = (16,16)77TOOLBOX_TITLEHEIGHT = 5+FONT_SIZE[1]78TOOLBOX_RADAR = (8,TOOLBOX_TITLEHEIGHT+6)79TOOLBOX_RADARDIM = (100,100)80TOOLBOX_LINE = (17+TOOLBOX_RADARDIM[0],7+TOOLBOX_TITLEHEIGHT)81TOOLBOX_LINEHEIGHT = max(ICON_SIZE[1],FONT_SIZE[1])82TOOLBOX_LINES = int((TOOLBOX_RADARDIM[1]-2) / TOOLBOX_LINEHEIGHT)83TOOLBOX_LINEWIDTH = FONT.size('W' * 15)[0]84TOOLBOX_AMMOWIDTH = FONT.size('999')[0]85TOOLBOX_LINESDIM = (ICON_SIZE[0]+TOOLBOX_LINEWIDTH+TOOLBOX_AMMOWIDTH,TOOLBOX_LINEHEIGHT*TOOLBOX_LINES)86TOOLBOX_DIALLENGTH = 2087TOOLBOX_DIAL = (8+TOOLBOX_DIALLENGTH,12+TOOLBOX_TITLEHEIGHT+TOOLBOX_RADARDIM[1]+TOOLBOX_DIALLENGTH)88TOOLBOX_DIALTEXT = (5+TOOLBOX_DIAL[0]+TOOLBOX_DIALLENGTH,TOOLBOX_DIAL[1]-TOOLBOX_DIALLENGTH/2-FONT_SIZE[1]/2)89TOOLBOX_DIALWIDTH = FONT.size('90')[0] + 690TOOLBOX_POWERDIM = (40,10)91TOOLBOX_POWER = (20+TOOLBOX_DIAL[0]+TOOLBOX_DIALLENGTH+TOOLBOX_DIALWIDTH,12+TOOLBOX_TITLEHEIGHT+TOOLBOX_RADARDIM[1]+(TOOLBOX_DIALLENGTH/2)-(TOOLBOX_POWERDIM[1]/2))92TOOLBOX_POWERTEXT = (TOOLBOX_POWER[0]+TOOLBOX_POWERDIM[0]+5,12+TOOLBOX_TITLEHEIGHT+TOOLBOX_RADARDIM[1]+(TOOLBOX_DIALLENGTH/2)-(FONT_SIZE[1]/2))93TOOLBOX_POWERWIDTH = FONT.size('1000/1000')[0]94TOOLBOX_SCROLLBUTTON = (10,10)95TOOLBOX_SCROLLUP = (1+TOOLBOX_LINE[0]+TOOLBOX_LINESDIM[0],TOOLBOX_LINE[1])96TOOLBOX_SCROLLDOWN = (TOOLBOX_SCROLLUP[0],TOOLBOX_SCROLLUP[1]+TOOLBOX_LINEHEIGHT*TOOLBOX_LINES-TOOLBOX_SCROLLBUTTON[1])97TOOLBOX_SCROLLBAR = (TOOLBOX_SCROLLUP[0],TOOLBOX_SCROLLUP[1]+TOOLBOX_SCROLLBUTTON[1]+1)98TOOLBOX_SCROLL = (TOOLBOX_SCROLLUP[0],TOOLBOX_SCROLLUP[1]+TOOLBOX_SCROLLBUTTON[1])99TOOLBOX_SCROLLDIM = (TOOLBOX_SCROLLBUTTON[0],TOOLBOX_SCROLLDOWN[1]-TOOLBOX_SCROLLUP[1]-TOOLBOX_SCROLLBUTTON[1]-2)100TOOLBOX_SIZE = (9+TOOLBOX_SCROLLUP[0]+TOOLBOX_SCROLLBUTTON[0],8+TOOLBOX_DIAL[1])101TOOLBOX_MINIMIZEDIM = (10,10)102TOOLBOX_MINIMIZE = (TOOLBOX_SIZE[0]-8-TOOLBOX_MINIMIZEDIM[0],(TOOLBOX_TITLEHEIGHT+1)/2-TOOLBOX_MINIMIZEDIM[1]/2)...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run pyatom 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