ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> anygui-devel
anygui-devel
[Anygui-devel] Anygui on Zaurus
by Stephen Wilbourne other posts by this author
Aug 11 2003 7:09AM messages near this date
[Anygui-devel] [patch] Unicode support for GTK, QT, TK | RE: [Anygui-devel] Anygui on Zaurus
Hi,

I am building a python application using sqlite and anygui on a Sharp Zaurus  SL-5500. As yo
u are probably aware, the Zaurus uses Qtopia (Qt/Embedded) for its gui. I have needed to mak
e a few 'tweaks' to the anygui backend file 'qtgui.py' in order to make things work, or work
 better, on the Zaurus. Listed below are all the changes I have made. Perhaps you can find a
 way to optionally include them in the qtgui.py file, or perhaps in a separate backend file.

Please be aware that this is my first attempt at python programming, so you may find my chan
ges clumsy. They do seem to work however!

Keep up the good work. I am very impressed with Anygui. It has enabled me to start programmi
ng on the Zaurus - I found the Qtopia documentation somewhat overwhelming and very difficult
 to work out where to begin.

I also tried loading python, sqlite and anygui on a W2000 box. I copied across my work-in-pr
ogress application and the sqlite database file. It worked first time. I was simply amazed.

Here's what I have tweaked:

1. To make the application run as a window that puts an icon on the taskbar, and that you ca
n return to by selecting the icon:

- at the top of the program, add:
	from qtpe import QPEApplication

- throughout the program, change all references to 'QApplication' to 'QPEApplication'

- at the end of the program, immediately before the line 'qApp.exec_loop()' add:
	if self._windows:
 		self.showMainWidget(self._windows[0]._qt_comp)

I was unable to get multiple windows to behave correctly. If you moved to another applicatio
n and returned, you always got the first window. To overcome this I have written everything 
in one window, and use 'visible' and 'refresh' to change the view.

2. In a listbox, I needed the signal to only be sent when the line was actually selected, no
t when it was highlighted. Otherwise you could not use the Zaurus arrow keys to move down to
 an item and press the centre key to select. The downside to this is that if you use the sty
lus, you need to double-press to make the selection.

I changed this line:
              qApp.connect(self._qt_comp, SIGNAL('highlighted(int)'),to:
              qApp.connect(self._qt_comp, SIGNAL('selected(int)'),
3. In a text field, the enter key event was not sent if the hardware 'OK' button was used, o
r the centre key in the arrows, and also not if the return 'key' was used in the 'jumpx' vir
tual keyboard (which I use in preference to the 'qwerty' virtual keyboard.)

I discovered that Qtopia has a 'returnedPressed' signal and that this is sent by all the ret
urn key options. To use this I commented out these lines:
          if int(event.key()) == 0x1004: #Qt Return Key Code
              send(self, 'enterkey')
and added this into the 'def _ensure_events(self):' under 'TextBase':
              qApp.connect(self._qt_comp, SIGNAL('returnPressed()'),              self._qt_r
eturn_key_handler)
I also added:
      def _qt_return_key_handler(self):
          send(self, 'enterkey')

4. In a text area, I wanted word-wrap to work, so I added this at the end of the 'def _ensur
e_selection(self):' under 'TextArea':
             self._qt_comp.setWordWrap(1)


Regards,

Stephen Wilbourne


-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved