Etiquetas

555 74HC04 74HC14 74HC165 74LS04 acentos ADC10 Amstrad archivo arduino aristóteles armbian array ass at backup base64 bash Basho bc beethoven Biblia blog bucle c c++ c++11 c++17 C005 cadena Carmina Burana casting CD4017 CD4040 Cine clases Colores connect Consolación a Helvia Consolación a Marcia Consolación a Polibio constante corsair CPC Cristal 32Khz css cursor mouse cut daemon date dead keys Debian directorio disco duro DS32kHz electricidad Electrónica ensamblador entryList epicureismo Estadística estoicismo felicidad ffmpeg filePath filosofia Filosofía firefox flac for fstab funcion Gargantúa gastronomía gilgamesh Ginott gmp gpt grep gtts Hobbes hotkeys html imagemagick inline Javascript kde kernel modulos latex ldr lib-notify Linux Literatura ludoteca macro mapa de bits Matroska mega Microsoft Word Milan Kundera mkvextract mkvinfo mount mp3 mplayer MSP430 msp430F5529 MSP432 Multimedia Musica oop orange_pi pato PIR PL9823 Platón poesía POO en C++ pulseaudio puntero PWM pygame pyqt python QAction qApp QApplication QByteArray QDialog Qdir QFile QFileDialog QImage qlabel QList QListWidget QMessagebox QMouseEvent qpainter QPalette QPixmap QProcess QRegularExpression QRegularExpressionMatchIterator QString QStringList Qt qt5 QToolbar quijote QVector qwidget R Rabelais ratón relé Resonador cerámico samba San Agustín screen Séneca signal slot smart smartctl sox srt static const stdarg.h subtítulos Symbian tar teléfonos móviles temperatura temperatura cpu Temporizador tesseract Timer timestamp Trigonometría tts tutorial uid unicode user USI va_arg va_end va_list va_start velocidad ventilador Voltaire wallpaper xboxdrv xinput xrandr Z80 zip

martes, junio 29, 2010

Main window en Symbian y en desktop

#ifdef Q_OS_SYMBIAN
    w.showFullScreen();
#else
   w.show();
#endif

Un qmessagebox con acentos

El siguiente ejemplo asume que tu editor utiliza utf8.

int ret = QMessageBox::question(this, QString::fromUtf8("Confirmación"),
    QString::fromUtf8("¿Desea borrar el formulario?"),
    QMessageBox::Yes|QMessageBox::No);

if (ret ==QMessageBox::Yes) {
    clearForm();
}

Relacionado:

QMessageBox en 3 lineas

QMessageBox con más de tres lineas 

domingo, junio 06, 2010

The Meaning of life 2

The miracle of birth. Part 2.

The second part, subtitled "The Third World", is set in Yorkshire. It depicts a Roman Catholic couple (Palin and Jones), who can no longer afford to feed their 63 children, a number that has arisen because their religion forbids birth control. They are forced to sell their many offspring for medical experiments. The skit culminates in the musical number "Every Sperm is Sacred". This satire on the Catholic Church's attitudes toward contraception and masturbation is followed by one on Protestants: Chapman plays the husband of the household next door, who lectures his wife on their church's tolerance toward having intercourse for fun, although his frustrated spouse (Idle) points out that they never do.



Every sperm is sacred
The song was released on the album Monty Python Sings and was nominated for a BAFTA Music Award for Best Original Song in a Film in 1983. Michael Palin and Terry Jones wrote the music and lyrics and performed the sketch, which is hailed as one of the Pythons' great sketches.

The song is a satire of Catholic teachings on reproduction which forbid masturbation and contraception by artificial means.

The lyric
DAD:
There are Jews in the world.
There are Buddhists.
There are Hindus and Mormons, and then
There are those that follow Mohammed, but
I've never been one of them.

I'm a Roman Catholic,
And have been since before I was born,
And the one thing they say about Catholics is:
They'll take you as soon as you're warm.

You don't have to be a six-footer.
You don't have to have a great brain.
You don't have to have any clothes on. You're
A Catholic the moment Dad came,

Because

Every sperm is sacred.
Every sperm is great.
If a sperm is wasted,
God gets quite irate.

CHILDREN:
Every sperm is sacred.
Every sperm is great.
If a sperm is wasted,
God gets quite irate.

GIRL:
Let the heathen spill theirs
On the dusty ground.
God shall make them pay for
Each sperm that can't be found.

CHILDREN:
Every sperm is wanted.
Every sperm is good.
Every sperm is needed
In your neighbourhood.

MUM:
Hindu, Taoist, Mormon,
Spill theirs just anywhere,
But God loves those who treat their
Semen with more care.

MEN:
Every sperm is sacred.
Every sperm is great.
WOMEN:
If a sperm is wasted,...
CHILDREN:
...God get quite irate.

PRIEST:
Every sperm is sacred.
BRIDE and GROOM:
Every sperm is good.
NANNIES:
Every sperm is needed...
CARDINALS:
...In your neighbourhood!

CHILDREN:
Every sperm is useful.
Every sperm is fine.
FUNERAL CORTEGE:
God needs everybody's.
MOURNER #1:
Mine!
MOURNER #2:
And mine!
CORPSE:
And mine!

NUN:
Let the Pagan spill theirs
O'er mountain, hill, and plain.
HOLY STATUES:
God shall strike them down for
Each sperm that's spilt in vain.

EVERYONE:
Every sperm is sacred.
Every sperm is good.
Every sperm is needed
In your neighbourhood.

Every sperm is sacred.
Every sperm is great.
If a sperm is wasted,
God gets quite iraaaaaate!

References
http://en.wikipedia.org/wiki/Monty_Python%27s_The_Meaning_of_Life
http://en.wikipedia.org/wiki/Every_Sperm_is_Sacred
http://www.lyricsdepot.com/monty-python/every-sperm-is-sacred.html

viernes, abril 03, 2009

Consola bluetooth para pyS60

sdptool add --channel=2 SP

rfcomm listen rfcomm2 2

En otra terminal:
cutecom

sábado, julio 21, 2007

Crear miniaturas

convert -size 150x150 Imagen000.jpg -resize '150x150>' -bordercolor skyblue -border 50 -gravity center -crop 150x150+0+0 miniaturas/0.jpg

domingo, diciembre 24, 2006

convertir wmv a xvid

mencoder prueba00.wmv -o salida02.avi -ovc xvid -oac mp3lame -ofps 25 -xvidencopts bitrate=800

jueves, diciembre 14, 2006

miércoles, noviembre 01, 2006

Instalación de netbeans

Instalar Java jdk-1_5 (J2SE Development kit 5.0), no confundir con j2sdk-1_4_2

lunes, octubre 02, 2006

Comprimir un directorio

Instrucciones para comprimir un directorio y todos sus subdirectorios con tar.

1. Ir al directorio
2. tar czvf fichero_comprimido.tar.gz *

martes, agosto 22, 2006

Obtener un directorio con QFileDialog


str = qt.QFileDialog.getExistingDirectory (self.txtOut.text(), self)

QFileDialog devuelve un directorio o una cadena vacía si se pulsa cancelar. A continuación se comprueba la cadena.

if str :
    self.txtOut.setText ( str )

domingo, agosto 13, 2006

Mostrar la salida de la consola en una ventana

from qt import *
from parentfrm01 import *

Primero hemos creado un cuadro de diálogo con un QTextEdit para mostrar la salida y varios botones para lanzar y detener el proceso

class Frm01 ( parentFrm01 ):

Constructor de la ventana:
  
  def __init__(self,parent = None,name = None,fl = 0):
    #call parent's constructor
    parentFrm01.__init__ (self,parent,name,fl)

Se crea un objeto QProcess y se le conecta a los slots

    self.proc = QProcess ( self )
    self.connect (self.proc,SIGNAL("readyReadStdout ()"),self.leidofromProcess )
    self.connect (self.proc,SIGNAL("readyReadStderr ()"),self.leidofromProcess)
    self.connect (self.proc,SIGNAL("processExited ()"),self.procesoTerminado)

Esta función es invocada cada vez que el proceso imprime algo en la consola

  def leidofromProcess(self):
    self.textEdit1.append ( QString (self.proc.readStdout () ) )
    self.textEdit1.append ( QString (self.proc.readStderr () ) )
    #Lleva el cursor a la última linea
    self.textEdit1.setContentsPos (0,self.textEdit1.contentsHeight() )

Esta función es invocada cuando el proceso termina

  def procesoTerminado ( self ) :
    #self.textEdit1.setContentsPos (0,0)
    self.textEdit1.append ("Terminado")

Lanzamiento del proceso y dos formas de pasarle los argumentos.

  def lanzar(self):
    a = QStringList ()
    a.append ("faad")
    a.append ("s9.m4a")
    self.proc.setArguments ( a )
    #self.proc.addArgument ("faad")
    #self.proc.addArgument ("s9.m4a")
    
    if not self.proc.start () :
      print "fallo"

Vuelvo a lanzar el proceso, pero ahora con diferentes argumentos

  def lanza2 ( self ) :
    a = QStringList()
    a.append ("ls")
    a.append ("/")
    a.append ("-l")

    self.proc.setArguments ( a )
    #self.proc.addArgument ( "ls" )
    #self.proc.addArgument ( "/" )
    #self.proc.addArgument ( "-l" )

    if not self.proc.start () :
      print "fallo"

Detención del proceso a petición del usuario. Se solicita que el proceso termine por las buenas. En caso de fallo el proceso se termina por las malas a los 5 segundos.

  def parar ( self ) :
    print "terminando..."
    self.proc.tryTerminate()
    QTimer.singleShot(5000, self.proc, SLOT ("kill()") )

jueves, agosto 10, 2006

Redirigir la salida estandar a un fichero


import sys

old_stdout = sys.stdout

sys.stdout = open("kk.log","w")
print"hola"
print"adios"
sys.stdout.close()

sys.stdout = old_stdout

print "ya esta"

viernes, julio 07, 2006

Mensaje en la barra de estado


self.statusBar().message ("hola")

lunes, julio 03, 2006

CustomEvents


#id para el evento
DirNoValid = 1001

#El evento
class DirNoValidEvent ( QCustomEvent ):
   def __init__(self):
      QCustomEvent.__init__ ( self, DirNoValid )

#El manejo del evento dentro de la clase del formulario
def customEvent (self, event):
   if ( event.type() == DirNoValid ):
      pass

#Lanzamiento del event
QApplication.postEvent ( self, DirNoValidEvent () )

sábado, julio 01, 2006

QInputDialog.getText

(text,ok) = QInputDialog.getText ( "Noticias","Editar origen",QLineEdit.Normal,ct)

#text es el texto introducido
#ok vale 0 si se ha cancelado

#ct es el texto por defecto

QMessageBox.question

x = QMessageBox.question (self, "Noticias","¿Desea eliminar el origen?","Si","No","",0,1)

A esto devuelve 0= si; 1 = no

Menú contextual con PyQT

#Crear instancia de QPopupMenu
popMenu = QPopupMenu( self )

#Crear las acciones del menú
orgNewAction = QAction ( self, "orgNew")
#"orgNew" es una etiqueta. No se usa
#orgNewAction.setIconSet(self.image0)
orgNewAction.setText ("A\xf1adir origen")
orgNewAction.addTo(popMenu)

orgEditAction = QAction ( self,"orgedit")
orgEditAction.setText("Editar origen")
orgEditAction.addTo(popMenu)

orgDeleteAction = (QAction (self, "orgdel"))
orgDeleteAction.setText("Eliminar origen")
orgDeleteAction.addTo(popMenu)

#Conectar acciones con las funciones
#self.origenAnadir() es la función que hace el trabajo.
#Al conectar se omiten los paréntesis
self.connect (orgNewAction,SIGNAL("activated()"),self.origenAnadir)
self.connect (orgEditAction,SIGNAL("activated()"),self.origenEditar)
self.connect (orgDeleteAction,SIGNAL("activated()"),self.origenEliminar)

#Mostrar el menu en la posición del cursor
popMenu.popup(QCursor.pos())