From a2eeccf346c63ef51db78ba34db166448a31c7b0 Mon Sep 17 00:00:00 2001 From: kibergus Date: Wed, 3 Nov 2010 19:51:07 +0000 Subject: [PATCH] 0.0.4 version git-svn-id: file:///svnroot/ussd-widget/trunk@43 d197f4d6-dc93-42ad-8354-0da1f58e353f --- ussd4all/debian/changelog | 6 +++--- ussd4all/src/qussd.cpp | 24 +++++++++++++++++------- ussd4all/ussdquery/ussdquery.py | 32 +++++++++++++++++--------------- 3 files changed, 37 insertions(+), 25 deletions(-) diff --git a/ussd4all/debian/changelog b/ussd4all/debian/changelog index 7820e77..88c6fa2 100644 --- a/ussd4all/debian/changelog +++ b/ussd4all/debian/changelog @@ -1,6 +1,6 @@ -ussd4all (0.0.3-1) unstable; urgency=low +ussd4all (0.0.4-1) unstable; urgency=low - * Fixed PR 1.3 issue. postinst does not break phone if library is not - recognized. Multiple * can be entered. + * Word wrap in qussd. Text can be copyed. Better pnatd initialization in + ussdquery.py. -- Alexey Guseynov Tue, 03 July 2010 16:21:05 +0003 diff --git a/ussd4all/src/qussd.cpp b/ussd4all/src/qussd.cpp index adaf7a1..8c39434 100644 --- a/ussd4all/src/qussd.cpp +++ b/ussd4all/src/qussd.cpp @@ -30,18 +30,28 @@ class QUssd : public QMainWindow { connect(actLandscape, SIGNAL(changed()), this, SLOT(setOrientation())); connect(actAuto, SIGNAL(changed()), this, SLOT(setOrientation())); - replyLabel = new QLabel(message); + replyLabel = new QTextEdit(message); replyLabel->setMinimumWidth(400); - replyLabel->setMaximumHeight(100); + replyLabel->setMinimumHeight(200); replyLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum); - +// replyLabel->setWordWrap(true); +// replyLabel->setReadOnly(true); + replyLabel->setFrameStyle(QFrame::NoFrame); + QPalette pal = palette(); + pal.setColor(QPalette::Base, Qt::transparent); + replyLabel->setPalette(pal); +// replyLabel->setTextBackgroundColor(Qt::black); + replyLabel->setTextColor(Qt::white); + replyLabel->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard); + numberLabel = new QLabel(""); - replyLabel->setMinimumWidth(400); - replyLabel->setMinimumHeight(150); - replyLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + numberLabel->setMinimumWidth(400); + numberLabel->setMaximumHeight(100); + numberLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); indicationLayout = new QVBoxLayout; indicationLayout->addWidget(numberLabel); + indicationLayout->addWidget(replyLabel); padDel = new QPushButton("C"); @@ -334,7 +344,7 @@ class QUssd : public QMainWindow { numberLabel->setText(QString("

")+number+"

"); } - QLabel *replyLabel; + QTextEdit *replyLabel; QLabel *numberLabel; QAction *actPortrait; QAction *actLandscape; diff --git a/ussd4all/ussdquery/ussdquery.py b/ussd4all/ussdquery/ussdquery.py index fa38dec..d580e85 100755 --- a/ussd4all/ussdquery/ussdquery.py +++ b/ussd4all/ussdquery/ussdquery.py @@ -56,6 +56,17 @@ def release_lock (): fcntl.flock(lockf,fcntl.LOCK_UN) lockf.close() +def ensure_modem_listening (modem): + # We try to ger response for about 2 seconds + for i in range(20): + modem.send('at junk\r'); + index = modem.expect (['ERROR\r', pexpect.TIMEOUT], 0.1); + if index == 0: + modem.send('at\r'); + index = modem.expect (['OK\r'], 1); + return; + raise + def init_modem(modem): # We have only one modem, simultaneous acces wouldn't bring anything good gain_lock() @@ -65,21 +76,12 @@ def init_modem(modem): if modem == None : # OK response should be recieved shortly modem = pexpect.spawn('pnatd', [], 2) - # FIXME This is a dirty hack. A better solution needed - time.sleep(0.5) - try : - modem.send('at\r'); - # Read our "at" command - modem.readline(); - # Read OK response - response = modem.readline().strip() - except pexpect.TIMEOUT: - modem.kill(9) - modem = None - response = "" - if response != "OK" : - time.sleep(0.5) - init_retry -= 1 + try : + ensure_modem_listening (modem); + except : + modem.kill(9); + modem = None; + response = ""; else: try: # Switch output encoding to GSM default encoding -- 1.7.9.5