Red de conocimiento informático - Problemas con los teléfonos móviles - Código fuente de Ubuntu en Python

Código fuente de Ubuntu en Python

sudo mkdir/usr/share/backgrounds/my background-imgs

sudo CD/usr/share/backgrounds/my background-imgs

Sudo cp /home/dónde está tu imagen de fondo directorio ubicado/*.

Sudo. /background .py

Dónde backgroud.py:

#!/usr/bin/env python

#Encoding=utf-8

Importar sistemas operativos globales

Importar habilidades

Importar tiempo

Importar imágenes

Lista de archivos=[]

Archivo de definición (ruta):

Si os.path.isfile(ruta):

wenjian=OS.path.split ext(ruta)[1][1:]

Si wenjian=="jpg" o wenjian=="png" o wenjian=="gif":

Prueba:

ancho, alto = Imagen .abierto(ruta).

Tamaño

Si kuan gt=1024 y altura gt=768:

filelist.append(ruta)

Excepto IOError:

Pase

elif os.path.isdir(ruta):

Para elementos en os.listdir(ruta):

itemsrc = os.path.join( ruta , item)

filelie(itemsrc)

curdir = os.getcwd()

filelie(curdir)

currentImageFiles =Lista de archivos

#Imprimir lista de archivos

si la ruta del sistema operativo es archivo(' diapositiva de fondo . XML '):

os.remove( 'fondoslide.xml ' )

horaactual = time.localtime()

longitud = len(currentImageFiles)

f = file('backgroundslide.xml ', ' w ')

f . escribir( lt; fondo gt\n ')

f . escribir(' \ t lt; hora de inicio gt\n ')

f . (' \ t \ t lt; año>; ' str(hora actual . TM _ año) ' lt; /año gt; \n ')

f . mes>; ' str(hora actual. TM _ mon) ' lt; /mes gt; \n ')

f . TM _ mday) ' lt;/día gt;\n ')

f . write(' \ t \ t lt; hora gt' str(hora actual . TM _ hora ) ' lt;/ hora gt;\n ')

f . write(' \ t \ t lt; minuto gt' str(hora actual . TM _ min) ' lt;/minuto gt;\ n ')

f . write(' \ t \ t lt; segundo gt' str(hora actual . TM _ sec) ' lt; / segundo gt\n ')

f . \t lt;/hora de inicio gt;\n ')

f . - La animación comenzará en la creación - gt;\n ')

Para I en currentImageFiles:

longitud = longitud - 1

f.write (' \t lt; gt estático\n ')

f . write(' \ t \ t lt; duración gt550.0 lt/duración gt;\n ')

f . escribir('\t\tlt;archivo>' Imagen actual

Archivos[longitud] ' lt;/file gt;\n ')

f . '\t lt; transición gt\n ')

f . escribir(' \ t \ t lt; duración gt25.0 lt/duración gt;\n ')

f .write('\t\tlt;from gt' currentImageFiles[length] 'lt;/from gt;\n ')

Si lengthgt= 1:

f .write( ' \t \t lt; to gt' currentImageFiles[length-1] ' lt;/to gt;\n ')

si longitud lt1:

f . \ t \ t lt; to gt' currentImageFiles[len(currentImageFiles)-1] ' lt;/to gt;\n ')

f . n ')

f .escribir( lt;/fondo gt;\n ')

f.close()