From e602246539fd7435aaeb440fcb7f852c92c8426b Mon Sep 17 00:00:00 2001 From: aneejit1 Date: Thu, 28 Jul 2022 15:46:19 +0000 Subject: Remove Qt V2 support and example files Build files for pyuic2 have been removed along with the examples for version 2 of Qt and the build/configure scripts have been amended accordingly. The "examples3" directory has been renamed to just "examples". Signed-off-by: aneejit1 --- build.py | 4 - configure.py | 18 - examples/README | 12 + examples/SQL/README | 76 ++ examples/SQL/connect.ui | 238 ++++ examples/SQL/connect.ui.h | 21 + examples/SQL/dbconnect.py | 82 ++ examples/SQL/dbpar.py | 22 + examples/SQL/form1.ui | 77 ++ examples/SQL/form2.ui | 327 +++++ examples/SQL/frmconnect.py | 120 ++ examples/SQL/frmconnect.ui | 245 ++++ examples/SQL/runform1.py | 21 + examples/SQL/runform2.py | 21 + examples/SQL/runsqlex.py | 151 +++ examples/SQL/sqlcustom1.py | 94 ++ examples/SQL/sqlex.ui | 303 +++++ examples/SQL/sqlex.ui.h | 35 + examples/SQL/sqlsubclass5.py | 151 +++ examples/SQL/sqltable4.py | 118 ++ examples/SQL/testdb_mysql.sql | 57 + examples/SQL/testdb_pg.sql | 232 ++++ examples/aclock.py | 61 + examples/addressbook.py | 457 +++++++ examples/application.py | 277 ++++ examples/biff.py | 173 +++ examples/bigtable.py | 72 ++ examples/buttongroups.py | 125 ++ examples/canvas/butterfly.png | Bin 0 -> 37832 bytes examples/canvas/canvas.py | 619 +++++++++ examples/canvas/qt-trans.xpm | 54 + examples/canvas/qtlogo.png | Bin 0 -> 22603 bytes examples/checklists.py | 135 ++ examples/cursor.py | 114 ++ examples/dclock.py | 58 + examples/desktop.py | 230 ++++ examples/dirview.py | 452 +++++++ examples/dragdrop.py | 57 + examples/drawlines.py | 74 ++ examples/dropsite.py | 96 ++ examples/fileopen.xpm | 22 + examples/fontdisplayer.py | 148 +++ examples/fonts.py | 149 +++ examples/gears.py | 235 ++++ examples/i18n/i18n.pro | 15 + examples/i18n/i18n.py | 147 +++ examples/i18n/mywidget.py | 47 + examples/i18n/mywidget_cs.qm | Bin 0 -> 818 bytes examples/i18n/mywidget_cs.ts | 75 ++ examples/i18n/mywidget_de.qm | Bin 0 -> 913 bytes examples/i18n/mywidget_de.ts | 69 + examples/i18n/mywidget_el.qm | Bin 0 -> 832 bytes examples/i18n/mywidget_el.ts | 68 + examples/i18n/mywidget_en.qm | Bin 0 -> 337 bytes examples/i18n/mywidget_en.ts | 69 + examples/i18n/mywidget_eo.qm | Bin 0 -> 835 bytes examples/i18n/mywidget_eo.ts | 72 ++ examples/i18n/mywidget_fr.qm | Bin 0 -> 884 bytes examples/i18n/mywidget_fr.ts | 68 + examples/i18n/mywidget_it.qm | Bin 0 -> 763 bytes examples/i18n/mywidget_it.ts | 72 ++ examples/i18n/mywidget_jp.qm | Bin 0 -> 738 bytes examples/i18n/mywidget_jp.ts | 68 + examples/i18n/mywidget_ko.qm | Bin 0 -> 738 bytes examples/i18n/mywidget_ko.ts | 68 + examples/i18n/mywidget_no.qm | Bin 0 -> 830 bytes examples/i18n/mywidget_no.ts | 68 + examples/i18n/mywidget_ru.qm | Bin 0 -> 799 bytes examples/i18n/mywidget_ru.ts | 68 + examples/i18n/mywidget_zh.qm | Bin 0 -> 706 bytes examples/i18n/mywidget_zh.ts | 68 + examples/lineedits.py | 140 ++ examples/listbox.py | 176 +++ examples/listboxcombo.py | 167 +++ examples/marble.png | Bin 0 -> 25239 bytes examples/mdi.py | 360 ++++++ examples/menu.py | 286 +++++ examples/progress.py | 281 ++++ examples/progressbar.py | 155 +++ examples/qdir.py | 324 +++++ examples/qmag.py | 233 ++++ examples/qt.png | Bin 0 -> 355 bytes examples/qtlogo.png | Bin 0 -> 12634 bytes examples/rangecontrols.py | 79 ++ examples/richtext.py | 136 ++ examples/secret.py | 65 + examples/semaphore.py | 203 +++ examples/smalltable.py | 57 + examples/splitter.py | 65 + examples/tabdialog.py | 116 ++ examples/tablestatistics.py | 170 +++ examples/tooltip.py | 105 ++ examples/trolltech.bmp | Bin 0 -> 30055 bytes examples/trolltech.gif | Bin 0 -> 42629 bytes examples/tt-logo.png | Bin 0 -> 3133 bytes examples/tut1.py | 16 + examples/tut10.py | 145 +++ examples/tut11.py | 213 ++++ examples/tut12.py | 253 ++++ examples/tut13.py | 330 +++++ examples/tut14.py | 378 ++++++ examples/tut2.py | 19 + examples/tut3.py | 21 + examples/tut4.py | 29 + examples/tut5.py | 32 + examples/tut6.py | 41 + examples/tut7.py | 57 + examples/tut8.py | 97 ++ examples/tut9.py | 104 ++ examples/webbrowser/mainwindow.py | 1097 ++++++++++++++++ examples/webbrowser/mainwindow.ui | 410 ++++++ examples/webbrowser/webbrowser.py | 91 ++ examples/widgets.py | 500 ++++++++ examples2/README | 11 - examples2/aclock.py | 61 - examples2/addressbook.py | 457 ------- examples2/application.py | 277 ---- examples2/buttongroups.py | 113 -- examples2/dclock.py | 58 - examples2/desktop.py | 219 ---- examples2/dirview.py | 76 -- examples2/dragdrop.py | 57 - examples2/dropsite.py | 96 -- examples2/gears.py | 235 ---- examples2/menu.py | 301 ----- examples2/qt.png | Bin 355 -> 0 bytes examples2/qtlogo.png | Bin 3684 -> 0 bytes examples2/secret.py | 65 - examples2/semaphore.py | 203 --- examples2/splitter.py | 65 - examples2/table.py | 115 -- examples2/themes.py | 2484 ------------------------------------ examples2/trolltech.bmp | Bin 30055 -> 0 bytes examples2/trolltech.gif | Bin 42629 -> 0 bytes examples2/tt-logo.png | Bin 3133 -> 0 bytes examples2/tut1.py | 16 - examples2/tut10.py | 145 --- examples2/tut11.py | 213 ---- examples2/tut12.py | 252 ---- examples2/tut13.py | 329 ----- examples2/tut14.py | 377 ------ examples2/tut2.py | 19 - examples2/tut3.py | 20 - examples2/tut4.py | 29 - examples2/tut5.py | 32 - examples2/tut6.py | 41 - examples2/tut7.py | 57 - examples2/tut8.py | 96 -- examples2/tut9.py | 104 -- examples2/widgets.py | 512 -------- examples3/README | 12 - examples3/SQL/README | 76 -- examples3/SQL/connect.ui | 238 ---- examples3/SQL/connect.ui.h | 21 - examples3/SQL/dbconnect.py | 82 -- examples3/SQL/dbpar.py | 22 - examples3/SQL/form1.ui | 77 -- examples3/SQL/form2.ui | 327 ----- examples3/SQL/frmconnect.py | 120 -- examples3/SQL/frmconnect.ui | 245 ---- examples3/SQL/runform1.py | 21 - examples3/SQL/runform2.py | 21 - examples3/SQL/runsqlex.py | 151 --- examples3/SQL/sqlcustom1.py | 94 -- examples3/SQL/sqlex.ui | 303 ----- examples3/SQL/sqlex.ui.h | 35 - examples3/SQL/sqlsubclass5.py | 151 --- examples3/SQL/sqltable4.py | 118 -- examples3/SQL/testdb_mysql.sql | 57 - examples3/SQL/testdb_pg.sql | 232 ---- examples3/aclock.py | 61 - examples3/addressbook.py | 457 ------- examples3/application.py | 277 ---- examples3/biff.py | 173 --- examples3/bigtable.py | 72 -- examples3/buttongroups.py | 125 -- examples3/canvas/butterfly.png | Bin 37832 -> 0 bytes examples3/canvas/canvas.py | 619 --------- examples3/canvas/qt-trans.xpm | 54 - examples3/canvas/qtlogo.png | Bin 22603 -> 0 bytes examples3/checklists.py | 135 -- examples3/cursor.py | 114 -- examples3/dclock.py | 58 - examples3/desktop.py | 230 ---- examples3/dirview.py | 452 ------- examples3/dragdrop.py | 57 - examples3/drawlines.py | 74 -- examples3/dropsite.py | 96 -- examples3/fileopen.xpm | 22 - examples3/fontdisplayer.py | 148 --- examples3/fonts.py | 149 --- examples3/gears.py | 235 ---- examples3/i18n/i18n.pro | 15 - examples3/i18n/i18n.py | 147 --- examples3/i18n/mywidget.py | 47 - examples3/i18n/mywidget_cs.qm | Bin 818 -> 0 bytes examples3/i18n/mywidget_cs.ts | 75 -- examples3/i18n/mywidget_de.qm | Bin 913 -> 0 bytes examples3/i18n/mywidget_de.ts | 69 - examples3/i18n/mywidget_el.qm | Bin 832 -> 0 bytes examples3/i18n/mywidget_el.ts | 68 - examples3/i18n/mywidget_en.qm | Bin 337 -> 0 bytes examples3/i18n/mywidget_en.ts | 69 - examples3/i18n/mywidget_eo.qm | Bin 835 -> 0 bytes examples3/i18n/mywidget_eo.ts | 72 -- examples3/i18n/mywidget_fr.qm | Bin 884 -> 0 bytes examples3/i18n/mywidget_fr.ts | 68 - examples3/i18n/mywidget_it.qm | Bin 763 -> 0 bytes examples3/i18n/mywidget_it.ts | 72 -- examples3/i18n/mywidget_jp.qm | Bin 738 -> 0 bytes examples3/i18n/mywidget_jp.ts | 68 - examples3/i18n/mywidget_ko.qm | Bin 738 -> 0 bytes examples3/i18n/mywidget_ko.ts | 68 - examples3/i18n/mywidget_no.qm | Bin 830 -> 0 bytes examples3/i18n/mywidget_no.ts | 68 - examples3/i18n/mywidget_ru.qm | Bin 799 -> 0 bytes examples3/i18n/mywidget_ru.ts | 68 - examples3/i18n/mywidget_zh.qm | Bin 706 -> 0 bytes examples3/i18n/mywidget_zh.ts | 68 - examples3/lineedits.py | 140 -- examples3/listbox.py | 176 --- examples3/listboxcombo.py | 167 --- examples3/marble.png | Bin 25239 -> 0 bytes examples3/mdi.py | 360 ------ examples3/menu.py | 286 ----- examples3/progress.py | 281 ---- examples3/progressbar.py | 155 --- examples3/qdir.py | 324 ----- examples3/qmag.py | 233 ---- examples3/qt.png | Bin 355 -> 0 bytes examples3/qtlogo.png | Bin 12634 -> 0 bytes examples3/rangecontrols.py | 79 -- examples3/richtext.py | 136 -- examples3/secret.py | 65 - examples3/semaphore.py | 203 --- examples3/smalltable.py | 57 - examples3/splitter.py | 65 - examples3/tabdialog.py | 116 -- examples3/tablestatistics.py | 170 --- examples3/tooltip.py | 105 -- examples3/trolltech.bmp | Bin 30055 -> 0 bytes examples3/trolltech.gif | Bin 42629 -> 0 bytes examples3/tt-logo.png | Bin 3133 -> 0 bytes examples3/tut1.py | 16 - examples3/tut10.py | 145 --- examples3/tut11.py | 213 ---- examples3/tut12.py | 253 ---- examples3/tut13.py | 330 ----- examples3/tut14.py | 378 ------ examples3/tut2.py | 19 - examples3/tut3.py | 21 - examples3/tut4.py | 29 - examples3/tut5.py | 32 - examples3/tut6.py | 41 - examples3/tut7.py | 57 - examples3/tut8.py | 97 -- examples3/tut9.py | 104 -- examples3/webbrowser/mainwindow.py | 1097 ---------------- examples3/webbrowser/mainwindow.ui | 410 ------ examples3/webbrowser/webbrowser.py | 91 -- examples3/widgets.py | 500 -------- pyuic2/COPYING | 280 ---- pyuic2/domtool.cpp | 260 ---- pyuic2/domtool.h | 41 - pyuic2/globaldefs.h | 33 - pyuic2/pyuic.pro.in | 24 - pyuic2/pyuic.sbf | 24 - pyuic2/uic.cpp | 1600 ----------------------- pyuic2/uic.h | 133 -- pyuic2/widgetdatabase.cpp | 640 ---------- pyuic2/widgetdatabase.h | 75 -- 271 files changed, 14004 insertions(+), 24271 deletions(-) create mode 100644 examples/README create mode 100644 examples/SQL/README create mode 100644 examples/SQL/connect.ui create mode 100644 examples/SQL/connect.ui.h create mode 100755 examples/SQL/dbconnect.py create mode 100644 examples/SQL/dbpar.py create mode 100644 examples/SQL/form1.ui create mode 100644 examples/SQL/form2.ui create mode 100644 examples/SQL/frmconnect.py create mode 100644 examples/SQL/frmconnect.ui create mode 100755 examples/SQL/runform1.py create mode 100755 examples/SQL/runform2.py create mode 100755 examples/SQL/runsqlex.py create mode 100755 examples/SQL/sqlcustom1.py create mode 100644 examples/SQL/sqlex.ui create mode 100644 examples/SQL/sqlex.ui.h create mode 100755 examples/SQL/sqlsubclass5.py create mode 100755 examples/SQL/sqltable4.py create mode 100644 examples/SQL/testdb_mysql.sql create mode 100644 examples/SQL/testdb_pg.sql create mode 100755 examples/aclock.py create mode 100755 examples/addressbook.py create mode 100755 examples/application.py create mode 100755 examples/biff.py create mode 100755 examples/bigtable.py create mode 100755 examples/buttongroups.py create mode 100644 examples/canvas/butterfly.png create mode 100755 examples/canvas/canvas.py create mode 100644 examples/canvas/qt-trans.xpm create mode 100644 examples/canvas/qtlogo.png create mode 100755 examples/checklists.py create mode 100755 examples/cursor.py create mode 100755 examples/dclock.py create mode 100755 examples/desktop.py create mode 100755 examples/dirview.py create mode 100755 examples/dragdrop.py create mode 100755 examples/drawlines.py create mode 100644 examples/dropsite.py create mode 100644 examples/fileopen.xpm create mode 100755 examples/fontdisplayer.py create mode 100755 examples/fonts.py create mode 100755 examples/gears.py create mode 100644 examples/i18n/i18n.pro create mode 100755 examples/i18n/i18n.py create mode 100644 examples/i18n/mywidget.py create mode 100644 examples/i18n/mywidget_cs.qm create mode 100644 examples/i18n/mywidget_cs.ts create mode 100644 examples/i18n/mywidget_de.qm create mode 100644 examples/i18n/mywidget_de.ts create mode 100644 examples/i18n/mywidget_el.qm create mode 100644 examples/i18n/mywidget_el.ts create mode 100644 examples/i18n/mywidget_en.qm create mode 100644 examples/i18n/mywidget_en.ts create mode 100644 examples/i18n/mywidget_eo.qm create mode 100644 examples/i18n/mywidget_eo.ts create mode 100644 examples/i18n/mywidget_fr.qm create mode 100644 examples/i18n/mywidget_fr.ts create mode 100644 examples/i18n/mywidget_it.qm create mode 100644 examples/i18n/mywidget_it.ts create mode 100644 examples/i18n/mywidget_jp.qm create mode 100644 examples/i18n/mywidget_jp.ts create mode 100644 examples/i18n/mywidget_ko.qm create mode 100644 examples/i18n/mywidget_ko.ts create mode 100644 examples/i18n/mywidget_no.qm create mode 100644 examples/i18n/mywidget_no.ts create mode 100644 examples/i18n/mywidget_ru.qm create mode 100644 examples/i18n/mywidget_ru.ts create mode 100644 examples/i18n/mywidget_zh.qm create mode 100644 examples/i18n/mywidget_zh.ts create mode 100755 examples/lineedits.py create mode 100755 examples/listbox.py create mode 100755 examples/listboxcombo.py create mode 100644 examples/marble.png create mode 100755 examples/mdi.py create mode 100755 examples/menu.py create mode 100755 examples/progress.py create mode 100755 examples/progressbar.py create mode 100755 examples/qdir.py create mode 100755 examples/qmag.py create mode 100644 examples/qt.png create mode 100644 examples/qtlogo.png create mode 100755 examples/rangecontrols.py create mode 100755 examples/richtext.py create mode 100644 examples/secret.py create mode 100755 examples/semaphore.py create mode 100755 examples/smalltable.py create mode 100755 examples/splitter.py create mode 100755 examples/tabdialog.py create mode 100755 examples/tablestatistics.py create mode 100755 examples/tooltip.py create mode 100644 examples/trolltech.bmp create mode 100644 examples/trolltech.gif create mode 100644 examples/tt-logo.png create mode 100755 examples/tut1.py create mode 100755 examples/tut10.py create mode 100755 examples/tut11.py create mode 100755 examples/tut12.py create mode 100755 examples/tut13.py create mode 100755 examples/tut14.py create mode 100755 examples/tut2.py create mode 100755 examples/tut3.py create mode 100755 examples/tut4.py create mode 100755 examples/tut5.py create mode 100755 examples/tut6.py create mode 100755 examples/tut7.py create mode 100755 examples/tut8.py create mode 100755 examples/tut9.py create mode 100644 examples/webbrowser/mainwindow.py create mode 100644 examples/webbrowser/mainwindow.ui create mode 100644 examples/webbrowser/webbrowser.py create mode 100755 examples/widgets.py delete mode 100644 examples2/README delete mode 100755 examples2/aclock.py delete mode 100755 examples2/addressbook.py delete mode 100755 examples2/application.py delete mode 100755 examples2/buttongroups.py delete mode 100755 examples2/dclock.py delete mode 100755 examples2/desktop.py delete mode 100755 examples2/dirview.py delete mode 100755 examples2/dragdrop.py delete mode 100644 examples2/dropsite.py delete mode 100755 examples2/gears.py delete mode 100755 examples2/menu.py delete mode 100644 examples2/qt.png delete mode 100644 examples2/qtlogo.png delete mode 100644 examples2/secret.py delete mode 100755 examples2/semaphore.py delete mode 100755 examples2/splitter.py delete mode 100755 examples2/table.py delete mode 100755 examples2/themes.py delete mode 100644 examples2/trolltech.bmp delete mode 100644 examples2/trolltech.gif delete mode 100644 examples2/tt-logo.png delete mode 100755 examples2/tut1.py delete mode 100755 examples2/tut10.py delete mode 100755 examples2/tut11.py delete mode 100755 examples2/tut12.py delete mode 100755 examples2/tut13.py delete mode 100755 examples2/tut14.py delete mode 100755 examples2/tut2.py delete mode 100755 examples2/tut3.py delete mode 100755 examples2/tut4.py delete mode 100755 examples2/tut5.py delete mode 100755 examples2/tut6.py delete mode 100755 examples2/tut7.py delete mode 100755 examples2/tut8.py delete mode 100755 examples2/tut9.py delete mode 100755 examples2/widgets.py delete mode 100644 examples3/README delete mode 100644 examples3/SQL/README delete mode 100644 examples3/SQL/connect.ui delete mode 100644 examples3/SQL/connect.ui.h delete mode 100755 examples3/SQL/dbconnect.py delete mode 100644 examples3/SQL/dbpar.py delete mode 100644 examples3/SQL/form1.ui delete mode 100644 examples3/SQL/form2.ui delete mode 100644 examples3/SQL/frmconnect.py delete mode 100644 examples3/SQL/frmconnect.ui delete mode 100755 examples3/SQL/runform1.py delete mode 100755 examples3/SQL/runform2.py delete mode 100755 examples3/SQL/runsqlex.py delete mode 100755 examples3/SQL/sqlcustom1.py delete mode 100644 examples3/SQL/sqlex.ui delete mode 100644 examples3/SQL/sqlex.ui.h delete mode 100755 examples3/SQL/sqlsubclass5.py delete mode 100755 examples3/SQL/sqltable4.py delete mode 100644 examples3/SQL/testdb_mysql.sql delete mode 100644 examples3/SQL/testdb_pg.sql delete mode 100755 examples3/aclock.py delete mode 100755 examples3/addressbook.py delete mode 100755 examples3/application.py delete mode 100755 examples3/biff.py delete mode 100755 examples3/bigtable.py delete mode 100755 examples3/buttongroups.py delete mode 100644 examples3/canvas/butterfly.png delete mode 100755 examples3/canvas/canvas.py delete mode 100644 examples3/canvas/qt-trans.xpm delete mode 100644 examples3/canvas/qtlogo.png delete mode 100755 examples3/checklists.py delete mode 100755 examples3/cursor.py delete mode 100755 examples3/dclock.py delete mode 100755 examples3/desktop.py delete mode 100755 examples3/dirview.py delete mode 100755 examples3/dragdrop.py delete mode 100755 examples3/drawlines.py delete mode 100644 examples3/dropsite.py delete mode 100644 examples3/fileopen.xpm delete mode 100755 examples3/fontdisplayer.py delete mode 100755 examples3/fonts.py delete mode 100755 examples3/gears.py delete mode 100644 examples3/i18n/i18n.pro delete mode 100755 examples3/i18n/i18n.py delete mode 100644 examples3/i18n/mywidget.py delete mode 100644 examples3/i18n/mywidget_cs.qm delete mode 100644 examples3/i18n/mywidget_cs.ts delete mode 100644 examples3/i18n/mywidget_de.qm delete mode 100644 examples3/i18n/mywidget_de.ts delete mode 100644 examples3/i18n/mywidget_el.qm delete mode 100644 examples3/i18n/mywidget_el.ts delete mode 100644 examples3/i18n/mywidget_en.qm delete mode 100644 examples3/i18n/mywidget_en.ts delete mode 100644 examples3/i18n/mywidget_eo.qm delete mode 100644 examples3/i18n/mywidget_eo.ts delete mode 100644 examples3/i18n/mywidget_fr.qm delete mode 100644 examples3/i18n/mywidget_fr.ts delete mode 100644 examples3/i18n/mywidget_it.qm delete mode 100644 examples3/i18n/mywidget_it.ts delete mode 100644 examples3/i18n/mywidget_jp.qm delete mode 100644 examples3/i18n/mywidget_jp.ts delete mode 100644 examples3/i18n/mywidget_ko.qm delete mode 100644 examples3/i18n/mywidget_ko.ts delete mode 100644 examples3/i18n/mywidget_no.qm delete mode 100644 examples3/i18n/mywidget_no.ts delete mode 100644 examples3/i18n/mywidget_ru.qm delete mode 100644 examples3/i18n/mywidget_ru.ts delete mode 100644 examples3/i18n/mywidget_zh.qm delete mode 100644 examples3/i18n/mywidget_zh.ts delete mode 100755 examples3/lineedits.py delete mode 100755 examples3/listbox.py delete mode 100755 examples3/listboxcombo.py delete mode 100644 examples3/marble.png delete mode 100755 examples3/mdi.py delete mode 100755 examples3/menu.py delete mode 100755 examples3/progress.py delete mode 100755 examples3/progressbar.py delete mode 100755 examples3/qdir.py delete mode 100755 examples3/qmag.py delete mode 100644 examples3/qt.png delete mode 100644 examples3/qtlogo.png delete mode 100755 examples3/rangecontrols.py delete mode 100755 examples3/richtext.py delete mode 100644 examples3/secret.py delete mode 100755 examples3/semaphore.py delete mode 100755 examples3/smalltable.py delete mode 100755 examples3/splitter.py delete mode 100755 examples3/tabdialog.py delete mode 100755 examples3/tablestatistics.py delete mode 100755 examples3/tooltip.py delete mode 100644 examples3/trolltech.bmp delete mode 100644 examples3/trolltech.gif delete mode 100644 examples3/tt-logo.png delete mode 100755 examples3/tut1.py delete mode 100755 examples3/tut10.py delete mode 100755 examples3/tut11.py delete mode 100755 examples3/tut12.py delete mode 100755 examples3/tut13.py delete mode 100755 examples3/tut14.py delete mode 100755 examples3/tut2.py delete mode 100755 examples3/tut3.py delete mode 100755 examples3/tut4.py delete mode 100755 examples3/tut5.py delete mode 100755 examples3/tut6.py delete mode 100755 examples3/tut7.py delete mode 100755 examples3/tut8.py delete mode 100755 examples3/tut9.py delete mode 100644 examples3/webbrowser/mainwindow.py delete mode 100644 examples3/webbrowser/mainwindow.ui delete mode 100644 examples3/webbrowser/webbrowser.py delete mode 100755 examples3/widgets.py delete mode 100644 pyuic2/COPYING delete mode 100644 pyuic2/domtool.cpp delete mode 100644 pyuic2/domtool.h delete mode 100644 pyuic2/globaldefs.h delete mode 100644 pyuic2/pyuic.pro.in delete mode 100644 pyuic2/pyuic.sbf delete mode 100644 pyuic2/uic.cpp delete mode 100644 pyuic2/uic.h delete mode 100644 pyuic2/widgetdatabase.cpp delete mode 100644 pyuic2/widgetdatabase.h diff --git a/build.py b/build.py index 890acad..80e48f9 100644 --- a/build.py +++ b/build.py @@ -689,10 +689,6 @@ def main(argv): sip_tqt_config.inform("Creating Makefile for pyuic3.") subdirs.append("pyuic3") olddir = sip_tqt_config.push_dir("pyuic3") - elif config.qt_version >= 0x020000: - sip_tqt_config.inform("Creating Makefile for pyuic2.") - subdirs.append("pyuic2") - olddir = sip_tqt_config.push_dir("pyuic2") config.create_makefile("pyuic.pro", []) sip_tqt_config.pop_dir(olddir) diff --git a/configure.py b/configure.py index b5c4221..0981ad5 100644 --- a/configure.py +++ b/configure.py @@ -361,24 +361,6 @@ class ConfigurePyTQt3(ConfigureBase): makefile.generate() tool_dirs.append("pylupdate3") - elif qt_version >= 0x020000: - sip_tqt_config.inform("Creating pyuic Makefile...") - - makefile = sip_tqt_config.ProgramMakefile( - configuration=sipcfg, - build_file="pyuic.sbf", - dir="pyuic2", - install_dir=opt_pyqtbindir, - console=1, - qt=1, - warnings=1 - ) - - makefile.extra_defines.append("UIC") - makefile.extra_include_dirs.append(qt_dir + "/src/3rdparty/zlib") - - makefile.generate() - tool_dirs.append("pyuic2") return tool_dirs diff --git a/examples/README b/examples/README new file mode 100644 index 0000000..fcebe5f --- /dev/null +++ b/examples/README @@ -0,0 +1,12 @@ +To run these examples, make sure you have your PYTHONPATH environment variable +set if needed and explicitly set the path to python at the top of each script +if you don't have /usr/bin/env. + +The examples are written for TQt v3.x. + +A much better source of information about using PyTQt is Boudewijn Rempt's +book at http://stage.linuxports.com/projects/pyqt/. + + +Phil Thompson +phil@riverbankcomputing.co.uk diff --git a/examples/SQL/README b/examples/SQL/README new file mode 100644 index 0000000..862e608 --- /dev/null +++ b/examples/SQL/README @@ -0,0 +1,76 @@ +This directory contains some translated sql examples from TQt 3.x. + +runform1.py, form1.ui: + + A simple designer generated TQDataTable. Run "pyuic form1.ui -o form1.py". + +runform2.py, form2.ui: + + A simple designer generated TQDataBrowser. Run "pyuic form2.ui -o form2.py". + +sqlcustom1.py: + + TQSqlForm based form with a simple custom editor forcing all input to + be uppercase + +sqltable4.py: + + Custom TQDataTable with reimplemented paintField method, combined with + a TQComboBox based custom field editor (StatusPicker), gathering its + items from a different table (status) and a calculated column (monsalary). + Note, that TQSqlEditorFactory based field editors are somewhat restricted, + because TQt's TQ_PROPERTY feature isn't supported, yet. I've circumvented + this limitation by choosing the status table ids corresponding to the + index in the TQComboBox. + +sqlsubclass5.py: + + Similar to the former, and even more deviated from its qt ancestor, + because the sense escaped me. This could be related to the different + database layout needed for MySQL (Trolltech used PostgreSQL sequences, + while we're using the simpler, but less powerful auto_increment here). + If you enter and invalid date (e.g. day: 0) in the Paid column, it is + shown as "not yet", but produces some qt warnings. + +runsqlex.py, sqlex.ui, sqlex.ui.h, connect.ui, connect.ui.h: + + This one is a most advanced example, showing the use of a TQSqlCursor + driven by TQSqlQuery and iterating through database tables and fields. + Definitely worth a look. + +Unfortunately you will have to make sure that these prerequisites are met +before trying the examples: + + - Install MySQL or PostgreSQL and any development packages + + - Create a database user with sufficient rights + + - Create the testdb database + - For MySQL, run: mysql -u user -p password < testdb_mysql.sql + - For PostgreSQL, run: psql -U user template1 -f testdb_pg.sql + + - Build TQt with the mysql and/or psql modules activated. + +Now you should be ready for the fun part. You can run dbconnect.py from +a command line and try to connect to the database. If all went well, +'ok' should be printed after pressing OK. If you don't want to enter all +your data over and over again, create a file named local_dbpar.py here, +with the following keys (with your own data, of course): + +DB_HOSTNAMES = ["localhost"] +DB_DATABASES = ["testdb"] +DB_USERNAME = "name" +DB_PASSWORD = "pass" + +The dbconnect.py script is generated from dbconnect.ui, which was created +with qt's designer. You can find it also in Boudewijn Rempt's book +"GUI Programming with Python, using the TQt Toolkit". Although you won't find +the SQL widgets discussed there, for the simple reason of the book being +written before they appeared, it is a valuable source for anybody new in +this area. + +Please direct any comments, patches and questions to . + +Good luck + +Hans-Peter Jansen diff --git a/examples/SQL/connect.ui b/examples/SQL/connect.ui new file mode 100644 index 0000000..d33a783 --- /dev/null +++ b/examples/SQL/connect.ui @@ -0,0 +1,238 @@ + +ConnectDialog + + + ConnectDialog + + + + 0 + 0 + 303 + 251 + + + + Connect... + + + + unnamed + + + 11 + + + 6 + + + + GroupBox3 + + + Connection settings + + + + unnamed + + + 11 + + + 6 + + + + editDatabase + + + + + TextLabel3 + + + Database Name: + + + comboDatabase + + + + + editPassword + + + Password + + + + + TextLabel4 + + + &Username: + + + editUsername + + + + + TextLabel4_2 + + + &Password: + + + editPassword + + + + + comboDriver + + + + + editUsername + + + + + editHostname + + + + + TextLabel5 + + + &Hostname: + + + editHostname + + + + + TextLabel5_2 + + + P&ort: + + + portSpinBox + + + + + portSpinBox + + + Default + + + 65535 + + + -1 + + + -1 + + + + + TextLabel2 + + + D&river + + + comboDriver + + + + + + + Layout25 + + + + unnamed + + + 0 + + + 6 + + + + Spacer1 + + + Horizontal + + + Expanding + + + + + PushButton1 + + + &OK + + + true + + + + + PushButton2 + + + &Cancel + + + + + + + + + PushButton1 + clicked() + ConnectDialog + accept() + + + PushButton2 + clicked() + ConnectDialog + reject() + + + + comboDriver + editDatabase + editUsername + editPassword + editHostname + portSpinBox + PushButton1 + PushButton2 + + + connect.ui.h + + + init() + destroy() + + + diff --git a/examples/SQL/connect.ui.h b/examples/SQL/connect.ui.h new file mode 100644 index 0000000..ceff8dc --- /dev/null +++ b/examples/SQL/connect.ui.h @@ -0,0 +1,21 @@ +/**************************************************************************** +** ui.h extension file, included from the uic-generated form implementation. +** +** If you wish to add, delete or rename slots use TQt Designer which will +** update this file, preserving your code. Create an init() slot in place of +** a constructor, and a destroy() slot in place of a destructor. +*****************************************************************************/ + + +void ConnectDialog::init() +{ +from python_tqt.qtsql import TQSqlDatabase +#qDebug("ConnectDialog init") +self.comboDriver.clear() +self.comboDriver.insertStringList(TQSqlDatabase.drivers()) +} + +void ConnectDialog::destroy() +{ + +} diff --git a/examples/SQL/dbconnect.py b/examples/SQL/dbconnect.py new file mode 100755 index 0000000..d1c1baf --- /dev/null +++ b/examples/SQL/dbconnect.py @@ -0,0 +1,82 @@ +#!/usr/bin/env python + +import sys +from python_tqt.qt import * +from python_tqt.qtsql import * + +from frmconnect import frmConnect +from dbpar import * + +TRUE = 1 +FALSE = 0 + +def createConnection(): + driver = DB_DRIVER + # all qt examples use TQSqlDatabase::addDatabase, but + # this never returns NULL in my experience + drivers = list(map(str, TQSqlDatabase.drivers())) + if driver in drivers: + dlg = dbConnect(driver) + #TODO: make connection parameters accessible + return dlg.exec_loop() + else: + TQMessageBox.warning(None, "Database Error", + "<%s> database driver not found!\n\n" + "Please make sure, that this database adaptor\n" + "is available in your TQt installation.\n" % + (driver), TQMessageBox.Abort | TQMessageBox.Escape) + return FALSE + +class dbConnect(frmConnect): + def __init__(self, driver, parent = None): + frmConnect.__init__(self, parent) + self.hostnames = DB_HOSTNAMES + self.hostname = DB_HOSTNAMES[0] + self.databases = DB_DATABASES + self.database = DB_DATABASES[0] + self.username = DB_USERNAME + self.password = DB_PASSWORD + self.dbdriver = driver + + self.txtName.setText(self.username) + self.txtPasswd.setText(self.password) + list(map(self.cmbServer.insertItem, self.hostnames)) + list(map(self.cmbDatabase.insertItem, self.databases)) + self.connect(self.buttonHelp, SIGNAL("clicked()"), + self.buttonHelp_clicked) + + def accept(self): + self.hostname = self.cmbServer.currentText() + self.database = self.cmbDatabase.currentText() + self.username = self.txtName.text() + self.password = self.txtPasswd.text() + db = TQSqlDatabase.addDatabase(self.dbdriver) + if db: + db.setHostName(self.hostname) + db.setDatabaseName(self.database) + db.setUserName(self.username) + db.setPassword(self.password) + if db.open(): + frmConnect.accept(self) + else: + TQMessageBox.warning(self, "Database Error", + "Cannot open %s database on %s!\n\n%s\n%s\n" % + (self.database, self.hostname, + db.lastError().driverText(), + db.lastError().databaseText()), " Ooops ") + + + def buttonHelp_clicked(self): + TQMessageBox.information(self, "About Connecting", + "Here you specify userid, password, host and database\n" + "for the PyTQt sql examples. If you encounter any problems,\n" + "please read the README file in this folder before posting.\n\n" + "Thanks,\nHans-Peter Jansen \n") + + +if __name__ == "__main__": + app = TQApplication(sys.argv) + if createConnection(): + print("ok") + else: + print("cancel") diff --git a/examples/SQL/dbpar.py b/examples/SQL/dbpar.py new file mode 100644 index 0000000..19e6d9b --- /dev/null +++ b/examples/SQL/dbpar.py @@ -0,0 +1,22 @@ +# sql examples default database parameter + +# you can create a local_dbpar.py module with definitons +# of your own parameters to overrule these defaults + +#DB_DRIVER = "TQPSQL7" +DB_DRIVER = "TQMYSQL3" +# list of servers +DB_HOSTNAMES = ["localhost"] +# list of databases +DB_DATABASES = ["testdb"] +# database user id +DB_USERNAME = "" +# database password +DB_PASSWORD = "" + +# remove this in your local_dbpar.py +try: + from local_dbpar import * +except: + pass + diff --git a/examples/SQL/form1.ui b/examples/SQL/form1.ui new file mode 100644 index 0000000..118a84e --- /dev/null +++ b/examples/SQL/form1.ui @@ -0,0 +1,77 @@ + +Form1 + + + Form1 + + + + 0 + 0 + 600 + 370 + + + + Form1 + + + + + Forename + + + forename + + + + + Surname + + + surname + + + + + Salary + + + salary + + + + + Statusid + + + statusid + + + + DataTable2 + + + + 0 + 0 + 600 + 370 + + + + true + + + true + + + + (default) + staff + + + + + + diff --git a/examples/SQL/form2.ui b/examples/SQL/form2.ui new file mode 100644 index 0000000..4856e39 --- /dev/null +++ b/examples/SQL/form2.ui @@ -0,0 +1,327 @@ + +Form2 + + + Form2 + + + + 0 + 0 + 367 + 152 + + + + Form2 + + + + DataBrowser1 + + + + 0 + 0 + 366 + 150 + + + + + surname ASC + forename ASC + + + + + (default) + staff + + + + + unnamed + + + 11 + + + 6 + + + + Layout2 + + + + unnamed + + + 0 + + + 6 + + + + labelSurname + + + Surname + + + + + TQSpinBoxStatusid + + + 2147483647 + + + + (default) + staff + statusid + + + + + + TQLineEditSurname + + + + (default) + staff + surname + + + + + + labelStatusid + + + Statusid + + + + + labelForename + + + Forename + + + + + TQLineEditSalary + + + AlignRight + + + + (default) + staff + salary + + + + + + labelSalary + + + Salary + + + + + TQLineEditForename + + + + (default) + staff + forename + + + + + + + + Layout3 + + + + unnamed + + + 0 + + + 6 + + + + PushButtonFirst + + + |< &First + + + + + PushButtonPrev + + + << &Prev + + + + + PushButtonNext + + + &Next >> + + + + + PushButtonLast + + + &Last >| + + + + + + + Layout4 + + + + unnamed + + + 0 + + + 6 + + + + PushButtonInsert + + + &Insert + + + + + PushButtonUpdate + + + &Update + + + + + PushButtonDelete + + + &Delete + + + + + + + + + + PushButtonFirst + clicked() + DataBrowser1 + first() + + + DataBrowser1 + firstRecordAvailable( bool ) + PushButtonFirst + setEnabled(bool) + + + PushButtonPrev + clicked() + DataBrowser1 + prev() + + + DataBrowser1 + prevRecordAvailable( bool ) + PushButtonPrev + setEnabled(bool) + + + PushButtonNext + clicked() + DataBrowser1 + next() + + + DataBrowser1 + nextRecordAvailable( bool ) + PushButtonNext + setEnabled(bool) + + + PushButtonLast + clicked() + DataBrowser1 + last() + + + DataBrowser1 + lastRecordAvailable( bool ) + PushButtonLast + setEnabled(bool) + + + PushButtonInsert + clicked() + DataBrowser1 + insert() + + + PushButtonUpdate + clicked() + DataBrowser1 + update() + + + PushButtonDelete + clicked() + DataBrowser1 + del() + + + + TQLineEditForename + TQLineEditSurname + TQLineEditSalary + TQSpinBoxStatusid + PushButtonFirst + PushButtonPrev + PushButtonNext + PushButtonLast + PushButtonInsert + PushButtonUpdate + PushButtonDelete + + + diff --git a/examples/SQL/frmconnect.py b/examples/SQL/frmconnect.py new file mode 100644 index 0000000..97fb406 --- /dev/null +++ b/examples/SQL/frmconnect.py @@ -0,0 +1,120 @@ +# Form implementation generated from reading ui file 'frmconnect.ui' +# +# Created: Sam Jul 6 12:47:10 2002 +# by: The PyTQt User Interface Compiler (pyuic) +# +# WARNING! All changes made in this file will be lost! + + +from python_tqt.qt import * + + +class frmConnect(TQDialog): + def __init__(self,parent = None,name = None,modal = 0,fl = 0): + TQDialog.__init__(self,parent,name,modal,fl) + + if name == None: + self.setName("frmConnect") + + self.resize(415,154) + self.setCaption(self.trUtf8("Connecting")) + self.setSizeGripEnabled(1) + + frmConnectLayout = TQGridLayout(self,1,1,11,6,"frmConnectLayout") + + Layout7 = TQVBoxLayout(None,0,6,"Layout7") + + self.buttonOK = TQPushButton(self,"buttonOK") + self.buttonOK.setText(self.trUtf8("&OK")) + self.buttonOK.setAutoDefault(1) + self.buttonOK.setDefault(1) + TQToolTip.add(self.buttonOK,self.trUtf8("Connect to Database")) + Layout7.addWidget(self.buttonOK) + + self.buttonCancel = TQPushButton(self,"buttonCancel") + self.buttonCancel.setText(self.trUtf8("&Cancel")) + TQToolTip.add(self.buttonCancel,self.trUtf8("Cancel Connecting")) + Layout7.addWidget(self.buttonCancel) + + self.buttonHelp = TQPushButton(self,"buttonHelp") + self.buttonHelp.setText(self.trUtf8("&Help")) + TQToolTip.add(self.buttonHelp,self.trUtf8("About Connecting")) + Layout7.addWidget(self.buttonHelp) + spacer = TQSpacerItem(0,0,TQSizePolicy.Minimum,TQSizePolicy.Expanding) + Layout7.addItem(spacer) + + frmConnectLayout.addLayout(Layout7,0,1) + + self.grpConnection = TQGroupBox(self,"grpConnection") + self.grpConnection.setTitle(self.trUtf8("")) + self.grpConnection.setColumnLayout(0,TQt.Vertical) + self.grpConnection.layout().setSpacing(6) + self.grpConnection.layout().setMargin(11) + grpConnectionLayout = TQGridLayout(self.grpConnection.layout()) + grpConnectionLayout.setAlignment(TQt.AlignTop) + + self.txtName = TQLineEdit(self.grpConnection,"txtName") + self.txtName.setMaxLength(16) + TQToolTip.add(self.txtName,self.trUtf8("Database User ID")) + + grpConnectionLayout.addWidget(self.txtName,0,1) + + self.lblDatabase = TQLabel(self.grpConnection,"lblDatabase") + self.lblDatabase.setText(self.trUtf8("&Database")) + + grpConnectionLayout.addWidget(self.lblDatabase,3,0) + + self.lblServer = TQLabel(self.grpConnection,"lblServer") + self.lblServer.setText(self.trUtf8("&Server")) + + grpConnectionLayout.addWidget(self.lblServer,2,0) + + self.lblName = TQLabel(self.grpConnection,"lblName") + self.lblName.setText(self.trUtf8("&Name")) + + grpConnectionLayout.addWidget(self.lblName,0,0) + + self.cmbDatabase = TQComboBox(0,self.grpConnection,"cmbDatabase") + self.cmbDatabase.setEditable(1) + self.cmbDatabase.setAutoCompletion(1) + self.cmbDatabase.setDuplicatesEnabled(0) + TQToolTip.add(self.cmbDatabase,self.trUtf8("Database Name")) + + grpConnectionLayout.addWidget(self.cmbDatabase,3,1) + + self.txtPasswd = TQLineEdit(self.grpConnection,"txtPasswd") + self.txtPasswd.setMaxLength(16) + self.txtPasswd.setEchoMode(TQLineEdit.Password) + TQToolTip.add(self.txtPasswd,self.trUtf8("Database User Password")) + + grpConnectionLayout.addWidget(self.txtPasswd,1,1) + + self.lblPasswd = TQLabel(self.grpConnection,"lblPasswd") + self.lblPasswd.setText(self.trUtf8("&Password")) + + grpConnectionLayout.addWidget(self.lblPasswd,1,0) + + self.cmbServer = TQComboBox(0,self.grpConnection,"cmbServer") + self.cmbServer.setEditable(1) + self.cmbServer.setAutoCompletion(1) + self.cmbServer.setDuplicatesEnabled(0) + TQToolTip.add(self.cmbServer,self.trUtf8("Database Server Address")) + + grpConnectionLayout.addWidget(self.cmbServer,2,1) + + frmConnectLayout.addWidget(self.grpConnection,0,0) + + self.connect(self.buttonOK,SIGNAL("clicked()"),self,SLOT("accept()")) + self.connect(self.buttonCancel,SIGNAL("clicked()"),self,SLOT("reject()")) + + self.setTabOrder(self.txtName,self.txtPasswd) + self.setTabOrder(self.txtPasswd,self.cmbServer) + self.setTabOrder(self.cmbServer,self.cmbDatabase) + self.setTabOrder(self.cmbDatabase,self.buttonOK) + self.setTabOrder(self.buttonOK,self.buttonCancel) + self.setTabOrder(self.buttonCancel,self.buttonHelp) + + self.lblDatabase.setBuddy(self.cmbDatabase) + self.lblServer.setBuddy(self.cmbServer) + self.lblName.setBuddy(self.txtName) + self.lblPasswd.setBuddy(self.txtPasswd) diff --git a/examples/SQL/frmconnect.ui b/examples/SQL/frmconnect.ui new file mode 100644 index 0000000..f2017ee --- /dev/null +++ b/examples/SQL/frmconnect.ui @@ -0,0 +1,245 @@ + +frmConnect + + + frmConnect + + + + 0 + 0 + 415 + 154 + + + + Connecting + + + true + + + + unnamed + + + 11 + + + 6 + + + + Layout7 + + + + unnamed + + + 0 + + + 6 + + + + buttonOK + + + &OK + + + true + + + true + + + Connect to Database + + + + + buttonCancel + + + &Cancel + + + Cancel Connecting + + + + + buttonHelp + + + &Help + + + About Connecting + + + + + spacer + + + Vertical + + + Expanding + + + + + + + grpConnection + + + + + + + unnamed + + + 11 + + + 6 + + + + txtName + + + 16 + + + Database User ID + + + + + lblDatabase + + + &Database + + + cmbDatabase + + + + + lblServer + + + &Server + + + cmbServer + + + + + lblName + + + &Name + + + txtName + + + + + cmbDatabase + + + true + + + true + + + false + + + Database Name + + + + + txtPasswd + + + 16 + + + Password + + + Database User Password + + + + + lblPasswd + + + &Password + + + txtPasswd + + + + + cmbServer + + + true + + + true + + + false + + + Database Server Address + + + + + + + + + buttonOK + clicked() + frmConnect + accept() + + + buttonCancel + clicked() + frmConnect + reject() + + + + txtName + txtPasswd + cmbServer + cmbDatabase + buttonOK + buttonCancel + buttonHelp + + + diff --git a/examples/SQL/runform1.py b/examples/SQL/runform1.py new file mode 100755 index 0000000..2e01b7e --- /dev/null +++ b/examples/SQL/runform1.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python + +import sys +from python_tqt.qt import * + +from form1 import Form1 +from dbconnect import createConnection + +class mainWindow(Form1): + def __init__(self,parent = None,name = None,fl = 0): + Form1.__init__(self,parent,name,fl) + +if __name__ == "__main__": + a = TQApplication(sys.argv) + if createConnection(): + TQObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()")) + w = mainWindow() + a.setMainWidget(w) + w.show() + a.exec_loop() + diff --git a/examples/SQL/runform2.py b/examples/SQL/runform2.py new file mode 100755 index 0000000..0184e9d --- /dev/null +++ b/examples/SQL/runform2.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python + +import sys +from python_tqt.qt import * + +from form2 import Form2 +from dbconnect import createConnection + +class mainWindow(Form2): + def __init__(self,parent = None,name = None,fl = 0): + Form2.__init__(self,parent,name,fl) + +if __name__ == "__main__": + a = TQApplication(sys.argv) + if createConnection(): + TQObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()")) + w = mainWindow() + a.setMainWidget(w) + w.show() + a.exec_loop() + diff --git a/examples/SQL/runsqlex.py b/examples/SQL/runsqlex.py new file mode 100755 index 0000000..2235699 --- /dev/null +++ b/examples/SQL/runsqlex.py @@ -0,0 +1,151 @@ +#!/usr/bin/env python + +import sys +from python_tqt.qt import * +from python_tqt.qtsql import * + +from sqlex import SqlEx +from connect import ConnectDialog + +from dbpar import * + +TRUE = 1 +FALSE = 0 + +def showError(err, parent): + errStr = TQString("The database reported an error:\n\n") + if not err.databaseText().isEmpty(): + errStr.append(err.databaseText()) + errStr.append("\n") + if not err.driverText().isEmpty(): + errStr.append(err.driverText()) + errStr.append("\n") + TQMessageBox.warning(parent, "Error", errStr) + +class CustomSqlCursor(TQSqlCursor): + def __init__(self, query = None, autopopulate = TRUE, db = None): + TQSqlCursor.__init__(self, None, autopopulate, db) + self.execQuery(query) + if self.isSelect() and autopopulate: + fields = self.driver().recordInfo(self) + for f in fields: + self.append(f) + self.setMode(TQSqlCursor.ReadOnly) + + def select(self, filter, sort = TQSqlIndex()): + return self.execQuery(self.lastQuery()) + + def primaryIndex(self, prime = TRUE): + return TQSqlIndex() + + def insert(self, invalidate = TRUE): + return FALSE + + def update(self, invalidate = TRUE): + return FALSE + + def delRecords(self, invalidate = TRUE): + return FALSE + + def setName(self, name, autopopulate = TRUE): + return + + +class MainWindow(SqlEx): + def __init__(self,parent = None,name = None,fl = 0): + SqlEx.__init__(self,parent,name,fl) + self.conDiag = ConnectDialog(self, "Connection Dialog", TRUE) + self.firstconn = TRUE + + def dbConnect(self): + if self.firstconn: + self.firstconn = FALSE + self.conDiag.editUsername.setText(DB_USERNAME) + self.conDiag.editPassword.setText(DB_PASSWORD) + self.conDiag.editHostname.setText(DB_HOSTNAMES[0]) + self.conDiag.editDatabase.setText(DB_DATABASES[0]) + for i in range(self.conDiag.comboDriver.count()): + if str(self.conDiag.comboDriver.text(i)) == DB_DRIVER: + self.conDiag.comboDriver.setCurrentItem(i) + break + if self.conDiag.exec_loop() != TQDialog.Accepted: + return + if self.dt.sqlCursor(): + self.dt.setSqlCursor() + + # close old connection (if any) + if TQSqlDatabase.contains("SqlEx"): + oldDb = TQSqlDatabase.database("SqlEx") + oldDb.close() + TQSqlDatabase.removeDatabase("SqlEx") + + # open the new connection + db = TQSqlDatabase.addDatabase(self.conDiag.comboDriver.currentText(), "SqlEx") + if not db: + TQMessageBox.warning(self, "Error", "Could not open database") + return + + db.setHostName(self.conDiag.editHostname.text()) + db.setDatabaseName(self.conDiag.editDatabase.text()) + db.setPort(self.conDiag.portSpinBox.value()) + if not db.open(self.conDiag.editUsername.text(), + self.conDiag.editPassword.text()): + showError(db.lastError(), self) + return + + self.lbl.setText("Double-Click on a table-name to view the contents") + self.lv.clear() + + tables = db.tables() + for t in tables: + lvi = TQListViewItem(self.lv, t) + fields = db.recordInfo(t) + for f in fields: + req = "?" + if f.isRequired() > 0: + req = "Yes" + elif f.isRequired() == 0: + req = "No" + fi = TQListViewItem(lvi, f.name(), TQVariant.typeToName(f.type()), req) + lvi.insertItem(fi) + self.lv.insertItem(lvi) + + self.submitBtn.setEnabled(TRUE) + + def execQuery(self): + cursor = CustomSqlCursor(self.te.text(), TRUE, + TQSqlDatabase.database("SqlEx", TRUE)) + if cursor.isSelect(): + self.dt.setSqlCursor(cursor, TRUE, TRUE) + self.dt.refresh() + txt = TQString("Query OK") + if cursor.size() >= 0: + txt.append(", returned rows: %s" % cursor.size()) + self.lbl.setText(txt) + else: + if not cursor.isActive(): + # an error occured + showError(cursor.lastError(), self) + else: + self.lbl.setText("Query OK, affected rows: %s" % + cursor.numRowsAffected()) + + def showTable(self, item): + i = item.parent() + if not i: + i = item + cursor = TQSqlCursor(i.text(0), TRUE, TQSqlDatabase.database("SqlEx", TRUE)) + self.dt.setSqlCursor(cursor, TRUE, TRUE) + self.dt.setSort(cursor.primaryIndex()) + self.dt.refresh(TQDataTable.RefreshAll) + self.lbl.setText("Displaying table %s" % i.text(0)) + + +if __name__ == "__main__": + a = TQApplication(sys.argv) + TQObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()")) + w = MainWindow() + a.setMainWidget(w) + w.show() + a.exec_loop() + diff --git a/examples/SQL/sqlcustom1.py b/examples/SQL/sqlcustom1.py new file mode 100755 index 0000000..4da8f8a --- /dev/null +++ b/examples/SQL/sqlcustom1.py @@ -0,0 +1,94 @@ +#!/usr/bin/env python + +#**************************************************************************** +#** $Id: sqlcustom1.py,v 1.3 2002/07/06 13:35:41 phil Exp $ +#** +#** Copyright (C) 1992-1998 Troll Tech AS. All rights reserved. +#** +#** This file is part of an example program for PyTQt. This example +#** program may be used, distributed and modified without limitation. +#** +#*****************************************************************************/ + +import sys +from python_tqt.qt import * +from python_tqt.qtsql import * + +from dbconnect import createConnection + +TRUE = 1 +FALSE = 0 + +class CustomEdit(TQLineEdit): + def __init__(self, parent = None, name = None): + TQLineEdit.__init__(self, parent, name) + TQObject.connect(self, SIGNAL("textChanged(const TQString &)"), + self.changed) + + def changed(self, line): + self.setUpperLine(line) + + def setUpperLine(self, line): + self.upperLineText = line.upper() + self.setText(self.upperLineText) + + +class FormDialog(TQDialog): + def __init__(self): + TQDialog.__init__(self) + forenameLabel = TQLabel("Forename:", self) + forenameEdit = CustomEdit(self) + surnameLabel = TQLabel("Surname:", self) + surnameEdit = CustomEdit(self) + salaryLabel = TQLabel("Salary:", self) + salaryEdit = TQLineEdit(self) + salaryEdit.setAlignment(TQt.AlignRight) + saveButton = TQPushButton("&Save", self) + self.connect(saveButton, SIGNAL("clicked()"), self.save) + + grid = TQGridLayout(self) + grid.addWidget(forenameLabel, 0, 0) + grid.addWidget(forenameEdit, 0, 1) + grid.addWidget(surnameLabel, 1, 0) + grid.addWidget(surnameEdit, 1, 1) + grid.addWidget(salaryLabel, 2, 0) + grid.addWidget(salaryEdit, 2, 1) + grid.addWidget(saveButton, 3, 0) + grid.activate() + + self.staffCursor = TQSqlCursor("staff") + self.staffCursor.setTrimmed("forename", TRUE) + self.staffCursor.setTrimmed("surname", TRUE) + self.idIndex = self.staffCursor.index("id") + self.staffCursor.select(self.idIndex) + self.staffCursor.first() + + self.propMap = TQSqlPropertyMap() + self.propMap.insert(forenameEdit.className(), "upperLine") + + self.sqlForm = TQSqlForm() + self.sqlForm.setRecord(self.staffCursor.primeUpdate()) + self.sqlForm.installPropertyMap(self.propMap) + self.sqlForm.insert(forenameEdit, "forename") + self.sqlForm.insert(surnameEdit, "surname") + self.sqlForm.insert(salaryEdit, "salary") + self.sqlForm.readFields() + + def save(self): + self.sqlForm.writeFields() + self.staffCursor.update() + self.staffCursor.select(self.idIndex) + self.staffCursor.first() + + +if __name__=='__main__': + app = TQApplication( sys.argv ) + + if createConnection(): + formDialog = FormDialog() + formDialog.show() + + app.setMainWidget(formDialog) + app.exec_loop() + + diff --git a/examples/SQL/sqlex.ui b/examples/SQL/sqlex.ui new file mode 100644 index 0000000..64b3d0f --- /dev/null +++ b/examples/SQL/sqlex.ui @@ -0,0 +1,303 @@ + +SqlEx + + + SqlEx + + + + 0 + 0 + 669 + 438 + + + + SQL Browser + + + + unnamed + + + 11 + + + 6 + + + + Layout23 + + + + unnamed + + + 0 + + + 6 + + + + lbl + + + Press "Connect" to open a database + + + + + conBtn + + + + 0 + 0 + 0 + 0 + + + + + 80 + 0 + + + + &Connect... + + + + + + + vsplit + + + Vertical + + + + hsplit + + + Horizontal + + + + + Tables + + + true + + + true + + + + + Type + + + true + + + true + + + + + Required + + + true + + + true + + + + lv + + + 0 + + + true + + + true + + + LastColumn + + + + + dt + + + false + + + + + + gb + + + SQL Query + + + + unnamed + + + 11 + + + 6 + + + + Layout22 + + + + unnamed + + + 0 + + + 6 + + + + te + + + + + Layout21 + + + + unnamed + + + 0 + + + 6 + + + + Spacer3 + + + Horizontal + + + Expanding + + + + + submitBtn + + + + 5 + 0 + 0 + 0 + + + + + 80 + 0 + + + + &Submit + + + + + clearBtn + + + + 5 + 0 + 0 + 0 + + + + + 80 + 0 + + + + C&lear + + + + + + + + + + + + + + clearBtn + clicked() + te + clear() + + + conBtn + clicked() + SqlEx + dbConnect() + + + lv + returnPressed(TQListViewItem*) + SqlEx + showTable(TQListViewItem*) + + + lv + doubleClicked(TQListViewItem*) + SqlEx + showTable(TQListViewItem*) + + + submitBtn + clicked() + SqlEx + execQuery() + + + + sqlex.ui.h + + + init() + dbConnect() + showTable( TQListViewItem * ) + execQuery() + + + diff --git a/examples/SQL/sqlex.ui.h b/examples/SQL/sqlex.ui.h new file mode 100644 index 0000000..07edcd0 --- /dev/null +++ b/examples/SQL/sqlex.ui.h @@ -0,0 +1,35 @@ +/**************************************************************************** +** ui.h extension file, included from the uic-generated form implementation. +** +** If you wish to add, delete or rename slots use TQt Designer which will +** update this file, preserving your code. Create an init() slot in place of +** a constructor, and a destroy() slot in place of a destructor. +*****************************************************************************/ + + +void SqlEx::init() +{ +self.hsplit.setSizes([250]) +self.hsplit.setResizeMode(self.lv, TQSplitter.KeepSize) +self.vsplit.setResizeMode(self.gb, TQSplitter.KeepSize) +self.submitBtn.setEnabled(0) +} + + +void SqlEx::dbConnect() +{ + +} + + +void SqlEx::showTable( TQListViewItem * ) +{ + +} + + + +void SqlEx::execQuery() +{ + +} diff --git a/examples/SQL/sqlsubclass5.py b/examples/SQL/sqlsubclass5.py new file mode 100755 index 0000000..0fdc78c --- /dev/null +++ b/examples/SQL/sqlsubclass5.py @@ -0,0 +1,151 @@ +#!/usr/bin/env python + +#**************************************************************************** +#** $Id: sqlsubclass5.py,v 1.3 2002/07/06 13:35:41 phil Exp $ +#** +#** Copyright (C) 1992-1998 Troll Tech AS. All rights reserved. +#** +#** This file is part of an example program for PyTQt. This example +#** program may be used, distributed and modified without limitation. +#** +#*****************************************************************************/ + +import sys +from python_tqt.qt import * +from python_tqt.qtsql import * + +from dbconnect import createConnection + +TRUE = 1 +FALSE = 0 + +class CustomTable(TQDataTable): + def __init__(self, cursor, autoPopulate = FALSE, parent = None, name = None): + TQDataTable.__init__(self, cursor, autoPopulate, parent, name) + + def paintField(self, p, field, cr, b): + if not field: + return + fn = str(field.name()) + if fn == "pricesid": + query = TQSqlQuery("SELECT name FROM prices WHERE id=%s" % + field.value().toString()) + value = "" + if next(query): + value = query.value(0).toString() + p.drawText(2, 2, cr.width()-4, cr.height()-4, + self.fieldAlignment(field), value) + elif fn == "quantity": + p.drawText(2, 2, cr.width()-6, cr.height()-4, + TQt.AlignRight|TQt.AlignVCenter, field.value().toString()) + elif fn in ("price", "cost"): + v = field.value().toDouble() + if v < 0: + p.setPen(TQColor("red")) + value = TQString("%.2f \u20ac" % v) + p.drawText(2, 2, cr.width()-6, cr.height()-4, + TQt.AlignRight|TQt.AlignVCenter, value) + elif fn == "paiddate": + if field.value().toDate().isNull(): + v = TQString("not yet") + p.setPen(TQColor("red")) + else: + v = field.value().toDate().toString(TQt.LocalDate) + p.drawText(2, 2, cr.width()-4, cr.height()-4, + TQt.AlignHCenter|TQt.AlignVCenter, v) + else: + TQDataTable.paintField(self, p, field, cr, b) + + +class InvoiceItemCursor(TQSqlCursor): + def __init__(self): + TQSqlCursor.__init__(self, "invoiceitem") + + productPrice = TQSqlFieldInfo("price", TQVariant.Double) + self.append(productPrice) + self.setCalculated(productPrice.name(), TRUE) + + productCost = TQSqlFieldInfo("cost", TQVariant.Double) + self.append(productCost) + self.setCalculated(productCost.name(), TRUE) + + def calculateField(self, name): + fn = str(name) + if fn == "productname": + query = TQSqlQuery("SELECT name FROM prices WHERE id=%d;" % + (self.field("pricesid").value().toInt())) + if next(query): + return query.value(0) + elif fn == "price": + query = TQSqlQuery("SELECT price FROM prices WHERE id=%d;" % + (self.field("pricesid").value().toInt())) + if next(query): + return query.value(0) + elif fn == "cost": + query = TQSqlQuery("SELECT price FROM prices WHERE id=%d;" % + (self.field("pricesid").value().toInt())) + if next(query): + return TQVariant(query.value(0).toDouble() * + self.value("quantity").toDouble()) + return TQVariant(TQString.null) + + def primeInsert(self): + buffer = self.editBuffer() + buffer.setValue("id", TQVariant(0)) + buffer.setValue("paiddate", TQVariant(TQDate.currentDate())) + buffer.setValue("quantity", TQVariant(1)) + return buffer + + +class ProductPicker(TQComboBox): + def __init__(self, parent = None, name = None): + TQComboBox.__init__(self, parent, name) + cur = TQSqlCursor("prices") + cur.select(cur.index("id")) + while next(cur): + self.insertItem(cur.value("name").toString(), cur.value("id").toInt()) + + +class CustomSqlEditorFactory(TQSqlEditorFactory): + def __init__(self): + TQSqlEditorFactory.__init__(self) + + def createEditor(self, parent, field): + try: + if str(field.name()) == "pricesid": + return ProductPicker(parent) + except AttributeError: + pass + return TQSqlEditorFactory.createEditor(self, parent, field) + +class Table(CustomTable): + def __init__(self): + self.invoiceItemCursor = InvoiceItemCursor() + TQDataTable.__init__(self, self.invoiceItemCursor) + self.propMap = TQSqlPropertyMap() + self.editorFactory = CustomSqlEditorFactory() + self.propMap.insert("ProductPicker", "pricesid") + self.installPropertyMap(self.propMap) + self.installEditorFactory(self.editorFactory) + + for cn, ch in (("pricesid", "Product"), + ("quantity", "Quantity"), + ("price", "Price" ), + ("cost", "Cost"), + ("paiddate", "Paid")): + self.addColumn(cn, ch) + self.setColumnWidth(0 , 150) + self.setColumnWidth(1, 70) + self.resize(600, 250) + self.refresh() + + +if __name__=='__main__': + app = TQApplication(sys.argv) + if createConnection(): + t = Table() + app.setMainWidget(t) + t.show() + app.exec_loop() + + diff --git a/examples/SQL/sqltable4.py b/examples/SQL/sqltable4.py new file mode 100755 index 0000000..a8484c5 --- /dev/null +++ b/examples/SQL/sqltable4.py @@ -0,0 +1,118 @@ +#!/usr/bin/env python + +#**************************************************************************** +#** $Id: sqltable4.py,v 1.3 2002/07/06 13:35:41 phil Exp $ +#** +#** Copyright (C) 1992-1998 Troll Tech AS. All rights reserved. +#** +#** This file is part of an example program for PyTQt. This example +#** program may be used, distributed and modified without limitation. +#** +#*****************************************************************************/ + +import sys +from python_tqt.qt import * +from python_tqt.qtsql import * + +from dbconnect import createConnection + +TRUE = 1 +FALSE = 0 + +class CustomTable(TQDataTable): + def __init__(self, cursor, autoPopulate = FALSE, parent = None, name = None): + TQDataTable.__init__(self, cursor, autoPopulate, parent, name) + + def paintField(self, p, field, cr, b): + if not field: + return + fn = str(field.name()) + if fn in ("salary", "monsalary"): + v = field.value().toDouble() + if v < 0: + p.setPen(TQColor("red")) + value = TQString("%.2f \u20ac" % v) + #print unicode(value).encode("iso-8859-15") + p.drawText(2, 2, cr.width()-6, cr.height()-4, + TQt.AlignRight|TQt.AlignVCenter, value) + elif fn == "statusid": + query = TQSqlQuery("SELECT name FROM status WHERE id=%s" % + field.value().toString()) + value = "" + if next(query): + value = query.value(0).toString() + p.drawText(2, 2, cr.width()-4, cr.height()-4, + self.fieldAlignment(field), value) + else: + TQDataTable.paintField(self, p, field, cr, b) + + +class StatusPicker(TQComboBox): + def __init__(self, parent = None, name = None): + TQComboBox.__init__(self, parent, name) + cur = TQSqlCursor("status") + cur.select(cur.index("id")) + while next(cur): + self.insertItem(cur.value("name").toString(), cur.value("id").toInt()) + + +class CustomSqlEditorFactory(TQSqlEditorFactory): + def __init__(self): + TQSqlEditorFactory.__init__(self) + + def createEditor(self, parent, field): + try: + if str(field.name()) == "statusid": + return StatusPicker(parent) + except AttributeError: + pass + return TQSqlEditorFactory.createEditor(self, parent, field) + + +class StaffCursor(TQSqlCursor): + def __init__(self): + TQSqlCursor.__init__(self, "staff") + monSalary = TQSqlFieldInfo("monsalary", TQVariant.Double) + self.append(monSalary) + self.setCalculated(monSalary.name(), TRUE) + + def calculateField(self, name): + if str(name) == "monsalary": + return TQVariant(self.value("salary").toDouble() / 12) + return TQVariant(TQString.null) + + +class Table(CustomTable): + def __init__(self): + #self.staffCursor = TQSqlCursor("staff") + self.staffCursor = StaffCursor() + TQDataTable.__init__(self, self.staffCursor) + self.propMap = TQSqlPropertyMap() + self.editorFactory = CustomSqlEditorFactory() + self.propMap.insert("StatusPicker", "statusid") + self.installPropertyMap(self.propMap) + self.installEditorFactory(self.editorFactory) + for cn, ch in (("forename", "Forename"), + ("surname", "Surname" ), + ("salary", "Annual Salary"), + ("monsalary","Monthly Salary"), + ("statusid", "Status")): + self.addColumn(cn, ch) + self.order = TQStringList("surname") + self.order.append("forename") + self.setSort(self.order) + self.refresh() + + +if __name__=='__main__': + app = TQApplication(sys.argv) + #app.setFont(TQFont("Verdana", 11)) + + if createConnection(): + t = Table() + app.setMainWidget(t) + t.resize(600, 250) + t.show() + app.exec_loop() + + diff --git a/examples/SQL/testdb_mysql.sql b/examples/SQL/testdb_mysql.sql new file mode 100644 index 0000000..144d4c9 --- /dev/null +++ b/examples/SQL/testdb_mysql.sql @@ -0,0 +1,57 @@ +drop database testdb; +create database testdb; +use testdb; + +create table people (id integer primary key auto_increment, + name char(40)); + +create table staff (id integer primary key auto_increment, + forename char(40), + surname char(40), + salary float(10,2), + statusid integer); + +create table status (id integer primary key, + name char(30)); + +create table creditors (id integer primary key auto_increment, + forename char(40), + surname char(40), + city char(30)); + +create table prices (id integer primary key, + name char(40), + price float); + +create table invoiceitem (id integer primary key auto_increment, + pricesid integer, + quantity integer, + paiddate date); + +insert into staff (forename, surname, salary, statusid) values + ("Hugo", "Hurtig", 123450.50, 0), + ("Alfred E.", "Neumann", 56780.90, 1), + ("Agate", "Schnell-Fertig", 12340.56, 2), + ("Emil", "Dotterschreck", -5670.23, 3), + ("Eugen", "Nutzlos", -7833.56, 3), + ("Harald", "Schmidt", -150000.0, 3), + ("Urmel", "auf dem Eis", 7778.0, 2); + +insert into status (id, name) values + (0, 'Chief'), + (1, 'Programmer'), + (2, 'Secretary'), + (3, 'Driver'); + +insert into prices (id, name, price) values + (0, "Waschbecken", 150.25), + (1, "Wellensittich", 27.95), + (2, "Roter Papagei", 850.0), + (3, "Spam & Eggs", -7.50), + (4, "Renault Espace", 9000.0), + (5, "Tux, der Pinguin", 65.35), + (6, "Makroskop", 985000.0), + (7, "Regenbaum", 1235.65), + (8, "Bluterguß", 23.95), + (9, "Weltmeisterschaft", 2.95), + (10, "Premiere Dekoder", -185.75); diff --git a/examples/SQL/testdb_pg.sql b/examples/SQL/testdb_pg.sql new file mode 100644 index 0000000..73a4270 --- /dev/null +++ b/examples/SQL/testdb_pg.sql @@ -0,0 +1,232 @@ +-- +-- Selected TOC Entries: +-- +-- +-- TOC Entry ID 1 (OID 0) +-- +-- Name: testdb Type: DATABASE Owner: postgres +-- + +CREATE DATABASE "testdb"; + +\connect testdb postgres +-- +-- TOC Entry ID 16 (OID 17332) +-- +-- Name: people Type: TABLE Owner: postgres +-- + +CREATE TABLE "people" ( + "id" integer DEFAULT nextval('people_id_seq'::text) NOT NULL, + "name" character(40), + Constraint "people_pkey" Primary Key ("id") +); + +-- +-- TOC Entry ID 17 (OID 17335) +-- +-- Name: staff Type: TABLE Owner: postgres +-- + +CREATE TABLE "staff" ( + "id" integer DEFAULT nextval('staff_id_seq'::text) NOT NULL, + "forename" character(40), + "surname" character(40), + "salary" money, + "statusid" integer, + Constraint "staff_pkey" Primary Key ("id") +); + +-- +-- TOC Entry ID 18 (OID 17338) +-- +-- Name: status Type: TABLE Owner: postgres +-- + +CREATE TABLE "status" ( + "id" integer NOT NULL, + "name" character(30), + Constraint "status_pkey" Primary Key ("id") +); + +-- +-- TOC Entry ID 19 (OID 17341) +-- +-- Name: creditors Type: TABLE Owner: postgres +-- + +CREATE TABLE "creditors" ( + "id" integer DEFAULT nextval('creditors_id_seq'::text) NOT NULL, + "forename" character(40), + "surname" character(40), + "city" character(30), + Constraint "creditors_pkey" Primary Key ("id") +); + +-- +-- TOC Entry ID 20 (OID 17344) +-- +-- Name: prices Type: TABLE Owner: postgres +-- + +CREATE TABLE "prices" ( + "id" integer NOT NULL, + "name" character(40), + "price" real, + Constraint "prices_pkey" Primary Key ("id") +); + +-- +-- TOC Entry ID 21 (OID 17347) +-- +-- Name: invoiceitem Type: TABLE Owner: postgres +-- + +CREATE TABLE "invoiceitem" ( + "id" integer DEFAULT nextval('invoice_id_seq'::text) NOT NULL, + "pricesid" integer, + "quantity" integer, + "paiddate" date, + Constraint "invoiceitem_pkey" Primary Key ("id") +); + +-- +-- TOC Entry ID 2 (OID 17351) +-- +-- Name: people_id_seq Type: SEQUENCE Owner: postgres +-- + +CREATE SEQUENCE "people_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1; + +-- +-- TOC Entry ID 4 (OID 17353) +-- +-- Name: staff_id_seq Type: SEQUENCE Owner: postgres +-- + +CREATE SEQUENCE "staff_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1; + +-- +-- TOC Entry ID 6 (OID 17355) +-- +-- Name: creditors_id_seq Type: SEQUENCE Owner: postgres +-- + +CREATE SEQUENCE "creditors_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1; + +-- +-- TOC Entry ID 8 (OID 17357) +-- +-- Name: invoice_id_seq Type: SEQUENCE Owner: postgres +-- + +CREATE SEQUENCE "invoice_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1; + +-- +-- Data for TOC Entry ID 28 (OID 17332) +-- +-- Name: people Type: TABLE DATA Owner: postgres +-- + + +COPY "people" FROM stdin; +\. +-- +-- Data for TOC Entry ID 29 (OID 17335) +-- +-- Name: staff Type: TABLE DATA Owner: postgres +-- + + +COPY "staff" FROM stdin; +1 Hugo Hurtig $123,450.50 0 +2 Alfred E. Neumann $56,780.90 1 +3 Agate Schnell-Fertig $12,340.56 2 +6 Eugen Nutzlos -$7,833.56 3 +7 Harald Schmidt -$150,000.00 3 +4 Urmel auf dem Eis $7,778.00 2 +5 Emil Dotterschreck -$5,670.23 3 +\. +-- +-- Data for TOC Entry ID 30 (OID 17338) +-- +-- Name: status Type: TABLE DATA Owner: postgres +-- + + +COPY "status" FROM stdin; +0 Chief +1 Programmer +2 Secretary +3 Driver +\. +-- +-- Data for TOC Entry ID 31 (OID 17341) +-- +-- Name: creditors Type: TABLE DATA Owner: postgres +-- + + +COPY "creditors" FROM stdin; +\. +-- +-- Data for TOC Entry ID 32 (OID 17344) +-- +-- Name: prices Type: TABLE DATA Owner: postgres +-- + + +COPY "prices" FROM stdin; +0 Waschbecken 150.25 +1 Wellensittich 27.95 +2 Roter Papagei 850 +3 Spam & Eggs -7.5 +4 Renault Espace 9000 +5 Tux, der Pinguin 65.35 +6 Makroskop 985000 +7 Regenbaum 1235.65 +8 Bluterguß 23.95 +9 Weltmeisterschaft 2.95 +10 Premiere Dekoder -185.75 +\. +-- +-- Data for TOC Entry ID 33 (OID 17347) +-- +-- Name: invoiceitem Type: TABLE DATA Owner: postgres +-- + + +COPY "invoiceitem" FROM stdin; +\. +-- +-- TOC Entry ID 3 (OID 17351) +-- +-- Name: people_id_seq Type: SEQUENCE SET Owner: postgres +-- + +SELECT setval ('"people_id_seq"', 1, false); + +-- +-- TOC Entry ID 5 (OID 17353) +-- +-- Name: staff_id_seq Type: SEQUENCE SET Owner: postgres +-- + +SELECT setval ('"staff_id_seq"', 8, true); + +-- +-- TOC Entry ID 7 (OID 17355) +-- +-- Name: creditors_id_seq Type: SEQUENCE SET Owner: postgres +-- + +SELECT setval ('"creditors_id_seq"', 1, false); + +-- +-- TOC Entry ID 9 (OID 17357) +-- +-- Name: invoice_id_seq Type: SEQUENCE SET Owner: postgres +-- + +SELECT setval ('"invoice_id_seq"', 1, false); + diff --git a/examples/aclock.py b/examples/aclock.py new file mode 100755 index 0000000..66283ef --- /dev/null +++ b/examples/aclock.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python + +import sys +from python_tqt.qt import * + +def TQMIN(x, y): + if y > x: return y + return x +class AnalogClock(TQWidget): + def __init__(self, *args): + TQWidget.__init__(*(self,) + args) + self.time = TQTime.currentTime() + internalTimer = TQTimer(self) + self.connect(internalTimer, SIGNAL("timeout()"), self.timeout) + internalTimer.start(5000) + + def timeout(self): + new_time = TQTime.currentTime() + if new_time.minute() != self.time.minute(): + self.update() + + def paintEvent(self, qe): + if not self.isVisible(): + return + self.time = TQTime.currentTime() + + pts = TQPointArray() + paint = TQPainter(self) + paint.setBrush(self.foregroundColor()) + + cp = TQPoint(self.rect().center()) + d = TQMIN(self.width(), self.height()) + matrix = TQWMatrix() + matrix.translate(cp.x(), cp.y()) + matrix.scale(d/1000.0, d/1000.0) + + h_angle = 30*(self.time.hour()%12 - 3) + self.time.minute()/2 + matrix.rotate(h_angle) + paint.setWorldMatrix(matrix) + pts.setPoints([-20,0,0,-20,300,0,0,20]) + paint.drawPolygon(pts) + matrix.rotate(-h_angle) + + m_angle = (self.time.minute()-15)*6 + matrix.rotate(m_angle) + paint.setWorldMatrix(matrix) + pts.setPoints([-10,0,0,-10,400,0,0,10]) + paint.drawPolygon(pts) + matrix.rotate(-m_angle) + + for i in range(0,12): + paint.setWorldMatrix(matrix) + paint.drawLine(450,0, 500,0) + matrix.rotate(30) + +a = TQApplication(sys.argv) +clock = AnalogClock() +clock.resize(100,100) +a.setMainWidget(clock) +clock.show() +a.exec_loop() diff --git a/examples/addressbook.py b/examples/addressbook.py new file mode 100755 index 0000000..14b5679 --- /dev/null +++ b/examples/addressbook.py @@ -0,0 +1,457 @@ +#!/usr/bin/env python + +# A port to PyTQt of the application example from TQt v2.x. + + +import sys, string +from python_tqt.qt import * + +TRUE = 1 +FALSE = 0 +fileopen = [ +' 16 13 5 1', +'. c #040404', +'# c #808304', +'a c None', +'b c #f3f704', +'c c #f3f7f3', +'aaaaaaaaa...aaaa', +'aaaaaaaa.aaa.a.a', +'aaaaaaaaaaaaa..a', +'a...aaaaaaaa...a', +'.bcb.......aaaaa', +'.cbcbcbcbc.aaaaa', +'.bcbcbcbcb.aaaaa', +'.cbcb...........', +'.bcb.#########.a', +'.cb.#########.aa', +'.b.#########.aaa', +'..#########.aaaa', +'...........aaaaa' +] + +filesave = [ +' 14 14 4 1', +'. c #040404', +'# c #808304', +'a c #bfc2bf', +'b c None', +'..............', +'.#.aaaaaaaa.a.', +'.#.aaaaaaaa...', +'.#.aaaaaaaa.#.', +'.#.aaaaaaaa.#.', +'.#.aaaaaaaa.#.', +'.#.aaaaaaaa.#.', +'.##........##.', +'.############.', +'.##.........#.', +'.##......aa.#.', +'.##......aa.#.', +'.##......aa.#.', +'b.............' +] + +fileprint = [ +' 16 14 6 1', +'. c #000000', +'# c #848284', +'a c #c6c3c6', +'b c #ffff00', +'c c #ffffff', +'d c None', +'ddddd.........dd', +'dddd.cccccccc.dd', +'dddd.c.....c.ddd', +'ddd.cccccccc.ddd', +'ddd.c.....c....d', +'dd.cccccccc.a.a.', +'d..........a.a..', +'.aaaaaaaaaa.a.a.', +'.............aa.', +'.aaaaaa###aa.a.d', +'.aaaaaabbbaa...d', +'.............a.d', +'d.aaaaaaaaa.a.dd', +'dd...........ddd' +] + +class ABCentralWidget( TQWidget ): + def __init__( self, *args ): + TQWidget.__init__(*(self, ) + args) + self.mainGrid = TQGridLayout( self, 2, 1, 5, 5 ) + + self.setupTabWidget() + self.setupListView() + + self.mainGrid.setRowStretch( 0, 0 ) + self.mainGrid.setRowStretch( 1, 1 ) + + def save( self, filename ): + if not self.listView.firstChild(): + return + + f = TQFile( filename ) + if not f.open( IO_WriteOnly ): + return + + t = TQTextStream( f ) + + #it = TQListViewItemIterator( self.listView ) + + while not t.eof(): + item = TQListViewItem( self.listView ) + for i in range (0, 4): + t << item.text( i ) << '\n' + #for it in it.current(): + #for i in range (0, 4): + #t << it.current().text[ i ] << "\n" + + f.close() + + + def load( self, filename ): + self.listView.clear() + + f = TQFile( filename ) + if not f.open( IO_ReadOnly ): + return + + t = TQTextStream( f ) + + while not t.eof(): + item = TQListViewItem( self.listView ) + for i in range (0, 4): + item.setText( i, t.readLine() ) + + f.close(); + + + def setupTabWidget( self ): + self.tabWidget = TQTabWidget( self ) + + self.input = TQWidget( self.tabWidget ) + self.grid1 = TQGridLayout( self.input, 2, 5, 5, 5 ) + + self.liFirstName = TQLabel( 'First &Name', self.input ) + self.liFirstName.resize( self.liFirstName.sizeHint() ) + self.grid1.addWidget( self.liFirstName, 0, 0 ) + + self.liLastName = TQLabel( '&Last Name', self.input ) + self.liLastName.resize( self.liLastName.sizeHint() ) + self.grid1.addWidget( self.liLastName, 0, 1 ) + + self.liAddress = TQLabel( '&Address', self.input ) + self.liAddress.resize( self.liAddress.sizeHint() ) + self.grid1.addWidget( self.liAddress, 0, 2 ) + + self.liEMail = TQLabel( '&E-Mail', self.input ) + self.liEMail.resize( self.liEMail.sizeHint() ) + self.grid1.addWidget( self.liEMail, 0, 3 ) + + self.add = TQPushButton( '&Add', self.input ) + self.add.resize( self.add.sizeHint() ) + self.grid1.addWidget( self.add, 0, 4 ) + self.connect( self.add, SIGNAL( 'clicked()' ), self.addEntry ) + + self.iFirstName = TQLineEdit( self.input ) + self.iFirstName.resize( self.iFirstName.sizeHint() ) + self.grid1.addWidget( self.iFirstName, 1, 0 ) + self.liFirstName.setBuddy( self.iFirstName ) + + self.iLastName = TQLineEdit( self.input ) + self.iLastName.resize( self.iLastName.sizeHint() ) + self.grid1.addWidget( self.iLastName, 1, 1 ) + self.liLastName.setBuddy( self.iLastName ) + + self.iAddress = TQLineEdit( self.input ) + self.iAddress.resize( self.iAddress.sizeHint() ) + self.grid1.addWidget( self.iAddress, 1, 2 ) + self.liAddress.setBuddy( self.iAddress ) + + self.iEMail = TQLineEdit( self.input ) + self.iEMail.resize( self.iEMail.sizeHint() ) + self.grid1.addWidget( self.iEMail, 1, 3 ) + self.liEMail.setBuddy( self.iEMail ) + + self.change = TQPushButton( '&Change', self.input ) + self.change.resize( self.change.sizeHint() ) + self.grid1.addWidget( self.change, 1, 4 ) + self.connect( self.change, SIGNAL( 'clicked()' ), self.changeEntry ) + + self.tabWidget.addTab( self.input, '&Add/Change Entry' ) + + # -------------------------------------- + + self.search = TQWidget( self ) + self.grid2 = TQGridLayout( self.search, 2, 5, 5, 5 ) + + self.cFirstName = TQCheckBox( 'First &Name', self.search ) + self.cFirstName.resize( self.cFirstName.sizeHint() ) + self.grid2.addWidget( self.cFirstName, 0, 0 ) + self.connect( self.cFirstName, SIGNAL( 'clicked()' ), self.toggleFirstName ) + + self.cLastName = TQCheckBox( '&Last Name', self.search ) + self.cLastName.resize( self.cLastName.sizeHint() ) + self.grid2.addWidget( self.cLastName, 0, 1 ) + self.connect( self.cLastName, SIGNAL( 'clicked()' ), self.toggleLastName ) + + self.cAddress = TQCheckBox( '&Address', self.search ) + self.cAddress.resize( self.cAddress.sizeHint() ) + self.grid2.addWidget( self.cAddress, 0, 2 ) + self.connect( self.cAddress, SIGNAL( 'clicked()' ), self.toggleAddress ) + + self.cEMail = TQCheckBox( '&E-Mail', self.search ) + self.cEMail.resize( self.cEMail.sizeHint() ) + self.grid2.addWidget( self.cEMail, 0, 3 ) + self.connect( self.cEMail, SIGNAL( 'clicked()' ), self.toggleEMail ) + + self.sFirstName = TQLineEdit( self.search ) + self.sFirstName.resize( self.sFirstName.sizeHint() ) + self.grid2.addWidget( self.sFirstName, 1, 0 ) + + self.sLastName = TQLineEdit( self.search ) + self.sLastName.resize( self.sLastName.sizeHint() ) + self.grid2.addWidget( self.sLastName, 1, 1 ) + + self.sAddress = TQLineEdit( self.search ) + self.sAddress.resize( self.sAddress.sizeHint() ) + self.grid2.addWidget( self.sAddress, 1, 2 ) + + self.sEMail = TQLineEdit( self.search ) + self.sEMail.resize( self.sEMail.sizeHint() ) + self.grid2.addWidget( self.sEMail, 1, 3 ) + + self.find = TQPushButton( '&Find', self.search ) + self.find.resize( self.find.sizeHint() ) + self.grid2.addWidget( self.find, 1, 4 ) + self.connect( self.find, SIGNAL( 'clicked()' ), self.findEntries ) + + self.cFirstName.setChecked( TRUE ) + self.sFirstName.setEnabled( TRUE ) + self.sLastName.setEnabled( FALSE ) + self.sAddress.setEnabled( FALSE ) + self.sEMail.setEnabled( FALSE ) + + self.tabWidget.addTab( self.search, "&Search" ) + + self.mainGrid.addWidget( self.tabWidget, 0, 0 ) + + def setupListView( self ): + self.listView = TQListView( self ) + self.listView.addColumn( 'First Name' ) + self.listView.addColumn( 'Last Name' ) + self.listView.addColumn( 'Address' ) + self.listView.addColumn( 'E-Mail' ) + + self.listView.setSelectionMode( TQListView.Extended ) + + self.connect( self.listView, SIGNAL( 'clicked( TQListViewItem* )' ), self.itemSelected ) + + self.mainGrid.addWidget( self.listView, 1, 0 ) + self.listView.setAllColumnsShowFocus( TRUE ) + + + def addEntry( self ): + if not self.iFirstName.text().isEmpty() or not self.iLastName.text().isEmpty() or \ + not self.iAddress.text().isEmpty() or not self.iEMail.text().isEmpty() : + self.item = TQListViewItem( self.listView ) + self.item.setText( 0, self.iFirstName.text() ) + self.item.setText( 1, self.iLastName.text() ) + self.item.setText( 2, self.iAddress.text() ) + self.item.setText( 3, self.iEMail.text() ) + + self.iFirstName.setText( '' ) + self.iLastName.setText( '' ) + self.iAddress.setText( '' ) + self.iEMail.setText( '' ) + + def changeEntry( self ): + self.item = self.listView.currentItem() + if self.item and ( not self.iFirstName.text().isEmpty() or not self.iLastName.text().isEmpty() or \ + not self.iAddress.text().isEmpty() or not self.iEMail.text().isEmpty() ) : + self.item.setText( 0, self.iFirstName.text() ) + self.item.setText( 1, self.iLastName.text() ) + self.item.setText( 2, self.iAddress.text() ) + self.item.setText( 3, self.iEMail.text() ) + + def selectionChanged( self ): + self.iFirstName.setText( '' ) + self.iLastName.setText( '' ) + self.iAddress.setText( '' ) + self.iEMail.setText( '' ) + + def itemSelected( self, item ): + self.item.setSelected( TRUE ) + self.item.repaint() + + self.iFirstName.setText( item.text( 0 ) ) + self.iLastName.setText( item.text( 1 ) ) + self.iAddress.setText( item.text( 2 ) ) + self.iEMail.setText( item.text( 3 ) ) + + def toggleFirstName( self ): + self.sFirstName.setText( '' ) + if self.cFirstName.isChecked(): + self.sFirstName.setEnabled( TRUE ) + self.sFirstName.setFocus() + else: + self.sFirstName.setEnabled( FALSE ) + + def toggleLastName( self ): + self.sLastName.setText( '' ) + if self.cLastName.isChecked(): + self.sLastName.setEnabled( TRUE ) + self.sLastName.setFocus() + else: + self.sLastName.setEnabled( FALSE ) + + + def toggleAddress( self ): + self.sAddress.setText( '' ) + if self.cAddress.isChecked(): + self.sAddress.setEnabled( TRUE ) + self.sAddress.setFocus() + else: + self.sAddress.setEnabled( FALSE ) + + + def toggleEMail( self ): + self.sEMail.setText( '' ) + if self.cEMail.isChecked(): + self.sEMail.setEnabled( TRUE ) + self.sEMail.setFocus() + + else: + self.sEMail.setEnabled( FALSE ) + + + def findEntries( self ): + if not self.cFirstName.isChecked() and not self.cLastName.isChecked() and \ + not self.cAddress.isChecked() and not self.cEMail.isChecked(): + self.listView.clearSelection() + return + + it = TQListViewItemIterator( self.listView ) + + for it in it.current() : + select = TRUE + + if self.cFirstName.isChecked(): + if select and it.current().text( 0 ).contains( self.sFirstName.text() ): + select = TRUE + else: + select = FALSE + + if self.cLastName.isChecked(): + if select and it.current().text( 1 ).contains( self.sLastName.text() ): + select = TRUE + else: + select = FALSE + + if self.cAddress.isChecked(): + if select and it.current().text( 2 ).contains( self.sAddress.text() ): + select = TRUE + else: + select = FALSE + + if self.cEMail.isChecked(): + if select and it.current().text( 3 ).contains( self.sEMail.text() ): + select = TRUE + else: + select = FALSE + + + if select: + it.current().setSelected( TRUE ) + else: + it.current().setSelected( FALSE ) + it.current().repaint() + + +class ABMainWindow(TQMainWindow): + def __init__( self ): + TQMainWindow.__init__( self, None, 'example addressbook application' ) + + self.filename = TQString.null + self.setupMenuBar() + self.setupFileTools() + self.setupStatusBar() + self.setupCentralWidget() + + def setupMenuBar( self ): + self.file = TQPopupMenu( self ) + self.menuBar().insertItem( '&File', self.file ) + + openIcon = TQIconSet( TQPixmap( fileopen ) ) + self.file.insertItem( 'New', self.fileNew, TQt.CTRL + TQt.Key_N ) + self.file.insertItem( openIcon, 'Open', self.fileOpen, TQt.CTRL + TQt.Key_O ) + self.file.insertSeparator() + saveIcon = TQIconSet( TQPixmap( filesave ) ) + self.file.insertItem( saveIcon, 'Save', self.fileSave, TQt.CTRL + TQt.Key_S ) + self.file.insertItem( 'Save As...', self.fileSaveAs ) + self.file.insertSeparator() + printIcon = TQIconSet( TQPixmap( fileprint ) ) + self.file.insertItem( printIcon, 'Print...', self.filePrint, TQt.CTRL + TQt.Key_P ) + self.file.insertSeparator() + #self.file.insertItem( 'Close', self.closeWindow, TQt.CTRL + TQt.Key_W ) + self.file.insertItem('Close', self, SLOT('close()'), TQt.CTRL+TQt.Key_W) + self.file.insertItem( 'Quit', tqApp, SLOT( 'quit()' ), TQt.CTRL + TQt.Key_Q ) + + def setupFileTools( self ): + pass + #self.fileTools = TQToolBar( self, 'file operations' ) + + def setupStatusBar( self ): + self.statusBar().message( "Ready", 2000 ) + + def setupCentralWidget( self ): + self.view = ABCentralWidget( self ) + #self.view.show() + self.setCentralWidget( self.view ) + + def closeWindow( self ): + close() + + + def fileNew( self ): + pass + + def fileOpen( self ): + fn = TQFileDialog.getOpenFileName( TQString.null, TQString.null, self ) + if not fn.isEmpty(): + self.filename = fn + self.view.load( self.filename ) + + def fileSave( self ): + if self.filename.isEmpty(): + self.fileSaveAs() + return + + self.view.save( self.filename ) + + def fileSaveAs( self ): + fn = TQFileDialog.getSaveFileName( TQString.null, TQString.null, self ) + if not fn.isEmpty(): + self.filename = fn + self.fileSave + + def filePrint( self ): + pass + + +a = TQApplication( sys.argv ) + +mw = ABMainWindow() +#mw.setupMenuBar() +#mw.setupFileTools +#mw.setupStatusBar +#mw.setupCentralWidget +#view = ABCentralWidget() +#mw.setCentralWidget( view ) +mw.setCaption( 'Addressbook 1' ) +a.setMainWidget( mw ) +mw.show() + +a.connect( a, SIGNAL( 'lastWindowClosed()' ), a, SLOT( 'quit()' ) ) +a.exec_loop() diff --git a/examples/application.py b/examples/application.py new file mode 100755 index 0000000..056e895 --- /dev/null +++ b/examples/application.py @@ -0,0 +1,277 @@ +#!/usr/bin/env python + +# A simple application. + + +import sys, string +from python_tqt.qt import * + + +fileopen = [ + '16 13 5 1', + '. c #040404', + '# c #808304', + 'a c None', + 'b c #f3f704', + 'c c #f3f7f3', + 'aaaaaaaaa...aaaa', + 'aaaaaaaa.aaa.a.a', + 'aaaaaaaaaaaaa..a', + 'a...aaaaaaaa...a', + '.bcb.......aaaaa', + '.cbcbcbcbc.aaaaa', + '.bcbcbcbcb.aaaaa', + '.cbcb...........', + '.bcb.#########.a', + '.cb.#########.aa', + '.b.#########.aaa', + '..#########.aaaa', + '...........aaaaa' +] + +filesave = [ + '14 14 4 1', + '. c #040404', + '# c #808304', + 'a c #bfc2bf', + 'b c None', + '..............', + '.#.aaaaaaaa.a.', + '.#.aaaaaaaa...', + '.#.aaaaaaaa.#.', + '.#.aaaaaaaa.#.', + '.#.aaaaaaaa.#.', + '.#.aaaaaaaa.#.', + '.##........##.', + '.############.', + '.##.........#.', + '.##......aa.#.', + '.##......aa.#.', + '.##......aa.#.', + 'b.............' +] + +fileprint = [ + '16 14 6 1', + '. c #000000', + '# c #848284', + 'a c #c6c3c6', + 'b c #ffff00', + 'c c #ffffff', + 'd c None', + 'ddddd.........dd', + 'dddd.cccccccc.dd', + 'dddd.c.....c.ddd', + 'ddd.cccccccc.ddd', + 'ddd.c.....c....d', + 'dd.cccccccc.a.a.', + 'd..........a.a..', + '.aaaaaaaaaa.a.a.', + '.............aa.', + '.aaaaaa###aa.a.d', + '.aaaaaabbbaa...d', + '.............a.d', + 'd.aaaaaaaaa.a.dd', + 'dd...........ddd' +] + + +fileOpenText = \ +''' +Click this button to open a new file.

+You can also select the Open command from the File menu.''' + +fileSaveText = \ +'''Click this button to save the file you are editing.

+You will be prompted for a filename.

+You can also select the Save command from the File menu.''' + +filePrintText = \ +'''Click this button to print the file you are editing.

+You can also select the Print command from the File menu.''' + + +editorList = [] + + +class ApplicationWindow(TQMainWindow): + def __init__(self): + TQMainWindow.__init__(self,None,'example application main window',TQt.WDestructiveClose) + + self.filename = TQString.null + self.printer = TQPrinter() + + self.fileTools = TQToolBar(self,'file operations') + + openIcon = TQPixmap(fileopen) + self.fileOpen = TQToolButton(TQIconSet(openIcon),'Open File',TQString.null,self.load,self.fileTools,'open file') + + saveIcon = TQPixmap(filesave) + self.fileSave = TQToolButton(TQIconSet(saveIcon),'Save File',TQString.null,self.save,self.fileTools,'save file') + + printIcon = TQPixmap(fileprint) + self.filePrint = TQToolButton(TQIconSet(printIcon),'Print File',TQString.null,self.printDoc,self.fileTools,'print file') + + TQWhatsThis.whatsThisButton(self.fileTools) + + TQWhatsThis.add(self.fileOpen,fileOpenText) + TQMimeSourceFactory.defaultFactory().setPixmap('fileopen',openIcon) + TQWhatsThis.add(self.fileSave,fileSaveText) + TQWhatsThis.add(self.filePrint,filePrintText) + + self.file = TQPopupMenu(self) + self.menuBar().insertItem('&File',self.file) + + self.file.insertItem('&New',self.newDoc,TQt.CTRL + TQt.Key_N) + + id = self.file.insertItem(TQIconSet(openIcon),'&Open',self.load,TQt.CTRL + TQt.Key_O) + self.file.setWhatsThis(id,fileOpenText) + + id = self.file.insertItem(TQIconSet(saveIcon),'&Save',self.save,TQt.CTRL + TQt.Key_S) + self.file.setWhatsThis(id,fileSaveText) + + id = self.file.insertItem('Save &as',self.saveAs) + self.file.setWhatsThis(id,fileSaveText) + + self.file.insertSeparator() + + id = self.file.insertItem(TQIconSet(printIcon),'&Print',self.printDoc,TQt.CTRL + TQt.Key_P) + self.file.setWhatsThis(id,filePrintText) + + self.file.insertSeparator() + + self.file.insertItem('&Close',self,SLOT('close()'),TQt.CTRL + TQt.Key_W) + self.file.insertItem('&Quit',tqApp,SLOT('closeAllWindows()'),TQt.CTRL + TQt.Key_Q) + + self.help = TQPopupMenu(self) + self.menuBar().insertSeparator() + self.menuBar().insertItem('&Help',self.help) + + self.help.insertItem('&About',self.about,TQt.Key_F1) + self.help.insertItem('About &TQt',self.aboutTQt) + + self.e = TQMultiLineEdit(self,'editor') + self.e.setFocus() + self.setCentralWidget(self.e) + + self.statusBar().message('Ready',2000) + self.resize(450,600) + + def newDoc(self): + ed = ApplicationWindow() + ed.show() + editorList.append(ed) + + def load(self): + fn = TQFileDialog.getOpenFileName(TQString.null,TQString.null,self) + if fn.isEmpty(): + self.statusBar().message('Loading aborted',2000) + return + + fileName = str(fn) + + self.e.setAutoUpdate(0) + self.e.clear() + + try: + f = open(fileName,'r') + except: + return + + for l in f.readlines(): + self.e.append(l.rstrip()) + + f.close() + + self.e.setAutoUpdate(1) + self.e.repaint() + self.e.setEdited(0) + self.setCaption(fileName) + self.statusBar().message('Loaded document %s' % (fileName),2000) + + def save(self): + if self.filename.isEmpty(): + self.saveAs() + return + + try: + f = open(str(self.filename),'w+') + except: + self.statusBar().message('Could not write to %s' % (self.filename),2000) + return + + f.write(str(self.e.text())) + f.close() + + self.e.setEdited(0) + self.setCaption(self.filename) + self.statusBar().message('File %s saved' % (self.filename),2000) + + def saveAs(self): + fn = TQFileDialog.getSaveFileName(TQString.null,TQString.null,self) + if not fn.isEmpty(): + self.filename = fn + self.save() + else: + self.statusBar().message('Saving aborted',2000) + + def printDoc(self): + Margin = 10 + pageNo = 1 + + if self.printer.setup(self): + self.statusBar().message('Printing...') + + p = TQPainter() + p.begin(self.printer) + p.setFont(self.e.font()) + yPos = 0 + fm = p.fontMetrics() + metrics = TQPaintDeviceMetrics(self.printer) + + for i in range(self.e.numLines): + if Margin + yPos > metrics.height() - Margin: + pageNo = pageNo + 1 + self.statusBar().message('Printing (page %d)...' % (pageNo)) + self.printer.newPage() + yPos = 0 + + p.drawText(Margin,Margin + yPos,metrics.width(),fm.lineSpacing(),TQt.ExpandTabs | TQt.DontClip,self.e.textLine(i)) + yPos = yPos + fm.lineSpacing() + + p.end() + self.statusBar().message('Printing completed',2000) + else: + self.statusBar().message('Printing aborted',2000) + + def closeEvent(self,ce): + if not self.e.edited(): + ce.accept() + return + + rc = TQMessageBox.information(self,'TQt Application Example', + 'The document has been changed since the last save.', + 'Save Now','Cancel','Leave Anyway',0,1) + + if rc == 0: + self.save() + ce.accept() + elif rc == 2: + ce.accept() + else: + ce.ignore() + + def about(self): + TQMessageBox.about(self,'TQt Application Example', + 'This example demonstrates simple use of TQMainWindow,\nTQMenuBar and TQToolBar.') + + def aboutTQt(self): + TQMessageBox.aboutTQt(self,'TQt Application Example') + + +a = TQApplication(sys.argv) +mw = ApplicationWindow() +mw.setCaption('Document 1') +mw.show() +a.connect(a, SIGNAL('lastWindowClosed()'), a, SLOT('quit()')) +a.exec_loop() diff --git a/examples/biff.py b/examples/biff.py new file mode 100755 index 0000000..abee0cf --- /dev/null +++ b/examples/biff.py @@ -0,0 +1,173 @@ +#!/usr/bin/env python + +import os, sys, string +from python_tqt.qt import * + + +if TQT_VERSION < 0x030100: + print("This example requires TQt v3.1.0 or later.") + sys.exit(1) + + +FALSE = 0 +TRUE = 1 + +hasmail_bmp_data = [ +"48 48 3 1", +" c None", +". c #000000", +"+ c #FFFFFF", +"................................................", +".............................++++++++++.........", +".............................++++++++++.........", +"........................++++.+++.+.+.++.........", +"......................++++.++++.+.+.+++.........", +".....................+++.....+++.+.+.++.........", +"....................++.......++.+.+.+++.........", +"...................++........++++++++++.........", +"..................++.........++++++++++.........", +".................++..........+++..+.............", +"................++...........+++..+.............", +"...............++............+++.++.............", +"..............+++++++........++++++.............", +".............++++++++++......++++++.............", +"............+++......+++.....++++.+.............", +"...........+++.........++....+++..+.............", +"...........++..........++...++++..+.............", +"..........++............++.+++++..+.............", +"..........++............++++++++..+.............", +".........++....++++++....+++.+++..+.............", +".........++......++......++..+++..+.............", +".........++..............++..+++..+.............", +".........++..............++..+++..+.............", +".........++..............++..++...+.............", +"+++++++..++.+.+..+..+.+..++.......+..+++++++++++", +".........++.+++.+.+.+.+..++.......+.............", +".........++.+.+.+++.+.+..++.......+.............", +".........++.+.+.+.+.+.+..++......++.............", +".........++.+.+.+.+.+.++.++.....++..............", +".........++..............++....++...............", +"..+.+.+..++..............++...++..+.+.+.+.+.+.+.", +".+.+.+.+.++..............++..++..+.+.+.+.+.+.+..", +"..+.+.+..++..............++.++..+.+.+.+.+.+.+.+.", +".+.+.+.+.++..............+++++.+.+.+.+.+.+.+.+..", +"..+.+.+..+++++++++++++++++++.++.+.+.+.+.+.+.+.+.", +".+.+.+.+..+++++++++++++++++..+.+.+.+.+.+.+.+.+..", +"..+.+.+.+..........+...+.....++.+.+.+.+.+.+.+.+.", +".+.+.+.+.+.+.+.+.+.+...+.....+.+.+.+.+.+.+.+.+..", +"..+.+.+.+.+.+.+.+.++...+.....++.+.+.+.+.+.+.+.+.", +".+.+.+.+.+.+.+.+.+.+...+.....+.+.+.+.+.+.+.+.+..", +"..+.+.+.+.+.+.+.+.++...+.....++.+.+.+.+.+.+.+.+.", +".+.+.+.+.+.+.+.+.+.+...+.....+.+.+.+.+.+.+.+.+..", +"..+.+.+.+.+.+.+.+.++...+....+.+.+.+.+.+.+.+.+.+.", +".+.+.+.+.+.+.+.+.+.+...+...+.+.+.+.+.+.+.+.+.+..", +"..+.+.+.+.+.+.+.+.+.+..+..+.+.+.+.+.+.+.+.+.+.+.", +".+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+..", +"..+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+...", +"................................................" +] + +nomail_bmp_data = [ +"48 48 3 1", +" c None", +". c #FFFFFF", +"+ c #000000", +"................................................", +"................................................", +"................................................", +".........................++++...................", +".......................++++++++.................", +".....................++++....+++................", +"....................+++........++...............", +"...................++...........++..............", +"..................++............++..............", +".................++..............++.......+.....", +"................++...............++......++.....", +"...............++................++.....+++.....", +"..............+++++++...........+++....++++.....", +".............++++++++++........++++...+++++.....", +"............+++......+++......+++.+..++++++.....", +"...........+++.........++....+++..+.+++.+++.....", +"...........++..........++...+++...++++..+++.....", +"..........++............++.+++...++++...++......", +"..........++............+++++...++++............", +".........++....++++++....+++...++++.............", +".........++......++......++...+++.+.............", +".........++..............++...+++.+.............", +".........++..............++...++..+.............", +".........++..............++.......+.............", +"+++++++..++..............++.......+..+++++++++++", +".........++..............++.......+.............", +".........++..............++.......+.............", +".........++..............++......++.............", +".........++..............++.....++..............", +".........++..............++....++...............", +".........++..............++...++................", +".........++..............++..++.................", +".........++..............++.++..................", +".........++..............+++++..................", +".........+++++++++++++++++++.+..................", +"..........+++++++++++++++++..+..................", +"...................+...+.....+..................", +"...................+...+.....+..................", +"...................+...+.....+..................", +"...................+...+.....+..................", +"...................+...+.....+..................", +"...................+...+.....+..................", +"...................+...+.....+..................", +"...................+...+.....+..................", +"+++.++++++++++.+.+++...+..+++++++++++.++...+++++", +"+.+++..+++.+.+++++.++..+.++.+++..+..+.++.+.++++.", +".++...+.....++...+...+++++++....+....++++++...+.", +"++++++++++++++++++++++++++++++++++++++++++++++++" +] + +class Biff(TQWidget): + def __init__(self): + TQWidget.__init__(self, None, "Biff - example application") + + mail = os.getenv("MAIL") + fi = TQFileInfo(mail); + if not fi.exists(): + s = "/var/spool/mail/"+os.getenv("USER") + fi.setFile(s) + + if fi.exists(): + self.mailbox = fi.absFilePath() + self.startTimer(1000) + + self.setMinimumSize(48, 48) + self.setMaximumSize(48, 48) + self.resize(48, 48) + + self.hasNewMail = TQPixmap(hasmail_bmp_data) + self.noNewMail = TQPixmap(nomail_bmp_data) + + self.gotMail = FALSE + self.lastModified = fi.lastModified() + + def timerEvent(self, te): + fi = TQFileInfo(self.mailbox) + newState = ( fi.lastModified().toTime_t() != self.lastModified.toTime_t() and fi.lastModified().toTime_t() > fi.lastRead().toTime_t()) + if newState != self.gotMail: + if self.gotMail == TRUE: + self.lastModified = fi.lastModified() + self.gotMail = newState + self.repaint(FALSE) + + def paintEvent(self, pe): + if self.gotMail: + bitBlt(self, 0, 0, self.hasNewMail) + else: + bitBlt(self, 0, 0, self.noNewMail) + + def mousePressEvent(self, me): + fi = TQFileInfo(self.mailbox) + lastModified = fi.lastModified() + + +a = TQApplication(sys.argv) +b = Biff() +a.setMainWidget(b) +b.show() +a.exec_loop() diff --git a/examples/bigtable.py b/examples/bigtable.py new file mode 100755 index 0000000..f2d9788 --- /dev/null +++ b/examples/bigtable.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python + +#**************************************************************************** +#** $Id: bigtable.py,v 1.1 2002/06/19 07:56:07 phil Exp $ +#** +#** Copyright (C) 1992-1998 Troll Tech AS. All rights reserved. +#** +#** This file is part of an example program for PyTQt. This example +#** program may be used, distributed and modified without limitation. +#** +#*****************************************************************************/ + +import sys +import os +from python_tqt.qt import * +from python_tqt.qttable import * + +TRUE = 1 +FALSE = 0 + +numRows = 1000000 +numCols = 1000000 + +class MyTable(TQTable): + def __init__(self, r, c): + TQTable.__init__(self, r, c) + self.items = {} + self.widgets = {} + self.setCaption("This is a big table with 1.000.000x1.000.000 cells...") + self.setLeftMargin(self.fontMetrics().width("W999999W")) + + def resizeData(self, v): + return + + def item(self, r, c): + try: + return self.items[self.indexOf(r, c)] + except KeyError: + return None + + def setItem(self, r, c, i): + self.items[self.indexOf(r, c)] = i + + def clearCell(self, r, c): + try: + del self.items[self.indexOf(r, c)] + except KeyError: + pass + + def insertWidget(self, r, c, w): + self.widgets[self.indexOf(r, c)] = w + + def cellWidget(self, r, c): + try: + return self.widgets[self.indexOf(r, c)] + except KeyError: + return None + + def clearCellWidget(self, r, c): + try: + del self.widgets[self.indexOf(r, c)] + except KeyError: + pass + + +if __name__ == '__main__': + app = TQApplication(sys.argv) + + table = MyTable(numRows, numCols) + app.setMainWidget(table) + table.show() + app.exec_loop() diff --git a/examples/buttongroups.py b/examples/buttongroups.py new file mode 100755 index 0000000..3d6883e --- /dev/null +++ b/examples/buttongroups.py @@ -0,0 +1,125 @@ +#!/usr/bin/env python +#/**************************************************************************** +#** $Id: buttongroups.py,v 1.2 2002/12/20 18:46:10 phil Exp $ +#** +#** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. +#** +#** This file is part of an example program for TQt. This example +#** program may be used, distributed and modified without limitation. +#** +#*****************************************************************************/ + +import sys +from python_tqt.qt import * + +TRUE = 1 +FALSE = 0 + +## +# Creates all child widgets of the ButtonGroups window +## + +class ButtonsGroups( TQWidget ): + def __init__( self, *args ): + TQWidget.__init__(*(self,) + args) + + # Create Widgets which allow easy layouting + self.vbox = TQVBoxLayout( self, 11, 6 ) + self.box1 = TQHBoxLayout( self.vbox ) + self.box2 = TQHBoxLayout( self.vbox ) + + # ------- first group + + # Create an exclusive button group + self.grp1 = TQButtonGroup( 1, TQGroupBox.Horizontal, "Button Group 1 (exclusive)", self ) + self.box1.addWidget( self.grp1 ) + self.grp1.setExclusive( TRUE ) + + # insert 3 radiobuttons + self.rb11 = TQRadioButton( "&Radiobutton 1", self.grp1 ) + self.rb11.setChecked( TRUE ) + TQRadioButton( "R&adiobutton 2", self.grp1 ) + TQRadioButton( "Ra&diobutton 3", self.grp1 ) + + # ------- second group + + # Create a non-exclusive buttongroup + self.grp2 = TQButtonGroup( 1, TQGroupBox.Horizontal, "Button Group 2 (non-exclusive)", self ) + self.box1.addWidget( self.grp2 ) + self.grp2.setExclusive( FALSE ) + + # insert 3 checkboxes + TQCheckBox( "&Checkbox 1", self.grp2 ) + self.cb12 = TQCheckBox( "C&heckbox 2", self.grp2 ) + self.cb12.setChecked( TRUE ) + self.cb13 = TQCheckBox( "Triple &State Button", self.grp2 ) + self.cb13.setTristate( TRUE ) + self.cb13.setChecked( TRUE ) + + # ------------ third group + + # create a buttongroup which is exclusive for radiobuttons and non-exclusive for all other buttons + self.grp3 = TQButtonGroup( 1, TQGroupBox.Horizontal, "Button Group 3 (Radiobutton-exclusive)", self ) + self.box2.addWidget( self.grp3 ) + self.grp3.setRadioButtonExclusive( TRUE ) + + # insert three radiobuttons + self.rb21 = TQRadioButton( "Rad&iobutton 1", self.grp3 ) + self.rb22 = TQRadioButton( "Radi&obutton 2", self.grp3 ) + self.rb23 = TQRadioButton( "Radio&button 3", self.grp3 ) + self.rb23.setChecked( TRUE ) + + # insert a checkbox... + self.state = TQCheckBox( "E&nable Radiobuttons", self.grp3 ) + self.state.setChecked( TRUE ) + # ...and connect its SIGNAL clicked() with the SLOT slotChangeGrp3State() + self.connect( self.state, SIGNAL( "clicked()" ), self.slotChangeGrp3State ) + + # ------------ fourth group + + # create a groupbox which layouts its childs in a columns + self.grp4 = TQButtonGroup( 1, TQGroupBox.Horizontal, "Groupbox with normal buttons", self ) + self.box2.addWidget( self.grp4 ) + + # insert two pushbuttons... + TQPushButton( "&Push Button", self.grp4 ) + self.tb2 = TQPushButton( "&Toggle Button", self.grp4 ) + + # ... and make the second one a toggle button + self.tb2.setToggleButton( TRUE ) + self.tb2.setOn( TRUE ) + + # ... and make the third one a flat button + self.tb3 = TQPushButton( "&Flat Button", self.grp4 ) + self.tb3.setFlat( TRUE ) + + # .. and the fourth a button with a menu + self.tb4 = TQPushButton( "Popup Button", self.grp4 ) + menu = TQPopupMenu(self.tb4) + menu.insertItem("Item1", 0) + menu.insertItem("Item2", 0) + menu.insertItem("Item3", 0) + menu.insertItem("Item4", 0) + self.tb4.setPopup(menu) + + # + # SLOT slotChangeGrp3State() + # enables/disables the radiobuttons of the third buttongroup + # + + def slotChangeGrp3State( self ): + self.rb21.setEnabled( self.state.isChecked() ) + self.rb22.setEnabled( self.state.isChecked() ) + self.rb23.setEnabled( self.state.isChecked() ) + + +## main program +a = TQApplication( sys.argv ) + +buttonsgroups = ButtonsGroups() +buttonsgroups.resize( 500, 250 ) +buttonsgroups.setCaption( "PyQT Example - Buttons and Groups" ) +a.setMainWidget( buttonsgroups ) +buttonsgroups.show() + +a.exec_loop() diff --git a/examples/canvas/butterfly.png b/examples/canvas/butterfly.png new file mode 100644 index 0000000..619f253 Binary files /dev/null and b/examples/canvas/butterfly.png differ diff --git a/examples/canvas/canvas.py b/examples/canvas/canvas.py new file mode 100755 index 0000000..5f7f774 --- /dev/null +++ b/examples/canvas/canvas.py @@ -0,0 +1,619 @@ +#!/usr/bin/env python + +import sys +from python_tqt.qt import * +from python_tqt.qtcanvas import * +import random + + +True = 1 +False = 0 +butterfly_fn = TQString.null +butterflyimg = [] +logo_fn = TQString.null +logoimg = [] +bouncy_logo = None +views = [] + + +class ImageItem(TQCanvasRectangle): + def __init__(self,img,canvas): + TQCanvasRectangle.__init__(self,canvas) + self.imageRTTI=984376 + self.image=img + self.pixmap=TQPixmap() + self.setSize(self.image.width(), self.image.height()) + self.pixmap.convertFromImage(self.image, TQt.OrderedAlphaDither); + + def rtti(self): + return self.imageRTTI + + def hit(self,p): + ix = p.x()-self.x() + iy = p.y()-self.y() + if not self.image.valid( ix , iy ): + return False + self.pixel = self.image.pixel( ix, iy ) + return (tqAlpha( self.pixel ) != 0) + + def drawShape(self,p): + p.drawPixmap( self.x(), self.y(), self.pixmap ) + + +class NodeItem(TQCanvasEllipse): + def __init__(self,canvas): + TQCanvasEllipse.__init__(self,6,6,canvas) + self.__inList=[] + self.__outList=[] + self.setPen(TQPen(TQt.black)) + self.setBrush(TQBrush(TQt.red)) + self.setZ(128) + + def addInEdge(self,edge): + self.__inList.append(edge) + + def addOutEdge(self,edge): + self.__outList.append(edge) + + def moveBy(self,dx,dy): + TQCanvasEllipse.moveBy(self,dx,dy) + for each_edge in self.__inList: + each_edge.setToPoint( int(self.x()), int(self.y()) ) + for each_edge in self.__outList: + each_edge.setFromPoint( int(self.x()), int(self.y()) ) + +class EdgeItem(TQCanvasLine): + __c=0 + def __init__(self,fromNode, toNode,canvas): + TQCanvasLine.__init__(self,canvas) + self.__c=self.__c+1 + self.setPen(TQPen(TQt.black)) + self.setBrush(TQBrush(TQt.red)) + fromNode.addOutEdge(self) + toNode.addInEdge(self) + self.setPoints(int(fromNode.x()),int(fromNode.y()), int(toNode.x()), int(toNode.y())) + self.setZ(127) + + def setFromPoint(self,x,y): + self.setPoints(x,y,self.endPoint().x(),self.endPoint().y()) + + def setToPoint(self,x,y): + self.setPoints(self.startPoint().x(), self.startPoint().y(),x,y) + + def count(self): + return self.__c + + def moveBy(self,dx,dy): + pass + + +class FigureEditor(TQCanvasView): + def __init__(self,c,parent,name,f): + TQCanvasView.__init__(self,c,parent,name,f) + self.__moving=0 + self.__moving_start= 0 + + def contentsMousePressEvent(self,e): # TQMouseEvent e + point = self.inverseWorldMatrix().map(e.pos()) + ilist = self.canvas().collisions(point) #TQCanvasItemList ilist + for each_item in ilist: + if each_item.rtti()==984376: + if not each_item.hit(point): + continue + self.__moving=each_item + self.__moving_start=point + return + self.__moving=0 + + def clear(self): + ilist = self.canvas().allItems() + for each_item in ilist: + if each_item: + each_item.setCanvas(None) + del each_item + self.canvas().update() + + def contentsMouseMoveEvent(self,e): + if self.__moving : + point = self.inverseWorldMatrix().map(e.pos()); + self.__moving.moveBy(point.x() - self.__moving_start.x(),point.y() - self.__moving_start.y()) + self.__moving_start = point + self.canvas().update() + + +class BouncyLogo(TQCanvasSprite): + def __init__(self,canvas): + # Make sure the logo exists. + global bouncy_logo + if bouncy_logo is None: + bouncy_logo=TQCanvasPixmapArray("qt-trans.xpm") + + TQCanvasSprite.__init__(self,None,canvas) + self.setSequence(bouncy_logo) + self.setAnimated(True) + self.initPos() + self.logo_rtti=1234 + + def rtti(self): + return self.logo_rtti + + def initPos(self): + self.initSpeed() + trial=1000 + self.move(random.random()%self.canvas().width(), random.random()%self.canvas().height()) + self.advance(0) + trial=trial-1 + while (trial & (self.xVelocity()==0 )& (self.yVelocity()==0)): + elf.move(random.random()%self.canvas().width(), random.random()%self.canvas().height()) + self.advance(0) + trial=trial-1 + + def initSpeed(self): + speed=4.0 + d=random.random()%1024/1024.0 + self.setVelocity(d*speed*2-speed, (1-d)*speed*2-speed) + + def advance(self,stage): + if stage==0: + vx=self.xVelocity() + vy=self.yVelocity() + if (vx==0.0) & (vy==0.0): + self.initSpeed() + vx=self.xVelocity() + vy=self.yVelocity() + + nx=self.x()+vx + ny=self.y()+vy + + if (nx<0) | (nx >= self.canvas().width()): + vx=-vx + if (ny<0) | (ny >= self.canvas().height()): + vy=-vy + + for bounce in [0,1,2,3]: + l=self.collisions(False) + for hit in l: + if (hit.rtti()==1234) & (hit.collidesWith(self)): + if bounce==0: + vx=-vx + elif bounce==1: + vy=-vy + vx=-vx + elif bounce==2: + vx=-vx + elif bounce==3: + vx=0 + vy=0 + self.setVelocity(vx,vy) + break + + if (self.x()+vx < 0) | (self.x()+vx >= self.canvas().width()): + vx=0 + if (self.y()+vy < 0) | (self.y()+vy >= self.canvas().height()): + vy=0 + + self.setVelocity(vx,vy) + elif stage==1: + TQCanvasItem.advance(self,stage) + + +class Main (TQMainWindow): + def __init__(self,c,parent,name,f=0): + TQMainWindow.__init__(self,parent,name,f) + self.editor=FigureEditor(c,self,name,f) + self.printer=TQPrinter() + self.dbf_id=0 + self.canvas=c + self.mainCount=0 + file=TQPopupMenu(self.menuBar()) + file.insertItem("&Fill canvas", self.init, TQt.CTRL+TQt.Key_F) + file.insertItem("&Erase canvas", self.clear, TQt.CTRL+TQt.Key_E) + file.insertItem("&New view", self.newView, TQt.CTRL+TQt.Key_N) + file.insertSeparator(); + file.insertItem("&Print", self._print, TQt.CTRL+TQt.Key_P) + file.insertSeparator() + file.insertItem("E&xit", tqApp, SLOT("quit()"), TQt.CTRL+TQt.Key_Q) + self.menuBar().insertItem("&File", file) + + edit = TQPopupMenu(self.menuBar() ) + edit.insertItem("Add &Circle", self.addCircle, TQt.ALT+TQt.Key_C) + edit.insertItem("Add &Hexagon", self.addHexagon, TQt.ALT+TQt.Key_H) + edit.insertItem("Add &Polygon", self.addPolygon, TQt.ALT+TQt.Key_P) + edit.insertItem("Add Spl&ine", self.addSpline, TQt.ALT+TQt.Key_I) + edit.insertItem("Add &Text", self.addText, TQt.ALT+TQt.Key_T) + edit.insertItem("Add &Line", self.addLine, TQt.ALT+TQt.Key_L) + edit.insertItem("Add &Rectangle", self.addRectangle, TQt.ALT+TQt.Key_R) + edit.insertItem("Add &Sprite", self.addSprite, TQt.ALT+TQt.Key_S) + edit.insertItem("Create &Mesh", self.addMesh, TQt.ALT+TQt.Key_M ) + edit.insertItem("Add &Alpha-blended image", self.addButterfly, TQt.ALT+TQt.Key_A) + self.menuBar().insertItem("&Edit", edit) + + view = TQPopupMenu(self.menuBar() ); + view.insertItem("&Enlarge", self.enlarge, TQt.SHIFT+TQt.CTRL+TQt.Key_Plus); + view.insertItem("Shr&ink", self.shrink, TQt.SHIFT+TQt.CTRL+TQt.Key_Minus); + view.insertSeparator(); + view.insertItem("&Rotate clockwise", self.rotateClockwise, TQt.CTRL+TQt.Key_PageDown); + view.insertItem("Rotate &counterclockwise", self.rotateCounterClockwise, TQt.CTRL+TQt.Key_PageUp); + view.insertItem("&Zoom in", self.zoomIn, TQt.CTRL+TQt.Key_Plus); + view.insertItem("Zoom &out", self.zoomOut, TQt.CTRL+TQt.Key_Minus); + view.insertItem("Translate left", self.moveL, TQt.CTRL+TQt.Key_Left); + view.insertItem("Translate right", self.moveR, TQt.CTRL+TQt.Key_Right); + view.insertItem("Translate up", self.moveU, TQt.CTRL+TQt.Key_Up); + view.insertItem("Translate down", self.moveD, TQt.CTRL+TQt.Key_Down); + view.insertItem("&Mirror", self.mirror, TQt.CTRL+TQt.Key_Home); + self.menuBar().insertItem("&View", view) + + self.options = TQPopupMenu( self.menuBar() ); + self.dbf_id = self.options.insertItem("Double buffer", self.toggleDoubleBuffer) + self.options.setItemChecked(self.dbf_id, True) + self.menuBar().insertItem("&Options",self.options) + + self.menuBar().insertSeparator(); + + help = TQPopupMenu( self.menuBar() ) + help.insertItem("&About", self.help, TQt.Key_F1) + help.insertItem("&About TQt", self.aboutTQt, TQt.Key_F2) + help.setItemChecked(self.dbf_id, True) + self.menuBar().insertItem("&Help",help) + + self.statusBar() + + self.setCentralWidget(self.editor) + + self.printer = 0 + self.tb=0 + self.tp=0 + + self.init() + + def init(self): + self.clear() + r=24 + r=r+1 + random.seed(r) + for i in range(self.canvas.width()/56): + self.addButterfly() + for j in range(self.canvas.width()/85): + self.addHexagon() + for k in range(self.canvas.width()/128): + self.addLogo() + + def newView(self): + m=Main(self.canvas,None,"new windiw",TQt.WDestructiveClose) + tqApp.setMainWidget(m) + m.show() + tqApp.setMainWidget(None) + views.append(m) + + def clear(self): + self.editor.clear() + + def help(self): + TQMessageBox.information(None, "PyTQt Canvas Example", + "

The PyTQt TQCanvas classes example


" + "

This is the PyTQt implementation of " + "TQt canvas example.

by Sadi Kose " + "(kose@nuvox.net)
" + "
    " + "
  • Press ALT-S for some sprites." + "
  • Press ALT-C for some circles." + "
  • Press ALT-L for some lines." + "
  • Drag the objects around." + "
  • Read the code!" + "
","Dismiss") + + def aboutTQt(self): + TQMessageBox.aboutTQt(self,"PyTQt Canvas Example") + + def toggleDoubleBuffer(self): + s = not self.options.isItemChecked(self.dbf_id) + self.options.setItemChecked(self.dbf_id,s) + self.canvas.setDoubleBuffering(s) + + def enlarge(self): + self.canvas.resize(self.canvas.width()*4/3, self.canvas.height()*4/3) + + def shrink(self): + self.canvas.resize(self.canvas.width()*3/4, self.canvas.height()*3/4) + + def rotateClockwise(self): + m = self.editor.worldMatrix() + m.rotate( 22.5 ) + self.editor.setWorldMatrix( m ) + + def rotateCounterClockwise(self): + m = self.editor.worldMatrix() + m.rotate( -22.5 ) + self.editor.setWorldMatrix( m ) + + def zoomIn(self): + m = self.editor.worldMatrix() + m.scale( 2.0, 2.0 ) + self.editor.setWorldMatrix( m ) + + def zoomOut(self): + m = self.editor.worldMatrix() + m.scale( 0.5, 0.5 ) + self.editor.setWorldMatrix( m ) + + def mirror(self): + m = self.editor.worldMatrix() + m.scale( -1, 1 ) + self.editor.setWorldMatrix( m ) + + def moveL(self): + m = self.editor.worldMatrix() + m.translate( -16, 0 ) + self.editor.setWorldMatrix( m ) + + def moveR(self): + m = self.editor.worldMatrix() + m.translate( +16, 0 ) + self.editor.setWorldMatrix( m ) + + def moveU(self): + m = self.editor.worldMatrix() + m.translate( 0, -16 ) + self.editor.setWorldMatrix( m ) + + def moveD(self): + m = self.editor.worldMatrix(); + m.translate( 0, +16 ); + self.editor.setWorldMatrix( m ) + + def _print(self): + if not self.printer: + self.printer = TQPrinter() + if self.printer.setup(self) : + pp=TQPainter(self.printer) + self.canvas.drawArea(TQRect(0,0,self.canvas.width(),self.canvas.height()),pp,False) + + def addSprite(self): + i = BouncyLogo(self.canvas) + i.setZ(256*random.random()%256); + i.show(); + + def addButterfly(self): + if butterfly_fn.isEmpty(): + return + if not butterflyimg: + butterflyimg.append(TQImage()) + butterflyimg[0].load(butterfly_fn) + butterflyimg.append(TQImage()) + butterflyimg[1] = butterflyimg[0].smoothScale( int(butterflyimg[0].width()*0.75), + int(butterflyimg[0].height()*0.75) ) + butterflyimg.append(TQImage()) + butterflyimg[2] = butterflyimg[0].smoothScale( int(butterflyimg[0].width()*0.5), + int(butterflyimg[0].height()*0.5) ) + butterflyimg.append(TQImage()) + butterflyimg[3] = butterflyimg[0].smoothScale( int(butterflyimg[0].width()*0.25), + int(butterflyimg[0].height()*0.25) ) + + i = ImageItem(butterflyimg[int(4*random.random()%4)],self.canvas) + i.move((self.canvas.width()-butterflyimg[0].width())*random.random()%(self.canvas.width()-butterflyimg[0].width()), + (self.canvas.height()-butterflyimg[0].height())*random.random()%(self.canvas.height()-butterflyimg[0].height())) + i.setZ(256*random.random()%256+250); + i.show() + + def addLogo(self): + if logo_fn.isEmpty(): + return; + if not logoimg: + logoimg.append(TQImage()) + logoimg[0].load( logo_fn ) + logoimg.append(TQImage()) + logoimg[1] = logoimg[0].smoothScale( int(logoimg[0].width()*0.75), + int(logoimg[0].height()*0.75) ) + logoimg.append(TQImage()) + logoimg[2] = logoimg[0].smoothScale( int(logoimg[0].width()*0.5), + int(logoimg[0].height()*0.5) ) + logoimg.append(TQImage()) + logoimg[3] = logoimg[0].smoothScale( int(logoimg[0].width()*0.25), + int(logoimg[0].height()*0.25) ); + + i = ImageItem(logoimg[int(4*random.random()%4)],self.canvas) + i.move((self.canvas.width()-logoimg[0].width())*random.random()%(self.canvas.width()-logoimg[0].width()), + (self.canvas.height()-logoimg[0].width())*random.random()%(self.canvas.height()-logoimg[0].width())) + i.setZ(256*random.random()%256+256) + i.show() + + def addCircle(self): + i = TQCanvasEllipse(50,50,self.canvas) + i.setBrush( TQBrush(TQColor(256*random.random()%32*8,256*random.random()%32*8,256*random.random()%32*8) )) + i.move(self.canvas.width()*random.random()%self.canvas.width(),self.canvas.width()*random.random()%self.canvas.height()) + i.setZ(256*random.random()%256) + i.show() + + def addHexagon(self): + i = TQCanvasPolygon(self.canvas) + size = canvas.width() / 25 + pa=TQPointArray(6) + pa.setPoint(0,TQPoint(2*size,0)) + pa.setPoint(1,TQPoint(size,-size*173/100)) + pa.setPoint(2,TQPoint(-size,-size*173/100)) + pa.setPoint(3,TQPoint(-2*size,0)) + pa.setPoint(4,TQPoint(-size,size*173/100)) + pa.setPoint(5,TQPoint(size,size*173/100)) + i.setPoints(pa) + i.setBrush( TQBrush(TQColor(256*random.random()%32*8,256*random.random()%32*8,256*random.random()%32*8) )) + i.move(self.canvas.width()*random.random()%self.canvas.width(),self.canvas.width()*random.random()%self.canvas.height()) + i.setZ(256*random.random()%256) + i.show() + + def addPolygon(self): + i = TQCanvasPolygon(self.canvas) + size = self.canvas.width()/2 + pa=TQPointArray(6) + pa.setPoint(0, TQPoint(0,0)) + pa.setPoint(1, TQPoint(size,size/5)) + pa.setPoint(2, TQPoint(size*4/5,size)) + pa.setPoint(3, TQPoint(size/6,size*5/4)) + pa.setPoint(4, TQPoint(size*3/4,size*3/4)) + pa.setPoint(5, TQPoint(size*3/4,size/4)) + + i.setPoints(pa) + i.setBrush(TQBrush( TQColor(256*random.random()%32*8,256*random.random()%32*8,256*random.random()%32*8)) ) + i.move(self.canvas.width()*random.random()%self.canvas.width(),self.canvas.width()*random.random()%self.canvas.height()) + i.setZ(256*random.random()%256) + i.show() + + def addSpline(self): + i = TQCanvasSpline(self.canvas) + size = canvas.width()/6 + pa=TQPointArray(12) + pa.setPoint(0,TQPoint(0,0)) + pa.setPoint(1,TQPoint(size/2,0)) + pa.setPoint(2,TQPoint(size,size/2)) + pa.setPoint(3,TQPoint(size,size)) + pa.setPoint(4,TQPoint(size,size*3/2)) + pa.setPoint(5,TQPoint(size/2,size*2)) + pa.setPoint(6,TQPoint(0,size*2)) + pa.setPoint(7,TQPoint(-size/2,size*2)) + pa.setPoint(8,TQPoint(size/4,size*3/2)) + pa.setPoint(9,TQPoint(0,size)) + pa.setPoint(10,TQPoint(-size/4,size/2)) + pa.setPoint(11,TQPoint(-size/2,0)) + i.setControlPoints(pa) + i.setBrush( TQBrush(TQColor(256*random.random()%32*8,256*random.random()%32*8,256*random.random()%32*8) )) + i.move(self.canvas.width()*random.random()%self.canvas.width(),self.canvas.width()*random.random()%self.canvas.height()) + i.setZ(256*random.random()%256) + i.show() + + def addText(self): + i = TQCanvasText(self.canvas) + i.setText("TQCanvasText") + i.move(self.canvas.width()*random.random()%self.canvas.width(),self.canvas.width()*random.random()%self.canvas.height()) + i.setZ(256*random.random()%256) + i.show() + + def addLine(self): + i = TQCanvasLine(self.canvas); + i.setPoints( self.canvas.width()*random.random()%self.canvas.width(), self.canvas.width()*random.random()%self.canvas.height(), + self.canvas.width()*random.random()%self.canvas.width(), self.canvas.width()*random.random()%self.canvas.height() ) + i.setPen( TQPen(TQColor(256*random.random()%32*8,256*random.random()%32*8,256*random.random()%32*8), 6) ) + i.setZ(256*random.random()%256) + i.show() + + def ternary(self,exp,x,y): + if exp: + return x + else: + return y + + def addMesh(self): + x0 = 0; + y0 = 0; + + if not self.tb: + self.tb = TQBrush( TQt.red ) + if not self.tp: + self.tp = TQPen( TQt.black ) + + nodecount = 0; + + w = self.canvas.width() + h = self.canvas.height() + + dist = 30 + rows = h / dist + cols = w / dist + + #ifndef TQT_NO_PROGRESSDIALOG + #progress=TQProgressDialog( "Creating mesh...", "Abort", rows, + # self, "progress", True ); + #endif + + lastRow=[] + for c in range(cols): + lastRow.append(NodeItem(self.canvas)) + for j in range(rows): + n = self.ternary(j%2 , cols-1 , cols) + prev = 0; + for i in range(n): + el = NodeItem( self.canvas ) + nodecount=nodecount+1 + r = 20*20*random.random() + xrand = r %20 + yrand = (r/20) %20 + el.move( xrand + x0 + i*dist + self.ternary(j%2 , dist/2 , 0 ), + yrand + y0 + j*dist ); + + if j > 0 : + if i < cols-1 : + EdgeItem( lastRow[i], el, self.canvas ).show() + if j%2 : + EdgeItem( lastRow[i+1], el, self.canvas ).show() + elif i > 0 : + EdgeItem( lastRow[i-1], el, self.canvas ).show() + if prev: + EdgeItem( prev, el, self.canvas ).show() + + if i > 0 : + lastRow[i-1] = prev + prev = el + el.show() + + lastRow[n-1]=prev + #ifndef TQT_NO_PROGRESSDIALOG + #progress.setProgress( j ) + #if progress.wasCancelled() : + # break + #endif + + #ifndef TQT_NO_PROGRESSDIALOG + #progress.setProgress( rows ) + #endif + #// tqDebug( "%d nodes, %d edges", nodecount, EdgeItem::count() ); + + def addRectangle(self): + i = TQCanvasRectangle( self.canvas.width()*random.random()%self.canvas.width(), + self.canvas.width()*random.random()%self.canvas.height(), + self.canvas.width()/5,self.canvas.width()/5,self.canvas) + z = 256*random.random()%256 + i.setBrush( TQBrush(TQColor(z,z,z) )) + i.setPen( TQPen(TQColor(self.canvas.width()*random.random()%32*8, + self.canvas.width()*random.random()%32*8, + self.canvas.width()*random.random()%32*8), 6) ) + i.setZ(z) + i.show() + + +if __name__=='__main__': + app=TQApplication(sys.argv) + + if len(sys.argv) > 1: + butterfly_fn=TQString(sys.argv[1]) + else: + butterfly_fn=TQString("butterfly.png") + + if len(sys.argv) > 2: + logo_fn = TQString(sys.argv[2]) + else: + logo_fn=TQString("qtlogo.png") + + canvas=TQCanvas(800,600) + canvas.setAdvancePeriod(30) + m=Main(canvas,None,"pyqt canvas example") + m.resize(m.sizeHint()) + + tqApp.setMainWidget(m) + m.setCaption("TQt Canvas Example ported to PyTQt") + if TQApplication.desktop().width() > m.width() + 10 and TQApplication.desktop().height() > m.height() + 30: + m.show() + else: + m.showMaximized() + + m.show(); + #// m.help(); + tqApp.setMainWidget(None); + + TQObject.connect( tqApp, SIGNAL("lastWindowClosed()"), tqApp, SLOT("quit()") ) + + app.exec_loop() + + # We need to explicitly delete the canvas now (and, therefore, the main + # window beforehand) to make sure that the sprite logo doesn't get garbage + # collected first. + views = [] + del m + del canvas diff --git a/examples/canvas/qt-trans.xpm b/examples/canvas/qt-trans.xpm new file mode 100644 index 0000000..225f684 --- /dev/null +++ b/examples/canvas/qt-trans.xpm @@ -0,0 +1,54 @@ +/* XPM */ +static char *qtlogo_xpm[] = { +/* width height ncolors chars_per_pixel */ +"54 34 13 1", +/* colors */ +" c #000000", +". c #999999", +"X c #333366", +"o c #6666CC", +"O c #333333", +"@ c #666699", +"# c #000066", +"$ c #666666", +"% c #3333CC", +"& c #000033", +"* c #9999CC", +"= c #333399", +"+ c None", +/* pixels */ +"+++++++++++++++++++.$OOO$.++++++++++++++++++++++++++++", +"+++++++++++++++++$ O.+++++++++++++++++++++++++", +"+++++++++++++++.O $++++++++++++++++++++++++", +"++++++++++++++. $.++.$ O+++++++++++++++++++++++", +"+++++++++++++. O.+++++++$ O++++++++++++++++++++++", +"+++++++++++++O ++++++++++$ $+++++++++++++++++++++", +"++++++++++++$ .+++++++++++O .++++++++++++++++++++", +"+++++++++++. O+++++++++++++ O++++++.+++++++++++++", +"+++++++++++$ .+++++++++++++$ .+++.O +++++++++++++", +"+++++++++++ +++++++++++++++ O+++. +++++++++++++", +"++++++++++. &Xoooo*++++++++++$ +++. +++++++++++++", +"++++++++++@=%%%%%%%%%%*+++++++. .++. +++++++++++++", +"+++++++**oooooo**++*o%%%%o+++++ $++O +++++++++++++", +"+++++*****$OOX@oooo*++*%%%%%*++O $+. OOO$++++++++*", +"++..+.++....$O$+*ooooo*+*o%%%%%O O+$ $$O.++++++**+", +"***+*+++++$$....+++*oooo**+*o%%# O++O ++++++***o*++", +"*+++++++++O $.....++**oooo**+*X &o*O ++++*ooo*++++", +"++++++++++$ O++.....++**oooo*X &%%& ..*o%%*++++++", +"++++++++++$ ++++.....+++**ooO $*o& @oo*+++++++++", +"++++++++++. .++++++.....+++*O Xo*O .++++++++++++", +"+++++++++++ O+++++++++...... .++O +++++++++++++", +"+++++++++++O +++.$$$.++++++. O+++O +++++++++++++", +"+++++++++++. $$OO O.++++O .+++O +++++++++++++", +"++++++++++++O .+++.O $++. O++++O +++++++++++++", +"++++++++++++. O+++++O $+O +++++O +++++++++++++", +"+++++++++++++. O+++++O O .+++++O .++++++++++++", +"++++++++++++++$ .++++O .++++.+$ O+.$.++++++++", +"+++++++++++++++. O$$O .+++++... +++++++++", +"+++++++++++++++++$ O+++++$$+.O O$.+++++++++", +"+++++++++++++++++++$OO O$.O O.++. .++++++++++++++++", +"+++++++++++++++++++++++++++. OO .++++++++++++++++", +"++++++++++++++++++++++++++++. O+++++++++++++++++", +"+++++++++++++++++++++++++++++. .+++++++++++++++++", +"++++++++++++++++++++++++++++++.O O.++++++++++++++++++" +}; diff --git a/examples/canvas/qtlogo.png b/examples/canvas/qtlogo.png new file mode 100644 index 0000000..96202de Binary files /dev/null and b/examples/canvas/qtlogo.png differ diff --git a/examples/checklists.py b/examples/checklists.py new file mode 100755 index 0000000..61734ba --- /dev/null +++ b/examples/checklists.py @@ -0,0 +1,135 @@ +#!/usr/bin/env python + +# Copyright (C) 2002 Oleksandr Yakovlyev (yshurik) + +import sys +from python_tqt.qt import * + +TRUE = 1 +FALSE = 0 + +class CheckLists(TQWidget): + def __init__(self, *args): + TQWidget.__init__(* (self, ) + args ) + + lay = TQHBoxLayout(self) + lay.setMargin(5) + + vbox1 = TQVBoxLayout(lay) + vbox1.setMargin(5) + + # First child: a Label + vbox1.addWidget(TQLabel("Check some items!", self)) + + # Second child: the ListView + self.lv1 = TQListView(self) + vbox1.addWidget(self.lv1) + self.lv1.addColumn("Items") + self.lv1.setRootIsDecorated(TRUE) + + # create a list with 4 ListViewItems which will be parent items of other ListViewItems + + parentList = [] + + parentList.append( TQListViewItem( self.lv1, "Parent Item 1" ) ) + parentList.append( TQListViewItem( self.lv1, "Parent Item 2" ) ) + parentList.append( TQListViewItem( self.lv1, "Parent Item 3" ) ) + parentList.append( TQListViewItem( self.lv1, "Parent Item 4" ) ) + + num = 0 + + self.childList1 = [] + # go through the list of parent items... + for i in range(4): + it = parentList[i] + it.setOpen( TRUE ) + + # ...and create 5 checkable child ListViewItems for each parent item + for j in range(5): + ci = TQCheckListItem( it, TQString("%1. Child of Parent %2").arg( j ).arg( i ), TQCheckListItem.CheckBox ) + self.childList1.append(ci) + + # Create another widget for layouting + tmp1 = TQVBoxLayout( lay ) + tmp1.setMargin( 5 ) + + # create a pushbutton + copy1 = TQPushButton( " -> ", self ) + tmp1.addWidget( copy1 ) + copy1.setMaximumWidth( copy1.sizeHint().width() ); + # connect the SIGNAL clicked() of the pushbutton with the SLOT copy1to2() + self.connect( copy1, SIGNAL('clicked()'), self.copy1to2 ) + + # another widget for layouting + vbox2 = TQVBoxLayout( lay ) + vbox2.setMargin( 5 ) + + # and another label + vbox2.addWidget( TQLabel( "Check one item!", self ) ) + + # create the second listview + self.lv2 = TQListView( self ) + vbox2.addWidget( self.lv2 ) + self.lv2.addColumn( "Items" ) + self.lv2.setRootIsDecorated( TRUE ) + + # another widget needed for layouting only + tmp2 = TQVBoxLayout( lay ) + tmp2.setMargin( 5 ) + + # create another pushbutton... + copy2 = TQPushButton( " -> ", self ) + lay.addWidget( copy2 ) + copy2.setMaximumWidth( copy2.sizeHint().width() ) + # ...and connect its clicked() SIGNAL to the copy2to3() SLOT + self.connect( copy2, SIGNAL('clicked()'), self.copy2to3 ) + + tmp3 = TQVBoxLayout( lay ) + tmp3.setMargin( 5 ) + + # and create a label which will be at the right of the window + self.label = TQLabel( "No Item yet...", self ) + tmp3.addWidget( self.label ) + + def copy1to2(self): + self.lv2.clear() + + # Insert first a controller Item into the second ListView. Always if Radio-ListViewItems + # are inserted into a Listview, the parent item of these MUST be a controller Item! + item = TQCheckListItem( self.lv2, "Controller", TQCheckListItem.Controller ) + item.setOpen( TRUE ) + + self.listChild2 = [] + for it in self.childList1: + # ...check state of childs, and... + if it.parent() != None: + # ...if the item is checked... + if it.isOn(): + # ...insert a Radio-ListViewItem with the same text into the second ListView + ri = TQCheckListItem(item , it.text(0), TQCheckListItem.RadioButton) + self.listChild2.append(ri) + + if item.firstChild() != None: + item.firstChild().setOn(TRUE) + + def copy2to3(self): + self.label.setText( "No Item checked" ) + + # iterate through the second ListView... + for it in self.listChild2: + # ...check state of childs, and... + if it.parent() != None: + # ...if the item is checked... + if it.isOn(): + # ...set the text of the item to the label + self.label.setText( it.text( 0 ) ) + +a = TQApplication(sys.argv) + +checkLists = CheckLists() +checkLists.resize(700, 400) +checkLists.setCaption("PyTQt example - CheckLists") + +a.setMainWidget(checkLists) +checkLists.show() +a.exec_loop() diff --git a/examples/cursor.py b/examples/cursor.py new file mode 100755 index 0000000..da9db7b --- /dev/null +++ b/examples/cursor.py @@ -0,0 +1,114 @@ +#!/usr/bin/env python + +"""$Id: cursor.py,v 1.1 2003/07/01 14:18:37 phil Exp $ +** +** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. +** +** This file is part of an example program for TQt. This example +** program may be used, distributed and modified without limitation. +** +***************************************************************************""" + +import sys +from python_tqt.qt import * + +# cb_bits and cm_bits were generated by X bitmap program. + +cb_width = 32 +cb_height = 32 + +# cursor bitmap +cb_bits = b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf8\x0f\x00" \ + b"\x00\x06\x30\x00\x80\x01\xc0\x00\x40\x00\x00\x01" \ + b"\x20\x00\x00\x02\x10\x00\x00\x04\x08\x3e\x3e\x08" \ + b"\x08\x03\xe0\x08\xc4\x00\x00\x11\x04\x1e\x78\x10" \ + b"\x02\x0c\x30\x20\x02\x40\x00\x20\x02\x40\x00\x20" \ + b"\x02\x40\x00\x20\x02\x20\x04\x20\x02\x20\x04\x20" \ + b"\x02\x10\x08\x20\x02\x08\x08\x20\x02\xf0\x07\x20" \ + b"\x04\x00\x00\x10\x04\x00\x00\x10\x08\x00\xc0\x08" \ + b"\x08\x3c\x30\x08\x10\xe6\x19\x04\x20\x00\x0f\x02" \ + b"\x40\x00\x00\x01\x80\x01\xc0\x00\x00\x06\x30\x00" \ + b"\x00\xf8\x0f\x00\x00\x00\x00\x00" + +cm_width = 32 +cm_height = 32 + +# cursor bitmap mask +cm_bits = b"\x00\x00\x00\x00\x00\xf8\x1f\x00\x00\xfe\x3f\x00" \ + b"\x80\x07\xf0\x00\xc0\x01\xc0\x01\x60\x00\x00\x03" \ + b"\x30\x00\x00\x06\x18\x00\x00\x0c\x0c\x3e\x3e\x18" \ + b"\x0e\x03\xe0\x18\xc6\x00\x00\x31\x07\x1e\x78\x30" \ + b"\x03\x0c\x30\x60\x03\x40\x00\x60\x03\x40\x00\x60" \ + b"\x03\x40\x00\x60\x03\x20\x04\x60\x03\x20\x04\x60" \ + b"\x03\x10\x08\x60\x03\x08\x08\x60\x03\xf0\x07\x60" \ + b"\x06\x00\x00\x30\x06\x00\x00\x30\x0c\x00\xc0\x18" \ + b"\x0c\x3c\x30\x18\x18\xe6\x19\x0c\x30\x00\x0f\x06" \ + b"\x60\x00\x00\x03\xc0\x01\xc0\x01\x80\x07\xf0\x00" \ + b"\x00\xfe\x3f\x00\x00\xf8\x0f\x00" + +# The CursorView contains many labels with different cursors. +class CursorView( TQWidget ): # cursor view + def __init__( self ): + TQWidget.__init__( self ) + # Constructs a cursor view. +#enum CursorShape { ArrowCursor, UpArrowCursor, CrossCursor, WaitCursor, IbeamCursor, SizeVerCursor, SizeHorCursor, SizeBDiagCursor, SizeFDiagCursor, SizeAllCursor, BlankCursor, SplitVCursor, SplitHCursor, PointingHandCursor, ForbiddenCursor, WhatsThisCursor, LastCursor = WhatsThisCursor, BitmapCursor = 24 } + + shape = [ + "ArrowCursor", "UpArrowCursor", "CrossCursor", + "WaitCursor", "IbeamCursor", "SizeVerCursor", + "SizeHorCursor", "SizeBDiagCursor", "SizeFDiagCursor", + "SizeAllCursor", "BlankCursor", "SplitVCursor", + "SplitHCursor", "PointingHandCursor", "ForbiddenCursor", + "WhatsThisCursor" + ] + name = [ + "standard arrow cursor", "upwards arrow", + "crosshair", "hourglass/watch", + "ibeam/text entry", "vertical resize", + "horizontal resize", "diagonal resize (/)", + "diagonal resize (\)", "all directions resize", + "blank/invisible cursor", "vertical splitting", + "horziontal splitting", "a pointing hand", + "a slashed circle", "an arrow with a question mark" + ] + + self.setCaption( "CursorView" ) # set window caption + + grid = TQGridLayout( self, 5, 4, 20 ) + + i=0 + for y in range( 0, 4, 1 ) : # create the small labels + for x in range( 0, 4, 1 ) : + label = TQLabel( self ) + label.setCursor( TQCursor(i) ) + label.setText( shape[i] ); + label.setAlignment( self.AlignCenter ) + label.setFrameStyle( TQFrame.Box | TQFrame.Raised ) + grid.addWidget( label, x, y ) + TQToolTip.add( label, name[i] ) + i += 1 + + cb = TQBitmap( cb_width, cb_height, cb_bits, True ) + cm = TQBitmap( cm_width, cm_height, cm_bits, True ) + custom = TQCursor( cb, cm ) # create bitmap cursor + + label = TQLabel( self ) # create the big label + label.setCursor( custom ) + label.setText( "Custom bitmap cursor" ) + TQToolTip.add( label, "custom bitmap cursor" ) + label.setAlignment( self.AlignCenter ) + label.setFrameStyle( TQFrame.Box | TQFrame.Sunken ) + grid.addMultiCellWidget( label, 4, 4, 0, 3 ) + +# Create and display a CursorView. +def main( args ): + a = TQApplication(sys.argv) # application object + v = CursorView() # cursor view + v.setCaption( "TQt Example - Cursors" ) + a.setMainWidget( v ) + v.show() + + a.exec_loop() + +if __name__=="__main__": + main(sys.argv) diff --git a/examples/dclock.py b/examples/dclock.py new file mode 100755 index 0000000..302d454 --- /dev/null +++ b/examples/dclock.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python + +# A port to PyTQt of the dclock example from TQt v2.x. + + +import sys, string +from python_tqt.qt import * + + +class DigitalClock(TQLCDNumber): + def __init__(self, parent=None, name=None): + TQLCDNumber.__init__(self, parent, name) + self.showingColon = 0 + self.setFrameStyle(TQFrame.Panel | TQFrame.Raised) + self.setLineWidth(2) + self.showTime() + self.normalTimer = self.startTimer(500) + self.showDateTimer = -1 + + def timerEvent(self, e): + if e.timerId() == self.showDateTimer: + self.stopDate() + else: + if self.showDateTimer == -1: + self.showTime() + + def mousePressEvent(self, e): + if e.button() == TQt.LeftButton: + self.showDate() + + def showDate(self): + if self.showDateTimer != -1: + return + d = TQDate.currentDate() + self.display('%2d %2d' % (d.month(), d.day())) + self.showDateTimer = self.startTimer(2000) + + def stopDate(self): + self.killTimer(self.showDateTimer) + self.showDateTimer = -1 + self.showTime() + + def showTime(self): + self.showingColon = not self.showingColon + s = list(str(TQTime.currentTime().toString())[:5]) #.left(5) + if not self.showingColon: + s[2] = ' ' + if s[0] == '0': + s[0] = ' ' + s = ''.join(s) + self.display(s) + +a = TQApplication(sys.argv) +clock = DigitalClock() +clock.resize(170,80) +a.setMainWidget(clock) +clock.show() +a.exec_loop() diff --git a/examples/desktop.py b/examples/desktop.py new file mode 100755 index 0000000..154b632 --- /dev/null +++ b/examples/desktop.py @@ -0,0 +1,230 @@ +#!/usr/bin/env python + +import sys +from python_tqt.qt import * + +seed = 0.353535353535 +KINDA_RAND_MAX = 32767 + +def kindaRand(): + global seed + seed = seed * 147 + seed = seed - int(seed) + return int(seed*(KINDA_RAND_MAX + 1)) + +velmax = 15 +velmin = 4 + +def velocity(i): + if i == 1 or i == 2: + i = (kindaRand()&0x7fff % velmax)/3 + velmin + else: + i = (kindaRand()&0x7fff % velmax) + velmin + return i + +maxpoints = 5 +maxcurves = 8 + +def poly(): + d = TQApplication.desktop() + d.setEraseColor(TQt.white) + xvel = [ 0 ] * maxpoints + yvel = [ 0 ] * maxpoints + head = 0 + tail = -maxcurves + 2 + a = [ TQPointArray() ] * maxcurves + r = d.rect() + for i in range(maxcurves): + a[i].resize(maxpoints) + p = a[0] + for i in range(maxpoints): + p.setPoint(i, (kindaRand()&0x7fff) % r.width(), + (kindaRand()&0x7fff) % r.height() ) + xvel[i] = velocity(i) + yvel[i] = velocity(i) + + paint = TQPainter() + paint.begin(d) + + for ntimes in range(2000): + paint.setBrush(TQColor(kindaRand()%360,180,255, TQColor.Hsv)) + paint.drawPolygon(a[head]) + tail = tail + 1 + if tail >= maxcurves: + tail = 0 + minx = r.left() + maxx = r.right() + miny = r.top() + maxy = r.bottom() + p = a[head] + head = head + 1 + if head >= maxcurves: + head = 0 + for i in range(maxpoints): + x, y = p.point(i) + x = x + xvel[i] + y = y + yvel[i] + if x >= maxx: + x = maxx - (x - maxx + 1) + xvel[i] = -velocity(i) + if x <= minx: + x = minx + (minx - x + 1) + xvel[i] = velocity(i) + if y >= maxy: + y = maxy - (y - maxy + 1) + yvel[i] = -velocity(i) + if y <= miny: + y = miny + (miny - y + 1) + yvel[i] = velocity(i) + a[head].setPoint(i, x, y) + paint.end() + +def rotate(): + w = 64 + h = 64 + image = TQImage(w, h, 8, 128) + for i in range(128): + image.setColor(i, tqRgb(i,0,0)) + for y in range(h): + for x in range(w): + image.setPixel(x,y,(x+y)%128) + + pm = TQPixmap() + pm.convertFromImage(image) + pm.setOptimization(TQPixmap.BestOptim) + + d = TQApplication.desktop() + + for i in range(0,361,2): + m = TQWMatrix() + m.rotate(i) + rpm = pm.xForm(m) + d.setErasePixmap(rpm) + d.update() + +def generateStone(pm, c1, c2, c3): + p = TQPainter() + p1 = TQPen(c1, 0) + p2 = TQPen(c2, 0) + p3 = TQPen(c3, 0) + + p.begin(pm) + for i in range(pm.width()): + for j in range(pm.height()): + r = kindaRand() + if r < KINDA_RAND_MAX / 3: + p.setPen(p1) + elif r < KINDA_RAND_MAX / 3 * 2: + p.setPen(p2) + else: + p.setPen(p3) + p.drawPoint(i, j) + p.end() + +def drawShadeText(p, x, y, text, topColor, bottomColor, sw=2): + if not p.isActive(): + return + + p.setPen(bottomColor) + p.drawText(x+sw, y+sw, text) + p.setPen(topColor) + p.drawText(x, y, text) + +class DesktopWidget(TQWidget): + def __init__(self, s, parent=None, name=''): + TQWidget.__init__(self, parent, name, TQt.WType_Desktop | TQt.WPaintDesktop) + self.text = s + self.pm = None + + def paintEvent(self, pe): + c1 = self.eraseColor() + c2 = c1.light(104) + c3 = c1.dark(106) + if not self.pm: + self.pm = TQPixmap(64, 64) + generateStone(self.pm, c1, c2, c3) + self.setErasePixmap(self.pm) + self.update() + br = self.fontMetrics().boundingRect(self.text) + offscreen = TQPixmap(br.width(), br.height()) + x = self.width()/2 - br.width()/2 + y = self.height()/2 - br.height()/2 + offscreen.fill(self, x, y) + p = TQPainter() + p.begin(offscreen) + drawShadeText(p, -br.x(), -br.y(), self.text, c2, c3, 3) + p.end() + bitBlt(self, x, y, offscreen) + +def desktopWidget(s='Trolltech'): + t = DesktopWidget(s) + t.update() + tqApp.exec_loop() + +def desktopText(s='Trolltech'): + border = 20 + + c1 = tqApp.palette().normal().background() + c2 = c1.light(104) + c3 = c1.dark(106) + + pm = TQPixmap(10, 10) + p = TQPainter() + p.begin(pm) + r = p.fontMetrics().boundingRect(s) + p.end() + + appWidth = tqApp.desktop().width() + appHeight = tqApp.desktop().height() + if r.width() > appWidth - border*2: + r.setWidth(appWidth - border*2) + if r.height() > appHeight - border*2: + r.setHeight(appHeight - border*2) + + pm.resize(r.size().width()+border*2,r.size().height()+border*2) + generateStone(pm, c1, c2, c3) + p.begin(pm) + drawShadeText(p, -r.x()+border, -r.y()+border, s, c2, c3) + p.end() + + tqApp.desktop().setErasePixmap(pm) + +a = TQApplication(sys.argv) +if len(sys.argv) > 1: + f = TQFont('charter', 96, TQFont.Black) + f.setStyleHint(TQFont.Times) + a.setFont(f) + +validOptions = 0 + +if len(sys.argv) == 2: + validOptions = 1 + if sys.argv[1] == '-poly': + poly() + elif sys.argv[1] == '-rotate': + rotate() + elif sys.argv[1] == '-troll': + desktopText() + elif sys.argv[1] == '-trollwidget': + desktopWidget() + else: + validOptions = 0 + +if len(sys.argv) == 3: + validOptions = 1 + if sys.argv[1] == '-shadetext': + desktopText(sys.argv[2]) + elif sys.argv[1] == '-shadewidget': + desktopWidget(sys.argv[2]) + else: + validOptions = 0 + +if not validOptions: + print("""Usage: +\tdesktop -poly +\tdesktop -rotate +\tdesktop -troll +\tdesktop -trollwidget +\tdesktop -shadetext +\tdesktop -shadewidget """) + rotate() diff --git a/examples/dirview.py b/examples/dirview.py new file mode 100755 index 0000000..e6b1f58 --- /dev/null +++ b/examples/dirview.py @@ -0,0 +1,452 @@ +#!/usr/bin/env python + +"""************************************************************************** +** $Id: dirview.py,v 1.7 2005/11/14 17:21:26 phil Exp $ +** +** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. +** Some corrections by M. Biermaier (http://www.office-m.at) +** +** This file is part of an example program for TQt. This example +** program may be used, distributed and modified without limitation. +** +***************************************************************************""" + +import sys +from python_tqt.qt import * + +folder_closed_xpm = [ + "16 16 9 1", + "g c #808080", + "b c #c0c000", + "e c #c0c0c0", + "# c #000000", + "c c #ffff00", + ". c None", + "a c #585858", + "f c #a0a0a4", + "d c #ffffff", + "..###...........", + ".#abc##.........", + ".#daabc#####....", + ".#ddeaabbccc#...", + ".#dedeeabbbba...", + ".#edeeeeaaaab#..", + ".#deeeeeeefe#ba.", + ".#eeeeeeefef#ba.", + ".#eeeeeefeff#ba.", + ".#eeeeefefff#ba.", + ".##geefeffff#ba.", + "...##gefffff#ba.", + ".....##fffff#ba.", + ".......##fff#b##", + ".........##f#b##", + "...........####." +] + +folder_open_xpm = [ + "16 16 11 1", + "# c #000000", + "g c #c0c0c0", + "e c #303030", + "a c #ffa858", + "b c #808080", + "d c #a0a0a4", + "f c #585858", + "c c #ffdca8", + "h c #dcdcdc", + "i c #ffffff", + ". c None", + "....###.........", + "....#ab##.......", + "....#acab####...", + "###.#acccccca#..", + "#ddefaaaccccca#.", + "#bdddbaaaacccab#", + ".eddddbbaaaacab#", + ".#bddggdbbaaaab#", + "..edgdggggbbaab#", + "..#bgggghghdaab#", + "...ebhggghicfab#", + "....#edhhiiidab#", + "......#egiiicfb#", + "........#egiibb#", + "..........#egib#", + "............#ee#" +] + +folder_locked = [ + "16 16 10 1", + "h c #808080", + "b c #ffa858", + "f c #c0c0c0", + "e c #c05800", + "# c #000000", + "c c #ffdca8", + ". c None", + "a c #585858", + "g c #a0a0a4", + "d c #ffffff", + "..#a#...........", + ".#abc####.......", + ".#daa#eee#......", + ".#ddf#e##b#.....", + ".#dfd#e#bcb##...", + ".#fdccc#daaab#..", + ".#dfbbbccgfg#ba.", + ".#ffb#ebbfgg#ba.", + ".#ffbbe#bggg#ba.", + ".#fffbbebggg#ba.", + ".##hf#ebbggg#ba.", + "...###e#gggg#ba.", + ".....#e#gggg#ba.", + "......###ggg#b##", + ".........##g#b##", + "...........####." +] + +pix_file = [ + "16 16 7 1", + "# c #000000", + "b c #ffffff", + "e c #000000", + "d c #404000", + "c c #c0c000", + "a c #ffffc0", + ". c None", + "................", + ".........#......", + "......#.#a##....", + ".....#b#bbba##..", + "....#b#bbbabbb#.", + "...#b#bba##bb#..", + "..#b#abb#bb##...", + ".#a#aab#bbbab##.", + "#a#aaa#bcbbbbbb#", + "#ccdc#bcbbcbbb#.", + ".##c#bcbbcabb#..", + "...#acbacbbbe...", + "..#aaaacaba#....", + "...##aaaaa#.....", + ".....##aa#......", + ".......##......." +] + +folderLocked = None +folderClosed = None +folderOpened = None +fileNormal = None + +class FileItem( TQListViewItem ) : + def __init__( self, parent=None, s1=TQString.null, s2=TQString.null ): + TQListViewItem.__init__( self, parent, s1, s2 ) + self.pix = None + + def setPixmap( self, p ) : + self.pix = p + self.setup() + self.widthChanged( 0 ) + self.invalidateHeight() + self.repaint() + + def pixmap( self, i ) : + if i : return None + else : return self.pix; + +# Class Directory +class Directory( TQListViewItem ) : + def __init__( self, parent=None, filename=TQString.null, col2=TQString.null ): + TQListViewItem.__init__( self, parent, filename, col2 ) + self.pix = None + global folderLocked, folderClosed, folderOpened, fileNormal + self.showDirsOnly = False + if isinstance(parent, TQListView): + self.p = None + self.showDirsOnly = parent.showDirsOnly() + self.f = TQFile( TQString('/') ) + else: + self.p = parent + self.showDirsOnly = parent.showDirsOnly + self.f = TQFile( TQString(filename) ) + + self.readable = TQDir( self.fullName() ).isReadable() + if not self.readable : self.setPixmap( folderLocked ) + else : self.setPixmap( folderClosed ) + + def setPixmap( self, px ) : + self.pix = px + self.setup() + self.widthChanged( 0 ) + self.invalidateHeight() + self.repaint() + + def pixmap( self, i ) : + if i : return None + else : return self.pix + + def setOpen( self, o ) : + if o : self.setPixmap( folderOpened ) + else : self.setPixmap( folderClosed ) + + if o and not self.childCount() : + s = TQString( self.fullName() ) + thisDir = TQDir( s ) + if not thisDir.isReadable() : + self.readable = False + self.setExpandable( False ) + return + + self.listView().setUpdatesEnabled( False ) + files = thisDir.entryInfoList() + if files : + fi = TQFileInfo() + for it in files: + fi = it + if str(fi.fileName()) == "." or str(fi.fileName()) == ".." : + continue # nothing + elif fi.isSymLink() and not self.showDirsOnly : + item = FileItem( self, fi.fileName(), "Symbolic Link" ) + item.setPixmap( fileNormal ) + elif fi.isDir() : + Directory( self, fi.fileName() ) + elif not self.showDirsOnly : + if fi.isFile() : item = FileItem( self, fi.fileName(), "File" ) + else : item = FileItem( self, fi.fileName(), "Special" ) + item.setPixmap( fileNormal ) + + self.listView().setUpdatesEnabled( True ) + TQListViewItem.setOpen( self, o ) + + def setup( self ): + self.setExpandable( True ) + TQListViewItem.setup( self ) + + def fullName( self ): + s = TQString() + if self.p : + s = self.p.fullName() + s.append( self.f.name() ) + s.append( "/" ) + else : + s = self.f.name() + return s + + def text( self, column ) : + if column == 0 : return self.f.name() + elif self.readable : return "Directory" + else : return "Unreadable Directory" + +# Class DirectoryView + +class DirectoryView( TQListView ): + def __init__( self, parent=None, name=None, sdo=False ): + TQListView.__init__( self, parent, name ) + self.dirsOnly = sdo + self.oldCurrent = 0 + self.dropItem = 0 + self.presspos = TQPoint(0,0) + self.mousePressed = False + global folderLocked, folderClosed, folderOpened, fileNormal #= TQPixmap() + self.autoopenTime = 750 + + self.autoopen_timer = TQTimer( self ) + if not folderLocked : + folderLocked = TQPixmap( folder_locked ) + folderClosed = TQPixmap( folder_closed_xpm ) + folderOpened = TQPixmap( folder_open_xpm ) + fileNormal = TQPixmap( pix_file ) + + self.connect( self, SIGNAL("doubleClicked(TQListViewItem *)"), + self.slotFolderSelected ) + self.connect( self, SIGNAL("returnPressed(TQListViewItem *)"), + self.slotFolderSelected ) + + self.setAcceptDrops( True ) + self.viewport().setAcceptDrops( True ) + + self.connect( self.autoopen_timer, SIGNAL("timeout()"), self.openFolder ) + + def showDirsOnly( self ): + return self.dirsOnly + + def slotFolderSelected( self, i ): + if not i or not self.showDirsOnly(): + return + dir = i + self.emit( PYSIGNAL("folderSelected(const TQString &)"), (dir.fullName(), ) ) + + def openFolder( self ): + self.autoopen_timer.stop() + if self.dropItem and not self.dropItem.isOpen(): + self.dropItem.setOpen( True ) + self.dropItem.repaint() + + def contentsDragEnterEvent( self, e ): + if not TQUriDrag.canDecode(e) : + e.ignore() + return + self.oldCurrent = self.currentItem() + i = self.itemAt( self.contentsToViewport(e.pos()) ) + if i : + self.dropItem = i + self.autoopen_timer.start( self.autoopenTime ) + + def contentsDragMoveEvent( self, e ) : + if not TQUriDrag.canDecode(e) : + e.ignore() + return + vp = self.contentsToViewport( e.pos() ) + i = self.itemAt( vp ) + if i : + self.setSelected( i, True ) + e.accept() + if i != self.dropItem : + self.autoopen_timer.stop() + self.dropItem = i + self.autoopen_timer.start( self.autoopenTime ) + + if e.action() == TQDropEvent.Copy: + pass + elif e.action() == TQDropEvent.Move: + e.acceptAction() + elif e.action() == TQDropEvent.Link: + e.acceptAction() + else: + pass + else : + e.ignore() + self.autoopen_timer.stop() + self.dropItem = 0 + + def contentsDragLeaveEvent( self, TQDragLeaveEvent ) : + self.autoopen_timer.stop() + self.dropItem = 0 + + self.setCurrentItem( self.oldCurrent ) + self.setSelected( self.oldCurrent, True ) + + def contentsDropEvent( self, e ): + self.autoopen_timer.stop() + if not TQUriDrag.canDecode(e) : + e.ignore() + return + item = self.itemAt( self.contentsToViewport(e.pos()) ) + if item : + lst = TQStringList() + TQUriDrag.decodeLocalFiles( e, lst ) + if e.action() == TQDropEvent.Copy: + s = TQString("Copy") + elif e.action() == TQDropEvent.Move: + s = TQString("Move") + e.acceptAction() + elif e.action() == TQDropEvent.Link: + s = TQString("Link") + e.acceptAction() + else: + s = TQString("Unknown") + + s += "\n\n" + e.accept() + + for filename in lst: + s += filename + s += "\n" + + s += "\nTo\n\n " + s += self.fullPath(item) + TQMessageBox.information( self, "Drop target", s, "Not implemented" ) + else : + e.ignore() + + def fullPath( self, item ): + fullpath = TQString( item.text(0) ) + item = item.parent() + while item: + newpath = item.text(0) + + if item.parent(): + newpath += "/" + + newpath += fullpath + fullpath = newpath + item = item.parent() + + return fullpath + + def contentsMousePressEvent( self, e ) : + TQListView.contentsMousePressEvent( self, e ) + p = TQPoint( self.contentsToViewport( e.pos() ) ) + i = self.itemAt( p ) + if i : + # if the user clicked into the root decoration of the item, don't try to start a drag! + if self.rootIsDecorated(): isdecorated = 1 + else : isdecorated = 0 + if p.x() > self.header().sectionPos( self.header().mapToIndex( 0 )) + self.treeStepSize() * ( i.depth() + isdecorated + self.itemMargin() or + p.x() < self.header().sectionPos( self.header().mapToIndex( 0 ) ) ) : + self.presspos.setX(e.pos().x()) + self.presspos.setY(e.pos().y()) + self.mousePressed = True + + def contentsMouseMoveEvent( self, e ): + offset = TQPoint( self.presspos.x() - e.pos().x(), + self.presspos.y() - e.pos().y() ) + if self.mousePressed and (offset).manhattanLength() > TQApplication.startDragDistance() : + self.mousePressed = False + item = self.itemAt( self.contentsToViewport(self.presspos) ) + if item : + source = self.fullPath(item) + if TQFile.exists(source) : + ud = TQUriDrag(self.viewport()) + ud.setFileNames( TQStringList (source) ) + if ud.drag() : + TQMessageBox.information( self, "Drag source", + TQString("Delete ")+source, "Not implemented" ) + + def contentsMouseReleaseEvent( self, TQMouseEvent ): + self.mousePressed = False + + def setDir( self, s ): + it = TQListViewItem( self ) + it.setOpen(False) + thisDir = TQDir( s ) + it = TQListViewItem( self ) + it.setOpen(False) + lst = TQStringList( TQStringList.split( "/", s ) ) + listview2 = [] + listview2.extend( lst ) + + item = self.firstChild() + for it2 in listview2 : + while item : + if item.text( 0 ) == it2 : + item.setOpen( True ) + break + item = item.itemBelow() + if item: + self.setCurrentItem( item ) + +def main( args ): + a = TQApplication( args ) + + mw = DirectoryView() + mw.addColumn( "Name" ) + mw.addColumn( "Type" ) + mw.setTreeStepSize( 20 ) + + roots = TQDir.drives() + if roots : + for it in roots: + fi = it + root = Directory( mw, fi.filePath() ) + if roots.count(it) <= 1 : + root.setOpen( True ) # be interesting + + mw.resize( 400, 400 ) + mw.setCaption( "TQt Example - Directory Browser" ) + mw.setAllColumnsShowFocus( True ) + a.setMainWidget( mw ) + mw.show() + + a.exec_loop() + +if __name__=="__main__": + main(sys.argv) diff --git a/examples/dragdrop.py b/examples/dragdrop.py new file mode 100755 index 0000000..a715170 --- /dev/null +++ b/examples/dragdrop.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python + +# Ported to PyTQt by Issac Trotts on Jan 1, 2002 + +import sys +from python_tqt.qt import * + +import dropsite, secret + + +def addStuff( parent, yn_image, yn_secret = 0 ): + tll = TQVBoxLayout( parent, 10 ) + d = dropsite.DropSite( parent, 'dropsite' ) + d.setFrameStyle( TQFrame.Sunken + TQFrame.WinPanel ) + tll.addWidget( d ) + if yn_image: + stuff = TQPixmap() + if not stuff.load( "trolltech.bmp" ): + stuff = TQPixmap(20,20) + stuff.fill(TQt.green) + d.setPixmap( stuff ) + else: + d.setText("Drag and Drop") + d.setFont(TQFont("Helvetica",18)) + if secret: + s = secret.SecretSource( 42, parent ) + tll.addWidget( s ) + + format = TQLabel( "\n\n\n\nNone\n\n\n\n", parent ) + tll.addWidget( format ) + tll.activate() + parent.resize( parent.sizeHint() ) + + TQObject.connect( d, PYSIGNAL('message(TQString &)'), + format, SLOT('setText(TQString &)') ) + + +app = TQApplication( sys.argv ) + +mw = TQWidget() +addStuff( mw, 1 ) +mw.setCaption( "TQt Example - Drag and Drop" ) +mw.show() + +mw2 = TQWidget() +addStuff( mw2, 0 ) +mw2.setCaption( "TQt Example - Drag and Drop" ) +mw2.show() + +mw3 = TQWidget() +addStuff( mw3, 1, 1 ) +mw3.setCaption( "TQt Example - Drag and Drop" ) +mw3.show() + +TQObject.connect(tqApp,SIGNAL('lastWindowClosed()'),tqApp,SLOT('quit()')) + +app.exec_loop() diff --git a/examples/drawlines.py b/examples/drawlines.py new file mode 100755 index 0000000..c1553f2 --- /dev/null +++ b/examples/drawlines.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python + +import sys, random +from python_tqt.qt import * + +TRUE = 1 +FALSE = 0 + +MAXPOINTS = 2000; # maximum number of points +MAXCOLORS = 40; + +# +# ConnectWidget - draws connected lines +# + +class ConnectWidget(TQWidget): + def __init__(self): + TQWidget.__init__(self) + self.setEraseColor( TQt.white ) # white background + self.count = 0; + self.down = FALSE + + self.points = [] + self.colors = [] + + for i in range(MAXPOINTS): # init arrays + self.points.append(TQPoint()) + for i in range(MAXCOLORS): + self.colors.append(TQColor( random.randint(0,255), random.randint(0,255), random.randint(0,255) )) + +# +# Handles paint events for the connect widget. +# + def paintEvent(self, pe): + paint = TQPainter( self ) + for i in range(self.count-1): # connect all points + for j in range(i+1, self.count): + paint.setPen( self.colors[random.randint(0,MAXCOLORS-1)] ) # set random pen color + paint.drawLine( self.points[i], self.points[j] ) # draw line + +# +# Handles mouse press events for the connect widget. +# + def mousePressEvent(self, me): + self.down = TRUE + self.count = 0 # start recording points + self.erase() # erase widget contents + +# +# Handles mouse release events for the connect widget. +# + def mouseReleaseEvent(self, me ): + self.down = FALSE # done recording points + self.update() # draw the lines + +# +# Handles mouse move events for the connect widget. +# + def mouseMoveEvent(self, me): + if self.down and self.count < MAXPOINTS: + paint = TQPainter( self ) + self.points[self.count] = TQPoint(me.pos()) # add point + paint.drawPoint( me.pos() ) # plot point + self.count = self.count+1 + +# +# Create and display a ConnectWidget. +# +a = TQApplication( sys.argv ) +connect = ConnectWidget() +connect.setCaption( "PyTQt Example - Draw lines") +a.setMainWidget( connect ) +connect.show() +a.exec_loop() diff --git a/examples/dropsite.py b/examples/dropsite.py new file mode 100644 index 0000000..8581e0e --- /dev/null +++ b/examples/dropsite.py @@ -0,0 +1,96 @@ +# This is part of the dragdrop example. + + +from python_tqt.qt import * + +import secret + + +class DropSite(TQLabel): + def __init__(self, parent=None, name=None): + TQLabel.__init__( self, parent, name ) + self.setAcceptDrops(1) + + # this is a normal event + def mousePressEvent( self, e ): + if ( self.pixmap() ) : + drobj = TQImageDrag( self.pixmap().convertToImage(), self ) + pm = TQPixmap() + pm.convertFromImage(self.pixmap().convertToImage().smoothScale( + self.pixmap().width()/3,self.pixmap().height()/3)) + drobj.setPixmap(pm,TQPoint(-5,-7)) + else : + drobj = TQTextDrag( self.text(), self ) + drobj.dragCopy() + + def backgroundColorChange( self, qcolor ): + # Reduce flicker by using repaint() rather than update() + self.repaint() + + def dragMoveEvent( self, e ): + # Check if you want the drag at e.pos()... + # Give the user some feedback... + pass + + def dragEnterEvent( self, e ): + # Check if you want the drag... + if (secret.canDecode( e ) or + TQTextDrag.canDecode( e ) or + TQImageDrag.canDecode( e ) or + TQUriDrag.canDecode( e )): + e.accept() + + # Give the user some feedback... + t = '' + i = 0 + while e.format( i ): + if ( t != '' ): + t += "\n" + t += str(e.format( i )) + i += 1 + self.emit(PYSIGNAL('message(TQString &)'), (TQString(t),)) + self.setEraseColor(TQt.white) + + def dragLeaveEvent( self, TQDragLeaveEvent ): + # Give the user some feedback... + self.emit(PYSIGNAL('message(TQString &)'), (TQString(''),)) + self.setEraseColor(TQt.lightGray) + + def dropEvent( self, e ): + self.setEraseColor(TQt.lightGray) + # Try to decode to the data you understand... + str = TQString() + if ( TQTextDrag.decode( e, str ) ) : + self.setText( str ) + self.setMinimumSize( self.minimumSize().expandedTo(self.sizeHint()) ) + return + + pm = TQPixmap() + if ( TQImageDrag.decode( e, pm ) ) : + self.setPixmap( pm ) + self.setMinimumSize(self.minimumSize().expandedTo(self.sizeHint())) + return + + # TQStrList strings + #strings = TQStrList() + strings = [] + if ( TQUriDrag.decode( e, strings ) ) : + m = TQString("Full URLs:\n") + for u in strings: + m = m + " " + u + '\n' + # TQStringList files + files = [] + if ( TQUriDrag.decodeLocalFiles( e, files ) ) : + m += "Files:\n" + # for (TQStringList.Iterator i=files.begin() i!=files.end() ++i) + for i in files: + m = m + " " + i + '\n' + self.setText( m ) + self.setMinimumSize(self.minimumSize().expandedTo(self.sizeHint())) + return + + str = secret.decode( e ) + if str: + self.setText( str ) + self.setMinimumSize(self.minimumSize().expandedTo(self.sizeHint())) + return diff --git a/examples/fileopen.xpm b/examples/fileopen.xpm new file mode 100644 index 0000000..880417e --- /dev/null +++ b/examples/fileopen.xpm @@ -0,0 +1,22 @@ +/* XPM */ +static const char *fileopen[] = { +" 16 13 5 1", +". c #040404", +"# c #808304", +"a c None", +"b c #f3f704", +"c c #f3f7f3", +"aaaaaaaaa...aaaa", +"aaaaaaaa.aaa.a.a", +"aaaaaaaaaaaaa..a", +"a...aaaaaaaa...a", +".bcb.......aaaaa", +".cbcbcbcbc.aaaaa", +".bcbcbcbcb.aaaaa", +".cbcb...........", +".bcb.#########.a", +".cb.#########.aa", +".b.#########.aaa", +"..#########.aaaa", +"...........aaaaa" +}; diff --git a/examples/fontdisplayer.py b/examples/fontdisplayer.py new file mode 100755 index 0000000..1f616bf --- /dev/null +++ b/examples/fontdisplayer.py @@ -0,0 +1,148 @@ +#!/usr/bin/env python + +"""************************************************************************** +** $Id: fontdisplayer.py,v 1.2 2004/07/19 18:41:53 phil Exp $ +** +** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. +** +** This file is part of an example program for TQt. This example +** program may be used, distributed and modified without limitation. +** +***************************************************************************""" + +import sys +from python_tqt.qt import * + +class FontRowTable( TQFrame ): + def __init__( self, parent=None, name=None ): + TQFrame.__init__( self, parent, name ) + + self.setBackgroundMode(self.PaletteBase) + self.setFrameStyle(self.Panel|self.Sunken) + self.setMargin(8) + self.setRow(0) + self.row = 0 + self.tablefont = TQFont( TQApplication.font() ) + + def sizeHint( self ) : + width = 16*self.cellSize().width()+TQSize(2,2).width()*(self.margin()+self.frameWidth()) + height = 16*self.cellSize().height()+TQSize(2,2).height()*(self.margin()+self.frameWidth()) + return TQSize(width,height) + + def cellSize( self ) : + fm = self.fontMetrics() + return TQSize( fm.maxWidth(), fm.lineSpacing() + 1 ) + + def paintEvent( self, e ): + TQFrame.paintEvent(self, e) + p = TQPainter(self) + p.setClipRegion(e.region()) + r = TQRect(e.rect()) + fm = self.fontMetrics() + ml = self.frameWidth() + self.margin() + 1 + max(0,-fm.minLeftBearing()) + mt = self.frameWidth() + self.margin() + cell = TQSize(int((self.width()-15-ml)/16),int((self.height()-15-mt)/16)) + + if not cell.width() or not cell.height() : + return + + mini = int(r.left() / cell.width()) + maxi = int((r.right()+cell.width()-1) / cell.width()) + minj = int(r.top() / cell.height()) + maxj = int((r.bottom()+cell.height()-1) / cell.height()) + + h = fm.height() + + body = TQColor(255,255,192); + negative = TQColor(255,192,192); + positive = TQColor(192,192,255); + rnegative = TQColor(255,128,128); + rpositive = TQColor(128,128,255); + + for j in range(minj, maxj+1, 1) : + for i in range(mini, maxi+1, 1) : + if i < 16 and j < 16 : + x = i*cell.width() + y = j*cell.height() + + ch = TQChar(j*16+i) #,self.row) # just accept one argument!!! + + if fm.inFont(ch) : + w = fm.width(ch) + l = fm.leftBearing(ch) + r = fm.rightBearing(ch) + + x += ml + y += mt+h + + p.fillRect(x,y,w,-h,TQBrush(body)) + + if w : + if l : + if l < 0: sign = negative + else: sign = positive + if l > 0: lsign = 0 + else: lsign = 1 + p.fillRect(x+lsign, int(y-h/2), abs(l),int(-h/2), TQBrush(sign)) + if r : + if r < 0: sign = rnegative + else: sign = rpositive + if r > 0: rsign = r + else: rsign = 0 + p.fillRect(int(x+w-rsign),y+2, abs(r),int(-h/2), TQBrush(sign)) + s = TQString( ch ) + p.setPen(TQPen(TQt.black)) + p.drawText(x,y,s) + + def setRow( self, r ) : + self.row = r + + fm = self.fontMetrics() + str = " minLB=%d minRB=%d maxW=%d" % (fm.minLeftBearing(), fm.minRightBearing(), fm.maxWidth()) + self.emit( PYSIGNAL("fontInformation"), ( TQString(str), ) ) + self.update() + + def chooseFont( self ) : + ok = 0 + oldfont = TQFont( self.tablefont ) + self.tablefont, ok = TQFontDialog.getFont(oldfont, self) + if ok: + self.setFont(self.tablefont) + else: + self.tablefont = oldfont + +class FontDisplayer( TQMainWindow ) : + def __init__( self, parent=None, name=None ): + TQMainWindow.__init__( self, parent, name ) + table = FontRowTable(self) + controls = TQToolBar(self) + + TQLabel(self.tr("Row:"), controls) + self.row = TQSpinBox(0,255,1,controls) + controls.addSeparator() + fontbutton = TQPushButton(self.tr("Font..."), controls) + status = TQStatusBar(self) + + self.connect( self.row, SIGNAL("valueChanged(int)"), table.setRow ) + self.connect( fontbutton, SIGNAL("clicked()"), table.chooseFont ) + self.connect( table, PYSIGNAL("fontInformation"), + status, SLOT("message(const TQString&)") ) + table.setRow(0) + self.setCentralWidget(table) + +def main( args ): + # Use an interesting font + TQApplication.setFont(TQFont("unifont",16)) + app = TQApplication(sys.argv) + + m = FontDisplayer() + sh = TQSize( m.centralWidget().sizeHint() ) + m.resize(sh.width(), sh.height() + 3 * m.statusBar().height()) + app.setMainWidget(m); + m.setCaption("TQt Example - TQFD"); + m.show() + + app.exec_loop() + +if __name__=="__main__": + main(sys.argv) diff --git a/examples/fonts.py b/examples/fonts.py new file mode 100755 index 0000000..145b815 --- /dev/null +++ b/examples/fonts.py @@ -0,0 +1,149 @@ +#!/usr/bin/env python + +"""************************************************************************** +** $Id: fonts.py,v 1.1 2003/07/01 14:18:37 phil Exp $ +** +** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. +** +** This file is part of an example program for TQt. This example +** program may be used, distributed and modified without limitation. +** +***************************************************************************""" + +import sys +from python_tqt.qt import * + +class Viewer( TQWidget ): + def __init__( self ): + TQWidget.__init__( self ) + + self.setFontSubstitutions() + + greeting_heb = TQString.fromUtf8( b"\327\251\327\234\327\225\327\235" ) + greeting_ru = TQString.fromUtf8( b"\320\227\320\264\321\200\320\260\320\262\321\201\321\202\320\262\321\203\320\271\321\202\320\265" ) + greeting_en = "Hello" + + self.greetings = TQTextView( self, "textview" ) + + self.greetings.setText( greeting_en + "\n" + + greeting_ru + "\n" + + greeting_heb ) + + self.fontInfo = TQTextView( self, "fontinfo" ) + + self.setDefault() + + self.defaultButton = TQPushButton( "Default", self, "pushbutton1" ) + self.defaultButton.setFont( TQFont( "times" ) ) + self.connect( self.defaultButton, SIGNAL("clicked()"), self.setDefault ) + + self.sansSerifButton = TQPushButton( "Sans Serif", self, "pushbutton2" ) + self.sansSerifButton.setFont( TQFont( "Helvetica", 12 ) ) + self.connect( self.sansSerifButton, SIGNAL("clicked()"), self.setSansSerif ) + + self.italicsButton = TQPushButton( "Italics", self, "pushbutton3" ) + self.italicsButton.setFont( TQFont( "lucida", 12, TQFont.Bold, True ) ) + self.connect( self.italicsButton, SIGNAL("clicked()"), self.setItalics ) + + self.layout() + + def setDefault( self ): + font = TQFont( "Bavaria" ) + font.setPointSize( 24 ) + font.setWeight( TQFont.Bold ) + font.setUnderline( True ) + + self.greetings.setFont( font ) + + self.showFontInfo( font ) + + def setSansSerif( self ): + font = TQFont( "Newyork", 18 ) + font.setStyleHint( TQFont.SansSerif ) + + self.greetings.setFont( font ) + + self.showFontInfo( font ) + + def setItalics( self ): + font = TQFont( "Tokyo" ) + font.setPointSize( 32 ) + font.setWeight( TQFont.Bold ) + font.setItalic( True ) + + self.greetings.setFont( font ) + + self.showFontInfo( font ) + + def showFontInfo( self, font ): + info = TQFontInfo( font ) + + messageText = "Font requested: \"" + str(font.family()) + "\" " \ + + str(TQString.number( font.pointSize() )) + "pt
" \ + + "Font used: \"" + str(info.family()) + "\" " \ + + str(TQString.number( info.pointSize() )) + "pt

" + + if not self.substitutes.isEmpty() : + messageText += "The following substitutions exist for " + \ + str(font.family()) + ":

    " + for i in self.substitutes : + messageText += "
  • \"" + str(i) + "\"" + messageText += "
"; + else : + messageText += "No substitutions exist for " + \ + str(font.family()) + "." + + self.fontInfo.setText( messageText ) + + def setFontSubstitutions( self ): + self.substitutes = TQStringList() + self.substitutes.append( "Times" ) + self.substitutes.append( "Mincho" ) + self.substitutes.append( "Arabic Newspaper" ) + self.substitutes.append( "crox" ) + #TQFont.insertSubstitutions( "Bavaria", self.substitutes ) + TQFont.insertSubstitution( "Bavaria", "Times" ) + TQFont.insertSubstitution( "Tokyo", "Lucida" ) + + # For those who prefer to use TQt Designer for creating GUIs + # the following function might not be of particular interest: + # all it does is creating the widget layout. + def layout( self ): + textViewContainer = TQHBoxLayout() + textViewContainer.addWidget( self.greetings ) + textViewContainer.addWidget( self.fontInfo ) + + buttonContainer = TQHBoxLayout() + buttonContainer.addWidget( self.defaultButton ) + buttonContainer.addWidget( self.sansSerifButton ) + buttonContainer.addWidget( self.italicsButton ) + + maxButtonHeight = self.defaultButton.height() + + if self.sansSerifButton.height() > maxButtonHeight : + maxButtonHeight = self.sansSerifButton.height() + if self.italicsButton.height() > maxButtonHeight : + maxButtonHeight = self.italicsButton.height() + + self.defaultButton.setFixedHeight( maxButtonHeight ) + self.sansSerifButton.setFixedHeight( maxButtonHeight ) + self.italicsButton.setFixedHeight( maxButtonHeight ) + + container = TQVBoxLayout( self ) + container.addLayout( textViewContainer ) + container.addLayout( buttonContainer ) + + self.resize( 700, 250 ) + +def main( args ): + app = TQApplication(sys.argv) # application object + + textViewer = Viewer() + textViewer.setCaption( "TQt Example - Simple TQFont Demo" ) + app.setMainWidget( textViewer ) + textViewer.show() + + app.exec_loop() + +if __name__=="__main__": + main(sys.argv) diff --git a/examples/gears.py b/examples/gears.py new file mode 100755 index 0000000..e98df55 --- /dev/null +++ b/examples/gears.py @@ -0,0 +1,235 @@ +#!/usr/bin/env python + + +import sys +import math +from python_tqt.qt import * +from python_tqt.qtgl import * +from OpenGL.GL import * + +def gear(inner_radius,outer_radius,width,teeth,tooth_depth): + r0 = inner_radius + r1 = outer_radius - tooth_depth/2.0 + r2 = outer_radius + tooth_depth/2.0 + + da = 2.0*math.pi/teeth/4.0 + + glShadeModel(GL_FLAT) + + glNormal3f(0.0,0.0,1.0) + + # draw front face + + glBegin(GL_QUAD_STRIP) + + for i in range(teeth+1): + angle = i * 2.0*math.pi/teeth + glVertex3f(r0*math.cos(angle), r0*math.sin(angle), width*0.5 ) + glVertex3f(r1*math.cos(angle), r1*math.sin(angle), width*0.5 ) + glVertex3f(r0*math.cos(angle), r0*math.sin(angle), width*0.5 ) + glVertex3f(r1*math.cos(angle+3*da), r1*math.sin(angle+3*da), width*0.5 ) + + glEnd() + + # draw front sides of teeth + + da = 2.0*math.pi/teeth/4.0 + + glBegin(GL_QUADS) + + for i in range(teeth): + angle = i*2.0*math.pi/teeth + + glVertex3f( r1*math.cos(angle), r1*math.sin(angle), width*0.5 ) + glVertex3f( r2*math.cos(angle+da), r2*math.sin(angle+da), width*0.5 ) + glVertex3f( r2*math.cos(angle+2*da), r2*math.sin(angle+2*da), width*0.5 ) + glVertex3f( r1*math.cos(angle+3*da), r1*math.sin(angle+3*da), width*0.5 ) + + glEnd() + + + glNormal3f( 0.0, 0.0, -1.0 ) + + # draw back face + + glBegin( GL_QUAD_STRIP ) + + for i in range(teeth+1): + angle = i*2.0*math.pi/teeth + + glVertex3f( r1*math.cos(angle), r1*math.sin(angle), -width*0.5 ) + glVertex3f( r0*math.cos(angle), r0*math.sin(angle), -width*0.5 ) + glVertex3f( r1*math.cos(angle+3*da), r1*math.sin(angle+3*da), -width*0.5 ) + glVertex3f( r0*math.cos(angle), r0*math.sin(angle), -width*0.5 ) + + glEnd() + + # draw back sides of teeth + + da = 2.0*math.pi/teeth/4.0 + + glBegin( GL_QUADS ) + + for i in range(teeth): + angle = i*2.0*math.pi/teeth + + glVertex3f( r1*math.cos(angle+3*da), r1*math.sin(angle+3*da), -width*0.5 ) + glVertex3f( r2*math.cos(angle+2*da), r2*math.sin(angle+2*da), -width*0.5 ) + glVertex3f( r2*math.cos(angle+da), r2*math.sin(angle+da), -width*0.5 ) + glVertex3f( r1*math.cos(angle), r1*math.sin(angle), -width*0.5 ) + + glEnd() + + # draw outward faces of teeth + + glBegin( GL_QUAD_STRIP ) + + for i in range(teeth): + angle = i*2.0*math.pi/teeth + + glVertex3f( r1*math.cos(angle), r1*math.sin(angle), width*0.5 ) + glVertex3f( r1*math.cos(angle), r1*math.sin(angle), -width*0.5 ) + + u = r2*math.cos(angle+da) - r1*math.cos(angle) + v = r2*math.sin(angle+da) - r1*math.sin(angle) + + len = math.sqrt( u*u + v*v ) + u /= len + v /= len + glNormal3f( v, -u, 0.0 ) + glVertex3f( r2*math.cos(angle+da), r2*math.sin(angle+da), width*0.5 ) + glVertex3f( r2*math.cos(angle+da), r2*math.sin(angle+da), -width*0.5 ) + glNormal3f( math.cos(angle), math.sin(angle), 0.0 ) + glVertex3f( r2*math.cos(angle+2*da), r2*math.sin(angle+2*da), width*0.5 ) + glVertex3f( r2*math.cos(angle+2*da), r2*math.sin(angle+2*da), -width*0.5 ) + u = r1*math.cos(angle+3*da) - r2*math.cos(angle+2*da) + v = r1*math.sin(angle+3*da) - r2*math.sin(angle+2*da) + glNormal3f( v, -u, 0.0 ) + glVertex3f( r1*math.cos(angle+3*da), r1*math.sin(angle+3*da), width*0.5 ) + glVertex3f( r1*math.cos(angle+3*da), r1*math.sin(angle+3*da), -width*0.5 ) + glNormal3f( math.cos(angle), math.sin(angle), 0.0 ) + + glVertex3f( r1*math.cos(0.0), r1*math.sin(0.0), width*0.5 ) + glVertex3f( r1*math.cos(0.0), r1*math.sin(0.0), -width*0.5 ) + + glEnd() + + glShadeModel (GL_SMOOTH) + + # draw inside radius cylinder + + glBegin( GL_QUAD_STRIP ) + + for i in range(teeth+1): + angle = i * 2.0*math.pi / teeth + glNormal3f( -math.cos(angle), -math.sin(angle), 0.0 ) + glVertex3f( r0*math.cos(angle), r0*math.sin(angle), -width*0.5 ) + glVertex3f( r0*math.cos(angle), r0*math.sin(angle), width*0.5 ) + + glEnd() + +############################################################################## +class GearWidget(TQGLWidget): + def __init__(self,parent=None,name=None): + TQGLWidget.__init__(self,parent,name) + + self.angle=0.0 + self.view_rotx=0.0 + self.view_roty=0.0 + self.view_rotz=0.0 + + self.startTimer(10) + + def timerEvent(self,event): + self.updateGL() + + def paintGL(self): + self.angle = self.angle + 2.0 + self.view_rotx = self.view_rotx + 1.0 + self.view_roty = self.view_roty + 3.0 + self.view_rotz = self.view_rotz + 2.0 + + glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ) + + glPushMatrix() + glRotatef( self.view_rotx, 1.0, 0.0, 0.0 ) + glRotatef( self.view_roty, 0.0, 1.0, 0.0 ) + glRotatef( self.view_rotz, 0.0, 0.0, 1.0 ) + + glPushMatrix() + glTranslatef( -3.0, -2.0, 0.0 ) + glRotatef( self.angle, 0.0, 0.0, 1.0 ) + glCallList(self.gear1) + glPopMatrix() + + glPushMatrix() + glTranslatef( 3.1, -2.0, 0.0 ) + glRotatef( -2.0*self.angle-9.0, 0.0, 0.0, 1.0 ) + glCallList(self.gear2) + glPopMatrix() + + glPushMatrix() + glTranslatef( -3.1, 2.2, -1.8 ) + glRotatef( 90.0, 1.0, 0.0, 0.0 ) + glRotatef( 2.0*self.angle-2.0, 0.0, 0.0, 1.0 ) + glCallList(self.gear3) + glPopMatrix() + + glPopMatrix() + + def resizeGL(self,width,height): + w = width / float(height) + h = 1.0 + + glViewport( 0, 0, width, height ) + glMatrixMode(GL_PROJECTION) + glLoadIdentity() + glFrustum( -w, w, -h, h, 5.0, 60.0 ) + glMatrixMode(GL_MODELVIEW) + glLoadIdentity() + glTranslatef( 0.0, 0.0, -40.0 ) + + def initializeGL(self): + pos=(5.0, 5.0, 10.0, 1.0 ) + ared=(0.8, 0.1, 0.0, 1.0 ) + agreen=(0.0, 0.8, 0.2, 1.0 ) + ablue=(0.2, 0.2, 1.0, 1.0 ) + + glLightfv(GL_LIGHT0,GL_POSITION,pos) + glEnable(GL_CULL_FACE) + glEnable(GL_LIGHTING) + glEnable(GL_LIGHT0) + glEnable(GL_DEPTH_TEST) + + self.gear1=glGenLists(1) + glNewList(self.gear1,GL_COMPILE) + glMaterialfv(GL_FRONT,GL_AMBIENT_AND_DIFFUSE,ared) + gear(1.0,4.0,1.0,20,0.7) + glEndList() + + self.gear2=glGenLists(1) + glNewList(self.gear2,GL_COMPILE) + glMaterialfv(GL_FRONT,GL_AMBIENT_AND_DIFFUSE,agreen) + gear(0.5,2.0,2.0,10,0.7) + glEndList() + + self.gear3=glGenLists(1) + glNewList(self.gear3,GL_COMPILE) + glMaterialfv(GL_FRONT,GL_AMBIENT_AND_DIFFUSE,ablue) + gear(1.3,2.0,0.5,10,0.7) + glEndList() + + glEnable(GL_NORMALIZE) + +############################################################################## +if __name__=='__main__': + TQApplication.setColorSpec(TQApplication.CustomColor) + app=TQApplication(sys.argv) + + if not TQGLFormat.hasOpenGL(): + raise Exception('No TQt OpenGL support.') + + widget=GearWidget() + app.setMainWidget(widget) + widget.show() + app.exec_loop() diff --git a/examples/i18n/i18n.pro b/examples/i18n/i18n.pro new file mode 100644 index 0000000..fc55895 --- /dev/null +++ b/examples/i18n/i18n.pro @@ -0,0 +1,15 @@ +SOURCES = mywidget.py \ + i18n.py + +TRANSLATIONS = mywidget_cs.ts \ + mywidget_de.ts \ + mywidget_el.ts \ + mywidget_en.ts \ + mywidget_eo.ts \ + mywidget_fr.ts \ + mywidget_it.ts \ + mywidget_jp.ts \ + mywidget_ko.ts \ + mywidget_no.ts \ + mywidget_ru.ts \ + mywidget_zh.ts diff --git a/examples/i18n/i18n.py b/examples/i18n/i18n.py new file mode 100755 index 0000000..b4dc42a --- /dev/null +++ b/examples/i18n/i18n.py @@ -0,0 +1,147 @@ +#!/usr/bin/env python + +# Copyright (c) 2002 Detlev Offenbach + +from whrandom import randint +import sys + +from python_tqt.qt import * + +from mywidget import MyWidget + +class TQVDialog(TQDialog): + def __init__(self, parent=None, name=None, modal=0, flags=0): + TQDialog.__init__(self, parent, name, modal, flags) + + self.vb = TQVBoxLayout(self, 8) + self.vb.setAutoAdd(1) + + self.hb = None + self.map = {} + #self.sm = TQSignalMapper(self) + self.connect(self, PYSIGNAL('mapped(int)'), self.done) + + def addButtons(self, cancel=None, ok=None, mid1=None, mid2=None, mid3=None): + if ok is None: + self.addButton(self.tr("OK"),1) + else: + self.addButton(ok,1) + + if mid1 is not None: + self.addButton(mid1,2) + + if mid2 is not None: + self.addButton(mid2,3) + + if mid3 is not None: + self.addButton(mid3,4) + + if cancel is None: + self.addButton(self.tr('Cancel'),0) + else: + self.addButton(cancel,0) + + def addButton(self, text, result): + if self.hb is None: + self.hb = TQHBox(self) + c = TQPushButton(text, self.hb) + self.setMapping(c, result) + self.connect(c, SIGNAL('clicked()'), self.mapit) + + def setMapping(self, c, result): + self.map[c] = result + + def mapit(self): + qo = self.sender() + self.emit(PYSIGNAL('mapped(int)'), (self.map[qo],)) + +translator = None +wlist = [] # keep reference to widgets + +def showLang(lang): + global translator + + tqApp.setPalette(TQPalette(TQColor(220-randint(0,64),220-randint(0,64),220-randint(0,64)))) + + language = "mywidget_"+lang+".qm" + fi = TQFileInfo(language) + + if not fi.exists(): + TQMessageBox.warning(None, "File error", + "Cannot find translation for language: "+lang+\ + "\n(try eg. 'de' or 'en')") + return None + + if translator is not None: + tqApp.removeTranslator(translator) + translator = None + + translator = TQTranslator(None) + translator.load(language,".") + tqApp.installTranslator(translator) + m = MyWidget() + m.setCaption("PyTQt Example - i18n - " + str(m.caption())) + wlist.append(m) + return m + +def main(argv): + app = TQApplication(argv) + + qm = ["cs", "de", "el", "en", "eo", "fr", "it", "jp", "ko", "no", "ru", "zh"] + + lang = None + if len(argv) == 2: + lang = argv[1] + + if (len(argv) != 2) or (lang == "all"): + dlg = TQVDialog(None, None, 1) + qmb = [] + r = 0 + if lang == "all": + r=2 + else: + bg = TQButtonGroup(4, TQt.Vertical, "Choose Locales", dlg) + loc = TQTextCodec.locale() + for i in range(0,len(qm)): + qmb.append(TQCheckBox(qm[i], bg)) + qmb[i].setChecked(str(loc) == qm[i]) + dlg.addButtons("Cancel","OK","All") + r = dlg.exec_loop() + + if r: + tight = tqApp.desktop().screen().width < 1024 + x = 5 + y = 25 + for i in range(0,len(qm)): + if (r == 2) or (qmb[i].isChecked()): + w = showLang(qm[i]) + + if w == None: + sys.exit(0) + + app.connect(app, SIGNAL('lastWindowClosed()'), tqApp, SLOT('quit()')) + w.setGeometry(x,y,197,356) + w.show() + if tight: + x += 8 + y += 8 + else: + x += 205 + if x > 1000: + x = 5 + y += 384 + + else: + sys.exit(0) + + else: + lang = argv[1] + m = showLang(lang) + app.setMainWidget(m) + m.setCaption("PyTQt Example - i18n") + m.show() + + return app.exec_loop() + +if __name__ == "__main__": + main(sys.argv) diff --git a/examples/i18n/mywidget.py b/examples/i18n/mywidget.py new file mode 100644 index 0000000..8013c1c --- /dev/null +++ b/examples/i18n/mywidget.py @@ -0,0 +1,47 @@ +# Copyright (c) 2002 Detlev Offenbach + +from python_tqt.qt import * + +class MyWidget(TQMainWindow): + + def __init__(self, parent=None, name=None): + TQMainWindow.__init__(self, parent, name) + + self.central = TQVBox(self) + self.central.setMargin(5) + self.central.setSpacing(5) + self.setCentralWidget(self.central) + + self.setCaption(self.trUtf8("""Internationalization Example""")) + + self.file = TQPopupMenu(self) + self.file.insertItem(self.trUtf8("E&xit"), tqApp, SLOT("quit()"), + TQKeySequence(self.trUtf8("Ctrl+Q","File|Quit"))) + self.menuBar().insertItem(self.trUtf8("&File"), self.file) + + self.statusBar().message(self.trUtf8('''Language: English''')) + + self.label = TQLabel(self.trUtf8("The Main Window"), self.central) + + self.gbox = TQButtonGroup(1, TQGroupBox.Horizontal, + self.trUtf8("View"), self.central) + rb = TQRadioButton(tqApp.translate('MyWidget','Perspective'), self.gbox) + rb = TQRadioButton(tqApp.translate('MyWidget','Isometric'), self.gbox) + rb = TQRadioButton(tqApp.translate('MyWidget','Oblique'), self.gbox) + + self.initChoices(self.central) + + choices = [ + QT_TRANSLATE_NOOP("MyWidget", "First"), + QT_TRANSLATE_NOOP("MyWidget", "Second"), + QT_TRANSLATE_NOOP("MyWidget", "Third") + ] + + def initChoices(self, parent): + self.lb = TQListBox(parent) + for ch in self.choices: + self.lb.insertItem(self.trUtf8(ch)) + + def closeEvent(self, e): + TQWidget.closeEvent(self, e) + self.emit(PYSIGNAL('closed'), ()) diff --git a/examples/i18n/mywidget_cs.qm b/examples/i18n/mywidget_cs.qm new file mode 100644 index 0000000..f95090d Binary files /dev/null and b/examples/i18n/mywidget_cs.qm differ diff --git a/examples/i18n/mywidget_cs.ts b/examples/i18n/mywidget_cs.ts new file mode 100644 index 0000000..2b82f04 --- /dev/null +++ b/examples/i18n/mywidget_cs.ts @@ -0,0 +1,75 @@ + + + MyWidget + + View + Pohled + + + &File + &Soubor + + + E&xit + &Konec + + + First + První + + + Third + TÅ™etí + + + Language: English + Jayzk: ÄŒeský + + + The Main Window + Hlavní okno + + + Ctrl+Q + Ctrl+Q + + + Oblique + NaklonÄ›ný + + + Second + Druhý + + + Isometric + Isometrický + + + Perspective + Perspektivní + + + Internationalization Example + Ukázka lokalizace + + + + TQAccel + + Ctrl + Ctrl + + + + TQVDialog + + OK + + + + Cancel + + + + diff --git a/examples/i18n/mywidget_de.qm b/examples/i18n/mywidget_de.qm new file mode 100644 index 0000000..6433855 Binary files /dev/null and b/examples/i18n/mywidget_de.qm differ diff --git a/examples/i18n/mywidget_de.ts b/examples/i18n/mywidget_de.ts new file mode 100644 index 0000000..0a60c2b --- /dev/null +++ b/examples/i18n/mywidget_de.ts @@ -0,0 +1,69 @@ + + + MyWidget + + First + Erstens + + + Second + Zweitens + + + Third + Drittens + + + Internationalization Example + Internationalisierungsbeispiel + + + E&xit + Be&enden + + + &File + &Datei + + + Language: English + Sprache: Deutsch + + + The Main Window + Das Hauptfenster + + + View + Ansicht + + + Perspective + Perspektivisch + + + Isometric + Isometrisch + + + Oblique + Schief + + + Ctrl+Q + File|Quit + Strg+Q + + + + TQVDialog + + OK + OK + + + Cancel + Abbruch + + + diff --git a/examples/i18n/mywidget_el.qm b/examples/i18n/mywidget_el.qm new file mode 100644 index 0000000..15d7689 Binary files /dev/null and b/examples/i18n/mywidget_el.qm differ diff --git a/examples/i18n/mywidget_el.ts b/examples/i18n/mywidget_el.ts new file mode 100644 index 0000000..0d7a5dc --- /dev/null +++ b/examples/i18n/mywidget_el.ts @@ -0,0 +1,68 @@ + + + MyWidget + + &File + &ΑÏχείο + + + Ctrl+Q + Ctrl+Q + + + E&xit + Έ&ξοδος + + + First + ΠÏώτο + + + Internationalization Example + ΠαÏάδειγμα διεθνοποίησης + + + Isometric + ΙσομετÏική + + + Language: English + Γλώσσα: Ελληνικά + + + Oblique + Πλάγια + + + Perspective + ΠÏοοπτική + + + Second + ΔεÏτεÏο + + + The Main Window + ΚÏÏιο παÏάθυÏο + + + Third + ΤÏίτο + + + View + Όψη + + + + TQVDialog + + OK + + + + Cancel + + + + diff --git a/examples/i18n/mywidget_en.qm b/examples/i18n/mywidget_en.qm new file mode 100644 index 0000000..6bd22c4 Binary files /dev/null and b/examples/i18n/mywidget_en.qm differ diff --git a/examples/i18n/mywidget_en.ts b/examples/i18n/mywidget_en.ts new file mode 100644 index 0000000..30a6e66 --- /dev/null +++ b/examples/i18n/mywidget_en.ts @@ -0,0 +1,69 @@ + + + MyWidget + + First + + + + Second + + + + Third + + + + Internationalization Example + + + + E&xit + + + + &File + + + + Language: English + + + + The Main Window + + + + View + + + + Perspective + + + + Isometric + + + + Oblique + + + + Ctrl+Q + File|Quit + + + + + TQVDialog + + OK + + + + Cancel + + + + diff --git a/examples/i18n/mywidget_eo.qm b/examples/i18n/mywidget_eo.qm new file mode 100644 index 0000000..372cf79 Binary files /dev/null and b/examples/i18n/mywidget_eo.qm differ diff --git a/examples/i18n/mywidget_eo.ts b/examples/i18n/mywidget_eo.ts new file mode 100644 index 0000000..f4eaef4 --- /dev/null +++ b/examples/i18n/mywidget_eo.ts @@ -0,0 +1,72 @@ + + + MyWidget + + &File + &Dosiero + + + Ctrl+Q + Ctrl+F + + + E&xit... + &Fini... + + + First + Unue + + + Internationalization Example + Ekzemplo pri internaciigo + + + Isometric + Isometria + + + Language: English + Lingvo: Esperanto (ĈĜĤĴŜŬĉÄĥĵÅÅ­) + + + Oblique + Oblikva + + + Perspective + Perspektiva + + + Second + Due + + + The Main Window + La Ĉeffenestro + + + Third + Trie + + + View + Aspekto + + + E&xit + + + + + TQVDialog + + OK + + + + Cancel + + + + diff --git a/examples/i18n/mywidget_fr.qm b/examples/i18n/mywidget_fr.qm new file mode 100644 index 0000000..12a8464 Binary files /dev/null and b/examples/i18n/mywidget_fr.qm differ diff --git a/examples/i18n/mywidget_fr.ts b/examples/i18n/mywidget_fr.ts new file mode 100644 index 0000000..3fa0191 --- /dev/null +++ b/examples/i18n/mywidget_fr.ts @@ -0,0 +1,68 @@ + + + MyWidget + + View + Vue + + + &File + &Fichier + + + E&xit + &Quitter + + + First + Premier + + + Third + Troisième + + + Language: English + Langage : Français + + + The Main Window + La fenêtre principale + + + Ctrl+Q + Ctrl+Q + + + Oblique + Oblique + + + Second + Second + + + Isometric + Isométrique + + + Perspective + Perspective + + + Internationalization Example + Exemple d'internationalisation + + + + TQVDialog + + OK + + + + Cancel + + + + diff --git a/examples/i18n/mywidget_it.qm b/examples/i18n/mywidget_it.qm new file mode 100644 index 0000000..075bee2 Binary files /dev/null and b/examples/i18n/mywidget_it.qm differ diff --git a/examples/i18n/mywidget_it.ts b/examples/i18n/mywidget_it.ts new file mode 100644 index 0000000..4fa708c --- /dev/null +++ b/examples/i18n/mywidget_it.ts @@ -0,0 +1,72 @@ + + + MyWidget + + E&xit... + &Esci... + + + First + Primo + + + Internationalization Example + Esempio di localizzazione + + + Isometric + Isometrica + + + Language: English + Lingua: Italiano + + + Oblique + Obliqua + + + Perspective + Prospettica + + + Second + Secondo + + + The Main Window + La Finestra Principale + + + Third + Terzo + + + View + Vista + + + E&xit + + + + Ctrl+Q + + + + &File + + + + + TQVDialog + + OK + + + + Cancel + + + + diff --git a/examples/i18n/mywidget_jp.qm b/examples/i18n/mywidget_jp.qm new file mode 100644 index 0000000..8942dd7 Binary files /dev/null and b/examples/i18n/mywidget_jp.qm differ diff --git a/examples/i18n/mywidget_jp.ts b/examples/i18n/mywidget_jp.ts new file mode 100644 index 0000000..029dd0e --- /dev/null +++ b/examples/i18n/mywidget_jp.ts @@ -0,0 +1,68 @@ + + + MyWidget + + &File + ファイル(&F) + + + Ctrl+Q + Ctrl+Q + + + E&xit + 終了(&X) + + + First + 第一行 + + + Internationalization Example + 国際化(i18n)ã®ä¾‹ + + + Isometric + 等角投影法 + + + Language: English + 言語: 日本語 + + + Oblique + æ–œã‚投影法 + + + Perspective + é è¿‘法 + + + Second + 第二行 + + + The Main Window + メインウィンドウ + + + Third + 第三行 + + + View + è¡¨ç¤ºæ–¹å¼ + + + + TQVDialog + + OK + + + + Cancel + + + + diff --git a/examples/i18n/mywidget_ko.qm b/examples/i18n/mywidget_ko.qm new file mode 100644 index 0000000..dccc2ba Binary files /dev/null and b/examples/i18n/mywidget_ko.qm differ diff --git a/examples/i18n/mywidget_ko.ts b/examples/i18n/mywidget_ko.ts new file mode 100644 index 0000000..632f8a7 --- /dev/null +++ b/examples/i18n/mywidget_ko.ts @@ -0,0 +1,68 @@ + + + MyWidget + + &File + 파ì¼&F + + + Ctrl+Q + Ctrl+E + + + E&xit + 종료&X + + + First + 첫번째 + + + Internationalization Example + 국제화 예제 + + + Isometric + Isometric + + + Language: English + 언어 : 한국어 + + + Oblique + Oblique + + + Perspective + Perspective + + + Second + ë‘번째 + + + The Main Window + ë©”ì¸ ìœˆë„ìš° + + + Third + 세번째 + + + View + 보기 + + + + TQVDialog + + OK + + + + Cancel + + + + diff --git a/examples/i18n/mywidget_no.qm b/examples/i18n/mywidget_no.qm new file mode 100644 index 0000000..2adc136 Binary files /dev/null and b/examples/i18n/mywidget_no.qm differ diff --git a/examples/i18n/mywidget_no.ts b/examples/i18n/mywidget_no.ts new file mode 100644 index 0000000..b91293c --- /dev/null +++ b/examples/i18n/mywidget_no.ts @@ -0,0 +1,68 @@ + + + MyWidget + + View + Visning + + + &File + &Fil + + + E&xit + &Slutt + + + First + Første + + + Third + Tredje + + + Language: English + SprÃ¥k: Norsk + + + The Main Window + Hovedvinduet + + + Ctrl+Q + Ctrl+S + + + Oblique + Skjev + + + Second + Andre + + + Isometric + Isometrisk + + + Perspective + Perspektiv + + + Internationalization Example + Internasjonaliseringseksempel + + + + TQVDialog + + OK + + + + Cancel + + + + diff --git a/examples/i18n/mywidget_ru.qm b/examples/i18n/mywidget_ru.qm new file mode 100644 index 0000000..ebc512e Binary files /dev/null and b/examples/i18n/mywidget_ru.qm differ diff --git a/examples/i18n/mywidget_ru.ts b/examples/i18n/mywidget_ru.ts new file mode 100644 index 0000000..d279ed1 --- /dev/null +++ b/examples/i18n/mywidget_ru.ts @@ -0,0 +1,68 @@ + + + MyWidget + + View + Вид + + + &File + Файл + + + E&xit + Выход + + + First + Первый + + + Third + Третий + + + Language: English + Язык: РуÑÑкий + + + The Main Window + Главное окно + + + Oblique + КурÑив + + + Second + Второй + + + Isometric + ИзометричеÑкий + + + Perspective + ПерÑпектива + + + Internationalization Example + Пример интернациноализации + + + Ctrl+Q + + + + + TQVDialog + + OK + + + + Cancel + + + + diff --git a/examples/i18n/mywidget_zh.qm b/examples/i18n/mywidget_zh.qm new file mode 100644 index 0000000..a890c09 Binary files /dev/null and b/examples/i18n/mywidget_zh.qm differ diff --git a/examples/i18n/mywidget_zh.ts b/examples/i18n/mywidget_zh.ts new file mode 100644 index 0000000..0dcb2df --- /dev/null +++ b/examples/i18n/mywidget_zh.ts @@ -0,0 +1,68 @@ + + + MyWidget + + View + 视图 + + + &File + 文件[&F] + + + E&xit + 退出[&x] + + + First + 第一个 + + + Third + 第三个 + + + Language: English + 语言: 简体中文 + + + The Main Window + ä¸»çª—å£ + + + Ctrl+Q + Ctrl+Q + + + Oblique + 斜投影 + + + Second + 第二个 + + + Isometric + 等角投影 + + + Perspective + é€è§†æŠ•å½± + + + Internationalization Example + 国际化范例 + + + + TQVDialog + + OK + + + + Cancel + + + + diff --git a/examples/lineedits.py b/examples/lineedits.py new file mode 100755 index 0000000..0093f40 --- /dev/null +++ b/examples/lineedits.py @@ -0,0 +1,140 @@ +#!/usr/bin/env python + +#**************************************************************************** +#** $Id: lineedits.py,v 1.1 2002/06/19 07:56:07 phil Exp $ +#** +#** Copyright (C) 1992-1998 Troll Tech AS. All rights reserved. +#** +#** This file is part of an example program for PyTQt. This example +#** program may be used, distributed and modified without limitation. +#** +#*****************************************************************************/ + +import sys +from python_tqt.qt import * + +TRUE = 1 +FALSE = 0 + +class LineEdits(TQGroupBox): + def __init__(self, parent = None, name = None): + TQGroupBox.__init__(self, 0, TQt.Horizontal, "Line Edits", parent, name) + + self.setMargin(10) + + box = TQVBoxLayout(self.layout()) + + row1 = TQHBoxLayout(box) + row1.setMargin(5) + + label = TQLabel("Echo Mode: ", self) + row1.addWidget(label) + + combo1 = TQComboBox(FALSE, self) + row1.addWidget(combo1) + combo1.insertItem("Normal", -1) + combo1.insertItem("Password", -1) + combo1.insertItem("No Echo", -1) + + self.connect(combo1, SIGNAL("activated(int)"), self.slotEchoChanged) + self.lined1 = TQLineEdit(self) + box.addWidget(self.lined1) + + row2 = TQHBoxLayout(box) + row2.setMargin(5) + + label = TQLabel("Validator: ", self) + row2.addWidget(label) + + combo2 = TQComboBox(FALSE, self) + row2.addWidget(combo2) + combo2.insertItem("No Validator", -1) + combo2.insertItem("Integer Validator", -1) + combo2.insertItem("Double Validator", -1) + + self.connect(combo2, SIGNAL("activated(int)"), self.slotValidatorChanged) + + self.lined2 = TQLineEdit(self) + box.addWidget(self.lined2) + + row3 = TQHBoxLayout(box) + row3.setMargin(5) + + label = TQLabel("Alignment: ", self) + row3.addWidget(label) + + combo3 = TQComboBox(FALSE, self) + row3.addWidget(combo3) + combo3.insertItem("Left", -1) + combo3.insertItem("Centered", -1) + combo3.insertItem("Right", -1) + + self.connect(combo3, SIGNAL("activated(int)"), self.slotAlignmentChanged) + self.lined3 = TQLineEdit(self) + box.addWidget(self.lined3) + + row4 = TQHBox(self) + box.addWidget(row4) + row4.setMargin(5) + + TQLabel("Read-Only: ", row4) + + combo4 = TQComboBox(FALSE, row4) + combo4.insertItem("False", -1) + combo4.insertItem("True", -1) + + self.connect(combo4, SIGNAL("activated(int)"), self.slotReadOnlyChanged) + + self.lined4 = TQLineEdit(self) + box.addWidget(self.lined4) + + self.lined1.setFocus() + + def slotEchoChanged(self, i): + if i == 0: + self.lined1.setEchoMode(TQLineEdit.Normal) + elif i == 1: + self.lined1.setEchoMode(TQLineEdit.Password) + elif i == 2: + self.lined1.setEchoMode(TQLineEdit.NoEcho) + + self.lined1.setFocus() + + def slotValidatorChanged(self, i): + if i == 0: + self.lined2.setValidator(None) + elif i == 1: + self.lined2.setValidator(TQIntValidator(self.lined2)) + elif i == 2: + self.lined2.setValidator(TQDoubleValidator(-999.0, 999.0, 2, self.lined2)) + + self.lined2.setText("") + self.lined2.setFocus() + + def slotAlignmentChanged(self, i): + if i == 0: + self.lined3.setAlignment(TQLineEdit.AlignLeft) + elif i == 1: + self.lined3.setAlignment(TQLineEdit.AlignCenter) + elif i == 2: + self.lined3.setAlignment(TQLineEdit.AlignRight) + + self.lined3.setFocus() + + def slotReadOnlyChanged(self, i): + if i == 0: + self.lined4.setReadOnly(FALSE) + elif i == 1: + self.lined4.setReadOnly(TRUE) + + self.lined4.setFocus() + + +if __name__=='__main__': + app = TQApplication( sys.argv ) + + lineedits = LineEdits() + lineedits.setCaption("Lineedits - PyTQt Example") + lineedits.show() + app.setMainWidget(lineedits) + app.exec_loop() diff --git a/examples/listbox.py b/examples/listbox.py new file mode 100755 index 0000000..fce0cc8 --- /dev/null +++ b/examples/listbox.py @@ -0,0 +1,176 @@ +#!/usr/bin/env python + +"""************************************************************************** +** $Id: listbox.py,v 1.1 2003/05/30 17:47:57 phil Exp $ +** +** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. +** +** This file is part of an example program for TQt. This example +** program may be used, distributed and modified without limitation. +** +***************************************************************************""" + +import sys +from python_tqt.qt import * + +FALSE = 0 +TRUE = 1 + +class ListBoxDemo( TQWidget ): + def __init__( self, parent=None, name=None ): + TQWidget.__init__( self, parent, name ) + b = FALSE + g = TQGridLayout( self, 2, 2, 6 ) + + g.addWidget( TQLabel( "Configuration:", self ), 0, 0 ) + g.addWidget( TQLabel( "Result:", self ), 0, 1 ) + + self.l = TQListBox( self ) + g.addWidget( self.l, 1, 1 ) + self.l.setFocusPolicy( TQWidget.StrongFocus ) + + v = TQVBoxLayout( ) + g.addLayout( v, 1, 0 ) + + bg = TQButtonGroup( self, None ) + + b = TQRadioButton( "Fixed number of columns,\n" + "as many rows as needed.", + self ) + bg.insert( b ) + v.addWidget( b ) + b.setChecked( TRUE ) + self.connect( b, SIGNAL("clicked()"), self.setNumCols ) + h = TQHBoxLayout() + v.addLayout( h ) + h.addSpacing( 30 ) + h.addSpacing( 100 ) + h.addWidget( TQLabel( "Columns:", self ) ) + self.columns = TQSpinBox( self ) + h.addWidget( self.columns ) + + v.addSpacing( 12 ) + + b = TQRadioButton( "As many columns as fit on-screen,\n" + "as many rows as needed.", + self ) + bg.insert( b ) + v.addWidget( b ) + self.connect( b, SIGNAL("clicked()"), self.setColsByWidth ) + + v.addSpacing( 12 ) + + b = TQRadioButton( "Fixed number of rows,\n" + "as many columns as needed.", + self ) + bg.insert( b ) + v.addWidget( b ) + self.connect( b, SIGNAL("clicked()"), self.setNumRows ) + h = TQHBoxLayout() + v.addLayout( h ) + h.addSpacing( 30 ) + h.addSpacing( 100 ) + h.addWidget( TQLabel( "Rows:", self ) ) + self.rows = TQSpinBox( self ) + self.rows.setEnabled( FALSE ) + h.addWidget( self.rows ) + + v.addSpacing( 12 ) + + b = TQRadioButton( "As many rows as fit on-screen,\n" + "as many columns as needed.", + self ) + bg.insert( b ) + v.addWidget( b ) + self.connect( b, SIGNAL("clicked()"), self.setRowsByHeight ) + + v.addSpacing( 12 ) + + cb = TQCheckBox( "Variable-height rows", self ) + cb.setChecked( TRUE ) + self.connect( cb, SIGNAL("toggled(bool)"), self.setVariableHeight ) + v.addWidget( cb ) + v.addSpacing( 6 ) + + cb = TQCheckBox( "Variable-width columns", self ) + self.connect( cb, SIGNAL("toggled(bool)"), self.setVariableWidth ) + v.addWidget( cb ) + + cb = TQCheckBox( "Extended-Selection", self ) + self.connect( cb, SIGNAL("toggled(bool)"), self.setMultiSelection ) + v.addWidget( cb ) + + pb = TQPushButton( "Sort ascending", self ) + self.connect( pb, SIGNAL("clicked()"), self.sortAscending ) + v.addWidget( pb ) + + pb = TQPushButton( "Sort descending", self ) + self.connect( pb, SIGNAL("clicked()"), self.sortDescending ) + v.addWidget( pb ) + + v.addStretch( 100 ) + + i = 0 + while i <= 2560: + i+=1 + self.l.insertItem( str(TQString.fromLatin1( "Item " )) + str(TQString.number( i )), i ) + self.columns.setRange( 1, 256 ) + self.columns.setValue( 1 ) + self.rows.setRange( 1, 256 ) + self.rows.setValue( 256 ) + + self.connect( self.columns, SIGNAL("valueChanged(int)"), self.setNumCols ) + self.connect( self.rows, SIGNAL("valueChanged(int)"), self.setNumRows ) + + # slots + def setNumCols( self ): + self.columns.setEnabled( TRUE ) + self.rows.setEnabled( FALSE ) + self.l.setColumnMode( self.columns.value() ) + + def setNumRows( self ): + self.columns.setEnabled( FALSE ) + self.rows.setEnabled( TRUE ) + self.l.setRowMode( self.rows.value() ) + + def setRowsByHeight( self ): + self.columns.setEnabled( FALSE ) + self.rows.setEnabled( FALSE ) + self.l.setRowMode( TQListBox.FitToHeight ) + + def setColsByWidth( self ): + self.columns.setEnabled( FALSE ) + self.rows.setEnabled( FALSE ) + self.l.setColumnMode( TQListBox.FitToWidth ) + + def setVariableWidth( self, b ): + self.l.setVariableWidth( b ) + + def setVariableHeight( self, b ): + self.l.setVariableHeight( b ) + + def setMultiSelection( self, b ): + self.l.clearSelection() + if b : + self.l.setSelectionMode( TQListBox.Extended ) + else: + self.l.setSelectionMode( TQListBox.Single ) + + def sortAscending( self ): + self.l.sort( TRUE ) + + def sortDescending( self ): + self.l.sort( FALSE ) + + +def main( args ): + a = TQApplication( args ) + t = ListBoxDemo() + t.setCaption( "TQt Example - Listbox" ) + a.setMainWidget( t ) + t.show() + + a.exec_loop() + +if __name__=="__main__": + main(sys.argv) diff --git a/examples/listboxcombo.py b/examples/listboxcombo.py new file mode 100755 index 0000000..baca5d2 --- /dev/null +++ b/examples/listboxcombo.py @@ -0,0 +1,167 @@ +#!/usr/bin/env python + +"""************************************************************************** +** $Id: listboxcombo.py,v 1.1 2003/05/30 17:47:57 phil Exp $ +** +** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. +** +** This file is part of an example program for TQt. This example +** program may be used, distributed and modified without limitation. +** +***************************************************************************""" + +import sys +from python_tqt.qt import * + +FALSE = 0 +TRUE = 1 + +class ListBoxCombo( TQVBox ): + # Constructor + # Creates child widgets of the ListBoxCombo widget + def __init__( self, parent=None, name=None ): + TQVBox.__init__( self, parent, name ) + + self.setMargin( 5 ) + self.setSpacing( 5 ) + + i = 0 + row1 = TQHBox( self ) + row1.setSpacing( 5 ) + + # Create a multi-selection ListBox... + self.lb1 = TQListBox( row1 ) + self.lb1.setSelectionMode( TQListBox.Multi ) + + # ...insert a pixmap item... + xpm = TQPixmap( "qtlogo.png" ) + txt = TQString() + TQListBoxPixmap( self.lb1, xpm, txt ) + + # ...and 100 text items + for i in range(0, 100, 1) : + xpm = TQPixmap() + txt = TQString( "Listbox Item %1" ).arg( i ) + if not i % 4 : + xpm = TQPixmap( "fileopen.xpm" ) + TQListBoxPixmap( self.lb1, xpm, txt ) + + # Create a pushbutton... + arrow1 = TQPushButton( " -> ", row1 ) + # ...and connect the clicked SIGNAL with the SLOT slotLeft2Right + self.connect( arrow1, SIGNAL("clicked()"), self.slotLeft2Right ) + + # create an empty single-selection ListBox + self.lb2 = TQListBox( row1 ) + + row2 = TQHBox( self ) + row2.setSpacing( 5 ) + + box1 = TQVBox( row2 ) + box1.setSpacing( 5 ) + + # Create a non-editable Combobox and a label below... + cb1 = TQComboBox( FALSE, box1 ) + self.label1 = TQLabel( "Current Item: Combobox Item 0", box1 ) + self.label1.setMaximumHeight( self.label1.sizeHint().height() * 2 ) + self.label1.setFrameStyle( TQFrame.Panel | TQFrame.Sunken ) + + #...and insert 50 items into the Combobox + for i in range( 0, 50, 1 ) : + txt = str( TQString( "Combobox Item %1" ).arg( i ) ) + if i % 9 : + cb1.insertItem( txt ) + else : + cb1.listBox().insertItem( MyListBoxItem() ) + + box2 = TQVBox( row2 ) + box2.setSpacing( 5 ) + + # Create an editable Combobox and a label below... + cb2 = TQComboBox( TRUE, box2 ) + self.label2 = TQLabel( "Current Item: Combobox Item 0", box2 ) + self.label2.setMaximumHeight( self.label2.sizeHint().height() * 2 ) + self.label2.setFrameStyle( TQFrame.Panel | TQFrame.Sunken ) + + # ... and insert 50 items into the Combobox + for i in range(0, 50, 1 ) : + txt = str(TQString( "Combobox Item %1" ).arg( i )) + if not i % 4 : + cb2.insertItem( TQPixmap( "fileopen.xpm" ), txt ) + else : + cb2.insertItem( txt ) + + # Connect the activated SIGNALs of the Comboboxes with SLOTs + self.connect( cb1, SIGNAL("activated( const TQString & )"), self.slotCombo1Activated ) + self.connect( cb2, SIGNAL("activated( const TQString & )"), self.slotCombo2Activated ) + + """ SLOT slotLeft2Right + * Copies all selected items of the first ListBox into the second ListBox + """ + def slotLeft2Right( self ): + # Go through all items of the first ListBox + for i in range( 0, self.lb1.count(), 1 ) : + item = self.lb1.item( i ) + # if the item is selected... + if self.lb1.isSelected( i ): #item.isSelected() : + # ...and it is a text item... + if item.pixmap() and not(item.text().isEmpty()): + self.lb2.insertItem( item.pixmap(), item.text() ) + elif not( item.pixmap() ): + self.lb2.insertItem( item.text() ) + elif item.text().isEmpty() : + self.lb2.insertItem( item.pixmap() ) + + """ SLOT slotCombo1Activated( const TQString &s ) + * Sets the text of the item which the user just selected in the + * first Combobox (and is now the value of s) to the first Label. + """ + def slotCombo1Activated( self, s ) : + self.label1.setText( str(TQString( "Current Item: %1" ).arg( s ) ) ) + + """ SLOT slotCombo2Activated( const TQString &s ) + * Sets the text of the item which the user just selected in the + * second Combobox (and is now the value of s) to the second Label. + """ + def slotCombo2Activated( self, s ) : + self.label2.setText( str(TQString( "Current Item: %1" ).arg( s ) ) ) + + +class MyListBoxItem( TQListBoxItem ): + def __init__( self, parent=None, name=None ): + TQListBoxItem.__init__( self, parent, name ) + self.setCustomHighlighting( TRUE ) + + def paint( self, painter ): + # evil trick: find out whether we are painted onto our listbox + in_list_box = 0 + if self.listBox() and self.listBox().viewport() == painter.device(): + in_list_box = 1 + r = TQRect( 0, 0, self.width( self.listBox() ), self.height( self.listBox() ) ) + brush = TQBrush( TQt.red, TQt.SolidPattern ) + if in_list_box and isSelected(): + painter.eraseRect( r ) + painter.fillRect( 5, 5, self.width( self.listBox() ) - 10, self.height( self.listBox() ) - 10, brush ) + if in_list_box and isCurrent(): + self.listBox().style().drawPrimitive( TQStyle.PE_FocusRect, painter, r, self.listBox().colorGroup() ) + + def width( self, TQListBox ): + return 100 + + def height( self, TQListBox ): + return 16 + + +def main( args ): + a = TQApplication( args ) + + listboxcombo = ListBoxCombo() + listboxcombo.resize( 400, 270 ) + listboxcombo.setCaption( "TQt Example - Listboxes and Comboboxes" ) + a.setMainWidget( listboxcombo ) + listboxcombo.show(); + + a.exec_loop() + +if __name__=="__main__": + main(sys.argv) diff --git a/examples/marble.png b/examples/marble.png new file mode 100644 index 0000000..9c32530 Binary files /dev/null and b/examples/marble.png differ diff --git a/examples/mdi.py b/examples/mdi.py new file mode 100755 index 0000000..ca3d33b --- /dev/null +++ b/examples/mdi.py @@ -0,0 +1,360 @@ +#!/usr/bin/env python + +# A simple application. + + +import sys, string +from python_tqt.qt import * + + +fileopen = [ + '16 13 5 1', + '. c #040404', + '# c #808304', + 'a c None', + 'b c #f3f704', + 'c c #f3f7f3', + 'aaaaaaaaa...aaaa', + 'aaaaaaaa.aaa.a.a', + 'aaaaaaaaaaaaa..a', + 'a...aaaaaaaa...a', + '.bcb.......aaaaa', + '.cbcbcbcbc.aaaaa', + '.bcbcbcbcb.aaaaa', + '.cbcb...........', + '.bcb.#########.a', + '.cb.#########.aa', + '.b.#########.aaa', + '..#########.aaaa', + '...........aaaaa' +] + +filesave = [ + '14 14 4 1', + '. c #040404', + '# c #808304', + 'a c #bfc2bf', + 'b c None', + '..............', + '.#.aaaaaaaa.a.', + '.#.aaaaaaaa...', + '.#.aaaaaaaa.#.', + '.#.aaaaaaaa.#.', + '.#.aaaaaaaa.#.', + '.#.aaaaaaaa.#.', + '.##........##.', + '.############.', + '.##.........#.', + '.##......aa.#.', + '.##......aa.#.', + '.##......aa.#.', + 'b.............' +] + +fileprint = [ + '16 14 6 1', + '. c #000000', + '# c #848284', + 'a c #c6c3c6', + 'b c #ffff00', + 'c c #ffffff', + 'd c None', + 'ddddd.........dd', + 'dddd.cccccccc.dd', + 'dddd.c.....c.ddd', + 'ddd.cccccccc.ddd', + 'ddd.c.....c....d', + 'dd.cccccccc.a.a.', + 'd..........a.a..', + '.aaaaaaaaaa.a.a.', + '.............aa.', + '.aaaaaa###aa.a.d', + '.aaaaaabbbaa...d', + '.............a.d', + 'd.aaaaaaaaa.a.dd', + 'dd...........ddd' +] + +document = [ +"12 16 6 1", +" c #040404", +". c None", +"X c white", +"o c #808304", +"O c black", +"+ c #f3f7f3", +" .....", +" XXXXX ....", +" XXXXX X ...", +" XXXXX XX ..", +" XooXX O.", +" X+XXX+XXXO.", +" XXXXXXXXXO.", +" XoooXooXXO.", +" XXXXXXXXXO.", +" XXXXXXXXXO.", +" XoXXoooXXO.", +" XXXXXXXXXO.", +"OXXXXXXXXXO.", +"OXXXXXXXXXO.", +"OOOOOOOOOOO.", +"............" +] + +fileOpenText = \ +''' +Click this button to open a new file.

+You can also select the Open command from the File menu.''' + +fileSaveText = \ +'''Click this button to save the file you are editing.

+You will be prompted for a filename.

+You can also select the Save command from the File menu.''' + +filePrintText = \ +'''Click this button to print the file you are editing.

+You can also select the Print command from the File menu.''' + +#True=1 +#False=0 + +class ApplicationWindow(TQMainWindow): + def __init__(self): + TQMainWindow.__init__(self,None,'example application main window',TQt.WDestructiveClose) + + self.filename = TQString.null + self.printer = TQPrinter() + + self.fileTools = TQToolBar(self,'file operations') + + openIcon = TQPixmap(fileopen) + self.fileOpen = TQToolButton(TQIconSet(openIcon),'Open File',TQString.null,self.load,self.fileTools,'open file') + + saveIcon = TQPixmap(filesave) + self.fileSave = TQToolButton(TQIconSet(saveIcon),'Save File',TQString.null,self.save,self.fileTools,'save file') + printIcon = TQPixmap(fileprint) + self.filePrint = TQToolButton(TQIconSet(printIcon),'Print File',TQString.null,self.printDoc,self.fileTools,'print file') + + TQWhatsThis.whatsThisButton(self.fileTools) + + TQWhatsThis.add(self.fileOpen,fileOpenText) + TQMimeSourceFactory.defaultFactory().setPixmap('fileopen',openIcon) + TQWhatsThis.add(self.fileSave,fileSaveText) + TQWhatsThis.add(self.filePrint,filePrintText) + + self.file = TQPopupMenu(self) + self.menuBar().insertItem('&File',self.file) + + self.file.insertItem('&New',self.newDoc,TQt.CTRL + TQt.Key_N) + + id = self.file.insertItem(TQIconSet(openIcon),'&Open',self.load,TQt.CTRL + TQt.Key_O) + self.file.setWhatsThis(id,fileOpenText) + + id = self.file.insertItem(TQIconSet(saveIcon),'&Save',self.save,TQt.CTRL + TQt.Key_S) + self.file.setWhatsThis(id,fileSaveText) + + id = self.file.insertItem('Save &as',self.saveAs) + self.file.setWhatsThis(id,fileSaveText) + + self.file.insertSeparator() + + id = self.file.insertItem(TQIconSet(printIcon),'&Print',self.printDoc,TQt.CTRL + TQt.Key_P) + self.file.setWhatsThis(id,filePrintText) + + self.file.insertSeparator() + + self.file.insertItem('&Close',self,SLOT('close()'),TQt.CTRL + TQt.Key_W) + self.file.insertItem('&Quit',tqApp,SLOT('closeAllWindows()'),TQt.CTRL + TQt.Key_Q) + + self.menuBar().insertSeparator() + self.windows = TQPopupMenu( self ) + self.windows.setCheckable( True ) + self.connect( self.windows, SIGNAL( "aboutToShow()" ), + self.windowsMenuAboutToShow ) + self.menuBar().insertItem( "&Windows", self.windows ) + + self.help = TQPopupMenu(self) + self.menuBar().insertSeparator() + self.menuBar().insertItem('&Help',self.help) + + self.help.insertItem('&About',self.about,TQt.Key_F1) + self.help.insertItem('About &TQt',self.aboutTQt) + self.help.insertSeparator() + self.help.insertItem( "What's &This", self, SLOT("whatsThis()"), TQt.SHIFT+TQt.Key_F1) + + self.menuBar().insertSeparator() + + self.vb = TQVBox( self ) + self.vb.setFrameStyle( TQFrame.StyledPanel | TQFrame.Sunken ) + self.ws = TQWorkspace( self.vb ) + self.ws.setScrollBarsEnabled( True ) + self.setCentralWidget( self.vb ) + + self.statusBar().message('Ready',2000) + #self.resize(450,600) + + def newDoc(self): + w = MDIWindow( self.ws, "", TQt.WDestructiveClose ) + self.connect( w, PYSIGNAL( "message" ), self.statusBar(), SLOT( "message(const TQString&, int )") ) + w.setCaption("unnamed document") + w.setIcon( TQPixmap(document) ) + # show the very first window in maximized mode + if len(self.ws.windowList())==0: + w.showMaximized() + else: + w.show() + return w + + def load(self): + fn = TQFileDialog.getOpenFileName( TQString.null, TQString.null, self ) + if not fn.isEmpty(): + w = self.newDoc() + w.load( fn ) + else: + self.statusBar().message( "Loading aborted", 2000 ) + + def save(self): + m = self.ws.activeWindow() + if m: + m.save() + + def saveAs(self): + m = self.ws.activeWindow() + if m: + m.saveAs() + + def printDoc(self): + m = self.ws.activeWindow() + if m: + m.printDoc( self.printer ) + + def closeWindow(self): + m = self.ws.activeWindow() + if m: + m.close() + + def about(self): + TQMessageBox.about( self, "TQt Application Example", + "This example demonstrates simple use of\n " + "TQt's Multiple Document Interface (MDI).") + + def aboutTQt(self): + TQMessageBox.aboutTQt( self, "TQt Application Example" ) + + def windowsMenuAboutToShow(self): + self.windows.clear() + cascadeId = self.windows.insertItem("&Cascade", self.ws, SLOT("cascade() ") ) + tileId = self.windows.insertItem("&Tile", self.ws, SLOT("tile()" ) ) + if len(self.ws.windowList())==0 : + self.windows.setItemEnabled( cascadeId, False ) + self.windows.setItemEnabled( tileId, False ) + self.windows.insertSeparator() + windows = self.ws.windowList() + cnt=0 + for i in windows: + id =self.windows.insertItem(i.caption(),self.windowsMenuActivated ) + self.windows.setItemParameter( id, cnt ); + self.windows.setItemChecked( id, self.ws.activeWindow() == i ) + cnt=cnt+1 + + def windowsMenuActivated(self,sid ): + w = self.ws.windowList().at( id ) + if w: + w.showNormal() + w.setFocus() + + +class MDIWindow( TQMainWindow): + def __init__(self,parent, name, wflags ): + TQMainWindow.__init__(self,parent, name, wflags ) + self.mmovie = 0 + self.medit = TQMultiLineEdit( self ) + self.setFocusProxy( self.medit ) + self.setCentralWidget( self.medit ); + + + def load(self, fn ): + self.filename = fn + self.f=TQFile( self.filename ) + if not self.f.open( IO_ReadOnly ): + return + + if fn.contains(".gif"): + tmp=TQWidget(self) + self.setFocusProxy(tmp) + self.setCentralWidget(tmp) + self.medit.hide() + del self.medit + qm=TQMovie(fn) + #ifdef Q_WS_QWS // temporary speed-test hack + #qm->setDisplayWidget(tmp); + #endif + tmp.setBackgroundMode(TQWidget.NoBackground) + tmp.show() + self.mmovie=qm + else : + self.mmovie = 0 + t=TQTextStream(self.f) + s = t.read() + self.medit.setText( s ) + self.f.close() + self.setCaption( self.filename ) + self.emit(PYSIGNAL( "message"),(TQString("Loaded document %1").arg(self.filename),2000 )) + + def save(self): + if self.filename.isEmpty(): + self.saveAs() + return + text = self.medit.text() + output=open(str(self.filename),'w') + output.write(str(text)) + #emit message( TQString("Could not write to %1").arg(filename), 2000 ); + #return + output.close() + self.setCaption(self.filename) + self.emit(PYSIGNAL( "message"),(TQString("File %1 saved").arg(self.filename),2000 )) + + def saveAs(self): + fn = TQFileDialog.getSaveFileName( self.filename, TQString.null, self ) + if not fn.isEmpty(): + self.filename = fn + self.save() + else : + self.emit(PYSIGNAL( "message"),(TQString("Saving aborted"),2000 )) + + def printDoc(self,printer): + Margin = 10 + pageNo = 1 + + if printer.setup(self): + self.emit(PYSIGNAL( "message"),(TQString("Printing..."),2000 )) + p = TQPainter() + p.begin(printer) + p.setFont(self.medit.font()) + yPos = 0 + fm = p.fontMetrics() + metrics = TQPaintDeviceMetrics(printer) + + for i in range(self.medit.numLines()): + if Margin + yPos > metrics.height() - Margin: + pageNo = pageNo + 1 + self.emit(PYSIGNAL( "message"),(TQString("Printing (page %1) ...").arg(pageNo),2000 )) + printer.newPage() + yPos = 0 + + p.drawText(Margin,Margin + yPos,metrics.width(),fm.lineSpacing(),TQt.ExpandTabs | TQt.DontClip,self.medit.textLine(i)) + yPos = yPos + fm.lineSpacing() + + p.end() + self.emit(PYSIGNAL( "message"),(TQString("Printing completed"),2000 )) + else: + self.emit(PYSIGNAL( "message"),(TQString("Printing aborted"),2000 )) + + +if __name__=='__main__': + a = TQApplication(sys.argv) + mw = ApplicationWindow() + mw.setCaption("PyTQt Example - Multiple Documents Interface (MDI)") + mw.show() + a.connect(a, SIGNAL('lastWindowClosed()'), a, SLOT('quit()')) + a.exec_loop() diff --git a/examples/menu.py b/examples/menu.py new file mode 100755 index 0000000..31fadd9 --- /dev/null +++ b/examples/menu.py @@ -0,0 +1,286 @@ +#!/usr/bin/env python + +#**************************************************************************** +#** $Id: menu.py,v 1.3 2003/06/06 12:59:26 phil Exp $ +#** +#** Copyright (C) 1992-1998 Troll Tech AS. All rights reserved. +#** +#** This file is part of an example program for PyTQt. This example +#** program may be used, distributed and modified without limitation. +#** +#*****************************************************************************/ + +import sys, string +from python_tqt.qt import * + +TRUE = 1 +FALSE = 0 + +# XPM +p1_xpm = [ +"16 16 3 1", +" c None", +". c #000000000000", +"X c #FFFFFFFF0000", +" ", +" ", +" .... ", +" .XXXX. ", +" .............. ", +" .XXXXXXXXXXXX. ", +" .XXXXXXXXXXXX. ", +" .XXXXXXXXXXXX. ", +" .XXXXXXXXXXXX. ", +" .XXXXXXXXXXXX. ", +" .XXXXXXXXXXXX. ", +" .XXXXXXXXXXXX. ", +" .XXXXXXXXXXXX. ", +" .XXXXXXXXXXXX. ", +" .............. ", +" " +] + +# XPM +p2_xpm = [ +"16 16 3 1", +" c None", +". c #000000000000", +"X c #FFFFFFFFFFFF", +" ", +" ...... ", +" .XXX.X. ", +" .XXX.XX. ", +" .XXX.XXX. ", +" .XXX..... ", +" .XXXXXXX. ", +" .XXXXXXX. ", +" .XXXXXXX. ", +" .XXXXXXX. ", +" .XXXXXXX. ", +" .XXXXXXX. ", +" .XXXXXXX. ", +" ......... ", +" ", +" " +] + +# XPM +p3_xpm = [ +"16 16 3 1", +" c None", +". c #000000000000", +"X c #FFFFFFFFFFFF", +" ", +" ", +" ......... ", +" ........... ", +" ........ .. ", +" ........... ", +" ........... ", +" ........... ", +" ........... ", +" ...XXXXX... ", +" ...XXXXX... ", +" ...XXXXX... ", +" ...XXXXX... ", +" ......... ", +" ", +" " +] + + +# Auxiliary class to provide fancy menu items with different fonts. +# Used for the "bold" and "underline" menu items in the options menu. + +class MyMenuItem( TQCustomMenuItem ): + def __init__( self, s, f ): + TQCustomMenuItem.__init__( self ) + self.string = s + self.font = f + + def paint( self, p, cg, act, enabled, x, y, w, h ) : + p.setFont ( self.font ) + p.drawText( x, y, w, h, TQt.AlignLeft | TQt.AlignVCenter | TQt.ShowPrefix | TQt.DontClip, self.string ) + + def sizeHint( self ): + return TQFontMetrics( self.font ).size( TQt.AlignLeft | TQt.AlignVCenter | TQt.ShowPrefix | TQt.DontClip, self.string ) + + +# Implementation of MenuExample class + +class MenuExample( TQWidget ): + def __init__( self, parent=None, name=None ): + TQWidget.__init__( self, parent, name ) + self.p1 = TQIconSet( TQPixmap ( p1_xpm ) ) + self.p2 = TQIconSet( TQPixmap ( p2_xpm ) ) + self.p3 = TQIconSet( TQPixmap ( p3_xpm ) ) + + self.printer = TQPopupMenu( self ) + self.printer.insertTearOffHandle() + self.printer.insertItem( "&Print to printer", self.printDoc ) + self.printer.insertItem( "Print to &file", self.printFile ) + self.printer.insertItem( "Print to fa&x", self.fax ) + self.printer.insertSeparator() + self.printer.insertItem( "Printer &Setup", self.printerSetup ) + + self.file = TQPopupMenu( self ) + self.file.insertItem( self.p1, "&Open", self.open, TQt.CTRL+TQt.Key_O ) + self.file.insertItem( self.p2, "&New", self.news, TQt.CTRL+TQt.Key_N ) + self.file.insertItem( self.p3, "&Save", self.save, TQt.CTRL+TQt.Key_S ) + self.file.insertItem( "&Close", self.closeDoc, TQt.CTRL+TQt.Key_W ) + self.file.insertSeparator() + self.file.insertItem( "&Print", self.printer, TQt.CTRL+TQt.Key_P ) + self.file.insertSeparator() + self.file.insertItem( "E&xit", tqApp, SLOT( "quit()" ), TQt.CTRL+TQt.Key_Q ) + + self.edit = TQPopupMenu( self ) + undoID = self.edit.insertItem( "&Undo", self.undo ) + redoID = self.edit.insertItem( "&Redo", self.redo ) + self.edit.setItemEnabled( undoID, FALSE ) + self.edit.setItemEnabled( redoID, FALSE ) + + self.options = TQPopupMenu( self ) + self.options.insertTearOffHandle() + self.options.setCaption( "Options" ) + self.options.insertItem( "&Normal Font", self.normal ) + self.options.insertSeparator() + + self.options.polish() # adjust system settings + f = self.options.font() + f.setBold( TRUE ) + self.boldID = self.options.insertItem( MyMenuItem( "Bold", f ) ) + self.options.setAccel( TQt.CTRL+TQt.Key_B, self.boldID ) + self.options.connectItem( self.boldID, self.bold ) + + f = self.options.font() + f.setUnderline( TRUE ) + self.underlineID = self.options.insertItem( MyMenuItem( "Underline", f ) ) + self.options.setAccel( TQt.CTRL+TQt.Key_U, self.underlineID ) + self.options.connectItem( self.underlineID, self.underline ) + + self.isBold = FALSE + self.isUnderline = FALSE + self.options.setCheckable( TRUE ) + + self.help = TQPopupMenu( self ) + self.help.insertItem( "&About", self.about, TQt.CTRL+TQt.Key_H ) + self.help.insertItem( "About &TQt", self.aboutTQt ) + + self.menu = TQMenuBar( self ) + self.menu.insertItem( "&File", self.file ) + self.menu.insertItem( "&Edit", self.edit ) + self.menu.insertItem( "&Options", self.options ) + self.menu.insertSeparator() + self.menu.insertItem( "&Help", self.help ) + self.menu.setSeparator( TQMenuBar.InWindowsStyle ) + + msg = TQLabel( self ) + msg.setText( "A context menu is available.\n" + "Invoke it by right-clicking or by" + " pressing the 'context' button." ) + msg.setGeometry( 0, self.height() - 60, self.width(), 60 ) + msg.setAlignment( TQt.AlignCenter ) + + self.label = TQLabel( self ) + self.label.setGeometry( 20, self.rect().center().y()-20, self.width()-40, 40 ) + self.label.setFrameStyle( TQFrame.Box | TQFrame.Raised ) + self.label.setLineWidth( 1 ) + self.label.setAlignment( TQt.AlignCenter ) + + self.connect( self, PYSIGNAL( "explain" ), self.label, SLOT( "setText(const TQString &" ) ) + + self.setMinimumSize( 100, 80 ) + self.setFocusPolicy( TQWidget.ClickFocus ) + + def contextMenuEvent(self, cmev): + contextMenu = TQPopupMenu( self ) + caption = TQLabel( "Context Menu", self ) + caption.setAlignment( TQt.AlignCenter ) + contextMenu.insertItem( caption ) + contextMenu.insertItem( "&New", self.news, TQt.CTRL+TQt.Key_N ) + contextMenu.insertItem( "&Open...", self.open, TQt.CTRL+TQt.Key_O ) + contextMenu.insertItem( "&Save", self.save, TQt.CTRL+TQt.Key_S ) + submenu = TQPopupMenu( self ) + submenu.insertItem( "&Print to printer", self.printDoc ) + submenu.insertItem( "Print to &file", self.printFile ) + submenu.insertItem( "Print to fa&x", self.fax ) + contextMenu.insertItem( "&Print", submenu ) + contextMenu.exec_loop( TQCursor.pos() ) + + def open( self ): + self.emit( PYSIGNAL( "explain" ), ( "File/Open selected", ) ) + + def news( self ): + self.emit( PYSIGNAL( "explain" ), ( "File/New selected", ) ) + + def save( self ): + self.emit( PYSIGNAL( "explain" ), ( "File/Save selected", ) ) + + def closeDoc( self ): + self.emit( PYSIGNAL( "explain" ), ( "File/Close selected", ) ) + + def undo( self ): + self.emit( PYSIGNAL( "explain" ), ( "Edit/Undo selected", ) ) + + def redo( self ): + self.emit( PYSIGNAL( "explain" ), ( "Edit/Redo selected", ) ) + + def normal( self ): + self.isBold = FALSE + self.isUnderline = FALSE + font = TQFont() + self.label.setFont( font ) + self.options.setItemChecked( self.boldID, self.isBold ) + self.options.setItemChecked( self.underlineID, self.isUnderline ) + self.emit( PYSIGNAL( "explain" ), ( "Options/Normal selected", ) ) + + def bold( self ): + self.isBold = not self.isBold + font = TQFont() + font.setBold( self.isBold ) + font.setUnderline( self.isUnderline ) + self.label.setFont( font ) + self.options.setItemChecked( self.boldID, self.isBold ) + self.emit( PYSIGNAL( "explain" ), ( "Options/Bold selected", ) ) + + def underline( self ): + self.isUnderline = not self.isUnderline + font = TQFont() + font.setBold( self.isBold ) + font.setUnderline( self.isUnderline ) + self.label.setFont( font ) + self.options.setItemChecked( self.underlineID, self.isUnderline ) + self.emit( PYSIGNAL("explain"), ( "Options/Underline selected", )) + + def about( self ): + TQMessageBox.about( self, "TQt Menu Example", + "This example demonstrates simple use of TQt menus.\n" + "You can cut and paste lines from it to your own\n" + "programs." ) + + def aboutTQt( self ): + TQMessageBox.aboutTQt( self, "TQt Menu Example" ) + + def printDoc( self ): + self.emit( PYSIGNAL( "explain" ), ( "File/Printer/Print selected", ) ) + + def printFile( self ): + self.emit( PYSIGNAL( "explain" ), ( "File/Printer/Print To File selected", ) ) + + def fax( self ): + self.emit( PYSIGNAL( "explain" ), ( "File/Printer/Print To Fax selected", ) ) + + def printerSetup( self ): + self.emit( PYSIGNAL( "explain" ), ( "File/Printer/Printer Setup selected", ) ) + + def resizeEvent( self, ev ): + self.label.setGeometry( 20, self.rect().center().y()-20, self.width()-40, 40 ) + + +a = TQApplication( sys.argv ) +m = MenuExample() + +m.setCaption( "TQt Examples - Menus" ) +a.setMainWidget( m ) +m.show() +a.exec_loop() diff --git a/examples/progress.py b/examples/progress.py new file mode 100755 index 0000000..3ebdd12 --- /dev/null +++ b/examples/progress.py @@ -0,0 +1,281 @@ +#!/usr/bin/env python + +#/**************************************************************************** +#** $Id: progress.py 3.3.7 edited Aug 31 2005 $ +#** +#** Copyright (C) 1992-2005 Trolltech AS. All rights reserved. +#** +#** This file is part of an example program for TQt. This example +#** program may be used, distributed and modified without limitation. +#** +#** Converted to PyTQt3 by Hans-Peter Jansen +#** +#*****************************************************************************/ + +import sys +from python_tqt.qt import * +from random import randint + +class AnimatedThingy(TQLabel): + def __init__(self, parent, s): + TQLabel.__init__(self, parent) + self.label = TQString(s) + self.setEraseColor(TQt.white) + self.label.append("\n... and wasting CPU\nwith this animation!\n") + self.step = 0 + self.nqix = 10 + self.stepoff = 2 + self.stepmax = 7 + self.lwidth = 2 + self.tdelay = 100 + self.ox, self.oy = [], [] + for i in range(self.nqix): + self.ox.append((0, 0)) + self.oy.append((0, 0)) + self.x0, self.y0, self.x1, self.y1 = 0, 0, 0, 0 + self.dx0 = randint(0, self.stepmax) + self.stepoff + self.dy0 = randint(0, self.stepmax) + self.stepoff + self.dx1 = randint(0, self.stepmax) + self.stepoff + self.dy1 = randint(0, self.stepmax) + self.stepoff + + def show(self): + if not self.isVisible(): + self.startTimer(self.tdelay) + TQWidget.show(self) + + def hide(self): + TQWidget.hide(self) + self.killTimers() + + def sizeHint(self): + return TQSize(120, 100) + + def timerEvent(self, e): + p, pn = self._painter() + pn.setColor(self.eraseColor()) + p.setPen(pn) + self.step = step = (self.step + 1) % self.nqix + # erase line + p.drawLine(self.ox[step][0], self.oy[step][0], + self.ox[step][1], self.oy[step][1]) + # calc new line coordinates + ww, wh = self.width(), self.height() + self.x0, self.dx0 = self._inc(self.x0, self.dx0, ww) + self.y0, self.dy0 = self._inc(self.y0, self.dy0, wh) + self.x1, self.dx1 = self._inc(self.x1, self.dx1, ww) + self.y1, self.dy1 = self._inc(self.y1, self.dy1, wh) + self.ox[step] = (self.x0, self.x1) + self.oy[step] = (self.y0, self.y1) + self._drawqix(p, pn, step) + self._drawtxt(p) + + def paintEvent(self, event): + p, pn = self._painter() + p.setClipRect(event.rect()) + for i in range(self.nqix): + self._drawqix(p, pn, i) + self._drawtxt(p) + + def _painter(self): + p = TQPainter(self) + # we need to create a new pen from p.pen() with TQPen() in order + # to make it fully functional (changes are discarded otherwise) + pn = TQPen(p.pen()) + pn.setWidth(self.lwidth) + p.setPen(pn) + return p, pn + + def _drawqix(self, p, pn, step): + # rainbow effect + pn.setColor(TQColor(int((step * 255)/self.nqix), 255, 255, TQColor.Hsv)) + p.setPen(pn) + p.drawLine(self.ox[step][0], self.oy[step][0], + self.ox[step][1], self.oy[step][1]) + + def _drawtxt(self, p): + p.setPen(self.colorGroup().text()) + p.drawText(self.rect(), TQt.AlignCenter, self.label) + + def _inc(self, x, dx, b): + x += dx + if x < 0: + x = 0 + dx = randint(0, self.stepmax) + self.stepoff; + elif x >= b: + x = b - 1 + dx = -(randint(0, self.stepmax) + self.stepoff) + return x, dx + + +class CPUWaster(TQWidget): + def __init__(self): + TQWidget.__init__(self) + self.first_draw_item = 1000 + self.last_draw_item = 1006 + self.rects = 0 + self.timer_driven = 0 + self.default_label = 0 + self.got_stop = False + self.pb = None # non modal progress dialog + self.menubar = menubar = TQMenuBar(self, "menu") + self.file_ = file_ = TQPopupMenu() + menubar.insertItem("&File", file_) + for i in range(self.first_draw_item, self.last_draw_item + 1): + file_.insertItem(self.drawItemText(i), i) + file_.setAccel(TQKeySequence( + "Ctrl+%s" % (i - self.first_draw_item)), i) + self.connect(menubar, SIGNAL("activated(int)"), self.doMenuItem) + file_.insertSeparator() + file_.insertItem("Quit", tqApp, SLOT("quit()"), TQKeySequence("Ctrl+Q")) + self.options = options = TQPopupMenu() + menubar.insertItem("&Options", options) + self.ld_id = options.insertItem("Loop driven", self.loopDriven, + TQKeySequence("Alt+L")) + self.td_id = options.insertItem("Timer driven", self.timerDriven, + TQKeySequence("Alt+T")) + options.insertSeparator() + self.dl_id = options.insertItem("Default label", self.defaultLabel, + TQKeySequence("Alt+D")) + self.cl_id = options.insertItem("Custom label", self.customLabel, + TQKeySequence("Alt+C")) + options.insertSeparator() + self.md_id = options.insertItem("No minimum duration", + self.toggleMinimumDuration, + TQKeySequence("Alt+M")) + options.setCheckable(True) + # default option settings + self.timerDriven() + self.customLabel() + self.toggleMinimumDuration() + self.resize(400, 300) + self.setEraseColor(TQt.black) + + def drawItemRects(self, id_): + r = 100 + for n in range(id_ - self.first_draw_item): + if not n % 3: + r *= 4 + else: + r *= 5 + return r + + def drawItemText(self, id_): + return TQString("%d Rectangles" % self.drawItemRects(id_)) + + def enableDrawingItems(self, yes): + for i in range(self.first_draw_item, self.last_draw_item + 1): + self.menubar.setItemEnabled(i, yes) + + # slots + def doMenuItem(self, id_): + if id_ >= self.first_draw_item and id_ <= self.last_draw_item: + self.draw(self.drawItemRects(id_)) + + def timerDriven(self): + self.timer_driven = True + self.options.setItemChecked(self.td_id, True) + self.options.setItemChecked(self.ld_id, False) + + def loopDriven(self): + self.timer_driven = False + self.options.setItemChecked(self.ld_id, True) + self.options.setItemChecked(self.td_id, False) + + def defaultLabel(self): + self.default_label = True + self.options.setItemChecked(self.dl_id, True) + self.options.setItemChecked(self.cl_id, False) + + def customLabel(self): + self.default_label = False + self.options.setItemChecked(self.dl_id, False) + self.options.setItemChecked(self.cl_id, True) + + def toggleMinimumDuration(self): + self.options.setItemChecked(self.md_id, + not self.options.isItemChecked(self.md_id)) + + def stopDrawing(self): + self.got_stop = True + + def newProgressDialog(self, label, steps, modal): + d = TQProgressDialog(label, "Cancel", steps, self, "progress", modal) + if self.options.isItemChecked(self.md_id): + d.setMinimumDuration(0) + if not self.default_label: + d.setLabel(AnimatedThingy(d, label)) + d.setCaption("Please Wait") + return d + + def draw(self, n): + if self.timer_driven: + if self.pb: + tqWarning("This cannot happen!") + return + + self.rects = n + self.pb = self.newProgressDialog("Drawing rectangles.\n" + "Using timer event.", n, False) + self.connect(self.pb, SIGNAL("cancelled()"), self.stopDrawing) + self.enableDrawingItems(False) + self.startTimer(0) + self.got_stop = False + else: # loop driven with modal progress dialog + lpb = self.newProgressDialog("Drawing rectangles.\n" + "Using loop.", n, True) + p = TQPainter(self) + for i in range(n): + lpb.setProgress(i) + if lpb.wasCancelled(): + break + self._draw(p) + self._clear(p) + lpb.cancel() + del lpb + + def timerEvent(self, e): + if not self.got_stop: + self.pb.setProgress(self.pb.totalSteps() - self.rects) + self.rects -= 1 + p = TQPainter(self) + self._draw(p) + + if not self.rects or self.got_stop: + if not self.got_stop: + self.pb.setProgress(self.pb.totalSteps()) + self._clear(p) + self.enableDrawingItems(True) + self.killTimers() + self.pb.cancel() + del self.pb + self.pb = None + + def _draw(self, p): + ww = self.width() + wh = self.height() + if ww > 8 and wh > 8: + c = TQColor(randint(0, 255), randint(0, 255), randint(0, 255)) + x = randint(0, ww - 8) + y = randint(0, wh - 8) + w = randint(0, ww - x) + h = randint(0, wh - y) + p.fillRect(x, y, w, h, TQBrush(c)) + + def _clear(self, p): + p.fillRect(0, 0, self.width(), self.height(), TQBrush(self.eraseColor())) + + +if __name__ == "__main__": + app = TQApplication(sys.argv) + try: + n = int(sys.argv[1]) + except: + n = 1 + wlst = [] # keep a ref around + for i in range(n): + cpuw = CPUWaster() + if i == 0: + app.setMainWidget(cpuw) + cpuw.show() + wlst.append(cpuw) + app.exec_loop() diff --git a/examples/progressbar.py b/examples/progressbar.py new file mode 100755 index 0000000..e33362e --- /dev/null +++ b/examples/progressbar.py @@ -0,0 +1,155 @@ +#!/usr/bin/env python + +"""*********************************************************************** +** $Id: progressbar.py,v 1.1 2003/06/10 14:51:24 phil Exp $ +** +** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. +** +** This file is part of an example program for TQt. This example +** program may be used, distributed and modified without limitation. +** +**************************************************************************""" + +#import pdb +import sys +from python_tqt.qt import * + +FALSE = 0 +TRUE = 1 + +class ProgressBar( TQButtonGroup ): + # Constructor + # Creates child widgets of the ProgressBar widget + def __init__( self, parent=None, name=None ): + TQButtonGroup.__init__( self, 0, TQt.Horizontal, "Progress Bar", parent, name ) + + self.timer = TQTimer() + + self.setMargin( 10 ) + toplayout = TQGridLayout( self.layout(), 2, 2, 5) + + self.setRadioButtonExclusive( TRUE ) + + # insert three radiobuttons which the user can use + # to set the speed of the progress and two pushbuttons + # to start/pause/continue and reset the progress + self.slow = TQRadioButton( "&Slow", self ) + self.normal = TQRadioButton( "&Normal", self ) + self.fast = TQRadioButton( "&Fast", self ) + vb1 = TQVBoxLayout( ) + toplayout.addLayout( vb1, 0, 0 ) + vb1.addWidget( self.slow ) + vb1.addWidget( self.normal ) + vb1.addWidget( self.fast ) + + # two push buttons, one for start, for for reset. + self.start = TQPushButton( "&Start", self ) + self.reset = TQPushButton( "&Reset", self ) + + vb2 = TQVBoxLayout() + toplayout.addLayout( vb2, 0, 1 ) + vb2.addWidget( self.start ) + vb2.addWidget( self.reset ) + + # Create the progressbar + self.progress = TQProgressBar( 100, self ) + #self.progress.setStyle( TQMotifStyle() ) + toplayout.addMultiCellWidget( self.progress, 1, 1, 0, 1 ) + + # connect the clicked() SIGNALs of the pushbuttons to SLOTs + self.connect( self.start, SIGNAL("clicked()"), self.slotStart ) + self.connect( self.reset, SIGNAL("clicked()"), self.slotReset ) + + # connect the timeout() SIGNAL of the progress-timer to a SLOT + self.connect( self.timer, SIGNAL("timeout()"), self.slotTimeout ) + # Let's start with normal speed... + self.normal.setChecked( TRUE ) + + # some contraints + self.start.setFixedWidth( 80 ) + self.setMinimumWidth( 300 ) + + # SLOT slotStart + # This SLOT is called if the user clicks start/pause/continue button + def slotStart( self ): + # If the progress bar is at the beginning... + if self.progress.progress() == -1 : + # ...set according to the checked speed-radiobutton the + # the number of steps which are needed to complete the process + if self.slow.isChecked(): + self.progress.setTotalSteps( 10000 ) + elif self.normal.isChecked() : + self.progress.setTotalSteps( 1000 ) + else : + self.progress.setTotalSteps( 50 ) + + # disable the speed-radiobuttons + self.slow.setEnabled( FALSE ) + self.normal.setEnabled( FALSE ) + self.fast.setEnabled( FALSE ) + + # If the progress is not running... + if not self.timer.isActive() : + # ...start the timer (and so the progress) with a interval of 1 ms... + self.timer.start( 1 ) + # ...and rename the start/pause/continue button to Pause + self.start.setText( "&Pause" ) + else : # if the prgress is running... + # ...stop the timer (and so the prgress)... + self.timer.stop() + # ...and rename the start/pause/continue button to Continue + self.start.setText( "&Continue" ) + + # SLOT slotReset + # This SLOT is called when the user clicks the reset button + def slotReset( self ): + # stop the timer and progress + self.timer.stop() + + # rename the start/pause/continue button to Start... + self.start.setText( "&Start" ) + # ...and enable this button + self.start.setEnabled( TRUE ) + + # enable the speed-radiobuttons + self.slow.setEnabled( TRUE ) + self.normal.setEnabled( TRUE ) + self.fast.setEnabled( TRUE ) + + # reset the progressbar + self.progress.reset() + + # SLOT slotTimeout + # This SLOT is called each ms when the timer is + # active (== progress is running) + def slotTimeout( self ): + p = self.progress.progress() + + # If the progress is complete... + if p == self.progress.totalSteps() : + # ...rename the start/pause/continue button to Start... + self.start.setText( "&Start" ) + # ...and disable it... + self.start.setEnabled( FALSE ) + # ...and return + return + + # If the process is not complete increase it + p += 1 + self.progress.setProgress( p ) + + + #TQPushButton *start, *pause, *reset; + +def main( args ): + a = TQApplication( args ) + + progressbar = ProgressBar() + progressbar.setCaption("TQt Example - ProgressBar") + a.setMainWidget(progressbar) + progressbar.show() + + a.exec_loop() + +if __name__=="__main__": + main(sys.argv) diff --git a/examples/qdir.py b/examples/qdir.py new file mode 100755 index 0000000..358c796 --- /dev/null +++ b/examples/qdir.py @@ -0,0 +1,324 @@ +#!/usr/bin/env python +# +# 2005-02-12 initial version hp + +from __future__ import print_function +import os +import pickle +from python_tqt.qt import * +from dirview import Directory, DirectoryView + +bookmarks = [ + "22 14 8 1", + "# c #000080", + "a c #585858", + "b c #000000", + "c c #ffffff", + "d c #ffffff", + "e c #ffffff", + "f c #000000", + ". c None", + "...bb.................", + "..bacb....bbb.........", + "..badcb.bbccbab.......", + "..bacccbadccbab.......", + "..baecdbcccdbab.......", + "..bacccbacccbab.......", + "..badcdbcecdfab.......", + "..bacecbacccbab.......", + "..baccdbcccdbab.......", + "...badcbacdbbab.......", + "....bacbcbbccab.......", + ".....babbaaaaab.......", + ".....bbabbbbbbb.......", + "......bb.............." +] + +home = [ + "16 15 4 1", + "# c #000000", + "a c #ffffff", + "b c #c0c0c0", + ". c None", + ".......##.......", + "..#...####......", + "..#..#aabb#.....", + "..#.#aaaabb#....", + "..##aaaaaabb#...", + "..#aaaaaaaabb#..", + ".#aaaaaaaaabbb#.", + "###aaaaaaaabb###", + "..#aaaaaaaabb#..", + "..#aaa###aabb#..", + "..#aaa#.#aabb#..", + "..#aaa#.#aabb#..", + "..#aaa#.#aabb#..", + "..#aaa#.#aabb#..", + "..#####.######.." +] + + +class PixmapView(TQScrollView): + def __init__(self, parent): + TQScrollView.__init__(self, parent) + self.pixmap = None + self.viewport().setBackgroundMode(self.PaletteBase) + + def setPixmap(self, pix): + self.pixmap = pix + self.resizeContents(pix.size().width(), pix.size().height()) + self.viewport().repaint(False) + + def drawContents(self, p, cx, cy, cw, ch): + p.fillRect(cx, cy, cw, ch, self.colorGroup().brush(TQColorGroup.Base)) + p.drawPixmap(0, 0, self.pixmap) + + +class Preview(TQWidgetStack): + def __init__(self, parent): + TQWidgetStack.__init__(self, parent) + self.normalText = TQMultiLineEdit(self) + self.normalText.setReadOnly(True) + self.html = TQTextView(self) + self.pixmap = PixmapView(self) + self.raiseWidget(self.normalText) + + def showPreview(self, url, size): + if url.isLocalFile(): + path = url.path() + fi = TQFileInfo(path) + if fi.isFile() and fi.size() > size * 1000: + self.normalText.setText( + "The File\n%s\nis too large, so I don't show it!" % path) + self.raiseWidget(self.normalText) + return + pix = TQPixmap(path) + if pix.isNull(): + if fi.isFile(): + err = False + try: + text = open(path.latin1(), "r").read() + except IOError as msg: + text = TQString(str(msg)) + err = True + if not err and fi.extension().lower().contains("htm"): + url = self.html.mimeSourceFactory().makeAbsolute( + path, self.html.context()) + self.html.setText(text, url) + self.raiseWidget(self.html) + return + else: + self.normalText.setText(text) + self.raiseWidget(self.normalText) + return + else: + self.normalText.setText("") + self.raiseWidget(self.normalText) + else: + self.pixmap.setPixmap(pix) + self.raiseWidget(self.pixmap) + else: + self.normalText.setText("I only show local files!") + self.raiseWidget(self.normalText) + + +# We can't instantiate TQFilePreview directly because it is abstract. Note that +# the previewUrl() abstract is patched in later to work around the fact that +# you can't multiply inherit from more than one wrapped class. +class FilePreview(TQFilePreview): + pass + + +class PreviewWidget(TQVBox): + def __init__(self, parent): + TQVBox.__init__(self, parent) + self.setSpacing( 5 ) + self.setMargin( 5 ) + row = TQHBox(self) + row.setSpacing(5) + TQLabel("Only show files smaller than: ", row) + self.sizeSpinBox = TQSpinBox(1, 10000, 1, row) + self.sizeSpinBox.setSuffix(" KB") + self.sizeSpinBox.setValue(128) + row.setFixedHeight(10 + self.sizeSpinBox.sizeHint().height()) + self.__preview = Preview(self) + # workaround sip inability of multiple inheritance + # create a local TQFilePreview instance and redirect + # the method, which is called on preview, to us + self.preview = FilePreview() + self.preview.previewUrl = self.previewUrl + + def previewUrl(self, url): + self.__preview.showPreview(url, self.sizeSpinBox.value()) + + +class CustomFileDialog(TQFileDialog): + def __init__(self, preview = False): + TQFileDialog.__init__(self, None, None, True) + self.bookmarkFile = ".pybookmarks" + self.bookmarkList = [] + if os.path.exists(self.bookmarkFile): + try: + self.bookmarkList = pickle.loads(open(self.bookmarkFile, "rb").read()) + except IOError as msg: + print(msg) + self.setDir("/") + self.dirView = DirectoryView(self, None, True) + self.dirView.addColumn("") + self.dirView.header().hide() + root = Directory(self.dirView, "/") + root.setOpen(True) + self.dirView.setFixedWidth(200) + self.addLeftWidget(self.dirView) + p = TQPushButton(self) + p.setPixmap(TQPixmap(bookmarks)) + TQToolTip.add(p, "Bookmarks") + self.bookmarkMenu = TQPopupMenu(self) + self.connect(self.bookmarkMenu, SIGNAL("activated(int)"), + self.bookmarkChosen) + self.addId = self.bookmarkMenu.insertItem("Add bookmark") + self.bookmarkMenu.insertSeparator() + for l in self.bookmarkList: + self.bookmarkMenu.insertItem(l) + p.setPopup(self.bookmarkMenu) + self.addToolButton(p, True) + self.connect(self.dirView, PYSIGNAL("folderSelected(const TQString &)"), + self.setDir2) + self.connect(self, SIGNAL("dirEntered(const TQString &)"), + self.dirView.setDir) + b = TQToolButton(self) + TQToolTip.add(b, "Go Home!") + b.setPixmap(TQPixmap(home)) + self.connect(b, SIGNAL("clicked()"), self.goHome) + self.addToolButton(b) + + if preview: + self.setContentsPreviewEnabled(True) + pw = PreviewWidget(self) + self.setContentsPreview(pw, pw.preview) + self.setViewMode(TQFileDialog.List) + self.setPreviewMode(TQFileDialog.Contents) + + w = self.width() + h = self.height() + if preview: + self.resize(w + w / 2, h + h / 3) + else: + self.resize(w + w / 3, h + h / 4) + + def done(self, r): + if self.bookmarkList: + try: + open(self.bookmarkFile, "wb").write(pickle.dumps(self.bookmarkList)) + except IOError as msg: + print(msg) + return TQFileDialog.done(self, r) + + def showEvent(self, e): + TQFileDialog.showEvent(self, e) + self.dirView.setDir(self.dirPath()) + + def setDir2(self, path): + self.blockSignals(True) + self.setDir(path) + self.blockSignals(False) + + def bookmarkChosen(self, i): + if i == self.addId: + # keep bookmarks pythonic + dp = self.dirPath().latin1() + if dp not in self.bookmarkList: + self.bookmarkList.append(dp) + self.bookmarkMenu.insertItem(dp) + else: + self.setDir(self.bookmarkMenu.text(i)) + + def goHome(self): + if os.getenv("HOME"): + self.setDir(os.getenv("HOME")) + else: + self.setDir("/") + + +if __name__ == '__main__': + import sys + import getopt + + def usage(msg = None): + if msg: + print(msg, file=sys.stderr) + print("""\ +usage: qdir [--any | --dir | --custom] [--preview] [--default f] {--filter f} [caption ...] + --any Get any filename, need not exist. + --dir Return a directory rather than a file. + --custom Opens a customized TQFileDialog with + dir browser, bookmark menu, etc. + --preview Show a preview widget. + --default f Start from directory/file f. + --filter f eg. '*.gif' '*.bmp' + caption ... Caption for dialog. +""", file=sys.stderr) + sys.exit(1) + + def main(): + options = ["help", "any", "dir", "custom", "preview", "default=", "filter="] + mode = TQFileDialog.ExistingFile + preview = False + custom = False + start = None + filter = TQString.null + app = TQApplication(sys.argv) + + try: + optlist, args = getopt.getopt(sys.argv[1:], "h", options) + except getopt.error as msg: + usage(msg) + + for opt, par in optlist: + if opt in ("-h", "--help"): + usage() + elif opt == "--any": + mode = TQFileDialog.AnyFile + elif opt == "--dir": + mode = TQFileDialog.Directory + elif opt == "--default": + start = par + elif opt == "--filter": + filter = par + elif opt == "--preview": + preview = True + elif opt == "--custom": + custom = True + if args: + caption = " ".join(args) + elif mode == TQFileDialog.Directory: + caption = "Choose directory..." + else: + caption = "Choose file..." + if not start: + start = TQDir.currentDirPath() + if not custom: + fd = TQFileDialog(TQString.null, filter, None, None, True) + fd.setMode(mode) + if preview: + fd.setContentsPreviewEnabled(True) + pw = PreviewWidget(fd) + fd.setContentsPreview(pw, pw.preview) + fd.setViewMode(TQFileDialog.List) + fd.setPreviewMode(TQFileDialog.Contents) + w = fd.width() + h = fd.height() + fd.resize(w + w / 3, h + h / 4) + fd.setCaption(caption) + fd.setSelection(start) + if fd.exec_loop() == TQDialog.Accepted: + print("%s\n" % fd.selectedFile().latin1()) + return 0 + else: + return 1 + else: + fd = CustomFileDialog(preview) + fd.exec_loop() + return 1 + + sys.exit(main()) diff --git a/examples/qmag.py b/examples/qmag.py new file mode 100755 index 0000000..186a473 --- /dev/null +++ b/examples/qmag.py @@ -0,0 +1,233 @@ +#!/usr/bin/env python + +#**************************************************************************** +#** $Id: qmag.py,v 1.1 2002/06/20 18:52:31 phil Exp $ +#** +#** Copyright (C) 1992-1998 Troll Tech AS. All rights reserved. +#** +#** This file is part of an example program for PyTQt. This example +#** program may be used, distributed and modified without limitation. +#** +#*****************************************************************************/ + +import sys +from python_tqt.qt import * + +TRUE = 1 +FALSE = 0 + +zoomfactors = ["100%","200%","300%","400%","500%","600%","700%","800%","1600%"] + +refreshrates = [ + "No autorefresh", "50 per second", "4 per second", "3 per second", + "2 per second", "Every second", "Every two seconds", "Every three seconds", + "Every five seconds", "Every ten seconds"] + +timer = (0, 20, 250, 333, 500, 1000, 2000, 3000, 5000, 10000) + +class MagWidget(TQWidget): + def __init__(self, tqApp, parent = None, name = None): + self.qApp = tqApp + TQWidget.__init__(self, parent, name) + self.pm = TQPixmap() # pixmap magnified + self.p = TQPixmap() # pixmap + self.image = TQImage() # image of pixmap (for RGB) + self.z = 0 # zoom factor + self.r = 0 # autorefresh rate (index into refreshrates) + self.grabbing = FALSE # TRUE if currently grabbing + self.grabx = -1 + self.graby = -1 + + self.zoom = TQComboBox(FALSE, self) + self.zoom.insertStrList(zoomfactors, len(zoomfactors)) + self.connect(self.zoom, SIGNAL("activated(int)"), + self.setZoom) + + self.refresh = TQComboBox(FALSE, self) + self.refresh.insertStrList(refreshrates, len(refreshrates)) + self.connect(self.refresh, SIGNAL("activated(int)"), + self.setRefresh) + + x = 0 + w = 0 + h = 20 + for s in zoomfactors: + cw = self.zoom.fontMetrics().width(s) + w = max(cw, w) + self.zoom.setGeometry(x, 2, w + 30, h) + + x = w + 34 + w = 0 + for s in refreshrates: + cw = self.refresh.fontMetrics().width(s) + w = max(cw, w) + self.refresh.setGeometry(x, 2, w + 30, h) + + self.saveButton = TQPushButton(self) + self.connect(self.saveButton, SIGNAL("clicked()"), self.save) + self.saveButton.setText("Save") + self.saveButton.setGeometry(x + w + 30 + 2, 2, + 10 + self.saveButton.fontMetrics().width("Save"), h) + + self.quitButton = TQPushButton(self) + self.connect(self.quitButton, SIGNAL("clicked()"), self.qApp, SLOT("quit()")) + self.quitButton.setText("Quit") + self.quitButton.setGeometry(self.saveButton.geometry().right() + 2, 2, + 10 + self.quitButton.fontMetrics().width("Quit"), h) + + self.rgb = TQLabel(self) + self.rgb.setText("") + self.rgb.setAlignment(TQt.AlignVCenter) + self.rgb.resize(self.width(), self.rgb.fontMetrics().height() + 4) + + self.yoffset = self.zoom.height() + 4 + self.rgb.height() + self.setMinimumSize(self.quitButton.geometry().topRight().x() + 2, + self.yoffset + 20) + w = self.quitButton.geometry().topRight().x() + 2 + self.resize(w, w) + + self.setMouseTracking(TRUE) + self.grabx = self.qApp.desktop().width() / 2 + self.graby = self.qApp.desktop().height() / 2 + self.grabAround(TQPoint(self.grabx, self.graby)) + + #self.zoom.setCurrentItem(1) # grabAround sets zoom factor + #self.setZoom(1) + self.refresh.setCurrentItem(5) + self.setRefresh(5) + + def setZoom(self, index): + if index == 8: + self.z = 16 + else: + self.z = index + 1 + self.grab() + + def setRefresh(self, index): + self.r = index + self.killTimers() + if index and not self.grabbing: + #print "st:", timer[index] + self.startTimer(timer[index]) + + def save(self): + if not self.p.isNull(): + self.killTimers() + fn = TQFileDialog.getSaveFileName() + if not fn.isEmpty(): + self.p.save(fn, "BMP") + if self.r: + self.startTimer(timer[self.r]) + + def grab(self): + if not self.isVisible() or self.grabx < 0 or self.graby < 0: + return + + w = (self.width() + self.z - 1) / self.z + h = (self.height() + self.z - 1 - self.yoffset) / self.z + + if w < 1 or h < 1: + return + + x = self.grabx - w / 2 + y = self.graby - h / 2 + + if x + w > TQApplication.desktop().width(): + x = TQApplication.desktop().width() - w + elif x < 0: + x = 0 + + if y + h > TQApplication.desktop().height(): + y = TQApplication.desktop().height() - h + elif y < 0: + y = 0 + + self.p = TQPixmap.grabWindow(TQApplication.desktop().winId(), x, y, w, h) + self.image = self.p.convertToImage() + m = TQWMatrix() + #print "z:", self.z + m.scale(float(self.z), float(self.z)) + self.pm = self.p.xForm(m) + self.repaint(FALSE) + + def paintEvent(self, e): + if not self.pm.isNull(): + paint = TQPainter(self) + paint.drawPixmap(0, self.zoom.height() + 4, self.pm, + 0, 0, self.width(), self.height() - self.yoffset) + + def mousePressEvent(self, e): + if not self.grabbing: + self.grabbing = TRUE + self.killTimers() + self.grabMouse(TQt.crossCursor) + self.grabx = -1 + self.graby = -1 + else: + self.grabx = self.mapToGlobal(e.pos()).x() + self.graby = self.mapToGlobal(e.pos()).y() + + def mouseReleaseEvent(self, e): + if self.grabbing and self.grabx >= 0 and self.graby >= 0: + self.grabbing = FALSE + self.grabAround(e.pos()) + self.releaseMouse() + + def grabAround(self, pos): + rx = self.mapToGlobal(pos).x() + ry = self.mapToGlobal(pos).y() + w = abs(rx - self.grabx) + h = abs(ry - self.graby) + if w > 10 and h > 10: + pz = 1 + while w*pz*h*pz < self.width()*(self.height()-self.yoffset) and \ + w*pz < TQApplication.desktop().width() and \ + h*pz < TQApplication.desktop().height(): + pz += 1 + if (w*pz*h*pz - self.width()*(self.height()-self.yoffset)) > \ + (self.width()*(self.height()-self.yoffset) - w*(pz-1)*h*(pz-1)): + pz -= 1 + if pz < 1: + pz = 1 + elif pz > 8: + pz = 8 + self.zoom.setCurrentItem(pz-1) + self.z = pz + self.grabx = min(rx, self.grabx) + w / 2 + self.graby = min(ry, self.graby) + h / 2 + #self.resize(w*self.z, h*self.z*self.yoffset) + self.grab() + + def mouseMoveEvent(self, e): + if self.grabbing or self.pm.isNull() or \ + e.pos().y() > self.height() - self.zoom.fontMetrics().height() - 4 or \ + e.pos().y() < self.zoom.height() + 4: + self.rgb.setText("") + else: + x = e.pos().x() / self.z + y = (e.pos().y() - self.zoom.height() - 4) / self.z + pixelinfo = "" + if self.image.valid(x, y): + px = self.image.pixel(x, y) + pixelinfo = "%3d,%3d,%3d #%02x%02x%02x" % ( + tqRed(px), tqGreen(px), tqBlue(px), + tqRed(px), tqGreen(px), tqBlue(px)) + self.rgb.setText("x=%d, y=%d %s" % \ + (x + self.grabx, y + self.graby, pixelinfo)) + + def focusOutEvent(self, e): + self.rgb.setText("") + + def timerEvent(self, e): + self.grab() + + def resizeEvent(self, e): + self.rgb.setGeometry(0, self.height() - self.rgb.height(), + self.width(), self.rgb.height()) + +if __name__=='__main__': + app = TQApplication( sys.argv ) + m = MagWidget(app) + app.setMainWidget(m) + m.show() + app.exec_loop() diff --git a/examples/qt.png b/examples/qt.png new file mode 100644 index 0000000..d63e16f Binary files /dev/null and b/examples/qt.png differ diff --git a/examples/qtlogo.png b/examples/qtlogo.png new file mode 100644 index 0000000..c83c7b2 Binary files /dev/null and b/examples/qtlogo.png differ diff --git a/examples/rangecontrols.py b/examples/rangecontrols.py new file mode 100755 index 0000000..14588c8 --- /dev/null +++ b/examples/rangecontrols.py @@ -0,0 +1,79 @@ +#!/usr/bin/env python + +"""************************************************************************** +** $Id: rangecontrols.py,v 1.1 2003/07/01 14:18:37 phil Exp $ +** +** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. +** +** This file is part of an example program for TQt. This example +** program may be used, distributed and modified without limitation. +** +***************************************************************************""" + +import sys +from python_tqt.qt import * + +INT_MAX = sys.maxsize + +class RangeControls( TQVBox ): + def __init__( self, parent=None, name=None ): + TQVBox.__init__( self, parent, name ) + + row1 = TQHBox( self ) + cell2 = TQVBox( row1 ) + cell2.setMargin( 10 ) + cell2.setFrameStyle( TQFrame.WinPanel | TQFrame.Sunken ) + + TQWidget( cell2 ) + + label1 = TQLabel( TQString( "Enter a value between\n%1 and %2:" ).arg( -INT_MAX ).arg( INT_MAX ), cell2 ) + label1.setMaximumHeight( label1.sizeHint().height() ) + sb1 = TQSpinBox( -INT_MAX, INT_MAX, 1, cell2 ) + sb1.setValue( 0 ) + + label2 = TQLabel( "Enter a zoom value:", cell2 ) + label2.setMaximumHeight( label2.sizeHint().height() ) + sb2 = TQSpinBox( 0, 1000, 10, cell2 ) + sb2.setSuffix( " %" ) + sb2.setSpecialValueText( "Automatic" ) + + label3 = TQLabel( "Enter a price:", cell2 ) + label3.setMaximumHeight( label3.sizeHint().height() ) + sb3 = TQSpinBox( 0, INT_MAX, 1, cell2 ) + sb3.setPrefix( "$" ) + sb3.setValue( 355 ) + + TQWidget( cell2 ) + + row2 = TQHBox( self ) + + cell3 = TQVBox( row2 ) + cell3.setMargin( 10 ) + cell3.setFrameStyle( TQFrame.WinPanel | TQFrame.Sunken ) + hslider = TQSlider( 0, 64, 1, 33, TQt.Horizontal, cell3 ) + lcd2 = TQLCDNumber( 2, cell3 ) + lcd2.display( 33 ) + lcd2.setSegmentStyle( TQLCDNumber.Filled ) + self.connect( hslider, SIGNAL("valueChanged( int )"), lcd2, SLOT("display( int )") ) + + cell4 = TQHBox( row2 ) + cell4.setFrameStyle( TQFrame.WinPanel | TQFrame.Sunken ) + cell4.setMargin( 10 ) + vslider = TQSlider( 0, 64, 1, 8, TQt.Vertical, cell4 ) + lcd3 = TQLCDNumber( 3, cell4 ) + lcd3.display( 8 ) + self.connect( vslider, SIGNAL("valueChanged( int )"), lcd3, SLOT("display( int )") ) + +def main( args ): + a = TQApplication( args ) + + rangecontrols = RangeControls() + rangecontrols.resize( 500, 300 ) + rangecontrols.setCaption( "TQt Example - Range Control Widgets" ); + a.setMainWidget( rangecontrols ) + rangecontrols.show() + + a.exec_loop() + +if __name__=="__main__": + main(sys.argv) diff --git a/examples/richtext.py b/examples/richtext.py new file mode 100755 index 0000000..2e6abac --- /dev/null +++ b/examples/richtext.py @@ -0,0 +1,136 @@ +#!/usr/bin/env python + +"""************************************************************************** +** $Id: richtext.py,v 1.1 2003/07/01 14:18:37 phil Exp $ +** +** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. +** +** This file is part of an example program for TQt. This example +** program may be used, distributed and modified without limitation. +** +***************************************************************************""" + +import sys +from python_tqt.qt import * + +sayings = [ + "Saying 1:
" + "


" + "Evil is that which one believes of others. It is a sin to believe evil " + "of others, but it is seldom a mistake.

" + "
-- H.L. Mencken
", + + "Saying 2:
" + "


" + "A well-used door needs no oil on its hinges.
" + "A swift-flowing steam does not grow stagnant.
" + "Neither sound nor thoughts can travel through a vacuum.
" + "Software rots if not used.

" + "These are great mysteries.


" + "
-- Geoffrey James, \"The Tao of Programming\"
", + + "Saying 3:
" + "


" + "Show business is just like high school, except you get paid.

" + "
-- Martin Mull
", + + "Saying 4:
" + "


" + "The Least Successful Executions
" + "

History has furnished us with two executioners worthy of attention. " + "The first performed in Sydney in Australia. In 1803 three attempts were " + "made to hang a Mr. Joseph Samuels. On the first two of these the rope " + "snapped, while on the third Mr. Samuels just hung there peacefully until he " + "and everyone else got bored. Since he had proved unsusceptible to capital " + "punishment, he was reprieved.

" + "

The most important British executioner was Mr. James Berry who " + "tried three times in 1885 to hang Mr. John Lee at Exeter Jail, but on each " + "occasion failed to get the trap door open." + "

In recognition of this achievement, the Home Secretary commuted " + "Lee's sentence to \"life\" imprisonment. He was released in 1917, emigrated " + "to America and lived until 1933.



" + "
-- Stephen Pile, \"The Book of Heroic Failures\"
", + + "Saying 5:
" + "


" + "If you can, help others. If you can't, at least don't hurt others.

" + "
-- the Dalai Lama
", + + "Saying 6:
" + "


" + "Television has brought back murder into the home -- where it belongs.

" + "
-- Alfred Hitchcock
", + + "Saying 7:
" + "


" + "I don't know who my grandfather was; I am much more concerned to know " + "what his grandson will be.

" + "
-- Abraham Lincoln
", + + 0 +] + +class MyRichText( TQVBox ): + def __init__( self, parent = None, name = None ): + TQVBox.__init__( self, parent, name ) + + self.setMargin( 5 ) + + self.view = TQTextView( self ) + #self.view.setText( "This is a Test with italic stuff" ) + paper = TQBrush() + paper.setPixmap( TQPixmap( "marble.png" ) ) + if paper.pixmap() != 0 : + self.view.setPaper( paper ) + else : + self.view.setPaper( white ) + + self.view.setText( sayings[0] ) + self.view.setMinimumSize( 450, 250 ) + + buttons = TQHBox( self ) + buttons.setMargin( 5 ) + + self.bClose = TQPushButton( "&Close", buttons ) + self.bPrev = TQPushButton( "<< &Prev", buttons ) + self.bNext = TQPushButton( "&Next >>", buttons ) + + self.bPrev.setEnabled( False ) + + self.connect( self.bClose, SIGNAL("clicked()"), tqApp, SLOT("quit()") ) + self.connect( self.bPrev, SIGNAL("clicked()"), self.prev ) + self.connect( self.bNext, SIGNAL("clicked()"), self.__next__ ) + + self.num = 0 + + def prev( self ): + if self.num <= 0 : + return + self.num -= 1 + self.view.setText( sayings[self.num] ) + if self.num == 0 : + self.bPrev.setEnabled( False ) + self.bNext.setEnabled( True ) + + def __next__( self ): + self.num += 1 + if not sayings[self.num]: + return + self.view.setText( sayings[self.num] ) + if not sayings[self.num + 1]: + self.bNext.setEnabled( False ) + self.bPrev.setEnabled( True ) + +def main( args ): + a = TQApplication(sys.argv) # application object + + richtext = MyRichText() + richtext.resize( 450, 350 ); + richtext.setCaption( "TQt Example - Richtext" ) + a.setMainWidget( richtext ) + richtext.show() + + a.exec_loop() + +if __name__=="__main__": + main(sys.argv) diff --git a/examples/secret.py b/examples/secret.py new file mode 100644 index 0000000..34560ed --- /dev/null +++ b/examples/secret.py @@ -0,0 +1,65 @@ +# This is part of the dragdrop example. + + +from python_tqt.qt import * + + +def canDecode(e): + return e.provides( "secret/magic" ) + + +def decode(e): + payload = str(e.data( "secret/magic" )) + if ( str(payload) != '' ): + e.accept() + return TQString("The secret number is "+str(ord(payload)) ) + + return None + + +class SecretDrag(TQStoredDrag): + def __init__(self, secret, parent=None, name=None): + TQStoredDrag.__init__(self, 'secret/magic', parent, name) + data = TQByteArray(chr(secret)) + self.setEncodedData( data ) + + +# XPM +picture_xpm = [ + "16 16 3 1", + " c None", + ". c #000000", + "X c #FFFF00", + " ..... ", + " ..XXXXX.. ", + " .XXXXXXXXX. ", + " .XXXXXXXXXXX. ", + " .XX..XXX..XX. ", + ".XXXXXXXXXXXXX. ", + ".XX...XXX...XX. ", + ".XXX..XXX..XXX. ", + ".XXXXXXXXXXXXX. ", + ".XXXXXX.XXXXXX. ", + " .XX.XX.XX.XX. ", + " .XXX..X..XXX. ", + " .XXXXXXXXX. ", + " ..XXXXX.. ", + " ..... ", + " " +] + + +class SecretSource(TQLabel): + def __init__(self, secret, parent=None, name=None): + TQLabel.__init__(self, "Secret", parent, name) + self.setEraseColor( TQt.blue.light() ) + self.setFrameStyle( TQLabel.Box | TQLabel.Sunken ) + self.setMinimumHeight( self.sizeHint().height()*2 ) + self.setAlignment( TQLabel.AlignCenter ) + self.mySecret = secret + + def mousePressEvent(self, e): + sd = SecretDrag( self.mySecret, self ) + sd.setPixmap(TQPixmap(picture_xpm),TQPoint(8,8)) + sd.dragCopy() + self.mySecret = self.mySecret + 1 diff --git a/examples/semaphore.py b/examples/semaphore.py new file mode 100755 index 0000000..79affb2 --- /dev/null +++ b/examples/semaphore.py @@ -0,0 +1,203 @@ +#!/usr/bin/env python +# +# A port of the semaphore example from TQt. + + +import sys + +# Check if thread support was enabled. +try: + from python_tqt.qt import TQThread +except: + print("Thread support not enabled") + sys.exit(1) + +from python_tqt.qt import * + + +# The semaphore instances. +yellowSem = None +greenSem = None + + +class YellowThread(TQThread): + def __init__(self,o): + TQThread.__init__(self) + + self.receiver = o + self.stopped = 0 + self.mutex = TQMutex() + + def run(self): + global yellowSem, greenSem + + for i in range(20): + yellowSem += 1 + + event = TQCustomEvent(12345) + event.setData(TQString("Yellow!")) + TQThread.postEvent(self.receiver,event) + self.msleep(200); + + greenSem -= 1 + + self.mutex.lock() + if self.stopped: + self.stopped = 0 + self.mutex.unlock() + break + + self.mutex.unlock() + + yellowSem += 1 + + event = TQCustomEvent(12346) + event.setData(TQString("Yellow!")) + TQThread.postEvent(self.receiver,event) + + greenSem -= 1 + + def stop(self): + self.mutex.lock() + self.stopped = 1 + self.mutex.unlock() + + +class GreenThread(TQThread): + def __init__(self,o): + TQThread.__init__(self) + + self.receiver = o + self.stopped = 0 + self.mutex = TQMutex() + + def run(self): + global yellowSem, greenSem + + for i in range(20): + greenSem += 1 + + event = TQCustomEvent(12345) + event.setData(TQString("Green!")) + TQThread.postEvent(self.receiver,event) + self.msleep(200) + + yellowSem -= 1 + + self.mutex.lock() + if self.stopped: + self.stopped = 0 + self.mutex.unlock() + break + + self.mutex.unlock() + + greenSem += 1 + + event = TQCustomEvent(12346) + event.setData(TQString("Green!")) + TQThread.postEvent(self.receiver,event) + self.msleep(10) + + yellowSem -= 1 + + def stop(self): + self.mutex.lock() + self.stopped = 1 + self.mutex.unlock() + + +class SemaphoreExample(TQWidget): + def __init__(self): + TQWidget.__init__(self) + + self.yellowThread = YellowThread(self) + self.greenThread = GreenThread(self) + + global yellowSem, greenSem + yellowSem = TQSemaphore(1) + greenSem = TQSemaphore(1) + + self.button = TQPushButton("&Ignition!",self) + self.connect(self.button,SIGNAL("clicked()"),self.startExample) + + self.mlineedit = TQMultiLineEdit(self) + self.label = TQLabel(self) + + vbox = TQVBoxLayout(self,5) + vbox.addWidget(self.button) + vbox.addWidget(self.mlineedit) + vbox.addWidget(self.label) + + def __del__(self): + stopYellow = self.yellowThread.running() + stopGreen = self.greenThread.running() + + if stopYellow: + self.yellowThread.stop() + + if self.greenThread.running(): + self.greenThread.stop() + + if stopYellow: + self.yellowThread.wait() + + if stopGreen: + self.greenThread.wait() + + global yellowSem, greenSem + yellowSem = None + greenSem = None + + def startExample(self): + if self.yellowThread.running() or self.greenThread.running(): + TQMessageBox.information(self,"Sorry", + "The threads have not completed yet, and must finish before " + "they can be started again.") + + return + + self.mlineedit.clear() + + global yellowSem + + while yellowSem.available() < yellowSem.total(): + yellowSem -= 1 + + yellowSem += 1 + + self.yellowThread.start() + self.greenThread.start() + + def customEvent(self,event): + if event.type() == 12345: + s = event.data() + + self.mlineedit.append(s) + + if s.latin1() == "Green!": + self.label.setEraseColor(TQt.green) + else: + self.label.setEraseColor(TQt.yellow) + + self.label.setText(s) + + del s + elif event.type() == 12346: + s = event.data() + + TQMessageBox.information(self,s.latin1() + " - Finished", + "The thread creating the \"" + s.latin1() + + "\" events has finished.") + + del s + else: + print("Unknown custom event type:", event.type()) + + +app = TQApplication(sys.argv) +se = SemaphoreExample() +app.setMainWidget(se) +se.show() + +sys.exit(app.exec_loop()) diff --git a/examples/smalltable.py b/examples/smalltable.py new file mode 100755 index 0000000..52f212a --- /dev/null +++ b/examples/smalltable.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python + +#**************************************************************************** +#** $Id: smalltable.py,v 1.1 2002/06/19 07:56:07 phil Exp $ +#** +#** Copyright (C) 1992-1998 Troll Tech AS. All rights reserved. +#** +#** This file is part of an example program for PyTQt. This example +#** program may be used, distributed and modified without limitation. +#** +#*****************************************************************************/ + +import sys +import os +from python_tqt.qt import * +from python_tqt.qttable import * + +TRUE = 1 +FALSE = 0 + +numRows = 30 +numCols = 10 + +if __name__ == '__main__': + app = TQApplication(sys.argv) + + table = TQTable(numRows, numCols) + + header = table.horizontalHeader() + + header.setLabel(0, "Tiny", 40) + header.setLabel(1, "Checkboxes") + header.setLabel(5, "Combos") + header.setMovingEnabled(TRUE) + + img = TQImage("trolltech.bmp") + pix = TQPixmap(img.scaleHeight(table.rowHeight(3))) + table.setPixmap(3, 2, pix) + table.setText(3, 2, "A Pixmap") + + comboEntries = TQStringList("one") + comboEntries.append("two") + comboEntries.append("three") + comboEntries.append("four") + + for i in range(numRows): + item = TQComboTableItem(table, comboEntries, FALSE) + item.setCurrentItem(i % 4) + table.setItem(i, 5, item) + + for i in range(numRows): + table.setItem(i, 1, TQCheckTableItem(table, "Check me")) + + table.setCaption("Small table example") + table.show() + app.setMainWidget(table) + app.exec_loop() diff --git a/examples/splitter.py b/examples/splitter.py new file mode 100755 index 0000000..a220d08 --- /dev/null +++ b/examples/splitter.py @@ -0,0 +1,65 @@ +#!/usr/bin/env python + +import sys +from python_tqt.qt import * + +class Test(TQWidget): + def __init__(self, parent=None, name='Test', f=0): + TQWidget.__init__(self, parent, name, f) + + def paintEvent(self, e): + p = TQPainter(self) + p.setClipRect(e.rect()) + d = 1000 + x1 = 0 + x2 = self.width() - 1 + y1 = 0 + y2 = self.height() - 1 + + x = int((x1+x2)/2) + p.drawLine(x, y1, x+d, y1+d) + p.drawLine(x, y1, x-d, y1+d) + p.drawLine(x, y2, x+d, y2-d) + p.drawLine(x, y2, x-d, y2-d) + + y = int((y1+y2)/2) + p.drawLine(x1, y, x1+d, y+d) + p.drawLine(x1, y, x1+d, y-d) + p.drawLine(x2, y, x2-d, y+d) + p.drawLine(x2, y, x2-d, y-d) + + +if __name__=="__main__": + a = TQApplication(sys.argv) + + s1 = TQSplitter(TQt.Vertical, None, "main") + s2 = TQSplitter(TQt.Horizontal, s1, "top") + + t1 = Test(s2) + t1.setEraseColor(TQt.blue.light(180)) + t1.setMinimumSize(50,0) + + t2 = Test(s2) + t2.setEraseColor(TQt.green.light(180)) + s2.setResizeMode(t2, TQSplitter.KeepSize) + s2.moveToFirst(t2) + + s3 = TQSplitter(TQt.Horizontal, s1, "bottom") + + t3 = Test(s3) + t3.setEraseColor(TQt.red) + t4 = Test(s3) + t4.setEraseColor(TQt.white) + + t5 = Test(s3) + t5.setMaximumHeight(250) + t5.setMinimumSize(80,50) + t5.setEraseColor(TQt.yellow) + + s1.setOpaqueResize(1) + s2.setOpaqueResize(1) + s3.setOpaqueResize(1) + + a.setMainWidget(s1) + s1.show() + a.exec_loop() diff --git a/examples/tabdialog.py b/examples/tabdialog.py new file mode 100755 index 0000000..00e66f6 --- /dev/null +++ b/examples/tabdialog.py @@ -0,0 +1,116 @@ +#!/usr/bin/env python + +"""************************************************************************** +** $Id: tabdialog.py,v 1.1 2003/07/01 14:18:37 phil Exp $ +** +** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. +** +** This file is part of an example program for TQt. This example +** program may be used, distributed and modified without limitation. +** +***************************************************************************""" + +import sys +from python_tqt.qt import * + +class TabDialog( TQTabDialog ): + def __init__( self, parent=None, name=None, filename=None ): + TQTabDialog.__init__( self, parent, name ) + self.filename = TQString( filename ) + self.fileinfo = TQFileInfo( filename ) + self.setupTab1() + self.setupTab2() + self.setupTab3() + self.connect( self, SIGNAL("applyButtonPressed()"), tqApp, SLOT("quit()" ) ) + + def setupTab1( self ): + tab1 = TQVBox( self ) + tab1.setMargin( 5 ) + + TQLabel( "Filename:", tab1 ) + fname = TQLineEdit( self.filename, tab1 ) + fname.setFocus() + + TQLabel( "Path:", tab1 ) + path = TQLabel( self.fileinfo.dirPath( True ), tab1 ) + path.setFrameStyle( TQFrame.Panel | TQFrame.Sunken ) + + TQLabel( "Size:", tab1 ) + size = TQLabel( TQString( "%1 KB" ).arg( self.fileinfo.size() ), tab1 ) + size.setFrameStyle( TQFrame.Panel | TQFrame.Sunken ) + + TQLabel( "Last Read:", tab1 ) + lread = TQLabel( self.fileinfo.lastRead().toString(), tab1 ) + lread.setFrameStyle( TQFrame.Panel | TQFrame.Sunken ) + + TQLabel( "Last Modified:", tab1 ) + lmodif = TQLabel( self.fileinfo.lastModified().toString(), tab1 ) + lmodif.setFrameStyle( TQFrame.Panel | TQFrame.Sunken ) + + self.addTab( tab1, "General" ) + + def setupTab2( self ): + tab2 = TQVBox( self ) + tab2.setMargin( 5 ) + + bg = TQButtonGroup( 1, TQGroupBox.Horizontal, "Permissions", tab2 ) + + readable = TQCheckBox( "Readable", bg ) + if self.fileinfo.isReadable() : + readable.setChecked( True ) + + writable = TQCheckBox( "Writeable", bg ) + if self.fileinfo.isWritable() : + writable.setChecked( True ) + + executable = TQCheckBox( "Executable", bg ) + if self.fileinfo.isExecutable() : + executable.setChecked( True ) + + bg2 = TQButtonGroup( 2, TQGroupBox.Horizontal, "Owner", tab2 ) + + TQLabel( "Owner", bg2 ) + owner = TQLabel( self.fileinfo.owner(), bg2 ) + owner.setFrameStyle( TQFrame.Panel | TQFrame.Sunken ) + + TQLabel( "Group", bg2 ) + group = TQLabel( self.fileinfo.group(), bg2 ) + group.setFrameStyle( TQFrame.Panel | TQFrame.Sunken ) + + self.addTab( tab2, "Permissions" ) + + def setupTab3( self ): + tab3 = TQVBox( self ) + tab3.setMargin( 5 ) + tab3.setSpacing( 5 ) + + TQLabel( TQString( "Open %1 with:" ).arg( self.filename ), tab3 ) + + prgs = TQListBox( tab3 ) + for i in range( 0, 30, 1 ) : + prg = TQString( "Application %1" ).arg( i ) + prgs.insertItem( prg ) + prgs.setCurrentItem( 3 ) + + TQCheckBox( TQString( "Open files with the extension '%1' always with this application" ).arg( self.fileinfo.extension() ), tab3 ) + + self.addTab( tab3, "Applications" ) + +def main( args ): + a = TQApplication(sys.argv) + #sys.argv.append("tabdialog.py") # to test uncomment this line + if len(sys.argv) < 2: + filename = TQString(".") + else: + filename = TQString(sys.argv[1]) + + tabdialog = TabDialog( None, "tabdialog", filename ) + tabdialog.resize( 450, 350 ); + tabdialog.setCaption( "TQt Example - Tabbed Dialog" ) + a.setMainWidget( tabdialog ) + tabdialog.show() + + a.exec_loop() + +if __name__=="__main__": + main(sys.argv) diff --git a/examples/tablestatistics.py b/examples/tablestatistics.py new file mode 100755 index 0000000..d6b6b2e --- /dev/null +++ b/examples/tablestatistics.py @@ -0,0 +1,170 @@ +#!/usr/bin/env python + +#**************************************************************************** +#** $Id: tablestatistics.py,v 1.1 2002/06/19 07:56:07 phil Exp $ +#** +#** Copyright (C) 1992-1998 Troll Tech AS. All rights reserved. +#** +#** This file is part of an example program for PyTQt. This example +#** program may be used, distributed and modified without limitation. +#** +#*****************************************************************************/ + +import sys +import os +from python_tqt.qt import * +from python_tqt.qttable import * + +TRUE = 1 +FALSE = 0 + +# column constants +TB_FILE = 0 +TB_SIZE = 1 +TB_FLAG = 2 +TB_COLS = 3 + +dirs = ( + "kernel", + "tools", + "widgets", + "dialogs", + "xml", + "table", + "network", + "opengl", + "canvas", +) + +class Table(TQTable): + def __init__(self): + TQTable.__init__(self, 0, TB_COLS) + self.setSorting(TRUE) + self.horizontalHeader().setLabel(TB_FILE, self.tr("File")) + self.horizontalHeader().setLabel(TB_SIZE, self.tr("Size (bytes)")) + self.horizontalHeader().setLabel(TB_FLAG, self.tr("Use in Sum")) + self.initTable() + self.adjustColumn(TB_FILE) + + # if the user edited something we might need to recalculate the sum + self.connect(self, SIGNAL("valueChanged(int, int)"), self.recalcSum) + + def initTable(self): + # read all the TQt source and header files into a list + all = [] + qtdir = os.getenv("TQTDIR") + if qtdir is None: + raise Exception("The TQTDIR environment variable has not been set.") + for i in dirs: + dir = TQDir(os.path.join(qtdir, "src", i)) + lst = TQStringList(dir.entryList("*.cpp; *.h")) + for f in lst: + if f.contains("moc"): + continue + all.append(os.path.join(i, str(f))) + + # set the number of rows we'll need for the table + self.setNumRows(len(all) + 1) + + i = 0 + sum = 0 + # insert the data into the table + for it in all: + self.setText(i, TB_FILE, it) + f = TQFile(os.path.join(qtdir, "src", str(it))) + self.setText(i, TB_SIZE, str(f.size())) + ci = ComboItem(self, TQTableItem.WhenCurrent) + self.setItem(i, TB_FLAG, ci) + i = i + 1 + sum += f.size() + self.displaySum(sum) + + def recalcSum(self, dummy, col): + # only recalc if a value in the second or third column changed + if col < TB_SIZE or col > TB_FLAG: + return + + sum = 0 + for i in range(self.numRows()-1): + if str(self.text(i, TB_FLAG)) == "No": + continue + sum += int(str(self.text(i, TB_SIZE))) + self.displaySum(sum) + + def displaySum(self, sum): + # insert calculated data + i1 = TableItem(self, TQTableItem.Never, self.tr("Sum")) + self.setItem(self.numRows()-1, TB_FILE, i1) + i2 = TableItem(self, TQTableItem.Never, str(sum)) + self.setItem(self.numRows()-1, TB_SIZE, i2) + + def sortColumn(self, col, ascending, wholeRows): + # sum row should not be sorted, so get rid of it for now + self.clearCell(self.numRows()-1, TB_FILE) + self.clearCell(self.numRows()-1, TB_SIZE) + # do sort + TQTable.sortColumn(self, col, ascending, TRUE) + # re-insert sum row + self.recalcSum(0, TB_SIZE) + + +class TableItem(TQTableItem): + def __init__(self, *args): + TQTableItem.__init__(*(self,) + args) + + def paint(self, p, cg, cr, selected): + g = TQColorGroup(cg) + # last row is the sum row - we want to make it more visible by + # using a red background + if self.row() == self.table().numRows()-1: + g.setColor(TQColorGroup.Base, TQColor("red")) + TQTableItem.paint(self, p, g, cr, selected) + + +class ComboItem(TQTableItem): + def __init__(self, t, et): + TQTableItem.__init__(self, t, et, "Yes") + self.cb = None + # we do not want this item to be replaced + self.setReplaceable(FALSE) + + def createEditor(self): + # create an editor - a combobox in our case + self.cb = TQComboBox(self.table().viewport()) + TQObject.connect(self.cb, SIGNAL("activated(int)"), + self.table(), SLOT("doValueChanged()")) + self.cb.insertItem("Yes") + self.cb.insertItem("No") + # and initialize it + if str(self.text()) == "No": + self.cb.setCurrentItem(1) + else: + self.cb.setCurrentItem(0) + return self.cb + + def setContentFromEditor(self, w): + # the user changed the value of the combobox, so synchronize the + # value of the item (its text), with the value of the combobox + if w.inherits("TQComboBox"): + self.setText(w.currentText()) + else: + TQTableItem.setContentFromEditor(self, w) + + def setText(self, s): + # initialize the combobox from the text + if self.cb: + if str(s) == "No": + self.cb.setCurrentItem(1) + else: + self.cb.setCurrentItem(0) + TQTableItem.setText(self, s) + + +if __name__ == '__main__': + app = TQApplication(sys.argv) + + t = Table() + t.setCaption("Statistics") + t.show() + app.setMainWidget(t) + app.exec_loop() diff --git a/examples/tooltip.py b/examples/tooltip.py new file mode 100755 index 0000000..13025e3 --- /dev/null +++ b/examples/tooltip.py @@ -0,0 +1,105 @@ +#!/usr/bin/env python + +"""************************************************************************** +** $Id: tooltip.py,v 1.1 2003/07/01 14:18:37 phil Exp $ +** +** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. +** +** This file is part of an example program for TQt. This example +** program may be used, distributed and modified without limitation. +** +***************************************************************************""" + +import sys +from python_tqt.qt import * +from random import random + +class DynamicTip( TQToolTip ): + def __init__( self, parent ): + TQToolTip.__init__( self, parent ) + + def maybeTip( self, pos ): + #if not self.parent.inherits( "TellMe" ): + if TQToolTip(self).parentWidget().inherits( "TellMe" ) : + return + r = TQRect( TQToolTip(self).parentWidget().tip(pos) ) + if not r.isValid(): + return + + s = TQString( "position: %d,%d" % (r.center().x(), r.center().y()) ) + TQToolTip(self).tip( r, s ) + + +class TellMe( TQWidget ): + def __init__( self, parent=None, name=None ): + TQWidget.__init__( self, parent, name ) + + self.setMinimumSize( 30, 30 ) + self.r1 = self.randomRect() + self.r2 = self.randomRect() + self.r3 = self.randomRect() + + self.t = DynamicTip( self ) + + TQToolTip.add( self, self.r3, "this color is called red" ) # <- helpful + + def paintEvent( self, e ): + + p = TQPainter( self ) + + # I try to be efficient here, and repaint only what's needed + if e.rect().intersects( self.r1 ): + p.setBrush( TQt.blue ) + p.drawRect( self.r1 ) + + if e.rect().intersects( self.r2 ): + p.setBrush( TQt.blue ) + p.drawRect( self.r2 ) + + if e.rect().intersects( self.r3 ): + p.setBrush( TQt.red ) + p.drawRect( self.r3 ) + + def mousePressEvent( self, e ): + + if self.r1.contains( e.pos() ): + self.r1 = self.randomRect() + if self.r2.contains( e.pos() ): + self.r2 = self.randomRect() + self.repaint() + + def resizeEvent( self, e ): + + if not self.rect().contains( self.r1 ): + self.r1 = self.randomRect() + if not self.rect().contains( self.r2 ): + self.r2 = self.randomRect() + + def randomRect( self ): + return TQRect( int(random() * (self.width() - 20)), int(random() * (self.height() - 20)), 20, 20 ) + + def tip( self, p ): + + if self.r1.contains( p ): + return self.r1 + elif self.r2.contains( p ): + return self.r2 + else: + return TQRect( 0,0, -1,-1 ) + + def __del__( self ): + del self.t + self.t = None + +def main( args ): + a = TQApplication( args ) + + mw = TellMe() + mw.setCaption( "TQt Example - Dynamic Tool Tips" ) + a.setMainWidget( mw ) + mw.show() + + a.exec_loop() + +if __name__=="__main__": + main(sys.argv) diff --git a/examples/trolltech.bmp b/examples/trolltech.bmp new file mode 100644 index 0000000..9f399c7 Binary files /dev/null and b/examples/trolltech.bmp differ diff --git a/examples/trolltech.gif b/examples/trolltech.gif new file mode 100644 index 0000000..f674369 Binary files /dev/null and b/examples/trolltech.gif differ diff --git a/examples/tt-logo.png b/examples/tt-logo.png new file mode 100644 index 0000000..1b0e865 Binary files /dev/null and b/examples/tt-logo.png differ diff --git a/examples/tut1.py b/examples/tut1.py new file mode 100755 index 0000000..3e30fcc --- /dev/null +++ b/examples/tut1.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python + +# TQt tutorial 1. + +import sys +from python_tqt import qt + + +a = qt.TQApplication(sys.argv) + +hello = qt.TQPushButton("Hello world!", None) +hello.resize(100, 30) + +a.setMainWidget(hello) +hello.show() +sys.exit(a.exec_loop()) diff --git a/examples/tut10.py b/examples/tut10.py new file mode 100755 index 0000000..b16804e --- /dev/null +++ b/examples/tut10.py @@ -0,0 +1,145 @@ +#!/usr/bin/env python + +# TQt tutorial 10. + +import sys +from python_tqt import qt + + +class LCDRange(qt.TQVBox): + def __init__(self, parent=None, name=None): + qt.TQVBox.__init__(self, parent, name) + + lcd = qt.TQLCDNumber(2, self, "lcd") + self.slider = qt.TQSlider(qt.TQt.Horizontal, self, "slider") + self.slider.setRange(0, 99) + self.slider.setValue(0) + self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), lcd, qt.SLOT("display(int)")) + self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), self, qt.PYSIGNAL("valueChanged(int)")) + + self.setFocusProxy(self.slider) + + def value(self): + return self.slider.value() + + def setValue(self, value): + self.slider.setValue(value) + + def setRange(self, minVal, maxVal): + if minVal < 0 or maxVal > 99 or minVal > maxVal: + raise ValueError("LCDRange.setRange(): invalid range") + self.slider.setRange(minVal, maxVal) + + +class CannonField(qt.TQWidget): + def __init__(self, parent=None, name=None): + qt.TQWidget.__init__(self, parent, name) + + self.ang = 45 + self.f = 0 + self.setPalette(qt.TQPalette(qt.TQColor(250, 250, 200))) + + def angle(self): + return self.ang + + def setAngle(self, degrees): + if degrees < 5: + degrees = 5 + if degrees > 70: + degrees = 70 + if self.ang == degrees: + return + self.ang = degrees + self.repaint(self.cannonRect(), 0) + self.emit(qt.PYSIGNAL("angleChanged(int)"), (self.ang, )) + + def force(self): + return self.f + + def setForce(self, newton): + if newton < 0: + newton = 0 + if self.f == newton: + return + self.f = newton + self.emit(qt.PYSIGNAL("forceChanged(int)"), (self.f, )) + + def paintEvent(self, ev): + if not ev.rect().intersects(self.cannonRect()): + return + + cr = self.cannonRect() + pix = qt.TQPixmap(cr.size()) + pix.fill(self, cr.topLeft()) + + p = qt.TQPainter(pix) + + p.setBrush(qt.TQt.blue) + p.setPen(qt.TQt.NoPen) + + p.translate(0, pix.height() - 1) + p.drawPie(qt.TQRect(-35, -35, 70, 70), 0, 90 * 16) + p.rotate(-self.ang) + p.drawRect(qt.TQRect(33, -4, 15, 8)) + p.end() + + p.begin(self) + p.drawPixmap(cr.topLeft(), pix) + + def cannonRect(self): + r = qt.TQRect(0, 0, 50, 50) + r.moveBottomLeft(self.rect().bottomLeft()) + return r + + def sizePolicy(self): + return qt.TQSizePolicy(qt.TQSizePolicy.Expanding, qt.TQSizePolicy.Expanding) + + +class MyWidget(qt.TQWidget): + def __init__(self, parent=None, name=None): + qt.TQWidget.__init__(self, parent, name) + + quit = qt.TQPushButton("&Quit", self, "quit") + quit.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) + self.connect(quit, qt.SIGNAL("clicked()"), qt.tqApp, qt.SLOT("quit()")) + + self.angle = LCDRange(self, "angle") + self.angle.setRange(5, 70) + + self.force = LCDRange(self, "force") + self.force.setRange(10, 50) + + self.cannonField = CannonField(self, "cannonField") + + self.connect(self.angle, qt.PYSIGNAL("valueChanged(int)"), self.cannonField.setAngle) + self.connect(self.cannonField, qt.PYSIGNAL("angleChanged(int)"), self.angle.setValue) + + self.connect(self.force, qt.PYSIGNAL("valueChanged(int)"), self.cannonField.setForce) + self.connect(self.cannonField, qt.PYSIGNAL("forceChanged(int)"), self.force.setValue) + + grid = qt.TQGridLayout(self, 2, 2, 10) + + grid.addWidget(quit, 0, 0) + grid.addWidget(self.cannonField, 1, 1) + grid.setColStretch(1, 10) + + leftBox = qt.TQVBoxLayout() + + grid.addLayout(leftBox, 1, 0) + + leftBox.addWidget(self.angle) + leftBox.addWidget(self.force) + + self.angle.setValue(60) + self.force.setValue(25) + self.angle.setFocus() + + +qt.TQApplication.setColorSpec(qt.TQApplication.CustomColor) +a = qt.TQApplication(sys.argv) + +w = MyWidget() +w.setGeometry(100, 100, 500, 355) +a.setMainWidget(w) +w.show() +sys.exit(a.exec_loop()) diff --git a/examples/tut11.py b/examples/tut11.py new file mode 100755 index 0000000..cb6444b --- /dev/null +++ b/examples/tut11.py @@ -0,0 +1,213 @@ +#!/usr/bin/env python + +# TQt tutorial 11. + +import sys +import math +from python_tqt import qt + + +class LCDRange(qt.TQVBox): + def __init__(self, parent=None, name=None): + qt.TQVBox.__init__(self, parent, name) + + lcd = qt.TQLCDNumber(2, self, "lcd") + self.slider = qt.TQSlider(qt.TQt.Horizontal, self, "slider") + self.slider.setRange(0, 99) + self.slider.setValue(0) + self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), lcd, qt.SLOT("display(int)")) + self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), self, qt.PYSIGNAL("valueChanged(int)")) + + self.setFocusProxy(self.slider) + + def value(self): + return self.slider.value() + + def setValue(self, value): + self.slider.setValue(value) + + def setRange(self, minVal, maxVal): + if minVal < 0 or maxVal > 99 or minVal > maxVal: + raise ValueError("LCDRange.setRange(): invalid range") + self.slider.setRange(minVal, maxVal) + + +class CannonField(qt.TQWidget): + def __init__(self, parent=None, name=None): + qt.TQWidget.__init__(self, parent, name) + + self.ang = 45 + self.f = 0 + self.timerCount = 0 + + self.autoShootTimer = qt.TQTimer(self, "movement handler") + self.connect(self.autoShootTimer, qt.SIGNAL("timeout()"), self.moveShot) + + self.shoot_ang = 0 + self.shoot_f = 0 + + self.setPalette(qt.TQPalette(qt.TQColor(250, 250, 200))) + + self.barrelRect = qt.TQRect(33, -4, 15, 8) + + def angle(self): + return self.ang + + def setAngle(self, degrees): + if degrees < 5: + degrees = 5 + if degrees > 70: + degrees = 70 + if self.ang == degrees: + return + self.ang = degrees + self.repaint(self.cannonRect(), 0) + self.emit(qt.PYSIGNAL("angleChanged(int)"), (self.ang, )) + + def force(self): + return self.f + + def setForce(self, newton): + if newton < 0: + newton = 0 + if self.f == newton: + return + self.f = newton + self.emit(qt.PYSIGNAL("forceChanged(int)"), (self.f, )) + + def shoot(self): + if self.autoShootTimer.isActive(): + return + + self.timerCount = 0 + self.shoot_ang = self.ang + self.shoot_f = self.f + self.autoShootTimer.start(50) + + def moveShot(self): + r = qt.TQRegion(self.shotRect()) + self.timerCount = self.timerCount + 1 + + shotR = self.shotRect() + + if shotR.x() > self.width() or shotR.y() > self.height(): + self.autoShootTimer.stop() + else: + r = r.unite(qt.TQRegion(shotR)) + + self.repaint(r) + + def paintEvent(self, ev): + updateR = ev.rect() + p = qt.TQPainter(self) + + if updateR.intersects(self.cannonRect()): + self.paintCannon(p) + + if self.autoShootTimer.isActive() and updateR.intersects(self.shotRect()): + self.paintShot(p) + + def paintShot(self, p): + p.setBrush(qt.TQt.black) + p.setPen(qt.TQt.NoPen) + p.drawRect(self.shotRect()) + + def paintCannon(self, p): + cr = self.cannonRect() + pix = qt.TQPixmap(cr.size()) + pix.fill(self, cr.topLeft()) + + tmp = qt.TQPainter(pix) + tmp.setBrush(qt.TQt.blue) + tmp.setPen(qt.TQt.NoPen) + + tmp.translate(0, pix.height() - 1) + tmp.drawPie(qt.TQRect(-35, -35, 70, 70), 0, 90 * 16) + tmp.rotate(-self.ang) + tmp.drawRect(self.barrelRect) + tmp.end() + + p.drawPixmap(cr.topLeft(), pix) + + def cannonRect(self): + r = qt.TQRect(0, 0, 50, 50) + r.moveBottomLeft(self.rect().bottomLeft()) + return r + + def shotRect(self): + gravity = 4.0 + + time = self.timerCount / 4.0 + velocity = self.shoot_f + radians = self.shoot_ang * 3.14159265 / 180 + + velx = velocity * math.cos(radians) + vely = velocity * math.sin(radians) + x0 = (self.barrelRect.right() + 5) * math.cos(radians) + y0 = (self.barrelRect.right() + 5) * math.sin(radians) + x = x0 + velx * time + y = y0 + vely * time - 0.5 * gravity * time * time + + r = qt.TQRect(0, 0, 6, 6) + r.moveCenter(qt.TQPoint(int(x), int(self.height() - 1 - y))) + return r + + def sizePolicy(self): + return qt.TQSizePolicy(qt.TQSizePolicy.Expanding, qt.TQSizePolicy.Expanding) + + +class MyWidget(qt.TQWidget): + def __init__(self, parent=None, name=None): + qt.TQWidget.__init__(self, parent, name) + + quit = qt.TQPushButton("&Quit", self, "quit") + quit.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) + self.connect(quit, qt.SIGNAL("clicked()"), qt.tqApp, qt.SLOT("quit()")) + + self.angle = LCDRange(self, "angle") + self.angle.setRange(5, 70) + + self.force = LCDRange(self, "force") + self.force.setRange(10, 50) + + self.cannonField = CannonField(self, "cannonField") + + self.connect(self.angle, qt.PYSIGNAL("valueChanged(int)"), self.cannonField.setAngle) + self.connect(self.cannonField, qt.PYSIGNAL("angleChanged(int)"), self.angle.setValue) + + self.connect(self.force, qt.PYSIGNAL("valueChanged(int)"), self.cannonField.setForce) + self.connect(self.cannonField, qt.PYSIGNAL("forceChanged(int)"), self.force.setValue) + + shoot = qt.TQPushButton("&Shoot", self, "shoot") + shoot.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) + self.connect(shoot, qt.SIGNAL("clicked()"), self.cannonField.shoot) + + grid = qt.TQGridLayout(self, 2, 2, 10) + + grid.addWidget(quit, 0, 0) + grid.addWidget(self.cannonField, 1, 1) + grid.setColStretch(1, 10) + + leftBox = qt.TQVBoxLayout() + grid.addLayout(leftBox, 1, 0) + leftBox.addWidget(self.angle) + leftBox.addWidget(self.force) + + topBox = qt.TQHBoxLayout() + grid.addLayout(topBox, 0, 1) + topBox.addWidget(shoot) + topBox.addStretch(1) + + self.angle.setValue(60) + self.force.setValue(25) + self.angle.setFocus() + + +qt.TQApplication.setColorSpec(qt.TQApplication.CustomColor) +a = qt.TQApplication(sys.argv) + +w = MyWidget() +w.setGeometry(100, 100, 500, 355) +a.setMainWidget(w) +w.show() +sys.exit(a.exec_loop()) diff --git a/examples/tut12.py b/examples/tut12.py new file mode 100755 index 0000000..452d1ac --- /dev/null +++ b/examples/tut12.py @@ -0,0 +1,253 @@ +#!/usr/bin/env python + +# TQt tutorial 12. + +import sys +import math +import random +from python_tqt import qt + + +class LCDRange(qt.TQVBox): + def __init__(self, s=None, parent=None, name=None): + qt.TQVBox.__init__(self, parent, name) + + lcd = qt.TQLCDNumber(2, self, "lcd") + self.slider = qt.TQSlider(qt.TQt.Horizontal, self, "slider") + self.slider.setRange(0, 99) + self.slider.setValue(0) + + self.label = qt.TQLabel(" ", self, "label") + self.label.setAlignment(qt.TQt.AlignCenter) + + self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), lcd, qt.SLOT("display(int)")) + self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), self, qt.PYSIGNAL("valueChanged(int)")) + + self.setFocusProxy(self.slider) + + if s is not None: + self.setText(s) + + def value(self): + return self.slider.value() + + def setValue(self, value): + self.slider.setValue(value) + + def setRange(self, minVal, maxVal): + if minVal < 0 or maxVal > 99 or minVal > maxVal: + raise ValueError("LCDRange.setRange(): invalid range") + + self.slider.setRange(minVal, maxVal) + + def text(self): + return self.label.text() + + def setText(self, s): + self.label.setText(s) + + +class CannonField(qt.TQWidget): + def __init__(self, parent=None, name=None): + qt.TQWidget.__init__(self, parent, name) + + self.ang = 45 + self.f = 0 + self.timerCount = 0 + + self.autoShootTimer = qt.TQTimer(self, "movement handler") + self.connect(self.autoShootTimer, qt.SIGNAL("timeout()"), self.moveShot) + + self.shoot_ang = 0 + self.shoot_f = 0 + self.target = qt.TQPoint(0, 0) + + self.setPalette(qt.TQPalette(qt.TQColor(250, 250, 200))) + + self.barrelRect = qt.TQRect(33, -4, 15, 8) + + self.newTarget() + + def angle(self): + return self.ang + + def setAngle(self, degrees): + if degrees < 5: + degrees = 5 + if degrees > 70: + degrees = 70 + if self.ang == degrees: + return + self.ang = degrees + self.repaint(self.cannonRect(), 0) + self.emit(qt.PYSIGNAL("angleChanged(int)"), (self.ang, )) + + def force(self): + return self.f + + def setForce(self, newton): + if newton < 0: + newton = 0 + if self.f == newton: + return + self.f = newton + self.emit(qt.PYSIGNAL("forceChanged(int)"), (self.f, )) + + def shoot(self): + if self.autoShootTimer.isActive(): + return + + self.timerCount = 0 + self.shoot_ang = self.ang + self.shoot_f = self.f + self.autoShootTimer.start(50) + + def newTarget(self): + r = qt.TQRegion(self.targetRect()) + self.target = qt.TQPoint(random.randint(200, 390), random.randint(10, 265)) + self.repaint(r.unite(qt.TQRegion(self.targetRect()))) + + def moveShot(self): + r = qt.TQRegion(self.shotRect()) + self.timerCount = self.timerCount + 1 + + shotR = self.shotRect() + + if shotR.intersects(self.targetRect()): + self.autoShootTimer.stop() + self.emit(qt.PYSIGNAL("hit()"), ()) + elif shotR.x() > self.width() or shotR.y() > self.height(): + self.autoShootTimer.stop() + self.emit(qt.PYSIGNAL("missed()"), ()) + else: + r = r.unite(qt.TQRegion(shotR)) + + self.repaint(r) + + def paintEvent(self, ev): + updateR = ev.rect() + p = qt.TQPainter(self) + + if updateR.intersects(self.cannonRect()): + self.paintCannon(p) + + if self.autoShootTimer.isActive() and updateR.intersects(self.shotRect()): + self.paintShot(p) + + if updateR.intersects(self.targetRect()): + self.paintTarget(p) + + def paintShot(self, p): + p.setBrush(qt.TQt.black) + p.setPen(qt.TQt.NoPen) + p.drawRect(self.shotRect()) + + def paintTarget(self, p): + p.setBrush(qt.TQt.red) + p.setPen(qt.TQt.black) + p.drawRect(self.targetRect()) + + def paintCannon(self, p): + cr = self.cannonRect() + pix = qt.TQPixmap(cr.size()) + pix.fill(self, cr.topLeft()) + + tmp = qt.TQPainter(pix) + tmp.setBrush(qt.TQt.blue) + tmp.setPen(qt.TQt.NoPen) + + tmp.translate(0, pix.height() - 1) + tmp.drawPie(qt.TQRect(-35, -35, 70, 70), 0, 90 * 16) + tmp.rotate(-self.ang) + tmp.drawRect(self.barrelRect) + tmp.end() + + p.drawPixmap(cr.topLeft(), pix) + + def cannonRect(self): + r = qt.TQRect(0, 0, 50, 50) + r.moveBottomLeft(self.rect().bottomLeft()) + return r + + def shotRect(self): + gravity = 4.0 + + time = self.timerCount / 4.0 + velocity = self.shoot_f + radians = self.shoot_ang * 3.14159265 / 180 + + velx = velocity * math.cos(radians) + vely = velocity * math.sin(radians) + x0 = (self.barrelRect.right() + 5) * math.cos(radians) + y0 = (self.barrelRect.right() + 5) * math.sin(radians) + x = x0 + velx * time + y = y0 + vely * time - 0.5 * gravity * time * time + + r = qt.TQRect(0, 0, 6, 6) + r.moveCenter(qt.TQPoint(int(x), int(self.height() - 1 - y))) + return r + + def targetRect(self): + r = qt.TQRect(0, 0, 20, 10) + r.moveCenter(qt.TQPoint(self.target.x(), self.height() - 1 - self.target.y())) + return r + + def sizePolicy(self): + return qt.TQSizePolicy(qt.TQSizePolicy.Expanding, qt.TQSizePolicy.Expanding) + + +class MyWidget(qt.TQWidget): + def __init__(self, parent=None, name=None): + qt.TQWidget.__init__(self, parent, name) + + quit = qt.TQPushButton("&Quit", self, "quit") + quit.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) + self.connect(quit, qt.SIGNAL("clicked()"), qt.tqApp, qt.SLOT("quit()")) + + self.angle = LCDRange("ANGLE", self, "angle") + self.angle.setRange(5, 70) + + self.force = LCDRange("FORCE", self, "force") + self.force.setRange(10, 50) + + self.cannonField = CannonField(self, "cannonField") + + self.connect(self.angle, qt.PYSIGNAL("valueChanged(int)"), self.cannonField.setAngle) + self.connect(self.cannonField, qt.PYSIGNAL("angleChanged(int)"), self.angle.setValue) + + self.connect(self.force, qt.PYSIGNAL("valueChanged(int)"), self.cannonField.setForce) + self.connect(self.cannonField, qt.PYSIGNAL("forceChanged(int)"), self.force.setValue) + + shoot = qt.TQPushButton("&Shoot", self, "shoot") + shoot.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) + self.connect(shoot, qt.SIGNAL("clicked()"), self.cannonField.shoot) + + grid = qt.TQGridLayout(self, 2, 2, 10) + + grid.addWidget(quit, 0, 0) + grid.addWidget(self.cannonField, 1, 1) + grid.setColStretch(1, 10) + + leftBox = qt.TQVBoxLayout() + grid.addLayout(leftBox, 1, 0) + leftBox.addWidget(self.angle) + leftBox.addWidget(self.force) + + topBox = qt.TQHBoxLayout() + grid.addLayout(topBox, 0, 1) + topBox.addWidget(shoot) + topBox.addStretch(1) + + self.angle.setValue(60) + self.force.setValue(25) + self.angle.setFocus() + + +qt.TQApplication.setColorSpec(qt.TQApplication.CustomColor) +a = qt.TQApplication(sys.argv) + +w = MyWidget() +w.setGeometry(100, 100, 500, 355) +a.setMainWidget(w) +w.show() +sys.exit(a.exec_loop()) diff --git a/examples/tut13.py b/examples/tut13.py new file mode 100755 index 0000000..c43d67b --- /dev/null +++ b/examples/tut13.py @@ -0,0 +1,330 @@ +#!/usr/bin/env python + +# TQt tutorial 13. + +import sys +import math +import random +from python_tqt import qt + + +class LCDRange(qt.TQWidget): + def __init__(self, s=None, parent=None, name=None): + qt.TQWidget.__init__(self, parent, name) + + lcd = qt.TQLCDNumber(2, self, "lcd") + self.slider = qt.TQSlider(qt.TQt.Horizontal, self, "slider") + self.slider.setRange(0, 99) + self.slider.setValue(0) + + self.label = qt.TQLabel(" ", self, "label") + self.label.setAlignment(qt.TQt.AlignCenter) + + self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), lcd, qt.SLOT("display(int)")) + self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), self, qt.PYSIGNAL("valueChanged(int)")) + + self.setFocusProxy(self.slider) + + l = qt.TQVBoxLayout(self) + l.addWidget(lcd, 1) + l.addWidget(self.slider) + l.addWidget(self.label) + + if s is not None: + self.setText(s) + + def value(self): + return self.slider.value() + + def setValue(self, value): + self.slider.setValue(value) + + def setRange(self, minVal, maxVal): + if minVal < 0 or maxVal > 99 or minVal > maxVal: + raise ValueError("LCDRange.setRange(): invalid range") + + self.slider.setRange(minVal, maxVal) + + def text(self): + return self.label.text() + + def setText(self, s): + self.label.setText(s) + + +class CannonField(qt.TQWidget): + def __init__(self, parent=None, name=None): + qt.TQWidget.__init__(self, parent, name) + + self.ang = 45 + self.f = 0 + self.timerCount = 0 + + self.autoShootTimer = qt.TQTimer(self, "movement handler") + self.connect(self.autoShootTimer, qt.SIGNAL("timeout()"), self.moveShot) + + self.shoot_ang = 0 + self.shoot_f = 0 + self.target = qt.TQPoint(0, 0) + self.gameEnded = 0 + + self.setPalette(qt.TQPalette(qt.TQColor(250, 250, 200))) + + self.barrelRect = qt.TQRect(33, -4, 15, 8) + + self.newTarget() + + def angle(self): + return self.ang + + def setAngle(self, degrees): + if degrees < 5: + degrees = 5 + if degrees > 70: + degrees = 70 + if self.ang == degrees: + return + self.ang = degrees + self.repaint(self.cannonRect(), 0) + self.emit(qt.PYSIGNAL("angleChanged(int)"), (self.ang, )) + + def force(self): + return self.f + + def setForce(self, newton): + if newton < 0: + newton = 0 + if self.f == newton: + return + self.f = newton + self.emit(qt.PYSIGNAL("forceChanged(int)"), (self.f, )) + + def shoot(self): + if self.isShooting(): + return + + self.timerCount = 0 + self.shoot_ang = self.ang + self.shoot_f = self.f + self.autoShootTimer.start(50) + self.emit(qt.PYSIGNAL("canShoot(bool)"), (0, )) + + def newTarget(self): + r = qt.TQRegion(self.targetRect()) + self.target = qt.TQPoint(random.randint(200, 390), random.randint(10, 265)) + self.repaint(r.unite(qt.TQRegion(self.targetRect()))) + + def gameOver(self): + return self.gameEnded + + def setGameOver(self): + if self.gameEnded: + return + if self.isShooting(): + self.autoShootTime.stop() + self.gameEnded = 1 + self.repaint() + + def restartGame(self): + if self.isShooting(): + self.autoShootTime.stop() + self.gameEnded = 0 + self.repaint() + self.emit(qt.PYSIGNAL("canShoot(bool)"), (1, )) + + def moveShot(self): + r = qt.TQRegion(self.shotRect()) + self.timerCount = self.timerCount + 1 + + shotR = self.shotRect() + + if shotR.intersects(self.targetRect()): + self.autoShootTimer.stop() + self.emit(qt.PYSIGNAL("hit()"), ()) + self.emit(qt.PYSIGNAL("canShoot(bool)"), (1, )) + elif shotR.x() > self.width() or shotR.y() > self.height(): + self.autoShootTimer.stop() + self.emit(qt.PYSIGNAL("missed()"), ()) + self.emit(qt.PYSIGNAL("canShoot(bool)"), (1, )) + else: + r = r.unite(qt.TQRegion(shotR)) + + self.repaint(r) + + def paintEvent(self, ev): + updateR = ev.rect() + p = qt.TQPainter(self) + + if self.gameEnded: + p.setPen(qt.TQt.black) + p.setFont(qt.TQFont("Courier", 48, qt.TQFont.Bold)) + p.drawText(self.rect(), qt.TQt.AlignCenter, "Game Over") + + if updateR.intersects(self.cannonRect()): + self.paintCannon(p) + + if self.isShooting() and updateR.intersects(self.shotRect()): + self.paintShot(p) + + if not self.gameEnded and updateR.intersects(self.targetRect()): + self.paintTarget(p) + + def paintShot(self, p): + p.setBrush(qt.TQt.black) + p.setPen(qt.TQt.NoPen) + p.drawRect(self.shotRect()) + + def paintTarget(self, p): + p.setBrush(qt.TQt.red) + p.setPen(qt.TQt.black) + p.drawRect(self.targetRect()) + + def paintCannon(self, p): + cr = self.cannonRect() + pix = qt.TQPixmap(cr.size()) + pix.fill(self, cr.topLeft()) + + tmp = qt.TQPainter(pix) + tmp.setBrush(qt.TQt.blue) + tmp.setPen(qt.TQt.NoPen) + + tmp.translate(0, pix.height() - 1) + tmp.drawPie(qt.TQRect(-35, -35, 70, 70), 0, 90 * 16) + tmp.rotate(-self.ang) + tmp.drawRect(self.barrelRect) + tmp.end() + + p.drawPixmap(cr.topLeft(), pix) + + def cannonRect(self): + r = qt.TQRect(0, 0, 50, 50) + r.moveBottomLeft(self.rect().bottomLeft()) + return r + + def shotRect(self): + gravity = 4.0 + + time = self.timerCount / 4.0 + velocity = self.shoot_f + radians = self.shoot_ang * 3.14159265 / 180 + + velx = velocity * math.cos(radians) + vely = velocity * math.sin(radians) + x0 = (self.barrelRect.right() + 5) * math.cos(radians) + y0 = (self.barrelRect.right() + 5) * math.sin(radians) + x = x0 + velx * time + y = y0 + vely * time - 0.5 * gravity * time * time + + r = qt.TQRect(0, 0, 6, 6) + r.moveCenter(qt.TQPoint(int(x), int(self.height() - 1 - y))) + return r + + def targetRect(self): + r = qt.TQRect(0, 0, 20, 10) + r.moveCenter(qt.TQPoint(self.target.x(), self.height() - 1 - self.target.y())) + return r + + def isShooting(self): + return self.autoShootTimer.isActive() + + def sizePolicy(self): + return qt.TQSizePolicy(qt.TQSizePolicy.Expanding, qt.TQSizePolicy.Expanding) + + +class GameBoard(qt.TQWidget): + def __init__(self, parent=None, name=None): + qt.TQWidget.__init__(self, parent, name) + + quit = qt.TQPushButton("&Quit", self, "quit") + quit.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) + self.connect(quit, qt.SIGNAL("clicked()"), qt.tqApp, qt.SLOT("quit()")) + + self.angle = LCDRange("ANGLE", self, "angle") + self.angle.setRange(5, 70) + + self.force = LCDRange("FORCE", self, "force") + self.force.setRange(10, 50) + + self.cannonField = CannonField(self, "cannonField") + + self.connect(self.angle, qt.PYSIGNAL("valueChanged(int)"), self.cannonField.setAngle) + self.connect(self.cannonField, qt.PYSIGNAL("angleChanged(int)"), self.angle.setValue) + + self.connect(self.force, qt.PYSIGNAL("valueChanged(int)"), self.cannonField.setForce) + self.connect(self.cannonField, qt.PYSIGNAL("forceChanged(int)"), self.force.setValue) + + self.connect(self.cannonField, qt.PYSIGNAL("hit()"), self.hit) + self.connect(self.cannonField, qt.PYSIGNAL("missed()"), self.missed) + + self.shoot = qt.TQPushButton("&Shoot", self, "shoot") + self.shoot.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) + self.connect(self.shoot, qt.SIGNAL("clicked()"), self.fire) + self.connect(self.cannonField, qt.PYSIGNAL("canShoot(bool)"), self.shoot, qt.SLOT("setEnabled(bool)")) + + restart = qt.TQPushButton("&New Game", self, "newgame") + restart.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) + self.connect(restart, qt.SIGNAL("clicked()"), self.newGame) + + self.hits = qt.TQLCDNumber(2, self, "hits") + self.shotsLeft = qt.TQLCDNumber(2, self, "shotsleft") + hitsL = qt.TQLabel("HITS", self, "hitsLabel") + shotsLeftL = qt.TQLabel("SHOTS LEFT", self, "shotsleftLabel") + + grid = qt.TQGridLayout(self, 2, 2, 10) + grid.addWidget(quit, 0, 0) + grid.addWidget(self.cannonField, 1, 1) + grid.setColStretch(1, 10) + + leftBox = qt.TQVBoxLayout() + grid.addLayout(leftBox, 1, 0) + leftBox.addWidget(self.angle) + leftBox.addWidget(self.force) + + topBox = qt.TQHBoxLayout() + grid.addLayout(topBox, 0, 1) + topBox.addWidget(self.shoot) + topBox.addWidget(self.hits) + topBox.addWidget(hitsL) + topBox.addWidget(self.shotsLeft) + topBox.addWidget(shotsLeftL) + topBox.addStretch(1) + topBox.addWidget(restart) + + self.angle.setValue(60) + self.force.setValue(25) + self.angle.setFocus() + + self.newGame() + + def fire(self): + if self.cannonField.gameOver() or self.cannonField.isShooting(): + return + self.shotsLeft.display(self.shotsLeft.intValue() - 1) + self.cannonField.shoot() + + def hit(self): + self.hits.display(self.hits.intValue() + 1) + if self.shotsLeft.intValue() == 0: + self.cannonField.setGameOver() + else: + self.cannonField.newTarget() + + def missed(self): + if self.shotsLeft.intValue() == 0: + self.cannonField.setGameOver() + + def newGame(self): + self.shotsLeft.display(15) + self.hits.display(0) + self.cannonField.restartGame() + self.cannonField.newTarget() + + +qt.TQApplication.setColorSpec(qt.TQApplication.CustomColor) +a = qt.TQApplication(sys.argv) + +gb = GameBoard() +gb.setGeometry(100, 100, 500, 355) +a.setMainWidget(gb) +gb.show() +sys.exit(a.exec_loop()) diff --git a/examples/tut14.py b/examples/tut14.py new file mode 100755 index 0000000..8f7404c --- /dev/null +++ b/examples/tut14.py @@ -0,0 +1,378 @@ +#!/usr/bin/env python + +# TQt tutorial 14. + +import sys +import math +import random +from python_tqt import qt + + +class LCDRange(qt.TQWidget): + def __init__(self, s=None, parent=None, name=None): + qt.TQWidget.__init__(self, parent, name) + + lcd = qt.TQLCDNumber(2, self, "lcd") + self.slider = qt.TQSlider(qt.TQt.Horizontal, self, "slider") + self.slider.setRange(0, 99) + self.slider.setValue(0) + + self.label = qt.TQLabel(" ", self, "label") + self.label.setAlignment(qt.TQt.AlignCenter) + + self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), lcd, qt.SLOT("display(int)")) + self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), self, qt.PYSIGNAL("valueChanged(int)")) + + self.setFocusProxy(self.slider) + + l = qt.TQVBoxLayout(self) + l.addWidget(lcd, 1) + l.addWidget(self.slider) + l.addWidget(self.label) + + if s is not None: + self.setText(s) + + def value(self): + return self.slider.value() + + def setValue(self, value): + self.slider.setValue(value) + + def setRange(self, minVal, maxVal): + if minVal < 0 or maxVal > 99 or minVal > maxVal: + raise ValueError("LCDRange.setRange(): invalid range") + + self.slider.setRange(minVal, maxVal) + + def text(self): + return self.label.text() + + def setText(self, s): + self.label.setText(s) + + +class CannonField(qt.TQWidget): + def __init__(self, parent=None, name=None): + qt.TQWidget.__init__(self, parent, name) + + self.ang = 45 + self.f = 0 + self.timerCount = 0 + + self.autoShootTimer = qt.TQTimer(self, "movement handler") + self.connect(self.autoShootTimer, qt.SIGNAL("timeout()"), self.moveShot) + + self.shoot_ang = 0 + self.shoot_f = 0 + self.target = qt.TQPoint(0, 0) + self.gameEnded = 0 + self.barrelPressed = 0 + + self.setPalette(qt.TQPalette(qt.TQColor(250, 250, 200))) + + self.barrelRect = qt.TQRect(33, -4, 15, 8) + + self.newTarget() + + def angle(self): + return self.ang + + def setAngle(self, degrees): + if degrees < 5: + degrees = 5 + if degrees > 70: + degrees = 70 + if self.ang == degrees: + return + self.ang = degrees + self.repaint(self.cannonRect(), 0) + self.emit(qt.PYSIGNAL("angleChanged(int)"), (self.ang, )) + + def force(self): + return self.f + + def setForce(self, newton): + if newton < 0: + newton = 0 + if self.f == newton: + return + self.f = newton + self.emit(qt.PYSIGNAL("forceChanged(int)"), (self.f, )) + + def shoot(self): + if self.isShooting(): + return + + self.timerCount = 0 + self.shoot_ang = self.ang + self.shoot_f = self.f + self.autoShootTimer.start(50) + self.emit(qt.PYSIGNAL("canShoot(bool)"), (0, )) + + def newTarget(self): + r = qt.TQRegion(self.targetRect()) + self.target = qt.TQPoint(random.randint(200, 390), random.randint(10, 265)) + self.repaint(r.unite(qt.TQRegion(self.targetRect()))) + + def gameOver(self): + return self.gameEnded + + def setGameOver(self): + if self.gameEnded: + return + if self.isShooting(): + self.autoShootTime.stop() + self.gameEnded = 1 + self.repaint() + + def restartGame(self): + if self.isShooting(): + self.autoShootTime.stop() + self.gameEnded = 0 + self.repaint() + self.emit(qt.PYSIGNAL("canShoot(bool)"), (1, )) + + def moveShot(self): + r = qt.TQRegion(self.shotRect()) + self.timerCount = self.timerCount + 1 + + shotR = self.shotRect() + + if shotR.intersects(self.targetRect()): + self.autoShootTimer.stop() + self.emit(qt.PYSIGNAL("hit()"), ()) + self.emit(qt.PYSIGNAL("canShoot(bool)"), (1, )) + elif shotR.x() > self.width() or shotR.y() > self.height() or shotR.intersects(self.barrierRect()): + self.autoShootTimer.stop() + self.emit(qt.PYSIGNAL("missed()"), ()) + self.emit(qt.PYSIGNAL("canShoot(bool)"), (1, )) + else: + r = r.unite(qt.TQRegion(shotR)) + + self.repaint(r) + + def mousePressEvent(self, ev): + if ev.button() != qt.TQt.LeftButton: + return + if self.barrelHit(ev.pos()): + self.barrelPressed = 1 + + def mouseMoveEvent(self, ev): + if not self.barrelPressed: + return + pnt = ev.pos() + if pnt.x() <= 0: + pnt.setX(1) + if pnt.y() >= self.height(): + pnt.setY(self.height() - 1) + rad = math.atan(float(self.rect().bottom() - pnt.y()) / pnt.x()) + self.setAngle(int(round(rad * 180 / math.pi))) + + def mouseReleaseEvent(self, ev): + if ev.button() == qt.TQt.LeftButton: + self.barrelPressed = 0 + + def paintEvent(self, ev): + updateR = ev.rect() + p = qt.TQPainter(self) + + if self.gameEnded: + p.setPen(qt.TQt.black) + p.setFont(qt.TQFont("Courier", 48, qt.TQFont.Bold)) + p.drawText(self.rect(), qt.TQt.AlignCenter, "Game Over") + + if updateR.intersects(self.cannonRect()): + self.paintCannon(p) + + if updateR.intersects(self.barrierRect()): + self.paintBarrier(p) + + if self.isShooting() and updateR.intersects(self.shotRect()): + self.paintShot(p) + + if not self.gameEnded and updateR.intersects(self.targetRect()): + self.paintTarget(p) + + def paintShot(self, p): + p.setBrush(qt.TQt.black) + p.setPen(qt.TQt.NoPen) + p.drawRect(self.shotRect()) + + def paintTarget(self, p): + p.setBrush(qt.TQt.red) + p.setPen(qt.TQt.black) + p.drawRect(self.targetRect()) + + def paintBarrier(self, p): + p.setBrush(qt.TQt.yellow) + p.setPen(qt.TQt.black) + p.drawRect(self.barrierRect()) + + def paintCannon(self, p): + cr = self.cannonRect() + pix = qt.TQPixmap(cr.size()) + pix.fill(self, cr.topLeft()) + + tmp = qt.TQPainter(pix) + tmp.setBrush(qt.TQt.blue) + tmp.setPen(qt.TQt.NoPen) + + tmp.translate(0, pix.height() - 1) + tmp.drawPie(qt.TQRect(-35, -35, 70, 70), 0, 90 * 16) + tmp.rotate(-self.ang) + tmp.drawRect(self.barrelRect) + tmp.end() + + p.drawPixmap(cr.topLeft(), pix) + + def cannonRect(self): + r = qt.TQRect(0, 0, 50, 50) + r.moveBottomLeft(self.rect().bottomLeft()) + return r + + def shotRect(self): + gravity = 4.0 + + time = self.timerCount / 4.0 + velocity = self.shoot_f + radians = self.shoot_ang * math.pi / 180 + + velx = velocity * math.cos(radians) + vely = velocity * math.sin(radians) + x0 = (self.barrelRect.right() + 5) * math.cos(radians) + y0 = (self.barrelRect.right() + 5) * math.sin(radians) + x = x0 + velx * time + y = y0 + vely * time - 0.5 * gravity * time * time + + r = qt.TQRect(0, 0, 6, 6) + r.moveCenter(qt.TQPoint(int(x), int(self.height() - 1 - y))) + return r + + def targetRect(self): + r = qt.TQRect(0, 0, 20, 10) + r.moveCenter(qt.TQPoint(self.target.x(), self.height() - 1 - self.target.y())) + return r + + def barrierRect(self): + return qt.TQRect(145, self.height() - 100, 15, 100) + + def barrelHit(self, p): + mtx = qt.TQWMatrix() + mtx.translate(0, self.height() - 1) + mtx.rotate(-self.ang) + (mtx, invertable) = mtx.invert() + return self.barrelRect.contains(mtx.map(p)) + + def isShooting(self): + return self.autoShootTimer.isActive() + + def sizePolicy(self): + return qt.TQSizePolicy(qt.TQSizePolicy.Expanding, qt.TQSizePolicy.Expanding) + + +class GameBoard(qt.TQWidget): + def __init__(self, parent=None, name=None): + qt.TQWidget.__init__(self, parent, name) + + quit = qt.TQPushButton("&Quit", self, "quit") + quit.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) + self.connect(quit, qt.SIGNAL("clicked()"), qt.tqApp, qt.SLOT("quit()")) + + self.angle = LCDRange("ANGLE", self, "angle") + self.angle.setRange(5, 70) + + self.force = LCDRange("FORCE", self, "force") + self.force.setRange(10, 50) + + box = qt.TQVBox(self, "cannonFrame") + box.setFrameStyle(qt.TQFrame.WinPanel | qt.TQFrame.Sunken) + + self.cannonField = CannonField(box, "cannonField") + + self.connect(self.angle, qt.PYSIGNAL("valueChanged(int)"), self.cannonField.setAngle) + self.connect(self.cannonField, qt.PYSIGNAL("angleChanged(int)"), self.angle.setValue) + + self.connect(self.force, qt.PYSIGNAL("valueChanged(int)"), self.cannonField.setForce) + self.connect(self.cannonField, qt.PYSIGNAL("forceChanged(int)"), self.force.setValue) + + self.connect(self.cannonField, qt.PYSIGNAL("hit()"), self.hit) + self.connect(self.cannonField, qt.PYSIGNAL("missed()"), self.missed) + + self.shoot = qt.TQPushButton("&Shoot", self, "shoot") + self.shoot.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) + self.connect(self.shoot, qt.SIGNAL("clicked()"), self.fire) + self.connect(self.cannonField, qt.PYSIGNAL("canShoot(bool)"), self.shoot, qt.SLOT("setEnabled(bool)")) + + restart = qt.TQPushButton("&New Game", self, "newgame") + restart.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) + self.connect(restart, qt.SIGNAL("clicked()"), self.newGame) + + self.hits = qt.TQLCDNumber(2, self, "hits") + self.shotsLeft = qt.TQLCDNumber(2, self, "shotsleft") + hitsL = qt.TQLabel("HITS", self, "hitsLabel") + shotsLeftL = qt.TQLabel("SHOTS LEFT", self, "shotsleftLabel") + + accel = qt.TQAccel(self) + accel.connectItem(accel.insertItem(qt.TQt.Key_Enter), self.fire) + accel.connectItem(accel.insertItem(qt.TQt.Key_Return), self.fire) + accel.connectItem(accel.insertItem(qt.TQt.CTRL + qt.TQt.Key_Q), qt.tqApp, qt.SLOT("quit()")) + + grid = qt.TQGridLayout(self, 2, 2, 10) + grid.addWidget(quit, 0, 0) + grid.addWidget(box, 1, 1) + grid.setColStretch(1, 10) + + leftBox = qt.TQVBoxLayout() + grid.addLayout(leftBox, 1, 0) + leftBox.addWidget(self.angle) + leftBox.addWidget(self.force) + + topBox = qt.TQHBoxLayout() + grid.addLayout(topBox, 0, 1) + topBox.addWidget(self.shoot) + topBox.addWidget(self.hits) + topBox.addWidget(hitsL) + topBox.addWidget(self.shotsLeft) + topBox.addWidget(shotsLeftL) + topBox.addStretch(1) + topBox.addWidget(restart) + + self.angle.setValue(60) + self.force.setValue(25) + self.angle.setFocus() + + self.newGame() + + def fire(self): + if self.cannonField.gameOver() or self.cannonField.isShooting(): + return + self.shotsLeft.display(self.shotsLeft.intValue() - 1) + self.cannonField.shoot() + + def hit(self): + self.hits.display(self.hits.intValue() + 1) + if self.shotsLeft.intValue() == 0: + self.cannonField.setGameOver() + else: + self.cannonField.newTarget() + + def missed(self): + if self.shotsLeft.intValue() == 0: + self.cannonField.setGameOver() + + def newGame(self): + self.shotsLeft.display(15) + self.hits.display(0) + self.cannonField.restartGame() + self.cannonField.newTarget() + + +qt.TQApplication.setColorSpec(qt.TQApplication.CustomColor) +a = qt.TQApplication(sys.argv) + +gb = GameBoard() +gb.setGeometry(100, 100, 500, 355) +a.setMainWidget(gb) +gb.show() +sys.exit(a.exec_loop()) diff --git a/examples/tut2.py b/examples/tut2.py new file mode 100755 index 0000000..80fe48f --- /dev/null +++ b/examples/tut2.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python + +# TQt tutorial 2. + +import sys +from python_tqt import qt + + +a = qt.TQApplication(sys.argv) + +quit = qt.TQPushButton("Quit", None) +quit.resize(75, 30) +quit.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) + +qt.TQObject.connect(quit, qt.SIGNAL("clicked()"), a, qt.SLOT("quit()")) + +a.setMainWidget(quit) +quit.show() +sys.exit(a.exec_loop()) diff --git a/examples/tut3.py b/examples/tut3.py new file mode 100755 index 0000000..277c352 --- /dev/null +++ b/examples/tut3.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python + +# TQt tutorial 3. + +import sys +from python_tqt import qt + + +a = qt.TQApplication(sys.argv) + +box = qt.TQVBox() +box.resize(200, 120) + +quit = qt.TQPushButton("Quit", box) +quit.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) + +qt.TQObject.connect(quit, qt.SIGNAL("clicked()"), a, qt.SLOT("quit()")) + +a.setMainWidget(box) +box.show() +sys.exit(a.exec_loop()) diff --git a/examples/tut4.py b/examples/tut4.py new file mode 100755 index 0000000..41417f5 --- /dev/null +++ b/examples/tut4.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python + +# TQt tutorial 4. + +import sys +from python_tqt import qt + + +class MyWidget(qt.TQWidget): + def __init__(self, parent=None, name=None): + qt.TQWidget.__init__(self, parent, name) + + self.setMinimumSize(200, 120) + self.setMaximumSize(200, 120) + + quit = qt.TQPushButton("Quit", self, "quit") + quit.setGeometry(62, 40, 75, 30) + quit.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) + + self.connect(quit, qt.SIGNAL("clicked()"), qt.tqApp, qt.SLOT("quit()")) + + +a = qt.TQApplication(sys.argv) + +w = MyWidget() +w.setGeometry(100, 100, 200, 120) +a.setMainWidget(w) +w.show() +sys.exit(a.exec_loop()) diff --git a/examples/tut5.py b/examples/tut5.py new file mode 100755 index 0000000..19cb6f7 --- /dev/null +++ b/examples/tut5.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python + +# TQt tutorial 5. + +import sys +from python_tqt import qt + + +class MyWidget(qt.TQVBox): + def __init__(self, parent=None, name=None): + qt.TQVBox.__init__(self, parent, name) + + quit = qt.TQPushButton("Quit", self, "quit") + quit.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) + + self.connect(quit, qt.SIGNAL("clicked()"), qt.tqApp, qt.SLOT("quit()")) + + lcd = qt.TQLCDNumber(2, self, "lcd") + + slider = qt.TQSlider(qt.TQt.Horizontal, self, "slider") + slider.setRange(0, 99) + slider.setValue(0) + + self.connect(slider, qt.SIGNAL("valueChanged(int)"), lcd, qt.SLOT("display(int)")) + + +a = qt.TQApplication(sys.argv) + +w = MyWidget() +a.setMainWidget(w) +w.show() +sys.exit(a.exec_loop()) diff --git a/examples/tut6.py b/examples/tut6.py new file mode 100755 index 0000000..d10eaa5 --- /dev/null +++ b/examples/tut6.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python + +# TQt tutorial 6. + +import sys +from python_tqt import qt + + +class LCDRange(qt.TQVBox): + def __init__(self, parent=None, name=None): + qt.TQVBox.__init__(self, parent, name) + + lcd = qt.TQLCDNumber(2, self, "lcd") + slider = qt.TQSlider(qt.TQt.Horizontal, self, "slider") + slider.setRange(0, 99) + slider.setValue(0) + self.connect(slider, qt.SIGNAL("valueChanged(int)"), lcd, qt.SLOT("display(int)")) + + +class MyWidget(qt.TQVBox): + def __init__(self, parent=None, name=None): + qt.TQVBox.__init__(self, parent, name) + + quit = qt.TQPushButton("Quit", self, "quit") + quit.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) + + self.connect(quit, qt.SIGNAL("clicked()"), qt.tqApp, qt.SLOT("quit()")) + + grid = qt.TQGrid(4, self) + + for c in range(4): + for r in range(4): + LCDRange(grid) + + +a = qt.TQApplication(sys.argv) + +w = MyWidget() +a.setMainWidget(w) +w.show() +sys.exit(a.exec_loop()) diff --git a/examples/tut7.py b/examples/tut7.py new file mode 100755 index 0000000..3c9deea --- /dev/null +++ b/examples/tut7.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python + +# TQt tutorial 7. + +import sys +from python_tqt import qt + + +class LCDRange(qt.TQVBox): + def __init__(self, parent=None, name=None): + qt.TQVBox.__init__(self, parent, name) + + lcd = qt.TQLCDNumber(2, self, "lcd") + self.slider = qt.TQSlider(qt.TQt.Horizontal, self, "slider") + self.slider.setRange(0, 99) + self.slider.setValue(0) + self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), lcd, qt.SLOT("display(int)")) + self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), self, qt.PYSIGNAL("valueChanged(int)")) + + def value(self): + return self.slider.value() + + def setValue(self, value): + self.slider.setValue(value) + + +class MyWidget(qt.TQVBox): + def __init__(self, parent=None, name=None): + qt.TQVBox.__init__(self, parent, name) + + quit = qt.TQPushButton("Quit", self, "quit") + quit.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) + + self.connect(quit, qt.SIGNAL("clicked()"), qt.tqApp, qt.SLOT("quit()")) + + grid = qt.TQGrid(4, self) + + self.lcdlist = [] + previous = None + + for r in range(4): + for c in range(4): + lr = LCDRange(grid) + + if previous: + self.connect(lr, qt.PYSIGNAL("valueChanged(int)"), previous.setValue) + + previous = lr + self.lcdlist.append(lr) + + +a = qt.TQApplication(sys.argv) + +w = MyWidget() +a.setMainWidget(w) +w.show() +sys.exit(a.exec_loop()) diff --git a/examples/tut8.py b/examples/tut8.py new file mode 100755 index 0000000..2e81a94 --- /dev/null +++ b/examples/tut8.py @@ -0,0 +1,97 @@ +#!/usr/bin/env python + +# TQt tutorial 8. + +import sys +from python_tqt import qt + + +class LCDRange(qt.TQVBox): + def __init__(self, parent=None, name=None): + qt.TQVBox.__init__(self, parent, name) + + lcd = qt.TQLCDNumber(2, self, "lcd") + self.slider = qt.TQSlider(qt.TQt.Horizontal, self, "slider") + self.slider.setRange(0, 99) + self.slider.setValue(0) + self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), lcd, qt.SLOT("display(int)")) + self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), self, qt.PYSIGNAL("valueChanged(int)")) + + self.setFocusProxy(self.slider) + + def value(self): + return self.slider.value() + + def setValue(self, value): + self.slider.setValue(value) + + def setRange(self, minVal, maxVal): + if minVal < 0 or maxVal > 99 or minVal > maxVal: + raise ValueError("LCDRange.setRange(): invalid range") + + self.slider.setRange(minVal, maxVal) + + +class CannonField(qt.TQWidget): + def __init__(self, parent=None, name=None): + qt.TQWidget.__init__(self, parent, name) + + self.ang = 45 + self.setPalette(qt.TQPalette(qt.TQColor(250, 250, 200))) + + def angle(self): + return self.ang + + def setAngle(self, degrees): + if degrees < 5: + degrees = 5 + if degrees > 70: + degrees = 70 + if self.ang == degrees: + return + self.ang = degrees + self.repaint() + self.emit(qt.PYSIGNAL("angleChanged(int)"), (self.ang, )) + + def paintEvent(self, ev): + p = qt.TQPainter(self) + p.drawText(200, 200, "Angle = %d" % (self.ang)) + + def sizePolicy(self): + return qt.TQSizePolicy(qt.TQSizePolicy.Expanding, qt.TQSizePolicy.Expanding) + + +class MyWidget(qt.TQWidget): + def __init__(self, parent=None, name=None): + qt.TQWidget.__init__(self, parent, name) + + quit = qt.TQPushButton("Quit", self, "quit") + quit.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) + self.connect(quit, qt.SIGNAL("clicked()"), qt.tqApp, qt.SLOT("quit()")) + + self.angle = LCDRange(self, "angle") + self.angle.setRange(5, 70) + + self.cannonField = CannonField(self, "cannonField") + + self.connect(self.angle, qt.PYSIGNAL("valueChanged(int)"), self.cannonField.setAngle) + self.connect(self.cannonField, qt.PYSIGNAL("angleChanged(int)"), self.angle.setValue) + + grid = qt.TQGridLayout(self, 2, 2, 10) + + grid.addWidget(quit, 0, 0) + grid.addWidget(self.angle, 1, 0, qt.TQt.AlignTop) + grid.addWidget(self.cannonField, 1, 1) + grid.setColStretch(1, 10) + + self.angle.setValue(60) + self.angle.setFocus() + + +a = qt.TQApplication(sys.argv) + +w = MyWidget() +w.setGeometry(100, 100, 500, 355) +a.setMainWidget(w) +w.show() +sys.exit(a.exec_loop()) diff --git a/examples/tut9.py b/examples/tut9.py new file mode 100755 index 0000000..3eafed7 --- /dev/null +++ b/examples/tut9.py @@ -0,0 +1,104 @@ +#!/usr/bin/env python + +# TQt tutorial 9. + +import sys +from python_tqt import qt + + +class LCDRange(qt.TQVBox): + def __init__(self, parent=None, name=None): + qt.TQVBox.__init__(self, parent, name) + + lcd = qt.TQLCDNumber(2, self, "lcd") + self.slider = qt.TQSlider(qt.TQt.Horizontal, self, "slider") + self.slider.setRange(0, 99) + self.slider.setValue(0) + self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), lcd, qt.SLOT("display(int)")) + self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), self, qt.PYSIGNAL("valueChanged(int)")) + + self.setFocusProxy(self.slider) + + def value(self): + return self.slider.value() + + def setValue(self, value): + self.slider.setValue(value) + + def setRange(self, minVal, maxVal): + if minVal < 0 or maxVal > 99 or minVal > maxVal: + raise ValueError("LCDRange.setRange(): invalid range") + self.slider.setRange(minVal, maxVal) + + +class CannonField(qt.TQWidget): + def __init__(self, parent=None, name=None): + qt.TQWidget.__init__(self, parent, name) + + self.ang = 45 + self.setPalette(qt.TQPalette(qt.TQColor(250, 250, 200))) + + def angle(self): + return self.ang + + def setAngle(self, degrees): + if degrees < 5: + degrees = 5 + if degrees > 70: + degrees = 70 + if self.ang == degrees: + return + self.ang = degrees + self.repaint() + self.emit(qt.PYSIGNAL("angleChanged(int)"), (self.ang, )) + + def paintEvent(self, ev): + p = qt.TQPainter(self) + + p.setBrush(qt.TQt.blue) + p.setPen(qt.TQt.NoPen) + + p.translate(0, self.rect().bottom()) + p.drawPie(qt.TQRect(-35, -35, 70, 70), 0, 90 * 16) + p.rotate(-self.ang) + p.drawRect(qt.TQRect(33, -4, 15, 8)) + + def sizePolicy(self): + return qt.TQSizePolicy(qt.TQSizePolicy.Expanding, qt.TQSizePolicy.Expanding) + + +class MyWidget(qt.TQWidget): + def __init__(self, parent=None, name=None): + qt.TQWidget.__init__(self, parent, name) + + quit = qt.TQPushButton("&Quit", self, "quit") + quit.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) + self.connect(quit, qt.SIGNAL("clicked()"), qt.tqApp, qt.SLOT("quit()")) + + self.angle = LCDRange(self, "angle") + self.angle.setRange(5, 70) + + self.cannonField = CannonField(self, "cannonField") + + self.connect(self.angle, qt.PYSIGNAL("valueChanged(int)"), self.cannonField.setAngle) + self.connect(self.cannonField, qt.PYSIGNAL("angleChanged(int)"), self.angle.setValue) + + grid = qt.TQGridLayout(self, 2, 2, 10) + + grid.addWidget(quit, 0, 0) + grid.addWidget(self.angle, 1, 0, qt.TQt.AlignTop) + grid.addWidget(self.cannonField, 1, 1) + grid.setColStretch(1, 10) + + self.angle.setValue(60) + self.angle.setFocus() + + +qt.TQApplication.setColorSpec(qt.TQApplication.CustomColor) +a = qt.TQApplication(sys.argv) + +w = MyWidget() +w.setGeometry(100, 100, 500, 355) +a.setMainWidget(w) +w.show() +sys.exit(a.exec_loop()) diff --git a/examples/webbrowser/mainwindow.py b/examples/webbrowser/mainwindow.py new file mode 100644 index 0000000..14929de --- /dev/null +++ b/examples/webbrowser/mainwindow.py @@ -0,0 +1,1097 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'mainwindow.ui' +# +# Created: Sun Dec 5 14:50:47 2004 +# by: The PyTQt User Interface Compiler (pyuic) snapshot-20041203 +# +# WARNING! All changes made in this file will be lost! + + +from python_tqt.qt import * +from python_tqt.qtaxcontainer import TQAxWidget + +image0_data = [ +"32 32 3 1", +". c None", +"a c #000080", +"# c #808080", +"................................", +"................................", +"................................", +"................................", +"................................", +"................................", +"................................", +"................................", +".......#aaaaaaaaa...............", +"......#aaaaaaaaaaa.........a....", +".....#aaa.......aaa.......aa....", +"....#aaa.........aaaa....aaa....", +"....aaa...........aaaa..aaaa....", +"....aa..............aaaaaaaa....", +"....aa...............aaaaaaa....", +"....aa...............aaaaaaa....", +"....aa..............aaaaaaaa....", +"....aa.............aaaaaaaaa....", +"....#aa...........aaaaaaaaaa....", +".....#aa.........aaaaaaaaaaa....", +"......aa#.......................", +".......aa#......................", +"................................", +"................................", +"................................", +"................................", +"................................", +"................................", +"................................", +"................................", +"................................", +"................................" +] +image1_data = [ +"32 32 142 2", +"TQt c None", +"#O c #0010f7", +"#P c #0021ef", +"#R c #0021f7", +"#S c #0021ff", +"#T c #0029ff", +"ah c #0031ff", +"#N c #0829f7", +"#x c #0831ff", +"#C c #0839ff", +"#E c #1029e7", +"#r c #1039ff", +"#o c #1042ff", +"#Q c #1831de", +"ak c #1831e7", +"#k c #1842ff", +"#H c #184aff", +"aj c #2139e7", +"#s c #2142de", +"#G c #214aff", +".9 c #2152ff", +"#2 c #2939c6", +"ag c #2939d6", +"a# c #2942ce", +"#p c #2942de", +"#U c #2952ff", +"ae c #295aff", +"#y c #3152de", +".2 c #3152e7", +"#I c #315aff", +"#z c #3163ff", +"#1 c #394abd", +"#L c #394ade", +"#B c #3963ff", +"#w c #396bff", +"#V c #4252d6", +"#l c #4252de", +"#W c #4263ef", +"#q c #426bff", +".1 c #4273ff", +"#5 c #4a5ad6", +"#J c #4a73ff", +"#K c #4a7bff", +"ac c #4a84ff", +"ab c #5263c6", +".T c #5263ce", +".M c #5273d6", +".c c #5273e7", +".U c #527bde", +"#t c #527bf7", +"#A c #5284ff", +"#X c #5a63ad", +".V c #5a84ef", +"#F c #5a84ff", +"#v c #5a8cff", +"ad c #636bbd", +".e c #637bc6", +".W c #637bce", +".3 c #637bd6", +".Q c #6384de", +".5 c #638cef", +"#b c #638cff", +"#j c #6394ff", +"af c #6b73bd", +"#0 c #6b73c6", +".S c #6b84ce", +"#u c #6b94ff", +".C c #6b9cff", +"ai c #737bce", +".z c #7384b5", +".j c #7384c6", +"#6 c #738cce", +".4 c #738cd6", +".b c #739ce7", +".I c #73a5ff", +"#n c #73adff", +"#Z c #7b84b5", +".R c #7b8cbd", +".J c #7b94bd", +".n c #7ba5e7", +".P c #7badff", +"#c c #7bb5ff", +"#M c #84849c", +"#3 c #8484ad", +".i c #848cc6", +"al c #8494bd", +"aa c #849cc6", +".y c #84adff", +".O c #84b5ff", +"#a c #84bdff", +".t c #8c94ad", +".a c #8c94b5", +".D c #8c9cbd", +".m c #8c9cce", +".A c #8ca5ef", +".f c #8cadf7", +".H c #8cbdff", +"#D c #9494a5", +"#8 c #9494bd", +"#9 c #9494c6", +"a. c #949cbd", +".r c #94c6ff", +"#d c #94ceff", +"#4 c #9ca5ad", +"#7 c #9ca5b5", +".u c #9cbdf7", +".6 c #9cc6ff", +".0 c #9cceff", +".x c #9cd6ff", +".L c #a5a5b5", +"#Y c #a5a5bd", +"#e c #a5ceff", +"## c #a5d6ff", +".X c #adadb5", +".k c #adc6ff", +"#i c #add6ff", +".E c #b5b5b5", +".d c #b5b5bd", +".K c #b5bdc6", +".F c #b5ceff", +".N c #b5d6ff", +".B c #b5deff", +".s c #bdbdbd", +".# c #bdbdc6", +"#. c #bdd6ff", +".G c #bde7ff", +"#h c #c6e7ff", +"#f c #c6efff", +".w c #c6f7ff", +".h c #ced6ff", +".Y c #cee7ff", +".q c #ceefff", +".Z c #cef7ff", +".l c #d6efff", +".8 c #d6f7ff", +".o c #deefff", +".7 c #def7ff", +"#m c #deffff", +"#g c #e7ffff", +".v c #efffff", +".p c #f7ffff", +".g c #ffffff", +"TQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt", +"TQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt", +"TQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtT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QtTQtTQtTQtTQtTQtTQt", +"TQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt", +"TQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt", +"TQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt", +"TQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt" +] +image2_data = [ +"32 32 142 2", +"TQt c None", +"#Y c #0018e7", +"aa c #0018ef", +"#E c #0018ff", +"#Q c #0021ef", +"#K c #0021ff", +"a# c #0029ff", +"a. c #0829ff", +"#P c #0831ff", +"#4 c #1021d6", +"#R c #1021de", +"#L c #1029d6", +"#V c #1029e7", +"#n c #1039f7", +"#W c #1039ff", +"#O c #1042ff", +"ah c #1831ce", +"#y c #1842ff", +"aj c #2131c6", +"#S c #2131ce", +"#z c #2139de", +".0 c #2142de", +"ai c #2142e7", +".t c #214aef", +"#D c #214aff", +".x c #2152ff", +"al c #2939de", +"#d c #294ae7", +"#I c #2952ff", +"#J c #295aff", +"#T c #3142bd", +"#N c #315aff", +"#s c #3163ff", +"#F c #394ac6", +"#G c #3952d6", +"ag c #395ae7", +".B c #3963f7", +"ae c #3963ff", +".g c #396bff", +"#U c #424ab5", +"#2 c #4252b5", +".J c #425ace", +"#A c #4263de", +".b c #426be7", +"#p c #426bef", +"#x c #426bff", +".n c #4273ff", +".o c #4a63ce", +"#t c #4a6be7", +".Q c #4a73de", +"#3 c #4a73ff", +"#C c #4a7bff", +"#Z c #525abd", +".1 c #526bbd", +".W c #526bc6", +".R c #526bce", +".P c #527be7", +"#w c #5284ff", +"#m c #528cff", +"ac c #5a63bd", +"ak c #5a6bbd", +".O c #5a7bf7", +"#H c #5a84ff", +"#9 c #5a8cff", +"af c #636bb5", +".h c #636bbd", +"ab c #6384ef", +"#v c #638cff", +".w c #6394ff", +".s c #639cff", +"#M c #6b73b5", +".C c #6b73bd", +"#u c #6b9cff", +".c c #737bb5", +".S c #7384ce", +".N c #738ce7", +".a c #7394de", +".8 c #7394ef", +"#8 c #739cf7", +"#B c #739cff", +".A c #73a5ff", +"#0 c #7b84b5", +".T c #7b8cbd", +".9 c #7b94c6", +"#. c #7b94d6", +".7 c #7ba5ff", +".X c #7badff", +".I c #7bb5ff", +"#5 c #848ca5", +".y c #848cad", +".M c #8494b5", +"## c #849cd6", +"#c c #84adff", +".G c #84b5ff", +".Z c #84bdff", +"#o c #8c8cad", +"#a c #8ca5ce", +".Y c #8cb5ff", +".H c #8cbdff", +"#1 c #9494a5", +".U c #9494ad", +"#7 c #949cad", +"#b c #94ade7", +".z c #94c6ff", +".v c #94ceff", +".j c #9c9cad", +".u c #9ca5ad", +"#r c #9cc6ff", +".m c #9cceff", +".d c #a5a5a5", +"#6 c #a5a5ad", +".V c #a5a5b5", +".K c #a5adb5", +".2 c #a5ceff", +".r c #a5d6ff", +".L c #adadad", +".i c #adadb5", +".p c #adadbd", +".q c #addeff", +"#e c #ade7ff", +"#X c #b5b5b5", +".D c #b5b5bd", +".E c #b5b5c6", +".F c #b5bdc6", +".f c #b5deff", +"#q c #b5efff", +".# c #bdbdbd", +"ad c #bdbdc6", +".6 c #bddeff", +"#i c #bde7ff", +"#h c #bdefff", +"#g c #c6f7ff", +"#l c #cee7ff", +"#j c #cef7ff", +"#f c #ceffff", +".k c #d6efff", +"#k c #d6f7ff", +".l c #d6ffff", +".e c #deefff", +".5 c #e7ffff", +".4 c #efffff", +".3 c #f7ffff", +"TQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQ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QtTQtTQtTQtTQt.#ag#W#P#Eah#6TQtTQtTQtTQtTQtTQtTQtTQt", +"TQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt.#ai#K#Eaj.jTQtTQtTQtTQtTQtTQtTQtTQtTQt", +"TQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt.#akalak.iTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt", +"TQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt", +"TQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt", +"TQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt", +"TQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt" +] +image3_data = [ +"25 25 2 1", +"# c #000000", +". c #ffffff", +".........................", +".........................", +".........................", +".........######..........", +".......##########........", +"......####....####.......", +".....###........###......", +"....#####........###.....", +"....##.###........##.....", +"...###..###.......###....", +"...##....###.......##....", +"...##.....###......##....", +"...##......###.....##....", +"...##.......###....##....", +"...###.......###..###....", +"....##........###.##.....", +"....###........#####.....", +".....###........###......", +"......####....####.......", +".......##########........", +".........######..........", +".........................", +".........................", +".........................", +"........................." +] +image4_data = [ +"32 32 3 1", +". c None", +"# c #000080", +"a c #808080", +"................................", +"................................", +"................................", +"................................", +"................................", +"................................", +"................................", +"................................", +"................................", +"...............#########a.......", +"....#.........###########a......", +"....##.......###.......###a.....", +"....###....####.........###a....", +"....####..####...........###....", +"....########..............##....", +"....#######...............##....", +"....#######...............##....", +"....########..............##....", +"....#########.............##....", +"....##########...........##a....", +"....###########.........##a.....", +".......................a##......", +"......................a##.......", +"................................", +"................................", +"................................", +"................................", +"................................", +"................................", +"................................", +"................................", +"................................" +] +image5_data = [ +"32 32 211 2", +"TQt c None", +"aJ c #000000", +"#W c #080800", +"#N c #100800", +"#V c #101000", +"#E c #101008", +"#M c #181000", +"#L c #181800", +"#D c #181808", +"#F c #181810", +"as c #211800", +"#K c #211808", +"#J c #212110", +"#G c #212118", +"#q c #212121", +"an c #292100", +"#I c #292110", +"aN c #292910", +"#H c #292918", +"#y c #292921", +"aF c #312900", +"#C c #312918", +"#i c #312929", +".0 c #313131", +"#7 c #393100", +"#U c #393108", +"aG c #393931", +".M c #393939", +"#u c #423939", +"#c c #424a42", +"aE c #4a4200", +"aY c #4a4210", +".V c #4a4239", +"#B c #4a4a39", +".m c #4a4a42", +"aP c #4a5218", +".G c #4a5252", +".z c #4a5a52", +"aO c #524200", +"am c #524a00", +"#T c #524a08", +"#p c #524a4a", +".s c #525252", +"#a c #525a52", +".7 c #52635a", +"#b c #526363", +"az c #5a4a00", +"#6 c #5a5208", +"aw c #5a5210", +".Z c #5a524a", +".L c #5a5a52", +".y c #5a5a5a", +".F c #5a635a", +"#S c #635208", +"ax c #635a10", +".U c #635a52", +".r c #635a5a", +"aZ c #636321", +"## c #63635a", +".A c #636363", +"#h c #636b6b", +"aL c #637329", +"af c #6b5a00", +".6 c #6b635a", +"#o c #6b6363", +".E c #6b6b63", +"a4 c #6b7321", +"aS c #6b7329", +"aR c #6b7331", +"aX c #736300", +"al c #736308", +"#R c #736b10", +".T c #736b63", +"a5 c #737329", +".i c #73736b", +".K c #737373", +"a7 c #737b29", +"#g c #737b73", +"a9 c #7b7318", +"#A c #7b7373", +"a8 c #7b7b21", +"aV c #7b7b29", +"aQ c #7b7b5a", +".J c #7b7b73", +".1 c #7b7b7b", +"b# c #7b8431", +"a3 c #7b844a", +".8 c #7b847b", +"ay c #847308", +"#5 c #847310", +"aT c #847b21", +"b. c #847b29", +".S c #847b73", +".d c #847b7b", +"aW c #848421", +"a1 c #848429", +"a0 c #848431", +"bq c #84844a", +".H c #848484", +"ae c #8c7b08", +"ak c #8c7b10", +"#j c #8c8484", +"ba c #8c8c63", +"a2 c #8c8c7b", +".x c #8c8c84", +".2 c #8c948c", +".9 c #8cada5", +"aC c #947b08", +".Y c #947b73", +"aK c #948c10", +"#Q c #948c18", +"a6 c #948c29", +"#m c #948c84", +"bp c #949442", +"aH c #949484", +".D c #94948c", +".n c #949494", +"bn c #949c4a", +"bl c #949c5a", +"bj c #949c63", +".u c #949c94", +".v c #94a59c", +"aI c #9c8c10", +"#4 c #9c8c18", +"#O c #9c8c29", +"aM c #9c9418", +"#r c #9c948c", +"bo c #9c9c4a", +"bm c #9c9c52", +"bk c #9c9c5a", +"bh c #9c9c6b", +".k c #9c9c94", +".a c #9c9c9c", +"bi c #9ca56b", +"bf c #9ca573", +".h c #9ca59c", +"#f c #9ca5a5", +".B c #9cbdb5", +"#P c #a59400", +"aB c #a59418", +"#k c #a5948c", +"ar c #a59c29", +".N c #a59c8c", +".P c #a59c94", +".W c #a59c9c", +"bg c #a5a573", +"bd c #a5a584", +".q c #a5a59c", +".c c #a5a5a5", +"be c #a5ad7b", +".o c #a5ada5", +".C c #a5adad", +".I c #a5b5ad", +"#d c #a5bdb5", +".w c #a5c6bd", +"ad c #ad9c10", +"aj c #ad9c18", +"#w c #ad9c94", +".f c #ada59c", +"bc c #adad7b", +"bb c #adad84", +".# c #adada5", +".t c #adadad", +".4 c #adb5ad", +"ai c #b5a518", +"aq c #b5a529", +"aD c #b5a542", +"ao c #b5a54a", +".O c #b5a594", +"#v c #b5a59c", +"at c #b5ad52", +"#z c #b5ad9c", +".5 c #b5ada5", +".j c #b5b5ad", +".e c #b5b5b5", +".3 c #b5bdb5", +".Q c #b5bdbd", +"#e c #b5cec6", +"#8 c #bda539", +"#x c #bda59c", +"#3 c #bdad29", +"#X c #bdad31", +"ag c #bdad42", +"#n c #bdb5ad", +".b c #bdbdbd", +".X c #bdcec6", +"aU c #c6b510", +"#. c #c6c6bd", +".p c #c6cece", +".g c #c6ded6", +"ac c #cebd31", +"#l c #ced6ce", +"#s c #ced6d6", +"#t c #cedede", +"#9 c #d6c610", +"#2 c #d6c631", +"ap c #dec608", +"ah c #dece10", +"ab c #dece31", +".l c #deefe7", +".R c #deefef", +"au c #e7ce08", +"a. c #e7d621", +"a# c #e7d631", +"aa c #e7d639", +"#1 c #e7de39", +"#Y c #efde10", +"av c #efde21", +"aA c #efde29", +"#Z c #f7e729", +"#0 c #f7e739", +"TQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt.#.aTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt", +"TQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt.b.c.d.eTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt", +"TQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt.f.g.h.i.bTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt", +"TQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt.j.k.l.e.m.nTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt", +"TQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt.b.a.o.p.q.r.s.tTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt", +"TQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt.u.v.w.k.x.y.z.A.bTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt", +"TQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt.t.k.B.C.k.D.E.F.G.HTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt", +"TQtTQtTQtTQtTQtTQtTQtTQtTQtTQt.b.#.#.o.I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QtTQtTQtTQtTQtTQtTQtTQt.b#8#9a.a#aaaaabac#3adaeaf#7#M.JTQtTQtTQtTQtTQtTQtTQtTQt", +"TQtTQtTQtTQtTQtTQtTQtTQt.bagaha.a##1aaaa#2aiajakalaman#ATQtTQtTQtTQtTQtTQtTQtTQt", +"TQtTQtTQtTQtTQtTQtTQtTQtTQtaoapa.a#aaaqaraq#3aj#5afamas.JTQtTQtTQtTQtTQtTQtTQtTQt", +"TQtTQtTQtTQtTQtTQtTQtTQtTQtatauava#aw#V#W#Max#4ayafazan.JTQtTQtTQtTQtTQtTQtTQtTQt", +"TQtTQtTQtTQtTQtTQtTQtTQtTQtatahaAaB#W#N#M#V#V#RaCalazas.JTQtTQtTQtTQtTQtTQtTQtTQt", +"TQtTQtTQtTQtTQtTQtTQtTQt.baDap#Z#Q#N#M#V#M#N#6akafaEaFaG.E#h.JTQtTQtTQtTQtTQt", +"TQtTQtTQtTQtTQtTQtTQtTQtaHaIahaAaB#W#W#N#WaJ#6aKalamaF#WaJaJ#yTQtTQtTQtTQtTQt", +"TQtTQtTQtTQtTQtTQtTQt.qaLaIahavaM#WaJ#W#DaN#RaealaOan#NaNaPaTQTQtTQtTQtTQtTQt", +"TQtTQtTQtTQtTQtTQt.jaRaSaTaUavaB#WaNaPaLaVaWaeaX#6aYaZa0a1a2TQtTQtTQtTQtTQt", +"TQtTQtTQtTQtTQt.ba3a4a5a5aVa6a1aZa7aSaSa5a8a9a4a5b.b#a5a5.kTQtTQtTQtTQtTQt", +"TQtTQtTQtTQtTQtbaa7a7aVa0b.b#a7b#a0a7a7a7aSaSa7b.aVa0aVaR.#TQtTQtTQtTQtTQt", +"TQtTQtTQtTQtTQtbbbcbdbebebfbgbhbhbibjbjbkbkblbmbmbnbobpbq.bTQtTQtTQtTQtTQt" +] +image6_data = [ +"22 22 165 2", +"TQt c None", +".h c #000000", +".o c #010101", +"aF c #030303", +"#n c #060606", +".H c #080808", +".r c #0c0c0c", +".q c #121212", +"#V c #124e7f", +"#m c #131313", +".G c #161615", +"aI c #172cac", +".6 c #181818", +"aH c #1841b2", +".p c #191919", +"#8 c #1928ba", +"#W c #1929ba", +"aj c #192aba", +"av c #1a31c2", +"aE c #1b1b1b", +"aD c #1b2bc8", +"at c #1c79d2", +"ah c #1c7dd4", +"aA c #1d1d1d", +"aC c #1d7ad7", +"#6 c #1d7eda", +".5 c #1e1e1e", +"#7 c #1e8ae0", +"ai c #1e8de0", +"au c #1e90e0", +".g c #242424", +"#5 c #313b6c", +"aB c #343d8d", +"#3 c #393939", +".f c #3d3d3d", +"ak c #433967", +"#C c #434442", +"aw c #443c6e", +"#l c #454643", +"as c #454fa3", +".4 c #474845", +"#R c #474846", +".e c #484848", +"aG c #4856a0", +".d c #4a4a4a", +"#9 c #4c416a", +".c c #4c4c4c", +"ag c #4c5cae", +"#X c #4d4669", +"#z c #4dc2b2", +"#P c #4e445a", +"#G c #53504e", +".l c #545454", +".b c #555555", +"#Q c #595274", +"#i c #62b2a2", +".a c #676767", +"#j c #69b6a3", +".F c #6f6f6a", +".K c #6f8b89", +"ax c #747474", +"#a c #76a1a0", +".# c #797979", +"#A c #7bd7e8", +"ay c #7d7d7d", +"#U c #7e7d73", +".I c #808080", +".O c #81a3b8", +"az c #828282", +"#y c #82d1c0", +"#S c #848484", +"#O c #857e7c", +"#F c #86add2", +"#k c #86cdda", +"#N c #89b1bd", +"#h c #8acec3", +"#o c #8c8c8c", +"#L c #8cbbca", +"al c #8d8d8d", +".s c #8f8f8f", +"#H c #909090", +"#K c #90bac9", +"#M c #91c4cf", +"#t c #929292", +".X c #94c2cf", +".N c #94c2d0", +".W c #959595", +"#B c #96b9cb", +".3 c #97bede", +".L c #98c2ce", +".P c #9b9b9b", +"a. c #9c9c9c", +"am c #9d9d9d", +"#s c #9dbdc4", +"#b c #9e9e9e", +"#Y c #a0a0a0", +"an c #a6a6a6", +"#v c #a6d1d6", +".Z c #a7a1a1", +"#I c #a7a7a7", +"#D c #a7edde", +".M c #a8d8e5", +"#u c #aeaeae", +"ac c #b1b1b1", +"a# c #b2b2b2", +".2 c #b5cbd6", +".V c #b6b6b6", +"ar c #b7b7b7", +"#Z c #b8b8b8", +"#2 c #bababa", +".Q c #babbb9", +"aq c #bbbbbb", +"#c c #bcbcbc", +".8 c #bfbfbf", +"ap c #c0c0c0", +".1 c #c1d9d2", +"aa c #c8c8c8", +"ab c #cacaca", +"ao c #cbcbcb", +".Y c #ccf8f1", +"#J c #cdcdcd", +".R c #cecece", +"#p c #d1f9f4", +"#4 c #d5d5d5", +"#w c #d5ece4", +".9 c #d5f6f5", +"#0 c #d6d6d6", +".U c #d7d7d7", +"af c #d8d8d8", +".x c #dadada", +".y c #dbdbdb", +".w c #dcdcdc", +"#e c #dcf7f4", +"#1 c #dddddd", +"ae c #dedede", +".E c #dfdfdf", +".z c #e0e0e0", +"#g c #e0ebe4", +"#q c #e1edea", +"#d c #e2e2e2", +"#x c #e2ebe2", +".0 c #e2eee5", +".v c #e3e3e3", +"## c #e3e7d5", +"#r c #e4ebd9", +"#E c #e4f2ec", +".u c #e5e5e5", +".S c #e7e7e7", +".k c #e9e9e9", +".A c #ebebeb", +".D c #ededed", +".t c #f0f0f0", +"#T c #f4f4f4", +".n c #f6f6f6", +".C c #f7f7f7", +"#f c #f8f5f2", +".m c #f8f8f8", +".7 c #f9f9f9", +"ad c #fafafa", +"#. c #fbf0eb", +".J c #fbfbfb", +".T c #fcfcfc", +".B c #fdfdfd", +".j c #fefefe", +".i c #ffffff", +"TQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt", +"TQtTQtTQtTQtTQt.#.a.b.c.d.d.e.f.g.hTQtTQtTQtTQtTQtTQtTQt", +"TQtTQtTQtTQt.#.i.i.i.i.i.i.i.i.i.h.hTQtTQtTQtTQtTQtTQt", +"TQtTQtTQtTQt.a.j.j.j.j.j.j.i.i.i.h.k.hTQtTQtTQtTQtTQt", +"TQtTQtTQtTQt.l.m.n.o.p.q.r.s.j.i.h.t.u.hTQtTQtTQtTQt", +"TQtTQtTQtTQt.e.v.w.x.y.z.A.n.B.B.h.C.D.E.hTQtTQtTQt", +"TQtTQtTQt.h.h.h.h.h.F.G.H.I.n.J.h.h.h.h.h.hTQtTQt", +"TQtTQt.h.K.L.M.N.O.h.P.Q.R.S.n.T.j.U.V.W.hTQtTQt", +"TQt.h.X.Y.Z.0.1.2.3.h.4.5.6.q.r.s.7.v.8.hTQtTQt", +"TQt.h.9#..###.F.F.F#a.h#b#c#d.m.j.7.v#c.hTQtTQt", +"TQt.h#e#f.a#g#h#i#j#k.h#l#m.r#n#o.7.v#c.hTQtTQt", +"TQt.h#p#q.a#r.F.F.F#s.h#t#u.x.n.j.7.v#c.hTQtTQt", +"TQt.h#v#w.##x#y#z#A#B.h#C#m#m.q#o.7.v#c.hTQtTQt", +"TQtTQt.h#D.Z#E.F.F#F.h#G#H#I#J.A.7.m.v#c.hTQtTQt", +"TQtTQtTQt.h#K#L#M#N.h#O#P#Q#R#m.q#S#T#d#c.hTQtTQt", +"TQtTQtTQtTQt.h.h.h.h.Z#U#V#W#X#Y#Z#0.S#1#2.hTQtTQt", +"TQtTQtTQtTQt#3.t.v.x#4#5#6#7#8#9a.a#aaabac.hTQtTQt", +"TQtTQtTQtTQt.6ad.kae.yafagahaiajakalamana..oTQtTQt", +"TQtTQtTQtTQt.haeaoapaqaqarasatauavawaxayaz.oTQtTQt", +"TQtTQtTQtTQtTQt.h.h.h.h.haA.oaBaCaiaD.HaEaFTQtTQtTQt", +"TQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtaGaHaITQtTQtTQtTQtTQtTQt", +"TQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt" +] + +class MainWindow(TQMainWindow): + def __init__(self,parent = None,name = None,fl = 0): + TQMainWindow.__init__(self,parent,name,fl) + self.statusBar() + + self.image0 = TQPixmap(image0_data) + self.image1 = TQPixmap(image1_data) + self.image2 = TQPixmap(image2_data) + self.image3 = TQPixmap(image3_data) + self.image4 = TQPixmap(image4_data) + self.image5 = TQPixmap(image5_data) + self.image6 = TQPixmap(image6_data) + + if not name: + self.setName("MainWindow") + + + self.setCentralWidget(TQWidget(self,"qt_central_widget")) + MainWindowLayout = TQHBoxLayout(self.centralWidget(),0,6,"MainWindowLayout") + + self.Frame3 = TQFrame(self.centralWidget(),"Frame3") + self.Frame3.setFrameShape(TQFrame.StyledPanel) + self.Frame3.setFrameShadow(TQFrame.Sunken) + Frame3Layout = TQVBoxLayout(self.Frame3,1,0,"Frame3Layout") + + self.WebBrowser = TQAxWidget(self.Frame3,"WebBrowser") + self.WebBrowser.setControl("{8856F961-340A-11D0-A96B-00C04FD705A2}") + self.WebBrowser.setFocusPolicy(TQAxWidget.StrongFocus) + Frame3Layout.addWidget(self.WebBrowser) + MainWindowLayout.addWidget(self.Frame3) + + self.actionGo = TQAction(self,"actionGo") + self.actionGo.setIconSet(TQIconSet(self.image0)) + self.actionBack = TQAction(self,"actionBack") + self.actionBack.setIconSet(TQIconSet(self.image1)) + self.actionForward = TQAction(self,"actionForward") + self.actionForward.setIconSet(TQIconSet(self.image2)) + self.actionStop = TQAction(self,"actionStop") + self.actionStop.setIconSet(TQIconSet(self.image3)) + self.actionRefresh = TQAction(self,"actionRefresh") + self.actionRefresh.setIconSet(TQIconSet(self.image4)) + self.actionHome = TQAction(self,"actionHome") + self.actionHome.setIconSet(TQIconSet(self.image5)) + self.actionFileClose = TQAction(self,"actionFileClose") + self.FileNewGroup = TQActionGroup(self,"FileNewGroup") + self.FileNewGroup.setUsesDropDown(1) + self.actionNewWindow = TQAction(self.FileNewGroup,"actionNewWindow") + self.actionSearch = TQAction(self,"actionSearch") + self.actionSearch.setIconSet(TQIconSet(self.image6)) + self.actionAbout = TQAction(self,"actionAbout") + self.actionAboutTQt = TQAction(self,"actionAboutTQt") + + + self.Toolbar = TQToolBar(TQString(""),self,TQt.DockTop) + + self.actionBack.addTo(self.Toolbar) + self.actionForward.addTo(self.Toolbar) + self.actionStop.addTo(self.Toolbar) + self.actionRefresh.addTo(self.Toolbar) + self.actionHome.addTo(self.Toolbar) + self.Toolbar.addSeparator() + self.actionSearch.addTo(self.Toolbar) + self.Toolbar_2 = TQToolBar(TQString(""),self,TQt.DockTop) + + self.Toolbar_2.setHorizontallyStretchable(1) + + self.lblAddress = TQLabel(self.Toolbar_2,"lblAddress") + + self.addressEdit = TQLineEdit(self.Toolbar_2,"addressEdit") + self.actionGo.addTo(self.Toolbar_2) + + + self.menubar = TQMenuBar(self,"menubar") + + + self.PopupMenu = TQPopupMenu(self) + self.FileNewGroup_2 = TQPopupMenu(self) + self.PopupMenu.setAccel(TQString.null,self.PopupMenu.insertItem(self.FileNewGroup.iconSet(),self.__tr("New"),self.FileNewGroup_2)) + self.actionNewWindow.addTo(self.FileNewGroup_2) + self.PopupMenu.insertSeparator() + self.actionFileClose.addTo(self.PopupMenu) + self.menubar.insertItem(TQString(""),self.PopupMenu,1) + + self.unnamed = TQPopupMenu(self) + self.actionAbout.addTo(self.unnamed) + self.actionAboutTQt.addTo(self.unnamed) + self.menubar.insertItem(TQString(""),self.unnamed,2) + + + self.languageChange() + + self.resize(TQSize(812,605).expandedTo(self.minimumSizeHint())) + self.clearWState(TQt.WState_Polished) + + self.connect(self.actionHome,SIGNAL("activated()"),self.WebBrowser,SLOT("GoHome()")) + self.connect(self.actionRefresh,SIGNAL("activated()"),self.WebBrowser,SLOT("Refresh()")) + self.connect(self.actionStop,SIGNAL("activated()"),self.WebBrowser,SLOT("Stop()")) + self.connect(self.actionForward,SIGNAL("activated()"),self.WebBrowser,SLOT("GoForward()")) + self.connect(self.actionBack,SIGNAL("activated()"),self.WebBrowser,SLOT("GoBack()")) + self.connect(self.actionGo,SIGNAL("activated()"),self.go) + self.connect(self.actionFileClose,SIGNAL("activated()"),self.close) + self.connect(self.actionSearch,SIGNAL("activated()"),self.WebBrowser,SLOT("GoSearch()")) + self.connect(self.addressEdit,SIGNAL("returnPressed()"),self.go) + self.connect(self.WebBrowser,SIGNAL("NavigateComplete(const TQString&)"),self.addressEdit.setText) + self.connect(self.WebBrowser,SIGNAL("TitleChange(const TQString&)"),self.setTitle) + self.connect(self.WebBrowser,SIGNAL("NavigateComplete(const TQString&)"),self.navigateComplete) + self.connect(self.WebBrowser,SIGNAL("CommandStateChange(int,bool)"),self.setCommandState) + self.connect(self.WebBrowser,SIGNAL("BeforeNavigate(const TQString&,int,const TQString&,const TQVariant&,const TQString&,bool&)"),self.navigateBegin) + self.connect(self.actionStop,SIGNAL("activated()"),self.navigateComplete) + self.connect(self.actionNewWindow,SIGNAL("activated()"),self.newWindow) + self.connect(self.actionAbout,SIGNAL("activated()"),self.aboutSlot) + self.connect(self.actionAboutTQt,SIGNAL("activated()"),self.aboutTQtSlot) + + self.init() + + + def languageChange(self): + self.setCaption(self.__tr("TQt WebBrowser")) + self.WebBrowser.setControl(self.__tr("{8856F961-340A-11D0-A96B-00C04FD705A2}")) + self.actionGo.setText(self.__tr("Go")) + self.actionGo.setMenuText(self.__tr("Go")) + self.actionBack.setText(self.__tr("Back")) + self.actionBack.setAccel(self.__tr("Backspace")) + self.actionBack.setMenuText(self.__tr("Back")) + self.actionForward.setText(self.__tr("Forward")) + self.actionForward.setMenuText(self.__tr("Forward")) + self.actionStop.setText(self.__tr("Stop")) + self.actionStop.setMenuText(self.__tr("Stop")) + self.actionRefresh.setText(self.__tr("Refresh")) + self.actionRefresh.setMenuText(self.__tr("Refresh")) + self.actionHome.setText(self.__tr("Home")) + self.actionHome.setMenuText(self.__tr("Home")) + self.actionFileClose.setText(self.__tr("Close")) + self.actionFileClose.setMenuText(self.__tr("C&lose")) + self.FileNewGroup.setText(self.__tr("New")) + self.actionNewWindow.setText(self.__tr("Window")) + self.actionNewWindow.setAccel(self.__tr("Ctrl+N")) + self.actionNewWindow.setMenuText(self.__tr("Window")) + self.FileNewGroup.setMenuText(self.__tr("New")) + self.actionSearch.setText(self.__tr("Search")) + self.actionSearch.setMenuText(self.__tr("Search")) + self.actionAbout.setText(self.__tr("About")) + self.actionAbout.setMenuText(self.__tr("About")) + self.actionAboutTQt.setText(self.__tr("About TQt")) + self.actionAboutTQt.setMenuText(self.__tr("About TQt")) + self.Toolbar.setLabel(self.__tr("Toolbar")) + self.Toolbar_2.setLabel(self.__tr("Toolbar_2")) + self.lblAddress.setText(self.__tr("Address")) + self.PopupMenu.changeItem(self.PopupMenu.idAt(0),self.__tr("New")) + if self.menubar.findItem(1): + self.menubar.findItem(1).setText(self.__tr("&File")) + if self.menubar.findItem(2): + self.menubar.findItem(2).setText(self.__tr("&Help")) + + + def go(self): + print("MainWindow.go(): Not implemented yet") + + def newWindow(self): + print("MainWindow.newWindow(): Not implemented yet") + + def setProgress(self,a0,a1): + print("MainWindow.setProgress(int,int): Not implemented yet") + + def init(self): + pass + + def setTitle(self,a0): + print("MainWindow.setTitle(const TQString&): Not implemented yet") + + def setCommandState(self,a0,a1): + print("MainWindow.setCommandState(int,bool): Not implemented yet") + + def navigateComplete(self): + print("MainWindow.navigateComplete(): Not implemented yet") + + def navigateBegin(self): + print("MainWindow.navigateBegin(): Not implemented yet") + + def aboutSlot(self): + print("MainWindow.aboutSlot(): Not implemented yet") + + def aboutTQtSlot(self): + print("MainWindow.aboutTQtSlot(): Not implemented yet") + + def __tr(self,s,c = None): + return tqApp.translate("MainWindow",s,c) diff --git a/examples/webbrowser/mainwindow.ui b/examples/webbrowser/mainwindow.ui new file mode 100644 index 0000000..446a717 --- /dev/null +++ b/examples/webbrowser/mainwindow.ui @@ -0,0 +1,410 @@ + +MainWindow + + + MainWindow + + + + 0 + 0 + 812 + 605 + + + + TQt WebBrowser + + + + unnamed + + + 0 + + + 6 + + + + Frame3 + + + StyledPanel + + + Sunken + + + + unnamed + + + 1 + + + 0 + + + + WebBrowser + + + StrongFocus + + + {8856F961-340A-11D0-A96B-00C04FD705A2} + + + + + + + + + menubar + + + + + + + + + + + + + + + + + + Toolbar + + + Toolbar + + + + + + + + + + + + Toolbar_2 + + + true + + + Toolbar_2 + + + + lblAddress + + + Address + + + + + addressEdit + + + + + + + + + + + actionGo + + + image0 + + + Go + + + + + actionBack + + + image1 + + + Back + + + Backspace + + + + + actionForward + + + image2 + + + Forward + + + + + actionStop + + + image3 + + + Stop + + + + + actionRefresh + + + image4 + + + Refresh + + + + + actionHome + + + image5 + + + Home + + + + + actionFileClose + + + Close + + + C&lose + + + + + FileNewGroup + + + New + + + true + + + + actionNewWindow + + + Window + + + Ctrl+N + + + + + + actionSearch + + + image6 + + + Search + + + + + actionAbout + + + About + + + + + actionAboutTQt + + + About TQt + + + + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232365200210543251d2e253d856405bffcbc54103b11c8563600020b03105719c4b530b08072f50880513560a09c080338d5209420294a4451a38c90426621ab5146d10de524a2aa417505445122861a547722bb0c971a3d2aa921c2ae446c6a9431fc85a9064551220e354009653dec00294e712a1ac4e97078a9a9b5e6020013b3f563 + + + 789ce596497332470c86effe15947573a5f4c1cc30cc542a07ef60bc808dd7540e3d9b6df006186c93ca7f8fba2535ce57be98dc9292313c487a2575f7ccf063a376d53baa6dfc589bbe9ad7fbbc96df99496da3983d3e7efcfec76f7faead87418dfe1a51500bd67f595befbfd6f2daf1f35369014e08a05e6fd4ab96e31e73d0282bc7a7cae23ff3ccfe8170ca6cee9843f51f3b4ec8cff9efccdebf2d2cf9b06bb9417a25c74f98bdff99390a84fb8e49af70f39891b2e40bfbf8b6b0917e87968346a8f5a6cc51c07ab02f2cf1983237552f709c86691e3bbd5be5821998a32067bd1765d13f67563d530a4b3df8b01c523d8ec74059faed086bfc82390e851b8ed3c86485e34365a9bfc5ece3df8433e10bcb5140f5dd3cf0e099f32f99e350cecb5858f2b1c1dc52fda663d334a277c0ecfd5d61c9373973120967969b548fd71b079e797d8e985b21eb63aecceb85e7c299f4ffaa2ce7739359ebc195631387c6ad1f5e302791ccbba72cf173e15cfa2d2cc7619cf1fa63c9dccaa4ff4bcfdc7fa82cfdf7999348f6bf299c4bfd4c59ea0f99535dafca71d60a65ffebca52ff8c3989e47cce98351fb785759e7bcbad65bf0be624ca9a8e87caac0fb1702ef191b2cc9731a7b9ec4f87d934659e27e142f8c671e6eb9d0ae7b2be07cc6924ccf999698a7e4f58f572e64cebb9f393444994e68e4365d9ff7be15caef70766ad678cb0f8f18359ebe109b3af27f199fadd794cf254eb196599774758e77d5496f5dd64a67959af122ef87c639b59eb81d34ba97fe3f4215196f3922acbbc28acf527cc792c7a857029ecf63bcded05efb8a52cf3cc9833ed2f66563dac0b8b1ebe3317ea77f73352173db8f6ccf54a66df0f30fb7c777d9bc214d2cf88d9cf73cfece3ddf3296b66da7fe199d7a32b5cc8feef31fbfe8f99bdde96b0faddf3272bac390665b99e90d9e7ef33972de9d73d7ff3d873255c49fc1b73257ee4f8d2eb5d336b3e8e8535ff86d9e7bbf35f2cf51366ef77cfeb6299df62563f3c0a8b1fdcf3d3569778773f756e66f7fcac967e175f797ffff5dfd9ff4103010d6698a35955030b2cb1c25bbcc3fbd5344861882352b8c5077c5c45836678c267ca7fc1314ebeaf81537cc599eb608e6ff88e1f2b682c705314b6486182dbb8f31d0ddca529f644619ff2db641d3cf82a8bfa9d62d7da670d3cc4233c760a63eaa08d2734478fac8f87ffc833788a6738c073bc20ebe3255eb1069d863e5e3b851bacfb7c6b0d0c30c488f24a3a2d4ddaf1986a3d600b13179be280ef597809e876e206000c69d8ec0e590f32c8a18012b7a0825b9799e018eee0de4e0b4318c103ff2ea2985b78c47d28a487ce276b634cca40356d1655801c3bf044af2136e0195ef8b711be4045ab50ff42e16bdbb6463d8e610253fe3d4855ec3ed80abd9f62397ef9c9e6cee835249bc31bbc731ff0010beacbcdbfaca29f2836a3e839fd1f3acb5cb6fd6e13b6605b34766097d6664cdf0d7faad9813dd827df08daf4de812ddaa7061c4017baf43ea6daef70c8fb0247704c932dc897b94e67da09553a811ef4a94a0f4ee10c069435216b630ae7a43b800b7fc6164ea543ea73ea75663b22a50e5cc215ec50956beaf606ead08080147b64c76403d20ebdc6142268528d3655ee3a1db6f88b535ee015b42081d4205ee1f4f335878501ea7644331dc81acecdb7ef63b86b32eae59956cff63237f92af7319c9a82669c989256bd0b6fa6fabe86bbfe0ecdadb9a399ce61b49a86355adfbedd45736756bc27b30afd161a9a9179585de33bf69fd2f8ebd7b5bf014644b906 + + + 789ce5965b4f23471085dff915d6d6db2aaac5e3b92aca037703cbc55c8c21ca43cf8c8d0dd85c6c307694ff9eeaaed3bd68771f968d14298a0a109fabebd4e99a9ef17cfad8e81d1f343e7e5a99cecc6c5435aaa1796a7cac9fc7e3c5ef7ffcf6e7ca8756d4909f661c35a20fbfac7ce8cc1a55e3f07ed2b7409702b4badaccfb996563020f5c7ecbf340b9a31c3591dff7ac7943e002cc8e73cf74acdcc27a8a2d37a5be4e1d9f04567f9fc105f25dcfea9726caad62a07c1158f58f94e3087e868ea57fa5fa0be590bfb11c3525affd4e03ebfa25b8507fbcaa1c47ca66e459fdf10c6c30af4dcfda8f5f9513dfffce71e1f5a956967adddfaeb25f4f7b60e8d199e596f42f6bc787ca213f554e5be06dc7a28ffdee282791cedb5c83d19fd795a55ecf4b3fb0ee07ebd312fae796e3283665e238524e2265de031bcc774d396d61be25b8c4fe1f02abfeab67f49f2867decfbd6393b6a03f03438f3bca19fa51cb33fc6f80fd7eae2c27e257e7cb4de5b4045f78d679f24960ddcfb172e6f73357ce63e88fc115ce43e558fcabbeb905fb7e47cae24ff5daca41af007bbd81e5b425f53aff6160d52f95f318f37d01a39ee7ca05f4790a469e0e1c97590bfa1b81f53c3e2bfbf5ecf697b532efe754398f31af437085eb65948b18e723f70cbf9e2bcc633db0f65b533609fcbafb372bf318fdcfc015e65b281731ee0ff6acf70767ca5e8f7be01abcab5cfa7e89e53cce2ba3fd1681b5df8172013f44e00acfbf4a39e8ef287b7dbe02234feefce795d727a36c12ccf75239d4b7c1bede9def42fcc0ef7960d5cbc05ebf543635aed752b94aa1ff02ee83ddf3b6a87c3d3f2b9b047a4fcaa17e0cf6f5eef928ab13f5476960d5eb7ac6f5dd07d7e04839e83d29d7be9ffbfe31b50dc723cfa87f08acf947e51a7ad457ee6760773ecaa4f47e36036bfd96673c3fb6c13578a01cf41f9505d5af3b2f655dc28fa93da33e550ef523e5e06f08861eb9e7b94cdfe7ddf753d50feb6f94437e00f67edcf3aa4e831ed8afe73bb05fefe655f7c37edcfd62bb81ddfb82935776cfeb41c87766ff2cfe7f1a4c6cb8e48ae91f68d4dce7015ff390473fad71c3b77cc7639ef03d3ffcb48f013ff293a84c79c6d54f693c8bc28b28589539bff2e2ed647e586389184bacf13a6ff0e6d71a32f92dde96bfdf9dbccc6387dba2d086caae4c668ff7bf68f0673ee0433ee263eef0099ff2199f8b62d0e32e5f704fea2fe5b70d3f57729556b91b349a1c718b634e64faa9fc7fc919e772220a91213254ca273b884bf72b4a54f1846ad925e93b1af56940d734a4110fe4efb5c40dddda907311734c7752d10b3a1ae289c634a17b7dafe331e995b3b124fbdfd25d85471763596fab7aa2a4f53d444653ded3773bb96e8faeae1de2ea8dff9da0b0ebfcd858e3357aa667bb1f68b4a5e7d256853559e8f56d64aefe85e6f44a0b5aea3bac5c2bebf74b8775fb6bfbb858771e7a6f1df09c36f89a36698bb6f53d5c4ef08ee4e6a2dd269b9d488729ed4a171b7bd40ece3228cce5d305edd3673ed7773139bd133a14d5233a96cff7a9237142a77446e7125dba900e70681564f5a6acdc1285ae9e0feaf150d675e8d2d59dd315ad52931fec2973d1a5489c6698e29c5a508829797bd629a52665bcf9fdd32ed95c1d50217b5c18b67390f34befb8e78873a9b6b39ad285216328a2de3bef5b32a59db5ccec42a6b565aaf7dffba6e663d3972b211ea86b065f3cbccbc7b53890399a21a55f677f5863e4f670c337df667f58e3d6dc99dbef3dd5ff6bdf73ff82c65fbfaefc0d4fb5b868 + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232325500210543251d2e25658564056503300071f540dc3430007371012a492a830156496538c094848922c9c2259134c099304914e3604c8424aa5e6449b0044216ca824ba2da8b4512218b4d122e8b55520fee5974072164511da487ea490c7f22cba249e20d3efc018f3fcae0d2702eb5d2106992b5d65c00b9a48974 + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232365200210543251d2e253d856405bffcbc54105b19c8563600020b03103711c4b530b08072f50880513524ab518681443435ca984ae08ae06a94114a10ac443435ca3043904d4c4453a38ca604ae11590d9a0ab80bd0d46078914c35c4d885a608871a547f61f81d5d117a1862018930e5b8d5c0950c741a1b1e6a6aadb90086a9d853 + + + 789ca5985973db480ec7dff3295cc15b6a0b2351a428d6d63ef83e255bbe647b6a1fd02465dd872d9f53f3dd076c005dc926ce6a32eed8553f37fadf7fa0c1a69cdfbe6cdc9cb537befcf6e97145ab61be910fe861e34bf1349dbefdfedffffcf1e97323dae07f51bdbe117dfed7a7cfddd546bed199cfca0ae888016afeab62e8796ef110ee545caf05be16ae5bfc6ee096e7b6e756983f51b6f53b81257ecfb8eee7e9b162f66af1c78125fe48987f23f3fb81657e691cd5bddecc7316d555efd058f7eb2867aa771058f4de8c55cffb6dd4a34cf5b68d357e681c6515634db81a7e3ef59c35cccf5560bf9ef6953389c77660af074f15c751e05c38a6d81f2ef9f3a848f4e9d658f2c36b635dbfa54cc2383556bd33e12492fc70df38f1f3f8ae4cc2745a711285fda7caa4f95e06967a2d8c63f27a8fc2a60fa4acfa980a371b898f0767dc6cf8fdbc9f84c27e4de124d2fabe186b3dee8c75ff1365dbef2db0ccef0987fd2f2a6632fd576552fd2b63d57b08ecd7d39d70b321fd0560acfb6d1a4b7e3050764de7d79f08a70de937ea7b7689e68f4de1e0776e2c7ab8abecb47eb170aa7ee822b0e89f1b4b7fd24dc529abe9794f02cbf99e2b3badc7a5b1ee97089b3e0e8d253f3c364e253e5576120ff7c63a9f7966d2e771d358e75bca4ef3bb0e2cf9758db5fe47c6b21eeb81bd3f07c2ad58ebd130d67e6a194b3cf97e62b2fa24c67a1f5d2aab3f8781a53e17c6eaa7082cfa3de156acf9d5034b7e3563f1eb96c6eaf7c0b815fbf8d2739e3aedefb1b1de9723618b77a49cebf946c6e20f5f8d251e753e8b5bb9e74c980a4afc7a7fbf66b1ed8fb7c67a9ec7c2ad5cfd74038bdfa6b1f6cbd458fd2e84b358efbb0363f5b71358fccd8c33596f9c4bfddcc458fac78d8cf5797b3296f5f82c4c49e6f5c9bf9fb23ce41307967e3935d6f36c0b67b1ce3f188b5f3757367f5363b98fdc38b0cc0f8cf5f90bf3ea97028bfe50981289777d63edcf81b1c4439897f3c52d615738cfe0df371c1deb7db265acf98d8d253f7a50d67a60c758cfcbf4cc7f2fb0f8bf1736bfae30d6f35f1a4b3ce6c6e2df95ca85f6f7dc58f3db0e5c783e14e6ebc533e87e963fbe0873f9fd3cc97c91693fd028b0d4e3c558f3eb0b9b5f972bab3fe78c353f3056bfabc0e2371636bfe4cf9b29d1e76b69acfdb863accfd33cb0dc2fa7c6e2179e03cb79ae940b7dffbf1b6bfd1363f53b12367f581a6b3d1bca56df6e60a9bfc6e765def4ecef6bc7eafaf9e8d558fbb7a15ce87d7263acf7ffbdb1e40f33e1e0cf29ebfea8eb6d7ff29f17f8f4137dfe51d8fa0117ca65ee3fbfe3bd705116b2de9f775e3af50313e1a229f1f0682cf1b052e6e1d9dfbf1cddd4fd2363cdcfef5fb05b7d1f0c944bed4f67ac9f5f27c265bf4c3d9f07eefb787f1f96695eaa1e0a174d7d7f81b1ee4f81a5fe75e552d9bf1fca7e617e9e8d556f33b0c4fbcf5ffdb44c956bc6a2d75dfd6c2020fd3ce2ff69a0c31c0b2cff91461fef71804374bfaa81231ce3044b9ce2ecd734380fc2392e70890ff888bfa6f184cff8c24e5ef10ddf71f3a37c3ed6c015afdec26dfeb983bbb887fb78f0f734380fe031c7437f3247788c27d8fe713e1f6a1076f014cfb08be7ac7481977885d75c951fe4f3630dcea3c3eb7b9cc70d6b9ce12d9fee26de610debeb69b0fb578cb89a0d8c399711e794609373d9c39455f2b53466d8c20c17809c45cc7a3c00f011081cffccff379fef35388f1d0428a0c401f459e58c3d45700f0003cee71d8678fc730d7430e2557d3c8331f7568c37308129cc7006733e9d262c6008cb6ff3f94ea3c72bc678ca3f1fb80a637884154c71c974c55d72c91a4feca4fdf553f8ad46554d8e9ee30a9eb1efab31611f2ff0ca346427bb9c11e114debe7e7ebed328318702e7f0ce9dbee47a1c724655b745b0c94ea6b0c55519f059b98f73d19a6cc30eecc21eecfb7100877004c770026de8e070bdfe805338832e9cc3055cc2955f7b0d3de8f0cfebb5356ee016eea0c6a30e11342086049a907aadcd35355a90111250f5e5288706bfdb4bea572a78b49e06ddd3a0d2807a2502110d6944639ad09466ebf9e8ae684e0bf5b1a4075ab28f11ffa1df678dc7f57cb0c68a9ee899355e7c2ddbf40a31bdb1c63bcdfe86c6803669cb9f4555c76b38a76dcee57d5d1f5c8f1d5af0b9745581bb029a5c8f3eedd21eed73b70ebe56fa91061dd061f05139e9d1116b1cfb9aee55c4fcf6330d5cd289d778a6b65fdd831dea702e256b9cf2b974a84367d4fd580347744e17744957acc13e7cfc095d538f356ed8cd2ddd518dea147da4c1956890ffcf295ed5e4c83b4a59f182b9455935e3b801ab791c7fa4e188d7a4bcbee66353feaef9df8852ca2f3e9ee3ef73840f359cabfec22979f4ddbd1bf018ba118f318f899bf298b9b95bb8e537cffe9ffffef4171c39a0bf + + + 789c8d96c9521c490c86ef3c458775734cc8ddd5b5c6c41c303b180cc60b66620eaacc2c9aa5599b7562de7da45fc5180c8e98fa39f091522e4a49c9bbb783bdedcdc1db77735733991d864198c8e5e06dbc9e4eeffffceb8fbfe7de64d9407f466531c8defc36f76667360883adb3d364c013051ae2039f8147266359068f4dc6740a2e4db05f05d726f0253898c017c6a3cc04ffafce79aa3af0143c36c17e055caa0aacbf06aeb2203e5f09ae4d185f75ce472de6e7737063c2fcb57356b702fed673e32c473d4bcf3760198f02e69325706b022f3a676df0f567e05035d1ed273dc79883e7c1d1045e70ae2456d84fd9738a589f0b703261bc72ae25e17ee4b0e7d8f3b5733374e603e32c37c11ff36970db12f193f7e07c1c6bec87c6e0c604ff0e1c4db03f36cec7e3a6f4fd2e38e779eee7bd05e7e350fa7e4fc0455ee6b84fb9eab913bfdf1c5ce5758efba54fffb1e75302d726f8af3817a5f8f922584cf06fc0211f951ebfd0b30afe07ce4510dfdf1e38e665e9f9f1e01c32cf1fda06a73c2f7c7eac5f8c8b61eef582f315b909dc82f1c17e07dc1459e5f1c77d953abb787e0ab832611cf957366dd9c707f556762a3fcf8673ddd6d8afdc1957b909fe98af2a65d4c787c08d09e3c8bfaad504f378de83a309e35fc049d9d747bda19c7dbe8f602d88d6fd11af3a33c1ffde398e02ec69178c0b04bb7fa12be03e08e7ab4b895e2f74ec1ca2e73f6d811b2d37df1feaa9969082f71ff4a73a98c01f9cdb3678fde27eea58f7f9cdc8bfba33c11efda2199ac01bcead048fd72678a4e9e3f6a86f6d172acc87fc69f290f9386f3d72f478a1bf348509fea8b7a66c9b80fec1a8b7a66a53f47cc2fe9b5ae77346fe35ad09e761703081d12f9b68c2fc57ce6d0c1e6fe463934ce0efc63234c11ffd5b4a13c66f9cb53d79fded832bcd27f47f5aeb59055e744eb1df3fe2251aeee4e7453f9264c27aa847b44f7f4f909fda3efb7ae30c5c84b65f1fef435b9a608ff7a4ad4c981ffb6b6b13d8fda5edfb37eff4dcb65e2f787f5a7cb0f7fd0413ecf13eb49d09f6783ff07cf97d8ec0a3f8d8df516f483faf07c45b1f27e9f30ff989e9fdbe11ff1034fd3c9eebe068c238fa9f6677f2fb27ac1f475dd3f97da25fc6c204be755673ef3f8db3360c1f1f824b13c651df2877c44fd0df511efe5ea39f44318151cf9a4e2ab0af870d63fee4dc55fdfe109f880ff3fb788a8ff98df733762630fa471aa6febda2839e5b3f0fe1bef4f18bc9fb01fa7dca4ce0bb9e5b671ef69c3cff18f99cc626d853cf551f3fe453ca531bbdde979cbb2c793e207f536102a39fa5ca0446bf4279f97b89feaabb5181511f38bedf2ffa47373461bdcfe0dc8471d46387860fc6fbaad155c11ef7a5d953747ede69cf2a30fe3fd06c5121fe88572726f8a37f68720ffbfdadf7ac02fb7e82098c7e85ebf2fde37dea92098cf7acc367bc33fbff7a6ecfc4c22d078eaac41d1ff0e4d7f66a7df84293e71ecfec858f9ee8d1fef8a9c733fb139ef2299ff1395ff0255fc167c233befee1f1cc3ef10ddff21ddff303cfabe77bd584177891971e3d7ed8db4e7b2df30aaff29a7aac3ff9ebe4a9bdf2067fe04ddee28ffafb36eff027de558fcfbaab2ffc95bf3db5578b3dfecefb3ce411673c56ceb9e0b23f47a5fbac7fb26f889988742f2a129e504b81a246e0c8ec293cb7a7441d0b1dd0840ee9883486744253bea4533a7bd5fe9c2ed4feb29fff4aff32a36b8dd5e92fe6bfa15bddcf1dddd303cd93c6911668aa2b5cbc363f3c16799f9630fbb2d20aadd21aadeb3d547a8617f6f0d8a00fb4495bfadb47daa61dfa84f977e933c597f64f6e6c9fbed057fa467bf49df669c8bb34a2eca53d8d35576ef88e722aa8a48a6a6a448320a20fd36bf3eb7f407c2c89efb5500f6422877224c77222533915e6b397fbd117f54ccee54275295732936bb9915bb9937b797869ff34e7649ecfe4bd2ce81a8bbc2a4bb2fc5a3dfe2c59915559fb75fdfe8f7affe7f7b97f011cdd9635 + + + + + actionHome + activated() + WebBrowser + GoHome() + + + actionRefresh + activated() + WebBrowser + Refresh() + + + actionStop + activated() + WebBrowser + Stop() + + + actionForward + activated() + WebBrowser + GoForward() + + + actionBack + activated() + WebBrowser + GoBack() + + + actionGo + activated() + MainWindow + go() + + + actionFileClose + activated() + MainWindow + close() + + + actionSearch + activated() + WebBrowser + GoSearch() + + + addressEdit + returnPressed() + MainWindow + go() + + + WebBrowser + NavigateComplete(const TQString&) + addressEdit + setText(const TQString&) + + + WebBrowser + TitleChange(const TQString&) + MainWindow + setTitle(const TQString&) + + + WebBrowser + NavigateComplete(const TQString&) + MainWindow + navigateComplete() + + + WebBrowser + CommandStateChange(int,bool) + MainWindow + setCommandState(int,bool) + + + WebBrowser + BeforeNavigate(const TQString&,int,const TQString&,const TQVariant&,const TQString&,bool&) + MainWindow + navigateBegin() + + + actionStop + activated() + MainWindow + navigateComplete() + + + actionNewWindow + activated() + MainWindow + newWindow() + + + actionAbout + activated() + MainWindow + aboutSlot() + + + actionAboutTQt + activated() + MainWindow + aboutTQtSlot() + + + + class TQProgressBar + + + TQProgressBar *pb; + + + go() + newWindow() + setProgress( int a, int b ) + init() + setTitle( const TQString & title ) + setCommandState( int cmd, bool on ) + navigateComplete() + navigateBegin() + aboutSlot() + aboutTQtSlot() + + + + qaxwidget.h + + diff --git a/examples/webbrowser/webbrowser.py b/examples/webbrowser/webbrowser.py new file mode 100644 index 0000000..12f6f1c --- /dev/null +++ b/examples/webbrowser/webbrowser.py @@ -0,0 +1,91 @@ +# Copyright (C) 2001-2002 Trolltech AS. All rights reserved. +# Copyright (C) 2004 Riverbank Computing Ltd. All rights reserved. +# +# This file is part of an example program for the ActiveTQt integration. +# This example program may be used, distributed and modified without +# limitation. + + +import sys +from python_tqt import qt +from python_tqt import qtaxcontainer + +import mainwindow + + +class MainWindowImpl(mainwindow.MainWindow): + def init(self): + self.pb = qt.TQProgressBar(self.statusBar()) + self.pb.setPercentageVisible(False) + self.pb.hide() + self.statusBar().addWidget(self.pb, 0, True) + + self.connect(self.WebBrowser, qt.SIGNAL("ProgressChange(int,int)"), self.setProgress) + self.connect(self.WebBrowser, qt.SIGNAL("StatusTextChange(const TQString&)"), self.statusBar(), qt.SLOT("message(const TQString&)")) + + self.WebBrowser.dynamicCall("GoHome()"); + + self.subwindows = [] + + def go(self): + self.actionStop.setEnabled(True) + self.WebBrowser.dynamicCall("Navigate(const TQString&)", qt.TQVariant(self.addressEdit.text())) + + def setTitle(self, title): + self.setCaption("TQt WebBrowser - " + title.latin1()) + + def setProgress(self, a, b): + if a <= 0 or b <= 0: + self.pb.hide() + return + + self.pb.show() + self.pb.setTotalSteps(b) + self.pb.setProgress(a) + + def setCommandState(self, cmd, on): + if cmd == 1: + self.actionForward.setEnabled(on) + elif cmd == 2: + self.actionBack.setEnabled(on) + + def navigateBegin(self): + self.actionStop.setEnabled(True) + + def navigateComplete(self): + self.actionStop.setEnabled(False) + + def newWindow(self): + window = MainWindowImpl() + window.show() + + if self.addressEdit.text().isEmpty(): + return + + window.addressEdit.setText(self.addressEdit.text()) + window.actionStop.setEnabled(True) + window.go() + + self.subwindows += window + + def aboutSlot(self): + qt.TQMessageBox.about(self, self.tr("About WebBrowser"), self.tr( +"""This Example has been created using the ActiveTQt integration into TQt Designer. +It demonstrates the use of TQAxWidget to embed the Internet Explorer ActiveX +control into a TQt application.""")) + + def aboutTQtSlot(self): + qt.TQMessageBox.aboutTQt(self, self.tr("About TQt")) + + +def main(args): + a = qt.TQApplication(args) + w = MainWindowImpl() + a.setMainWidget(w) + w.show() + + return a.exec_loop() + + +if __name__ == "__main__": + sys.exit(main(sys.argv)) diff --git a/examples/widgets.py b/examples/widgets.py new file mode 100755 index 0000000..fe36049 --- /dev/null +++ b/examples/widgets.py @@ -0,0 +1,500 @@ +#!/usr/bin/env python + + +import sys, string +from python_tqt.qt import * + +# +## Constructs an analog clock widget that uses an internal TQTimer. +# +def TQMIN( x, y ): + if y > x: + return y + return x + +# +## Constructs an analog clock widget that uses an internal TQTimer. +# + +class AnalogClock( TQWidget ): + def __init__( self, *args ): + TQWidget.__init__(*(self,) + args) + self.time = TQTime.currentTime() # get current time + internalTimer = TQTimer( self ) # create internal timer + self.connect( internalTimer, SIGNAL("timeout()"), self.timeout ) + internalTimer.start( 5000 ) # emit signal every 5 seconds + +# +## The TQTimer::timeout() signal is received by this slot. +# + + def timeout( self ): + new_time = TQTime.currentTime() # get the current time + if new_time.minute() != self.time.minute(): # minute has changed + self.update() + +# +## The clock is painted using a 1000x1000 square coordinate system. +# + def paintEvent( self, qe ): # paint clock + if not self.isVisible(): # is is invisible + return + self.time = TQTime.currentTime() # save current time + + pts = TQPointArray() + paint = TQPainter( self ) + paint.setBrush( self.foregroundColor() ) # fill with foreground color + + cp = TQPoint( self.rect().center() ) # widget center point + d = TQMIN( self.width(), self.height() ) # we want a circular clock + + matrix = TQWMatrix() # setup transformation matrix + matrix.translate( cp.x(), cp.y() ) # origin at widget center + matrix.scale( d / 1000.0, d / 1000.0 ) # scale coordinate system + + h_angle = 30 * ( self.time.hour() % 12 - 3 ) + self.time.minute() / 2 + matrix.rotate( h_angle ) # rotate to draw hour hand + paint.setWorldMatrix( matrix ) + pts.setPoints( [ -20,0, 0,-20, 300,0, 0,20 ] ) + paint.drawPolygon( pts ) # draw hour hand + matrix.rotate( -h_angle ) # rotate back to zero + + m_angle = ( self.time.minute() - 15 ) * 6 + matrix.rotate( m_angle ) # rotate to draw minute hand + paint.setWorldMatrix( matrix ) + pts.setPoints( [ -10,0, 0,-10, 400,0, 0,10 ] ) + paint.drawPolygon( pts ) # draw minute hand + matrix.rotate( -m_angle ) # rotate back to zero + + for i in range( 0, 12 ): # draw hour lines + paint.setWorldMatrix( matrix ) + paint.drawLine( 450,0, 500,0 ) + matrix.rotate( 30 ) + + +class DigitalClock( TQLCDNumber ): + def __init__( self, *args ): + TQLCDNumber.__init__(*(self,) + args) + self.showingColon = 0 + self.setFrameStyle(TQFrame.Panel | TQFrame.Raised) + self.setLineWidth( 2 ) + self.showTime() + self.normalTimer = self.startTimer( 500 ) + self.showDateTimer = -1 + + def timerEvent( self, e ): + if e.timerId() == self.showDateTimer: + self.stopDate() + else: + if self.showDateTimer == -1: + self.showTime() + + def mousePressEvent( self, e ): + if e.button() == TQt.LeftButton: + self.showDate() + + def showDate( self ): + if self.showDateTimer != -1: + return + d = TQDate.currentDate() + self.display('%2d %2d' % (d.month(), d.day())) + self.showDateTimer = self.startTimer(2000) + + def stopDate( self ): + self.killTimer(self.showDateTimer) + self.showDateTimer = -1 + self.showTime() + + def showTime( self ): + self.showingColon = not self.showingColon + s = list(str(TQTime.currentTime().toString())[:5]) #.left(5) + if not self.showingColon: + s[2] = ' ' + if s[0] == '0': + s[0] = ' ' + s = ''.join(s) + self.display( s ) + + def TQMIN( x, y ): + if y > x: + return y + return x + +TRUE = 1 +FALSE = 0 +MOVIEFILENAME = "trolltech.gif" + +# +# WidgetView contains lots of TQt widgets. +# + +class WidgetView ( TQWidget ): + def __init__( self, *args ): + TQWidget.__init__(*(self,) + args) + + # Set the window caption/title + self.setCaption( "TQt Widgets Demo Application" ) + + # Install an application-global event filter + tqApp.installEventFilter( self ) + + # Create a layout to position the widgets + self.topLayout = TQVBoxLayout( self, 10 ) + + # Create a grid layout to hold most of the widgets + self.grid = TQGridLayout( 6, 3 ) + + # This layout will get all of the stretch + self.topLayout.addLayout( self.grid, 10 ) + + # Create a menubar + self.menubar = TQMenuBar( self ) + self.menubar.setSeparator( TQMenuBar.InWindowsStyle ) + + # Create an easter egg + TQToolTip.add( self.menubar, TQRect( 0, 0, 2, 2 ), "easter egg" ) + + self.popup = TQPopupMenu() + self.id = self.popup.insertItem( "&New" ) + self.popup.setItemEnabled( self.id, FALSE ) + self.id = self.popup.insertItem( "&Open" ) + self.popup.setItemEnabled( self.id, FALSE ) + self.popup.insertSeparator() + self.popup.insertItem( "&Quit", tqApp, SLOT("quit()"), TQt.CTRL+TQt.Key_Q ) + + self.menubar.insertItem( "&File", self.popup ) + + # Must tell the layout about a menubar in a widget + self.topLayout.setMenuBar( self.menubar ) + + # Create an analog and a digital clock + self.aclock = AnalogClock( self ) + self.aclock.resize( 50, 50 ) + self.dclock = DigitalClock( self ) + self.dclock.setMaximumWidth( 200 ) + self.grid.addWidget( self.aclock, 0, 2 ) + self.grid.addWidget( self.dclock, 1, 2 ) + + # Give the dclock widget a blue palette + col = TQColor() + col.setRgb( 0xaa, 0xbe, 0xff ) + self.dclock.setPalette( TQPalette( col ) ) + + # make tool tips for both of them + TQToolTip.add( self.aclock, "custom widget: analog clock" ) + TQToolTip.add( self.dclock, "custom widget: digital clock" ) + + # Create a push button. + self.pb = TQPushButton( self, "button1" ) # create button 1 + self.pb.setText( "Push button 1" ) + self.pb.setFixedHeight( self.pb.sizeHint().height() ) + self.grid.addWidget( self.pb, 0, 0, TQt.AlignVCenter ) + self.connect( self.pb, SIGNAL("clicked()"), self.button1Clicked ) + TQToolTip.add( self.pb, "push button 1" ) + self.pm = TQPixmap() + self.pix = self.pm.load( "qt.png" ) # load pixmap for button 2 + if not self.pix: + TQMessageBox.information( None, "TQt Widgets Example", + "Could not load the file \"qt.png\", which\n" + "contains an icon used...\n\n" + "The text \"line 42\" will be substituted.", + TQMessageBox.Ok + TQMessageBox.Default ) + + # Create a label containing a TQMovie + self.movielabel = TQLabel( self, "label0" ) + self.movie = TQMovie( MOVIEFILENAME ) + self.movie.connectStatus( self.movieStatus ) + self.movie.connectUpdate( self.movieUpdate ) + self.movielabel.setFrameStyle( TQFrame.Box | TQFrame.Plain ) + self.movielabel.setMovie( self.movie ) + self.movielabel.setMargin( 0 ) + self.movielabel.setFixedSize( 128 + self.movielabel.frameWidth() * 2, + 64 + self.movielabel.frameWidth() * 2 ) + self.grid.addWidget( self.movielabel, 0, 1, TQt.AlignCenter ) + TQToolTip.add( self.movielabel, "movie" ) + + # Create a group of check boxes + self.bg = TQButtonGroup( self, "checkGroup" ) + self.bg.setTitle( "Check Boxes" ) + self.grid.addWidget( self.bg, 1, 0 ) + + # Create a layout for the check boxes + self.vbox = TQVBoxLayout(self.bg, 10) + + self.vbox.addSpacing( self.bg.fontMetrics().height() ) + + self.cb = list(range(3)) + self.cb[0] = TQCheckBox( self.bg ) + self.cb[0].setText( "Read" ) + self.vbox.addWidget( self.cb[0] ) + self.cb[0].setMinimumSize( self.cb[0].sizeHint() ) + self.cb[1] = TQCheckBox( self.bg ) + self.cb[1].setText( "Write" ) + self.vbox.addWidget( self.cb[1] ) + self.cb[1].setMinimumSize( self.cb[1].sizeHint() ) + self.cb[2] = TQCheckBox( self.bg ) + self.cb[2].setText( "Execute" ) + self.cb[2].setMinimumSize( self.cb[2].sizeHint() ) + self.vbox.addWidget( self.cb[2] ) + self.bg.setMinimumSize( self.bg.childrenRect().size() ) + self.vbox.activate() + + self.connect( self.bg, SIGNAL("clicked(int)"), self.checkBoxClicked ) + + TQToolTip.add( self.cb[0], "check box 1" ) + TQToolTip.add( self.cb[1], "check box 2" ) + TQToolTip.add( self.cb[2], "check box 3" ) + + # Create a group of radio buttons + self.bg = TQButtonGroup( self, "radioGroup" ) + self.bg.setTitle( "Radio buttons" ) + + self.grid.addWidget( self.bg, 1, 1 ) + + # Create a layout for the radio buttons + self.vbox = TQVBoxLayout( self.bg, 10 ) + + self.vbox.addSpacing( self.bg.fontMetrics().height() ) + self.rb = TQRadioButton( self.bg ) + self.rb.setText( "&AM" ) + self.rb.setChecked( TRUE ) + self.vbox.addWidget( self.rb ) + self.rb.setMinimumSize( self.rb.sizeHint() ) + TQToolTip.add( self.rb, "radio button 1" ) + self.rb = TQRadioButton( self.bg ) + self.rb.setText( "&FM" ) + self.vbox.addWidget( self.rb ) + self.rb.setMinimumSize( self.rb.sizeHint() ) + TQToolTip.add( self.rb, "radio button 2" ) + self.rb = TQRadioButton( self.bg ) + self.rb.setText( "&Short Wave" ) + self.vbox.addWidget( self.rb ) + self.rb.setMinimumSize( self.rb.sizeHint() ) + self.vbox.activate() + + self.connect( self.bg, SIGNAL("clicked(int)"), self.radioButtonClicked ) + TQToolTip.add( self.rb, "radio button 3" ) + + # Create a list box + self.lb = TQListBox( self, "listBox" ) + for i in range( 0, 100, 1 ): # fill list box + txt = TQString() + txt = "line %d" % i + if i == 42 and self.pix: + self.lb.insertItem( self.pm ) + else: + self.lb.insertItem( txt ) + + self.grid.addMultiCellWidget( self.lb, 2, 4, 0, 0 ) + self.connect( self.lb, SIGNAL("selected(int)"), self.listBoxItemSelected ) + TQToolTip.add( self.lb, "list box" ) + + self.vbox = TQVBoxLayout( 8 ) + self.grid.addLayout( self.vbox, 2, 1 ) + + # Create a slider + self.sb = TQSlider( 0, 300, 1, 100, TQSlider.Horizontal, self, "Slider" ) + self.sb.setTickmarks( TQSlider.Below ) + self.sb.setTickInterval( 10 ) + self.sb.setFocusPolicy( TQWidget.TabFocus ) + self.sb.setFixedHeight( self.sb.sizeHint().height() ) + self.vbox.addWidget( self.sb ) + + self.connect( self.sb, SIGNAL("valueChanged(int)"), self.sliderValueChanged ) + TQToolTip.add( self.sb, "slider" ) + + # Create a combo box + self.combo = TQComboBox( FALSE, self, "comboBox" ) + self.combo.insertItem( "darkBlue" ) + self.combo.insertItem( "darkRed" ) + self.combo.insertItem( "darkGreen" ) + self.combo.insertItem( "blue" ) + self.combo.insertItem( "red" ) + self.combo.setFixedHeight( self.combo.sizeHint().height() ) + self.vbox.addWidget( self.combo ) + self.connect( self.combo, SIGNAL("activated(int)"), self.comboBoxItemActivated ) + TQToolTip.add( self.combo, "read-only combo box" ) + + # Create an editable combo box + self.edCombo = TQComboBox( TRUE, self, "edComboBox" ) + self.edCombo.insertItem( "Permutable" ) + self.edCombo.insertItem( "Malleable" ) + self.edCombo.insertItem( "Adaptable" ) + self.edCombo.insertItem( "Alterable" ) + self.edCombo.insertItem( "Inconstant" ) + self.edCombo.setFixedHeight( self.edCombo.sizeHint().height() ) + self.vbox.addWidget( self.edCombo ) + self.connect( self.edCombo, SIGNAL("activated(const TQString &)"), self.edComboBoxItemActivated) + TQToolTip.add( self.edCombo, "editable combo box" ) + + self.edCombo.setAutoCompletion( TRUE ) + + self.vbox.addStretch( 1 ) + + self.vbox = TQVBoxLayout( 8 ) + self.grid.addLayout( self.vbox, 2, 2 ) + + # Create a spin box + self.spin = TQSpinBox( 0, 10, 1, self, "spin" ) + self.spin.setSuffix( " mm" ) + self.spin.setSpecialValueText( "Auto" ) + self.spin.setMinimumSize( self.spin.sizeHint() ) + self.connect( self.spin, SIGNAL( "valueChanged(const TQString &)" ), self.spinBoxValueChanged ) + TQToolTip.add( self.spin, "spin box" ) + self.vbox.addWidget( self.spin ) + + self.vbox.addStretch( 1 ) + + # Create a multi line edit + self.mle = TQMultiLineEdit( self, "multiLineEdit" ) + + self.grid.addMultiCellWidget( self.mle, 3, 3, 1, 2 ) + self.mle.setMinimumHeight( self.mle.fontMetrics().height() * 3 ) + self.mle.setText("This is a TQMultiLineEdit widget,\n" + "useful for small multi-line\n" + "input fields.") + TQToolTip.add( self.mle, "multi line editor" ) + + # Create a single line edit + self.le = TQLineEdit( self, "lineEdit" ) + self.grid.addMultiCellWidget( self.le, 4, 4, 1, 2 ) + self.le.setFixedHeight( self.le.sizeHint().height() ) + self.connect( self.le, SIGNAL("textChanged(const TQString &)"), self.lineEditTextChanged ) + TQToolTip.add( self.le, "single line editor" ) + + # Create a horizontal line (sort of TQFrame) above the message line + self.separator = TQFrame( self, "separatorLine" ) + self.separator.setFrameStyle( TQFrame.HLine | TQFrame.Sunken ) + self.separator.setFixedHeight( self.separator.sizeHint().height() ) + self.grid.addMultiCellWidget( self.separator, 5, 5, 0, 2 ) + TQToolTip.add( self.separator, "tool tips on a separator! wow!" ) + + self.grid.setRowStretch( 0, 0 ) + self.grid.setRowStretch( 1, 0 ) + self.grid.setRowStretch( 2, 0 ) + self.grid.setRowStretch( 3, 1 ) + self.grid.setRowStretch( 4, 1 ) + self.grid.setRowStretch( 5, 0 ) + + self.grid.setColStretch( 0, 1 ) + self.grid.setColStretch( 1, 1 ) + self.grid.setColStretch( 2, 1 ) + + # Create an label and a message in a plain widget + # The message is updated when buttons are clicked etc. + + self.hbox = TQHBoxLayout() + self.topLayout.addLayout( self.hbox ) + self.msgLabel = TQLabel( self, "msgLabel" ) + self.msgLabel.setText( "Message:" ) + self.msgLabel.setAlignment( TQt.AlignHCenter | TQt.AlignVCenter ) + self.msgLabel.setFixedSize( self.msgLabel.sizeHint() ) + self.hbox.addWidget( self.msgLabel ) + TQToolTip.add( self.msgLabel, "label 1" ) + + self.msg = TQLabel( self, "message" ) + self.msg.setFrameStyle( TQFrame.Panel | TQFrame.Sunken ) + self.msg.setAlignment( TQt.AlignCenter ) + self.msg.setFont( TQFont( "times", 12, TQFont.Bold ) ) + self.msg.setText( "Message" ) + self.msg.setFixedHeight( self.msg.sizeHint().height() ) + self.msg.setText( "" ) + self.hbox.addWidget( self.msg, 5 ) + TQToolTip.add( self.msg, "label 2" ) + + self.topLayout.activate() + + def setStatus(self, text): + self.msg.setText( text ) + + def movieUpdate( self, r ): + # Uncomment this to test animated icons on your window manager + self.setIcon( self.movie.framePixmap() ) + + def movieStatus( self, s ): + if s == TQMovie.SourceEmpty or s == TQMovie.UnrecognizedFormat: + pm = TQPixmap('tt-logo.png') + self.movielabel.setPixmap(pm) + self.movielabel.setFixedSize(pm.size()) + else: + if ( self.movielabel.movie() ): # for flicker-free animation: + self.movielabel.setBackgroundMode( TQWidget.NoBackground ) + + def button1Clicked( self ): + self.msg.setText( "The first push button was clicked" ) + + def checkBoxClicked( self, id ): + txt = "Check box %s clicked : " % str(id) + chk = ["-","-","-"] + if self.cb[0].isChecked(): + chk[0] = "r" + if self.cb[1].isChecked(): + chk[1] = "w" + if self.cb[2].isChecked(): + chk[2] = "x" + txt = txt + str(chk[0]+chk[1]+chk[2]) + self.msg.setText( txt ) + + def edComboBoxItemActivated( self, text): + self.msg.setText( "Editable Combo Box set to %s" % text ) + + def radioButtonClicked( self, id ): + self.msg.setText( "Radio button #%d clicked" % id ) + + def listBoxItemSelected( self, index ): + self.msg.setText( "List box item %d selected" % index ) + + def sliderValueChanged( self, value ): + self.msg.setText( "Movie set to %d%% of normal speed" % value ) + self.movie.setSpeed( value ) + + def comboBoxItemActivated( self, index ): + self.msg.setText( "Combo box item %d activated" % index ) + p = TQApplication.palette() + if index == 0: + p.setColor( TQColorGroup.Highlight, TQt.darkBlue ) + elif index == 1: + p.setColor( TQColorGroup.Highlight, TQt.darkRed ) + elif index == 2: + p.setColor( TQColorGroup.Highlight, TQt.darkGreen ) + elif index == 3: + p.setColor( TQColorGroup.Highlight, TQt.blue ) + elif index == 4: + p.setColor( TQColorGroup.Highlight, TQt.red ) + TQApplication.setPalette( p, TRUE ) + + def lineEditTextChanged( self, newText ): + self.msg.setText("Line edit text: " + str(newText)) + + def spinBoxValueChanged( self, valueText ): + self.msg.setText("Spin box value: " + str(valueText)) + + # All application events are passed throught this event filter. + # We're using it to display some information about a clicked + # widget (right mouse button + CTRL). + #def eventFilter( self, event ): + # identify_now = TRUE + # if event.type() == Event_MouseButtonPress and identify_now: + # e = TQMouseEvent( event ) + # if (e.button() == TQt.RightButton) and (e.state() & TQt.ControlButton) != 0: + # txt = TQString( "The clicked widget is a\n" ) + # txt = txt + TQObect.className() + # txt = txt + "\nThe widget's name is\n" + # if TQObject.name(): + # txt = txt + TQObject.name() + # else: + # txt = txt + "" + # identify_now = FALSE # don't do it in message box + # TQMessageBox.message( "Identify Widget", txt, 0, TQObject ) + # identify_now = TRUE; # allow it again + # return FALSE # don't eat event + +################################################################################################ + +#TQApplication.setColourSpec( TQApplication.CustomColor ) +a = TQApplication( sys.argv ) + +w = WidgetView() +a.setMainWidget( w ) +w.show() +a.exec_loop() diff --git a/examples2/README b/examples2/README deleted file mode 100644 index a337e9b..0000000 --- a/examples2/README +++ /dev/null @@ -1,11 +0,0 @@ -To run these examples, make sure you have your PYTHONPATH environment variable -set if needed and explicitly set the path to python at the top of each script -if you don't have /usr/bin/env. - -The examples are written for TQt v2.x. - -A much better source of information about using PyTQt is Boudewijn Rempt's -book at http://stage.linuxports.com/projects/pyqt/. - -Phil Thompson -phil@riverbankcomputing.co.uk diff --git a/examples2/aclock.py b/examples2/aclock.py deleted file mode 100755 index 66283ef..0000000 --- a/examples2/aclock.py +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env python - -import sys -from python_tqt.qt import * - -def TQMIN(x, y): - if y > x: return y - return x -class AnalogClock(TQWidget): - def __init__(self, *args): - TQWidget.__init__(*(self,) + args) - self.time = TQTime.currentTime() - internalTimer = TQTimer(self) - self.connect(internalTimer, SIGNAL("timeout()"), self.timeout) - internalTimer.start(5000) - - def timeout(self): - new_time = TQTime.currentTime() - if new_time.minute() != self.time.minute(): - self.update() - - def paintEvent(self, qe): - if not self.isVisible(): - return - self.time = TQTime.currentTime() - - pts = TQPointArray() - paint = TQPainter(self) - paint.setBrush(self.foregroundColor()) - - cp = TQPoint(self.rect().center()) - d = TQMIN(self.width(), self.height()) - matrix = TQWMatrix() - matrix.translate(cp.x(), cp.y()) - matrix.scale(d/1000.0, d/1000.0) - - h_angle = 30*(self.time.hour()%12 - 3) + self.time.minute()/2 - matrix.rotate(h_angle) - paint.setWorldMatrix(matrix) - pts.setPoints([-20,0,0,-20,300,0,0,20]) - paint.drawPolygon(pts) - matrix.rotate(-h_angle) - - m_angle = (self.time.minute()-15)*6 - matrix.rotate(m_angle) - paint.setWorldMatrix(matrix) - pts.setPoints([-10,0,0,-10,400,0,0,10]) - paint.drawPolygon(pts) - matrix.rotate(-m_angle) - - for i in range(0,12): - paint.setWorldMatrix(matrix) - paint.drawLine(450,0, 500,0) - matrix.rotate(30) - -a = TQApplication(sys.argv) -clock = AnalogClock() -clock.resize(100,100) -a.setMainWidget(clock) -clock.show() -a.exec_loop() diff --git a/examples2/addressbook.py b/examples2/addressbook.py deleted file mode 100755 index 14b5679..0000000 --- a/examples2/addressbook.py +++ /dev/null @@ -1,457 +0,0 @@ -#!/usr/bin/env python - -# A port to PyTQt of the application example from TQt v2.x. - - -import sys, string -from python_tqt.qt import * - -TRUE = 1 -FALSE = 0 -fileopen = [ -' 16 13 5 1', -'. c #040404', -'# c #808304', -'a c None', -'b c #f3f704', -'c c #f3f7f3', -'aaaaaaaaa...aaaa', -'aaaaaaaa.aaa.a.a', -'aaaaaaaaaaaaa..a', -'a...aaaaaaaa...a', -'.bcb.......aaaaa', -'.cbcbcbcbc.aaaaa', -'.bcbcbcbcb.aaaaa', -'.cbcb...........', -'.bcb.#########.a', -'.cb.#########.aa', -'.b.#########.aaa', -'..#########.aaaa', -'...........aaaaa' -] - -filesave = [ -' 14 14 4 1', -'. c #040404', -'# c #808304', -'a c #bfc2bf', -'b c None', -'..............', -'.#.aaaaaaaa.a.', -'.#.aaaaaaaa...', -'.#.aaaaaaaa.#.', -'.#.aaaaaaaa.#.', -'.#.aaaaaaaa.#.', -'.#.aaaaaaaa.#.', -'.##........##.', -'.############.', -'.##.........#.', -'.##......aa.#.', -'.##......aa.#.', -'.##......aa.#.', -'b.............' -] - -fileprint = [ -' 16 14 6 1', -'. c #000000', -'# c #848284', -'a c #c6c3c6', -'b c #ffff00', -'c c #ffffff', -'d c None', -'ddddd.........dd', -'dddd.cccccccc.dd', -'dddd.c.....c.ddd', -'ddd.cccccccc.ddd', -'ddd.c.....c....d', -'dd.cccccccc.a.a.', -'d..........a.a..', -'.aaaaaaaaaa.a.a.', -'.............aa.', -'.aaaaaa###aa.a.d', -'.aaaaaabbbaa...d', -'.............a.d', -'d.aaaaaaaaa.a.dd', -'dd...........ddd' -] - -class ABCentralWidget( TQWidget ): - def __init__( self, *args ): - TQWidget.__init__(*(self, ) + args) - self.mainGrid = TQGridLayout( self, 2, 1, 5, 5 ) - - self.setupTabWidget() - self.setupListView() - - self.mainGrid.setRowStretch( 0, 0 ) - self.mainGrid.setRowStretch( 1, 1 ) - - def save( self, filename ): - if not self.listView.firstChild(): - return - - f = TQFile( filename ) - if not f.open( IO_WriteOnly ): - return - - t = TQTextStream( f ) - - #it = TQListViewItemIterator( self.listView ) - - while not t.eof(): - item = TQListViewItem( self.listView ) - for i in range (0, 4): - t << item.text( i ) << '\n' - #for it in it.current(): - #for i in range (0, 4): - #t << it.current().text[ i ] << "\n" - - f.close() - - - def load( self, filename ): - self.listView.clear() - - f = TQFile( filename ) - if not f.open( IO_ReadOnly ): - return - - t = TQTextStream( f ) - - while not t.eof(): - item = TQListViewItem( self.listView ) - for i in range (0, 4): - item.setText( i, t.readLine() ) - - f.close(); - - - def setupTabWidget( self ): - self.tabWidget = TQTabWidget( self ) - - self.input = TQWidget( self.tabWidget ) - self.grid1 = TQGridLayout( self.input, 2, 5, 5, 5 ) - - self.liFirstName = TQLabel( 'First &Name', self.input ) - self.liFirstName.resize( self.liFirstName.sizeHint() ) - self.grid1.addWidget( self.liFirstName, 0, 0 ) - - self.liLastName = TQLabel( '&Last Name', self.input ) - self.liLastName.resize( self.liLastName.sizeHint() ) - self.grid1.addWidget( self.liLastName, 0, 1 ) - - self.liAddress = TQLabel( '&Address', self.input ) - self.liAddress.resize( self.liAddress.sizeHint() ) - self.grid1.addWidget( self.liAddress, 0, 2 ) - - self.liEMail = TQLabel( '&E-Mail', self.input ) - self.liEMail.resize( self.liEMail.sizeHint() ) - self.grid1.addWidget( self.liEMail, 0, 3 ) - - self.add = TQPushButton( '&Add', self.input ) - self.add.resize( self.add.sizeHint() ) - self.grid1.addWidget( self.add, 0, 4 ) - self.connect( self.add, SIGNAL( 'clicked()' ), self.addEntry ) - - self.iFirstName = TQLineEdit( self.input ) - self.iFirstName.resize( self.iFirstName.sizeHint() ) - self.grid1.addWidget( self.iFirstName, 1, 0 ) - self.liFirstName.setBuddy( self.iFirstName ) - - self.iLastName = TQLineEdit( self.input ) - self.iLastName.resize( self.iLastName.sizeHint() ) - self.grid1.addWidget( self.iLastName, 1, 1 ) - self.liLastName.setBuddy( self.iLastName ) - - self.iAddress = TQLineEdit( self.input ) - self.iAddress.resize( self.iAddress.sizeHint() ) - self.grid1.addWidget( self.iAddress, 1, 2 ) - self.liAddress.setBuddy( self.iAddress ) - - self.iEMail = TQLineEdit( self.input ) - self.iEMail.resize( self.iEMail.sizeHint() ) - self.grid1.addWidget( self.iEMail, 1, 3 ) - self.liEMail.setBuddy( self.iEMail ) - - self.change = TQPushButton( '&Change', self.input ) - self.change.resize( self.change.sizeHint() ) - self.grid1.addWidget( self.change, 1, 4 ) - self.connect( self.change, SIGNAL( 'clicked()' ), self.changeEntry ) - - self.tabWidget.addTab( self.input, '&Add/Change Entry' ) - - # -------------------------------------- - - self.search = TQWidget( self ) - self.grid2 = TQGridLayout( self.search, 2, 5, 5, 5 ) - - self.cFirstName = TQCheckBox( 'First &Name', self.search ) - self.cFirstName.resize( self.cFirstName.sizeHint() ) - self.grid2.addWidget( self.cFirstName, 0, 0 ) - self.connect( self.cFirstName, SIGNAL( 'clicked()' ), self.toggleFirstName ) - - self.cLastName = TQCheckBox( '&Last Name', self.search ) - self.cLastName.resize( self.cLastName.sizeHint() ) - self.grid2.addWidget( self.cLastName, 0, 1 ) - self.connect( self.cLastName, SIGNAL( 'clicked()' ), self.toggleLastName ) - - self.cAddress = TQCheckBox( '&Address', self.search ) - self.cAddress.resize( self.cAddress.sizeHint() ) - self.grid2.addWidget( self.cAddress, 0, 2 ) - self.connect( self.cAddress, SIGNAL( 'clicked()' ), self.toggleAddress ) - - self.cEMail = TQCheckBox( '&E-Mail', self.search ) - self.cEMail.resize( self.cEMail.sizeHint() ) - self.grid2.addWidget( self.cEMail, 0, 3 ) - self.connect( self.cEMail, SIGNAL( 'clicked()' ), self.toggleEMail ) - - self.sFirstName = TQLineEdit( self.search ) - self.sFirstName.resize( self.sFirstName.sizeHint() ) - self.grid2.addWidget( self.sFirstName, 1, 0 ) - - self.sLastName = TQLineEdit( self.search ) - self.sLastName.resize( self.sLastName.sizeHint() ) - self.grid2.addWidget( self.sLastName, 1, 1 ) - - self.sAddress = TQLineEdit( self.search ) - self.sAddress.resize( self.sAddress.sizeHint() ) - self.grid2.addWidget( self.sAddress, 1, 2 ) - - self.sEMail = TQLineEdit( self.search ) - self.sEMail.resize( self.sEMail.sizeHint() ) - self.grid2.addWidget( self.sEMail, 1, 3 ) - - self.find = TQPushButton( '&Find', self.search ) - self.find.resize( self.find.sizeHint() ) - self.grid2.addWidget( self.find, 1, 4 ) - self.connect( self.find, SIGNAL( 'clicked()' ), self.findEntries ) - - self.cFirstName.setChecked( TRUE ) - self.sFirstName.setEnabled( TRUE ) - self.sLastName.setEnabled( FALSE ) - self.sAddress.setEnabled( FALSE ) - self.sEMail.setEnabled( FALSE ) - - self.tabWidget.addTab( self.search, "&Search" ) - - self.mainGrid.addWidget( self.tabWidget, 0, 0 ) - - def setupListView( self ): - self.listView = TQListView( self ) - self.listView.addColumn( 'First Name' ) - self.listView.addColumn( 'Last Name' ) - self.listView.addColumn( 'Address' ) - self.listView.addColumn( 'E-Mail' ) - - self.listView.setSelectionMode( TQListView.Extended ) - - self.connect( self.listView, SIGNAL( 'clicked( TQListViewItem* )' ), self.itemSelected ) - - self.mainGrid.addWidget( self.listView, 1, 0 ) - self.listView.setAllColumnsShowFocus( TRUE ) - - - def addEntry( self ): - if not self.iFirstName.text().isEmpty() or not self.iLastName.text().isEmpty() or \ - not self.iAddress.text().isEmpty() or not self.iEMail.text().isEmpty() : - self.item = TQListViewItem( self.listView ) - self.item.setText( 0, self.iFirstName.text() ) - self.item.setText( 1, self.iLastName.text() ) - self.item.setText( 2, self.iAddress.text() ) - self.item.setText( 3, self.iEMail.text() ) - - self.iFirstName.setText( '' ) - self.iLastName.setText( '' ) - self.iAddress.setText( '' ) - self.iEMail.setText( '' ) - - def changeEntry( self ): - self.item = self.listView.currentItem() - if self.item and ( not self.iFirstName.text().isEmpty() or not self.iLastName.text().isEmpty() or \ - not self.iAddress.text().isEmpty() or not self.iEMail.text().isEmpty() ) : - self.item.setText( 0, self.iFirstName.text() ) - self.item.setText( 1, self.iLastName.text() ) - self.item.setText( 2, self.iAddress.text() ) - self.item.setText( 3, self.iEMail.text() ) - - def selectionChanged( self ): - self.iFirstName.setText( '' ) - self.iLastName.setText( '' ) - self.iAddress.setText( '' ) - self.iEMail.setText( '' ) - - def itemSelected( self, item ): - self.item.setSelected( TRUE ) - self.item.repaint() - - self.iFirstName.setText( item.text( 0 ) ) - self.iLastName.setText( item.text( 1 ) ) - self.iAddress.setText( item.text( 2 ) ) - self.iEMail.setText( item.text( 3 ) ) - - def toggleFirstName( self ): - self.sFirstName.setText( '' ) - if self.cFirstName.isChecked(): - self.sFirstName.setEnabled( TRUE ) - self.sFirstName.setFocus() - else: - self.sFirstName.setEnabled( FALSE ) - - def toggleLastName( self ): - self.sLastName.setText( '' ) - if self.cLastName.isChecked(): - self.sLastName.setEnabled( TRUE ) - self.sLastName.setFocus() - else: - self.sLastName.setEnabled( FALSE ) - - - def toggleAddress( self ): - self.sAddress.setText( '' ) - if self.cAddress.isChecked(): - self.sAddress.setEnabled( TRUE ) - self.sAddress.setFocus() - else: - self.sAddress.setEnabled( FALSE ) - - - def toggleEMail( self ): - self.sEMail.setText( '' ) - if self.cEMail.isChecked(): - self.sEMail.setEnabled( TRUE ) - self.sEMail.setFocus() - - else: - self.sEMail.setEnabled( FALSE ) - - - def findEntries( self ): - if not self.cFirstName.isChecked() and not self.cLastName.isChecked() and \ - not self.cAddress.isChecked() and not self.cEMail.isChecked(): - self.listView.clearSelection() - return - - it = TQListViewItemIterator( self.listView ) - - for it in it.current() : - select = TRUE - - if self.cFirstName.isChecked(): - if select and it.current().text( 0 ).contains( self.sFirstName.text() ): - select = TRUE - else: - select = FALSE - - if self.cLastName.isChecked(): - if select and it.current().text( 1 ).contains( self.sLastName.text() ): - select = TRUE - else: - select = FALSE - - if self.cAddress.isChecked(): - if select and it.current().text( 2 ).contains( self.sAddress.text() ): - select = TRUE - else: - select = FALSE - - if self.cEMail.isChecked(): - if select and it.current().text( 3 ).contains( self.sEMail.text() ): - select = TRUE - else: - select = FALSE - - - if select: - it.current().setSelected( TRUE ) - else: - it.current().setSelected( FALSE ) - it.current().repaint() - - -class ABMainWindow(TQMainWindow): - def __init__( self ): - TQMainWindow.__init__( self, None, 'example addressbook application' ) - - self.filename = TQString.null - self.setupMenuBar() - self.setupFileTools() - self.setupStatusBar() - self.setupCentralWidget() - - def setupMenuBar( self ): - self.file = TQPopupMenu( self ) - self.menuBar().insertItem( '&File', self.file ) - - openIcon = TQIconSet( TQPixmap( fileopen ) ) - self.file.insertItem( 'New', self.fileNew, TQt.CTRL + TQt.Key_N ) - self.file.insertItem( openIcon, 'Open', self.fileOpen, TQt.CTRL + TQt.Key_O ) - self.file.insertSeparator() - saveIcon = TQIconSet( TQPixmap( filesave ) ) - self.file.insertItem( saveIcon, 'Save', self.fileSave, TQt.CTRL + TQt.Key_S ) - self.file.insertItem( 'Save As...', self.fileSaveAs ) - self.file.insertSeparator() - printIcon = TQIconSet( TQPixmap( fileprint ) ) - self.file.insertItem( printIcon, 'Print...', self.filePrint, TQt.CTRL + TQt.Key_P ) - self.file.insertSeparator() - #self.file.insertItem( 'Close', self.closeWindow, TQt.CTRL + TQt.Key_W ) - self.file.insertItem('Close', self, SLOT('close()'), TQt.CTRL+TQt.Key_W) - self.file.insertItem( 'Quit', tqApp, SLOT( 'quit()' ), TQt.CTRL + TQt.Key_Q ) - - def setupFileTools( self ): - pass - #self.fileTools = TQToolBar( self, 'file operations' ) - - def setupStatusBar( self ): - self.statusBar().message( "Ready", 2000 ) - - def setupCentralWidget( self ): - self.view = ABCentralWidget( self ) - #self.view.show() - self.setCentralWidget( self.view ) - - def closeWindow( self ): - close() - - - def fileNew( self ): - pass - - def fileOpen( self ): - fn = TQFileDialog.getOpenFileName( TQString.null, TQString.null, self ) - if not fn.isEmpty(): - self.filename = fn - self.view.load( self.filename ) - - def fileSave( self ): - if self.filename.isEmpty(): - self.fileSaveAs() - return - - self.view.save( self.filename ) - - def fileSaveAs( self ): - fn = TQFileDialog.getSaveFileName( TQString.null, TQString.null, self ) - if not fn.isEmpty(): - self.filename = fn - self.fileSave - - def filePrint( self ): - pass - - -a = TQApplication( sys.argv ) - -mw = ABMainWindow() -#mw.setupMenuBar() -#mw.setupFileTools -#mw.setupStatusBar -#mw.setupCentralWidget -#view = ABCentralWidget() -#mw.setCentralWidget( view ) -mw.setCaption( 'Addressbook 1' ) -a.setMainWidget( mw ) -mw.show() - -a.connect( a, SIGNAL( 'lastWindowClosed()' ), a, SLOT( 'quit()' ) ) -a.exec_loop() diff --git a/examples2/application.py b/examples2/application.py deleted file mode 100755 index 38a6cf5..0000000 --- a/examples2/application.py +++ /dev/null @@ -1,277 +0,0 @@ -#!/usr/bin/env python - -# A simple application. - - -import sys, string -from python_tqt.qt import * - - -fileopen = [ - '16 13 5 1', - '. c #040404', - '# c #808304', - 'a c None', - 'b c #f3f704', - 'c c #f3f7f3', - 'aaaaaaaaa...aaaa', - 'aaaaaaaa.aaa.a.a', - 'aaaaaaaaaaaaa..a', - 'a...aaaaaaaa...a', - '.bcb.......aaaaa', - '.cbcbcbcbc.aaaaa', - '.bcbcbcbcb.aaaaa', - '.cbcb...........', - '.bcb.#########.a', - '.cb.#########.aa', - '.b.#########.aaa', - '..#########.aaaa', - '...........aaaaa' -] - -filesave = [ - '14 14 4 1', - '. c #040404', - '# c #808304', - 'a c #bfc2bf', - 'b c None', - '..............', - '.#.aaaaaaaa.a.', - '.#.aaaaaaaa...', - '.#.aaaaaaaa.#.', - '.#.aaaaaaaa.#.', - '.#.aaaaaaaa.#.', - '.#.aaaaaaaa.#.', - '.##........##.', - '.############.', - '.##.........#.', - '.##......aa.#.', - '.##......aa.#.', - '.##......aa.#.', - 'b.............' -] - -fileprint = [ - '16 14 6 1', - '. c #000000', - '# c #848284', - 'a c #c6c3c6', - 'b c #ffff00', - 'c c #ffffff', - 'd c None', - 'ddddd.........dd', - 'dddd.cccccccc.dd', - 'dddd.c.....c.ddd', - 'ddd.cccccccc.ddd', - 'ddd.c.....c....d', - 'dd.cccccccc.a.a.', - 'd..........a.a..', - '.aaaaaaaaaa.a.a.', - '.............aa.', - '.aaaaaa###aa.a.d', - '.aaaaaabbbaa...d', - '.............a.d', - 'd.aaaaaaaaa.a.dd', - 'dd...........ddd' -] - - -fileOpenText = \ -''' -Click this button to open a new file.

-You can also select the Open command from the File menu.''' - -fileSaveText = \ -'''Click this button to save the file you are editing.

-You will be prompted for a filename.

-You can also select the Save command from the File menu.''' - -filePrintText = \ -'''Click this button to print the file you are editing.

-You can also select the Print command from the File menu.''' - - -editorList = [] - - -class ApplicationWindow(TQMainWindow): - def __init__(self): - TQMainWindow.__init__(self,None,'example application main window',TQt.WDestructiveClose) - - self.filename = TQString.null - self.printer = TQPrinter() - - self.fileTools = TQToolBar(self,'file operations') - - openIcon = TQPixmap(fileopen) - self.fileOpen = TQToolButton(TQIconSet(openIcon),'Open File',TQString.null,self.load,self.fileTools,'open file') - - saveIcon = TQPixmap(filesave) - self.fileSave = TQToolButton(TQIconSet(saveIcon),'Save File',TQString.null,self.save,self.fileTools,'save file') - - printIcon = TQPixmap(fileprint) - self.filePrint = TQToolButton(TQIconSet(printIcon),'Print File',TQString.null,self.printDoc,self.fileTools,'print file') - - TQWhatsThis.whatsThisButton(self.fileTools) - - TQWhatsThis.add(self.fileOpen,fileOpenText) - TQMimeSourceFactory.defaultFactory().setPixmap('fileopen',openIcon) - TQWhatsThis.add(self.fileSave,fileSaveText) - TQWhatsThis.add(self.filePrint,filePrintText) - - self.file = TQPopupMenu(self) - self.menuBar().insertItem('&File',self.file) - - self.file.insertItem('&New',self.newDoc,TQt.CTRL + TQt.Key_N) - - id = self.file.insertItem(TQIconSet(openIcon),'&Open',self.load,TQt.CTRL + TQt.Key_O) - self.file.setWhatsThis(id,fileOpenText) - - id = self.file.insertItem(TQIconSet(saveIcon),'&Save',self.save,TQt.CTRL + TQt.Key_S) - self.file.setWhatsThis(id,fileSaveText) - - id = self.file.insertItem('Save &as',self.saveAs) - self.file.setWhatsThis(id,fileSaveText) - - self.file.insertSeparator() - - id = self.file.insertItem(TQIconSet(printIcon),'&Print',self.printDoc,TQt.CTRL + TQt.Key_P) - self.file.setWhatsThis(id,filePrintText) - - self.file.insertSeparator() - - self.file.insertItem('&Close',self,SLOT('close()'),TQt.CTRL + TQt.Key_W) - self.file.insertItem('&Quit',tqApp,SLOT('closeAllWindows()'),TQt.CTRL + TQt.Key_Q) - - self.help = TQPopupMenu(self) - self.menuBar().insertSeparator() - self.menuBar().insertItem('&Help',self.help) - - self.help.insertItem('&About',self.about,TQt.Key_F1) - self.help.insertItem('About &TQt',self.aboutTQt) - - self.e = TQMultiLineEdit(self,'editor') - self.e.setFocus() - self.setCentralWidget(self.e) - - self.statusBar().message('Ready',2000) - self.resize(450,600) - - def newDoc(self): - ed = ApplicationWindow() - ed.show() - editorList.append(ed) - - def load(self): - fn = TQFileDialog.getOpenFileName(TQString.null,TQString.null,self) - if fn.isEmpty(): - self.statusBar().message('Loading aborted',2000) - return - - fileName = str(fn) - - self.e.setAutoUpdate(0) - self.e.clear() - - try: - f = open(fileName,'r') - except: - return - - for l in f.readlines(): - self.e.append(l.rstrip()) - - f.close() - - self.e.setAutoUpdate(1) - self.e.repaint() - self.e.setEdited(0) - self.setCaption(fileName) - self.statusBar().message('Loaded document %s' % (fileName),2000) - - def save(self): - if self.filename.isEmpty(): - self.saveAs() - return - - try: - f = open(str(self.filename),'w+') - except: - self.statusBar().message('Could not write to %s' % (self.filename),2000) - return - - f.write(str(self.e.text())) - f.close() - - self.e.setEdited(0) - self.setCaption(self.filename) - self.statusBar().message('File %s saved' % (self.filename),2000) - - def saveAs(self): - fn = TQFileDialog.getSaveFileName(TQString.null,TQString.null,self) - if not fn.isEmpty(): - self.filename = fn - self.save() - else: - self.statusBar().message('Saving aborted',2000) - - def printDoc(self): - Margin = 10 - pageNo = 1 - - if self.printer.setup(self): - self.statusBar().message('Printing...') - - p = TQPainter() - p.begin(self.printer) - p.setFont(self.e.font()) - yPos = 0 - fm = p.fontMetrics() - metrics = TQPaintDeviceMetrics(self.printer) - - for i in range(self.e.numLines): - if Margin + yPos > metrics.height() - Margin: - pageNo = pageNo + 1 - self.statusBar().message('Printing (page %d)...' % (pageNo)) - self.printer.newPage() - yPos = 0 - - p.drawText(Margin,Margin + yPos,metrics.width(),fm.lineSpacing(),TQt.ExpandTabs | TQt.DontClip,self.e.textLine(i)) - yPos = yPos + fm.lineSpacing() - - p.end() - self.statusBar().message('Printing completed',2000) - else: - self.statusBar().message('Printing aborted',2000) - - def closeEvent(self,ce): - if not self.e.edited(): - ce.accept() - return - - rc = TQMessageBox.information(self,'TQt Application Example', - 'The document has been changed since the last save.', - 'Save Now','Cancel','Leave Anyway',0,1) - - if rc == 0: - self.save() - ce.accept() - elif rc == 2: - ce.accept() - else: - ce.ignore() - - def about(self): - TQMessageBox.about(self,'TQt Application Example', - 'This example demonstrates simple use of TQMainWindow,\nTQMenuBar and TQToolBar.') - - def aboutTQt(self): - TQMessageBox.aboutTQt(self,'TQt Application Example') - - -a = TQApplication(sys.argv) -mw = ApplicationWindow() -mw.setCaption('Document 1') -mw.show() -a.connect(a, SIGNAL('lastWindowClosed()'), a, SLOT('quit()')) -a.exec_loop() diff --git a/examples2/buttongroups.py b/examples2/buttongroups.py deleted file mode 100755 index d3e0aaf..0000000 --- a/examples2/buttongroups.py +++ /dev/null @@ -1,113 +0,0 @@ -#!/usr/bin/env python -#/**************************************************************************** -#** $Id: buttongroups.py,v 1.1.1.1 2002/06/04 23:04:42 phil Exp $ -#** -#** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. -#** -#** This file is part of an example program for TQt. This example -#** program may be used, distributed and modified without limitation. -#** -#*****************************************************************************/ - -import sys -from python_tqt.qt import * - -TRUE = 1 -FALSE = 0 - -## -# Creates all child widgets of the ButtonGroups window -## - -class ButtonsGroups( TQWidget ): - def __init__( self, *args ): - TQWidget.__init__(*(self,) + args) - - # Create Widgets which allow easy layouting - self.vbox = TQVBoxLayout( self ) - self.box1 = TQHBoxLayout( self.vbox ) - self.box2 = TQHBoxLayout( self.vbox ) - - # ------- first group - - # Create an exclusive button group - self.grp1 = TQButtonGroup( 1, TQGroupBox.Horizontal, "Button Group 1 (exclusive)", self ) - self.box1.addWidget( self.grp1 ) - self.grp1.setExclusive( TRUE ) - - # insert 3 radiobuttons - self.rb11 = TQRadioButton( "&Radiobutton 1", self.grp1 ) - self.rb11.setChecked( TRUE ) - TQRadioButton( "R&adiobutton 2", self.grp1 ) - TQRadioButton( "Ra&diobutton 3", self.grp1 ) - - # ------- second group - - # Create a non-exclusive buttongroup - self.grp2 = TQButtonGroup( 1, TQGroupBox.Horizontal, "Button Group 2 (non-exclusive)", self ) - self.box1.addWidget( self.grp2 ) - self.grp2.setExclusive( FALSE ) - - # insert 3 checkboxes - TQCheckBox( "&Checkbox 1", self.grp2 ) - self.cb12 = TQCheckBox( "C&heckbox 2", self.grp2 ) - self.cb12.setChecked( TRUE ) - self.cb13 = TQCheckBox( "Triple &State Button", self.grp2 ) - self.cb13.setTristate( TRUE ) - self.cb13.setChecked( TRUE ) - - # ------------ third group - - # create a buttongroup which is exclusive for radiobuttons and non-exclusive for all other buttons - self.grp3 = TQButtonGroup( 1, TQGroupBox.Horizontal, "Button Group 3 (Radiobutton-exclusive)", self ) - self.box2.addWidget( self.grp3 ) - self.grp3.setRadioButtonExclusive( TRUE ) - - # insert three radiobuttons - self.rb21 = TQRadioButton( "Rad&iobutton 1", self.grp3 ) - self.rb22 = TQRadioButton( "Radi&obutton 2", self.grp3 ) - self.rb23 = TQRadioButton( "Radio&button 3", self.grp3 ) - self.rb23.setChecked( TRUE ) - - # insert a checkbox... - self.state = TQCheckBox( "E&nable Radiobuttons", self.grp3 ) - self.state.setChecked( TRUE ) - # ...and connect its SIGNAL clicked() with the SLOT slotChangeGrp3State() - self.connect( self.state, SIGNAL( "clicked()" ), self.slotChangeGrp3State ) - - # ------------ fourth group - - # create a groupbox which layouts its childs in a columns - self.grp4 = TQButtonGroup( 1, TQGroupBox.Horizontal, "Groupbox with normal buttons", self ) - self.box2.addWidget( self.grp4 ) - - # insert two pushbuttons... - TQPushButton( "&Push Button", self.grp4 ) - self.tb = TQPushButton( "&Toggle Button", self.grp4 ) - - # ... and make the second one a toggle button - self.tb.setToggleButton( TRUE ) - self.tb.setOn( TRUE ) - - - # - # SLOT slotChangeGrp3State() - # enables/disables the radiobuttons of the third buttongroup - # - - def slotChangeGrp3State( self ): - self.rb21.setEnabled( self.state.isChecked() ) - self.rb22.setEnabled( self.state.isChecked() ) - self.rb23.setEnabled( self.state.isChecked() ) - - -## main program -a = TQApplication( sys.argv ) - -buttonsgroups = ButtonsGroups() -buttonsgroups.resize( 500, 250 ) -buttonsgroups.setCaption( "Examples for Buttons and Groups" ) -a.setMainWidget( buttonsgroups ) -buttonsgroups.show() - -a.exec_loop() diff --git a/examples2/dclock.py b/examples2/dclock.py deleted file mode 100755 index 302d454..0000000 --- a/examples2/dclock.py +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env python - -# A port to PyTQt of the dclock example from TQt v2.x. - - -import sys, string -from python_tqt.qt import * - - -class DigitalClock(TQLCDNumber): - def __init__(self, parent=None, name=None): - TQLCDNumber.__init__(self, parent, name) - self.showingColon = 0 - self.setFrameStyle(TQFrame.Panel | TQFrame.Raised) - self.setLineWidth(2) - self.showTime() - self.normalTimer = self.startTimer(500) - self.showDateTimer = -1 - - def timerEvent(self, e): - if e.timerId() == self.showDateTimer: - self.stopDate() - else: - if self.showDateTimer == -1: - self.showTime() - - def mousePressEvent(self, e): - if e.button() == TQt.LeftButton: - self.showDate() - - def showDate(self): - if self.showDateTimer != -1: - return - d = TQDate.currentDate() - self.display('%2d %2d' % (d.month(), d.day())) - self.showDateTimer = self.startTimer(2000) - - def stopDate(self): - self.killTimer(self.showDateTimer) - self.showDateTimer = -1 - self.showTime() - - def showTime(self): - self.showingColon = not self.showingColon - s = list(str(TQTime.currentTime().toString())[:5]) #.left(5) - if not self.showingColon: - s[2] = ' ' - if s[0] == '0': - s[0] = ' ' - s = ''.join(s) - self.display(s) - -a = TQApplication(sys.argv) -clock = DigitalClock() -clock.resize(170,80) -a.setMainWidget(clock) -clock.show() -a.exec_loop() diff --git a/examples2/desktop.py b/examples2/desktop.py deleted file mode 100755 index 7f48159..0000000 --- a/examples2/desktop.py +++ /dev/null @@ -1,219 +0,0 @@ -#!/usr/bin/env python - -import sys -from python_tqt.qt import * - -seed = 0.353535353535 -KINDA_RAND_MAX = 32767 - -def kindaRand(): - global seed - seed = seed * 147 - seed = seed - int(seed) - return int(seed*(KINDA_RAND_MAX + 1)) - -velmax = 15 -velmin = 4 - -def velocity(i): - if i == 1 or i == 2: - i = (kindaRand()&0x7fff % velmax)/3 + velmin - else: - i = (kindaRand()&0x7fff % velmax) + velmin - -maxpoints = 5 -maxcurves = 8 - -def poly(): - d = TQApplication.desktop() - d.setPaletteBackgroundColor(white) - xvel = [ 0 ] * 8 - yvel = [ 0 ] * 8 - head = 0 - tail = -maxcurves + 2 - a = TQPointArray() * maxcurves - r = d.rect() - for i in range(maxcurves): - a[i].resize(maxpoints) - p = a[0] - for i in range(maxpoints): - p.setPoint(i, (kindaRand()&0x7fff) % r.width(), - (kindaRand()&0x7fff) % r.height() ) - xvel[i] = velocity(i) - yvel[i] = velocity(i) - - paint = TQPainter() - paint.begin(d) - - for ntimes in range(2000): - paint.setBrush(TQColor(kindaRand()%360,180,255, TQColor.Hsv)) - paint.drawPolygon(a[head]) - tail = tail + 1 - if tail >= maxcurves: - tail = 0 - minx = r.left() - maxx = r.right() - miny = r.top() - maxy = r.bottom() - p = a[head] - head = head + 1 - if head >= maxcurves: - head = 0 - for i in range(maxpoints): - x, y = p.point(i) - x = x + xvel[i] - y = y + yvel[i] - if x >= maxx: - x = maxx - (x - maxx + 1) - xvel[i] = -velocity(i) - if x <= minx: - x = minx + (minx - x + 1) - xvel[i] = velocity(i) - if y >= maxy: - y = maxy - (y - maxy + 1) - yvel[i] = -velocity(i) - if y <= miny: - y = miny + (miny - y + 1) - yvel[i] = velocity(i) - a[head].setPoint(i, x, y) - paint.end() - -def rotate(): - w = 64 - h = 64 - image = TQImage(w, h, 8, 128) - for i in range(128): - image.setColor(i, tqRgb(i,0,0)) - for y in range(h): - for x in range(w): - image.setPixel(x,y,(x+y)%128) - - pm = TQPixmap() - pm.convertFromImage(image) - #pm.optimize(1) - - d = TQApplication.desktop() - - for i in range(0,361,2): - m = TQWMatrix() - m.rotate(i) - rpm = pm.xForm(m) - d.setPaletteBackgroundPixmap(rpm) - d.update() - -def generateStone(pm, c1, c2, c3): - p = TQPainter() - p1 = TQPen(c1, 0) - p2 = TQPen(c2, 0) - p3 = TQPen(c3, 0) - - p.begin(pm) - for i in range(pm.width()): - for j in range(pm.height()): - r = kindaRand() - if r < KINDA_RAND_MAX / 3: - p.setPen(p1) - elif r < KINDA_RAND_MAX / 3 * 2: - p.setPen(p2) - else: - p.setPen(p3) - p.drawPoint(i, j) - p.end() - -def drawShadeText(p, x, y, text, topColor, bottomColor, sw=2): - if not p.isActive(): - return - - p.setPen(bottomColor) - p.drawText(x+sw, y+sw, text) - p.setPen(topColor) - p.drawText(x, y, text) - -class DesktopWidget(TQWidget): - def __init__(self, s, parent=None, name=''): - TQWidget.__init__(self, parent, name, WType_Desktop | WPaintDesktop) - self.text = s - self.pm = None - - def paintEvent(self, pe): - c1 = self.backgroundColor() - c2 = c1.light(104) - c3 = c1.dark(106) - if not self.pm: - self.pm = TQPixmap(64, 64) - generateStone(self.pm, c1, c2, c3) - self.setPaletteBackgroundPixmap(self.pm) - self.update() - br = self.fontMetrics().boundingRect(self.text) - offscreen = TQPixmap(br.width(), br.height()) - x = self.width()/2 - br.width()/2 - y = self.height()/2 - br.height()/2 - offscreen.fill(self, x, y) - p = TQPainter() - p.begin(offscreen) - drawShadeText(p, -br.x(), -br.y(), self.text, c2, c3, 3) - p.end() - bitBlt(self, x, y, offscreen) - -def desktopWidget(s='Troll Tech'): - t = DesktopWidget(s) - t.update() - tqApp.exec_loop() - -def desktopText(s='Troll Tech'): - border = 20 - - c1 = tqApp.palette().normal().background() - c2 = c1.light(104) - c3 = c1.dark(106) - - pm = TQPixmap(10, 10) - p = TQPainter() - p.begin(pm) - r = p.fontMetrics().boundingRect(s) - p.end() - - appWidth = tqApp.desktop().width() - appHeight = tqApp.desktop().height() - if r.width() > appWidth - border*2: - r.setWidth(appWidth - border*2) - if r.height() > appHeight - border*2: - r.setHeight(appHeight - border*2) - - pm.resize(r.size().width()+border*2,r.size().height()+border*2) - generateStone(pm, c1, c2, c3) - p.begin(pm) - drawShadeText(p, -r.x()+border, -r.y()+border, s, c2, c3) - p.end() - - tqApp.desktop().setPaletteBackgroundPixmap(pm) - -a = TQApplication(sys.argv) -if len(sys.argv) > 1: - f = TQFont('charter', 96, TQFont.Weight.Black) - f.setStyleHint(TQFont.StyleHint.Times) - a.setFont(f) -validOptions = 0 -if len(sys.argv) == 2: - validOptions = 1 - if sys.argv[1] == '-poly': - poly() - elif sys.argv[1] == '-rotate': - rotate() - elif sys.argv[1] == '-troll': - desktopText() - elif sys.argv[1] == '-trollwidget': - desktopWidget() - else: - validOptions = 0 -if len(sys.argv) == 3: - validOptions = 1 - if sys.argv[1] == '-shadetext': - desktopText(sys.argv[2]) - elif sys.argv[1] == '-shadewidget': - desktopWidget(sys.argv[2]) - else: - validOptions = 0 - -if not validOptions: - rotate() diff --git a/examples2/dirview.py b/examples2/dirview.py deleted file mode 100755 index ef8bcd7..0000000 --- a/examples2/dirview.py +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env python - -import sys -from python_tqt.qt import * - -class Directory(TQListViewItem): - def __init__(self, parent, name=None): - TQListViewItem.__init__(*(self,parent)) - if isinstance(parent, TQListView): - self.p = None - self.f = '/' - else: - self.p = parent - self.f = name - self.c = [] - self.readable = 1 - - def setOpen(self, o): - if o and not self.childCount(): - s = self.fullName() - thisDir = TQDir(s) - if not thisDir.isReadable(): - self.readable = 0 - return - - files = thisDir.entryInfoList() - if files: - for f in files: - fileName = str(f.fileName()) - if fileName == '.' or fileName == '..': - continue - elif f.isSymLink(): - d = TQListViewItem(self, fileName, 'Symbolic Link') - elif f.isDir(): - d = Directory(self, fileName) - else: - if f.isFile(): - s = 'File' - else: - s = 'Special' - d = TQListViewItem(self, fileName, s) - self.c.append(d) - - TQListViewItem.setOpen(self, o) - - def setup(self): - self.setExpandable(1) - TQListViewItem.setup(self) - - def fullName(self): - if self.p: - s = self.p.fullName() + self.f + '/' - else: - s = '/' - return s - - def text(self, column): - if column == 0: - return self.f - elif self.readable: - return 'Directory' - else: - return 'Unreadable Directory' - -a = TQApplication(sys.argv) -mw = TQListView() -a.setMainWidget(mw) -mw.setCaption('Directory Browser') -mw.addColumn('Name') -mw.addColumn('Type') -mw.resize(400, 400) -mw.setTreeStepSize(20) -root = Directory(mw) -root.setOpen(1) -mw.show() -a.exec_loop() diff --git a/examples2/dragdrop.py b/examples2/dragdrop.py deleted file mode 100755 index a715170..0000000 --- a/examples2/dragdrop.py +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env python - -# Ported to PyTQt by Issac Trotts on Jan 1, 2002 - -import sys -from python_tqt.qt import * - -import dropsite, secret - - -def addStuff( parent, yn_image, yn_secret = 0 ): - tll = TQVBoxLayout( parent, 10 ) - d = dropsite.DropSite( parent, 'dropsite' ) - d.setFrameStyle( TQFrame.Sunken + TQFrame.WinPanel ) - tll.addWidget( d ) - if yn_image: - stuff = TQPixmap() - if not stuff.load( "trolltech.bmp" ): - stuff = TQPixmap(20,20) - stuff.fill(TQt.green) - d.setPixmap( stuff ) - else: - d.setText("Drag and Drop") - d.setFont(TQFont("Helvetica",18)) - if secret: - s = secret.SecretSource( 42, parent ) - tll.addWidget( s ) - - format = TQLabel( "\n\n\n\nNone\n\n\n\n", parent ) - tll.addWidget( format ) - tll.activate() - parent.resize( parent.sizeHint() ) - - TQObject.connect( d, PYSIGNAL('message(TQString &)'), - format, SLOT('setText(TQString &)') ) - - -app = TQApplication( sys.argv ) - -mw = TQWidget() -addStuff( mw, 1 ) -mw.setCaption( "TQt Example - Drag and Drop" ) -mw.show() - -mw2 = TQWidget() -addStuff( mw2, 0 ) -mw2.setCaption( "TQt Example - Drag and Drop" ) -mw2.show() - -mw3 = TQWidget() -addStuff( mw3, 1, 1 ) -mw3.setCaption( "TQt Example - Drag and Drop" ) -mw3.show() - -TQObject.connect(tqApp,SIGNAL('lastWindowClosed()'),tqApp,SLOT('quit()')) - -app.exec_loop() diff --git a/examples2/dropsite.py b/examples2/dropsite.py deleted file mode 100644 index 461b44e..0000000 --- a/examples2/dropsite.py +++ /dev/null @@ -1,96 +0,0 @@ -# This is part of the dragdrop example. - - -from python_tqt.qt import * - -import secret - - -class DropSite(TQLabel): - def __init__(self, parent=None, name=None): - TQLabel.__init__( self, parent, name ) - self.setAcceptDrops(1) - - # this is a normal event - def mousePressEvent( self, e ): - if ( self.pixmap() ) : - drobj = TQImageDrag( self.pixmap().convertToImage(), self ) - pm = TQPixmap() - pm.convertFromImage(self.pixmap().convertToImage().smoothScale( - self.pixmap().width()/3,self.pixmap().height()/3)) - drobj.setPixmap(pm,TQPoint(-5,-7)) - else : - drobj = TQTextDrag( self.text(), self ) - drobj.dragCopy() - - def backgroundColorChange( self, qcolor ): - # Reduce flicker by using repaint() rather than update() - self.repaint() - - def dragMoveEvent( self, e ): - # Check if you want the drag at e.pos()... - # Give the user some feedback... - pass - - def dragEnterEvent( self, e ): - # Check if you want the drag... - if (secret.canDecode( e ) or - TQTextDrag.canDecode( e ) or - TQImageDrag.canDecode( e ) or - TQUriDrag.canDecode( e )): - e.accept() - - # Give the user some feedback... - t = '' - i = 0 - while e.format( i ): - if ( t != '' ): - t += "\n" - t += str(e.format( i )) - i += 1 - self.emit(PYSIGNAL('message(TQString &)'), (TQString(t),)) - self.setPaletteBackgroundColor(TQt.white) - - def dragLeaveEvent( self, TQDragLeaveEvent ): - # Give the user some feedback... - self.emit(PYSIGNAL('message(TQString &)'), (TQString(''),)) - self.setPaletteBackgroundColor(TQt.lightGray) - - def dropEvent( self, e ): - self.setPaletteBackgroundColor(TQt.lightGray) - # Try to decode to the data you understand... - str = TQString() - if ( TQTextDrag.decode( e, str ) ) : - self.setText( str ) - self.setMinimumSize( self.minimumSize().expandedTo(self.sizeHint()) ) - return - - pm = TQPixmap() - if ( TQImageDrag.decode( e, pm ) ) : - self.setPixmap( pm ) - self.setMinimumSize(self.minimumSize().expandedTo(self.sizeHint())) - return - - # TQStrList strings - #strings = TQStrList() - strings = [] - if ( TQUriDrag.decode( e, strings ) ) : - m = TQString("Full URLs:\n") - for u in strings: - m = m + " " + u + '\n' - # TQStringList files - files = [] - if ( TQUriDrag.decodeLocalFiles( e, files ) ) : - m += "Files:\n" - # for (TQStringList.Iterator i=files.begin() i!=files.end() ++i) - for i in files: - m = m + " " + i + '\n' - self.setText( m ) - self.setMinimumSize(self.minimumSize().expandedTo(self.sizeHint())) - return - - str = secret.decode( e ) - if str: - self.setText( str ) - self.setMinimumSize(self.minimumSize().expandedTo(self.sizeHint())) - return diff --git a/examples2/gears.py b/examples2/gears.py deleted file mode 100755 index 54734cc..0000000 --- a/examples2/gears.py +++ /dev/null @@ -1,235 +0,0 @@ -#!/usr/bin/env python - - -import sys -import math -from python_tqt.qt import * -from python_tqt.qtgl import * -from OpenGL.GL import * - -def gear(inner_radius,outer_radius,width,teeth,tooth_depth): - r0 = inner_radius; - r1 = outer_radius - tooth_depth/2.0; - r2 = outer_radius + tooth_depth/2.0; - - da = 2.0*math.pi/teeth/4.0; - - glShadeModel(GL_FLAT) - - glNormal3f(0.0,0.0,1.0) - - # draw front face - - glBegin(GL_QUAD_STRIP) - - for i in range(teeth+1): - angle = i * 2.0*math.pi/teeth; - glVertex3f(r0*math.cos(angle), r0*math.sin(angle), width*0.5 ) - glVertex3f(r1*math.cos(angle), r1*math.sin(angle), width*0.5 ) - glVertex3f(r0*math.cos(angle), r0*math.sin(angle), width*0.5 ) - glVertex3f(r1*math.cos(angle+3*da), r1*math.sin(angle+3*da), width*0.5 ) - - glEnd() - - # draw front sides of teeth - - da = 2.0*math.pi/teeth/4.0; - - glBegin(GL_QUADS) - - for i in range(teeth): - angle = i*2.0*math.pi/teeth - - glVertex3f( r1*math.cos(angle), r1*math.sin(angle), width*0.5 ) - glVertex3f( r2*math.cos(angle+da), r2*math.sin(angle+da), width*0.5 ) - glVertex3f( r2*math.cos(angle+2*da), r2*math.sin(angle+2*da), width*0.5 ) - glVertex3f( r1*math.cos(angle+3*da), r1*math.sin(angle+3*da), width*0.5 ) - - glEnd() - - - glNormal3f( 0.0, 0.0, -1.0 ) - - # draw back face - - glBegin( GL_QUAD_STRIP ); - - for i in range(teeth+1): - angle = i*2.0*math.pi/teeth; - - glVertex3f( r1*math.cos(angle), r1*math.sin(angle), -width*0.5 ) - glVertex3f( r0*math.cos(angle), r0*math.sin(angle), -width*0.5 ) - glVertex3f( r1*math.cos(angle+3*da), r1*math.sin(angle+3*da), -width*0.5 ) - glVertex3f( r0*math.cos(angle), r0*math.sin(angle), -width*0.5 ) - - glEnd() - - # draw back sides of teeth - - da = 2.0*math.pi/teeth/4.0 - - glBegin( GL_QUADS ) - - for i in range(teeth): - angle = i*2.0*math.pi/teeth - - glVertex3f( r1*math.cos(angle+3*da), r1*math.sin(angle+3*da), -width*0.5 ) - glVertex3f( r2*math.cos(angle+2*da), r2*math.sin(angle+2*da), -width*0.5 ) - glVertex3f( r2*math.cos(angle+da), r2*math.sin(angle+da), -width*0.5 ) - glVertex3f( r1*math.cos(angle), r1*math.sin(angle), -width*0.5 ) - - glEnd() - - # draw outward faces of teeth - - glBegin( GL_QUAD_STRIP ) - - for i in range(teeth): - angle = i*2.0*math.pi/teeth - - glVertex3f( r1*math.cos(angle), r1*math.sin(angle), width*0.5 ) - glVertex3f( r1*math.cos(angle), r1*math.sin(angle), -width*0.5 ) - - u = r2*math.cos(angle+da) - r1*math.cos(angle) - v = r2*math.sin(angle+da) - r1*math.sin(angle) - - len = math.sqrt( u*u + v*v ) - u /= len - v /= len - glNormal3f( v, -u, 0.0 ) - glVertex3f( r2*math.cos(angle+da), r2*math.sin(angle+da), width*0.5 ) - glVertex3f( r2*math.cos(angle+da), r2*math.sin(angle+da), -width*0.5 ) - glNormal3f( math.cos(angle), math.sin(angle), 0.0 ) - glVertex3f( r2*math.cos(angle+2*da), r2*math.sin(angle+2*da), width*0.5 ) - glVertex3f( r2*math.cos(angle+2*da), r2*math.sin(angle+2*da), -width*0.5 ) - u = r1*math.cos(angle+3*da) - r2*math.cos(angle+2*da) - v = r1*math.sin(angle+3*da) - r2*math.sin(angle+2*da) - glNormal3f( v, -u, 0.0 ) - glVertex3f( r1*math.cos(angle+3*da), r1*math.sin(angle+3*da), width*0.5 ) - glVertex3f( r1*math.cos(angle+3*da), r1*math.sin(angle+3*da), -width*0.5 ) - glNormal3f( math.cos(angle), math.sin(angle), 0.0 ) - - glVertex3f( r1*math.cos(0.0), r1*math.sin(0.0), width*0.5 ) - glVertex3f( r1*math.cos(0.0), r1*math.sin(0.0), -width*0.5 ) - - glEnd() - - glShadeModel (GL_SMOOTH) - - # draw inside radius cylinder - - glBegin( GL_QUAD_STRIP ) - - for i in range(teeth+1): - angle = i * 2.0*math.pi / teeth; - glNormal3f( -math.cos(angle), -math.sin(angle), 0.0 ); - glVertex3f( r0*math.cos(angle), r0*math.sin(angle), -width*0.5 ); - glVertex3f( r0*math.cos(angle), r0*math.sin(angle), width*0.5 ); - - glEnd() - -############################################################################## -class GearWidget(TQGLWidget): - def __init__(self,parent=None,name=None): - TQGLWidget.__init__(self,parent,name) - - self.angle=0.0 - self.view_rotx=0.0 - self.view_roty=0.0 - self.view_rotz=0.0 - - self.startTimer(10) - - def timerEvent(self,event): - self.updateGL() - - def paintGL(self): - self.angle = self.angle + 2.0 - self.view_rotx = self.view_rotx + 1.0 - self.view_roty = self.view_roty + 3.0 - self.view_rotz = self.view_rotz + 2.0 - - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ) - - glPushMatrix() - glRotatef( self.view_rotx, 1.0, 0.0, 0.0 ) - glRotatef( self.view_roty, 0.0, 1.0, 0.0 ) - glRotatef( self.view_rotz, 0.0, 0.0, 1.0 ) - - glPushMatrix() - glTranslatef( -3.0, -2.0, 0.0 ) - glRotatef( self.angle, 0.0, 0.0, 1.0 ) - glCallList(self.gear1) - glPopMatrix() - - glPushMatrix() - glTranslatef( 3.1, -2.0, 0.0 ) - glRotatef( -2.0*self.angle-9.0, 0.0, 0.0, 1.0 ) - glCallList(self.gear2) - glPopMatrix() - - glPushMatrix() - glTranslatef( -3.1, 2.2, -1.8 ) - glRotatef( 90.0, 1.0, 0.0, 0.0 ) - glRotatef( 2.0*self.angle-2.0, 0.0, 0.0, 1.0 ) - glCallList(self.gear3) - glPopMatrix() - - glPopMatrix() - - def resizeGL(self,width,height): - w = width / float(height) - h = 1.0 - - glViewport( 0, 0, width, height ) - glMatrixMode(GL_PROJECTION) - glLoadIdentity() - glFrustum( -w, w, -h, h, 5.0, 60.0 ) - glMatrixMode(GL_MODELVIEW) - glLoadIdentity() - glTranslatef( 0.0, 0.0, -40.0 ) - - def initializeGL(self): - pos=(5.0, 5.0, 10.0, 1.0 ) - ared=(0.8, 0.1, 0.0, 1.0 ) - agreen=(0.0, 0.8, 0.2, 1.0 ) - ablue=(0.2, 0.2, 1.0, 1.0 ) - - glLightfv(GL_LIGHT0,GL_POSITION,pos) - glEnable(GL_CULL_FACE) - glEnable(GL_LIGHTING) - glEnable(GL_LIGHT0) - glEnable(GL_DEPTH_TEST) - - self.gear1=glGenLists(1) - glNewList(self.gear1,GL_COMPILE) - glMaterialfv(GL_FRONT,GL_AMBIENT_AND_DIFFUSE,ared) - gear(1.0,4.0,1.0,20,0.7) - glEndList() - - self.gear2=glGenLists(1) - glNewList(self.gear2,GL_COMPILE) - glMaterialfv(GL_FRONT,GL_AMBIENT_AND_DIFFUSE,agreen) - gear(0.5,2.0,2.0,10,0.7) - glEndList() - - self.gear3=glGenLists(1) - glNewList(self.gear3,GL_COMPILE) - glMaterialfv(GL_FRONT,GL_AMBIENT_AND_DIFFUSE,ablue) - gear(1.3,2.0,0.5,10,0.7) - glEndList() - - glEnable(GL_NORMALIZE) - -############################################################################## -if __name__=='__main__': - TQApplication.setColorSpec(TQApplication.CustomColor) - app=TQApplication(sys.argv) - - if not TQGLFormat.hasOpenGL(): - raise Exception('No TQt OpenGL support.') - - widget=GearWidget() - app.setMainWidget(widget) - widget.show() - app.exec_loop() diff --git a/examples2/menu.py b/examples2/menu.py deleted file mode 100755 index 28e5a88..0000000 --- a/examples2/menu.py +++ /dev/null @@ -1,301 +0,0 @@ -#!/usr/bin/env python - -#**************************************************************************** -#** $Id: menu.py,v 1.1.1.1 2002/06/04 23:04:42 phil Exp $ -#** -#** Copyright (C) 1992-1998 Troll Tech AS. All rights reserved. -#** -#** This file is part of an example program for PyTQt. This example -#** program may be used, distributed and modified without limitation. -#** -#*****************************************************************************/ - -import sys, string -from python_tqt.qt import * - -TRUE = 1 -FALSE = 0 - -# XPM -p1_xpm = [ -"16 16 3 1", -" c None", -". c #000000000000", -"X c #FFFFFFFF0000", -" ", -" ", -" .... ", -" .XXXX. ", -" .............. ", -" .XXXXXXXXXXXX. ", -" .XXXXXXXXXXXX. ", -" .XXXXXXXXXXXX. ", -" .XXXXXXXXXXXX. ", -" .XXXXXXXXXXXX. ", -" .XXXXXXXXXXXX. ", -" .XXXXXXXXXXXX. ", -" .XXXXXXXXXXXX. ", -" .XXXXXXXXXXXX. ", -" .............. ", -" " -] - -# XPM -p2_xpm = [ -"16 16 3 1", -" c None", -". c #000000000000", -"X c #FFFFFFFFFFFF", -" ", -" ...... ", -" .XXX.X. ", -" .XXX.XX. ", -" .XXX.XXX. ", -" .XXX..... ", -" .XXXXXXX. ", -" .XXXXXXX. ", -" .XXXXXXX. ", -" .XXXXXXX. ", -" .XXXXXXX. ", -" .XXXXXXX. ", -" .XXXXXXX. ", -" ......... ", -" ", -" " -] - -# XPM -p3_xpm = [ -"16 16 3 1", -" c None", -". c #000000000000", -"X c #FFFFFFFFFFFF", -" ", -" ", -" ......... ", -" ........... ", -" ........ .. ", -" ........... ", -" ........... ", -" ........... ", -" ........... ", -" ...XXXXX... ", -" ...XXXXX... ", -" ...XXXXX... ", -" ...XXXXX... ", -" ......... ", -" ", -" " -] - -p4_xpm = [ -' 16 14 5 1', -'. c #000000', -'# c #848284', -'a c #c6c3c6', -'b c #ffff00', -'c c #ffffff', -'aaaaa.........aa', -'aaaa.cccccccc.aa', -'aaaa.c.....c.aaa', -'aaa.cccccccc.aaa', -'aaa.c.....c....a', -'aa.cccccccc.a.a.', -'a..........a.a..', -'.aaaaaaaaaa.a.a.', -'.............aa.', -'.aaaaaa###aa.a.a', -'.aaaaaabbbaa...a', -'.............a.a', -'a.aaaaaaaaa.a.aa', -'aa...........aaa' -] - -# Auxiliary class to provide fancy menu items with different fonts. -# Used for the "bold" and "underline" menu items in the options menu. - -#class MyMenuItem( TQCustomMenuItem ): -# def __init__( self, s=None, f=None ): -# apply( TQCustomMenuItem.__init__,( self, s, f ) ) -# string = TQString( s ) -# font = TQFont( f ) - -# def paint( self, p, TRUE, FALSE, x, y, w, h ) : -# p.setFont ( font ) -# p.drawText( x, y, w, h, TQt.AlignLeft | TQt.AlignVCenter | TQt.ShowPrefix | TQt.DontClip, string ) -# def sizeHint( self ): -# return TQFontMetrics( font ).size( TQt.AlignLeft | TQt.AlignVCenter | TQt.ShowPrefix | TQt.DontClip, string ) - - -# -### Implementation of MenuExample class -# - -class MenuExample( TQWidget ): - def __init__( self, parent=None, name=None ): - TQWidget.__init__(*(self, parent, name)) - self.p1 = TQIconSet( TQPixmap ( p1_xpm ) ) - self.p2 = TQIconSet( TQPixmap ( p2_xpm ) ) - self.p3 = TQIconSet( TQPixmap ( p3_xpm ) ) - self.p4 = TQIconSet( TQPixmap ( p4_xpm ) ) - #openIcon = TQPixmap() - #saveIcon = TQPixmap() - #printIcon = TQPixmap() - - self.printer = TQPopupMenu( self ) - #TQ_CHECK_PTR( self.printer ) - self.printer.insertTearOffHandle() - self.printer.insertItem( "&Print to printer", self.printDoc ) - self.printer.insertItem( "Print to &file", self.file ) - self.printer.insertItem( "Print to fa&x", self.fax ) - self.printer.insertSeparator() - self.printer.insertItem( "Printer &Setup", self.printerSetup ) - - self.file = TQPopupMenu( self ) - #TQ_CHECK_PTR( self.file ); - self.file.insertItem( self.p1, "&Open", self.open, TQt.CTRL+TQt.Key_O ) - self.file.insertItem( self.p2, "&New", self.news, TQt.CTRL+TQt.Key_N ) - self.file.insertItem( self.p3, "&Save", self.save, TQt.CTRL+TQt.Key_S ) - self.file.insertItem( "&Close", self.closeDoc, TQt.CTRL+TQt.Key_W ) - self.file.insertSeparator() - self.file.insertItem( self.p4, "&Print", self.printer, TQt.CTRL+TQt.Key_P ) - self.file.insertSeparator() - self.file.insertItem( "E&xit", tqApp, SLOT( "quit()" ), TQt.CTRL+TQt.Key_Q ) - - self.edit = TQPopupMenu( self ) - #TQ_CHECK_PTR( self.edit ) - undoID = self.edit.insertItem( "&Undo", self.undo ) - redoID = self.edit.insertItem( "&Redo", self.redo ) - self.edit.setItemEnabled( undoID, TRUE ) - self.edit.setItemEnabled( redoID, FALSE ) - - self.options = TQPopupMenu( self ) - #TQ_CHECK_PTR( self.options ) - self.options.insertTearOffHandle() - self.options.setCaption( 'Options' ) - self.options.insertItem( "&Normal Font", self.normal ) - self.options.insertSeparator() - - self.options.polish() # adjust system settings - self.f = TQFont( self.options.font() ) - self.f.setBold( TRUE ) - self.boldID = self.options.insertItem( "&Bold" ) - self.options.setAccel( TQt.CTRL+TQt.Key_B, self.boldID ) - self.options.connectItem( self.boldID, self.bold ) - - self.f = TQFont( self.options.font() ) - self.f.setUnderline( TRUE ) - self.underlineID = self.options.insertItem( "&Underline" ) - self.options.setAccel( TQt.CTRL+TQt.Key_U, self.underlineID ) - self.options.connectItem( self.underlineID, self.underline ) - - self.isBold = FALSE - self.isUnderline = FALSE - self.options.setCheckable( TRUE ) - - self.options = TQPopupMenu() - #TQ_CHECK_PTR( self.options ) - self.options.insertItem( "&Normal Font", self.normal ) - self.options.insertSeparator() - self.boldID = self.options.insertItem( "&Bold", self.bold ) - self.underlineID = self.options.insertItem( "&Underline", self.underline ) - - self.isBold = FALSE - self.isUnderline = FALSE - self.options.setCheckable( TRUE ) - - self.help = TQPopupMenu( self ) - #TQ_CHECK_PTR( self.help ) - self.help.insertItem( "&About", self.about, TQt.CTRL+TQt.Key_H ) - self.help.insertItem( "About &TQt", self.aboutTQt ) - - self.menu = TQMenuBar( self ) - #TQ_CHECK_PTR( self.menu ); - self.menu.insertItem( "&File", self.file ) - self.menu.insertItem( "&Edit", self.edit ) - self.menu.insertItem( "&Options", self.options ) - self.menu.insertSeparator() - self.menu.insertItem( "&Help", self.help ) - self.menu.setSeparator( TQMenuBar.InWindowsStyle ) - - self.label = TQLabel( self ) - #TQ_CHECK_PTR( self.label ) - self.label.setGeometry( 20, self.rect().center().y()-20, self.width()-40, 40 ) - self.label.setFrameStyle( TQFrame.Box | TQFrame.Raised ) - self.label.setLineWidth( 1 ) - self.label.setAlignment( TQt.AlignCenter ) - - self.label.setFont( TQFont( "times", 12, TQFont.Bold ) ) - self.connect( self, PYSIGNAL( "explain" ), self.label.setText ) - #self.connect( self, PYSIGNAL( "explain(const char *)" ), - # self.label, SLOT( "setText(const char *)" ) ) - - self.setMinimumSize( 100, 80 ) - - def open( self ): - self.emit ( PYSIGNAL( "explain" ), ( "File/Open selected", ) ) - - def news( self ): - self.emit ( PYSIGNAL( "explain" ), ( "File/New selected", ) ) - - def save( self ): - self.emit ( PYSIGNAL( "explain" ), ( "File/Save selected", ) ) - - def closeDoc( self ): - self.emit ( PYSIGNAL( "explain" ), ( "File/Close selected", ) ) - - def undo( self ): - self.emit ( PYSIGNAL( "explain" ), ( "Edit/Undo selected", ) ) - - def redo( self ): - self.emit ( PYSIGNAL( "explain" ), ( "Edit/Redo selected", ) ) - - def normal( self ): - self.isBold = FALSE - self.isUnderline = FALSE - self.options.setItemChecked( self.boldID, self.isBold ) - self.options.setItemChecked( self.underlineID, self.isUnderline ) - self.emit(PYSIGNAL("explain"), ("Options/Normal selected",)) - - def bold( self ): - self.isBold = not self.isBold - self.options.setItemChecked( self.boldID, self.isBold ) - self.emit ( PYSIGNAL( "explain" ), ( "Options/Bold selected", ) ) - - def underline( self ): - self.isUnderline = not self.isUnderline - self.options.setItemChecked( self.underlineID, self.isUnderline ) - self.emit(PYSIGNAL("explain"), ("Options/Underline selected",)) - - def about( self ): - TQMessageBox.about( self, "TQt Menu Example", - "This example demonstrates simple use of TQt menus.\n" - "You can cut and paste lines from it to your own\n" - "programs." ) - - def aboutTQt( self ): - TQMessageBox.aboutTQt( self, "TQt Menu Example" ) - - def printDoc( self ): - self.emit ( PYSIGNAL( "explain" ), ( "File/Printer/Print selected", ) ) - - def file( self ): - self.emit ( PYSIGNAL( "explain" ), ( "File/Printer/Print To File selected", ) ) - - def fax( self ): - self.emit ( PYSIGNAL( "explain" ), ( "File/Printer/Print To Fax selected", ) ) - - def printerSetup( self ): - self.emit ( PYSIGNAL( "explain" ), ( "File/Printer/Printer Setup selected", ) ) - - def resizeEvent( self, ev ): - self.label.setGeometry( 20, self.rect().center().y()-20, self.width()-40, 40 ) - -a = TQApplication( sys.argv ) -m = MenuExample() - -a.setMainWidget( m ) -m.setCaption( 'MenuExample' ) -m.show() -#a.connect( a, SIGNAL('lastWindowClosed()'), a, SLOT('quit()') ) -a.exec_loop() diff --git a/examples2/qt.png b/examples2/qt.png deleted file mode 100644 index d63e16f..0000000 Binary files a/examples2/qt.png and /dev/null differ diff --git a/examples2/qtlogo.png b/examples2/qtlogo.png deleted file mode 100644 index d45fbd4..0000000 Binary files a/examples2/qtlogo.png and /dev/null differ diff --git a/examples2/secret.py b/examples2/secret.py deleted file mode 100644 index d68bd1b..0000000 --- a/examples2/secret.py +++ /dev/null @@ -1,65 +0,0 @@ -# This is part of the dragdrop example. - - -from python_tqt.qt import * - - -def canDecode(e): - return e.provides( "secret/magic" ) - - -def decode(e): - payload = str(e.data( "secret/magic" )) - if ( str(payload) != '' ): - e.accept() - return TQString("The secret number is "+str(ord(payload)) ) - - return None - - -class SecretDrag(TQStoredDrag): - def __init__(self, secret, parent=None, name=None): - TQStoredDrag.__init__(self, 'secret/magic', parent, name) - data = TQByteArray(chr(secret)) - self.setEncodedData( data ) - - -# XPM -picture_xpm = [ - "16 16 3 1", - " c None", - ". c #000000", - "X c #FFFF00", - " ..... ", - " ..XXXXX.. ", - " .XXXXXXXXX. ", - " .XXXXXXXXXXX. ", - " .XX..XXX..XX. ", - ".XXXXXXXXXXXXX. ", - ".XX...XXX...XX. ", - ".XXX..XXX..XXX. ", - ".XXXXXXXXXXXXX. ", - ".XXXXXX.XXXXXX. ", - " .XX.XX.XX.XX. ", - " .XXX..X..XXX. ", - " .XXXXXXXXX. ", - " ..XXXXX.. ", - " ..... ", - " " -] - - -class SecretSource(TQLabel): - def __init__(self, secret, parent=None, name=None): - TQLabel.__init__(self, "Secret", parent, name) - self.setPaletteBackgroundColor( TQt.blue.light() ) - self.setFrameStyle( TQLabel.Box | TQLabel.Sunken ) - self.setMinimumHeight( self.sizeHint().height()*2 ) - self.setAlignment( TQLabel.AlignCenter ) - self.mySecret = secret - - def mousePressEvent(self, e): - sd = SecretDrag( self.mySecret, self ) - sd.setPixmap(TQPixmap(picture_xpm),TQPoint(8,8)) - sd.dragCopy() - self.mySecret = self.mySecret + 1 diff --git a/examples2/semaphore.py b/examples2/semaphore.py deleted file mode 100755 index f1a2b7a..0000000 --- a/examples2/semaphore.py +++ /dev/null @@ -1,203 +0,0 @@ -#!/usr/bin/env python -# -# A port of the semaphore example from TQt. - - -import sys - -# Check if thread support was enabled. -try: - from python_tqt.qt import TQThread -except: - print("Thread support not enabled") - sys.exit(1) - -from python_tqt.qt import * - - -# The semaphore instances. -yellowSem = None -greenSem = None - - -class YellowThread(TQThread): - def __init__(self,o): - TQThread.__init__(self) - - self.receiver = o - self.stopped = 0 - self.mutex = TQMutex() - - def run(self): - global yellowSem, greenSem - - for i in range(20): - yellowSem += 1 - - event = TQCustomEvent(12345) - event.setData(TQString("Yellow!")) - TQThread.postEvent(self.receiver,event) - self.msleep(200); - - greenSem -= 1 - - self.mutex.lock() - if self.stopped: - self.stopped = 0 - self.mutex.unlock() - break - - self.mutex.unlock() - - yellowSem += 1 - - event = TQCustomEvent(12346) - event.setData(TQString("Yellow!")) - TQThread.postEvent(self.receiver,event) - - greenSem -= 1 - - def stop(self): - self.mutex.lock() - self.stopped = 1 - self.mutex.unlock() - - -class GreenThread(TQThread): - def __init__(self,o): - TQThread.__init__(self) - - self.receiver = o - self.stopped = 0 - self.mutex = TQMutex() - - def run(self): - global yellowSem, greenSem - - for i in range(20): - greenSem += 1 - - event = TQCustomEvent(12345) - event.setData(TQString("Green!")) - TQThread.postEvent(self.receiver,event) - self.msleep(200) - - yellowSem -= 1 - - self.mutex.lock() - if self.stopped: - self.stopped = 0 - self.mutex.unlock() - break - - self.mutex.unlock() - - greenSem += 1 - - event = TQCustomEvent(12346) - event.setData(TQString("Green!")) - TQThread.postEvent(self.receiver,event) - self.msleep(10) - - yellowSem -= 1 - - def stop(self): - self.mutex.lock() - self.stopped = 1 - self.mutex.unlock() - - -class SemaphoreExample(TQWidget): - def __init__(self): - TQWidget.__init__(self) - - self.yellowThread = YellowThread(self) - self.greenThread = GreenThread(self) - - global yellowSem, greenSem - yellowSem = TQSemaphore(1) - greenSem = TQSemaphore(1) - - self.button = TQPushButton("&Ignition!",self) - self.connect(self.button,SIGNAL("clicked()"),self.startExample) - - self.mlineedit = TQMultiLineEdit(self) - self.label = TQLabel(self) - - vbox = TQVBoxLayout(self,5) - vbox.addWidget(self.button) - vbox.addWidget(self.mlineedit) - vbox.addWidget(self.label) - - def __del__(self): - stopYellow = self.yellowThread.running() - stopGreen = self.greenThread.running() - - if stopYellow: - self.yellowThread.stop() - - if self.greenThread.running(): - self.greenThread.stop() - - if stopYellow: - self.yellowThread.wait() - - if stopGreen: - self.greenThread.wait() - - global yellowSem, greenSem - yellowSem = None - greenSem = None - - def startExample(self): - if self.yellowThread.running() or self.greenThread.running(): - TQMessageBox.information(self,"Sorry", - "The threads have not completed yet, and must finish before " - "they can be started again.") - - return - - self.mlineedit.clear() - - global yellowSem - - while yellowSem.available() < yellowSem.total(): - yellowSem -= 1 - - yellowSem += 1 - - self.yellowThread.start() - self.greenThread.start() - - def customEvent(self,event): - if event.type() == 12345: - s = event.data() - - self.mlineedit.append(s) - - if s.latin1() == "Green!": - self.label.setPaletteBackgroundColor(TQt.green) - else: - self.label.setPaletteBackgroundColor(TQt.yellow) - - self.label.setText(s) - - del s - elif event.type() == 12346: - s = event.data() - - TQMessageBox.information(self,s.latin1() + " - Finished", - "The thread creating the \"" + s.latin1() + - "\" events has finished.") - - del s - else: - print("Unknown custom event type:", event.type()) - - -app = TQApplication(sys.argv) -se = SemaphoreExample() -app.setMainWidget(se) -se.show() - -sys.exit(app.exec_loop()) diff --git a/examples2/splitter.py b/examples2/splitter.py deleted file mode 100755 index 3d7450c..0000000 --- a/examples2/splitter.py +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env python - -import sys -from python_tqt.qt import * - -class Test(TQWidget): - def __init__(self, parent=None, name='Test', f=0): - TQWidget.__init__(self, parent, name, f) - - def paintEvent(self, e): - p = TQPainter(self) - p.setClipRect(e.rect()) - d = 1000 - x1 = 0 - x2 = self.width() - 1 - y1 = 0 - y2 = self.height() - 1 - - x = int((x1+x2)/2) - p.drawLine(x, y1, x+d, y1+d) - p.drawLine(x, y1, x-d, y1+d) - p.drawLine(x, y2, x+d, y2-d) - p.drawLine(x, y2, x-d, y2-d) - - y = int((y1+y2)/2) - p.drawLine(x1, y, x1+d, y+d) - p.drawLine(x1, y, x1+d, y-d) - p.drawLine(x2, y, x2-d, y+d) - p.drawLine(x2, y, x2-d, y-d) - - -if __name__=="__main__": - a = TQApplication(sys.argv) - - s1 = TQSplitter(TQt.Vertical, None, "main") - s2 = TQSplitter(TQt.Horizontal, s1, "top") - - t1 = Test(s2) - t1.setPaletteBackgroundColor(TQt.blue.light(180)) - t1.setMinimumSize(50,0) - - t2 = Test(s2) - t2.setPaletteBackgroundColor(TQt.green.light(180)) - s2.setResizeMode(t2, TQSplitter.KeepSize) - s2.moveToFirst(t2) - - s3 = TQSplitter(TQt.Horizontal, s1, "bottom") - - t3 = Test(s3) - t3.setPaletteBackgroundColor(TQt.red) - t4 = Test(s3) - t4.setPaletteBackgroundColor(TQt.white) - - t5 = Test(s3) - t5.setMaximumHeight(250) - t5.setMinimumSize(80,50) - t5.setPaletteBackgroundColor(TQt.yellow) - - s1.setOpaqueResize(1) - s2.setOpaqueResize(1) - s3.setOpaqueResize(1) - - a.setMainWidget(s1) - s1.show() - a.exec_loop() diff --git a/examples2/table.py b/examples2/table.py deleted file mode 100755 index f9db886..0000000 --- a/examples2/table.py +++ /dev/null @@ -1,115 +0,0 @@ -#!/usr/bin/env python - -import sys -from python_tqt.qt import * - -class Table(TQTableView): - def __init__(self, numRows, numCols, parent=None, name=''): - TQTableView.__init__(self, parent, name) - self.curRow = self.curCol = 0 - self.setFocusPolicy(TQWidget.StrongFocus) - self.setBackgroundMode(TQWidget.PaletteBase) - self.setNumCols(numCols) - self.setNumRows(numRows) - self.setCellWidth(100) - self.setCellHeight(30) - self.setTableFlags(Tbl_vScrollBar | - Tbl_hScrollBar | - Tbl_clipCellPainting) - self.resize(400,200) - self.contents = [''] * (numRows * numCols) - - def cellContent(self, row, col): - return self.contents[self.indexOf(row,col)] - - def setCellContent(self, row, col, c): - self.contents[self.indexOf(row,col)] = c - self.updateCell(row, col) - - def paintCell(self, p, row, col): - w = self.cellWidth(col) - h = self.cellHeight(row) - x2 = w-1 - y2 = h-1 - - p.drawLine(x2,0,x2,y2) - p.drawLine(0,y2,x2,y2) - - if row == self.curRow and col == self.curCol: - if self.hasFocus(): - p.drawRect(0, 0, x2, y2) - else: - p.setPen(TQt.DotLine) - p.drawRect(0, 0, x2, y2) - p.setPen(TQt.SolidLine) - - p.drawText(0,0,w,h,TQt.AlignCenter,self.contents[self.indexOf(row,col)]) - - def mousePressEvent(self, me): - oldRow = self.curRow - oldCol = self.curCol - clickedPos = me.pos() - self.curRow = self.findRow(clickedPos.y()) - self.curCol = self.findCol(clickedPos.x()) - if self.curRow != oldRow or \ - self.curCol != oldCol: - self.updateCell(oldRow, oldCol) - self.updateCell(self.curRow, self.curCol) - - def keyPressEvent(self, ke): - oldRow = self.curRow - oldCol = self.curCol - edge = 0 - key = ke.key() - if key == Key_Left: - if self.curCol > 0: - self.curCol = self.curCol - 1 - edge = self.leftCell() - if self.curCol < edge: - self.setLeftCell(edge-1) - elif key == Key_Right: - if self.curCol < self.numCols()-1: - self.curCol = self.curCol + 1 - edge = self.lastColVisible() - if self.curCol >= edge: - self.setLeftCell(self.leftCell()+1) - elif key == Key_Up: - if self.curRow > 0: - self.curRow = self.curRow - 1 - edge = self.topCell() - if self.curRow < edge: - self.setTopCell(edge-1) - elif key == Key_Down: - if self.curRow < self.numRows()-1: - self.curRow = self.curRow + 1 - edge = self.lastRowVisible() - if self.curRow >= edge: - self.setTopCell(self.topCell()+1) - else: - ke.ignore() - return - - if self.curRow != oldRow or \ - self.curCol != oldCol: - self.updateCell(oldRow, oldCol) - self.updateCell(self.curRow, self.curCol) - - def focusInEvnet(self, fie): - self.updateCell(self.curRow, self.curCol) - - def focusOutEvent(self, foe): - self.updateCell(self.curRow, self.curCol) - - def indexOf(self, row, col): - return (row * self.numCols()) + col - -numRows = 20 -numCols = 20 -a = TQApplication(sys.argv) -v = Table(numRows, numCols) -for i in range(numRows): - for j in range(numCols): - v.setCellContent(i,j,'%d %c' % (j, 65+(i%26))) -a.setMainWidget(v) -v.show() -a.exec_loop() diff --git a/examples2/themes.py b/examples2/themes.py deleted file mode 100755 index 4465348..0000000 --- a/examples2/themes.py +++ /dev/null @@ -1,2484 +0,0 @@ -#!/usr/bin/env python - -# This is a port to PyTQt of the TQt v2.x example program. It does not (yet) -# include the implementation of all of the example widgets. - - -FALSE=0 -TRUE=1 - -# Python modules - -import os, sys - -# include files for QT - -from python_tqt.qt import * - - -class ButtonsGroups(TQVBox): - - def __init__(self, parent=None, name=None): - TQVBox.__init__(self, parent, name) - - # Create widgets which allow easy layouting - box1=TQHBox(self) - box2=TQHBox(self) - - # first group - - # Create an exclusive button group - grp1=TQButtonGroup( 1 - , TQGroupBox.Horizontal - , "Button Group 1 (exclusive)" - , box1 - ) - grp1.setExclusive(TRUE) - - # insert 3 radiobuttons - rb11=TQRadioButton("&Radiobutton 1", grp1) - rb11.setChecked(TRUE) - TQRadioButton("R&adiobutton 2", grp1) - TQRadioButton("Ra&diobutton 3", grp1) - - # second group - - # Create a non-exclusive buttongroup - grp2=TQButtonGroup( 1 - , TQGroupBox.Horizontal - , "Button Group 2 (non-exclusive)" - , box1 - ) - grp2.setExclusive(FALSE) - - # insert 3 checkboxes - TQCheckBox("&Checkbox 1", grp2) - cb12=TQCheckBox("C&heckbox 2", grp2) - cb12.setChecked(TRUE) - cb13=TQCheckBox("Triple &State Button", grp2) - cb13.setTristate(TRUE) - cb13.setChecked(TRUE) - - # third group - - # create a buttongroup which is exclusive for radiobuttons and - # non-exclusive for all other buttons - grp3=TQButtonGroup( 1 - , TQGroupBox.Horizontal - , "Button Group 3 (Radiobutton-exclusive)" - , box2 - ) - grp3.setRadioButtonExclusive(TRUE) - - # insert three radiobuttons - self.rb21=TQRadioButton("Rad&iobutton 1", grp3) - self.rb22=TQRadioButton("Radi&obutton 2", grp3) - self.rb23=TQRadioButton("Radio&button 3", grp3) - self.rb23.setChecked(TRUE) - - # insert a checkbox... - self.state=TQCheckBox("E&nable Radiobuttons", grp3) - self.state.setChecked(TRUE) - # ...and connect its SIGNAL clicked() with the SLOT slotChangeGrp3State() - self.connect(self.state, SIGNAL('clicked()'),self.slotChangeGrp3State) - - # fourth group - - # create a groupbox which lays out its childs in a column - grp4=TQGroupBox( 1 - , TQGroupBox.Horizontal - , "Groupbox with normal buttons" - , box2 - ) - - # insert two pushbuttons... - TQPushButton("&Push Button", grp4) - tb=TQPushButton("&Toggle Button", grp4) - - # ...and make the second one a toggle button - tb.setToggleButton(TRUE) - tb.setOn(TRUE) - - def slotChangeGrp3State(self): - self.rb21.setEnabled(self.state.isChecked()) - self.rb22.setEnabled(self.state.isChecked()) - self.rb23.setEnabled(self.state.isChecked()) - - -class LineEdits(TQVBox): - - def __init__(self, parent=None, name=None): - TQVBox.__init__(self, parent, name) - - self.setMargin(10) - - # Widget for layouting - row1=TQHBox(self) - row1.setMargin(5) - - # Create a label - TQLabel("Echo Mode: ", row1) - - # Create a Combobox with three items... - self.combo1=TQComboBox(FALSE, row1) - self.combo1.insertItem("Normal", -1) - self.combo1.insertItem("Password", -1) - self.combo1.insertItem("No Echo", -1) - # ...and connect the activated() SIGNAL with the slotEchoChanged SLOT to be - # able to react when an item is selected - self.connect(self.combo1, SIGNAL('activated(int)'), self.slotEchoChanged) - - # insert the first LineEdit - self.lined1=TQLineEdit(self) - - # another widget which is used for layouting - row2=TQHBox(self) - row2.setMargin(5) - - # and the second label - TQLabel("Validator: ", row2) - - # A second Combobox with again three items... - self.combo2=TQComboBox(FALSE, row2) - self.combo2.insertItem("No Validator", -1) - self.combo2.insertItem("Integer Validator", -1) - self.combo2.insertItem("Double Validator", -1) - # ...and again the activated() SIGNAL gets connected with a SLOT - self.connect(self.combo2, SIGNAL('activated(int)'), self.slotValidatorChanged) - - # and the second LineEdit - self.lined2=TQLineEdit(self) - - # yet another widget which is used for layouting - row3=TQHBox(self) - row3.setMargin(5) - - # we need a label for this too - TQLabel("Alignment: ", row3) - - # A combo box for setting alignment - self.combo3=TQComboBox(FALSE, row3) - self.combo3.insertItem("Left", -1) - self.combo3.insertItem("Centered", -1) - self.combo3.insertItem("Right", -1) - # ...and again the activated() SIGNAL gets connected with a SLOT - self.connect(self.combo3, SIGNAL('activated(int)'), self.slotAlignmentChanged) - - # and the lineedit - self.lined3=TQLineEdit(self) - - # give the first LineEdit the focus at the beginning - self.lined1.setFocus() - - def slotEchoChanged(self, i): - if i == 0: - self.lined1.setEchoMode(TQLineEdit.EchoMode.Normal) - elif i == 1: - self.lined1.setEchoMode(TQLineEdit.EchoMode.Password) - elif i == 2: - self.lined1.setEchoMode(TQLineEdit.EchoMode.NoEcho) - - self.lined1.setFocus() - - def slotValidatorChanged(self, i): - if i == 0: - self.validator=None - self.lined2.setValidator(self.validator) - elif i == 1: - self.validator=TQIntValidator(self.lined2) - self.lined2.setValidator(self.validator) - elif i == 2: - self.validator=TQDoubleValidator(-999.0, 999.0, 2, self.lined2) - self.lined2.setValidator(self.validator) - - self.lined2.setText("") - self.lined2.setFocus() - - def slotAlignmentChanged(self, i): - if i == 0: - self.lined3.setAlignment(TQt.AlignLeft) - elif i == 1: - self.lined3.setAlignment(TQt.AlignCenter) - elif i == 2: - self.lined3.setAlignment(TQt.AlignRight) - - self.lined3.setFocus() - - -class ProgressBar(TQVBox): - - def __init__(self, parent=None, name=None): - TQVBox.__init__(self, parent, name) - - self.timer=TQTimer() - - self.setMargin(10) - - # Create a radiobutton-exclusive Buttongroup which aligns its childs in two - # columns - bg=TQButtonGroup(2, TQGroupBox.Horizontal, self) - bg.setRadioButtonExclusive(TRUE) - - # insert three radiobuttons which the user can use to set the speed of the - # progress and two pushbuttons to start/pause/continue and reset the - # progress - self.slow=TQRadioButton("&Slow", bg) - self.start=TQPushButton("S&tart", bg) - self.normal=TQRadioButton("&Normal", bg) - self.reset=TQPushButton("&Reset", bg) - self.fast=TQRadioButton("&Fast", bg) - - # Create the progressbar - self.progress=TQProgressBar(100, self) - - # connect the clicked() SIGNALs of the pushbuttons to SLOTs - self.connect(self.start, SIGNAL('clicked()'), self.slotStart) - self.connect(self.reset, SIGNAL('clicked()'), self.slotReset) - - # connect the timeout() SIGNAL of the progress-timer to a SLOT - self.connect(self.timer, SIGNAL('timeout()'), self.slotTimeout) - - # Let's start with normal speed... - self.normal.setChecked(TRUE) - - def slotStart(self): - # If the progress bar is at the beginning... - if self.progress.progress() == -1: - # ...set according to the checked speed-radionbutton the number of steps - # which are needed to complete the process - if self.slow.isChecked(): - self.progress.setTotalSteps(10000) - elif self.normal.isChecked(): - self.progress.setTotalSteps(1000) - else: - self.progress.setTotalSteps(50) - - # disable the speed-radiobuttons - self.slow.setEnabled(FALSE) - self.normal.setEnabled(FALSE) - self.fast.setEnabled(FALSE) - - # If the progress is not running... - if not self.timer.isActive(): - # ...start the time (and so the progress) with an interval fo 1ms... - self.timer.start(1) - # ...and rename the start/pause/continue button to Pause - self.start.setText("&Pause") - else: - # ...stop the timer (and so the progress)... - self.timer.stop() - # ...and rename the start/pause/continue button to Continue - self.start.setText("&Continue") - - def slotReset(self): - # stop the timer and progress - self.timer.stop() - - # rename the start/pause/continue button to Start... - self.start.setText("&Start") - # ...and enable this button - self.start.setEnabled(TRUE) - - # enable the speed-radiobuttons - self.slow.setEnabled(TRUE) - self.normal.setEnabled(TRUE) - self.fast.setEnabled(TRUE) - - # reset the progressbar - self.progress.reset() - - def slotTimeout(self): - p = self.progress.progress() - - # If the progress is complete... - if p == self.progress.totalSteps(): - # ...rename the start/pause/continue button to Start... - self.start.setText("&Start") - # ...and disable it... - self.start.setEnabled(FALSE) - # ...and return - return - - # If the progress is not complete increase it - self.progress.setProgress(p+1) - - -class ListBoxCombo(TQVBox): - - def __init__(self, parent=None, name=None): - TQVBox.__init__(self, parent, name) - - self.setMargin(5) - - row1=TQHBox(self) - row1.setMargin(5) - - # Create a multi-selection ListBox... - self.lb1=TQListBox(row1) - self.lb1.setMultiSelection(TRUE) - - # ...insert a pixmap item... - self.lb1.insertItem(TQPixmap("qtlogo.png")) - # ...and 100 text items - for i in range(100): - str=TQString("Listbox Item %1").arg(i) - self.lb1.insertItem(str) - - # Create a pushbutton... - self.arrow1=TQPushButton(" -> ", row1) - # ...and connect the clicked SIGNAL with the SLOT slotLeft2Right - self.connect(self.arrow1, SIGNAL('clicked()'), self.slotLeft2Right) - - # create an empty single-selection ListBox - self.lb2=TQListBox(row1) - - def slotLeft2Right(self): - # Go through all items of the first ListBox - for i in range(self.lb1.count()): - item=self.lb1.item(i) - # if the item is selected... - if item.selected(): - # ...and it is a text item... - if not item.text().isEmpty(): - # ...insert an item with the same text into the second ListBox - self.lb2.insertItem(TQListBoxText(item.text())) - # ...and if it is a pixmap item... - elif item.pixmap(): - # ...insert an item with the same pixmap into the second ListBox - self.lb2.insertItem(TQListBoxPixmap(item.pixmap())) - - -class NorwegianWoodStyle(TQMotifStyle): - - def __init__(self): - TQMotifStyle.__init__(self) - - def polish(self,o): - if isinstance(o,TQApplication): - self.polish_qapplication(o) - elif isinstance(o,TQWidget): - self.polish_qwidget(o) - else: - TQMotifStyle.polish(self,o) - - def unPolish(self,o): - if isinstance(o,TQApplication): - self.unPolish_qapplication(o) - elif isinstance(o,TQWidget): - self.unPolish_qwidget(o) - else: - TQMotifStyle.unPolish(self,o) - - def polish_qapplication(self,app): - global button_xpm, polish_xpm - - self.oldPalette=app.palette() - - # we simply create a nice TQColorGroup with a couple of fancy wood pixmaps - # here and apply it to all widgets - - img=TQImage(button_xpm) - orig=TQImage(img) - orig.detach() - button=TQPixmap() - button.convertFromImage(img) - - background=TQPixmap(polish_xpm) - - for i in range(img.numColors()): - rgb=img.color(i) - c=TQColor(rgb) - (r, g, b)=c.dark().rgb() - img.setColor(i,tqRgb(r, g, b)) - mid=TQPixmap() - mid.convertFromImage(img) - - img=TQImage(orig) - for i in range(img.numColors()): - rgb=img.color(i) - c=TQColor(rgb) - (r, g, b)=c.light().rgb() - img.setColor(i,tqRgb(r, g, b)) - light=TQPixmap() - light.convertFromImage(img) - - img=TQImage(orig) - for i in range(img.numColors()): - rgb=img.color(i) - c=TQColor(rgb) - (r, g, b)=c.dark().rgb() - img.setColor(i,tqRgb(r, g, b)) - dark=TQPixmap() - dark.convertFromImage(img) - - op=TQPalette(TQColor(212,140,95)) - - nor=TQColorGroup(TQBrush(op.normal().foreground()), - TQBrush(op.normal().button(), button), - TQBrush(op.normal().light(), light), - TQBrush(op.normal().dark(), dark), - TQBrush(op.normal().mid(), mid), - TQBrush(op.normal().text()), - TQBrush(TQt.white), - TQBrush(TQColor(236,182,120)), - TQBrush(op.normal().background(), background)) - disabled=TQColorGroup(TQBrush(op.disabled().foreground()), - TQBrush(op.disabled().button(), button), - TQBrush(op.disabled().light(), light), - TQBrush(op.disabled().dark()), - TQBrush(op.disabled().mid(), mid), - TQBrush(op.disabled().text()), - TQBrush(TQt.white), - TQBrush(TQColor(236,182,120)), - TQBrush(op.disabled().background(), background)) - active=TQColorGroup(TQBrush(op.active().foreground()), - TQBrush(op.active().button(), button), - TQBrush(op.active().light(), light), - TQBrush(op.active().dark()), - TQBrush(op.active().mid(), mid), - TQBrush(op.active().text()), - TQBrush(TQt.white), - TQBrush(TQColor(236,182,120)), - TQBrush(op.active().background(), background)) - - app.setPalette(TQPalette(nor, disabled, active), TRUE) - - def unPolish_qapplication(self,app): - app.setPalette(self.oldPalette, TRUE) - - def polish_qwidget(self,w): - # the polish function will set some widgets to transparent mode, to get the - # full benefit from the nice pixmaps in the color group. - - if w.inherits("TQTipLabel"): - return - - if w.inherits("TQLCDNumber"): - return - - if not w.isTopLevel(): - if w.inherits("TQLabel") \ - or w.inherits("TQButton") \ - or w.inherits("TQComboBox") \ - or w.inherits("TQGroupBox") \ - or w.inherits("TQSlider") \ - or w.inherits("TQTabWidget") \ - or w.inherits("TQTabBar"): - w.setAutoMask(TRUE) - - def unPolish_qwidget(self,w): - if w.inherits("TQTipLabel"): - return - - if w.inherits("TQLCDNumber"): - return - - if not w.isTopLevel(): - if w.inherits("TQLabel") \ - or w.inherits("TQButton") \ - or w.inherits("TQComboBox") \ - or w.inherits("TQGroupBox") \ - or w.inherits("TQSlider") \ - or w.inherits("TQTabWidget") \ - or w.inherits("TQTabBar"): - w.setAutoMask(FALSE) - - def drawroundrect(self, p, x, y, w, h, d): - rx=(200*d)/w - ry=(200*d)/h - p.drawRoundRect(x, y, w, h, rx, ry) - - def drawButton(self, p, x, y, w, h, g, sunken=FALSE, fill=None): - qDrawShadePanel(p, x, y, w, h, g, sunken, 5) - - oldBrush=p.brush() - oldPen=p.pen() - p.setPen(TQt.NoPen) - if fill != None: - newBrush=fill - else: - if sunken: - newBrush=g.brush(TQColorGroup.Mid) - else: - newBrush=g.brush(TQColorGroup.Button) - self.drawroundrect(p, x+3, y+3, w-6, h-6, 5) - p.setBrush(oldBrush) - p.setPen(g.foreground()) - self.drawroundrect(p, x, y, w, h, 8) - p.setPen(oldPen) - - def drawBevelButton(self, p, x, y, w, h, g, sunken=FALSE, fill=None): - TQMotifStyle.drawBevelButton(self, p, x, y, w, h, g, sunken, fill) - - def drawPushButton(self, btn, p): - g = btn.colorGroup() - - (x1, y1, x2, y2)=btn.rect().coords() - - p.setPen(g.foreground()) - p.setBrush(TQBrush(g.button(),TQt.NoBrush)) - - if btn.isDown(): - fill=g.brush(TQColorGroup.Mid) - elif btn.isOn(): - fill=TQBrush(g.mid(),TQt.Dense4Pattern) - else: - fill=g.brush(TQColorGroup.Button) - - if btn.isDefault(): - a=TQPointArray([x1, y1, x2, y1, x2, y2, x1, y2, x1, y1+1, - x2-1, y1+1, x2-1, y2-1, x1+1, y2-1, x1+1, y1+1]) - p.setPen(TQt.black) - p.drawPolyline(a) - x1=x1+2 - y1=y1+2 - x2=x2-2 - y2=y2-2 - - if btn.isOn() or btn.isDown(): - sunken=TRUE - else: - sunken=FALSE - - self.drawButton(p, x1, y1, x2-x1+1, y2-y1+1, g, sunken, fill) - - if btn.isMenuButton(): - dx=(y1-y2-4)/3 - self.drawArrow(p, TQt.DownArrow, FALSE, - x2-dx, dx, y1, y2-y1, - g, btn.isEnabled()) - - if p.brush().style != TQt.NoBrush: - p.setBrush(TQt.NoBrush) - - def drawPushButtonLabel(self, btn, p): - r=btn.rect() - (x, y, w, h)=r.rect() - - (x1, y1, x2, y2)=btn.rect().coords() - dx=0 - dy=0 - if btn.isMenuButton(): - dx=(y2-y1)/3 - if dx or dy: - p.translate(dx,dy) - - x=x+2 - y=y+2 - w=w-4 - h=h-4 - g=btn.colorGroup() - if btn.isDown() or btn.isOn(): - pencolour=btn.colorGroup().brightText() - else: - pencolour=btn.colorGroup().buttonText() - self.drawItem(p, x, y, w, h, - TQt.AlignCenter|TQt.ShowPrefix, - g, btn.isEnabled(), - btn.pixmap(), btn.text(), -1, - pencolour) - - if dx or dy: - p.translate(-dx,-dy) - - def buttonRect(self, x, y, w, h): - return TQRect(x+3, y+2, w-6, h-4) - - def drawButtonMask(self, p, x, y, w, h): - self.drawroundrect(p, x, y, w, h, 8) - - -class MetalStyle(TQWindowsStyle): - - def __init__(self): - TQWindowsStyle.__init__(self) - - def polish(self,o): - if isinstance(o,TQApplication): - self.polish_qapplication(o) - elif isinstance(o,TQWidget): - self.polish_qwidget(o) - else: - TQWindowsStyle.polish(self,o) - - def unPolish(self,o): - if isinstance(o,TQApplication): - self.unPolish_qapplication(o) - elif isinstance(o,TQWidget): - self.unPolish_qwidget(o) - else: - TQWindowsStyle.unPolish(self,o) - - def polish_qapplication(self,app): - global stone1_xpm, stonebright_xpm - - self.oldPalette=app.palette() - - # we simply create a nice TQColorGroup with a couple of fancy pixmaps here - # and apply it to all widgets - - f=TQFont("times", app.font().pointSize()) - f.setBold(TRUE) - f.setItalic(TRUE) - app.setFont(f, TRUE, "TQMenuBar") - app.setFont(f, TRUE, "TQPopupMenu") - - button=TQPixmap(stone1_xpm) - background=TQPixmap(stonebright_xpm) - dark=TQPixmap(1,1) - dark.fill(TQt.red.dark()) - mid=TQPixmap(stone1_xpm) - light=TQPixmap(stone1_xpm) - op=app.palette() - - backCol=TQColor(227,227,227) - - nor=TQColorGroup(TQBrush(op.normal().foreground()), - TQBrush(op.normal().button(), button), - TQBrush(op.normal().light(), light), - TQBrush(op.normal().dark(), dark), - TQBrush(op.normal().mid(), mid), - TQBrush(op.normal().text()), - TQBrush(TQt.white), - TQBrush(op.normal().base()), - TQBrush(backCol, background)) - nor.setColor(TQColorGroup.ButtonText, TQt.white) - nor.setColor(TQColorGroup.Shadow, TQt.black) - disabled=TQColorGroup(TQBrush(op.disabled().foreground()), - TQBrush(op.disabled().button(), button), - TQBrush(op.disabled().light(), light), - TQBrush(op.disabled().dark()), - TQBrush(op.disabled().mid(), mid), - TQBrush(op.disabled().text()), - TQBrush(TQt.white), - TQBrush(op.disabled().base()), - TQBrush(backCol, background)) - active=TQColorGroup(TQBrush(op.active().foreground()), - TQBrush(op.active().button(), button), - TQBrush(op.active().light(), light), - TQBrush(op.active().dark()), - TQBrush(op.active().mid(), mid), - TQBrush(op.active().text()), - TQBrush(TQt.white), - TQBrush(op.active().base()), - TQBrush(backCol, background)) - active.setColor(TQColorGroup.ButtonText, TQt.white) - - newPalette=TQPalette(nor, disabled, active) - app.setPalette(newPalette, TRUE) - - def unPolish_qapplication(self,app): - app.setPalette(self.oldPalette, TRUE) - app.setFont(app.font(), TRUE) - - def polish_qwidget(self,w): - # the polish function will set some widgets to transparent mode, to get the - # full benefit from the nice pixmaps in the color group. - - if w.inherits("TQPushButton"): - w.setBackgroundMode(TQWidget.NoBackground) - - def unPolish_qwidget(self,w): - if w.inherits("TQPushButton"): - w.setBackgroundMode(TQWidget.PaletteButton) - - def drawButton(self, p, x, y, w, h, g, sunken=FALSE, fill=None): - global img1, metal_xpm - - if not img1: - img1=TQImage(metal_xpm) - - scaledImage=img1.smoothScale(w, h) - pix=TQPixmap() - pix.convertFromImage(scaledImage) - p.drawPixmap(x, y, pix) - g2=TQColorGroup() - g2.setColor(TQColorGroup.Light, TQt.white) - g2.setColor(TQColorGroup.Dark, TQt.black) - - if sunken: - linewidth=2 - else: - linewidth=1 - - qDrawShadePanel(p, x, y, w, h, g2, sunken, linewidth) - - def drawBevelButton(self, p, x, y, w, h, g, sunken=FALSE, fill=None): - self.drawButton(p, x, y, w, h, g, sunken, fill) - - def drawPushButton(self, btn, p): - g = btn.colorGroup() - - (x1, y1, x2, y2)=btn.rect().coords() - - p.setPen(g.foreground()) - p.setBrush(TQBrush(g.button(),TQt.NoBrush)) - - if btn.isDown(): - fill=g.brush(TQColorGroup.Mid) - elif btn.isOn(): - fill=TQBrush(g.mid(),TQt.Dense4Pattern) - else: - fill=g.brush(TQColorGroup.Button) - - if btn.isDefault(): - a=TQPointArray([x1, y1, x2, y1, x2, y2, x1, y2, x1, y1+1, - x2-1, y1+1, x2-1, y2-1, x1+1, y2-1, x1+1, y1+1]) - p.setPen(TQt.black) - p.drawPolyline(a) - x1=x1+2 - y1=y1+2 - x2=x2-2 - y2=y2-2 - - if btn.isOn() or btn.isDown(): - sunken=TRUE - else: - sunken=FALSE - - self.drawButton(p, x1, y1, x2-x1+1, y2-y1+1, g, sunken, fill) - - if btn.isMenuButton(): - dx=(y1-y2-4)/3 - self.drawArrow(p, TQt.DownArrow, FALSE, - x2-dx, dx, y1, y2-y1, - g, btn.isEnabled()) - - if p.brush().style != TQt.NoBrush: - p.setBrush(TQt.NoBrush) - - def drawPushButtonLabel(self, btn, p): - r=btn.rect() - (x, y, w, h)=r.rect() - - (x1, y1, x2, y2)=btn.rect().coords() - dx=0 - dy=0 - if btn.isMenuButton(): - dx=(y2-y1)/3 - if btn.isOn() or btn.isDown(): - dx=dx-1 - dy=dy-1 - pencolour=btn.colorGroup().brightText() - else: - pencolour=btn.colorGroup().buttonText() - if dx or dy: - p.translate(dx,dy) - - x=x+2 - y=y+2 - w=w-4 - h=h-4 - g=btn.colorGroup() - self.drawItem(p, x, y, w, h, - TQt.AlignCenter|TQt.ShowPrefix, - g, btn.isEnabled(), - btn.pixmap(), btn.text(), -1, - pencolour) - - if dx or dy: - p.translate(-dx,-dy) - - def drawPanel(self, p, x, y, w, h, g, sunken, lineWidth, fill): - TQStyle.drawPanel(self, p, x, y, w, h, g, sunken, lineWidth, fill) - - -class Themes(TQMainWindow): - - def __init__(self, parent=None, name=None, f=TQt.WType_TopLevel): - TQMainWindow.__init__(self, parent, name, f) - - self.appFont=TQApplication.font() - self.tabwidget=TQTabWidget(self) - - self.buttonsgroups=ButtonsGroups(self.tabwidget) - self.tabwidget.addTab(self.buttonsgroups,"Buttons/Groups") - self.hbox=TQHBox(self.tabwidget) - self.hbox.setMargin(5) - self.linedits=LineEdits(self.hbox) - self.progressbar=ProgressBar(self.hbox) - self.tabwidget.addTab(self.hbox, "Lineedits/Progressbar") - self.listboxcombo=ListBoxCombo(self.tabwidget) - self.tabwidget.addTab(self.listboxcombo, "Listboxes/Comboboxes") - - self.setCentralWidget(self.tabwidget) - - self.style=TQPopupMenu(self) - self.style.setCheckable(TRUE) - self.menuBar().insertItem("&Style", self.style) - - self.sMetal=self.style.insertItem("&Metal", self.styleMetal) - self.sWood=self.style.insertItem("&Norwegian Wood", self.styleWood) - self.sPlatinum=self.style.insertItem("&Platinum", self.stylePlatinum) - self.sWindows=self.style.insertItem("&Windows", self.styleWindows) - self.sCDE=self.style.insertItem("&CDE", self.styleCDE) - self.sMotif=self.style.insertItem("M&otif", self.styleMotif) - self.sMotifPlus=self.style.insertItem("Motif P&lus", self.styleMotifPlus) - self.style.insertSeparator() - self.style.insertItem("&Quit", tqApp.quit, TQt.CTRL | TQt.Key_Q) - - self.help=TQPopupMenu(self) - self.menuBar().insertSeparator() - self.menuBar().insertItem("&Help", self.help) - self.help.insertItem("&About", self.about, TQt.Key_F1) - self.help.insertItem("About &TQt", self.aboutTQt) - - self.style=NorwegianWoodStyle() - tqApp.setStyle(self.style) - self.menuBar().setItemChecked(self.sWood, TRUE) - - # In the following we cannot simply set the new style as we can in C++. We - # need to keep the old style alive (if it is a Python one) so that it's - # unPolish methods can still be called when the new style is set. - - def styleWood(self): - newstyle=NorwegianWoodStyle() - tqApp.setStyle(newstyle) - self.style=newstyle - tqApp.setFont(self.appFont, TRUE) - self.selectStyleMenu(self.sWood) - - def styleMetal(self): - newstyle=MetalStyle() - tqApp.setStyle(newstyle) - self.style=newstyle - tqApp.setFont(self.appFont, TRUE) - self.selectStyleMenu(self.sMetal) - - def stylePlatinum(self): - newstyle=TQPlatinumStyle() - tqApp.setStyle(newstyle) - self.style=newstyle - p=TQPalette(TQColor(239, 239, 239)) - tqApp.setPalette(p, TRUE) - tqApp.setFont(self.appFont, TRUE) - self.selectStyleMenu(self.sPlatinum) - - def styleWindows(self): - newstyle=TQWindowsStyle() - tqApp.setStyle(newstyle) - self.style=newstyle - tqApp.setFont(self.appFont, TRUE) - self.selectStyleMenu(self.sWindows) - - def styleCDE(self): - newstyle=TQCDEStyle(TRUE) - tqApp.setStyle(newstyle) - self.style=newstyle - self.selectStyleMenu(self.sCDE) - - p=TQPalette(TQColor(75, 123, 130)) - p.setColor(TQPalette.Active, TQColorGroup.Base, TQColor(55, 77, 78)); - p.setColor(TQPalette.Inactive, TQColorGroup.Base, TQColor(55, 77, 78)); - p.setColor(TQPalette.Disabled, TQColorGroup.Base, TQColor(55, 77, 78)); - p.setColor(TQPalette.Active, TQColorGroup.Highlight, TQt.white); - p.setColor(TQPalette.Active, TQColorGroup.HighlightedText, TQColor(55, 77, 78)); - p.setColor(TQPalette.Inactive, TQColorGroup.Highlight, TQt.white); - p.setColor(TQPalette.Inactive, TQColorGroup.HighlightedText, TQColor(55, 77, 78)); - p.setColor(TQPalette.Disabled, TQColorGroup.Highlight, TQt.white); - p.setColor(TQPalette.Disabled, TQColorGroup.HighlightedText, TQColor(55, 77, 78)); - p.setColor(TQPalette.Active, TQColorGroup.Foreground, TQt.white); - p.setColor(TQPalette.Active, TQColorGroup.Text, TQt.white); - p.setColor(TQPalette.Active, TQColorGroup.ButtonText, TQt.white); - p.setColor(TQPalette.Inactive, TQColorGroup.Foreground, TQt.white); - p.setColor(TQPalette.Inactive, TQColorGroup.Text, TQt.white); - p.setColor(TQPalette.Inactive, TQColorGroup.ButtonText, TQt.white); - p.setColor(TQPalette.Disabled, TQColorGroup.Foreground, TQt.lightGray); - p.setColor(TQPalette.Disabled, TQColorGroup.Text, TQt.lightGray); - p.setColor(TQPalette.Disabled, TQColorGroup.ButtonText, TQt.lightGray); - tqApp.setPalette(p, TRUE) - tqApp.setFont(TQFont("times", self.appFont.pointSize()), TRUE) - - def styleMotif(self): - newstyle=TQMotifStyle(TRUE) - tqApp.setStyle(newstyle) - self.style=newstyle - p=TQPalette(TQColor(192, 192, 192)) - tqApp.setPalette(p, TRUE) - tqApp.setFont(self.appFont, TRUE) - self.selectStyleMenu(self.sMotif) - - def styleMotifPlus(self): - newstyle=TQMotifPlusStyle(TRUE) - tqApp.setStyle(newstyle) - self.style=newstyle - p=TQPalette(TQColor(192, 192, 192)) - tqApp.setPalette(p, TRUE) - tqApp.setFont(self.appFont, TRUE) - self.selectStyleMenu(self.sMotifPlus) - - def about(self): - TQMessageBox.about(self, "TQt Themes Example", - "

This example demonstrates the concept of " - "generalized GUI styles first introduced " - " with the 2.0 release of TQt.

" ) - - def aboutTQt(self): - TQMessageBox.aboutTQt(self, "TQt Themes Example") - - def selectStyleMenu(self, s): - self.menuBar().setItemChecked(self.sWood, FALSE) - self.menuBar().setItemChecked(self.sMetal, FALSE) - self.menuBar().setItemChecked(self.sPlatinum, FALSE) - self.menuBar().setItemChecked(self.sCDE, FALSE) - self.menuBar().setItemChecked(self.sMotif, FALSE) - self.menuBar().setItemChecked(self.sMotifPlus, FALSE) - self.menuBar().setItemChecked(self.sWindows, FALSE) - self.menuBar().setItemChecked(s, TRUE) - - -def main(argv): - TQApplication.setColorSpec(TQApplication.CustomColor) - TQApplication.setStyle(TQWindowsStyle()) - a=TQApplication(sys.argv) - - themes=Themes() - themes.setCaption('Theme (TQStyle) example') - themes.resize(640,400) - a.setMainWidget(themes) - themes.show() - - return a.exec_loop() - - -# Put these here where they are out of the way of most of the code. - -polish_xpm = [ -" 96 96 254 2", -".. c #9c4a34", -".# c #a4825c", -".a c #bc5e2c", -".b c #d48432", -".c c #dc9f51", -".d c #bc6e1c", -".e c #d4855d", -".f c #94664c", -".g c #bc714e", -".h c #8c6664", -".i c #d4923c", -".j c #bc8444", -".k c #d49360", -".l c #d4794e", -".m c #ecaf68", -".n c #bc8365", -".o c #d47439", -".p c #a46954", -".q c #dc9f70", -".r c #e48544", -".s c #bc7b51", -".t c #a47761", -".u c #bc7b42", -".v c #a4523c", -".w c #e4945e", -".x c #9c784c", -".y c #d4844a", -".z c #eca053", -".A c #bc614c", -".B c #e4855c", -".C c #bc8350", -".D c #c48e68", -".E c #b16634", -".F c #e49339", -".G c #bc703a", -".H c #bc7c67", -".I c #a45f34", -".J c #cc714d", -".K c #d48c5f", -".L c #a47057", -".M c #cc703a", -".N c #dca674", -".O c #b47859", -".P c #bc6729", -".Q c #d49475", -".R c #d48b4a", -".S c #cc8351", -".T c #cc8466", -".U c #ac6841", -".V c #e4a651", -".W c #e49576", -".X c #d47d31", -".Y c #ac6e4b", -".Z c #c07650", -".0 c #e48c43", -".1 c #e49452", -".2 c #9c745f", -".3 c #e47e54", -".4 c #cc7c4f", -".5 c #cc7c32", -".6 c #b46133", -".7 c #d49a68", -".8 c #d67e4f", -".9 c #bc7643", -"#. c #b47056", -"## c #d48b3a", -"#a c #dc9f5e", -"#b c #e49a60", -"#c c #cc6a31", -"#d c #8c6244", -"#e c #dc9a41", -"#f c #eca753", -"#g c #bc8a58", -"#h c #d48c76", -"#i c #bc693f", -"#j c #bc715d", -"#k c #9c6857", -"#l c #f4b171", -"#m c #bc8a6a", -"#n c #eca16d", -"#o c #a87e58", -"#p c #a4613f", -"#q c #a48569", -"#r c #d4846d", -"#s c #dc935f", -"#t c #c47c50", -"#u c #dc8449", -"#v c #bc6950", -"#w c #cc9678", -"#x c #c4703a", -"#y c #cc7b67", -"#z c #dc8c5e", -"#A c #ac7067", -"#B c #eca86e", -"#C c #b4786d", -"#D c #dc8c4a", -"#E c #b46842", -"#F c #d47c41", -"#G c #e48d51", -"#H c #e59a52", -"#I c #9c6e3f", -"#J c #d49351", -"#K c #cc843b", -"#L c #ecb678", -"#M c #9c5a38", -"#N c #d4795c", -"#O c #c47b39", -"#P c #ec9560", -"#Q c #ac764c", -"#R c #c48351", -"#S c #c48e74", -"#T c #cc7650", -"#U c #cc8a84", -"#V c #bc6a5c", -"#W c #e4af74", -"#X c #b46855", -"#Y c #e4a06e", -"#Z c #ac775b", -"#0 c #e48d5d", -"#1 c #c47d65", -"#2 c #cc763f", -"#3 c #b47e5d", -"#4 c #cc8a55", -"#5 c #cc8a67", -"#6 c #bf622f", -"#7 c #dc853b", -"#8 c #e49f4a", -"#9 c #9c505c", -"a. c #8c5644", -"a# c #cc7329", -"aa c #a45a51", -"ab c #b48264", -"ac c #9c7a7c", -"ad c #9c5f4f", -"ae c #b4844c", -"af c #a46749", -"ag c #dca664", -"ah c #b46e1c", -"ai c #c4762c", -"aj c #a45a3c", -"ak c #dc9a74", -"al c #ac7e46", -"am c #ac6a6c", -"an c #eca862", -"ao c #e49a41", -"ap c #e49a78", -"aq c #bc7660", -"ar c #d57e5e", -"as c #9c6e5c", -"at c #ab7e65", -"au c #cc8a44", -"av c #9c6240", -"aw c #bc6244", -"ax c #bc5d3f", -"ay c #e48550", -"az c #eca060", -"aA c #cc7160", -"aB c #cc7c42", -"aC c #b46241", -"aD c #b4726c", -"aE c #eca67f", -"aF c #9c6a3c", -"aG c #94685a", -"aH c #c48240", -"aI c #c48465", -"aJ c #dc7640", -"aK c #cc8f54", -"aL c #e4a76f", -"aM c #c4692e", -"aN c #dc9474", -"aO c #ac6050", -"aP c #b47048", -"aQ c #94614b", -"aR c #ac836c", -"aS c #a47048", -"aT c #b4764a", -"aU c #ec8e5c", -"aV c #dc9a53", -"aW c #cc765e", -"aX c #b48a64", -"aY c #dc9a63", -"aZ c #c47640", -"a0 c #ec9a60", -"a1 c #c48a54", -"a2 c #c48a67", -"a3 c #ac5a3c", -"a4 c #ac8458", -"a5 c #dc855d", -"a6 c #c4714d", -"a7 c #dc9243", -"a8 c #dc794e", -"a9 c #ac6955", -"b. c #cc8f67", -"b# c #ac6032", -"ba c #ac7056", -"bb c #dc7a34", -"bc c #ec9553", -"bd c #dc8d3b", -"be c #e4a060", -"bf c #f4a654", -"bg c #c46842", -"bh c #c46f62", -"bi c #ac613d", -"bj c #dc866c", -"bk c #c4694e", -"bl c #dc7d42", -"bm c #ec8d4f", -"bn c #dc9351", -"bo c #cc9177", -"bp c #c4695f", -"bq c #ecb075", -"br c #e4a75f", -"bs c #d4843c", -"bt c #bc722c", -"bu c #d4936c", -"bv c #d47644", -"bw c #bc7d5c", -"bx c #ac563c", -"by c #e4956c", -"bz c #a47a4c", -"bA c #d48454", -"bB c #bc825c", -"bC c #e49544", -"bD c #bc7044", -"bE c #bc7e74", -"bF c #d48d6c", -"bG c #cc7144", -"bH c #b47864", -"bI c #bc6a34", -"bJ c #d49684", -"bK c #d48b54", -"bL c #cc845c", -"bM c #cc8474", -"bN c #ac684c", -"bO c #cc7d5c", -"bP c #eca27c", -"bQ c #dc946c", -"bR c #c47c5c", -"bS c #dc8554", -"bT c #c47244", -"bU c #dc8c6c", -"bV c #dc8c54", -"bW c #b4684c", -"bX c #cc8344", -"bY c #c47b44", -"bZ c #c4825c", -"b0 c #e4a17c", -"b1 c #ac7a64", -"b2 c #e48c6c", -"b3 c #c47a74", -"b4 c #e49f54", -"b5 c #9c674c", -"b6 c #946764", -"b7 c #c48674", -"#u#G#G#P#G#G#G.1#G#G.1.1.1.w#G.r#D.1.1.1#D#DbVbV.K.K.K.KbO.Z.Z#TaP.GaT.Z.O.O.O.H.9aP.ZaPaPaPbZbo.i.k#J.k#JbKbnbn#b#sbVbV#G#G.r.ray.r.0#G.0#G.1bc.r.0.0bc.0.0.0.r.1.1.1.1#G#D.0#D.0.0.0bcbcbc.1.0", -"#aagaLbrag#a#a#a#DbVbn#G#0.1#0#Da5#za5.4.J.Jbk#vbt.G#x.9bY.4#tbYbw.saPaP.Ub#af.Y.s.s.Z.saP#E.gbw.U.U.UaObWbWbWaPb#b#.E#t.K.K#z#s#s#sbQ#s#sbn#s#sbn#s.w#s.w#s#sbn.ybV#s#sbV#s#sbQ#aak.7.k.7.k.k.k", -"#..g#.#.#j#.#XbW#Z#o.O.O#3.n.n.Halalalala4aXaXa4#t.u.9#R#5bu.k#5bob7aIaI.nbwbw#m#5aIa2#5#5aIb7#5.DbBbB#3bwbw.C.O#oabab.naI.C#t#R.9#tbY#tbY.ZbY.s#t#t#t#R.sbY.s#tbD.Z.Z#t.9.Z#t.4bBbw.s.saT.9aTaT", -".ybS.ybSbVbVbVbVbl#u#u#ubSaybSay#s#za5#z#z#z.KbA.Qb.aIbZbZbB.g.U.gaP#.aP#.aPaP.O.9aP.g.s.O.ZaP.Z#CaD#Aamamamam#X#3#Z.OaPaPaPaP.saZbY#t#t#tbY#tbY#t#tbLbZ.SbR#t#tbZbRbZbRbR.sbRbR.4aBaB.4bY.4.4.4", -"bKbV#zbKbA.ybK#zbV#z#0bS#0#0#0aya5bA.4.4.4#T#xbgbwaq.O.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#E.Ubi#EbDbD.ZbT#xbT#xabaRaR#oabat.O#Z.s#t.SbLaI#4aKb.b.b..Kbu.7.Qbub.", -".w#b#b#Y.w#0.1#G#z#G#z#G#b#b#b#s.1#G#G#G.1bc#G#G#G#Day#G#G#G#G#G.w#G#GbV.1#z.w#b.kbnbKbn#s#DbVbV.K#t#iaP.ZbW.g.Z.s.s.gaPaP.Zbw.Za6.Z.Z.8#r#z#ra5#D.r.r.r#Gbcbmbm#G.1.w.wbc.w#G#G#G#G#G#Ga0#P.1.r" -] - -button_xpm = [ -" 96 96 254 2", -".. c #9c3218", -".# c #a4733e", -".a c #bc450a", -".b c #d4700c", -".c c #dc8c29", -".d c #bc5e00", -".e c #d46b37", -".f c #945431", -".g c #bc5a2c", -".h c #8c4e4b", -".i c #d47e16", -".j c #bc7422", -".k c #d47d3a", -".l c #d45e28", -".m c #ec9b3e", -".n c #bc6b43", -".o c #d45a13", -".p c #a45236", -".q c #dc8848", -".r c #e46b1b", -".s c #bc652f", -".t c #a46243", -".u c #bc6920", -".v c #a4391e", -".w c #e47b35", -".x c #9c6b30", -".y c #d46d24", -".z c #ec8a29", -".A c #bc452a", -".B c #e46833", -".C c #bc702e", -".D c #c47845", -".E c #b15314", -".F c #e47e10", -".G c #bc5a18", -".H c #bc6145", -".I c #a44d16", -".J c #cc5728", -".K c #d47439", -".L c #a45b39", -".M c #cc5815", -".N c #dc8f4c", -".O c #b46239", -".P c #bc5307", -".Q c #d4794f", -".R c #d47624", -".S c #cc6c2c", -".T c #cc6941", -".U c #ac5222", -".V c #e49328", -".W c #e4754d", -".X c #d4650b", -".Y c #ac592c", -".Z c #c05e2d", -".0 c #e4751a", -".1 c #e47d29", -".2 c #9c6143", -".3 c #e45f2b", -".4 c #cc632a", -".5 c #cc660d", -".6 c #b44b13", -".7 c #d48442", -".8 c #d66228", -".9 c #bc6221", -"#. c #b45736", -"## c #d47714", -"#a c #dc8936", -"#b c #e48237", -"#c c #cc530c", -"#d c #8c522b", -"#e c #dc8819", -"#f c #ec9129", -"#g c #bc7936", -"#h c #d46f50", -"#i c #bc521d", -"#j c #bc553b", -"#k c #9c523b", -"#l c #f49a45", -"#m c #bc7548", -"#n c #ec8643", -"#o c #a86d3a", -"#p c #a44d21", -"#q c #a4754b", -"#r c #d46547", -"#s c #dc7937", -"#t c #c4642d", -"#u c #dc6c21", -"#v c #bc4d2e", -"#w c #cc7e53", -"#x c #c45917", -"#y c #cc5c42", -"#z c #dc7036", -"#A c #ac5448", -"#B c #ec8f44", -"#C c #b45c4d", -"#D c #dc7622", -"#E c #b45222", -"#F c #d4651b", -"#G c #e47328", -"#H c #e58429", -"#I c #9c5f23", -"#J c #d47f2b", -"#K c #cc7116", -"#L c #eca24e", -"#M c #9c471c", -"#N c #d45b36", -"#O c #c46716", -"#P c #ec7836", -"#Q c #ac642d", -"#R c #c46f2e", -"#S c #c47551", -"#T c #cc5b2b", -"#U c #cc685f", -"#V c #bc4b3a", -"#W c #e49a4b", -"#X c #b44c35", -"#Y c #e48745", -"#Z c #ac613c", -"#0 c #e47234", -"#1 c #c46242", -"#2 c #cc5e1a", -"#3 c #b4683d", -"#4 c #cc7430", -"#5 c #cc7042", -"#6 c #bf4b0d", -"#7 c #dc6e13", -"#8 c #e48c21", -"#9 c #9c3445", -"a. c #8c432b", -"a# c #cc5e04", -"aa c #a43f33", -"ab c #b46d44", -"ac c #9c5e62", -"ad c #9c4833", -"ae c #b4742c", -"af c #a4522b", -"ag c #dc943c", -"ah c #b46000", -"ai c #c46309", -"aj c #a4441e", -"ak c #dc7f4c", -"al c #ac6e27", -"am c #ac4b4e", -"an c #ec9238", -"ao c #e48518", -"ap c #e47c4f", -"aq c #bc5c3e", -"ar c #d56238", -"as c #9c5840", -"at c #ab6946", -"au c #cc761f", -"av c #9c5024", -"aw c #bc4922", -"ax c #bc421d", -"ay c #e46927", -"az c #ec8836", -"aA c #cc513b", -"aB c #cc661d", -"aC c #b44a21", -"aD c #b4544c", -"aE c #ec8a55", -"aF c #9c5a20", -"aG c #94533f", -"aH c #c4701d", -"aI c #c46b42", -"aJ c #dc5a18", -"aK c #cc7b2f", -"aL c #e49046", -"aM c #c4520b", -"aN c #dc774c", -"aO c #ac4631", -"aP c #b45b28", -"aQ c #944e30", -"aR c #ac6e4d", -"aS c #a45f2a", -"aT c #b4612a", -"aU c #ec7032", -"aV c #dc872b", -"aW c #cc5939", -"aX c #b47844", -"aY c #dc843b", -"aZ c #c4601d", -"a0 c #ec7f36", -"a1 c #c47531", -"a2 c #c47344", -"a3 c #ac431d", -"a4 c #ac7439", -"a5 c #dc6735", -"a6 c #c4582a", -"a7 c #dc7c1b", -"a8 c #dc5d26", -"a9 c #ac5036", -"b. c #cc7742", -"b# c #ac4b13", -"ba c #ac5a37", -"bb c #dc5f0c", -"bc c #ec7a29", -"bd c #dc7813", -"be c #e48b37", -"bf c #f48e28", -"bg c #c44e1f", -"bh c #c44e3f", -"bi c #ac4b1e", -"bj c #dc6544", -"bk c #c44c2b", -"bl c #dc611a", -"bm c #ec7125", -"bn c #dc7d29", -"bo c #cc7752", -"bp c #c4473c", -"bq c #ec994b", -"br c #e49336", -"bs c #d46f16", -"bt c #bc600a", -"bu c #d47a46", -"bv c #d45b1e", -"bw c #bc653a", -"bx c #ac3c1d", -"by c #e47943", -"bz c #a46b2e", -"bA c #d46b2e", -"bB c #bc6c3a", -"bC c #e47f1b", -"bD c #bc5b22", -"bE c #bc6052", -"bF c #d47346", -"bG c #cc561f", -"bH c #b46044", -"bI c #bc5312", -"bJ c #d4775e", -"bK c #d4732e", -"bL c #cc6b37", -"bM c #cc644f", -"bN c #ac512d", -"bO c #cc6137", -"bP c #ec8552", -"bQ c #dc7944", -"bR c #c46339", -"bS c #dc6a2c", -"bT c #c45a21", -"bU c #dc6f44", -"bV c #dc732c", -"bW c #b4502c", -"bX c #cc6d1f", -"bY c #c46521", -"bZ c #c46939", -"b0 c #e48653", -"b1 c #ac6445", -"b2 c #e46e43", -"b3 c #c45851", -"b4 c #e48b2b", -"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YaPbV#z.wbnbV.wbn#Dbn.OaP.4.y.4#N.K.K#T#t.U.Q#z.w#F#YazanaNan.bap#Ga0az#0#P#b#KbR.Z#aaz#ibK#h#u.wbC#B#b.1bebs#B#D#baLbcbA.k#P#G#E#S#2.K.8bAbL.Tbw.6.K#G#0.wbVbVbV#s#s.e.Oba.K.4aT.k.0" -] - -stone1_xpm = [ -" 96 96 250 2", -".. c #343e34", -".# c #94a28c", -".a c #64726c", -".b c #c4d2c4", -".c c #7c8a7c", -".d c #acbaac", -".e c #4c5a4c", -".f c #dceadc", -".g c #949284", -".h c #7c7a6c", -".i c #acaaa4", -".j c #c4c2b4", -".k c #64625c", -".l c #dcdad4", -".m c #8c967c", -".n c #a4ae9c", -".o c #6c7e74", -".p c #f4f2ec", -".q c #444e3c", -".r c #bcc6b4", -".s c #8c8a7c", -".t c #5c6654", -".u c #ccdecc", -".v c #7c826c", -".w c #a4a294", -".x c #949a8c", -".y c #bcbaac", -".z c #747264", -".A c #5c5a4c", -".B c #c4cabc", -".C c #d4d2c4", -".D c #ecf2e4", -".E c #acb2a4", -".F c #646a5c", -".G c #8c867c", -".H c #54524c", -".I c #9c9a8c", -".J c #849284", -".K c #7c827c", -".L c #44463c", -".M c #9caa9c", -".N c #b4c2b4", -".O c #dce2d4", -".P c #cccabc", -".Q c #b4b2a4", -".R c #94a29c", -".S c #848a7c", -".T c #f4faec", -".U c #6c6a5c", -".V c #6c7a6c", -".W c #acbab4", -".X c #546254", -".Y c #4c564c", -".Z c #a4aa9c", -".0 c #747a6c", -".1 c #ccdacc", -".2 c #545a4c", -".3 c #74867c", -".4 c #4c4e44", -".5 c #bcc2b4", -".6 c #5c6254", -".7 c #d4dacc", -".8 c #fcfaf4", -".9 c #3c463c", -"#. c #6c7264", -"## c #e4eadc", -"#a c #949294", -"#b c #847e74", -"#c c #8c968c", -"#d c #a4b6ac", -"#e c #747e6c", -"#f c #949a9c", -"#g c #9c9a9c", -"#h c #84827c", -"#i c #e4e2d4", -"#j c #848a8c", -"#k c #9ca294", -"#l c #ccd2c4", -"#m c #7c7e7c", -"#n c #c4c6c4", -"#o c #a4aeac", -"#p c #bcc6c4", -"#q c #8c8e8c", -"#r c #d4decc", -"#s c #848274", -"#t c #a4a6a4", -"#u c #bcbebc", -"#v c #747674", -"#w c #c4cecc", -"#x c #d4d6d4", -"#y c #acb6b4", -"#z c #646a6c", -"#A c #cccecc", -"#B c #b4b6b4", -"#C c #545e5c", -"#D c #6c7674", -"#E c #747e7c", -"#F c #3c3e34", -"#G c #b4baa4", -"#H c #949684", -"#I c #7c7e6c", -"#J c #acaeac", -"#K c #c4c6b4", -"#L c #646664", -"#M c #dcdedc", -"#N c #8c8e7c", -"#O c #a4a694", -"#P c #949e8c", -"#Q c #bcbeac", -"#R c #747664", -"#S c #5c5e5c", -"#T c #c4cebc", -"#U c #d4d6c4", -"#V c #acb6a4", -"#W c #545654", -"#X c #9c9e8c", -"#Y c #eceedc", -"#Z c #4c4a44", -"#0 c #dce6d4", -"#1 c #cccebc", -"#2 c #b4b6a4", -"#3 c #9ca29c", -"#4 c #848e7c", -"#5 c #8c928c", -"#6 c #b4bab4", -"#7 c #7c8e8c", -"#8 c #44524c", -"#9 c #6c6e6c", -"a. c #e4eeec", -"a# c #d4e2dc", -"aa c #a4aaac", -"ab c #747a7c", -"ac c #5c6264", -"ad c #94a694", -"ae c #acae9c", -"af c #646654", -"ag c #dcdecc", -"ah c #a4b2a4", -"ai c #bccabc", -"aj c #5c6a5c", -"ak c #7c8674", -"al c #5c5e54", -"am c #ecf6ec", -"an c #646e64", -"ao c #545644", -"ap c #7c867c", -"aq c #444a40", -"ar c #f4fef4", -"as c #6c6e64", -"at c #545e54", -"au c #4c5249", -"av c #fcfef7", -"aw c #6c766c", -"ax c #e4eee4", -"ay c #8c9a8e", -"az c #748274", -"aA c #84867d", -"aB c #e4e6dc", -"aC c #ccd6cb", -"aD c #d4e2d4", -"aE c #3c4238", -"aF c #b4beac", -"aG c #9ca69c", -"aH c #b4beb4", -"aI c #f4f6ec", -"aJ c #3c4a3c", -"aK c #949694", -"aL c #949e9c", -"aM c #9c9e9c", -"aN c #848e8c", -"aO c #9ca694", -"aP c #a4b2ac", -"aQ c #bccac4", -"aR c #5c6a64", -"aS c #848674", -"aT c #646e6c", -"aU c #74827c", -"aV c #94a294", -"aW c #7c8a84", -"aX c #dceae4", -"aY c #94928c", -"aZ c #7c7a74", -"a0 c #c4c2bc", -"a1 c #8c9684", -"a2 c #a4aea4", -"a3 c #444e44", -"a4 c #bcc6bc", -"a5 c #8c8a84", -"a6 c #5c665c", -"a7 c #7c8274", -"a8 c #a4a29c", -"a9 c #949a94", -"b. c #bcbab4", -"b# c #74726c", -"ba c #5c5a54", -"bb c #c4cac4", -"bc c #d4d2cc", -"bd c #ecf2ec", -"be c #acb2ac", -"bf c #646a64", -"bg c #8c8684", -"bh c #9c9a94", -"bi c #84928c", -"bj c #eceae4", -"bk c #b4c2bc", -"bl c #dce2dc", -"bm c #cccac4", -"bn c #b4b2ac", -"bo c #848a84", -"bp c #f4faf4", -"bq c #8c9284", -"br c #6c6a64", -"bs c #6c7a74", -"bt c #a4aaa4", -"bu c #747a74", -"bv c #ccdad4", -"bw c #545a54", -"bx c #4c4e4c", -"by c #bcc2bc", -"bz c #5c625c", -"bA c #d4dad4", -"bB c #6c726c", -"bC c #e4eae4", -"bD c #8c9694", -"bE c #747e74", -"bF c #ccd2cc", -"bG c #d4ded4", -"bH c #b4baac", -"bI c #94968c", -"bJ c #7c7e74", -"bK c #c4c6bc", -"bL c #8c8e84", -"bM c #a4a69c", -"bN c #949e94", -"bO c #bcbeb4", -"bP c #74766c", -"bQ c #c4cec4", -"bR c #d4d6cc", -"bS c #acb6ac", -"bT c #9c9e94", -"bU c #eceee4", -"bV c #dce6dc", -"bW c #cccec4", -"bX c #b4b6ac", -"bY c #848e84", -"bZ c #8c9294", -"b0 c #acaea4", -"b1 c #64665c", -"b2 c #dcded4", -"b3 c #54564c", -".x.0.OaHbI.2azbK.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#6aAbt#m#qbqbo#c.S#5bo.O.KbtbTa8.6.Eb.aAbL.5bTa7bHbe.x.ZbtbtbPbYb0be#.bnbH", -"aC#.a9bFbobtbPbLbLbobe#3bbbbbt#qbban.EawbE#.bqbEbHbfb0#5bI.x#c#cbLbXbybtbm.SbI.ybN.Kbe.K#qbD#q#za8.5bfbBbJ.BbTbLaVbMbV#3a6brbT#u.ZbA#kbF#.bMbEbW#B#.bB#naA.K#3bT#cbLapboa2#5#.bobu.KbubyaAbhbIb0", -"#Oa2bX.KbeaA.5a1b0.xaAaAa1#kb1.6a9aA#DbH.ZaVbKbqaA.SbJaA.XbS.S.b#gaA#t.EbL.xbMbWbea2bRbtbubWaM#5.ZaZbP.EbMbJ#mbJ.V#GbHaH#3bc.KaYbL#ca9.0#5a2bqbfbMaZbtaZaAbM#tasbeaCb0bTa4.x.K.E#vbE#LbraKbKbIaA", -".xakaKbybW#6bM#l#ka7#k.nbM.0bH#Pa2#3by#..K#kak#0bnbMaA.5.K.BbNa6aK.ka9bLbc.wbL.7.xaAbqbAbo#JawaB.KbLbq#BbebMbMbL.##Va7#2.S.B.0bIbEb2.7#6.Z.KbJbq#m#5a8bWby#ua8#6#3#lawbTbea7bL#3#3#J#5#.#3.ib#bM" -] - -stonebright_xpm = [ -" 96 96 250 2", -".. c #7b927b", -".# c #daefcf", -".a c #b5cec3", -".b c #ebfceb", -".c c #cce2cb", -".d c #e5f8e5", -".e c #99b499", -".f c #effeef", -".g c #e8e4cf", -".h c #d7d3bb", -".i c #f3f0e7", -".j c #faf7e6", -".k c #bfbbb0", -".l c #fdfbf4", -".m c #dae9c1", -".n c #e6f4db", -".o c #bbd9c7", -".p c #fffdf7", -".q c #91a680", -".r c #effbe4", -".s c #e3e0c9", -".t c #b0c2a0", -".u c #eafeea", -".v c #d3ddb8", -".w c #f0ecd8", -".x c #e3ecd7", -".y c #f8f5e3", -".z c #d0ccb3", -".A c #b6b297", -".B c #f4fbea", -".C c #fdfaea", -".D c #f9fff0", -".E c #eef6e3", -".F c #bbc6ab", -".G c #e3d9c9", -".H c #ada99d", -".I c #ede9d5", -".J c #d1e7d1", -".K c #d3ddd3", -".L c #989c86", -".M c #dff3df", -".N c #e8fae7", -".O c #f7feee", -".P c #fcf9e9", -".Q c #f6f3e0", -".R c #daefe6", -".S c #d9e2cb", -".T c #f9fff1", -".U c #c8c4ab", -".V c #bdd6bd", -".W c #e5f8f0", -".X c #a2bda2", -".Y c #9baf9b", -".Z c #ebf3df", -".0 c #ccd6bd", -".1 c #edfded", -".2 c #a9b499", -".3 c #c1dfce", -".4 c #a2a690", -".5 c #f3fae7", -".6 c #b2bda2", -".7 c #f6fded", -".8 c #fffdf7", -".9 c #869c86", -"#. c #c4ceb5", -"## c #f8feef", -"#a c #e8e5e8", -"#b c #ded3c3", -"#c c #d9e9d9", -"#d c #dff7e9", -"#e c #c8d9bb", -"#f c #e1eaed", -"#g c #edeaed", -"#h c #dedbd0", -"#i c #fefcec", -"#j c #d7e0e3", -"#k c #e6efda", -"#l c #f5fceb", -"#m c #d5d9d5", -"#n c #f9fbf9", -"#o c #e6f4f1", -"#p c #effbf9", -"#q c #e2e5e2", -"#r c #f3feea", -"#s c #dedac3", -"#t c #eef1ee", -"#u c #f6f9f6", -"#v c #ced2ce", -"#w c #f0fcfa", -"#x c #fbfdfb", -"#y c #e9f7f4", -"#z c #b9c4c8", -"#A c #fafcfa", -"#B c #f4f7f4", -"#C c #a4b8b4", -"#D c #c0d2ce", -"#E c #c7d9d5", -"#F c #8d927b", -"#G c #f0f8db", -"#H c #e6e9cd", -"#I c #d6d9bb", -"#J c #f1f4f1", -"#K c #f9fbe4", -"#L c #bec2be", -"#M c #fcfefc", -"#N c #e2e5c8", -"#O c #eff1d7", -"#P c #dfeed3", -"#Q c #f7f9e1", -"#R c #cfd2b2", -"#S c #b4b8b4", -"#T c #f0fce6", -"#U c #fbfde8", -"#V c #eaf7df", -"#W c #abafab", -"#X c #eceed3", -"#Y c #fdffec", -"#Z c #a39f92", -"#0 c #f3feea", -"#1 c #fafce6", -"#2 c #f5f7df", -"#3 c #e6efe6", -"#4 c #d5e5c8", -"#5 c #dee7de", -"#6 c #f0f8f0", -"#7 c #c8e5e2", -"#8 c #8daa9d", -"#9 c #c6cac6", -"a. c #f4fffd", -"a# c #eefef7", -"aa c #e7f0f3", -"ab c #c9d4d7", -"ac c #b0bcbf", -"ad c #d8f1d7", -"ae c #f2f4db", -"af c #bfc2a0", -"ag c #fcfeea", -"ah c #e3f6e3", -"ai c #eafbea", -"aj c #abc6ab", -"ak c #cfdfc1", -"al c #b4b8a4", -"am c #f5fff5", -"an c #b8cab8", -"ao c #abaf8a", -"ap c #cfdfcf", -"aq c #94a18b", -"ar c #f5fff5", -"as c #c6cab8", -"at c #a4b8a4", -"au c #9daa97", -"av c #fdfff8", -"aw c #c0d2c0", -"ax c #f4fff4", -"ay c #d7ecd9", -"az c #c6ddc6", -"aA c #dcdfd0", -"aB c #fcfef3", -"aC c #f1fdf0", -"aD c #eefeee", -"aE c #899780", -"aF c #ecf9e1", -"aG c #e2f1e2", -"aH c #ecf9ec", -"aI c #fdfff5", -"aJ c #83a182", -"aK c #e6e9e6", -"aL c #dfeeeb", -"aM c #ebeeeb", -"aN c #d5e5e2", -"aO c #e3f1d7", -"aP c #e3f6ed", -"aQ c #eafbf4", -"aR c #abc6bb", -"aS c #dcdfc1", -"aT c #b8cac6", -"aU c #c6ddd3", -"aV c #dbefda", -"aW c #cbe2d8", -"aX c #effef7", -"aY c #e8e5dc", -"aZ c #d7d3c9", -"a0 c #faf7f0", -"a1 c #dae9cd", -"a2 c #e6f4e6", -"a3 c #91a690", -"a4 c #effbef", -"a5 c #e3dfd7", -"a6 c #b0c2b0", -"a7 c #d3ddc6", -"a8 c #f0ede4", -"a9 c #e3ece3", -"b. c #f8f5ee", -"b# c #d0ccc2", -"ba c #b6b2a6", -"bb c #f4fbf4", -"bc c #fdfaf4", -"bd c #f9fff9", -"be c #eef6ee", -"bf c #bbc6bb", -"bg c #e3d9d7", -"bh c #edeae1", -"bi c #d1e7dd", -"bj c #fffdf6", -"bk c #e7faf2", -"bl c #f7fef7", -"bm c #fcf9f2", -"bn c #f6f3ec", -"bo c #d8e2d8", -"bp c #f9fff9", -"bq c #dee7d1", -"br c #c8c4b9", -"bs c #bdd6cb", -"bt c #eaf3ea", -"bu c #cbd6cb", -"bv c #edfdf6", -"bw c #a9b4a8", -"bx c #a2a6a2", -"by c #f2faf2", -"bz c #b2bdb2", -"bA c #f6fdf6", -"bB c #c3cec3", -"bC c #f8fef8", -"bD c #d9e9e6", -"bE c #c9d9c7", -"bF c #f5fcf5", -"bG c #f3fef3", -"bH c #f1f8e5", -"bI c #e6e9d9", -"bJ c #d6d9c7", -"bK c #f9fbef", -"bL c #e2e5d5", -"bM c #eef1e2", -"bN c #dfeedf", -"bO c #f6f9ec", -"bP c #cfd2c0", -"bQ c #f0fcf0", -"bR c #fbfdf1", -"bS c #e9f7e9", -"bT c #ebeedf", -"bU c #fdfff4", -"bV c #f3fef3", -"bW c #fafcf0", -"bX c #f4f7e9", -"bY c #d5e5d5", -"bZ c #dce5e8", -"b0 c #f1f4e6", -"b1 c #bec2b0", -"b2 c #fcfef3", -"b3 c #abaf9b", -".x.0.OaHbI.2azbK.rbJaF.Zbq.EbqbT#..x#6at.S.KaGbOaz#5albJb1b0bAayaw#..S##.xb0an#IbI#NalaFbH.5a6bN#kbSbobT.5bObu.Z#k.5.ZaYbL.ga9aZ#e.EaDbqap#..Z.S.SbP.ZbMaF.BbI#lbT#3ap.xbYbO.SbL.ZbEbXb0awbL#PbI", -"#k#c#..San#c.5bqa7bqb0bR.SbW#P.KbLawbqbLbCbHbT.5bY.c.ibObMa0aD.5.xbHa9.6bHa1bT.raAbIb0an#3#5bt#caAbXbWbYbtbSbM.SaCbq.t.xa5.SbLaAbLapbP#cbo.SaCbt#kbPaybIaOaGbMaOaG#c#k#S.Z#5#3blbIaO#k.Z.xbHbLaH", -"#3bOaHa1.xb0bH.YasbN#c#k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#GbHaH#3bc.KaYbL#ca9.0#5a2bqbfbMaZbtaZaAbM#tasbeaCb0bTa4.x.K.E#vbE#LbraKbKbIaA", -".xakaKbybW#6bM#l#ka7#k.nbM.0bH#Pa2#3by#..K#kak#0bnbMaA.5.K.BbNa6aK.ka9bLbc.wbL.7.xaAbqbAbo#JawaB.KbLbq#BbebMbMbL.##Va7#2.S.B.0bIbEb2.7#6.Z.KbJbq#m#5a8bWby#ua8#6#3#lawbTbea7bL#3#3#J#5#.#3.ib#bM" -] - -metal_xpm = [ -" 154 77 46 1", -". c #040204", -"# c #4c4e4c", -"a c #6c767c", -"b c #5c6264", -"c c #848a8c", -"d c #545a5c", -"e c #7c8284", -"f c #646e74", -"g c #3c3e3c", -"h c #444644", -"i c #8c9294", -"j c #4c565c", -"k c #7c7e84", -"l c #646a6c", -"m c #747e84", -"n c #4c525c", -"o c #74767c", -"p c #64666c", -"q c #8c8e94", -"r c #5c5e64", -"s c #84868c", -"t c #6c6e74", -"u c #444244", -"v c #4c4a4c", -"w c #4c5254", -"x c #5c666c", -"y c #848e94", -"z c #545e64", -"A c #7c868c", -"B c #3c4244", -"C c #444a4c", -"D c #8c969c", -"E c #747a7c", -"F c #6c7274", -"G c #4c4e54", -"H c #5c626c", -"I c #848a94", -"J c #545a64", -"K c #7c828c", -"L c #3c3e44", -"M c #44464c", -"N c #8c929c", -"O c #54565c", -"P c #646a74", -"Q c #747a84", -"R c #6c727c", -"DNDDDDDDDDDDNDNDNDNNiNNiNiNyiyiyqyyyyIyIcIcIcAsAsAAKAKeKememkmmmTQEQEEaoaoaaFRFFFftftlfPllllpxpxpxHbbbrbrzrzrJddddOdOOjOjOnwwwwwGwGG#GCGC#CCCCCCCMCMMMhMBhB", -"DDDNDNDNDNDNDDNDiDNDNDiyNNiNNyNyiyqyqyIyIIcIcIAcAsAseAKeKekemkmkEmETQEEoaoaoRFRFFtFtftltlPllplpxpbpbHbbrbrrzrdrdJdddOOOOjOwOwOGwwwGwGGGCGCG#CvC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FRaFFFRFFRFFFFtFtftfttftfftlPlPtlPpplplpxpxpxpbpbbbprbrbrrrzrzdrdddOrOOdOOOOOjOwOwwOwGwwGwG#GCwCG#CGCCCGCGMMCMMMCMBCBMBMuBMBuBuBuLBB", -"RFoFoRFFoRFRFRoFRRFRFFFRFFRFFRFFRttRttFfttfftfltPltPllpllplpxppxpbpHbHbHbrbrbrbzrrdrdrdOrdOdOdOdOOwOwOwOwwwwwGwGGwGGGGCGCvCvCCCMCMCMCMMhMMMhMMBMBuBBuBLBBL", -"RFRFFFRRFFaFRFFRFRoFRFRFRFFRFtFtFttftfttfftftltllPllPlPplppppxpxpbxpbpbbHrbrrzrrzrzdrddrOOdOdOOjOjOOwwOwwOGwGwGG#CwCGCGCGCGCCvMCCMCMMMBCBMBuBMBuBMBMLBuBLB", -"RFtRFRFFFRFFFRFRFFtFRFtFtttttRttfFftftftftltlPlPllPllpplxlxpxpbpbpbbbrHrbrbzbrzrdrdrdddOddOdOdOOwOOwOwwOwGwGwGwGwGGGC#GCGCCvCCCvMCMChCMMMMBMBMBMBuBBuBLuBL", -"tFRFtFRFFFFRFFFtRFtFtFtRtFtfFftfttftftfltlflPtllPllplplppxpxpxpbHbprbbbrbrrrrzrrzdrddrOddOdOOjOOOwwOwOw#wwO#GGG#GCGCGCGCCvCCCvMCMCMMMMBhBMMhBMBuBBuBBBBBLB", -"fFtFtFtttttttttFtFtRfttftfFtfttftftftltfPltlllPlllpPpxpxppxpbpbbpHbbbHrbrbzrzrdrdrdrOdddOdOOOOjOwOwOwwGOwGGwGwGwCGGGGCGCvCCvCMCMCMMMMhMMhMBMBuBuBMBBuLuLBL", -"ttfttttRtRtFtfRftftftfttftftftftfltlPllltlPlPlllpPppppxpxpxpbHpbbbrHrrbrrrrzrzrdrdOdddOdOOdjOjOOwOwwOwwGwGwGG#GCwGC#CGCvCCGMCMCMMMChBCBMBMuBMBMBBuBLBBBLBL", -"tfttfftfftffttftttftftftftftftPltflPltPPlPlplpplpplxpxppxpbbpbbHbHbbrbrrrzrzrdrdddrdOddOdOOOwOOwOwwOw#OwwGwGGGGwCGCGCvCCGCMCCCMCCMMMMMCBhMBMBuBuBBuBuLuLBL", -"ftffttftftftftftfftftftfftlltlftlltlPlllplpPplppxpxpxpxbpbbpbbbrbrrbrrzrzrzdrddrddOddOdOOjOOOwwOwOwwwGGGwGG#GCwGGCGCGCGCCCvCMMCMMMhBCuMMBMBMBMBBMBBBBBLBLL", -"ltftffftftftfftfPtltltltlltPlPlllPlPlllPplplppxpxppxpbpHbpHbbHbHrbbrbrrzrrdrdrdddOddOdOdOOjOwOOwwwOGOwwwGwGwGwCGCGCGCvCCvCMCMCMMMMCMMBMBMBMBuBuBuBLuBLBLBg", -"PlPtltlltltltlltlflPlPlPlPllPtlPlplplpplpppxpxppxpxpbxpbbbbbprbrbrrrzrzrzdrdrOdrOdOdOOOjOjOOwOwOwwwwGwGwG#GCG#GCGCGCCCvCMCCMCMMCMhBMMhBMhBMBMBBuBLuBLBuLLL", -"ltllPltlPlPlPltPltltlfPlltlPlplplPlpPpPpplxpppxpxpbbpbbrpbHbrbrbrrrrzrrdrdrddddOddOdOdOdwOOwOwwwwOGwwGwGGwGwCGC#GCvCvCCGCMvCMCMhMMCBMBMMBMBuBBuBBBBLBLBLBg", -"lPlPllPlPlPllPlllPllPtllPplllPplpplpppxpxppxxpxpbpbpbbpbrbrrbrrrrzrzrzrdrddrOdrOOdOOOjOOOwwOwOwOw#wO#wGG#GCwGCGCCGCCGCCMCMCMMMMMhBMMhBMBhBuBuBBBMLuBLBLLLL", -"lllllPlPllPlPllPplpllppllplplplplpplxpxppxxppbpbpbHrbHbrbHbbrbzrzrrzrdrddrdddOdOdOOdOOjOwOOwOww#OwwGGGGwGGwCGGCGGCCvCCCMvCMCMCMMMMhMBMMBuBMBuBuBLBBLuLBLBg", -"lpPlPllllPlllPplPlpPpllpPplpppxpxpxppxpxpxpbxbbbbbpbbbbHrrrrrrrzrzrdrddrOdOdddOdOOdjOjOOwOw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rzrzrzzrzrrzrrrzrdrdrdrdrdrdddrddddOdOdOdOdOOOOOjOjOOwwOwOwwOwO#GwGGwGGG#G#CwCw#CGCvCCCvCCMCMCMCMMMMBCBMBhBMBhBuBBuBBBuBBLLBLLLgLgLLgLgLgLg", -"rzrrzrrzrrzrrzrrzrrzrrzrzzrzdrdrdrddrdrddddrdddOrddOdOdOOOdOOjOOwOjwOwOwwOwOwGwwGwwGGwGwCGwCGGCGCGCCvCCvCCMCMCMMChMhMMhMBMBMBMBMBuLMBBLBLuLBLBLBLLgLLgLgLg", -"zrzrzrzrzrzrzrzrzrzrzrdrdrdrdzrddrdrddddrOddOJddOOOdOOOOdOOjOOjOjwOOwOwwww#GwwwGwG#Gw#GGGCGGCGCvCCvCCCCMCvMCMMMMMBCBMBMBMuBuBuBBuBBBuLBLBLBLLgLgLgLgLgLgLg", -"rdrdrdrdrdrdrdrdrdrdddrdrdrdrddrJdddOrJOddddddOOdOdOdOdOjOjOOwOwOwOwwwwOwOwGOGwGwGwGGGCGCGGCGCGCCvCvCGCCMMCMCMCMMMMMhMhMBMBMBMBuBBuBLBLuLBLBLBLLLgLLgLgLgg", -"drddrddrddrddrddrdrdrddrdddddrOddrdddOddrOOOdOddOOOOOOjOOjOwOjOwOwwwOwww#Gww#GGGGG#GCwGGCGCGCGCvCGCCCMCMCCMMMMMhBCBMBMBuBMBuBBuBBuBLuBLBLLLgLgLgLLggLgLgLg", -"ddrddrdddrddrddrdddddrddOrdrddddOdOJdddOOOdOdOOOdjOOjOOOwOOwOwOwwwwO#OwGOwGwGwGwGwCGGCGCGC#CvCGCCCMvCCMvMMCMCMCBMhMhMBMBMBMBuBBuBLBBBLBLBLBLBLgLgLgLgLgLgg" -] - -img1=None - -if __name__=="__main__": - main(sys.argv) diff --git a/examples2/trolltech.bmp b/examples2/trolltech.bmp deleted file mode 100644 index 9f399c7..0000000 Binary files a/examples2/trolltech.bmp and /dev/null differ diff --git a/examples2/trolltech.gif b/examples2/trolltech.gif deleted file mode 100644 index f674369..0000000 Binary files a/examples2/trolltech.gif and /dev/null differ diff --git a/examples2/tt-logo.png b/examples2/tt-logo.png deleted file mode 100644 index 1b0e865..0000000 Binary files a/examples2/tt-logo.png and /dev/null differ diff --git a/examples2/tut1.py b/examples2/tut1.py deleted file mode 100755 index f6e4b47..0000000 --- a/examples2/tut1.py +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env python - -# TQt tutorial 1. - -import sys -from python_tqt.qt import * - - -a = TQApplication(sys.argv) - -hello = TQPushButton("Hello world!",None) -hello.resize(100,30) - -a.setMainWidget(hello) -hello.show() -a.exec_loop() diff --git a/examples2/tut10.py b/examples2/tut10.py deleted file mode 100755 index a19ba9c..0000000 --- a/examples2/tut10.py +++ /dev/null @@ -1,145 +0,0 @@ -#!/usr/bin/env python - -# TQt tutorial 10. - -import sys -from python_tqt.qt import * - - -class LCDRange(TQVBox): - def __init__(self,parent=None,name=None): - TQVBox.__init__(self,parent,name) - - lcd = TQLCDNumber(2,self,'lcd') - self.slider = TQSlider(TQt.Horizontal,self,'slider') - self.slider.setRange(0,99) - self.slider.setValue(0) - self.connect(self.slider,SIGNAL('valueChanged(int)'),lcd,SLOT('display(int)')) - self.connect(self.slider,SIGNAL('valueChanged(int)'),self,PYSIGNAL('valueChanged(int)')) - - self.setFocusProxy(self.slider) - - def value(self): - return self.slider.value() - - def setValue(self,value): - self.slider.setValue(value) - - def setRange(self,minVal,maxVal): - if minVal < 0 or maxVal > 99 or minVal > maxVal: - raise ValueError('LCDRange.setRange(): invalid range') - self.slider.setRange(minVal,maxVal) - - -class CannonField(TQWidget): - def __init__(self,parent=None,name=None): - TQWidget.__init__(self,parent,name) - - self.ang = 45 - self.f = 0 - self.setPalette(TQPalette(TQColor(250,250,200))) - - def angle(self): - return self.ang - - def setAngle(self,degrees): - if degrees < 5: - degrees = 5 - if degrees > 70: - degrees = 70 - if self.ang == degrees: - return - self.ang = degrees - self.repaint(self.cannonRect(),0) - self.emit(PYSIGNAL('angleChanged(int)'),(self.ang,)) - - def force(self): - return self.f - - def setForce(self,newton): - if newton < 0: - newton = 0 - if self.f == newton: - return - self.f = newton - self.emit(PYSIGNAL('forceChanged(int)'),(self.f,)) - - def paintEvent(self,ev): - if not ev.rect().intersects(self.cannonRect()): - return - - cr = self.cannonRect() - pix = TQPixmap(cr.size()) - pix.fill(self,cr.topLeft()) - - p = TQPainter(pix) - - p.setBrush(TQt.blue) - p.setPen(TQt.NoPen) - - p.translate(0,pix.height() - 1) - p.drawPie(TQRect(-35,-35,70,70),0,90 * 16) - p.rotate(-self.ang) - p.drawRect(TQRect(33,-4,15,8)) - p.end() - - p.begin(self) - p.drawPixmap(cr.topLeft(),pix) - - def cannonRect(self): - r = TQRect(0,0,50,50) - r.moveBottomLeft(self.rect().bottomLeft()) - return r - - def sizePolicy(self): - return TQSizePolicy(TQSizePolicy.Expanding,TQSizePolicy.Expanding) - - -class MyWidget(TQWidget): - def __init__(self,parent=None,name=None): - TQWidget.__init__(self,parent,name) - - quit = TQPushButton('&Quit',self,'quit') - quit.setFont(TQFont('Times',18,TQFont.Bold)) - self.connect(quit,SIGNAL('clicked()'),tqApp,SLOT('quit()')) - - self.angle = LCDRange(self,'angle') - self.angle.setRange(5,70) - - self.force = LCDRange(self,'force') - self.force.setRange(10,50) - - self.cannonField = CannonField(self,'cannonField') - - self.connect(self.angle,PYSIGNAL('valueChanged(int)'),self.cannonField.setAngle) - self.connect(self.cannonField,PYSIGNAL('angleChanged(int)'),self.angle.setValue) - - self.connect(self.force,PYSIGNAL('valueChanged(int)'),self.cannonField.setForce) - self.connect(self.cannonField,PYSIGNAL('forceChanged(int)'),self.force.setValue) - - grid = TQGridLayout(self,2,2,10) - - grid.addWidget(quit,0,0) - grid.addWidget(self.cannonField,1,1) - grid.setColStretch(1,10) - - leftBox = TQVBoxLayout() - - grid.addLayout(leftBox,1,0) - - leftBox.addWidget(self.angle) - leftBox.addWidget(self.force) - - self.angle.setValue(60) - self.force.setValue(25) - self.angle.setFocus() - - -TQApplication.setColorSpec(TQApplication.CustomColor) -a = TQApplication(sys.argv) - -w = MyWidget() -w.setGeometry(100,100,500,355) -a.setMainWidget(w) -w.show() -a.exec_loop() diff --git a/examples2/tut11.py b/examples2/tut11.py deleted file mode 100755 index 7979d3d..0000000 --- a/examples2/tut11.py +++ /dev/null @@ -1,213 +0,0 @@ -#!/usr/bin/env python - -# TQt tutorial 11. - -import sys -import math -from python_tqt.qt import * - - -class LCDRange(TQVBox): - def __init__(self,parent=None,name=None): - TQVBox.__init__(self,parent,name) - - lcd = TQLCDNumber(2,self,'lcd') - self.slider = TQSlider(TQt.Horizontal,self,'slider') - self.slider.setRange(0,99) - self.slider.setValue(0) - self.connect(self.slider,SIGNAL('valueChanged(int)'),lcd,SLOT('display(int)')) - self.connect(self.slider,SIGNAL('valueChanged(int)'),self,PYSIGNAL('valueChanged(int)')) - - self.setFocusProxy(self.slider) - - def value(self): - return self.slider.value() - - def setValue(self,value): - self.slider.setValue(value) - - def setRange(self,minVal,maxVal): - if minVal < 0 or maxVal > 99 or minVal > maxVal: - raise ValueError('LCDRange.setRange(): invalid range') - self.slider.setRange(minVal,maxVal) - - -class CannonField(TQWidget): - def __init__(self,parent=None,name=None): - TQWidget.__init__(self,parent,name) - - self.ang = 45 - self.f = 0 - self.timerCount = 0 - - self.autoShootTimer = TQTimer(self,'movement handler') - self.connect(self.autoShootTimer,SIGNAL('timeout()'),self.moveShot) - - self.shoot_ang = 0 - self.shoot_f = 0 - - self.setPalette(TQPalette(TQColor(250,250,200))) - - self.barrelRect = TQRect(33,-4,15,8) - - def angle(self): - return self.ang - - def setAngle(self,degrees): - if degrees < 5: - degrees = 5 - if degrees > 70: - degrees = 70 - if self.ang == degrees: - return - self.ang = degrees - self.repaint(self.cannonRect(),0) - self.emit(PYSIGNAL('angleChanged(int)'),(self.ang,)) - - def force(self): - return self.f - - def setForce(self,newton): - if newton < 0: - newton = 0 - if self.f == newton: - return - self.f = newton - self.emit(PYSIGNAL('forceChanged(int)'),(self.f,)) - - def shoot(self): - if self.autoShootTimer.isActive(): - return - - self.timerCount = 0 - self.shoot_ang = self.ang - self.shoot_f = self.f - self.autoShootTimer.start(50) - - def moveShot(self): - r = TQRegion(self.shotRect()) - self.timerCount = self.timerCount + 1 - - shotR = self.shotRect() - - if shotR.x() > self.width() or shotR.y() > self.height(): - self.autoShootTimer.stop() - else: - r = r.unite(TQRegion(shotR)) - - self.repaint(r) - - def paintEvent(self,ev): - updateR = ev.rect() - p = TQPainter(self) - - if updateR.intersects(self.cannonRect()): - self.paintCannon(p) - - if self.autoShootTimer.isActive() and updateR.intersects(self.shotRect()): - self.paintShot(p) - - def paintShot(self,p): - p.setBrush(TQt.black) - p.setPen(TQt.NoPen) - p.drawRect(self.shotRect()) - - def paintCannon(self,p): - cr = self.cannonRect() - pix = TQPixmap(cr.size()) - pix.fill(self,cr.topLeft()) - - tmp = TQPainter(pix) - tmp.setBrush(TQt.blue) - tmp.setPen(TQt.NoPen) - - tmp.translate(0,pix.height() - 1) - tmp.drawPie(TQRect(-35,-35,70,70),0,90 * 16) - tmp.rotate(-self.ang) - tmp.drawRect(self.barrelRect) - tmp.end() - - p.drawPixmap(cr.topLeft(),pix) - - def cannonRect(self): - r = TQRect(0,0,50,50) - r.moveBottomLeft(self.rect().bottomLeft()) - return r - - def shotRect(self): - gravity = 4.0 - - time = self.timerCount / 4.0 - velocity = self.shoot_f - radians = self.shoot_ang * 3.14159265 / 180 - - velx = velocity * math.cos(radians) - vely = velocity * math.sin(radians) - x0 = (self.barrelRect.right() + 5) * math.cos(radians) - y0 = (self.barrelRect.right() + 5) * math.sin(radians) - x = x0 + velx * time - y = y0 + vely * time - 0.5 * gravity * time * time - - r = TQRect(0,0,6,6) - r.moveCenter(TQPoint(int(x),int(self.height() - 1 - y)))) - return r - - def sizePolicy(self): - return TQSizePolicy(TQSizePolicy.Expanding,TQSizePolicy.Expanding) - - -class MyWidget(TQWidget): - def __init__(self,parent=None,name=None): - TQWidget.__init__(self,parent,name) - - quit = TQPushButton('&Quit',self,'quit') - quit.setFont(TQFont('Times',18,TQFont.Bold)) - self.connect(quit,SIGNAL('clicked()'),tqApp,SLOT('quit()')) - - self.angle = LCDRange(self,'angle') - self.angle.setRange(5,70) - - self.force = LCDRange(self,'force') - self.force.setRange(10,50) - - self.cannonField = CannonField(self,'cannonField') - - self.connect(self.angle,PYSIGNAL('valueChanged(int)'),self.cannonField.setAngle) - self.connect(self.cannonField,PYSIGNAL('angleChanged(int)'),self.angle.setValue) - - self.connect(self.force,PYSIGNAL('valueChanged(int)'),self.cannonField.setForce) - self.connect(self.cannonField,PYSIGNAL('forceChanged(int)'),self.force.setValue) - - shoot = TQPushButton('&Shoot',self,'shoot') - shoot.setFont(TQFont('Times',18,TQFont.Bold)) - self.connect(shoot,SIGNAL('clicked()'),self.cannonField.shoot) - - grid = TQGridLayout(self,2,2,10) - - grid.addWidget(quit,0,0) - grid.addWidget(self.cannonField,1,1) - grid.setColStretch(1,10) - - leftBox = TQVBoxLayout() - grid.addLayout(leftBox,1,0) - leftBox.addWidget(self.angle) - leftBox.addWidget(self.force) - - topBox = TQHBoxLayout() - grid.addLayout(topBox,0,1) - topBox.addWidget(shoot) - topBox.addStretch(1) - - self.angle.setValue(60) - self.force.setValue(25) - self.angle.setFocus() - - -TQApplication.setColorSpec(TQApplication.CustomColor) -a = TQApplication(sys.argv) - -w = MyWidget() -w.setGeometry(100,100,500,355) -a.setMainWidget(w) -w.show() -a.exec_loop() diff --git a/examples2/tut12.py b/examples2/tut12.py deleted file mode 100755 index 8b2a700..0000000 --- a/examples2/tut12.py +++ /dev/null @@ -1,252 +0,0 @@ -#!/usr/bin/env python - -# TQt tutorial 12. - -import sys -import math -import random -from python_tqt.qt import * - - -class LCDRange(TQVBox): - def __init__(self,s=None,parent=None,name=None): - TQVBox.__init__(self,parent,name) - - lcd = TQLCDNumber(2,self,'lcd') - self.slider = TQSlider(TQt.Horizontal,self,'slider') - self.slider.setRange(0,99) - self.slider.setValue(0) - - self.label = TQLabel(' ',self,'label') - self.label.setAlignment(TQt.AlignCenter) - - self.connect(self.slider,SIGNAL('valueChanged(int)'),lcd,SLOT('display(int)')) - self.connect(self.slider,SIGNAL('valueChanged(int)'),self,PYSIGNAL('valueChanged(int)')) - - self.setFocusProxy(self.slider) - - if s is not None: - self.setText(s) - - def value(self): - return self.slider.value() - - def setValue(self,value): - self.slider.setValue(value) - - def setRange(self,minVal,maxVal): - if minVal < 0 or maxVal > 99 or minVal > maxVal: - raise ValueError('LCDRange.setRange(): invalid range') - self.slider.setRange(minVal,maxVal) - - def text(self): - return self.label.text() - - def setText(self,s): - self.label.setText(s) - - -class CannonField(TQWidget): - def __init__(self,parent=None,name=None): - TQWidget.__init__(self,parent,name) - - self.ang = 45 - self.f = 0 - self.timerCount = 0 - - self.autoShootTimer = TQTimer(self,'movement handler') - self.connect(self.autoShootTimer,SIGNAL('timeout()'),self.moveShot) - - self.shoot_ang = 0 - self.shoot_f = 0 - self.target = TQPoint(0,0) - - self.setPalette(TQPalette(TQColor(250,250,200))) - - self.barrelRect = TQRect(33,-4,15,8) - - self.newTarget() - - def angle(self): - return self.ang - - def setAngle(self,degrees): - if degrees < 5: - degrees = 5 - if degrees > 70: - degrees = 70 - if self.ang == degrees: - return - self.ang = degrees - self.repaint(self.cannonRect(),0) - self.emit(PYSIGNAL('angleChanged(int)'),(self.ang,)) - - def force(self): - return self.f - - def setForce(self,newton): - if newton < 0: - newton = 0 - if self.f == newton: - return - self.f = newton - self.emit(PYSIGNAL('forceChanged(int)'),(self.f,)) - - def shoot(self): - if self.autoShootTimer.isActive(): - return - - self.timerCount = 0 - self.shoot_ang = self.ang - self.shoot_f = self.f - self.autoShootTimer.start(50) - - def newTarget(self): - r = TQRegion(self.targetRect()) - self.target = TQPoint(random.randint(200,390),random.randint(10,265)) - self.repaint(r.unite(TQRegion(self.targetRect()))) - - def moveShot(self): - r = TQRegion(self.shotRect()) - self.timerCount = self.timerCount + 1 - - shotR = self.shotRect() - - if shotR.intersects(self.targetRect()): - self.autoShootTimer.stop() - self.emit(PYSIGNAL('hit()'),()) - elif shotR.x() > self.width() or shotR.y() > self.height(): - self.autoShootTimer.stop() - self.emit(PYSIGNAL('missed()'),()) - else: - r = r.unite(TQRegion(shotR)) - - self.repaint(r) - - def paintEvent(self,ev): - updateR = ev.rect() - p = TQPainter(self) - - if updateR.intersects(self.cannonRect()): - self.paintCannon(p) - - if self.autoShootTimer.isActive() and updateR.intersects(self.shotRect()): - self.paintShot(p) - - if updateR.intersects(self.targetRect()): - self.paintTarget(p) - - def paintShot(self,p): - p.setBrush(TQt.black) - p.setPen(TQt.NoPen) - p.drawRect(self.shotRect()) - - def paintTarget(self,p): - p.setBrush(TQt.red) - p.setPen(TQt.black) - p.drawRect(self.targetRect()) - - def paintCannon(self,p): - cr = self.cannonRect() - pix = TQPixmap(cr.size()) - pix.fill(self,cr.topLeft()) - - tmp = TQPainter(pix) - tmp.setBrush(TQt.blue) - tmp.setPen(TQt.NoPen) - - tmp.translate(0,pix.height() - 1) - tmp.drawPie(TQRect(-35,-35,70,70),0,90 * 16) - tmp.rotate(-self.ang) - tmp.drawRect(self.barrelRect) - tmp.end() - - p.drawPixmap(cr.topLeft(),pix) - - def cannonRect(self): - r = TQRect(0,0,50,50) - r.moveBottomLeft(self.rect().bottomLeft()) - return r - - def shotRect(self): - gravity = 4.0 - - time = self.timerCount / 4.0 - velocity = self.shoot_f - radians = self.shoot_ang * 3.14159265 / 180 - - velx = velocity * math.cos(radians) - vely = velocity * math.sin(radians) - x0 = (self.barrelRect.right() + 5) * math.cos(radians) - y0 = (self.barrelRect.right() + 5) * math.sin(radians) - x = x0 + velx * time - y = y0 + vely * time - 0.5 * gravity * time * time - - r = TQRect(0,0,6,6) - r.moveCenter(TQPoint(int(x),int(self.height() - 1 - y))) - return r - - def targetRect(self): - r = TQRect(0,0,20,10) - r.moveCenter(TQPoint(self.target.x(),self.height() - 1 - self.target.y())) - return r - - def sizePolicy(self): - return TQSizePolicy(TQSizePolicy.Expanding,TQSizePolicy.Expanding) - - -class MyWidget(TQWidget): - def __init__(self,parent=None,name=None): - TQWidget.__init__(self,parent,name) - - quit = TQPushButton('&Quit',self,'quit') - quit.setFont(TQFont('Times',18,TQFont.Bold)) - self.connect(quit,SIGNAL('clicked()'),tqApp,SLOT('quit()')) - - self.angle = LCDRange('ANGLE',self,'angle') - self.angle.setRange(5,70) - - self.force = LCDRange('FORCE',self,'force') - self.force.setRange(10,50) - - self.cannonField = CannonField(self,'cannonField') - - self.connect(self.angle,PYSIGNAL('valueChanged(int)'),self.cannonField.setAngle) - self.connect(self.cannonField,PYSIGNAL('angleChanged(int)'),self.angle.setValue) - - self.connect(self.force,PYSIGNAL('valueChanged(int)'),self.cannonField.setForce) - self.connect(self.cannonField,PYSIGNAL('forceChanged(int)'),self.force.setValue) - - shoot = TQPushButton('&Shoot',self,'shoot') - shoot.setFont(TQFont('Times',18,TQFont.Bold)) - self.connect(shoot,SIGNAL('clicked()'),self.cannonField.shoot) - - grid = TQGridLayout(self,2,2,10) - - grid.addWidget(quit,0,0) - grid.addWidget(self.cannonField,1,1) - grid.setColStretch(1,10) - - leftBox = TQVBoxLayout() - grid.addLayout(leftBox,1,0) - leftBox.addWidget(self.angle) - leftBox.addWidget(self.force) - - topBox = TQHBoxLayout() - grid.addLayout(topBox,0,1) - topBox.addWidget(shoot) - topBox.addStretch(1) - - self.angle.setValue(60) - self.force.setValue(25) - self.angle.setFocus() - - -TQApplication.setColorSpec(TQApplication.CustomColor) -a = TQApplication(sys.argv) - -w = MyWidget() -w.setGeometry(100,100,500,355) -a.setMainWidget(w) -w.show() -a.exec_loop() diff --git a/examples2/tut13.py b/examples2/tut13.py deleted file mode 100755 index f33c683..0000000 --- a/examples2/tut13.py +++ /dev/null @@ -1,329 +0,0 @@ -#!/usr/bin/env python - -# TQt tutorial 13. - -import sys -import math -import random -from python_tqt.qt import * - - -class LCDRange(TQWidget): - def __init__(self,s=None,parent=None,name=None): - TQWidget.__init__(self,parent,name) - - lcd = TQLCDNumber(2,self,'lcd') - self.slider = TQSlider(TQt.Horizontal,self,'slider') - self.slider.setRange(0,99) - self.slider.setValue(0) - - self.label = TQLabel(' ',self,'label') - self.label.setAlignment(TQt.AlignCenter) - - self.connect(self.slider,SIGNAL('valueChanged(int)'),lcd,SLOT('display(int)')) - self.connect(self.slider,SIGNAL('valueChanged(int)'),self,PYSIGNAL('valueChanged(int)')) - - self.setFocusProxy(self.slider) - - l = TQVBoxLayout(self) - l.addWidget(lcd,1) - l.addWidget(self.slider) - l.addWidget(self.label) - - if s is not None: - self.setText(s) - - def value(self): - return self.slider.value() - - def setValue(self,value): - self.slider.setValue(value) - - def setRange(self,minVal,maxVal): - if minVal < 0 or maxVal > 99 or minVal > maxVal: - raise ValueError('LCDRange.setRange(): invalid range') - self.slider.setRange(minVal,maxVal) - - def text(self): - return self.label.text() - - def setText(self,s): - self.label.setText(s) - - -class CannonField(TQWidget): - def __init__(self,parent=None,name=None): - TQWidget.__init__(self,parent,name) - - self.ang = 45 - self.f = 0 - self.timerCount = 0 - - self.autoShootTimer = TQTimer(self,'movement handler') - self.connect(self.autoShootTimer,SIGNAL('timeout()'),self.moveShot) - - self.shoot_ang = 0 - self.shoot_f = 0 - self.target = TQPoint(0,0) - self.gameEnded = 0 - - self.setPalette(TQPalette(TQColor(250,250,200))) - - self.barrelRect = TQRect(33,-4,15,8) - - self.newTarget() - - def angle(self): - return self.ang - - def setAngle(self,degrees): - if degrees < 5: - degrees = 5 - if degrees > 70: - degrees = 70 - if self.ang == degrees: - return - self.ang = degrees - self.repaint(self.cannonRect(),0) - self.emit(PYSIGNAL('angleChanged(int)'),(self.ang,)) - - def force(self): - return self.f - - def setForce(self,newton): - if newton < 0: - newton = 0 - if self.f == newton: - return - self.f = newton - self.emit(PYSIGNAL('forceChanged(int)'),(self.f,)) - - def shoot(self): - if self.isShooting(): - return - - self.timerCount = 0 - self.shoot_ang = self.ang - self.shoot_f = self.f - self.autoShootTimer.start(50) - self.emit(PYSIGNAL('canShoot(bool)'),(0,)) - - def newTarget(self): - r = TQRegion(self.targetRect()) - self.target = TQPoint(random.randint(200,390),random.randint(10,265)) - self.repaint(r.unite(TQRegion(self.targetRect()))) - - def gameOver(self): - return self.gameEnded - - def setGameOver(self): - if self.gameEnded: - return - if self.isShooting(): - self.autoShootTime.stop() - self.gameEnded = 1 - self.repaint() - - def restartGame(self): - if self.isShooting(): - self.autoShootTime.stop() - self.gameEnded = 0 - self.repaint() - self.emit(PYSIGNAL('canShoot(bool)'),(1,)) - - def moveShot(self): - r = TQRegion(self.shotRect()) - self.timerCount = self.timerCount + 1 - - shotR = self.shotRect() - - if shotR.intersects(self.targetRect()): - self.autoShootTimer.stop() - self.emit(PYSIGNAL('hit()'),()) - self.emit(PYSIGNAL('canShoot(bool)'),(1,)) - elif shotR.x() > self.width() or shotR.y() > self.height(): - self.autoShootTimer.stop() - self.emit(PYSIGNAL('missed()'),()) - self.emit(PYSIGNAL('canShoot(bool)'),(1,)) - else: - r = r.unite(TQRegion(shotR)) - - self.repaint(r) - - def paintEvent(self,ev): - updateR = ev.rect() - p = TQPainter(self) - - if self.gameEnded: - p.setPen(TQt.black) - p.setFont(TQFont('Courier',48,TQFont.Bold)) - p.drawText(self.rect(),TQt.AlignCenter,'Game Over') - - if updateR.intersects(self.cannonRect()): - self.paintCannon(p) - - if self.isShooting() and updateR.intersects(self.shotRect()): - self.paintShot(p) - - if not self.gameEnded and updateR.intersects(self.targetRect()): - self.paintTarget(p) - - def paintShot(self,p): - p.setBrush(TQt.black) - p.setPen(TQt.NoPen) - p.drawRect(self.shotRect()) - - def paintTarget(self,p): - p.setBrush(TQt.red) - p.setPen(TQt.black) - p.drawRect(self.targetRect()) - - def paintCannon(self,p): - cr = self.cannonRect() - pix = TQPixmap(cr.size()) - pix.fill(self,cr.topLeft()) - - tmp = TQPainter(pix) - tmp.setBrush(TQt.blue) - tmp.setPen(TQt.NoPen) - - tmp.translate(0,pix.height() - 1) - tmp.drawPie(TQRect(-35,-35,70,70),0,90 * 16) - tmp.rotate(-self.ang) - tmp.drawRect(self.barrelRect) - tmp.end() - - p.drawPixmap(cr.topLeft(),pix) - - def cannonRect(self): - r = TQRect(0,0,50,50) - r.moveBottomLeft(self.rect().bottomLeft()) - return r - - def shotRect(self): - gravity = 4.0 - - time = self.timerCount / 4.0 - velocity = self.shoot_f - radians = self.shoot_ang * 3.14159265 / 180 - - velx = velocity * math.cos(radians) - vely = velocity * math.sin(radians) - x0 = (self.barrelRect.right() + 5) * math.cos(radians) - y0 = (self.barrelRect.right() + 5) * math.sin(radians) - x = x0 + velx * time - y = y0 + vely * time - 0.5 * gravity * time * time - - r = TQRect(0,0,6,6) - r.moveCenter(TQPoint(int(x),int(self.height() - 1 - y))) - return r - - def targetRect(self): - r = TQRect(0,0,20,10) - r.moveCenter(TQPoint(self.target.x(),self.height() - 1 - self.target.y())) - return r - - def isShooting(self): - return self.autoShootTimer.isActive() - - def sizePolicy(self): - return TQSizePolicy(TQSizePolicy.Expanding,TQSizePolicy.Expanding) - - -class GameBoard(TQWidget): - def __init__(self,parent=None,name=None): - TQWidget.__init__(self,parent,name) - - quit = TQPushButton('&Quit',self,'quit') - quit.setFont(TQFont('Times',18,TQFont.Bold)) - self.connect(quit,SIGNAL('clicked()'),tqApp,SLOT('quit()')) - - self.angle = LCDRange('ANGLE',self,'angle') - self.angle.setRange(5,70) - - self.force = LCDRange('FORCE',self,'force') - self.force.setRange(10,50) - - self.cannonField = CannonField(self,'cannonField') - - self.connect(self.angle,PYSIGNAL('valueChanged(int)'),self.cannonField.setAngle) - self.connect(self.cannonField,PYSIGNAL('angleChanged(int)'),self.angle.setValue) - - self.connect(self.force,PYSIGNAL('valueChanged(int)'),self.cannonField.setForce) - self.connect(self.cannonField,PYSIGNAL('forceChanged(int)'),self.force.setValue) - - self.connect(self.cannonField,PYSIGNAL('hit()'),self.hit) - self.connect(self.cannonField,PYSIGNAL('missed()'),self.missed) - - self.shoot = TQPushButton('&Shoot',self,'shoot') - self.shoot.setFont(TQFont('Times',18,TQFont.Bold)) - self.connect(self.shoot,SIGNAL('clicked()'),self.fire) - self.connect(self.cannonField,PYSIGNAL('canShoot(bool)'),self.shoot,SLOT('setEnabled(bool)')) - - restart = TQPushButton('&New Game',self,'newgame') - restart.setFont(TQFont('Times',18,TQFont.Bold)) - self.connect(restart,SIGNAL('clicked()'),self.newGame) - - self.hits = TQLCDNumber(2,self,'hits') - self.shotsLeft = TQLCDNumber(2,self,'shotsleft') - hitsL = TQLabel('HITS',self,'hitsLabel') - shotsLeftL = TQLabel('SHOTS LEFT',self,'shotsleftLabel') - - grid = TQGridLayout(self,2,2,10) - grid.addWidget(quit,0,0) - grid.addWidget(self.cannonField,1,1) - grid.setColStretch(1,10) - - leftBox = TQVBoxLayout() - grid.addLayout(leftBox,1,0) - leftBox.addWidget(self.angle) - leftBox.addWidget(self.force) - - topBox = TQHBoxLayout() - grid.addLayout(topBox,0,1) - topBox.addWidget(self.shoot) - topBox.addWidget(self.hits) - topBox.addWidget(hitsL) - topBox.addWidget(self.shotsLeft) - topBox.addWidget(shotsLeftL) - topBox.addStretch(1) - topBox.addWidget(restart) - - self.angle.setValue(60) - self.force.setValue(25) - self.angle.setFocus() - - self.newGame() - - def fire(self): - if self.cannonField.gameOver() or self.cannonField.isShooting(): - return - self.shotsLeft.display(self.shotsLeft.intValue() - 1) - self.cannonField.shoot() - - def hit(self): - self.hits.display(self.hits.intValue() + 1) - if self.shotsLeft.intValue() == 0: - self.cannonField.setGameOver() - else: - self.cannonField.newTarget() - - def missed(self): - if self.shotsLeft.intValue() == 0: - self.cannonField.setGameOver() - - def newGame(self): - self.shotsLeft.display(15) - self.hits.display(0) - self.cannonField.restartGame() - self.cannonField.newTarget() - - -TQApplication.setColorSpec(TQApplication.CustomColor) -a = TQApplication(sys.argv) - -gb = GameBoard() -gb.setGeometry(100,100,500,355) -a.setMainWidget(gb) -gb.show() -a.exec_loop() diff --git a/examples2/tut14.py b/examples2/tut14.py deleted file mode 100755 index 998f26f..0000000 --- a/examples2/tut14.py +++ /dev/null @@ -1,377 +0,0 @@ -#!/usr/bin/env python - -# TQt tutorial 14. - -import sys -import math -import random -from python_tqt.qt import * - - -class LCDRange(TQWidget): - def __init__(self,s=None,parent=None,name=None): - TQWidget.__init__(self,parent,name) - - lcd = TQLCDNumber(2,self,'lcd') - self.slider = TQSlider(TQt.Horizontal,self,'slider') - self.slider.setRange(0,99) - self.slider.setValue(0) - - self.label = TQLabel(' ',self,'label') - self.label.setAlignment(TQt.AlignCenter) - - self.connect(self.slider,SIGNAL('valueChanged(int)'),lcd,SLOT('display(int)')) - self.connect(self.slider,SIGNAL('valueChanged(int)'),self,PYSIGNAL('valueChanged(int)')) - - self.setFocusProxy(self.slider) - - l = TQVBoxLayout(self) - l.addWidget(lcd,1) - l.addWidget(self.slider) - l.addWidget(self.label) - - if s is not None: - self.setText(s) - - def value(self): - return self.slider.value() - - def setValue(self,value): - self.slider.setValue(value) - - def setRange(self,minVal,maxVal): - if minVal < 0 or maxVal > 99 or minVal > maxVal: - raise ValueError('LCDRange.setRange(): invalid range') - self.slider.setRange(minVal,maxVal) - - def text(self): - return self.label.text() - - def setText(self,s): - self.label.setText(s) - - -class CannonField(TQWidget): - def __init__(self,parent=None,name=None): - TQWidget.__init__(self,parent,name) - - self.ang = 45 - self.f = 0 - self.timerCount = 0 - - self.autoShootTimer = TQTimer(self,'movement handler') - self.connect(self.autoShootTimer,SIGNAL('timeout()'),self.moveShot) - - self.shoot_ang = 0 - self.shoot_f = 0 - self.target = TQPoint(0,0) - self.gameEnded = 0 - self.barrelPressed = 0 - - self.setPalette(TQPalette(TQColor(250,250,200))) - - self.barrelRect = TQRect(33,-4,15,8) - - self.newTarget() - - def angle(self): - return self.ang - - def setAngle(self,degrees): - if degrees < 5: - degrees = 5 - if degrees > 70: - degrees = 70 - if self.ang == degrees: - return - self.ang = degrees - self.repaint(self.cannonRect(),0) - self.emit(PYSIGNAL('angleChanged(int)'),(self.ang,)) - - def force(self): - return self.f - - def setForce(self,newton): - if newton < 0: - newton = 0 - if self.f == newton: - return - self.f = newton - self.emit(PYSIGNAL('forceChanged(int)'),(self.f,)) - - def shoot(self): - if self.isShooting(): - return - - self.timerCount = 0 - self.shoot_ang = self.ang - self.shoot_f = self.f - self.autoShootTimer.start(50) - self.emit(PYSIGNAL('canShoot(bool)'),(0,)) - - def newTarget(self): - r = TQRegion(self.targetRect()) - self.target = TQPoint(random.randint(200,390),random.randint(10,265)) - self.repaint(r.unite(TQRegion(self.targetRect()))) - - def gameOver(self): - return self.gameEnded - - def setGameOver(self): - if self.gameEnded: - return - if self.isShooting(): - self.autoShootTime.stop() - self.gameEnded = 1 - self.repaint() - - def restartGame(self): - if self.isShooting(): - self.autoShootTime.stop() - self.gameEnded = 0 - self.repaint() - self.emit(PYSIGNAL('canShoot(bool)'),(1,)) - - def moveShot(self): - r = TQRegion(self.shotRect()) - self.timerCount = self.timerCount + 1 - - shotR = self.shotRect() - - if shotR.intersects(self.targetRect()): - self.autoShootTimer.stop() - self.emit(PYSIGNAL('hit()'),()) - self.emit(PYSIGNAL('canShoot(bool)'),(1,)) - elif shotR.x() > self.width() or shotR.y() > self.height() or shotR.intersects(self.barrierRect()): - self.autoShootTimer.stop() - self.emit(PYSIGNAL('missed()'),()) - self.emit(PYSIGNAL('canShoot(bool)'),(1,)) - else: - r = r.unite(TQRegion(shotR)) - - self.repaint(r) - - def mousePressEvent(self,ev): - if ev.button() != TQt.LeftButton: - return - if self.barrelHit(ev.pos()): - self.barrelPressed = 1 - - def mouseMoveEvent(self,ev): - if not self.barrelPressed: - return - pnt = ev.pos() - if pnt.x() <= 0: - pnt.setX(1) - if pnt.y() >= self.height(): - pnt.setY(self.height() - 1) - rad = math.atan(float(self.rect().bottom() - pnt.y()) / pnt.x()) - self.setAngle(int(round(rad * 180 / math.pi))) - - def mouseReleaseEvent(self,ev): - if ev.button() == TQt.LeftButton: - self.barrelPressed = 0 - - def paintEvent(self,ev): - updateR = ev.rect() - p = TQPainter(self) - - if self.gameEnded: - p.setPen(TQt.black) - p.setFont(TQFont('Courier',48,TQFont.Bold)) - p.drawText(self.rect(),TQt.AlignCenter,'Game Over') - - if updateR.intersects(self.cannonRect()): - self.paintCannon(p) - - if updateR.intersects(self.barrierRect()): - self.paintBarrier(p) - - if self.isShooting() and updateR.intersects(self.shotRect()): - self.paintShot(p) - - if not self.gameEnded and updateR.intersects(self.targetRect()): - self.paintTarget(p) - - def paintShot(self,p): - p.setBrush(TQt.black) - p.setPen(TQt.NoPen) - p.drawRect(self.shotRect()) - - def paintTarget(self,p): - p.setBrush(TQt.red) - p.setPen(TQt.black) - p.drawRect(self.targetRect()) - - def paintBarrier(self,p): - p.setBrush(TQt.yellow) - p.setPen(TQt.black) - p.drawRect(self.barrierRect()) - - def paintCannon(self,p): - cr = self.cannonRect() - pix = TQPixmap(cr.size()) - pix.fill(self,cr.topLeft()) - - tmp = TQPainter(pix) - tmp.setBrush(TQt.blue) - tmp.setPen(TQt.NoPen) - - tmp.translate(0,pix.height() - 1) - tmp.drawPie(TQRect(-35,-35,70,70),0,90 * 16) - tmp.rotate(-self.ang) - tmp.drawRect(self.barrelRect) - tmp.end() - - p.drawPixmap(cr.topLeft(),pix) - - def cannonRect(self): - r = TQRect(0,0,50,50) - r.moveBottomLeft(self.rect().bottomLeft()) - return r - - def shotRect(self): - gravity = 4.0 - - time = self.timerCount / 4.0 - velocity = self.shoot_f - radians = self.shoot_ang * math.pi / 180 - - velx = velocity * math.cos(radians) - vely = velocity * math.sin(radians) - x0 = (self.barrelRect.right() + 5) * math.cos(radians) - y0 = (self.barrelRect.right() + 5) * math.sin(radians) - x = x0 + velx * time - y = y0 + vely * time - 0.5 * gravity * time * time - - r = TQRect(0,0,6,6) - r.moveCenter(TQPoint(int(x),int(self.height() - 1 - y))) - return r - - def targetRect(self): - r = TQRect(0,0,20,10) - r.moveCenter(TQPoint(self.target.x(),self.height() - 1 - self.target.y())) - return r - - def barrierRect(self): - return TQRect(145,self.height() - 100,15,100) - - def barrelHit(self,p): - mtx = TQWMatrix() - mtx.translate(0,self.height() - 1) - mtx.rotate(-self.ang) - (mtx, invertable) = mtx.invert() - return self.barrelRect.contains(mtx.map(p)) - - def isShooting(self): - return self.autoShootTimer.isActive() - - def sizePolicy(self): - return TQSizePolicy(TQSizePolicy.Expanding,TQSizePolicy.Expanding) - - -class GameBoard(TQWidget): - def __init__(self,parent=None,name=None): - TQWidget.__init__(self,parent,name) - - quit = TQPushButton('&Quit',self,'quit') - quit.setFont(TQFont('Times',18,TQFont.Bold)) - self.connect(quit,SIGNAL('clicked()'),tqApp,SLOT('quit()')) - - self.angle = LCDRange('ANGLE',self,'angle') - self.angle.setRange(5,70) - - self.force = LCDRange('FORCE',self,'force') - self.force.setRange(10,50) - - box = TQVBox(self,'cannonFrame') - box.setFrameStyle(TQFrame.WinPanel | TQFrame.Sunken) - - self.cannonField = CannonField(box,'cannonField') - - self.connect(self.angle,PYSIGNAL('valueChanged(int)'),self.cannonField.setAngle) - self.connect(self.cannonField,PYSIGNAL('angleChanged(int)'),self.angle.setValue) - - self.connect(self.force,PYSIGNAL('valueChanged(int)'),self.cannonField.setForce) - self.connect(self.cannonField,PYSIGNAL('forceChanged(int)'),self.force.setValue) - - self.connect(self.cannonField,PYSIGNAL('hit()'),self.hit) - self.connect(self.cannonField,PYSIGNAL('missed()'),self.missed) - - self.shoot = TQPushButton('&Shoot',self,'shoot') - self.shoot.setFont(TQFont('Times',18,TQFont.Bold)) - self.connect(self.shoot,SIGNAL('clicked()'),self.fire) - self.connect(self.cannonField,PYSIGNAL('canShoot(bool)'),self.shoot,SLOT('setEnabled(bool)')) - - restart = TQPushButton('&New Game',self,'newgame') - restart.setFont(TQFont('Times',18,TQFont.Bold)) - self.connect(restart,SIGNAL('clicked()'),self.newGame) - - self.hits = TQLCDNumber(2,self,'hits') - self.shotsLeft = TQLCDNumber(2,self,'shotsleft') - hitsL = TQLabel('HITS',self,'hitsLabel') - shotsLeftL = TQLabel('SHOTS LEFT',self,'shotsleftLabel') - - accel = TQAccel(self) - accel.connectItem(accel.insertItem(TQt.Key_Enter),self.fire) - accel.connectItem(accel.insertItem(TQt.Key_Return),self.fire) - accel.connectItem(accel.insertItem(TQt.CTRL + TQt.Key_Q),tqApp,SLOT('quit()')) - - grid = TQGridLayout(self,2,2,10) - grid.addWidget(quit,0,0) - grid.addWidget(box,1,1) - grid.setColStretch(1,10) - - leftBox = TQVBoxLayout() - grid.addLayout(leftBox,1,0) - leftBox.addWidget(self.angle) - leftBox.addWidget(self.force) - - topBox = TQHBoxLayout() - grid.addLayout(topBox,0,1) - topBox.addWidget(self.shoot) - topBox.addWidget(self.hits) - topBox.addWidget(hitsL) - topBox.addWidget(self.shotsLeft) - topBox.addWidget(shotsLeftL) - topBox.addStretch(1) - topBox.addWidget(restart) - - self.angle.setValue(60) - self.force.setValue(25) - self.angle.setFocus() - - self.newGame() - - def fire(self): - if self.cannonField.gameOver() or self.cannonField.isShooting(): - return - self.shotsLeft.display(self.shotsLeft.intValue() - 1) - self.cannonField.shoot() - - def hit(self): - self.hits.display(self.hits.intValue() + 1) - if self.shotsLeft.intValue() == 0: - self.cannonField.setGameOver() - else: - self.cannonField.newTarget() - - def missed(self): - if self.shotsLeft.intValue() == 0: - self.cannonField.setGameOver() - - def newGame(self): - self.shotsLeft.display(15) - self.hits.display(0) - self.cannonField.restartGame() - self.cannonField.newTarget() - - -TQApplication.setColorSpec(TQApplication.CustomColor) -a = TQApplication(sys.argv) - -gb = GameBoard() -gb.setGeometry(100,100,500,355) -a.setMainWidget(gb) -gb.show() -a.exec_loop() diff --git a/examples2/tut2.py b/examples2/tut2.py deleted file mode 100755 index 730b047..0000000 --- a/examples2/tut2.py +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env python - -# TQt tutorial 2. - -import sys -from python_tqt.qt import * - - -a = TQApplication(sys.argv) - -quit = TQPushButton("Quit",None) -quit.resize(75,30) -quit.setFont(TQFont("Times",18,TQFont.Bold)) - -TQObject.connect(quit,SIGNAL("clicked()"),a,SLOT("quit()")) - -a.setMainWidget(quit) -quit.show() -a.exec_loop() diff --git a/examples2/tut3.py b/examples2/tut3.py deleted file mode 100755 index b1fe6ee..0000000 --- a/examples2/tut3.py +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env python - -# TQt tutorial 3. - -import sys -from python_tqt.qt import * - -a = TQApplication(sys.argv) - -box = TQVBox() -box.resize(200,120) - -quit = TQPushButton("Quit",box) -quit.setFont(TQFont("Times",18,TQFont.Bold)) - -TQObject.connect(quit,SIGNAL("clicked()"),a,SLOT("quit()")) - -a.setMainWidget(box) -box.show() -a.exec_loop() diff --git a/examples2/tut4.py b/examples2/tut4.py deleted file mode 100755 index 76d99bb..0000000 --- a/examples2/tut4.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env python - -# TQt tutorial 4. - -import sys -from python_tqt.qt import * - - -class MyWidget(TQWidget): - def __init__(self,parent=None,name=None): - TQWidget.__init__(self,parent,name) - - self.setMinimumSize(200,120) - self.setMaximumSize(200,120) - - quit = TQPushButton("Quit",self,"quit") - quit.setGeometry(62,40,75,30) - quit.setFont(TQFont("Times",18,TQFont.Bold)) - - self.connect(quit,SIGNAL("clicked()"),tqApp,SLOT("quit()")) - - -a = TQApplication(sys.argv) - -w = MyWidget() -w.setGeometry(100,100,200,120) -a.setMainWidget(w) -w.show() -a.exec_loop() diff --git a/examples2/tut5.py b/examples2/tut5.py deleted file mode 100755 index c77d843..0000000 --- a/examples2/tut5.py +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env python - -# TQt tutorial 5. - -import sys -from python_tqt.qt import * - - -class MyWidget(TQVBox): - def __init__(self,parent=None,name=None): - TQVBox.__init__(self,parent,name) - - quit = TQPushButton("Quit",self,"quit") - quit.setFont(TQFont("Times",18,TQFont.Bold)) - - self.connect(quit,SIGNAL("clicked()"),tqApp,SLOT("quit()")) - - lcd = TQLCDNumber(2,self,"lcd") - - slider = TQSlider(TQt.Horizontal,self,"slider") - slider.setRange(0,99) - slider.setValue(0) - - self.connect(slider,SIGNAL("valueChanged(int)"),lcd,SLOT("display(int)")) - - -a = TQApplication(sys.argv) - -w = MyWidget() -a.setMainWidget(w) -w.show() -a.exec_loop() diff --git a/examples2/tut6.py b/examples2/tut6.py deleted file mode 100755 index b26121a..0000000 --- a/examples2/tut6.py +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env python - -# TQt tutorial 6. - -import sys -from python_tqt.qt import * - - -class LCDRange(TQVBox): - def __init__(self,parent=None,name=None): - TQVBox.__init__(self,parent,name) - - lcd = TQLCDNumber(2,self,"lcd") - slider = TQSlider(TQt.Horizontal,self,"slider") - slider.setRange(0,99) - slider.setValue(0) - self.connect(slider,SIGNAL("valueChanged(int)"),lcd,SLOT("display(int)")) - - -class MyWidget(TQVBox): - def __init__(self,parent=None,name=None): - TQVBox.__init__(self,parent,name) - - quit = TQPushButton("Quit",self,"quit") - quit.setFont(TQFont("Times",18,TQFont.Bold)) - - self.connect(quit,SIGNAL("clicked()"),tqApp,SLOT("quit()")) - - grid = TQGrid(4,self) - - for c in range(4): - for r in range(4): - LCDRange(grid) - - -a = TQApplication(sys.argv) - -w = MyWidget() -a.setMainWidget(w) -w.show() -a.exec_loop() diff --git a/examples2/tut7.py b/examples2/tut7.py deleted file mode 100755 index 03098aa..0000000 --- a/examples2/tut7.py +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env python - -# TQt tutorial 7. - -import sys -from python_tqt.qt import * - - -class LCDRange(TQVBox): - def __init__(self,parent=None,name=None): - TQVBox.__init__(self,parent,name) - - lcd = TQLCDNumber(2,self,'lcd') - self.slider = TQSlider(TQt.Horizontal,self,'slider') - self.slider.setRange(0,99) - self.slider.setValue(0) - self.connect(self.slider,SIGNAL('valueChanged(int)'),lcd,SLOT('display(int)')) - self.connect(self.slider,SIGNAL('valueChanged(int)'),self,PYSIGNAL('valueChanged(int)')) - - def value(self): - return self.slider.value() - - def setValue(self,value): - self.slider.setValue(value) - - -class MyWidget(TQVBox): - def __init__(self,parent=None,name=None): - TQVBox.__init__(self,parent,name) - - quit = TQPushButton("Quit",self,"quit") - quit.setFont(TQFont("Times",18,TQFont.Bold)) - - self.connect(quit,SIGNAL("clicked()"),tqApp,SLOT("quit()")) - - grid = TQGrid(4,self) - - self.lcdlist = [] - previous = None - - for r in range(4): - for c in range(4): - lr = LCDRange(grid) - - if previous is not None: - self.connect(lr,PYSIGNAL("valueChanged(int)"),previous.setValue) - - previous = lr - self.lcdlist.append(lr) - - -a = TQApplication(sys.argv) - -w = MyWidget() -a.setMainWidget(w) -w.show() -a.exec_loop() diff --git a/examples2/tut8.py b/examples2/tut8.py deleted file mode 100755 index 3266a89..0000000 --- a/examples2/tut8.py +++ /dev/null @@ -1,96 +0,0 @@ -#!/usr/bin/env python - -# TQt tutorial 8. - -import sys -from python_tqt.qt import * - - -class LCDRange(TQVBox): - def __init__(self,parent=None,name=None): - TQVBox.__init__(self,parent,name) - - lcd = TQLCDNumber(2,self,'lcd') - self.slider = TQSlider(TQt.Horizontal,self,'slider') - self.slider.setRange(0,99) - self.slider.setValue(0) - self.connect(self.slider,SIGNAL('valueChanged(int)'),lcd,SLOT('display(int)')) - self.connect(self.slider,SIGNAL('valueChanged(int)'),self,PYSIGNAL('valueChanged(int)')) - - self.setFocusProxy(self.slider) - - def value(self): - return self.slider.value() - - def setValue(self,value): - self.slider.setValue(value) - - def setRange(self,minVal,maxVal): - if minVal < 0 or maxVal > 99 or minVal > maxVal: - raise ValueError('LCDRange.setRange(): invalid range') - self.slider.setRange(minVal,maxVal) - - -class CannonField(TQWidget): - def __init__(self,parent=None,name=None): - TQWidget.__init__(self,parent,name) - - self.ang = 45 - self.setPalette(TQPalette(TQColor(250,250,200))) - - def angle(self): - return self.ang - - def setAngle(self,degrees): - if degrees < 5: - degrees = 5 - if degrees > 70: - degrees = 70 - if self.ang == degrees: - return - self.ang = degrees - self.repaint() - self.emit(PYSIGNAL('angleChanged(int)'),(self.ang,)) - - def paintEvent(self,ev): - p = TQPainter(self) - p.drawText(200,200,'Angle = %d' % (self.ang)) - - def sizePolicy(self): - return TQSizePolicy(TQSizePolicy.Expanding,TQSizePolicy.Expanding) - - -class MyWidget(TQWidget): - def __init__(self,parent=None,name=None): - TQWidget.__init__(self,parent,name) - - quit = TQPushButton('Quit',self,'quit') - quit.setFont(TQFont('Times',18,TQFont.Bold)) - self.connect(quit,SIGNAL('clicked()'),tqApp,SLOT('quit()')) - - self.angle = LCDRange(self,'angle') - self.angle.setRange(5,70) - - self.cannonField = CannonField(self,'cannonField') - - self.connect(self.angle,PYSIGNAL('valueChanged(int)'),self.cannonField.setAngle) - self.connect(self.cannonField,PYSIGNAL('angleChanged(int)'),self.angle.setValue) - - grid = TQGridLayout(self,2,2,10) - - grid.addWidget(quit,0,0) - grid.addWidget(self.angle,1,0,TQt.AlignTop) - grid.addWidget(self.cannonField,1,1) - grid.setColStretch(1,10) - - self.angle.setValue(60) - self.angle.setFocus() - - -a = TQApplication(sys.argv) - -w = MyWidget() -w.setGeometry(100,100,500,355) -a.setMainWidget(w) -w.show() -a.exec_loop() diff --git a/examples2/tut9.py b/examples2/tut9.py deleted file mode 100755 index c413e00..0000000 --- a/examples2/tut9.py +++ /dev/null @@ -1,104 +0,0 @@ -#!/usr/bin/env python - -# TQt tutorial 9. - -import sys -from python_tqt.qt import * - - -class LCDRange(TQVBox): - def __init__(self,parent=None,name=None): - TQVBox.__init__(self,parent,name) - - lcd = TQLCDNumber(2,self,'lcd') - self.slider = TQSlider(TQt.Horizontal,self,'slider') - self.slider.setRange(0,99) - self.slider.setValue(0) - self.connect(self.slider,SIGNAL('valueChanged(int)'),lcd,SLOT('display(int)')) - self.connect(self.slider,SIGNAL('valueChanged(int)'),self,PYSIGNAL('valueChanged(int)')) - - self.setFocusProxy(self.slider) - - def value(self): - return self.slider.value() - - def setValue(self,value): - self.slider.setValue(value) - - def setRange(self,minVal,maxVal): - if minVal < 0 or maxVal > 99 or minVal > maxVal: - raise ValueError('LCDRange.setRange(): invalid range') - self.slider.setRange(minVal,maxVal) - - -class CannonField(TQWidget): - def __init__(self,parent=None,name=None): - TQWidget.__init__(self,parent,name) - - self.ang = 45 - self.setPalette(TQPalette(TQColor(250,250,200))) - - def angle(self): - return self.ang - - def setAngle(self,degrees): - if degrees < 5: - degrees = 5 - if degrees > 70: - degrees = 70 - if self.ang == degrees: - return - self.ang = degrees - self.repaint() - self.emit(PYSIGNAL('angleChanged(int)'),(self.ang,)) - - def paintEvent(self,ev): - p = TQPainter(self) - - p.setBrush(TQt.blue) - p.setPen(TQt.NoPen) - - p.translate(0,self.rect().bottom()) - p.drawPie(TQRect(-35,-35,70,70),0,90 * 16) - p.rotate(-self.ang) - p.drawRect(TQRect(33,-4,15,8)) - - def sizePolicy(self): - return TQSizePolicy(TQSizePolicy.Expanding,TQSizePolicy.Expanding) - - -class MyWidget(TQWidget): - def __init__(self,parent=None,name=None): - TQWidget.__init__(self,parent,name) - - quit = TQPushButton('&Quit',self,'quit') - quit.setFont(TQFont('Times',18,TQFont.Bold)) - self.connect(quit,SIGNAL('clicked()'),tqApp,SLOT('quit()')) - - self.angle = LCDRange(self,'angle') - self.angle.setRange(5,70) - - self.cannonField = CannonField(self,'cannonField') - - self.connect(self.angle,PYSIGNAL('valueChanged(int)'),self.cannonField.setAngle) - self.connect(self.cannonField,PYSIGNAL('angleChanged(int)'),self.angle.setValue) - - grid = TQGridLayout(self,2,2,10) - - grid.addWidget(quit,0,0) - grid.addWidget(self.angle,1,0,TQt.AlignTop) - grid.addWidget(self.cannonField,1,1) - grid.setColStretch(1,10) - - self.angle.setValue(60) - self.angle.setFocus() - - -TQApplication.setColorSpec(TQApplication.CustomColor) -a = TQApplication(sys.argv) - -w = MyWidget() -w.setGeometry(100,100,500,355) -a.setMainWidget(w) -w.show() -a.exec_loop() diff --git a/examples2/widgets.py b/examples2/widgets.py deleted file mode 100755 index cf235a8..0000000 --- a/examples2/widgets.py +++ /dev/null @@ -1,512 +0,0 @@ -#!/usr/bin/env python - - -import sys, string -from python_tqt.qt import * - -# -## Constructs an analog clock widget that uses an internal TQTimer. -# -def TQMIN( x, y ): - if y > x: - return y - return x - -# -## Constructs an analog clock widget that uses an internal TQTimer. -# - -class AnalogClock( TQWidget ): - def __init__( self, *args ): - TQWidget.__init__(*(self,) + args) - self.time = TQTime.currentTime() # get current time - internalTimer = TQTimer( self ) # create internal timer - self.connect( internalTimer, SIGNAL("timeout()"), self.timeout ) - internalTimer.start( 5000 ) # emit signal every 5 seconds - -# -## The TQTimer::timeout() signal is received by this slot. -# - - def timeout( self ): - new_time = TQTime.currentTime() # get the current time - if new_time.minute() != self.time.minute(): # minute has changed - self.update() - -# -## The clock is painted using a 1000x1000 square coordinate system. -# - def paintEvent( self, qe ): # paint clock - if not self.isVisible(): # is is invisible - return - self.time = TQTime.currentTime() # save current time - - pts = TQPointArray() - paint = TQPainter( self ) - paint.setBrush( self.foregroundColor() ) # fill with foreground color - - cp = TQPoint( self.rect().center() ) # widget center point - d = TQMIN( self.width(), self.height() ) # we want a circular clock - - matrix = TQWMatrix() # setup transformation matrix - matrix.translate( cp.x(), cp.y() ) # origin at widget center - matrix.scale( d / 1000.0, d / 1000.0 ) # scale coordinate system - - h_angle = 30 * ( self.time.hour() % 12 - 3 ) + self.time.minute() / 2 - matrix.rotate( h_angle ) # rotate to draw hour hand - paint.setWorldMatrix( matrix ) - pts.setPoints( [ -20,0, 0,-20, 300,0, 0,20 ] ) - paint.drawPolygon( pts ) # draw hour hand - matrix.rotate( -h_angle ) # rotate back to zero - - m_angle = ( self.time.minute() - 15 ) * 6 - matrix.rotate( m_angle ) # rotate to draw minute hand - paint.setWorldMatrix( matrix ) - pts.setPoints( [ -10,0, 0,-10, 400,0, 0,10 ] ) - paint.drawPolygon( pts ) # draw minute hand - matrix.rotate( -m_angle ) # rotate back to zero - - for i in range( 0, 12 ): # draw hour lines - paint.setWorldMatrix( matrix ) - paint.drawLine( 450,0, 500,0 ) - matrix.rotate( 30 ) - - -class DigitalClock( TQLCDNumber ): - def __init__( self, *args ): - TQLCDNumber.__init__(*(self,) + args) - self.showingColon = 0 - self.setFrameStyle(TQFrame.Panel | TQFrame.Raised) - self.setLineWidth( 2 ) - self.showTime() - self.normalTimer = self.startTimer( 500 ) - self.showDateTimer = -1 - - def timerEvent( self, e ): - if e.timerId() == self.showDateTimer: - self.stopDate() - else: - if self.showDateTimer == -1: - self.showTime() - - def mousePressEvent( self, e ): - if e.button() == TQt.LeftButton: - self.showDate() - - def showDate( self ): - if self.showDateTimer != -1: - return - d = TQDate.currentDate() - self.display('%2d %2d' % (d.month(), d.day())) - self.showDateTimer = self.startTimer(2000) - - def stopDate( self ): - self.killTimer(self.showDateTimer) - self.showDateTimer = -1 - self.showTime() - - def showTime( self ): - self.showingColon = not self.showingColon - s = list(str(TQTime.currentTime().toString())[:5]) #.left(5) - if not self.showingColon: - s[2] = ' ' - if s[0] == '0': - s[0] = ' ' - s = ''.join(s) - self.display( s ) - - def TQMIN( x, y ): - if y > x: - return y - return x - -TRUE = 1 -FALSE = 0 -MOVIEFILENAME = "trolltech.gif" - -# -# WidgetView contains lots of TQt widgets. -# - -class WidgetView ( TQWidget ): - def __init__( self, *args ): - TQWidget.__init__(*(self,) + args) - - # Set the window caption/title - self.setCaption( "TQt Widgets Demo Application" ) - - # Install an application-global event filter - tqApp.installEventFilter( self ) - - # Create a layout to position the widgets - self.topLayout = TQVBoxLayout( self, 10 ) - - # Create a grid layout to hold most of the widgets - self.grid = TQGridLayout( 6, 3 ) - - # This layout will get all of the stretch - self.topLayout.addLayout( self.grid, 10 ) - - # Create a menubar - self.menubar = TQMenuBar( self ) - #self.menubar.setSeparator( TQMenuBar.InWindowsStyle ) - self.menubar.setSeparator( 1 ) - - # Create an easter egg - TQToolTip.add( self.menubar, TQRect( 0, 0, 2, 2 ), "easter egg" ) - - self.popup = TQPopupMenu() - self.id = self.popup.insertItem( "&New" ) - self.popup.setItemEnabled( self.id, FALSE ) - self.id = self.popup.insertItem( "&Open" ) - self.popup.setItemEnabled( self.id, FALSE ) - self.popup.insertSeparator() - self.popup.insertItem( "&Quit", tqApp, SLOT("quit()"), TQt.CTRL+TQt.Key_Q ) - - self.menubar.insertItem( "&File", self.popup ) - - # Must tell the layout about a menubar in a widget - self.topLayout.setMenuBar( self.menubar ) - - # Create an analog and a digital clock - self.aclock = AnalogClock( self ) - self.aclock.resize( 50, 50 ) - self.dclock = DigitalClock( self ) - self.dclock.setMaximumWidth( 200 ) - self.grid.addWidget( self.aclock, 0, 2 ) - self.grid.addWidget( self.dclock, 1, 2 ) - - # Give the dclock widget a blue palette - col = TQColor() - col.setRgb( 0xaa, 0xbe, 0xff ) - self.dclock.setPalette( TQPalette( col ) ) - - # make tool tips for both of them - TQToolTip.add( self.aclock, "custom widget: analog clock" ) - TQToolTip.add( self.dclock, "custom widget: digital clock" ) - - # Create a push button. - self.pb = TQPushButton( self, "button1" ) # create button 1 - self.pb.setText( "Push button 1" ) - self.pb.setFixedHeight( self.pb.sizeHint().height() ) - self.grid.addWidget( self.pb, 0, 0, TQt.AlignVCenter ) - self.connect( self.pb, SIGNAL("clicked()"), self.button1Clicked ) - TQToolTip.add( self.pb, "push button 1" ) - self.pm = TQPixmap() - self.pix = self.pm.load( "qt.png" ) # load pixmap for button 2 - if not self.pix: - TQMessageBox.information( None, "TQt Widgets Example", - "Could not load the file \"qt.png\", which\n" - "contains an icon used...\n\n" - "The text \"line 42\" will be substituted.", - TQMessageBox.Ok + TQMessageBox.Default ) - - # Create a label containing a TQMovie - self.movielabel = TQLabel( self, "label0" ) - self.movie = TQMovie( MOVIEFILENAME ) - self.movie.connectStatus( self.movieStatus ) - self.movie.connectUpdate( self.movieUpdate ) - self.movielabel.setFrameStyle( TQFrame.Box | TQFrame.Plain ) - self.movielabel.setMovie( self.movie ) - self.movielabel.setMargin( 0 ) - self.movielabel.setFixedSize( 128 + self.movielabel.frameWidth() * 2, - 64 + self.movielabel.frameWidth() * 2 ) - self.grid.addWidget( self.movielabel, 0, 1, TQt.AlignCenter ) - TQToolTip.add( self.movielabel, "movie" ) - - # Create a group of check boxes - self.bg = TQButtonGroup( self, "checkGroup" ) - self.bg.setTitle( "Check Boxes" ) - self.grid.addWidget( self.bg, 1, 0 ) - - # Create a layout for the check boxes - self.vbox = TQVBoxLayout(self.bg, 10) - - self.vbox.addSpacing( self.bg.fontMetrics().height() ) - - self.cb = list(range(3)) - self.cb[0] = TQCheckBox( self.bg ) - self.cb[0].setText( "Read" ) - self.vbox.addWidget( self.cb[0] ) - self.cb[0].setMinimumSize( self.cb[0].sizeHint() ) - self.cb[1] = TQCheckBox( self.bg ) - self.cb[1].setText( "Write" ) - self.vbox.addWidget( self.cb[1] ) - self.cb[1].setMinimumSize( self.cb[1].sizeHint() ) - self.cb[2] = TQCheckBox( self.bg ) - self.cb[2].setText( "Execute" ) - self.cb[2].setMinimumSize( self.cb[2].sizeHint() ) - self.vbox.addWidget( self.cb[2] ) - self.bg.setMinimumSize( self.bg.childrenRect().size() ) - self.vbox.activate() - - self.connect( self.bg, SIGNAL("clicked(int)"), self.checkBoxClicked ) - - TQToolTip.add( self.cb[0], "check box 1" ) - TQToolTip.add( self.cb[1], "check box 2" ) - TQToolTip.add( self.cb[2], "check box 3" ) - - # Create a group of radio buttons - self.bg = TQButtonGroup( self, "radioGroup" ) - self.bg.setTitle( "Radio buttons" ) - - self.grid.addWidget( self.bg, 1, 1 ) - - # Create a layout for the radio buttons - self.vbox = TQVBoxLayout( self.bg, 10 ) - - self.vbox.addSpacing( self.bg.fontMetrics().height() ) - self.rb = TQRadioButton( self.bg ) - self.rb.setText( "&AM" ) - self.rb.setChecked( TRUE ) - self.vbox.addWidget( self.rb ) - self.rb.setMinimumSize( self.rb.sizeHint() ) - TQToolTip.add( self.rb, "radio button 1" ) - self.rb = TQRadioButton( self.bg ) - self.rb.setText( "&FM" ) - self.vbox.addWidget( self.rb ) - self.rb.setMinimumSize( self.rb.sizeHint() ) - TQToolTip.add( self.rb, "radio button 2" ) - self.rb = TQRadioButton( self.bg ) - self.rb.setText( "&Short Wave" ) - self.vbox.addWidget( self.rb ) - self.rb.setMinimumSize( self.rb.sizeHint() ) - self.vbox.activate() - - self.connect( self.bg, SIGNAL("clicked(int)"), self.radioButtonClicked ) - TQToolTip.add( self.rb, "radio button 3" ) - - # Create a list box - self.lb = TQListBox( self, "listBox" ) - for i in range( 0, 100, 1 ): # fill list box - txt = TQString() - txt = "line %d" % i - if i == 42 and self.pix: - self.lb.insertItem( self.pm ) - else: - self.lb.insertItem( txt ) - - self.grid.addMultiCellWidget( self.lb, 2, 4, 0, 0 ) - self.connect( self.lb, SIGNAL("selected(int)"), self.listBoxItemSelected ) - TQToolTip.add( self.lb, "list box" ) - - self.vbox = TQVBoxLayout( 8 ) - self.grid.addLayout( self.vbox, 2, 1 ) - - # Create a slider - self.sb = TQSlider( 0, 300, 1, 100, TQSlider.Horizontal, self, "Slider" ) - #self.sb.setTickmarks( TQSlider.Below ) - self.sb.setTickmarks( 1 ) - self.sb.setTickInterval( 10 ) - #self.sb.setFocusPolicy( TQWidget.TabFocus ) - self.sb.setFocusPolicy( 1 ) - self.sb.setFixedHeight( self.sb.sizeHint().height() ) - self.vbox.addWidget( self.sb ) - - self.connect( self.sb, SIGNAL("valueChanged(int)"), self.sliderValueChanged ) - TQToolTip.add( self.sb, "slider" ) - - # Create a combo box - self.combo = TQComboBox( FALSE, self, "comboBox" ) - self.combo.insertItem( "darkBlue" ) - self.combo.insertItem( "darkRed" ) - self.combo.insertItem( "darkGreen" ) - self.combo.insertItem( "blue" ) - self.combo.insertItem( "red" ) - self.combo.setFixedHeight( self.combo.sizeHint().height() ) - self.vbox.addWidget( self.combo ) - self.connect( self.combo, SIGNAL("activated(int)"), self.comboBoxItemActivated ) - TQToolTip.add( self.combo, "read-only combo box" ) - - # Create an editable combo box - self.edCombo = TQComboBox( TRUE, self, "edComboBox" ) - self.edCombo.insertItem( "Permutable" ) - self.edCombo.insertItem( "Malleable" ) - self.edCombo.insertItem( "Adaptable" ) - self.edCombo.insertItem( "Alterable" ) - self.edCombo.insertItem( "Inconstant" ) - self.edCombo.setFixedHeight( self.edCombo.sizeHint().height() ) - self.vbox.addWidget( self.edCombo ) - self.connect( self.edCombo, SIGNAL("activated(const TQString &)"), self.edComboBoxItemActivated) - TQToolTip.add( self.edCombo, "editable combo box" ) - - self.edCombo.setAutoCompletion( TRUE ) - - self.vbox.addStretch( 1 ) - - self.vbox = TQVBoxLayout( 8 ) - self.grid.addLayout( self.vbox, 2, 2 ) - - # Create a spin box - self.spin = TQSpinBox( 0, 10, 1, self, "spin" ) - self.spin.setSuffix( " mm" ) - self.spin.setSpecialValueText( "Auto" ) - self.spin.setMinimumSize( self.spin.sizeHint() ) - self.connect( self.spin, SIGNAL( "valueChanged(const TQString &)" ), self.spinBoxValueChanged ) - TQToolTip.add( self.spin, "spin box" ) - self.vbox.addWidget( self.spin ) - - self.vbox.addStretch( 1 ) - - # Create a multi line edit - self.mle = TQMultiLineEdit( self, "multiLineEdit" ) - - self.grid.addMultiCellWidget( self.mle, 3, 3, 1, 2 ) - self.mle.setMinimumHeight( self.mle.fontMetrics().height() * 3 ) - self.mle.setText("This is a TQMultiLineEdit widget,\n" - "useful for small multi-line\n" - "input fields.") - TQToolTip.add( self.mle, "multi line editor" ) - - # Create a single line edit - self.le = TQLineEdit( self, "lineEdit" ) - self.grid.addMultiCellWidget( self.le, 4, 4, 1, 2 ) - self.le.setFixedHeight( self.le.sizeHint().height() ) - self.connect( self.le, SIGNAL("textChanged(const TQString &)"), self.lineEditTextChanged ) - TQToolTip.add( self.le, "single line editor" ) - - # Create a horizontal line (sort of TQFrame) above the message line - self.separator = TQFrame( self, "separatorLine" ) - self.separator.setFrameStyle( TQFrame.HLine | TQFrame.Sunken ) - self.separator.setFixedHeight( self.separator.sizeHint().height() ) - self.grid.addMultiCellWidget( self.separator, 5, 5, 0, 2 ) - TQToolTip.add( self.separator, "tool tips on a separator! wow!" ) - - self.grid.setRowStretch( 0, 0 ) - self.grid.setRowStretch( 1, 0 ) - self.grid.setRowStretch( 2, 0 ) - self.grid.setRowStretch( 3, 1 ) - self.grid.setRowStretch( 4, 1 ) - self.grid.setRowStretch( 5, 0 ) - - self.grid.setColStretch( 0, 1 ) - self.grid.setColStretch( 1, 1 ) - self.grid.setColStretch( 2, 1 ) - - # Create an label and a message in a plain widget - # The message is updated when buttons are clicked etc. - - self.hbox = TQHBoxLayout() - self.topLayout.addLayout( self.hbox ) - self.msgLabel = TQLabel( self, "msgLabel" ) - self.msgLabel.setText( "Message:" ) - self.msgLabel.setAlignment( TQt.AlignHCenter | TQt.AlignVCenter ) - self.msgLabel.setFixedSize( self.msgLabel.sizeHint() ) - self.hbox.addWidget( self.msgLabel ) - TQToolTip.add( self.msgLabel, "label 1" ) - - self.msg = TQLabel( self, "message" ) - self.msg.setFrameStyle( TQFrame.Panel | TQFrame.Sunken ) - self.msg.setAlignment( TQt.AlignCenter ) - self.msg.setFont( TQFont( "times", 12, TQFont.Bold ) ) - self.msg.setText( "Message" ) - self.msg.setFixedHeight( self.msg.sizeHint().height() ) - self.msg.setText( "" ) - self.hbox.addWidget( self.msg, 5 ) - TQToolTip.add( self.msg, "label 2" ) - - self.topLayout.activate() - - def setStatus(self, text): - self.msg.setText( text ) - - def movieUpdate( self, r ): - # Uncomment this to test animated icons on your window manager - self.setIcon( self.movie.framePixmap() ) - - def movieStatus( self, s ): - if s == TQMovie.SourceEmpty or s == TQMovie.UnrecognizedFormat: - pm = TQPixmap('tt-logo.png') - self.movielabel.setPixmap(pm) - self.movielabel.setFixedSize(pm.size()) - else: - if ( self.movielabel.movie() ): # for flicker-free animation: - self.movielabel.setBackgroundMode( TQWidget.NoBackground ) - - def button1Clicked( self ): - self.msg.setText( "The first push button was clicked" ) - - def checkBoxClicked( self, id ): - txt = TQString() - txt = "Check box %s clicked : " % str(id) - chk = ["-","-","-"] - if self.cb[0].isChecked(): - chk[0] = "r" - if self.cb[1].isChecked(): - chk[1] = "w" - if self.cb[2].isChecked(): - chk[2] = "x" - txt = txt + str(chk[0]+chk[1]+chk[2]) - self.msg.setText( txt ) - - def edComboBoxItemActivated( self, text): - txt = TQString() - txt = "Editable Combo Box set to %s" % text - self.msg.setText( txt ) - - def radioButtonClicked( self, id ): - txt = TQString() - txt = "Radio button #%d clicked" % id - self.msg.setText( txt ) - - def listBoxItemSelected( self, index ): - txt = TQString() - txt = "List box item %d selected" % index - self.msg.setText( txt ) - - def sliderValueChanged( self, value ): - txt = TQString() - txt = "Movie set to %d%% of normal speed" % value - self.msg.setText( txt ) - self.movie.setSpeed( value ) - - def comboBoxItemActivated( self, index ): - txt = TQString() - txt = "Comboxo box item %d activated" % index - self.msg.setText( txt ) - if index == 0: - TQApplication.setWinStyleHighlightColor( TQt.darkBlue ) - elif index == 1: - TQApplication.setWinStyleHighlightColor( TQt.darkRed ) - elif index == 2: - TQApplication.setWinStyleHighlightColor( TQt.darkGreen ) - elif index == 3: - TQApplication.setWinStyleHighlightColor( TQt.blue ) - elif index == 4: - TQApplication.setWinStyleHighlightColor( TQt.red ) - - def lineEditTextChanged( self, newText ): - self.msg.setText("Line edit text: " + str(newText)) - - def spinBoxValueChanged( self, valueText ): - self.msg.setText("Spin box value: " + str(valueText)) - - # All application events are passed throught this event filter. - # We're using it to display some information about a clicked - # widget (right mouse button + CTRL). - #def eventFilter( self, event ): - # identify_now = TRUE - # if event.type() == Event_MouseButtonPress and identify_now: - # e = TQMouseEvent( event ) - # if (e.button() == TQt.RightButton) and (e.state() & TQt.ControlButton) != 0: - # txt = TQString( "The clicked widget is a\n" ) - # txt = txt + TQObect.className() - # txt = txt + "\nThe widget's name is\n" - # if TQObject.name(): - # txt = txt + TQObject.name() - # else: - # txt = txt + "" - # identify_now = FALSE # don't do it in message box - # TQMessageBox.message( "Identify Widget", txt, 0, TQObject ) - # identify_now = TRUE; # allow it again - # return FALSE # don't eat event - -################################################################################################ - -#TQApplication.setColourSpec( TQApplication.CustomColor ) -a = TQApplication( sys.argv ) - -w = WidgetView() -a.setMainWidget( w ) -w.show() -a.exec_loop() diff --git a/examples3/README b/examples3/README deleted file mode 100644 index fcebe5f..0000000 --- a/examples3/README +++ /dev/null @@ -1,12 +0,0 @@ -To run these examples, make sure you have your PYTHONPATH environment variable -set if needed and explicitly set the path to python at the top of each script -if you don't have /usr/bin/env. - -The examples are written for TQt v3.x. - -A much better source of information about using PyTQt is Boudewijn Rempt's -book at http://stage.linuxports.com/projects/pyqt/. - - -Phil Thompson -phil@riverbankcomputing.co.uk diff --git a/examples3/SQL/README b/examples3/SQL/README deleted file mode 100644 index 862e608..0000000 --- a/examples3/SQL/README +++ /dev/null @@ -1,76 +0,0 @@ -This directory contains some translated sql examples from TQt 3.x. - -runform1.py, form1.ui: - - A simple designer generated TQDataTable. Run "pyuic form1.ui -o form1.py". - -runform2.py, form2.ui: - - A simple designer generated TQDataBrowser. Run "pyuic form2.ui -o form2.py". - -sqlcustom1.py: - - TQSqlForm based form with a simple custom editor forcing all input to - be uppercase - -sqltable4.py: - - Custom TQDataTable with reimplemented paintField method, combined with - a TQComboBox based custom field editor (StatusPicker), gathering its - items from a different table (status) and a calculated column (monsalary). - Note, that TQSqlEditorFactory based field editors are somewhat restricted, - because TQt's TQ_PROPERTY feature isn't supported, yet. I've circumvented - this limitation by choosing the status table ids corresponding to the - index in the TQComboBox. - -sqlsubclass5.py: - - Similar to the former, and even more deviated from its qt ancestor, - because the sense escaped me. This could be related to the different - database layout needed for MySQL (Trolltech used PostgreSQL sequences, - while we're using the simpler, but less powerful auto_increment here). - If you enter and invalid date (e.g. day: 0) in the Paid column, it is - shown as "not yet", but produces some qt warnings. - -runsqlex.py, sqlex.ui, sqlex.ui.h, connect.ui, connect.ui.h: - - This one is a most advanced example, showing the use of a TQSqlCursor - driven by TQSqlQuery and iterating through database tables and fields. - Definitely worth a look. - -Unfortunately you will have to make sure that these prerequisites are met -before trying the examples: - - - Install MySQL or PostgreSQL and any development packages - - - Create a database user with sufficient rights - - - Create the testdb database - - For MySQL, run: mysql -u user -p password < testdb_mysql.sql - - For PostgreSQL, run: psql -U user template1 -f testdb_pg.sql - - - Build TQt with the mysql and/or psql modules activated. - -Now you should be ready for the fun part. You can run dbconnect.py from -a command line and try to connect to the database. If all went well, -'ok' should be printed after pressing OK. If you don't want to enter all -your data over and over again, create a file named local_dbpar.py here, -with the following keys (with your own data, of course): - -DB_HOSTNAMES = ["localhost"] -DB_DATABASES = ["testdb"] -DB_USERNAME = "name" -DB_PASSWORD = "pass" - -The dbconnect.py script is generated from dbconnect.ui, which was created -with qt's designer. You can find it also in Boudewijn Rempt's book -"GUI Programming with Python, using the TQt Toolkit". Although you won't find -the SQL widgets discussed there, for the simple reason of the book being -written before they appeared, it is a valuable source for anybody new in -this area. - -Please direct any comments, patches and questions to . - -Good luck - -Hans-Peter Jansen diff --git a/examples3/SQL/connect.ui b/examples3/SQL/connect.ui deleted file mode 100644 index d33a783..0000000 --- a/examples3/SQL/connect.ui +++ /dev/null @@ -1,238 +0,0 @@ - -ConnectDialog - - - ConnectDialog - - - - 0 - 0 - 303 - 251 - - - - Connect... - - - - unnamed - - - 11 - - - 6 - - - - GroupBox3 - - - Connection settings - - - - unnamed - - - 11 - - - 6 - - - - editDatabase - - - - - TextLabel3 - - - Database Name: - - - comboDatabase - - - - - editPassword - - - Password - - - - - TextLabel4 - - - &Username: - - - editUsername - - - - - TextLabel4_2 - - - &Password: - - - editPassword - - - - - comboDriver - - - - - editUsername - - - - - editHostname - - - - - TextLabel5 - - - &Hostname: - - - editHostname - - - - - TextLabel5_2 - - - P&ort: - - - portSpinBox - - - - - portSpinBox - - - Default - - - 65535 - - - -1 - - - -1 - - - - - TextLabel2 - - - D&river - - - comboDriver - - - - - - - Layout25 - - - - unnamed - - - 0 - - - 6 - - - - Spacer1 - - - Horizontal - - - Expanding - - - - - PushButton1 - - - &OK - - - true - - - - - PushButton2 - - - &Cancel - - - - - - - - - PushButton1 - clicked() - ConnectDialog - accept() - - - PushButton2 - clicked() - ConnectDialog - reject() - - - - comboDriver - editDatabase - editUsername - editPassword - editHostname - portSpinBox - PushButton1 - PushButton2 - - - connect.ui.h - - - init() - destroy() - - - diff --git a/examples3/SQL/connect.ui.h b/examples3/SQL/connect.ui.h deleted file mode 100644 index ceff8dc..0000000 --- a/examples3/SQL/connect.ui.h +++ /dev/null @@ -1,21 +0,0 @@ -/**************************************************************************** -** ui.h extension file, included from the uic-generated form implementation. -** -** If you wish to add, delete or rename slots use TQt Designer which will -** update this file, preserving your code. Create an init() slot in place of -** a constructor, and a destroy() slot in place of a destructor. -*****************************************************************************/ - - -void ConnectDialog::init() -{ -from python_tqt.qtsql import TQSqlDatabase -#qDebug("ConnectDialog init") -self.comboDriver.clear() -self.comboDriver.insertStringList(TQSqlDatabase.drivers()) -} - -void ConnectDialog::destroy() -{ - -} diff --git a/examples3/SQL/dbconnect.py b/examples3/SQL/dbconnect.py deleted file mode 100755 index d1c1baf..0000000 --- a/examples3/SQL/dbconnect.py +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/env python - -import sys -from python_tqt.qt import * -from python_tqt.qtsql import * - -from frmconnect import frmConnect -from dbpar import * - -TRUE = 1 -FALSE = 0 - -def createConnection(): - driver = DB_DRIVER - # all qt examples use TQSqlDatabase::addDatabase, but - # this never returns NULL in my experience - drivers = list(map(str, TQSqlDatabase.drivers())) - if driver in drivers: - dlg = dbConnect(driver) - #TODO: make connection parameters accessible - return dlg.exec_loop() - else: - TQMessageBox.warning(None, "Database Error", - "<%s> database driver not found!\n\n" - "Please make sure, that this database adaptor\n" - "is available in your TQt installation.\n" % - (driver), TQMessageBox.Abort | TQMessageBox.Escape) - return FALSE - -class dbConnect(frmConnect): - def __init__(self, driver, parent = None): - frmConnect.__init__(self, parent) - self.hostnames = DB_HOSTNAMES - self.hostname = DB_HOSTNAMES[0] - self.databases = DB_DATABASES - self.database = DB_DATABASES[0] - self.username = DB_USERNAME - self.password = DB_PASSWORD - self.dbdriver = driver - - self.txtName.setText(self.username) - self.txtPasswd.setText(self.password) - list(map(self.cmbServer.insertItem, self.hostnames)) - list(map(self.cmbDatabase.insertItem, self.databases)) - self.connect(self.buttonHelp, SIGNAL("clicked()"), - self.buttonHelp_clicked) - - def accept(self): - self.hostname = self.cmbServer.currentText() - self.database = self.cmbDatabase.currentText() - self.username = self.txtName.text() - self.password = self.txtPasswd.text() - db = TQSqlDatabase.addDatabase(self.dbdriver) - if db: - db.setHostName(self.hostname) - db.setDatabaseName(self.database) - db.setUserName(self.username) - db.setPassword(self.password) - if db.open(): - frmConnect.accept(self) - else: - TQMessageBox.warning(self, "Database Error", - "Cannot open %s database on %s!\n\n%s\n%s\n" % - (self.database, self.hostname, - db.lastError().driverText(), - db.lastError().databaseText()), " Ooops ") - - - def buttonHelp_clicked(self): - TQMessageBox.information(self, "About Connecting", - "Here you specify userid, password, host and database\n" - "for the PyTQt sql examples. If you encounter any problems,\n" - "please read the README file in this folder before posting.\n\n" - "Thanks,\nHans-Peter Jansen \n") - - -if __name__ == "__main__": - app = TQApplication(sys.argv) - if createConnection(): - print("ok") - else: - print("cancel") diff --git a/examples3/SQL/dbpar.py b/examples3/SQL/dbpar.py deleted file mode 100644 index 19e6d9b..0000000 --- a/examples3/SQL/dbpar.py +++ /dev/null @@ -1,22 +0,0 @@ -# sql examples default database parameter - -# you can create a local_dbpar.py module with definitons -# of your own parameters to overrule these defaults - -#DB_DRIVER = "TQPSQL7" -DB_DRIVER = "TQMYSQL3" -# list of servers -DB_HOSTNAMES = ["localhost"] -# list of databases -DB_DATABASES = ["testdb"] -# database user id -DB_USERNAME = "" -# database password -DB_PASSWORD = "" - -# remove this in your local_dbpar.py -try: - from local_dbpar import * -except: - pass - diff --git a/examples3/SQL/form1.ui b/examples3/SQL/form1.ui deleted file mode 100644 index 118a84e..0000000 --- a/examples3/SQL/form1.ui +++ /dev/null @@ -1,77 +0,0 @@ - -Form1 - - - Form1 - - - - 0 - 0 - 600 - 370 - - - - Form1 - - - - - Forename - - - forename - - - - - Surname - - - surname - - - - - Salary - - - salary - - - - - Statusid - - - statusid - - - - DataTable2 - - - - 0 - 0 - 600 - 370 - - - - true - - - true - - - - (default) - staff - - - - - - diff --git a/examples3/SQL/form2.ui b/examples3/SQL/form2.ui deleted file mode 100644 index 4856e39..0000000 --- a/examples3/SQL/form2.ui +++ /dev/null @@ -1,327 +0,0 @@ - -Form2 - - - Form2 - - - - 0 - 0 - 367 - 152 - - - - Form2 - - - - DataBrowser1 - - - - 0 - 0 - 366 - 150 - - - - - surname ASC - forename ASC - - - - - (default) - staff - - - - - unnamed - - - 11 - - - 6 - - - - Layout2 - - - - unnamed - - - 0 - - - 6 - - - - labelSurname - - - Surname - - - - - TQSpinBoxStatusid - - - 2147483647 - - - - (default) - staff - statusid - - - - - - TQLineEditSurname - - - - (default) - staff - surname - - - - - - labelStatusid - - - Statusid - - - - - labelForename - - - Forename - - - - - TQLineEditSalary - - - AlignRight - - - - (default) - staff - salary - - - - - - labelSalary - - - Salary - - - - - TQLineEditForename - - - - (default) - staff - forename - - - - - - - - Layout3 - - - - unnamed - - - 0 - - - 6 - - - - PushButtonFirst - - - |< &First - - - - - PushButtonPrev - - - << &Prev - - - - - PushButtonNext - - - &Next >> - - - - - PushButtonLast - - - &Last >| - - - - - - - Layout4 - - - - unnamed - - - 0 - - - 6 - - - - PushButtonInsert - - - &Insert - - - - - PushButtonUpdate - - - &Update - - - - - PushButtonDelete - - - &Delete - - - - - - - - - - PushButtonFirst - clicked() - DataBrowser1 - first() - - - DataBrowser1 - firstRecordAvailable( bool ) - PushButtonFirst - setEnabled(bool) - - - PushButtonPrev - clicked() - DataBrowser1 - prev() - - - DataBrowser1 - prevRecordAvailable( bool ) - PushButtonPrev - setEnabled(bool) - - - PushButtonNext - clicked() - DataBrowser1 - next() - - - DataBrowser1 - nextRecordAvailable( bool ) - PushButtonNext - setEnabled(bool) - - - PushButtonLast - clicked() - DataBrowser1 - last() - - - DataBrowser1 - lastRecordAvailable( bool ) - PushButtonLast - setEnabled(bool) - - - PushButtonInsert - clicked() - DataBrowser1 - insert() - - - PushButtonUpdate - clicked() - DataBrowser1 - update() - - - PushButtonDelete - clicked() - DataBrowser1 - del() - - - - TQLineEditForename - TQLineEditSurname - TQLineEditSalary - TQSpinBoxStatusid - PushButtonFirst - PushButtonPrev - PushButtonNext - PushButtonLast - PushButtonInsert - PushButtonUpdate - PushButtonDelete - - - diff --git a/examples3/SQL/frmconnect.py b/examples3/SQL/frmconnect.py deleted file mode 100644 index 97fb406..0000000 --- a/examples3/SQL/frmconnect.py +++ /dev/null @@ -1,120 +0,0 @@ -# Form implementation generated from reading ui file 'frmconnect.ui' -# -# Created: Sam Jul 6 12:47:10 2002 -# by: The PyTQt User Interface Compiler (pyuic) -# -# WARNING! All changes made in this file will be lost! - - -from python_tqt.qt import * - - -class frmConnect(TQDialog): - def __init__(self,parent = None,name = None,modal = 0,fl = 0): - TQDialog.__init__(self,parent,name,modal,fl) - - if name == None: - self.setName("frmConnect") - - self.resize(415,154) - self.setCaption(self.trUtf8("Connecting")) - self.setSizeGripEnabled(1) - - frmConnectLayout = TQGridLayout(self,1,1,11,6,"frmConnectLayout") - - Layout7 = TQVBoxLayout(None,0,6,"Layout7") - - self.buttonOK = TQPushButton(self,"buttonOK") - self.buttonOK.setText(self.trUtf8("&OK")) - self.buttonOK.setAutoDefault(1) - self.buttonOK.setDefault(1) - TQToolTip.add(self.buttonOK,self.trUtf8("Connect to Database")) - Layout7.addWidget(self.buttonOK) - - self.buttonCancel = TQPushButton(self,"buttonCancel") - self.buttonCancel.setText(self.trUtf8("&Cancel")) - TQToolTip.add(self.buttonCancel,self.trUtf8("Cancel Connecting")) - Layout7.addWidget(self.buttonCancel) - - self.buttonHelp = TQPushButton(self,"buttonHelp") - self.buttonHelp.setText(self.trUtf8("&Help")) - TQToolTip.add(self.buttonHelp,self.trUtf8("About Connecting")) - Layout7.addWidget(self.buttonHelp) - spacer = TQSpacerItem(0,0,TQSizePolicy.Minimum,TQSizePolicy.Expanding) - Layout7.addItem(spacer) - - frmConnectLayout.addLayout(Layout7,0,1) - - self.grpConnection = TQGroupBox(self,"grpConnection") - self.grpConnection.setTitle(self.trUtf8("")) - self.grpConnection.setColumnLayout(0,TQt.Vertical) - self.grpConnection.layout().setSpacing(6) - self.grpConnection.layout().setMargin(11) - grpConnectionLayout = TQGridLayout(self.grpConnection.layout()) - grpConnectionLayout.setAlignment(TQt.AlignTop) - - self.txtName = TQLineEdit(self.grpConnection,"txtName") - self.txtName.setMaxLength(16) - TQToolTip.add(self.txtName,self.trUtf8("Database User ID")) - - grpConnectionLayout.addWidget(self.txtName,0,1) - - self.lblDatabase = TQLabel(self.grpConnection,"lblDatabase") - self.lblDatabase.setText(self.trUtf8("&Database")) - - grpConnectionLayout.addWidget(self.lblDatabase,3,0) - - self.lblServer = TQLabel(self.grpConnection,"lblServer") - self.lblServer.setText(self.trUtf8("&Server")) - - grpConnectionLayout.addWidget(self.lblServer,2,0) - - self.lblName = TQLabel(self.grpConnection,"lblName") - self.lblName.setText(self.trUtf8("&Name")) - - grpConnectionLayout.addWidget(self.lblName,0,0) - - self.cmbDatabase = TQComboBox(0,self.grpConnection,"cmbDatabase") - self.cmbDatabase.setEditable(1) - self.cmbDatabase.setAutoCompletion(1) - self.cmbDatabase.setDuplicatesEnabled(0) - TQToolTip.add(self.cmbDatabase,self.trUtf8("Database Name")) - - grpConnectionLayout.addWidget(self.cmbDatabase,3,1) - - self.txtPasswd = TQLineEdit(self.grpConnection,"txtPasswd") - self.txtPasswd.setMaxLength(16) - self.txtPasswd.setEchoMode(TQLineEdit.Password) - TQToolTip.add(self.txtPasswd,self.trUtf8("Database User Password")) - - grpConnectionLayout.addWidget(self.txtPasswd,1,1) - - self.lblPasswd = TQLabel(self.grpConnection,"lblPasswd") - self.lblPasswd.setText(self.trUtf8("&Password")) - - grpConnectionLayout.addWidget(self.lblPasswd,1,0) - - self.cmbServer = TQComboBox(0,self.grpConnection,"cmbServer") - self.cmbServer.setEditable(1) - self.cmbServer.setAutoCompletion(1) - self.cmbServer.setDuplicatesEnabled(0) - TQToolTip.add(self.cmbServer,self.trUtf8("Database Server Address")) - - grpConnectionLayout.addWidget(self.cmbServer,2,1) - - frmConnectLayout.addWidget(self.grpConnection,0,0) - - self.connect(self.buttonOK,SIGNAL("clicked()"),self,SLOT("accept()")) - self.connect(self.buttonCancel,SIGNAL("clicked()"),self,SLOT("reject()")) - - self.setTabOrder(self.txtName,self.txtPasswd) - self.setTabOrder(self.txtPasswd,self.cmbServer) - self.setTabOrder(self.cmbServer,self.cmbDatabase) - self.setTabOrder(self.cmbDatabase,self.buttonOK) - self.setTabOrder(self.buttonOK,self.buttonCancel) - self.setTabOrder(self.buttonCancel,self.buttonHelp) - - self.lblDatabase.setBuddy(self.cmbDatabase) - self.lblServer.setBuddy(self.cmbServer) - self.lblName.setBuddy(self.txtName) - self.lblPasswd.setBuddy(self.txtPasswd) diff --git a/examples3/SQL/frmconnect.ui b/examples3/SQL/frmconnect.ui deleted file mode 100644 index f2017ee..0000000 --- a/examples3/SQL/frmconnect.ui +++ /dev/null @@ -1,245 +0,0 @@ - -frmConnect - - - frmConnect - - - - 0 - 0 - 415 - 154 - - - - Connecting - - - true - - - - unnamed - - - 11 - - - 6 - - - - Layout7 - - - - unnamed - - - 0 - - - 6 - - - - buttonOK - - - &OK - - - true - - - true - - - Connect to Database - - - - - buttonCancel - - - &Cancel - - - Cancel Connecting - - - - - buttonHelp - - - &Help - - - About Connecting - - - - - spacer - - - Vertical - - - Expanding - - - - - - - grpConnection - - - - - - - unnamed - - - 11 - - - 6 - - - - txtName - - - 16 - - - Database User ID - - - - - lblDatabase - - - &Database - - - cmbDatabase - - - - - lblServer - - - &Server - - - cmbServer - - - - - lblName - - - &Name - - - txtName - - - - - cmbDatabase - - - true - - - true - - - false - - - Database Name - - - - - txtPasswd - - - 16 - - - Password - - - Database User Password - - - - - lblPasswd - - - &Password - - - txtPasswd - - - - - cmbServer - - - true - - - true - - - false - - - Database Server Address - - - - - - - - - buttonOK - clicked() - frmConnect - accept() - - - buttonCancel - clicked() - frmConnect - reject() - - - - txtName - txtPasswd - cmbServer - cmbDatabase - buttonOK - buttonCancel - buttonHelp - - - diff --git a/examples3/SQL/runform1.py b/examples3/SQL/runform1.py deleted file mode 100755 index 2e01b7e..0000000 --- a/examples3/SQL/runform1.py +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env python - -import sys -from python_tqt.qt import * - -from form1 import Form1 -from dbconnect import createConnection - -class mainWindow(Form1): - def __init__(self,parent = None,name = None,fl = 0): - Form1.__init__(self,parent,name,fl) - -if __name__ == "__main__": - a = TQApplication(sys.argv) - if createConnection(): - TQObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()")) - w = mainWindow() - a.setMainWidget(w) - w.show() - a.exec_loop() - diff --git a/examples3/SQL/runform2.py b/examples3/SQL/runform2.py deleted file mode 100755 index 0184e9d..0000000 --- a/examples3/SQL/runform2.py +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env python - -import sys -from python_tqt.qt import * - -from form2 import Form2 -from dbconnect import createConnection - -class mainWindow(Form2): - def __init__(self,parent = None,name = None,fl = 0): - Form2.__init__(self,parent,name,fl) - -if __name__ == "__main__": - a = TQApplication(sys.argv) - if createConnection(): - TQObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()")) - w = mainWindow() - a.setMainWidget(w) - w.show() - a.exec_loop() - diff --git a/examples3/SQL/runsqlex.py b/examples3/SQL/runsqlex.py deleted file mode 100755 index 2235699..0000000 --- a/examples3/SQL/runsqlex.py +++ /dev/null @@ -1,151 +0,0 @@ -#!/usr/bin/env python - -import sys -from python_tqt.qt import * -from python_tqt.qtsql import * - -from sqlex import SqlEx -from connect import ConnectDialog - -from dbpar import * - -TRUE = 1 -FALSE = 0 - -def showError(err, parent): - errStr = TQString("The database reported an error:\n\n") - if not err.databaseText().isEmpty(): - errStr.append(err.databaseText()) - errStr.append("\n") - if not err.driverText().isEmpty(): - errStr.append(err.driverText()) - errStr.append("\n") - TQMessageBox.warning(parent, "Error", errStr) - -class CustomSqlCursor(TQSqlCursor): - def __init__(self, query = None, autopopulate = TRUE, db = None): - TQSqlCursor.__init__(self, None, autopopulate, db) - self.execQuery(query) - if self.isSelect() and autopopulate: - fields = self.driver().recordInfo(self) - for f in fields: - self.append(f) - self.setMode(TQSqlCursor.ReadOnly) - - def select(self, filter, sort = TQSqlIndex()): - return self.execQuery(self.lastQuery()) - - def primaryIndex(self, prime = TRUE): - return TQSqlIndex() - - def insert(self, invalidate = TRUE): - return FALSE - - def update(self, invalidate = TRUE): - return FALSE - - def delRecords(self, invalidate = TRUE): - return FALSE - - def setName(self, name, autopopulate = TRUE): - return - - -class MainWindow(SqlEx): - def __init__(self,parent = None,name = None,fl = 0): - SqlEx.__init__(self,parent,name,fl) - self.conDiag = ConnectDialog(self, "Connection Dialog", TRUE) - self.firstconn = TRUE - - def dbConnect(self): - if self.firstconn: - self.firstconn = FALSE - self.conDiag.editUsername.setText(DB_USERNAME) - self.conDiag.editPassword.setText(DB_PASSWORD) - self.conDiag.editHostname.setText(DB_HOSTNAMES[0]) - self.conDiag.editDatabase.setText(DB_DATABASES[0]) - for i in range(self.conDiag.comboDriver.count()): - if str(self.conDiag.comboDriver.text(i)) == DB_DRIVER: - self.conDiag.comboDriver.setCurrentItem(i) - break - if self.conDiag.exec_loop() != TQDialog.Accepted: - return - if self.dt.sqlCursor(): - self.dt.setSqlCursor() - - # close old connection (if any) - if TQSqlDatabase.contains("SqlEx"): - oldDb = TQSqlDatabase.database("SqlEx") - oldDb.close() - TQSqlDatabase.removeDatabase("SqlEx") - - # open the new connection - db = TQSqlDatabase.addDatabase(self.conDiag.comboDriver.currentText(), "SqlEx") - if not db: - TQMessageBox.warning(self, "Error", "Could not open database") - return - - db.setHostName(self.conDiag.editHostname.text()) - db.setDatabaseName(self.conDiag.editDatabase.text()) - db.setPort(self.conDiag.portSpinBox.value()) - if not db.open(self.conDiag.editUsername.text(), - self.conDiag.editPassword.text()): - showError(db.lastError(), self) - return - - self.lbl.setText("Double-Click on a table-name to view the contents") - self.lv.clear() - - tables = db.tables() - for t in tables: - lvi = TQListViewItem(self.lv, t) - fields = db.recordInfo(t) - for f in fields: - req = "?" - if f.isRequired() > 0: - req = "Yes" - elif f.isRequired() == 0: - req = "No" - fi = TQListViewItem(lvi, f.name(), TQVariant.typeToName(f.type()), req) - lvi.insertItem(fi) - self.lv.insertItem(lvi) - - self.submitBtn.setEnabled(TRUE) - - def execQuery(self): - cursor = CustomSqlCursor(self.te.text(), TRUE, - TQSqlDatabase.database("SqlEx", TRUE)) - if cursor.isSelect(): - self.dt.setSqlCursor(cursor, TRUE, TRUE) - self.dt.refresh() - txt = TQString("Query OK") - if cursor.size() >= 0: - txt.append(", returned rows: %s" % cursor.size()) - self.lbl.setText(txt) - else: - if not cursor.isActive(): - # an error occured - showError(cursor.lastError(), self) - else: - self.lbl.setText("Query OK, affected rows: %s" % - cursor.numRowsAffected()) - - def showTable(self, item): - i = item.parent() - if not i: - i = item - cursor = TQSqlCursor(i.text(0), TRUE, TQSqlDatabase.database("SqlEx", TRUE)) - self.dt.setSqlCursor(cursor, TRUE, TRUE) - self.dt.setSort(cursor.primaryIndex()) - self.dt.refresh(TQDataTable.RefreshAll) - self.lbl.setText("Displaying table %s" % i.text(0)) - - -if __name__ == "__main__": - a = TQApplication(sys.argv) - TQObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()")) - w = MainWindow() - a.setMainWidget(w) - w.show() - a.exec_loop() - diff --git a/examples3/SQL/sqlcustom1.py b/examples3/SQL/sqlcustom1.py deleted file mode 100755 index 4da8f8a..0000000 --- a/examples3/SQL/sqlcustom1.py +++ /dev/null @@ -1,94 +0,0 @@ -#!/usr/bin/env python - -#**************************************************************************** -#** $Id: sqlcustom1.py,v 1.3 2002/07/06 13:35:41 phil Exp $ -#** -#** Copyright (C) 1992-1998 Troll Tech AS. All rights reserved. -#** -#** This file is part of an example program for PyTQt. This example -#** program may be used, distributed and modified without limitation. -#** -#*****************************************************************************/ - -import sys -from python_tqt.qt import * -from python_tqt.qtsql import * - -from dbconnect import createConnection - -TRUE = 1 -FALSE = 0 - -class CustomEdit(TQLineEdit): - def __init__(self, parent = None, name = None): - TQLineEdit.__init__(self, parent, name) - TQObject.connect(self, SIGNAL("textChanged(const TQString &)"), - self.changed) - - def changed(self, line): - self.setUpperLine(line) - - def setUpperLine(self, line): - self.upperLineText = line.upper() - self.setText(self.upperLineText) - - -class FormDialog(TQDialog): - def __init__(self): - TQDialog.__init__(self) - forenameLabel = TQLabel("Forename:", self) - forenameEdit = CustomEdit(self) - surnameLabel = TQLabel("Surname:", self) - surnameEdit = CustomEdit(self) - salaryLabel = TQLabel("Salary:", self) - salaryEdit = TQLineEdit(self) - salaryEdit.setAlignment(TQt.AlignRight) - saveButton = TQPushButton("&Save", self) - self.connect(saveButton, SIGNAL("clicked()"), self.save) - - grid = TQGridLayout(self) - grid.addWidget(forenameLabel, 0, 0) - grid.addWidget(forenameEdit, 0, 1) - grid.addWidget(surnameLabel, 1, 0) - grid.addWidget(surnameEdit, 1, 1) - grid.addWidget(salaryLabel, 2, 0) - grid.addWidget(salaryEdit, 2, 1) - grid.addWidget(saveButton, 3, 0) - grid.activate() - - self.staffCursor = TQSqlCursor("staff") - self.staffCursor.setTrimmed("forename", TRUE) - self.staffCursor.setTrimmed("surname", TRUE) - self.idIndex = self.staffCursor.index("id") - self.staffCursor.select(self.idIndex) - self.staffCursor.first() - - self.propMap = TQSqlPropertyMap() - self.propMap.insert(forenameEdit.className(), "upperLine") - - self.sqlForm = TQSqlForm() - self.sqlForm.setRecord(self.staffCursor.primeUpdate()) - self.sqlForm.installPropertyMap(self.propMap) - self.sqlForm.insert(forenameEdit, "forename") - self.sqlForm.insert(surnameEdit, "surname") - self.sqlForm.insert(salaryEdit, "salary") - self.sqlForm.readFields() - - def save(self): - self.sqlForm.writeFields() - self.staffCursor.update() - self.staffCursor.select(self.idIndex) - self.staffCursor.first() - - -if __name__=='__main__': - app = TQApplication( sys.argv ) - - if createConnection(): - formDialog = FormDialog() - formDialog.show() - - app.setMainWidget(formDialog) - app.exec_loop() - - diff --git a/examples3/SQL/sqlex.ui b/examples3/SQL/sqlex.ui deleted file mode 100644 index 64b3d0f..0000000 --- a/examples3/SQL/sqlex.ui +++ /dev/null @@ -1,303 +0,0 @@ - -SqlEx - - - SqlEx - - - - 0 - 0 - 669 - 438 - - - - SQL Browser - - - - unnamed - - - 11 - - - 6 - - - - Layout23 - - - - unnamed - - - 0 - - - 6 - - - - lbl - - - Press "Connect" to open a database - - - - - conBtn - - - - 0 - 0 - 0 - 0 - - - - - 80 - 0 - - - - &Connect... - - - - - - - vsplit - - - Vertical - - - - hsplit - - - Horizontal - - - - - Tables - - - true - - - true - - - - - Type - - - true - - - true - - - - - Required - - - true - - - true - - - - lv - - - 0 - - - true - - - true - - - LastColumn - - - - - dt - - - false - - - - - - gb - - - SQL Query - - - - unnamed - - - 11 - - - 6 - - - - Layout22 - - - - unnamed - - - 0 - - - 6 - - - - te - - - - - Layout21 - - - - unnamed - - - 0 - - - 6 - - - - Spacer3 - - - Horizontal - - - Expanding - - - - - submitBtn - - - - 5 - 0 - 0 - 0 - - - - - 80 - 0 - - - - &Submit - - - - - clearBtn - - - - 5 - 0 - 0 - 0 - - - - - 80 - 0 - - - - C&lear - - - - - - - - - - - - - - clearBtn - clicked() - te - clear() - - - conBtn - clicked() - SqlEx - dbConnect() - - - lv - returnPressed(TQListViewItem*) - SqlEx - showTable(TQListViewItem*) - - - lv - doubleClicked(TQListViewItem*) - SqlEx - showTable(TQListViewItem*) - - - submitBtn - clicked() - SqlEx - execQuery() - - - - sqlex.ui.h - - - init() - dbConnect() - showTable( TQListViewItem * ) - execQuery() - - - diff --git a/examples3/SQL/sqlex.ui.h b/examples3/SQL/sqlex.ui.h deleted file mode 100644 index 07edcd0..0000000 --- a/examples3/SQL/sqlex.ui.h +++ /dev/null @@ -1,35 +0,0 @@ -/**************************************************************************** -** ui.h extension file, included from the uic-generated form implementation. -** -** If you wish to add, delete or rename slots use TQt Designer which will -** update this file, preserving your code. Create an init() slot in place of -** a constructor, and a destroy() slot in place of a destructor. -*****************************************************************************/ - - -void SqlEx::init() -{ -self.hsplit.setSizes([250]) -self.hsplit.setResizeMode(self.lv, TQSplitter.KeepSize) -self.vsplit.setResizeMode(self.gb, TQSplitter.KeepSize) -self.submitBtn.setEnabled(0) -} - - -void SqlEx::dbConnect() -{ - -} - - -void SqlEx::showTable( TQListViewItem * ) -{ - -} - - - -void SqlEx::execQuery() -{ - -} diff --git a/examples3/SQL/sqlsubclass5.py b/examples3/SQL/sqlsubclass5.py deleted file mode 100755 index 0fdc78c..0000000 --- a/examples3/SQL/sqlsubclass5.py +++ /dev/null @@ -1,151 +0,0 @@ -#!/usr/bin/env python - -#**************************************************************************** -#** $Id: sqlsubclass5.py,v 1.3 2002/07/06 13:35:41 phil Exp $ -#** -#** Copyright (C) 1992-1998 Troll Tech AS. All rights reserved. -#** -#** This file is part of an example program for PyTQt. This example -#** program may be used, distributed and modified without limitation. -#** -#*****************************************************************************/ - -import sys -from python_tqt.qt import * -from python_tqt.qtsql import * - -from dbconnect import createConnection - -TRUE = 1 -FALSE = 0 - -class CustomTable(TQDataTable): - def __init__(self, cursor, autoPopulate = FALSE, parent = None, name = None): - TQDataTable.__init__(self, cursor, autoPopulate, parent, name) - - def paintField(self, p, field, cr, b): - if not field: - return - fn = str(field.name()) - if fn == "pricesid": - query = TQSqlQuery("SELECT name FROM prices WHERE id=%s" % - field.value().toString()) - value = "" - if next(query): - value = query.value(0).toString() - p.drawText(2, 2, cr.width()-4, cr.height()-4, - self.fieldAlignment(field), value) - elif fn == "quantity": - p.drawText(2, 2, cr.width()-6, cr.height()-4, - TQt.AlignRight|TQt.AlignVCenter, field.value().toString()) - elif fn in ("price", "cost"): - v = field.value().toDouble() - if v < 0: - p.setPen(TQColor("red")) - value = TQString("%.2f \u20ac" % v) - p.drawText(2, 2, cr.width()-6, cr.height()-4, - TQt.AlignRight|TQt.AlignVCenter, value) - elif fn == "paiddate": - if field.value().toDate().isNull(): - v = TQString("not yet") - p.setPen(TQColor("red")) - else: - v = field.value().toDate().toString(TQt.LocalDate) - p.drawText(2, 2, cr.width()-4, cr.height()-4, - TQt.AlignHCenter|TQt.AlignVCenter, v) - else: - TQDataTable.paintField(self, p, field, cr, b) - - -class InvoiceItemCursor(TQSqlCursor): - def __init__(self): - TQSqlCursor.__init__(self, "invoiceitem") - - productPrice = TQSqlFieldInfo("price", TQVariant.Double) - self.append(productPrice) - self.setCalculated(productPrice.name(), TRUE) - - productCost = TQSqlFieldInfo("cost", TQVariant.Double) - self.append(productCost) - self.setCalculated(productCost.name(), TRUE) - - def calculateField(self, name): - fn = str(name) - if fn == "productname": - query = TQSqlQuery("SELECT name FROM prices WHERE id=%d;" % - (self.field("pricesid").value().toInt())) - if next(query): - return query.value(0) - elif fn == "price": - query = TQSqlQuery("SELECT price FROM prices WHERE id=%d;" % - (self.field("pricesid").value().toInt())) - if next(query): - return query.value(0) - elif fn == "cost": - query = TQSqlQuery("SELECT price FROM prices WHERE id=%d;" % - (self.field("pricesid").value().toInt())) - if next(query): - return TQVariant(query.value(0).toDouble() * - self.value("quantity").toDouble()) - return TQVariant(TQString.null) - - def primeInsert(self): - buffer = self.editBuffer() - buffer.setValue("id", TQVariant(0)) - buffer.setValue("paiddate", TQVariant(TQDate.currentDate())) - buffer.setValue("quantity", TQVariant(1)) - return buffer - - -class ProductPicker(TQComboBox): - def __init__(self, parent = None, name = None): - TQComboBox.__init__(self, parent, name) - cur = TQSqlCursor("prices") - cur.select(cur.index("id")) - while next(cur): - self.insertItem(cur.value("name").toString(), cur.value("id").toInt()) - - -class CustomSqlEditorFactory(TQSqlEditorFactory): - def __init__(self): - TQSqlEditorFactory.__init__(self) - - def createEditor(self, parent, field): - try: - if str(field.name()) == "pricesid": - return ProductPicker(parent) - except AttributeError: - pass - return TQSqlEditorFactory.createEditor(self, parent, field) - -class Table(CustomTable): - def __init__(self): - self.invoiceItemCursor = InvoiceItemCursor() - TQDataTable.__init__(self, self.invoiceItemCursor) - self.propMap = TQSqlPropertyMap() - self.editorFactory = CustomSqlEditorFactory() - self.propMap.insert("ProductPicker", "pricesid") - self.installPropertyMap(self.propMap) - self.installEditorFactory(self.editorFactory) - - for cn, ch in (("pricesid", "Product"), - ("quantity", "Quantity"), - ("price", "Price" ), - ("cost", "Cost"), - ("paiddate", "Paid")): - self.addColumn(cn, ch) - self.setColumnWidth(0 , 150) - self.setColumnWidth(1, 70) - self.resize(600, 250) - self.refresh() - - -if __name__=='__main__': - app = TQApplication(sys.argv) - if createConnection(): - t = Table() - app.setMainWidget(t) - t.show() - app.exec_loop() - - diff --git a/examples3/SQL/sqltable4.py b/examples3/SQL/sqltable4.py deleted file mode 100755 index a8484c5..0000000 --- a/examples3/SQL/sqltable4.py +++ /dev/null @@ -1,118 +0,0 @@ -#!/usr/bin/env python - -#**************************************************************************** -#** $Id: sqltable4.py,v 1.3 2002/07/06 13:35:41 phil Exp $ -#** -#** Copyright (C) 1992-1998 Troll Tech AS. All rights reserved. -#** -#** This file is part of an example program for PyTQt. This example -#** program may be used, distributed and modified without limitation. -#** -#*****************************************************************************/ - -import sys -from python_tqt.qt import * -from python_tqt.qtsql import * - -from dbconnect import createConnection - -TRUE = 1 -FALSE = 0 - -class CustomTable(TQDataTable): - def __init__(self, cursor, autoPopulate = FALSE, parent = None, name = None): - TQDataTable.__init__(self, cursor, autoPopulate, parent, name) - - def paintField(self, p, field, cr, b): - if not field: - return - fn = str(field.name()) - if fn in ("salary", "monsalary"): - v = field.value().toDouble() - if v < 0: - p.setPen(TQColor("red")) - value = TQString("%.2f \u20ac" % v) - #print unicode(value).encode("iso-8859-15") - p.drawText(2, 2, cr.width()-6, cr.height()-4, - TQt.AlignRight|TQt.AlignVCenter, value) - elif fn == "statusid": - query = TQSqlQuery("SELECT name FROM status WHERE id=%s" % - field.value().toString()) - value = "" - if next(query): - value = query.value(0).toString() - p.drawText(2, 2, cr.width()-4, cr.height()-4, - self.fieldAlignment(field), value) - else: - TQDataTable.paintField(self, p, field, cr, b) - - -class StatusPicker(TQComboBox): - def __init__(self, parent = None, name = None): - TQComboBox.__init__(self, parent, name) - cur = TQSqlCursor("status") - cur.select(cur.index("id")) - while next(cur): - self.insertItem(cur.value("name").toString(), cur.value("id").toInt()) - - -class CustomSqlEditorFactory(TQSqlEditorFactory): - def __init__(self): - TQSqlEditorFactory.__init__(self) - - def createEditor(self, parent, field): - try: - if str(field.name()) == "statusid": - return StatusPicker(parent) - except AttributeError: - pass - return TQSqlEditorFactory.createEditor(self, parent, field) - - -class StaffCursor(TQSqlCursor): - def __init__(self): - TQSqlCursor.__init__(self, "staff") - monSalary = TQSqlFieldInfo("monsalary", TQVariant.Double) - self.append(monSalary) - self.setCalculated(monSalary.name(), TRUE) - - def calculateField(self, name): - if str(name) == "monsalary": - return TQVariant(self.value("salary").toDouble() / 12) - return TQVariant(TQString.null) - - -class Table(CustomTable): - def __init__(self): - #self.staffCursor = TQSqlCursor("staff") - self.staffCursor = StaffCursor() - TQDataTable.__init__(self, self.staffCursor) - self.propMap = TQSqlPropertyMap() - self.editorFactory = CustomSqlEditorFactory() - self.propMap.insert("StatusPicker", "statusid") - self.installPropertyMap(self.propMap) - self.installEditorFactory(self.editorFactory) - for cn, ch in (("forename", "Forename"), - ("surname", "Surname" ), - ("salary", "Annual Salary"), - ("monsalary","Monthly Salary"), - ("statusid", "Status")): - self.addColumn(cn, ch) - self.order = TQStringList("surname") - self.order.append("forename") - self.setSort(self.order) - self.refresh() - - -if __name__=='__main__': - app = TQApplication(sys.argv) - #app.setFont(TQFont("Verdana", 11)) - - if createConnection(): - t = Table() - app.setMainWidget(t) - t.resize(600, 250) - t.show() - app.exec_loop() - - diff --git a/examples3/SQL/testdb_mysql.sql b/examples3/SQL/testdb_mysql.sql deleted file mode 100644 index 144d4c9..0000000 --- a/examples3/SQL/testdb_mysql.sql +++ /dev/null @@ -1,57 +0,0 @@ -drop database testdb; -create database testdb; -use testdb; - -create table people (id integer primary key auto_increment, - name char(40)); - -create table staff (id integer primary key auto_increment, - forename char(40), - surname char(40), - salary float(10,2), - statusid integer); - -create table status (id integer primary key, - name char(30)); - -create table creditors (id integer primary key auto_increment, - forename char(40), - surname char(40), - city char(30)); - -create table prices (id integer primary key, - name char(40), - price float); - -create table invoiceitem (id integer primary key auto_increment, - pricesid integer, - quantity integer, - paiddate date); - -insert into staff (forename, surname, salary, statusid) values - ("Hugo", "Hurtig", 123450.50, 0), - ("Alfred E.", "Neumann", 56780.90, 1), - ("Agate", "Schnell-Fertig", 12340.56, 2), - ("Emil", "Dotterschreck", -5670.23, 3), - ("Eugen", "Nutzlos", -7833.56, 3), - ("Harald", "Schmidt", -150000.0, 3), - ("Urmel", "auf dem Eis", 7778.0, 2); - -insert into status (id, name) values - (0, 'Chief'), - (1, 'Programmer'), - (2, 'Secretary'), - (3, 'Driver'); - -insert into prices (id, name, price) values - (0, "Waschbecken", 150.25), - (1, "Wellensittich", 27.95), - (2, "Roter Papagei", 850.0), - (3, "Spam & Eggs", -7.50), - (4, "Renault Espace", 9000.0), - (5, "Tux, der Pinguin", 65.35), - (6, "Makroskop", 985000.0), - (7, "Regenbaum", 1235.65), - (8, "Bluterguß", 23.95), - (9, "Weltmeisterschaft", 2.95), - (10, "Premiere Dekoder", -185.75); diff --git a/examples3/SQL/testdb_pg.sql b/examples3/SQL/testdb_pg.sql deleted file mode 100644 index 73a4270..0000000 --- a/examples3/SQL/testdb_pg.sql +++ /dev/null @@ -1,232 +0,0 @@ --- --- Selected TOC Entries: --- --- --- TOC Entry ID 1 (OID 0) --- --- Name: testdb Type: DATABASE Owner: postgres --- - -CREATE DATABASE "testdb"; - -\connect testdb postgres --- --- TOC Entry ID 16 (OID 17332) --- --- Name: people Type: TABLE Owner: postgres --- - -CREATE TABLE "people" ( - "id" integer DEFAULT nextval('people_id_seq'::text) NOT NULL, - "name" character(40), - Constraint "people_pkey" Primary Key ("id") -); - --- --- TOC Entry ID 17 (OID 17335) --- --- Name: staff Type: TABLE Owner: postgres --- - -CREATE TABLE "staff" ( - "id" integer DEFAULT nextval('staff_id_seq'::text) NOT NULL, - "forename" character(40), - "surname" character(40), - "salary" money, - "statusid" integer, - Constraint "staff_pkey" Primary Key ("id") -); - --- --- TOC Entry ID 18 (OID 17338) --- --- Name: status Type: TABLE Owner: postgres --- - -CREATE TABLE "status" ( - "id" integer NOT NULL, - "name" character(30), - Constraint "status_pkey" Primary Key ("id") -); - --- --- TOC Entry ID 19 (OID 17341) --- --- Name: creditors Type: TABLE Owner: postgres --- - -CREATE TABLE "creditors" ( - "id" integer DEFAULT nextval('creditors_id_seq'::text) NOT NULL, - "forename" character(40), - "surname" character(40), - "city" character(30), - Constraint "creditors_pkey" Primary Key ("id") -); - --- --- TOC Entry ID 20 (OID 17344) --- --- Name: prices Type: TABLE Owner: postgres --- - -CREATE TABLE "prices" ( - "id" integer NOT NULL, - "name" character(40), - "price" real, - Constraint "prices_pkey" Primary Key ("id") -); - --- --- TOC Entry ID 21 (OID 17347) --- --- Name: invoiceitem Type: TABLE Owner: postgres --- - -CREATE TABLE "invoiceitem" ( - "id" integer DEFAULT nextval('invoice_id_seq'::text) NOT NULL, - "pricesid" integer, - "quantity" integer, - "paiddate" date, - Constraint "invoiceitem_pkey" Primary Key ("id") -); - --- --- TOC Entry ID 2 (OID 17351) --- --- Name: people_id_seq Type: SEQUENCE Owner: postgres --- - -CREATE SEQUENCE "people_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1; - --- --- TOC Entry ID 4 (OID 17353) --- --- Name: staff_id_seq Type: SEQUENCE Owner: postgres --- - -CREATE SEQUENCE "staff_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1; - --- --- TOC Entry ID 6 (OID 17355) --- --- Name: creditors_id_seq Type: SEQUENCE Owner: postgres --- - -CREATE SEQUENCE "creditors_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1; - --- --- TOC Entry ID 8 (OID 17357) --- --- Name: invoice_id_seq Type: SEQUENCE Owner: postgres --- - -CREATE SEQUENCE "invoice_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1; - --- --- Data for TOC Entry ID 28 (OID 17332) --- --- Name: people Type: TABLE DATA Owner: postgres --- - - -COPY "people" FROM stdin; -\. --- --- Data for TOC Entry ID 29 (OID 17335) --- --- Name: staff Type: TABLE DATA Owner: postgres --- - - -COPY "staff" FROM stdin; -1 Hugo Hurtig $123,450.50 0 -2 Alfred E. Neumann $56,780.90 1 -3 Agate Schnell-Fertig $12,340.56 2 -6 Eugen Nutzlos -$7,833.56 3 -7 Harald Schmidt -$150,000.00 3 -4 Urmel auf dem Eis $7,778.00 2 -5 Emil Dotterschreck -$5,670.23 3 -\. --- --- Data for TOC Entry ID 30 (OID 17338) --- --- Name: status Type: TABLE DATA Owner: postgres --- - - -COPY "status" FROM stdin; -0 Chief -1 Programmer -2 Secretary -3 Driver -\. --- --- Data for TOC Entry ID 31 (OID 17341) --- --- Name: creditors Type: TABLE DATA Owner: postgres --- - - -COPY "creditors" FROM stdin; -\. --- --- Data for TOC Entry ID 32 (OID 17344) --- --- Name: prices Type: TABLE DATA Owner: postgres --- - - -COPY "prices" FROM stdin; -0 Waschbecken 150.25 -1 Wellensittich 27.95 -2 Roter Papagei 850 -3 Spam & Eggs -7.5 -4 Renault Espace 9000 -5 Tux, der Pinguin 65.35 -6 Makroskop 985000 -7 Regenbaum 1235.65 -8 Bluterguß 23.95 -9 Weltmeisterschaft 2.95 -10 Premiere Dekoder -185.75 -\. --- --- Data for TOC Entry ID 33 (OID 17347) --- --- Name: invoiceitem Type: TABLE DATA Owner: postgres --- - - -COPY "invoiceitem" FROM stdin; -\. --- --- TOC Entry ID 3 (OID 17351) --- --- Name: people_id_seq Type: SEQUENCE SET Owner: postgres --- - -SELECT setval ('"people_id_seq"', 1, false); - --- --- TOC Entry ID 5 (OID 17353) --- --- Name: staff_id_seq Type: SEQUENCE SET Owner: postgres --- - -SELECT setval ('"staff_id_seq"', 8, true); - --- --- TOC Entry ID 7 (OID 17355) --- --- Name: creditors_id_seq Type: SEQUENCE SET Owner: postgres --- - -SELECT setval ('"creditors_id_seq"', 1, false); - --- --- TOC Entry ID 9 (OID 17357) --- --- Name: invoice_id_seq Type: SEQUENCE SET Owner: postgres --- - -SELECT setval ('"invoice_id_seq"', 1, false); - diff --git a/examples3/aclock.py b/examples3/aclock.py deleted file mode 100755 index 66283ef..0000000 --- a/examples3/aclock.py +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env python - -import sys -from python_tqt.qt import * - -def TQMIN(x, y): - if y > x: return y - return x -class AnalogClock(TQWidget): - def __init__(self, *args): - TQWidget.__init__(*(self,) + args) - self.time = TQTime.currentTime() - internalTimer = TQTimer(self) - self.connect(internalTimer, SIGNAL("timeout()"), self.timeout) - internalTimer.start(5000) - - def timeout(self): - new_time = TQTime.currentTime() - if new_time.minute() != self.time.minute(): - self.update() - - def paintEvent(self, qe): - if not self.isVisible(): - return - self.time = TQTime.currentTime() - - pts = TQPointArray() - paint = TQPainter(self) - paint.setBrush(self.foregroundColor()) - - cp = TQPoint(self.rect().center()) - d = TQMIN(self.width(), self.height()) - matrix = TQWMatrix() - matrix.translate(cp.x(), cp.y()) - matrix.scale(d/1000.0, d/1000.0) - - h_angle = 30*(self.time.hour()%12 - 3) + self.time.minute()/2 - matrix.rotate(h_angle) - paint.setWorldMatrix(matrix) - pts.setPoints([-20,0,0,-20,300,0,0,20]) - paint.drawPolygon(pts) - matrix.rotate(-h_angle) - - m_angle = (self.time.minute()-15)*6 - matrix.rotate(m_angle) - paint.setWorldMatrix(matrix) - pts.setPoints([-10,0,0,-10,400,0,0,10]) - paint.drawPolygon(pts) - matrix.rotate(-m_angle) - - for i in range(0,12): - paint.setWorldMatrix(matrix) - paint.drawLine(450,0, 500,0) - matrix.rotate(30) - -a = TQApplication(sys.argv) -clock = AnalogClock() -clock.resize(100,100) -a.setMainWidget(clock) -clock.show() -a.exec_loop() diff --git a/examples3/addressbook.py b/examples3/addressbook.py deleted file mode 100755 index 14b5679..0000000 --- a/examples3/addressbook.py +++ /dev/null @@ -1,457 +0,0 @@ -#!/usr/bin/env python - -# A port to PyTQt of the application example from TQt v2.x. - - -import sys, string -from python_tqt.qt import * - -TRUE = 1 -FALSE = 0 -fileopen = [ -' 16 13 5 1', -'. c #040404', -'# c #808304', -'a c None', -'b c #f3f704', -'c c #f3f7f3', -'aaaaaaaaa...aaaa', -'aaaaaaaa.aaa.a.a', -'aaaaaaaaaaaaa..a', -'a...aaaaaaaa...a', -'.bcb.......aaaaa', -'.cbcbcbcbc.aaaaa', -'.bcbcbcbcb.aaaaa', -'.cbcb...........', -'.bcb.#########.a', -'.cb.#########.aa', -'.b.#########.aaa', -'..#########.aaaa', -'...........aaaaa' -] - -filesave = [ -' 14 14 4 1', -'. c #040404', -'# c #808304', -'a c #bfc2bf', -'b c None', -'..............', -'.#.aaaaaaaa.a.', -'.#.aaaaaaaa...', -'.#.aaaaaaaa.#.', -'.#.aaaaaaaa.#.', -'.#.aaaaaaaa.#.', -'.#.aaaaaaaa.#.', -'.##........##.', -'.############.', -'.##.........#.', -'.##......aa.#.', -'.##......aa.#.', -'.##......aa.#.', -'b.............' -] - -fileprint = [ -' 16 14 6 1', -'. c #000000', -'# c #848284', -'a c #c6c3c6', -'b c #ffff00', -'c c #ffffff', -'d c None', -'ddddd.........dd', -'dddd.cccccccc.dd', -'dddd.c.....c.ddd', -'ddd.cccccccc.ddd', -'ddd.c.....c....d', -'dd.cccccccc.a.a.', -'d..........a.a..', -'.aaaaaaaaaa.a.a.', -'.............aa.', -'.aaaaaa###aa.a.d', -'.aaaaaabbbaa...d', -'.............a.d', -'d.aaaaaaaaa.a.dd', -'dd...........ddd' -] - -class ABCentralWidget( TQWidget ): - def __init__( self, *args ): - TQWidget.__init__(*(self, ) + args) - self.mainGrid = TQGridLayout( self, 2, 1, 5, 5 ) - - self.setupTabWidget() - self.setupListView() - - self.mainGrid.setRowStretch( 0, 0 ) - self.mainGrid.setRowStretch( 1, 1 ) - - def save( self, filename ): - if not self.listView.firstChild(): - return - - f = TQFile( filename ) - if not f.open( IO_WriteOnly ): - return - - t = TQTextStream( f ) - - #it = TQListViewItemIterator( self.listView ) - - while not t.eof(): - item = TQListViewItem( self.listView ) - for i in range (0, 4): - t << item.text( i ) << '\n' - #for it in it.current(): - #for i in range (0, 4): - #t << it.current().text[ i ] << "\n" - - f.close() - - - def load( self, filename ): - self.listView.clear() - - f = TQFile( filename ) - if not f.open( IO_ReadOnly ): - return - - t = TQTextStream( f ) - - while not t.eof(): - item = TQListViewItem( self.listView ) - for i in range (0, 4): - item.setText( i, t.readLine() ) - - f.close(); - - - def setupTabWidget( self ): - self.tabWidget = TQTabWidget( self ) - - self.input = TQWidget( self.tabWidget ) - self.grid1 = TQGridLayout( self.input, 2, 5, 5, 5 ) - - self.liFirstName = TQLabel( 'First &Name', self.input ) - self.liFirstName.resize( self.liFirstName.sizeHint() ) - self.grid1.addWidget( self.liFirstName, 0, 0 ) - - self.liLastName = TQLabel( '&Last Name', self.input ) - self.liLastName.resize( self.liLastName.sizeHint() ) - self.grid1.addWidget( self.liLastName, 0, 1 ) - - self.liAddress = TQLabel( '&Address', self.input ) - self.liAddress.resize( self.liAddress.sizeHint() ) - self.grid1.addWidget( self.liAddress, 0, 2 ) - - self.liEMail = TQLabel( '&E-Mail', self.input ) - self.liEMail.resize( self.liEMail.sizeHint() ) - self.grid1.addWidget( self.liEMail, 0, 3 ) - - self.add = TQPushButton( '&Add', self.input ) - self.add.resize( self.add.sizeHint() ) - self.grid1.addWidget( self.add, 0, 4 ) - self.connect( self.add, SIGNAL( 'clicked()' ), self.addEntry ) - - self.iFirstName = TQLineEdit( self.input ) - self.iFirstName.resize( self.iFirstName.sizeHint() ) - self.grid1.addWidget( self.iFirstName, 1, 0 ) - self.liFirstName.setBuddy( self.iFirstName ) - - self.iLastName = TQLineEdit( self.input ) - self.iLastName.resize( self.iLastName.sizeHint() ) - self.grid1.addWidget( self.iLastName, 1, 1 ) - self.liLastName.setBuddy( self.iLastName ) - - self.iAddress = TQLineEdit( self.input ) - self.iAddress.resize( self.iAddress.sizeHint() ) - self.grid1.addWidget( self.iAddress, 1, 2 ) - self.liAddress.setBuddy( self.iAddress ) - - self.iEMail = TQLineEdit( self.input ) - self.iEMail.resize( self.iEMail.sizeHint() ) - self.grid1.addWidget( self.iEMail, 1, 3 ) - self.liEMail.setBuddy( self.iEMail ) - - self.change = TQPushButton( '&Change', self.input ) - self.change.resize( self.change.sizeHint() ) - self.grid1.addWidget( self.change, 1, 4 ) - self.connect( self.change, SIGNAL( 'clicked()' ), self.changeEntry ) - - self.tabWidget.addTab( self.input, '&Add/Change Entry' ) - - # -------------------------------------- - - self.search = TQWidget( self ) - self.grid2 = TQGridLayout( self.search, 2, 5, 5, 5 ) - - self.cFirstName = TQCheckBox( 'First &Name', self.search ) - self.cFirstName.resize( self.cFirstName.sizeHint() ) - self.grid2.addWidget( self.cFirstName, 0, 0 ) - self.connect( self.cFirstName, SIGNAL( 'clicked()' ), self.toggleFirstName ) - - self.cLastName = TQCheckBox( '&Last Name', self.search ) - self.cLastName.resize( self.cLastName.sizeHint() ) - self.grid2.addWidget( self.cLastName, 0, 1 ) - self.connect( self.cLastName, SIGNAL( 'clicked()' ), self.toggleLastName ) - - self.cAddress = TQCheckBox( '&Address', self.search ) - self.cAddress.resize( self.cAddress.sizeHint() ) - self.grid2.addWidget( self.cAddress, 0, 2 ) - self.connect( self.cAddress, SIGNAL( 'clicked()' ), self.toggleAddress ) - - self.cEMail = TQCheckBox( '&E-Mail', self.search ) - self.cEMail.resize( self.cEMail.sizeHint() ) - self.grid2.addWidget( self.cEMail, 0, 3 ) - self.connect( self.cEMail, SIGNAL( 'clicked()' ), self.toggleEMail ) - - self.sFirstName = TQLineEdit( self.search ) - self.sFirstName.resize( self.sFirstName.sizeHint() ) - self.grid2.addWidget( self.sFirstName, 1, 0 ) - - self.sLastName = TQLineEdit( self.search ) - self.sLastName.resize( self.sLastName.sizeHint() ) - self.grid2.addWidget( self.sLastName, 1, 1 ) - - self.sAddress = TQLineEdit( self.search ) - self.sAddress.resize( self.sAddress.sizeHint() ) - self.grid2.addWidget( self.sAddress, 1, 2 ) - - self.sEMail = TQLineEdit( self.search ) - self.sEMail.resize( self.sEMail.sizeHint() ) - self.grid2.addWidget( self.sEMail, 1, 3 ) - - self.find = TQPushButton( '&Find', self.search ) - self.find.resize( self.find.sizeHint() ) - self.grid2.addWidget( self.find, 1, 4 ) - self.connect( self.find, SIGNAL( 'clicked()' ), self.findEntries ) - - self.cFirstName.setChecked( TRUE ) - self.sFirstName.setEnabled( TRUE ) - self.sLastName.setEnabled( FALSE ) - self.sAddress.setEnabled( FALSE ) - self.sEMail.setEnabled( FALSE ) - - self.tabWidget.addTab( self.search, "&Search" ) - - self.mainGrid.addWidget( self.tabWidget, 0, 0 ) - - def setupListView( self ): - self.listView = TQListView( self ) - self.listView.addColumn( 'First Name' ) - self.listView.addColumn( 'Last Name' ) - self.listView.addColumn( 'Address' ) - self.listView.addColumn( 'E-Mail' ) - - self.listView.setSelectionMode( TQListView.Extended ) - - self.connect( self.listView, SIGNAL( 'clicked( TQListViewItem* )' ), self.itemSelected ) - - self.mainGrid.addWidget( self.listView, 1, 0 ) - self.listView.setAllColumnsShowFocus( TRUE ) - - - def addEntry( self ): - if not self.iFirstName.text().isEmpty() or not self.iLastName.text().isEmpty() or \ - not self.iAddress.text().isEmpty() or not self.iEMail.text().isEmpty() : - self.item = TQListViewItem( self.listView ) - self.item.setText( 0, self.iFirstName.text() ) - self.item.setText( 1, self.iLastName.text() ) - self.item.setText( 2, self.iAddress.text() ) - self.item.setText( 3, self.iEMail.text() ) - - self.iFirstName.setText( '' ) - self.iLastName.setText( '' ) - self.iAddress.setText( '' ) - self.iEMail.setText( '' ) - - def changeEntry( self ): - self.item = self.listView.currentItem() - if self.item and ( not self.iFirstName.text().isEmpty() or not self.iLastName.text().isEmpty() or \ - not self.iAddress.text().isEmpty() or not self.iEMail.text().isEmpty() ) : - self.item.setText( 0, self.iFirstName.text() ) - self.item.setText( 1, self.iLastName.text() ) - self.item.setText( 2, self.iAddress.text() ) - self.item.setText( 3, self.iEMail.text() ) - - def selectionChanged( self ): - self.iFirstName.setText( '' ) - self.iLastName.setText( '' ) - self.iAddress.setText( '' ) - self.iEMail.setText( '' ) - - def itemSelected( self, item ): - self.item.setSelected( TRUE ) - self.item.repaint() - - self.iFirstName.setText( item.text( 0 ) ) - self.iLastName.setText( item.text( 1 ) ) - self.iAddress.setText( item.text( 2 ) ) - self.iEMail.setText( item.text( 3 ) ) - - def toggleFirstName( self ): - self.sFirstName.setText( '' ) - if self.cFirstName.isChecked(): - self.sFirstName.setEnabled( TRUE ) - self.sFirstName.setFocus() - else: - self.sFirstName.setEnabled( FALSE ) - - def toggleLastName( self ): - self.sLastName.setText( '' ) - if self.cLastName.isChecked(): - self.sLastName.setEnabled( TRUE ) - self.sLastName.setFocus() - else: - self.sLastName.setEnabled( FALSE ) - - - def toggleAddress( self ): - self.sAddress.setText( '' ) - if self.cAddress.isChecked(): - self.sAddress.setEnabled( TRUE ) - self.sAddress.setFocus() - else: - self.sAddress.setEnabled( FALSE ) - - - def toggleEMail( self ): - self.sEMail.setText( '' ) - if self.cEMail.isChecked(): - self.sEMail.setEnabled( TRUE ) - self.sEMail.setFocus() - - else: - self.sEMail.setEnabled( FALSE ) - - - def findEntries( self ): - if not self.cFirstName.isChecked() and not self.cLastName.isChecked() and \ - not self.cAddress.isChecked() and not self.cEMail.isChecked(): - self.listView.clearSelection() - return - - it = TQListViewItemIterator( self.listView ) - - for it in it.current() : - select = TRUE - - if self.cFirstName.isChecked(): - if select and it.current().text( 0 ).contains( self.sFirstName.text() ): - select = TRUE - else: - select = FALSE - - if self.cLastName.isChecked(): - if select and it.current().text( 1 ).contains( self.sLastName.text() ): - select = TRUE - else: - select = FALSE - - if self.cAddress.isChecked(): - if select and it.current().text( 2 ).contains( self.sAddress.text() ): - select = TRUE - else: - select = FALSE - - if self.cEMail.isChecked(): - if select and it.current().text( 3 ).contains( self.sEMail.text() ): - select = TRUE - else: - select = FALSE - - - if select: - it.current().setSelected( TRUE ) - else: - it.current().setSelected( FALSE ) - it.current().repaint() - - -class ABMainWindow(TQMainWindow): - def __init__( self ): - TQMainWindow.__init__( self, None, 'example addressbook application' ) - - self.filename = TQString.null - self.setupMenuBar() - self.setupFileTools() - self.setupStatusBar() - self.setupCentralWidget() - - def setupMenuBar( self ): - self.file = TQPopupMenu( self ) - self.menuBar().insertItem( '&File', self.file ) - - openIcon = TQIconSet( TQPixmap( fileopen ) ) - self.file.insertItem( 'New', self.fileNew, TQt.CTRL + TQt.Key_N ) - self.file.insertItem( openIcon, 'Open', self.fileOpen, TQt.CTRL + TQt.Key_O ) - self.file.insertSeparator() - saveIcon = TQIconSet( TQPixmap( filesave ) ) - self.file.insertItem( saveIcon, 'Save', self.fileSave, TQt.CTRL + TQt.Key_S ) - self.file.insertItem( 'Save As...', self.fileSaveAs ) - self.file.insertSeparator() - printIcon = TQIconSet( TQPixmap( fileprint ) ) - self.file.insertItem( printIcon, 'Print...', self.filePrint, TQt.CTRL + TQt.Key_P ) - self.file.insertSeparator() - #self.file.insertItem( 'Close', self.closeWindow, TQt.CTRL + TQt.Key_W ) - self.file.insertItem('Close', self, SLOT('close()'), TQt.CTRL+TQt.Key_W) - self.file.insertItem( 'Quit', tqApp, SLOT( 'quit()' ), TQt.CTRL + TQt.Key_Q ) - - def setupFileTools( self ): - pass - #self.fileTools = TQToolBar( self, 'file operations' ) - - def setupStatusBar( self ): - self.statusBar().message( "Ready", 2000 ) - - def setupCentralWidget( self ): - self.view = ABCentralWidget( self ) - #self.view.show() - self.setCentralWidget( self.view ) - - def closeWindow( self ): - close() - - - def fileNew( self ): - pass - - def fileOpen( self ): - fn = TQFileDialog.getOpenFileName( TQString.null, TQString.null, self ) - if not fn.isEmpty(): - self.filename = fn - self.view.load( self.filename ) - - def fileSave( self ): - if self.filename.isEmpty(): - self.fileSaveAs() - return - - self.view.save( self.filename ) - - def fileSaveAs( self ): - fn = TQFileDialog.getSaveFileName( TQString.null, TQString.null, self ) - if not fn.isEmpty(): - self.filename = fn - self.fileSave - - def filePrint( self ): - pass - - -a = TQApplication( sys.argv ) - -mw = ABMainWindow() -#mw.setupMenuBar() -#mw.setupFileTools -#mw.setupStatusBar -#mw.setupCentralWidget -#view = ABCentralWidget() -#mw.setCentralWidget( view ) -mw.setCaption( 'Addressbook 1' ) -a.setMainWidget( mw ) -mw.show() - -a.connect( a, SIGNAL( 'lastWindowClosed()' ), a, SLOT( 'quit()' ) ) -a.exec_loop() diff --git a/examples3/application.py b/examples3/application.py deleted file mode 100755 index 056e895..0000000 --- a/examples3/application.py +++ /dev/null @@ -1,277 +0,0 @@ -#!/usr/bin/env python - -# A simple application. - - -import sys, string -from python_tqt.qt import * - - -fileopen = [ - '16 13 5 1', - '. c #040404', - '# c #808304', - 'a c None', - 'b c #f3f704', - 'c c #f3f7f3', - 'aaaaaaaaa...aaaa', - 'aaaaaaaa.aaa.a.a', - 'aaaaaaaaaaaaa..a', - 'a...aaaaaaaa...a', - '.bcb.......aaaaa', - '.cbcbcbcbc.aaaaa', - '.bcbcbcbcb.aaaaa', - '.cbcb...........', - '.bcb.#########.a', - '.cb.#########.aa', - '.b.#########.aaa', - '..#########.aaaa', - '...........aaaaa' -] - -filesave = [ - '14 14 4 1', - '. c #040404', - '# c #808304', - 'a c #bfc2bf', - 'b c None', - '..............', - '.#.aaaaaaaa.a.', - '.#.aaaaaaaa...', - '.#.aaaaaaaa.#.', - '.#.aaaaaaaa.#.', - '.#.aaaaaaaa.#.', - '.#.aaaaaaaa.#.', - '.##........##.', - '.############.', - '.##.........#.', - '.##......aa.#.', - '.##......aa.#.', - '.##......aa.#.', - 'b.............' -] - -fileprint = [ - '16 14 6 1', - '. c #000000', - '# c #848284', - 'a c #c6c3c6', - 'b c #ffff00', - 'c c #ffffff', - 'd c None', - 'ddddd.........dd', - 'dddd.cccccccc.dd', - 'dddd.c.....c.ddd', - 'ddd.cccccccc.ddd', - 'ddd.c.....c....d', - 'dd.cccccccc.a.a.', - 'd..........a.a..', - '.aaaaaaaaaa.a.a.', - '.............aa.', - '.aaaaaa###aa.a.d', - '.aaaaaabbbaa...d', - '.............a.d', - 'd.aaaaaaaaa.a.dd', - 'dd...........ddd' -] - - -fileOpenText = \ -''' -Click this button to open a new file.

-You can also select the Open command from the File menu.''' - -fileSaveText = \ -'''Click this button to save the file you are editing.

-You will be prompted for a filename.

-You can also select the Save command from the File menu.''' - -filePrintText = \ -'''Click this button to print the file you are editing.

-You can also select the Print command from the File menu.''' - - -editorList = [] - - -class ApplicationWindow(TQMainWindow): - def __init__(self): - TQMainWindow.__init__(self,None,'example application main window',TQt.WDestructiveClose) - - self.filename = TQString.null - self.printer = TQPrinter() - - self.fileTools = TQToolBar(self,'file operations') - - openIcon = TQPixmap(fileopen) - self.fileOpen = TQToolButton(TQIconSet(openIcon),'Open File',TQString.null,self.load,self.fileTools,'open file') - - saveIcon = TQPixmap(filesave) - self.fileSave = TQToolButton(TQIconSet(saveIcon),'Save File',TQString.null,self.save,self.fileTools,'save file') - - printIcon = TQPixmap(fileprint) - self.filePrint = TQToolButton(TQIconSet(printIcon),'Print File',TQString.null,self.printDoc,self.fileTools,'print file') - - TQWhatsThis.whatsThisButton(self.fileTools) - - TQWhatsThis.add(self.fileOpen,fileOpenText) - TQMimeSourceFactory.defaultFactory().setPixmap('fileopen',openIcon) - TQWhatsThis.add(self.fileSave,fileSaveText) - TQWhatsThis.add(self.filePrint,filePrintText) - - self.file = TQPopupMenu(self) - self.menuBar().insertItem('&File',self.file) - - self.file.insertItem('&New',self.newDoc,TQt.CTRL + TQt.Key_N) - - id = self.file.insertItem(TQIconSet(openIcon),'&Open',self.load,TQt.CTRL + TQt.Key_O) - self.file.setWhatsThis(id,fileOpenText) - - id = self.file.insertItem(TQIconSet(saveIcon),'&Save',self.save,TQt.CTRL + TQt.Key_S) - self.file.setWhatsThis(id,fileSaveText) - - id = self.file.insertItem('Save &as',self.saveAs) - self.file.setWhatsThis(id,fileSaveText) - - self.file.insertSeparator() - - id = self.file.insertItem(TQIconSet(printIcon),'&Print',self.printDoc,TQt.CTRL + TQt.Key_P) - self.file.setWhatsThis(id,filePrintText) - - self.file.insertSeparator() - - self.file.insertItem('&Close',self,SLOT('close()'),TQt.CTRL + TQt.Key_W) - self.file.insertItem('&Quit',tqApp,SLOT('closeAllWindows()'),TQt.CTRL + TQt.Key_Q) - - self.help = TQPopupMenu(self) - self.menuBar().insertSeparator() - self.menuBar().insertItem('&Help',self.help) - - self.help.insertItem('&About',self.about,TQt.Key_F1) - self.help.insertItem('About &TQt',self.aboutTQt) - - self.e = TQMultiLineEdit(self,'editor') - self.e.setFocus() - self.setCentralWidget(self.e) - - self.statusBar().message('Ready',2000) - self.resize(450,600) - - def newDoc(self): - ed = ApplicationWindow() - ed.show() - editorList.append(ed) - - def load(self): - fn = TQFileDialog.getOpenFileName(TQString.null,TQString.null,self) - if fn.isEmpty(): - self.statusBar().message('Loading aborted',2000) - return - - fileName = str(fn) - - self.e.setAutoUpdate(0) - self.e.clear() - - try: - f = open(fileName,'r') - except: - return - - for l in f.readlines(): - self.e.append(l.rstrip()) - - f.close() - - self.e.setAutoUpdate(1) - self.e.repaint() - self.e.setEdited(0) - self.setCaption(fileName) - self.statusBar().message('Loaded document %s' % (fileName),2000) - - def save(self): - if self.filename.isEmpty(): - self.saveAs() - return - - try: - f = open(str(self.filename),'w+') - except: - self.statusBar().message('Could not write to %s' % (self.filename),2000) - return - - f.write(str(self.e.text())) - f.close() - - self.e.setEdited(0) - self.setCaption(self.filename) - self.statusBar().message('File %s saved' % (self.filename),2000) - - def saveAs(self): - fn = TQFileDialog.getSaveFileName(TQString.null,TQString.null,self) - if not fn.isEmpty(): - self.filename = fn - self.save() - else: - self.statusBar().message('Saving aborted',2000) - - def printDoc(self): - Margin = 10 - pageNo = 1 - - if self.printer.setup(self): - self.statusBar().message('Printing...') - - p = TQPainter() - p.begin(self.printer) - p.setFont(self.e.font()) - yPos = 0 - fm = p.fontMetrics() - metrics = TQPaintDeviceMetrics(self.printer) - - for i in range(self.e.numLines): - if Margin + yPos > metrics.height() - Margin: - pageNo = pageNo + 1 - self.statusBar().message('Printing (page %d)...' % (pageNo)) - self.printer.newPage() - yPos = 0 - - p.drawText(Margin,Margin + yPos,metrics.width(),fm.lineSpacing(),TQt.ExpandTabs | TQt.DontClip,self.e.textLine(i)) - yPos = yPos + fm.lineSpacing() - - p.end() - self.statusBar().message('Printing completed',2000) - else: - self.statusBar().message('Printing aborted',2000) - - def closeEvent(self,ce): - if not self.e.edited(): - ce.accept() - return - - rc = TQMessageBox.information(self,'TQt Application Example', - 'The document has been changed since the last save.', - 'Save Now','Cancel','Leave Anyway',0,1) - - if rc == 0: - self.save() - ce.accept() - elif rc == 2: - ce.accept() - else: - ce.ignore() - - def about(self): - TQMessageBox.about(self,'TQt Application Example', - 'This example demonstrates simple use of TQMainWindow,\nTQMenuBar and TQToolBar.') - - def aboutTQt(self): - TQMessageBox.aboutTQt(self,'TQt Application Example') - - -a = TQApplication(sys.argv) -mw = ApplicationWindow() -mw.setCaption('Document 1') -mw.show() -a.connect(a, SIGNAL('lastWindowClosed()'), a, SLOT('quit()')) -a.exec_loop() diff --git a/examples3/biff.py b/examples3/biff.py deleted file mode 100755 index abee0cf..0000000 --- a/examples3/biff.py +++ /dev/null @@ -1,173 +0,0 @@ -#!/usr/bin/env python - -import os, sys, string -from python_tqt.qt import * - - -if TQT_VERSION < 0x030100: - print("This example requires TQt v3.1.0 or later.") - sys.exit(1) - - -FALSE = 0 -TRUE = 1 - -hasmail_bmp_data = [ -"48 48 3 1", -" c None", -". c #000000", -"+ c #FFFFFF", -"................................................", -".............................++++++++++.........", -".............................++++++++++.........", -"........................++++.+++.+.+.++.........", -"......................++++.++++.+.+.+++.........", -".....................+++.....+++.+.+.++.........", -"....................++.......++.+.+.+++.........", -"...................++........++++++++++.........", -"..................++.........++++++++++.........", -".................++..........+++..+.............", -"................++...........+++..+.............", -"...............++............+++.++.............", -"..............+++++++........++++++.............", -".............++++++++++......++++++.............", -"............+++......+++.....++++.+.............", -"...........+++.........++....+++..+.............", -"...........++..........++...++++..+.............", -"..........++............++.+++++..+.............", -"..........++............++++++++..+.............", -".........++....++++++....+++.+++..+.............", -".........++......++......++..+++..+.............", -".........++..............++..+++..+.............", -".........++..............++..+++..+.............", -".........++..............++..++...+.............", -"+++++++..++.+.+..+..+.+..++.......+..+++++++++++", -".........++.+++.+.+.+.+..++.......+.............", -".........++.+.+.+++.+.+..++.......+.............", -".........++.+.+.+.+.+.+..++......++.............", -".........++.+.+.+.+.+.++.++.....++..............", -".........++..............++....++...............", -"..+.+.+..++..............++...++..+.+.+.+.+.+.+.", -".+.+.+.+.++..............++..++..+.+.+.+.+.+.+..", -"..+.+.+..++..............++.++..+.+.+.+.+.+.+.+.", -".+.+.+.+.++..............+++++.+.+.+.+.+.+.+.+..", -"..+.+.+..+++++++++++++++++++.++.+.+.+.+.+.+.+.+.", -".+.+.+.+..+++++++++++++++++..+.+.+.+.+.+.+.+.+..", -"..+.+.+.+..........+...+.....++.+.+.+.+.+.+.+.+.", -".+.+.+.+.+.+.+.+.+.+...+.....+.+.+.+.+.+.+.+.+..", -"..+.+.+.+.+.+.+.+.++...+.....++.+.+.+.+.+.+.+.+.", -".+.+.+.+.+.+.+.+.+.+...+.....+.+.+.+.+.+.+.+.+..", -"..+.+.+.+.+.+.+.+.++...+.....++.+.+.+.+.+.+.+.+.", -".+.+.+.+.+.+.+.+.+.+...+.....+.+.+.+.+.+.+.+.+..", -"..+.+.+.+.+.+.+.+.++...+....+.+.+.+.+.+.+.+.+.+.", -".+.+.+.+.+.+.+.+.+.+...+...+.+.+.+.+.+.+.+.+.+..", -"..+.+.+.+.+.+.+.+.+.+..+..+.+.+.+.+.+.+.+.+.+.+.", -".+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+..", -"..+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+...", -"................................................" -] - -nomail_bmp_data = [ -"48 48 3 1", -" c None", -". c #FFFFFF", -"+ c #000000", -"................................................", -"................................................", -"................................................", -".........................++++...................", -".......................++++++++.................", -".....................++++....+++................", -"....................+++........++...............", -"...................++...........++..............", -"..................++............++..............", -".................++..............++.......+.....", -"................++...............++......++.....", -"...............++................++.....+++.....", -"..............+++++++...........+++....++++.....", -".............++++++++++........++++...+++++.....", -"............+++......+++......+++.+..++++++.....", -"...........+++.........++....+++..+.+++.+++.....", -"...........++..........++...+++...++++..+++.....", -"..........++............++.+++...++++...++......", -"..........++............+++++...++++............", -".........++....++++++....+++...++++.............", -".........++......++......++...+++.+.............", -".........++..............++...+++.+.............", -".........++..............++...++..+.............", -".........++..............++.......+.............", -"+++++++..++..............++.......+..+++++++++++", -".........++..............++.......+.............", -".........++..............++.......+.............", -".........++..............++......++.............", -".........++..............++.....++..............", -".........++..............++....++...............", -".........++..............++...++................", -".........++..............++..++.................", -".........++..............++.++..................", -".........++..............+++++..................", -".........+++++++++++++++++++.+..................", -"..........+++++++++++++++++..+..................", -"...................+...+.....+..................", -"...................+...+.....+..................", -"...................+...+.....+..................", -"...................+...+.....+..................", -"...................+...+.....+..................", -"...................+...+.....+..................", -"...................+...+.....+..................", -"...................+...+.....+..................", -"+++.++++++++++.+.+++...+..+++++++++++.++...+++++", -"+.+++..+++.+.+++++.++..+.++.+++..+..+.++.+.++++.", -".++...+.....++...+...+++++++....+....++++++...+.", -"++++++++++++++++++++++++++++++++++++++++++++++++" -] - -class Biff(TQWidget): - def __init__(self): - TQWidget.__init__(self, None, "Biff - example application") - - mail = os.getenv("MAIL") - fi = TQFileInfo(mail); - if not fi.exists(): - s = "/var/spool/mail/"+os.getenv("USER") - fi.setFile(s) - - if fi.exists(): - self.mailbox = fi.absFilePath() - self.startTimer(1000) - - self.setMinimumSize(48, 48) - self.setMaximumSize(48, 48) - self.resize(48, 48) - - self.hasNewMail = TQPixmap(hasmail_bmp_data) - self.noNewMail = TQPixmap(nomail_bmp_data) - - self.gotMail = FALSE - self.lastModified = fi.lastModified() - - def timerEvent(self, te): - fi = TQFileInfo(self.mailbox) - newState = ( fi.lastModified().toTime_t() != self.lastModified.toTime_t() and fi.lastModified().toTime_t() > fi.lastRead().toTime_t()) - if newState != self.gotMail: - if self.gotMail == TRUE: - self.lastModified = fi.lastModified() - self.gotMail = newState - self.repaint(FALSE) - - def paintEvent(self, pe): - if self.gotMail: - bitBlt(self, 0, 0, self.hasNewMail) - else: - bitBlt(self, 0, 0, self.noNewMail) - - def mousePressEvent(self, me): - fi = TQFileInfo(self.mailbox) - lastModified = fi.lastModified() - - -a = TQApplication(sys.argv) -b = Biff() -a.setMainWidget(b) -b.show() -a.exec_loop() diff --git a/examples3/bigtable.py b/examples3/bigtable.py deleted file mode 100755 index f2d9788..0000000 --- a/examples3/bigtable.py +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env python - -#**************************************************************************** -#** $Id: bigtable.py,v 1.1 2002/06/19 07:56:07 phil Exp $ -#** -#** Copyright (C) 1992-1998 Troll Tech AS. All rights reserved. -#** -#** This file is part of an example program for PyTQt. This example -#** program may be used, distributed and modified without limitation. -#** -#*****************************************************************************/ - -import sys -import os -from python_tqt.qt import * -from python_tqt.qttable import * - -TRUE = 1 -FALSE = 0 - -numRows = 1000000 -numCols = 1000000 - -class MyTable(TQTable): - def __init__(self, r, c): - TQTable.__init__(self, r, c) - self.items = {} - self.widgets = {} - self.setCaption("This is a big table with 1.000.000x1.000.000 cells...") - self.setLeftMargin(self.fontMetrics().width("W999999W")) - - def resizeData(self, v): - return - - def item(self, r, c): - try: - return self.items[self.indexOf(r, c)] - except KeyError: - return None - - def setItem(self, r, c, i): - self.items[self.indexOf(r, c)] = i - - def clearCell(self, r, c): - try: - del self.items[self.indexOf(r, c)] - except KeyError: - pass - - def insertWidget(self, r, c, w): - self.widgets[self.indexOf(r, c)] = w - - def cellWidget(self, r, c): - try: - return self.widgets[self.indexOf(r, c)] - except KeyError: - return None - - def clearCellWidget(self, r, c): - try: - del self.widgets[self.indexOf(r, c)] - except KeyError: - pass - - -if __name__ == '__main__': - app = TQApplication(sys.argv) - - table = MyTable(numRows, numCols) - app.setMainWidget(table) - table.show() - app.exec_loop() diff --git a/examples3/buttongroups.py b/examples3/buttongroups.py deleted file mode 100755 index 3d6883e..0000000 --- a/examples3/buttongroups.py +++ /dev/null @@ -1,125 +0,0 @@ -#!/usr/bin/env python -#/**************************************************************************** -#** $Id: buttongroups.py,v 1.2 2002/12/20 18:46:10 phil Exp $ -#** -#** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. -#** -#** This file is part of an example program for TQt. This example -#** program may be used, distributed and modified without limitation. -#** -#*****************************************************************************/ - -import sys -from python_tqt.qt import * - -TRUE = 1 -FALSE = 0 - -## -# Creates all child widgets of the ButtonGroups window -## - -class ButtonsGroups( TQWidget ): - def __init__( self, *args ): - TQWidget.__init__(*(self,) + args) - - # Create Widgets which allow easy layouting - self.vbox = TQVBoxLayout( self, 11, 6 ) - self.box1 = TQHBoxLayout( self.vbox ) - self.box2 = TQHBoxLayout( self.vbox ) - - # ------- first group - - # Create an exclusive button group - self.grp1 = TQButtonGroup( 1, TQGroupBox.Horizontal, "Button Group 1 (exclusive)", self ) - self.box1.addWidget( self.grp1 ) - self.grp1.setExclusive( TRUE ) - - # insert 3 radiobuttons - self.rb11 = TQRadioButton( "&Radiobutton 1", self.grp1 ) - self.rb11.setChecked( TRUE ) - TQRadioButton( "R&adiobutton 2", self.grp1 ) - TQRadioButton( "Ra&diobutton 3", self.grp1 ) - - # ------- second group - - # Create a non-exclusive buttongroup - self.grp2 = TQButtonGroup( 1, TQGroupBox.Horizontal, "Button Group 2 (non-exclusive)", self ) - self.box1.addWidget( self.grp2 ) - self.grp2.setExclusive( FALSE ) - - # insert 3 checkboxes - TQCheckBox( "&Checkbox 1", self.grp2 ) - self.cb12 = TQCheckBox( "C&heckbox 2", self.grp2 ) - self.cb12.setChecked( TRUE ) - self.cb13 = TQCheckBox( "Triple &State Button", self.grp2 ) - self.cb13.setTristate( TRUE ) - self.cb13.setChecked( TRUE ) - - # ------------ third group - - # create a buttongroup which is exclusive for radiobuttons and non-exclusive for all other buttons - self.grp3 = TQButtonGroup( 1, TQGroupBox.Horizontal, "Button Group 3 (Radiobutton-exclusive)", self ) - self.box2.addWidget( self.grp3 ) - self.grp3.setRadioButtonExclusive( TRUE ) - - # insert three radiobuttons - self.rb21 = TQRadioButton( "Rad&iobutton 1", self.grp3 ) - self.rb22 = TQRadioButton( "Radi&obutton 2", self.grp3 ) - self.rb23 = TQRadioButton( "Radio&button 3", self.grp3 ) - self.rb23.setChecked( TRUE ) - - # insert a checkbox... - self.state = TQCheckBox( "E&nable Radiobuttons", self.grp3 ) - self.state.setChecked( TRUE ) - # ...and connect its SIGNAL clicked() with the SLOT slotChangeGrp3State() - self.connect( self.state, SIGNAL( "clicked()" ), self.slotChangeGrp3State ) - - # ------------ fourth group - - # create a groupbox which layouts its childs in a columns - self.grp4 = TQButtonGroup( 1, TQGroupBox.Horizontal, "Groupbox with normal buttons", self ) - self.box2.addWidget( self.grp4 ) - - # insert two pushbuttons... - TQPushButton( "&Push Button", self.grp4 ) - self.tb2 = TQPushButton( "&Toggle Button", self.grp4 ) - - # ... and make the second one a toggle button - self.tb2.setToggleButton( TRUE ) - self.tb2.setOn( TRUE ) - - # ... and make the third one a flat button - self.tb3 = TQPushButton( "&Flat Button", self.grp4 ) - self.tb3.setFlat( TRUE ) - - # .. and the fourth a button with a menu - self.tb4 = TQPushButton( "Popup Button", self.grp4 ) - menu = TQPopupMenu(self.tb4) - menu.insertItem("Item1", 0) - menu.insertItem("Item2", 0) - menu.insertItem("Item3", 0) - menu.insertItem("Item4", 0) - self.tb4.setPopup(menu) - - # - # SLOT slotChangeGrp3State() - # enables/disables the radiobuttons of the third buttongroup - # - - def slotChangeGrp3State( self ): - self.rb21.setEnabled( self.state.isChecked() ) - self.rb22.setEnabled( self.state.isChecked() ) - self.rb23.setEnabled( self.state.isChecked() ) - - -## main program -a = TQApplication( sys.argv ) - -buttonsgroups = ButtonsGroups() -buttonsgroups.resize( 500, 250 ) -buttonsgroups.setCaption( "PyQT Example - Buttons and Groups" ) -a.setMainWidget( buttonsgroups ) -buttonsgroups.show() - -a.exec_loop() diff --git a/examples3/canvas/butterfly.png b/examples3/canvas/butterfly.png deleted file mode 100644 index 619f253..0000000 Binary files a/examples3/canvas/butterfly.png and /dev/null differ diff --git a/examples3/canvas/canvas.py b/examples3/canvas/canvas.py deleted file mode 100755 index 5f7f774..0000000 --- a/examples3/canvas/canvas.py +++ /dev/null @@ -1,619 +0,0 @@ -#!/usr/bin/env python - -import sys -from python_tqt.qt import * -from python_tqt.qtcanvas import * -import random - - -True = 1 -False = 0 -butterfly_fn = TQString.null -butterflyimg = [] -logo_fn = TQString.null -logoimg = [] -bouncy_logo = None -views = [] - - -class ImageItem(TQCanvasRectangle): - def __init__(self,img,canvas): - TQCanvasRectangle.__init__(self,canvas) - self.imageRTTI=984376 - self.image=img - self.pixmap=TQPixmap() - self.setSize(self.image.width(), self.image.height()) - self.pixmap.convertFromImage(self.image, TQt.OrderedAlphaDither); - - def rtti(self): - return self.imageRTTI - - def hit(self,p): - ix = p.x()-self.x() - iy = p.y()-self.y() - if not self.image.valid( ix , iy ): - return False - self.pixel = self.image.pixel( ix, iy ) - return (tqAlpha( self.pixel ) != 0) - - def drawShape(self,p): - p.drawPixmap( self.x(), self.y(), self.pixmap ) - - -class NodeItem(TQCanvasEllipse): - def __init__(self,canvas): - TQCanvasEllipse.__init__(self,6,6,canvas) - self.__inList=[] - self.__outList=[] - self.setPen(TQPen(TQt.black)) - self.setBrush(TQBrush(TQt.red)) - self.setZ(128) - - def addInEdge(self,edge): - self.__inList.append(edge) - - def addOutEdge(self,edge): - self.__outList.append(edge) - - def moveBy(self,dx,dy): - TQCanvasEllipse.moveBy(self,dx,dy) - for each_edge in self.__inList: - each_edge.setToPoint( int(self.x()), int(self.y()) ) - for each_edge in self.__outList: - each_edge.setFromPoint( int(self.x()), int(self.y()) ) - -class EdgeItem(TQCanvasLine): - __c=0 - def __init__(self,fromNode, toNode,canvas): - TQCanvasLine.__init__(self,canvas) - self.__c=self.__c+1 - self.setPen(TQPen(TQt.black)) - self.setBrush(TQBrush(TQt.red)) - fromNode.addOutEdge(self) - toNode.addInEdge(self) - self.setPoints(int(fromNode.x()),int(fromNode.y()), int(toNode.x()), int(toNode.y())) - self.setZ(127) - - def setFromPoint(self,x,y): - self.setPoints(x,y,self.endPoint().x(),self.endPoint().y()) - - def setToPoint(self,x,y): - self.setPoints(self.startPoint().x(), self.startPoint().y(),x,y) - - def count(self): - return self.__c - - def moveBy(self,dx,dy): - pass - - -class FigureEditor(TQCanvasView): - def __init__(self,c,parent,name,f): - TQCanvasView.__init__(self,c,parent,name,f) - self.__moving=0 - self.__moving_start= 0 - - def contentsMousePressEvent(self,e): # TQMouseEvent e - point = self.inverseWorldMatrix().map(e.pos()) - ilist = self.canvas().collisions(point) #TQCanvasItemList ilist - for each_item in ilist: - if each_item.rtti()==984376: - if not each_item.hit(point): - continue - self.__moving=each_item - self.__moving_start=point - return - self.__moving=0 - - def clear(self): - ilist = self.canvas().allItems() - for each_item in ilist: - if each_item: - each_item.setCanvas(None) - del each_item - self.canvas().update() - - def contentsMouseMoveEvent(self,e): - if self.__moving : - point = self.inverseWorldMatrix().map(e.pos()); - self.__moving.moveBy(point.x() - self.__moving_start.x(),point.y() - self.__moving_start.y()) - self.__moving_start = point - self.canvas().update() - - -class BouncyLogo(TQCanvasSprite): - def __init__(self,canvas): - # Make sure the logo exists. - global bouncy_logo - if bouncy_logo is None: - bouncy_logo=TQCanvasPixmapArray("qt-trans.xpm") - - TQCanvasSprite.__init__(self,None,canvas) - self.setSequence(bouncy_logo) - self.setAnimated(True) - self.initPos() - self.logo_rtti=1234 - - def rtti(self): - return self.logo_rtti - - def initPos(self): - self.initSpeed() - trial=1000 - self.move(random.random()%self.canvas().width(), random.random()%self.canvas().height()) - self.advance(0) - trial=trial-1 - while (trial & (self.xVelocity()==0 )& (self.yVelocity()==0)): - elf.move(random.random()%self.canvas().width(), random.random()%self.canvas().height()) - self.advance(0) - trial=trial-1 - - def initSpeed(self): - speed=4.0 - d=random.random()%1024/1024.0 - self.setVelocity(d*speed*2-speed, (1-d)*speed*2-speed) - - def advance(self,stage): - if stage==0: - vx=self.xVelocity() - vy=self.yVelocity() - if (vx==0.0) & (vy==0.0): - self.initSpeed() - vx=self.xVelocity() - vy=self.yVelocity() - - nx=self.x()+vx - ny=self.y()+vy - - if (nx<0) | (nx >= self.canvas().width()): - vx=-vx - if (ny<0) | (ny >= self.canvas().height()): - vy=-vy - - for bounce in [0,1,2,3]: - l=self.collisions(False) - for hit in l: - if (hit.rtti()==1234) & (hit.collidesWith(self)): - if bounce==0: - vx=-vx - elif bounce==1: - vy=-vy - vx=-vx - elif bounce==2: - vx=-vx - elif bounce==3: - vx=0 - vy=0 - self.setVelocity(vx,vy) - break - - if (self.x()+vx < 0) | (self.x()+vx >= self.canvas().width()): - vx=0 - if (self.y()+vy < 0) | (self.y()+vy >= self.canvas().height()): - vy=0 - - self.setVelocity(vx,vy) - elif stage==1: - TQCanvasItem.advance(self,stage) - - -class Main (TQMainWindow): - def __init__(self,c,parent,name,f=0): - TQMainWindow.__init__(self,parent,name,f) - self.editor=FigureEditor(c,self,name,f) - self.printer=TQPrinter() - self.dbf_id=0 - self.canvas=c - self.mainCount=0 - file=TQPopupMenu(self.menuBar()) - file.insertItem("&Fill canvas", self.init, TQt.CTRL+TQt.Key_F) - file.insertItem("&Erase canvas", self.clear, TQt.CTRL+TQt.Key_E) - file.insertItem("&New view", self.newView, TQt.CTRL+TQt.Key_N) - file.insertSeparator(); - file.insertItem("&Print", self._print, TQt.CTRL+TQt.Key_P) - file.insertSeparator() - file.insertItem("E&xit", tqApp, SLOT("quit()"), TQt.CTRL+TQt.Key_Q) - self.menuBar().insertItem("&File", file) - - edit = TQPopupMenu(self.menuBar() ) - edit.insertItem("Add &Circle", self.addCircle, TQt.ALT+TQt.Key_C) - edit.insertItem("Add &Hexagon", self.addHexagon, TQt.ALT+TQt.Key_H) - edit.insertItem("Add &Polygon", self.addPolygon, TQt.ALT+TQt.Key_P) - edit.insertItem("Add Spl&ine", self.addSpline, TQt.ALT+TQt.Key_I) - edit.insertItem("Add &Text", self.addText, TQt.ALT+TQt.Key_T) - edit.insertItem("Add &Line", self.addLine, TQt.ALT+TQt.Key_L) - edit.insertItem("Add &Rectangle", self.addRectangle, TQt.ALT+TQt.Key_R) - edit.insertItem("Add &Sprite", self.addSprite, TQt.ALT+TQt.Key_S) - edit.insertItem("Create &Mesh", self.addMesh, TQt.ALT+TQt.Key_M ) - edit.insertItem("Add &Alpha-blended image", self.addButterfly, TQt.ALT+TQt.Key_A) - self.menuBar().insertItem("&Edit", edit) - - view = TQPopupMenu(self.menuBar() ); - view.insertItem("&Enlarge", self.enlarge, TQt.SHIFT+TQt.CTRL+TQt.Key_Plus); - view.insertItem("Shr&ink", self.shrink, TQt.SHIFT+TQt.CTRL+TQt.Key_Minus); - view.insertSeparator(); - view.insertItem("&Rotate clockwise", self.rotateClockwise, TQt.CTRL+TQt.Key_PageDown); - view.insertItem("Rotate &counterclockwise", self.rotateCounterClockwise, TQt.CTRL+TQt.Key_PageUp); - view.insertItem("&Zoom in", self.zoomIn, TQt.CTRL+TQt.Key_Plus); - view.insertItem("Zoom &out", self.zoomOut, TQt.CTRL+TQt.Key_Minus); - view.insertItem("Translate left", self.moveL, TQt.CTRL+TQt.Key_Left); - view.insertItem("Translate right", self.moveR, TQt.CTRL+TQt.Key_Right); - view.insertItem("Translate up", self.moveU, TQt.CTRL+TQt.Key_Up); - view.insertItem("Translate down", self.moveD, TQt.CTRL+TQt.Key_Down); - view.insertItem("&Mirror", self.mirror, TQt.CTRL+TQt.Key_Home); - self.menuBar().insertItem("&View", view) - - self.options = TQPopupMenu( self.menuBar() ); - self.dbf_id = self.options.insertItem("Double buffer", self.toggleDoubleBuffer) - self.options.setItemChecked(self.dbf_id, True) - self.menuBar().insertItem("&Options",self.options) - - self.menuBar().insertSeparator(); - - help = TQPopupMenu( self.menuBar() ) - help.insertItem("&About", self.help, TQt.Key_F1) - help.insertItem("&About TQt", self.aboutTQt, TQt.Key_F2) - help.setItemChecked(self.dbf_id, True) - self.menuBar().insertItem("&Help",help) - - self.statusBar() - - self.setCentralWidget(self.editor) - - self.printer = 0 - self.tb=0 - self.tp=0 - - self.init() - - def init(self): - self.clear() - r=24 - r=r+1 - random.seed(r) - for i in range(self.canvas.width()/56): - self.addButterfly() - for j in range(self.canvas.width()/85): - self.addHexagon() - for k in range(self.canvas.width()/128): - self.addLogo() - - def newView(self): - m=Main(self.canvas,None,"new windiw",TQt.WDestructiveClose) - tqApp.setMainWidget(m) - m.show() - tqApp.setMainWidget(None) - views.append(m) - - def clear(self): - self.editor.clear() - - def help(self): - TQMessageBox.information(None, "PyTQt Canvas Example", - "

The PyTQt TQCanvas classes example


" - "

This is the PyTQt implementation of " - "TQt canvas example.

by Sadi Kose " - "(kose@nuvox.net)
" - "
    " - "
  • Press ALT-S for some sprites." - "
  • Press ALT-C for some circles." - "
  • Press ALT-L for some lines." - "
  • Drag the objects around." - "
  • Read the code!" - "
","Dismiss") - - def aboutTQt(self): - TQMessageBox.aboutTQt(self,"PyTQt Canvas Example") - - def toggleDoubleBuffer(self): - s = not self.options.isItemChecked(self.dbf_id) - self.options.setItemChecked(self.dbf_id,s) - self.canvas.setDoubleBuffering(s) - - def enlarge(self): - self.canvas.resize(self.canvas.width()*4/3, self.canvas.height()*4/3) - - def shrink(self): - self.canvas.resize(self.canvas.width()*3/4, self.canvas.height()*3/4) - - def rotateClockwise(self): - m = self.editor.worldMatrix() - m.rotate( 22.5 ) - self.editor.setWorldMatrix( m ) - - def rotateCounterClockwise(self): - m = self.editor.worldMatrix() - m.rotate( -22.5 ) - self.editor.setWorldMatrix( m ) - - def zoomIn(self): - m = self.editor.worldMatrix() - m.scale( 2.0, 2.0 ) - self.editor.setWorldMatrix( m ) - - def zoomOut(self): - m = self.editor.worldMatrix() - m.scale( 0.5, 0.5 ) - self.editor.setWorldMatrix( m ) - - def mirror(self): - m = self.editor.worldMatrix() - m.scale( -1, 1 ) - self.editor.setWorldMatrix( m ) - - def moveL(self): - m = self.editor.worldMatrix() - m.translate( -16, 0 ) - self.editor.setWorldMatrix( m ) - - def moveR(self): - m = self.editor.worldMatrix() - m.translate( +16, 0 ) - self.editor.setWorldMatrix( m ) - - def moveU(self): - m = self.editor.worldMatrix() - m.translate( 0, -16 ) - self.editor.setWorldMatrix( m ) - - def moveD(self): - m = self.editor.worldMatrix(); - m.translate( 0, +16 ); - self.editor.setWorldMatrix( m ) - - def _print(self): - if not self.printer: - self.printer = TQPrinter() - if self.printer.setup(self) : - pp=TQPainter(self.printer) - self.canvas.drawArea(TQRect(0,0,self.canvas.width(),self.canvas.height()),pp,False) - - def addSprite(self): - i = BouncyLogo(self.canvas) - i.setZ(256*random.random()%256); - i.show(); - - def addButterfly(self): - if butterfly_fn.isEmpty(): - return - if not butterflyimg: - butterflyimg.append(TQImage()) - butterflyimg[0].load(butterfly_fn) - butterflyimg.append(TQImage()) - butterflyimg[1] = butterflyimg[0].smoothScale( int(butterflyimg[0].width()*0.75), - int(butterflyimg[0].height()*0.75) ) - butterflyimg.append(TQImage()) - butterflyimg[2] = butterflyimg[0].smoothScale( int(butterflyimg[0].width()*0.5), - int(butterflyimg[0].height()*0.5) ) - butterflyimg.append(TQImage()) - butterflyimg[3] = butterflyimg[0].smoothScale( int(butterflyimg[0].width()*0.25), - int(butterflyimg[0].height()*0.25) ) - - i = ImageItem(butterflyimg[int(4*random.random()%4)],self.canvas) - i.move((self.canvas.width()-butterflyimg[0].width())*random.random()%(self.canvas.width()-butterflyimg[0].width()), - (self.canvas.height()-butterflyimg[0].height())*random.random()%(self.canvas.height()-butterflyimg[0].height())) - i.setZ(256*random.random()%256+250); - i.show() - - def addLogo(self): - if logo_fn.isEmpty(): - return; - if not logoimg: - logoimg.append(TQImage()) - logoimg[0].load( logo_fn ) - logoimg.append(TQImage()) - logoimg[1] = logoimg[0].smoothScale( int(logoimg[0].width()*0.75), - int(logoimg[0].height()*0.75) ) - logoimg.append(TQImage()) - logoimg[2] = logoimg[0].smoothScale( int(logoimg[0].width()*0.5), - int(logoimg[0].height()*0.5) ) - logoimg.append(TQImage()) - logoimg[3] = logoimg[0].smoothScale( int(logoimg[0].width()*0.25), - int(logoimg[0].height()*0.25) ); - - i = ImageItem(logoimg[int(4*random.random()%4)],self.canvas) - i.move((self.canvas.width()-logoimg[0].width())*random.random()%(self.canvas.width()-logoimg[0].width()), - (self.canvas.height()-logoimg[0].width())*random.random()%(self.canvas.height()-logoimg[0].width())) - i.setZ(256*random.random()%256+256) - i.show() - - def addCircle(self): - i = TQCanvasEllipse(50,50,self.canvas) - i.setBrush( TQBrush(TQColor(256*random.random()%32*8,256*random.random()%32*8,256*random.random()%32*8) )) - i.move(self.canvas.width()*random.random()%self.canvas.width(),self.canvas.width()*random.random()%self.canvas.height()) - i.setZ(256*random.random()%256) - i.show() - - def addHexagon(self): - i = TQCanvasPolygon(self.canvas) - size = canvas.width() / 25 - pa=TQPointArray(6) - pa.setPoint(0,TQPoint(2*size,0)) - pa.setPoint(1,TQPoint(size,-size*173/100)) - pa.setPoint(2,TQPoint(-size,-size*173/100)) - pa.setPoint(3,TQPoint(-2*size,0)) - pa.setPoint(4,TQPoint(-size,size*173/100)) - pa.setPoint(5,TQPoint(size,size*173/100)) - i.setPoints(pa) - i.setBrush( TQBrush(TQColor(256*random.random()%32*8,256*random.random()%32*8,256*random.random()%32*8) )) - i.move(self.canvas.width()*random.random()%self.canvas.width(),self.canvas.width()*random.random()%self.canvas.height()) - i.setZ(256*random.random()%256) - i.show() - - def addPolygon(self): - i = TQCanvasPolygon(self.canvas) - size = self.canvas.width()/2 - pa=TQPointArray(6) - pa.setPoint(0, TQPoint(0,0)) - pa.setPoint(1, TQPoint(size,size/5)) - pa.setPoint(2, TQPoint(size*4/5,size)) - pa.setPoint(3, TQPoint(size/6,size*5/4)) - pa.setPoint(4, TQPoint(size*3/4,size*3/4)) - pa.setPoint(5, TQPoint(size*3/4,size/4)) - - i.setPoints(pa) - i.setBrush(TQBrush( TQColor(256*random.random()%32*8,256*random.random()%32*8,256*random.random()%32*8)) ) - i.move(self.canvas.width()*random.random()%self.canvas.width(),self.canvas.width()*random.random()%self.canvas.height()) - i.setZ(256*random.random()%256) - i.show() - - def addSpline(self): - i = TQCanvasSpline(self.canvas) - size = canvas.width()/6 - pa=TQPointArray(12) - pa.setPoint(0,TQPoint(0,0)) - pa.setPoint(1,TQPoint(size/2,0)) - pa.setPoint(2,TQPoint(size,size/2)) - pa.setPoint(3,TQPoint(size,size)) - pa.setPoint(4,TQPoint(size,size*3/2)) - pa.setPoint(5,TQPoint(size/2,size*2)) - pa.setPoint(6,TQPoint(0,size*2)) - pa.setPoint(7,TQPoint(-size/2,size*2)) - pa.setPoint(8,TQPoint(size/4,size*3/2)) - pa.setPoint(9,TQPoint(0,size)) - pa.setPoint(10,TQPoint(-size/4,size/2)) - pa.setPoint(11,TQPoint(-size/2,0)) - i.setControlPoints(pa) - i.setBrush( TQBrush(TQColor(256*random.random()%32*8,256*random.random()%32*8,256*random.random()%32*8) )) - i.move(self.canvas.width()*random.random()%self.canvas.width(),self.canvas.width()*random.random()%self.canvas.height()) - i.setZ(256*random.random()%256) - i.show() - - def addText(self): - i = TQCanvasText(self.canvas) - i.setText("TQCanvasText") - i.move(self.canvas.width()*random.random()%self.canvas.width(),self.canvas.width()*random.random()%self.canvas.height()) - i.setZ(256*random.random()%256) - i.show() - - def addLine(self): - i = TQCanvasLine(self.canvas); - i.setPoints( self.canvas.width()*random.random()%self.canvas.width(), self.canvas.width()*random.random()%self.canvas.height(), - self.canvas.width()*random.random()%self.canvas.width(), self.canvas.width()*random.random()%self.canvas.height() ) - i.setPen( TQPen(TQColor(256*random.random()%32*8,256*random.random()%32*8,256*random.random()%32*8), 6) ) - i.setZ(256*random.random()%256) - i.show() - - def ternary(self,exp,x,y): - if exp: - return x - else: - return y - - def addMesh(self): - x0 = 0; - y0 = 0; - - if not self.tb: - self.tb = TQBrush( TQt.red ) - if not self.tp: - self.tp = TQPen( TQt.black ) - - nodecount = 0; - - w = self.canvas.width() - h = self.canvas.height() - - dist = 30 - rows = h / dist - cols = w / dist - - #ifndef TQT_NO_PROGRESSDIALOG - #progress=TQProgressDialog( "Creating mesh...", "Abort", rows, - # self, "progress", True ); - #endif - - lastRow=[] - for c in range(cols): - lastRow.append(NodeItem(self.canvas)) - for j in range(rows): - n = self.ternary(j%2 , cols-1 , cols) - prev = 0; - for i in range(n): - el = NodeItem( self.canvas ) - nodecount=nodecount+1 - r = 20*20*random.random() - xrand = r %20 - yrand = (r/20) %20 - el.move( xrand + x0 + i*dist + self.ternary(j%2 , dist/2 , 0 ), - yrand + y0 + j*dist ); - - if j > 0 : - if i < cols-1 : - EdgeItem( lastRow[i], el, self.canvas ).show() - if j%2 : - EdgeItem( lastRow[i+1], el, self.canvas ).show() - elif i > 0 : - EdgeItem( lastRow[i-1], el, self.canvas ).show() - if prev: - EdgeItem( prev, el, self.canvas ).show() - - if i > 0 : - lastRow[i-1] = prev - prev = el - el.show() - - lastRow[n-1]=prev - #ifndef TQT_NO_PROGRESSDIALOG - #progress.setProgress( j ) - #if progress.wasCancelled() : - # break - #endif - - #ifndef TQT_NO_PROGRESSDIALOG - #progress.setProgress( rows ) - #endif - #// tqDebug( "%d nodes, %d edges", nodecount, EdgeItem::count() ); - - def addRectangle(self): - i = TQCanvasRectangle( self.canvas.width()*random.random()%self.canvas.width(), - self.canvas.width()*random.random()%self.canvas.height(), - self.canvas.width()/5,self.canvas.width()/5,self.canvas) - z = 256*random.random()%256 - i.setBrush( TQBrush(TQColor(z,z,z) )) - i.setPen( TQPen(TQColor(self.canvas.width()*random.random()%32*8, - self.canvas.width()*random.random()%32*8, - self.canvas.width()*random.random()%32*8), 6) ) - i.setZ(z) - i.show() - - -if __name__=='__main__': - app=TQApplication(sys.argv) - - if len(sys.argv) > 1: - butterfly_fn=TQString(sys.argv[1]) - else: - butterfly_fn=TQString("butterfly.png") - - if len(sys.argv) > 2: - logo_fn = TQString(sys.argv[2]) - else: - logo_fn=TQString("qtlogo.png") - - canvas=TQCanvas(800,600) - canvas.setAdvancePeriod(30) - m=Main(canvas,None,"pyqt canvas example") - m.resize(m.sizeHint()) - - tqApp.setMainWidget(m) - m.setCaption("TQt Canvas Example ported to PyTQt") - if TQApplication.desktop().width() > m.width() + 10 and TQApplication.desktop().height() > m.height() + 30: - m.show() - else: - m.showMaximized() - - m.show(); - #// m.help(); - tqApp.setMainWidget(None); - - TQObject.connect( tqApp, SIGNAL("lastWindowClosed()"), tqApp, SLOT("quit()") ) - - app.exec_loop() - - # We need to explicitly delete the canvas now (and, therefore, the main - # window beforehand) to make sure that the sprite logo doesn't get garbage - # collected first. - views = [] - del m - del canvas diff --git a/examples3/canvas/qt-trans.xpm b/examples3/canvas/qt-trans.xpm deleted file mode 100644 index 225f684..0000000 --- a/examples3/canvas/qt-trans.xpm +++ /dev/null @@ -1,54 +0,0 @@ -/* XPM */ -static char *qtlogo_xpm[] = { -/* width height ncolors chars_per_pixel */ -"54 34 13 1", -/* colors */ -" c #000000", -". c #999999", -"X c #333366", -"o c #6666CC", -"O c #333333", -"@ c #666699", -"# c #000066", -"$ c #666666", -"% c #3333CC", -"& c #000033", -"* c #9999CC", -"= c #333399", -"+ c None", -/* pixels */ -"+++++++++++++++++++.$OOO$.++++++++++++++++++++++++++++", -"+++++++++++++++++$ O.+++++++++++++++++++++++++", -"+++++++++++++++.O $++++++++++++++++++++++++", -"++++++++++++++. $.++.$ O+++++++++++++++++++++++", -"+++++++++++++. O.+++++++$ O++++++++++++++++++++++", -"+++++++++++++O ++++++++++$ $+++++++++++++++++++++", -"++++++++++++$ .+++++++++++O .++++++++++++++++++++", -"+++++++++++. O+++++++++++++ O++++++.+++++++++++++", -"+++++++++++$ .+++++++++++++$ .+++.O +++++++++++++", -"+++++++++++ +++++++++++++++ O+++. +++++++++++++", -"++++++++++. &Xoooo*++++++++++$ +++. +++++++++++++", -"++++++++++@=%%%%%%%%%%*+++++++. .++. +++++++++++++", -"+++++++**oooooo**++*o%%%%o+++++ $++O +++++++++++++", -"+++++*****$OOX@oooo*++*%%%%%*++O $+. OOO$++++++++*", -"++..+.++....$O$+*ooooo*+*o%%%%%O O+$ $$O.++++++**+", -"***+*+++++$$....+++*oooo**+*o%%# O++O ++++++***o*++", -"*+++++++++O $.....++**oooo**+*X &o*O ++++*ooo*++++", -"++++++++++$ O++.....++**oooo*X &%%& ..*o%%*++++++", -"++++++++++$ ++++.....+++**ooO $*o& @oo*+++++++++", -"++++++++++. .++++++.....+++*O Xo*O .++++++++++++", -"+++++++++++ O+++++++++...... .++O +++++++++++++", -"+++++++++++O +++.$$$.++++++. O+++O +++++++++++++", -"+++++++++++. $$OO O.++++O .+++O +++++++++++++", -"++++++++++++O .+++.O $++. O++++O +++++++++++++", -"++++++++++++. O+++++O $+O +++++O +++++++++++++", -"+++++++++++++. O+++++O O .+++++O .++++++++++++", -"++++++++++++++$ .++++O .++++.+$ O+.$.++++++++", -"+++++++++++++++. O$$O .+++++... +++++++++", -"+++++++++++++++++$ O+++++$$+.O O$.+++++++++", -"+++++++++++++++++++$OO O$.O O.++. .++++++++++++++++", -"+++++++++++++++++++++++++++. OO .++++++++++++++++", -"++++++++++++++++++++++++++++. O+++++++++++++++++", -"+++++++++++++++++++++++++++++. .+++++++++++++++++", -"++++++++++++++++++++++++++++++.O O.++++++++++++++++++" -}; diff --git a/examples3/canvas/qtlogo.png b/examples3/canvas/qtlogo.png deleted file mode 100644 index 96202de..0000000 Binary files a/examples3/canvas/qtlogo.png and /dev/null differ diff --git a/examples3/checklists.py b/examples3/checklists.py deleted file mode 100755 index 61734ba..0000000 --- a/examples3/checklists.py +++ /dev/null @@ -1,135 +0,0 @@ -#!/usr/bin/env python - -# Copyright (C) 2002 Oleksandr Yakovlyev (yshurik) - -import sys -from python_tqt.qt import * - -TRUE = 1 -FALSE = 0 - -class CheckLists(TQWidget): - def __init__(self, *args): - TQWidget.__init__(* (self, ) + args ) - - lay = TQHBoxLayout(self) - lay.setMargin(5) - - vbox1 = TQVBoxLayout(lay) - vbox1.setMargin(5) - - # First child: a Label - vbox1.addWidget(TQLabel("Check some items!", self)) - - # Second child: the ListView - self.lv1 = TQListView(self) - vbox1.addWidget(self.lv1) - self.lv1.addColumn("Items") - self.lv1.setRootIsDecorated(TRUE) - - # create a list with 4 ListViewItems which will be parent items of other ListViewItems - - parentList = [] - - parentList.append( TQListViewItem( self.lv1, "Parent Item 1" ) ) - parentList.append( TQListViewItem( self.lv1, "Parent Item 2" ) ) - parentList.append( TQListViewItem( self.lv1, "Parent Item 3" ) ) - parentList.append( TQListViewItem( self.lv1, "Parent Item 4" ) ) - - num = 0 - - self.childList1 = [] - # go through the list of parent items... - for i in range(4): - it = parentList[i] - it.setOpen( TRUE ) - - # ...and create 5 checkable child ListViewItems for each parent item - for j in range(5): - ci = TQCheckListItem( it, TQString("%1. Child of Parent %2").arg( j ).arg( i ), TQCheckListItem.CheckBox ) - self.childList1.append(ci) - - # Create another widget for layouting - tmp1 = TQVBoxLayout( lay ) - tmp1.setMargin( 5 ) - - # create a pushbutton - copy1 = TQPushButton( " -> ", self ) - tmp1.addWidget( copy1 ) - copy1.setMaximumWidth( copy1.sizeHint().width() ); - # connect the SIGNAL clicked() of the pushbutton with the SLOT copy1to2() - self.connect( copy1, SIGNAL('clicked()'), self.copy1to2 ) - - # another widget for layouting - vbox2 = TQVBoxLayout( lay ) - vbox2.setMargin( 5 ) - - # and another label - vbox2.addWidget( TQLabel( "Check one item!", self ) ) - - # create the second listview - self.lv2 = TQListView( self ) - vbox2.addWidget( self.lv2 ) - self.lv2.addColumn( "Items" ) - self.lv2.setRootIsDecorated( TRUE ) - - # another widget needed for layouting only - tmp2 = TQVBoxLayout( lay ) - tmp2.setMargin( 5 ) - - # create another pushbutton... - copy2 = TQPushButton( " -> ", self ) - lay.addWidget( copy2 ) - copy2.setMaximumWidth( copy2.sizeHint().width() ) - # ...and connect its clicked() SIGNAL to the copy2to3() SLOT - self.connect( copy2, SIGNAL('clicked()'), self.copy2to3 ) - - tmp3 = TQVBoxLayout( lay ) - tmp3.setMargin( 5 ) - - # and create a label which will be at the right of the window - self.label = TQLabel( "No Item yet...", self ) - tmp3.addWidget( self.label ) - - def copy1to2(self): - self.lv2.clear() - - # Insert first a controller Item into the second ListView. Always if Radio-ListViewItems - # are inserted into a Listview, the parent item of these MUST be a controller Item! - item = TQCheckListItem( self.lv2, "Controller", TQCheckListItem.Controller ) - item.setOpen( TRUE ) - - self.listChild2 = [] - for it in self.childList1: - # ...check state of childs, and... - if it.parent() != None: - # ...if the item is checked... - if it.isOn(): - # ...insert a Radio-ListViewItem with the same text into the second ListView - ri = TQCheckListItem(item , it.text(0), TQCheckListItem.RadioButton) - self.listChild2.append(ri) - - if item.firstChild() != None: - item.firstChild().setOn(TRUE) - - def copy2to3(self): - self.label.setText( "No Item checked" ) - - # iterate through the second ListView... - for it in self.listChild2: - # ...check state of childs, and... - if it.parent() != None: - # ...if the item is checked... - if it.isOn(): - # ...set the text of the item to the label - self.label.setText( it.text( 0 ) ) - -a = TQApplication(sys.argv) - -checkLists = CheckLists() -checkLists.resize(700, 400) -checkLists.setCaption("PyTQt example - CheckLists") - -a.setMainWidget(checkLists) -checkLists.show() -a.exec_loop() diff --git a/examples3/cursor.py b/examples3/cursor.py deleted file mode 100755 index da9db7b..0000000 --- a/examples3/cursor.py +++ /dev/null @@ -1,114 +0,0 @@ -#!/usr/bin/env python - -"""$Id: cursor.py,v 1.1 2003/07/01 14:18:37 phil Exp $ -** -** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. -** -** This file is part of an example program for TQt. This example -** program may be used, distributed and modified without limitation. -** -***************************************************************************""" - -import sys -from python_tqt.qt import * - -# cb_bits and cm_bits were generated by X bitmap program. - -cb_width = 32 -cb_height = 32 - -# cursor bitmap -cb_bits = b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf8\x0f\x00" \ - b"\x00\x06\x30\x00\x80\x01\xc0\x00\x40\x00\x00\x01" \ - b"\x20\x00\x00\x02\x10\x00\x00\x04\x08\x3e\x3e\x08" \ - b"\x08\x03\xe0\x08\xc4\x00\x00\x11\x04\x1e\x78\x10" \ - b"\x02\x0c\x30\x20\x02\x40\x00\x20\x02\x40\x00\x20" \ - b"\x02\x40\x00\x20\x02\x20\x04\x20\x02\x20\x04\x20" \ - b"\x02\x10\x08\x20\x02\x08\x08\x20\x02\xf0\x07\x20" \ - b"\x04\x00\x00\x10\x04\x00\x00\x10\x08\x00\xc0\x08" \ - b"\x08\x3c\x30\x08\x10\xe6\x19\x04\x20\x00\x0f\x02" \ - b"\x40\x00\x00\x01\x80\x01\xc0\x00\x00\x06\x30\x00" \ - b"\x00\xf8\x0f\x00\x00\x00\x00\x00" - -cm_width = 32 -cm_height = 32 - -# cursor bitmap mask -cm_bits = b"\x00\x00\x00\x00\x00\xf8\x1f\x00\x00\xfe\x3f\x00" \ - b"\x80\x07\xf0\x00\xc0\x01\xc0\x01\x60\x00\x00\x03" \ - b"\x30\x00\x00\x06\x18\x00\x00\x0c\x0c\x3e\x3e\x18" \ - b"\x0e\x03\xe0\x18\xc6\x00\x00\x31\x07\x1e\x78\x30" \ - b"\x03\x0c\x30\x60\x03\x40\x00\x60\x03\x40\x00\x60" \ - b"\x03\x40\x00\x60\x03\x20\x04\x60\x03\x20\x04\x60" \ - b"\x03\x10\x08\x60\x03\x08\x08\x60\x03\xf0\x07\x60" \ - b"\x06\x00\x00\x30\x06\x00\x00\x30\x0c\x00\xc0\x18" \ - b"\x0c\x3c\x30\x18\x18\xe6\x19\x0c\x30\x00\x0f\x06" \ - b"\x60\x00\x00\x03\xc0\x01\xc0\x01\x80\x07\xf0\x00" \ - b"\x00\xfe\x3f\x00\x00\xf8\x0f\x00" - -# The CursorView contains many labels with different cursors. -class CursorView( TQWidget ): # cursor view - def __init__( self ): - TQWidget.__init__( self ) - # Constructs a cursor view. -#enum CursorShape { ArrowCursor, UpArrowCursor, CrossCursor, WaitCursor, IbeamCursor, SizeVerCursor, SizeHorCursor, SizeBDiagCursor, SizeFDiagCursor, SizeAllCursor, BlankCursor, SplitVCursor, SplitHCursor, PointingHandCursor, ForbiddenCursor, WhatsThisCursor, LastCursor = WhatsThisCursor, BitmapCursor = 24 } - - shape = [ - "ArrowCursor", "UpArrowCursor", "CrossCursor", - "WaitCursor", "IbeamCursor", "SizeVerCursor", - "SizeHorCursor", "SizeBDiagCursor", "SizeFDiagCursor", - "SizeAllCursor", "BlankCursor", "SplitVCursor", - "SplitHCursor", "PointingHandCursor", "ForbiddenCursor", - "WhatsThisCursor" - ] - name = [ - "standard arrow cursor", "upwards arrow", - "crosshair", "hourglass/watch", - "ibeam/text entry", "vertical resize", - "horizontal resize", "diagonal resize (/)", - "diagonal resize (\)", "all directions resize", - "blank/invisible cursor", "vertical splitting", - "horziontal splitting", "a pointing hand", - "a slashed circle", "an arrow with a question mark" - ] - - self.setCaption( "CursorView" ) # set window caption - - grid = TQGridLayout( self, 5, 4, 20 ) - - i=0 - for y in range( 0, 4, 1 ) : # create the small labels - for x in range( 0, 4, 1 ) : - label = TQLabel( self ) - label.setCursor( TQCursor(i) ) - label.setText( shape[i] ); - label.setAlignment( self.AlignCenter ) - label.setFrameStyle( TQFrame.Box | TQFrame.Raised ) - grid.addWidget( label, x, y ) - TQToolTip.add( label, name[i] ) - i += 1 - - cb = TQBitmap( cb_width, cb_height, cb_bits, True ) - cm = TQBitmap( cm_width, cm_height, cm_bits, True ) - custom = TQCursor( cb, cm ) # create bitmap cursor - - label = TQLabel( self ) # create the big label - label.setCursor( custom ) - label.setText( "Custom bitmap cursor" ) - TQToolTip.add( label, "custom bitmap cursor" ) - label.setAlignment( self.AlignCenter ) - label.setFrameStyle( TQFrame.Box | TQFrame.Sunken ) - grid.addMultiCellWidget( label, 4, 4, 0, 3 ) - -# Create and display a CursorView. -def main( args ): - a = TQApplication(sys.argv) # application object - v = CursorView() # cursor view - v.setCaption( "TQt Example - Cursors" ) - a.setMainWidget( v ) - v.show() - - a.exec_loop() - -if __name__=="__main__": - main(sys.argv) diff --git a/examples3/dclock.py b/examples3/dclock.py deleted file mode 100755 index 302d454..0000000 --- a/examples3/dclock.py +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env python - -# A port to PyTQt of the dclock example from TQt v2.x. - - -import sys, string -from python_tqt.qt import * - - -class DigitalClock(TQLCDNumber): - def __init__(self, parent=None, name=None): - TQLCDNumber.__init__(self, parent, name) - self.showingColon = 0 - self.setFrameStyle(TQFrame.Panel | TQFrame.Raised) - self.setLineWidth(2) - self.showTime() - self.normalTimer = self.startTimer(500) - self.showDateTimer = -1 - - def timerEvent(self, e): - if e.timerId() == self.showDateTimer: - self.stopDate() - else: - if self.showDateTimer == -1: - self.showTime() - - def mousePressEvent(self, e): - if e.button() == TQt.LeftButton: - self.showDate() - - def showDate(self): - if self.showDateTimer != -1: - return - d = TQDate.currentDate() - self.display('%2d %2d' % (d.month(), d.day())) - self.showDateTimer = self.startTimer(2000) - - def stopDate(self): - self.killTimer(self.showDateTimer) - self.showDateTimer = -1 - self.showTime() - - def showTime(self): - self.showingColon = not self.showingColon - s = list(str(TQTime.currentTime().toString())[:5]) #.left(5) - if not self.showingColon: - s[2] = ' ' - if s[0] == '0': - s[0] = ' ' - s = ''.join(s) - self.display(s) - -a = TQApplication(sys.argv) -clock = DigitalClock() -clock.resize(170,80) -a.setMainWidget(clock) -clock.show() -a.exec_loop() diff --git a/examples3/desktop.py b/examples3/desktop.py deleted file mode 100755 index 154b632..0000000 --- a/examples3/desktop.py +++ /dev/null @@ -1,230 +0,0 @@ -#!/usr/bin/env python - -import sys -from python_tqt.qt import * - -seed = 0.353535353535 -KINDA_RAND_MAX = 32767 - -def kindaRand(): - global seed - seed = seed * 147 - seed = seed - int(seed) - return int(seed*(KINDA_RAND_MAX + 1)) - -velmax = 15 -velmin = 4 - -def velocity(i): - if i == 1 or i == 2: - i = (kindaRand()&0x7fff % velmax)/3 + velmin - else: - i = (kindaRand()&0x7fff % velmax) + velmin - return i - -maxpoints = 5 -maxcurves = 8 - -def poly(): - d = TQApplication.desktop() - d.setEraseColor(TQt.white) - xvel = [ 0 ] * maxpoints - yvel = [ 0 ] * maxpoints - head = 0 - tail = -maxcurves + 2 - a = [ TQPointArray() ] * maxcurves - r = d.rect() - for i in range(maxcurves): - a[i].resize(maxpoints) - p = a[0] - for i in range(maxpoints): - p.setPoint(i, (kindaRand()&0x7fff) % r.width(), - (kindaRand()&0x7fff) % r.height() ) - xvel[i] = velocity(i) - yvel[i] = velocity(i) - - paint = TQPainter() - paint.begin(d) - - for ntimes in range(2000): - paint.setBrush(TQColor(kindaRand()%360,180,255, TQColor.Hsv)) - paint.drawPolygon(a[head]) - tail = tail + 1 - if tail >= maxcurves: - tail = 0 - minx = r.left() - maxx = r.right() - miny = r.top() - maxy = r.bottom() - p = a[head] - head = head + 1 - if head >= maxcurves: - head = 0 - for i in range(maxpoints): - x, y = p.point(i) - x = x + xvel[i] - y = y + yvel[i] - if x >= maxx: - x = maxx - (x - maxx + 1) - xvel[i] = -velocity(i) - if x <= minx: - x = minx + (minx - x + 1) - xvel[i] = velocity(i) - if y >= maxy: - y = maxy - (y - maxy + 1) - yvel[i] = -velocity(i) - if y <= miny: - y = miny + (miny - y + 1) - yvel[i] = velocity(i) - a[head].setPoint(i, x, y) - paint.end() - -def rotate(): - w = 64 - h = 64 - image = TQImage(w, h, 8, 128) - for i in range(128): - image.setColor(i, tqRgb(i,0,0)) - for y in range(h): - for x in range(w): - image.setPixel(x,y,(x+y)%128) - - pm = TQPixmap() - pm.convertFromImage(image) - pm.setOptimization(TQPixmap.BestOptim) - - d = TQApplication.desktop() - - for i in range(0,361,2): - m = TQWMatrix() - m.rotate(i) - rpm = pm.xForm(m) - d.setErasePixmap(rpm) - d.update() - -def generateStone(pm, c1, c2, c3): - p = TQPainter() - p1 = TQPen(c1, 0) - p2 = TQPen(c2, 0) - p3 = TQPen(c3, 0) - - p.begin(pm) - for i in range(pm.width()): - for j in range(pm.height()): - r = kindaRand() - if r < KINDA_RAND_MAX / 3: - p.setPen(p1) - elif r < KINDA_RAND_MAX / 3 * 2: - p.setPen(p2) - else: - p.setPen(p3) - p.drawPoint(i, j) - p.end() - -def drawShadeText(p, x, y, text, topColor, bottomColor, sw=2): - if not p.isActive(): - return - - p.setPen(bottomColor) - p.drawText(x+sw, y+sw, text) - p.setPen(topColor) - p.drawText(x, y, text) - -class DesktopWidget(TQWidget): - def __init__(self, s, parent=None, name=''): - TQWidget.__init__(self, parent, name, TQt.WType_Desktop | TQt.WPaintDesktop) - self.text = s - self.pm = None - - def paintEvent(self, pe): - c1 = self.eraseColor() - c2 = c1.light(104) - c3 = c1.dark(106) - if not self.pm: - self.pm = TQPixmap(64, 64) - generateStone(self.pm, c1, c2, c3) - self.setErasePixmap(self.pm) - self.update() - br = self.fontMetrics().boundingRect(self.text) - offscreen = TQPixmap(br.width(), br.height()) - x = self.width()/2 - br.width()/2 - y = self.height()/2 - br.height()/2 - offscreen.fill(self, x, y) - p = TQPainter() - p.begin(offscreen) - drawShadeText(p, -br.x(), -br.y(), self.text, c2, c3, 3) - p.end() - bitBlt(self, x, y, offscreen) - -def desktopWidget(s='Trolltech'): - t = DesktopWidget(s) - t.update() - tqApp.exec_loop() - -def desktopText(s='Trolltech'): - border = 20 - - c1 = tqApp.palette().normal().background() - c2 = c1.light(104) - c3 = c1.dark(106) - - pm = TQPixmap(10, 10) - p = TQPainter() - p.begin(pm) - r = p.fontMetrics().boundingRect(s) - p.end() - - appWidth = tqApp.desktop().width() - appHeight = tqApp.desktop().height() - if r.width() > appWidth - border*2: - r.setWidth(appWidth - border*2) - if r.height() > appHeight - border*2: - r.setHeight(appHeight - border*2) - - pm.resize(r.size().width()+border*2,r.size().height()+border*2) - generateStone(pm, c1, c2, c3) - p.begin(pm) - drawShadeText(p, -r.x()+border, -r.y()+border, s, c2, c3) - p.end() - - tqApp.desktop().setErasePixmap(pm) - -a = TQApplication(sys.argv) -if len(sys.argv) > 1: - f = TQFont('charter', 96, TQFont.Black) - f.setStyleHint(TQFont.Times) - a.setFont(f) - -validOptions = 0 - -if len(sys.argv) == 2: - validOptions = 1 - if sys.argv[1] == '-poly': - poly() - elif sys.argv[1] == '-rotate': - rotate() - elif sys.argv[1] == '-troll': - desktopText() - elif sys.argv[1] == '-trollwidget': - desktopWidget() - else: - validOptions = 0 - -if len(sys.argv) == 3: - validOptions = 1 - if sys.argv[1] == '-shadetext': - desktopText(sys.argv[2]) - elif sys.argv[1] == '-shadewidget': - desktopWidget(sys.argv[2]) - else: - validOptions = 0 - -if not validOptions: - print("""Usage: -\tdesktop -poly -\tdesktop -rotate -\tdesktop -troll -\tdesktop -trollwidget -\tdesktop -shadetext -\tdesktop -shadewidget """) - rotate() diff --git a/examples3/dirview.py b/examples3/dirview.py deleted file mode 100755 index e6b1f58..0000000 --- a/examples3/dirview.py +++ /dev/null @@ -1,452 +0,0 @@ -#!/usr/bin/env python - -"""************************************************************************** -** $Id: dirview.py,v 1.7 2005/11/14 17:21:26 phil Exp $ -** -** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. -** Some corrections by M. Biermaier (http://www.office-m.at) -** -** This file is part of an example program for TQt. This example -** program may be used, distributed and modified without limitation. -** -***************************************************************************""" - -import sys -from python_tqt.qt import * - -folder_closed_xpm = [ - "16 16 9 1", - "g c #808080", - "b c #c0c000", - "e c #c0c0c0", - "# c #000000", - "c c #ffff00", - ". c None", - "a c #585858", - "f c #a0a0a4", - "d c #ffffff", - "..###...........", - ".#abc##.........", - ".#daabc#####....", - ".#ddeaabbccc#...", - ".#dedeeabbbba...", - ".#edeeeeaaaab#..", - ".#deeeeeeefe#ba.", - ".#eeeeeeefef#ba.", - ".#eeeeeefeff#ba.", - ".#eeeeefefff#ba.", - ".##geefeffff#ba.", - "...##gefffff#ba.", - ".....##fffff#ba.", - ".......##fff#b##", - ".........##f#b##", - "...........####." -] - -folder_open_xpm = [ - "16 16 11 1", - "# c #000000", - "g c #c0c0c0", - "e c #303030", - "a c #ffa858", - "b c #808080", - "d c #a0a0a4", - "f c #585858", - "c c #ffdca8", - "h c #dcdcdc", - "i c #ffffff", - ". c None", - "....###.........", - "....#ab##.......", - "....#acab####...", - "###.#acccccca#..", - "#ddefaaaccccca#.", - "#bdddbaaaacccab#", - ".eddddbbaaaacab#", - ".#bddggdbbaaaab#", - "..edgdggggbbaab#", - "..#bgggghghdaab#", - "...ebhggghicfab#", - "....#edhhiiidab#", - "......#egiiicfb#", - "........#egiibb#", - "..........#egib#", - "............#ee#" -] - -folder_locked = [ - "16 16 10 1", - "h c #808080", - "b c #ffa858", - "f c #c0c0c0", - "e c #c05800", - "# c #000000", - "c c #ffdca8", - ". c None", - "a c #585858", - "g c #a0a0a4", - "d c #ffffff", - "..#a#...........", - ".#abc####.......", - ".#daa#eee#......", - ".#ddf#e##b#.....", - ".#dfd#e#bcb##...", - ".#fdccc#daaab#..", - ".#dfbbbccgfg#ba.", - ".#ffb#ebbfgg#ba.", - ".#ffbbe#bggg#ba.", - ".#fffbbebggg#ba.", - ".##hf#ebbggg#ba.", - "...###e#gggg#ba.", - ".....#e#gggg#ba.", - "......###ggg#b##", - ".........##g#b##", - "...........####." -] - -pix_file = [ - "16 16 7 1", - "# c #000000", - "b c #ffffff", - "e c #000000", - "d c #404000", - "c c #c0c000", - "a c #ffffc0", - ". c None", - "................", - ".........#......", - "......#.#a##....", - ".....#b#bbba##..", - "....#b#bbbabbb#.", - "...#b#bba##bb#..", - "..#b#abb#bb##...", - ".#a#aab#bbbab##.", - "#a#aaa#bcbbbbbb#", - "#ccdc#bcbbcbbb#.", - ".##c#bcbbcabb#..", - "...#acbacbbbe...", - "..#aaaacaba#....", - "...##aaaaa#.....", - ".....##aa#......", - ".......##......." -] - -folderLocked = None -folderClosed = None -folderOpened = None -fileNormal = None - -class FileItem( TQListViewItem ) : - def __init__( self, parent=None, s1=TQString.null, s2=TQString.null ): - TQListViewItem.__init__( self, parent, s1, s2 ) - self.pix = None - - def setPixmap( self, p ) : - self.pix = p - self.setup() - self.widthChanged( 0 ) - self.invalidateHeight() - self.repaint() - - def pixmap( self, i ) : - if i : return None - else : return self.pix; - -# Class Directory -class Directory( TQListViewItem ) : - def __init__( self, parent=None, filename=TQString.null, col2=TQString.null ): - TQListViewItem.__init__( self, parent, filename, col2 ) - self.pix = None - global folderLocked, folderClosed, folderOpened, fileNormal - self.showDirsOnly = False - if isinstance(parent, TQListView): - self.p = None - self.showDirsOnly = parent.showDirsOnly() - self.f = TQFile( TQString('/') ) - else: - self.p = parent - self.showDirsOnly = parent.showDirsOnly - self.f = TQFile( TQString(filename) ) - - self.readable = TQDir( self.fullName() ).isReadable() - if not self.readable : self.setPixmap( folderLocked ) - else : self.setPixmap( folderClosed ) - - def setPixmap( self, px ) : - self.pix = px - self.setup() - self.widthChanged( 0 ) - self.invalidateHeight() - self.repaint() - - def pixmap( self, i ) : - if i : return None - else : return self.pix - - def setOpen( self, o ) : - if o : self.setPixmap( folderOpened ) - else : self.setPixmap( folderClosed ) - - if o and not self.childCount() : - s = TQString( self.fullName() ) - thisDir = TQDir( s ) - if not thisDir.isReadable() : - self.readable = False - self.setExpandable( False ) - return - - self.listView().setUpdatesEnabled( False ) - files = thisDir.entryInfoList() - if files : - fi = TQFileInfo() - for it in files: - fi = it - if str(fi.fileName()) == "." or str(fi.fileName()) == ".." : - continue # nothing - elif fi.isSymLink() and not self.showDirsOnly : - item = FileItem( self, fi.fileName(), "Symbolic Link" ) - item.setPixmap( fileNormal ) - elif fi.isDir() : - Directory( self, fi.fileName() ) - elif not self.showDirsOnly : - if fi.isFile() : item = FileItem( self, fi.fileName(), "File" ) - else : item = FileItem( self, fi.fileName(), "Special" ) - item.setPixmap( fileNormal ) - - self.listView().setUpdatesEnabled( True ) - TQListViewItem.setOpen( self, o ) - - def setup( self ): - self.setExpandable( True ) - TQListViewItem.setup( self ) - - def fullName( self ): - s = TQString() - if self.p : - s = self.p.fullName() - s.append( self.f.name() ) - s.append( "/" ) - else : - s = self.f.name() - return s - - def text( self, column ) : - if column == 0 : return self.f.name() - elif self.readable : return "Directory" - else : return "Unreadable Directory" - -# Class DirectoryView - -class DirectoryView( TQListView ): - def __init__( self, parent=None, name=None, sdo=False ): - TQListView.__init__( self, parent, name ) - self.dirsOnly = sdo - self.oldCurrent = 0 - self.dropItem = 0 - self.presspos = TQPoint(0,0) - self.mousePressed = False - global folderLocked, folderClosed, folderOpened, fileNormal #= TQPixmap() - self.autoopenTime = 750 - - self.autoopen_timer = TQTimer( self ) - if not folderLocked : - folderLocked = TQPixmap( folder_locked ) - folderClosed = TQPixmap( folder_closed_xpm ) - folderOpened = TQPixmap( folder_open_xpm ) - fileNormal = TQPixmap( pix_file ) - - self.connect( self, SIGNAL("doubleClicked(TQListViewItem *)"), - self.slotFolderSelected ) - self.connect( self, SIGNAL("returnPressed(TQListViewItem *)"), - self.slotFolderSelected ) - - self.setAcceptDrops( True ) - self.viewport().setAcceptDrops( True ) - - self.connect( self.autoopen_timer, SIGNAL("timeout()"), self.openFolder ) - - def showDirsOnly( self ): - return self.dirsOnly - - def slotFolderSelected( self, i ): - if not i or not self.showDirsOnly(): - return - dir = i - self.emit( PYSIGNAL("folderSelected(const TQString &)"), (dir.fullName(), ) ) - - def openFolder( self ): - self.autoopen_timer.stop() - if self.dropItem and not self.dropItem.isOpen(): - self.dropItem.setOpen( True ) - self.dropItem.repaint() - - def contentsDragEnterEvent( self, e ): - if not TQUriDrag.canDecode(e) : - e.ignore() - return - self.oldCurrent = self.currentItem() - i = self.itemAt( self.contentsToViewport(e.pos()) ) - if i : - self.dropItem = i - self.autoopen_timer.start( self.autoopenTime ) - - def contentsDragMoveEvent( self, e ) : - if not TQUriDrag.canDecode(e) : - e.ignore() - return - vp = self.contentsToViewport( e.pos() ) - i = self.itemAt( vp ) - if i : - self.setSelected( i, True ) - e.accept() - if i != self.dropItem : - self.autoopen_timer.stop() - self.dropItem = i - self.autoopen_timer.start( self.autoopenTime ) - - if e.action() == TQDropEvent.Copy: - pass - elif e.action() == TQDropEvent.Move: - e.acceptAction() - elif e.action() == TQDropEvent.Link: - e.acceptAction() - else: - pass - else : - e.ignore() - self.autoopen_timer.stop() - self.dropItem = 0 - - def contentsDragLeaveEvent( self, TQDragLeaveEvent ) : - self.autoopen_timer.stop() - self.dropItem = 0 - - self.setCurrentItem( self.oldCurrent ) - self.setSelected( self.oldCurrent, True ) - - def contentsDropEvent( self, e ): - self.autoopen_timer.stop() - if not TQUriDrag.canDecode(e) : - e.ignore() - return - item = self.itemAt( self.contentsToViewport(e.pos()) ) - if item : - lst = TQStringList() - TQUriDrag.decodeLocalFiles( e, lst ) - if e.action() == TQDropEvent.Copy: - s = TQString("Copy") - elif e.action() == TQDropEvent.Move: - s = TQString("Move") - e.acceptAction() - elif e.action() == TQDropEvent.Link: - s = TQString("Link") - e.acceptAction() - else: - s = TQString("Unknown") - - s += "\n\n" - e.accept() - - for filename in lst: - s += filename - s += "\n" - - s += "\nTo\n\n " - s += self.fullPath(item) - TQMessageBox.information( self, "Drop target", s, "Not implemented" ) - else : - e.ignore() - - def fullPath( self, item ): - fullpath = TQString( item.text(0) ) - item = item.parent() - while item: - newpath = item.text(0) - - if item.parent(): - newpath += "/" - - newpath += fullpath - fullpath = newpath - item = item.parent() - - return fullpath - - def contentsMousePressEvent( self, e ) : - TQListView.contentsMousePressEvent( self, e ) - p = TQPoint( self.contentsToViewport( e.pos() ) ) - i = self.itemAt( p ) - if i : - # if the user clicked into the root decoration of the item, don't try to start a drag! - if self.rootIsDecorated(): isdecorated = 1 - else : isdecorated = 0 - if p.x() > self.header().sectionPos( self.header().mapToIndex( 0 )) + self.treeStepSize() * ( i.depth() + isdecorated + self.itemMargin() or - p.x() < self.header().sectionPos( self.header().mapToIndex( 0 ) ) ) : - self.presspos.setX(e.pos().x()) - self.presspos.setY(e.pos().y()) - self.mousePressed = True - - def contentsMouseMoveEvent( self, e ): - offset = TQPoint( self.presspos.x() - e.pos().x(), - self.presspos.y() - e.pos().y() ) - if self.mousePressed and (offset).manhattanLength() > TQApplication.startDragDistance() : - self.mousePressed = False - item = self.itemAt( self.contentsToViewport(self.presspos) ) - if item : - source = self.fullPath(item) - if TQFile.exists(source) : - ud = TQUriDrag(self.viewport()) - ud.setFileNames( TQStringList (source) ) - if ud.drag() : - TQMessageBox.information( self, "Drag source", - TQString("Delete ")+source, "Not implemented" ) - - def contentsMouseReleaseEvent( self, TQMouseEvent ): - self.mousePressed = False - - def setDir( self, s ): - it = TQListViewItem( self ) - it.setOpen(False) - thisDir = TQDir( s ) - it = TQListViewItem( self ) - it.setOpen(False) - lst = TQStringList( TQStringList.split( "/", s ) ) - listview2 = [] - listview2.extend( lst ) - - item = self.firstChild() - for it2 in listview2 : - while item : - if item.text( 0 ) == it2 : - item.setOpen( True ) - break - item = item.itemBelow() - if item: - self.setCurrentItem( item ) - -def main( args ): - a = TQApplication( args ) - - mw = DirectoryView() - mw.addColumn( "Name" ) - mw.addColumn( "Type" ) - mw.setTreeStepSize( 20 ) - - roots = TQDir.drives() - if roots : - for it in roots: - fi = it - root = Directory( mw, fi.filePath() ) - if roots.count(it) <= 1 : - root.setOpen( True ) # be interesting - - mw.resize( 400, 400 ) - mw.setCaption( "TQt Example - Directory Browser" ) - mw.setAllColumnsShowFocus( True ) - a.setMainWidget( mw ) - mw.show() - - a.exec_loop() - -if __name__=="__main__": - main(sys.argv) diff --git a/examples3/dragdrop.py b/examples3/dragdrop.py deleted file mode 100755 index a715170..0000000 --- a/examples3/dragdrop.py +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env python - -# Ported to PyTQt by Issac Trotts on Jan 1, 2002 - -import sys -from python_tqt.qt import * - -import dropsite, secret - - -def addStuff( parent, yn_image, yn_secret = 0 ): - tll = TQVBoxLayout( parent, 10 ) - d = dropsite.DropSite( parent, 'dropsite' ) - d.setFrameStyle( TQFrame.Sunken + TQFrame.WinPanel ) - tll.addWidget( d ) - if yn_image: - stuff = TQPixmap() - if not stuff.load( "trolltech.bmp" ): - stuff = TQPixmap(20,20) - stuff.fill(TQt.green) - d.setPixmap( stuff ) - else: - d.setText("Drag and Drop") - d.setFont(TQFont("Helvetica",18)) - if secret: - s = secret.SecretSource( 42, parent ) - tll.addWidget( s ) - - format = TQLabel( "\n\n\n\nNone\n\n\n\n", parent ) - tll.addWidget( format ) - tll.activate() - parent.resize( parent.sizeHint() ) - - TQObject.connect( d, PYSIGNAL('message(TQString &)'), - format, SLOT('setText(TQString &)') ) - - -app = TQApplication( sys.argv ) - -mw = TQWidget() -addStuff( mw, 1 ) -mw.setCaption( "TQt Example - Drag and Drop" ) -mw.show() - -mw2 = TQWidget() -addStuff( mw2, 0 ) -mw2.setCaption( "TQt Example - Drag and Drop" ) -mw2.show() - -mw3 = TQWidget() -addStuff( mw3, 1, 1 ) -mw3.setCaption( "TQt Example - Drag and Drop" ) -mw3.show() - -TQObject.connect(tqApp,SIGNAL('lastWindowClosed()'),tqApp,SLOT('quit()')) - -app.exec_loop() diff --git a/examples3/drawlines.py b/examples3/drawlines.py deleted file mode 100755 index c1553f2..0000000 --- a/examples3/drawlines.py +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/env python - -import sys, random -from python_tqt.qt import * - -TRUE = 1 -FALSE = 0 - -MAXPOINTS = 2000; # maximum number of points -MAXCOLORS = 40; - -# -# ConnectWidget - draws connected lines -# - -class ConnectWidget(TQWidget): - def __init__(self): - TQWidget.__init__(self) - self.setEraseColor( TQt.white ) # white background - self.count = 0; - self.down = FALSE - - self.points = [] - self.colors = [] - - for i in range(MAXPOINTS): # init arrays - self.points.append(TQPoint()) - for i in range(MAXCOLORS): - self.colors.append(TQColor( random.randint(0,255), random.randint(0,255), random.randint(0,255) )) - -# -# Handles paint events for the connect widget. -# - def paintEvent(self, pe): - paint = TQPainter( self ) - for i in range(self.count-1): # connect all points - for j in range(i+1, self.count): - paint.setPen( self.colors[random.randint(0,MAXCOLORS-1)] ) # set random pen color - paint.drawLine( self.points[i], self.points[j] ) # draw line - -# -# Handles mouse press events for the connect widget. -# - def mousePressEvent(self, me): - self.down = TRUE - self.count = 0 # start recording points - self.erase() # erase widget contents - -# -# Handles mouse release events for the connect widget. -# - def mouseReleaseEvent(self, me ): - self.down = FALSE # done recording points - self.update() # draw the lines - -# -# Handles mouse move events for the connect widget. -# - def mouseMoveEvent(self, me): - if self.down and self.count < MAXPOINTS: - paint = TQPainter( self ) - self.points[self.count] = TQPoint(me.pos()) # add point - paint.drawPoint( me.pos() ) # plot point - self.count = self.count+1 - -# -# Create and display a ConnectWidget. -# -a = TQApplication( sys.argv ) -connect = ConnectWidget() -connect.setCaption( "PyTQt Example - Draw lines") -a.setMainWidget( connect ) -connect.show() -a.exec_loop() diff --git a/examples3/dropsite.py b/examples3/dropsite.py deleted file mode 100644 index 8581e0e..0000000 --- a/examples3/dropsite.py +++ /dev/null @@ -1,96 +0,0 @@ -# This is part of the dragdrop example. - - -from python_tqt.qt import * - -import secret - - -class DropSite(TQLabel): - def __init__(self, parent=None, name=None): - TQLabel.__init__( self, parent, name ) - self.setAcceptDrops(1) - - # this is a normal event - def mousePressEvent( self, e ): - if ( self.pixmap() ) : - drobj = TQImageDrag( self.pixmap().convertToImage(), self ) - pm = TQPixmap() - pm.convertFromImage(self.pixmap().convertToImage().smoothScale( - self.pixmap().width()/3,self.pixmap().height()/3)) - drobj.setPixmap(pm,TQPoint(-5,-7)) - else : - drobj = TQTextDrag( self.text(), self ) - drobj.dragCopy() - - def backgroundColorChange( self, qcolor ): - # Reduce flicker by using repaint() rather than update() - self.repaint() - - def dragMoveEvent( self, e ): - # Check if you want the drag at e.pos()... - # Give the user some feedback... - pass - - def dragEnterEvent( self, e ): - # Check if you want the drag... - if (secret.canDecode( e ) or - TQTextDrag.canDecode( e ) or - TQImageDrag.canDecode( e ) or - TQUriDrag.canDecode( e )): - e.accept() - - # Give the user some feedback... - t = '' - i = 0 - while e.format( i ): - if ( t != '' ): - t += "\n" - t += str(e.format( i )) - i += 1 - self.emit(PYSIGNAL('message(TQString &)'), (TQString(t),)) - self.setEraseColor(TQt.white) - - def dragLeaveEvent( self, TQDragLeaveEvent ): - # Give the user some feedback... - self.emit(PYSIGNAL('message(TQString &)'), (TQString(''),)) - self.setEraseColor(TQt.lightGray) - - def dropEvent( self, e ): - self.setEraseColor(TQt.lightGray) - # Try to decode to the data you understand... - str = TQString() - if ( TQTextDrag.decode( e, str ) ) : - self.setText( str ) - self.setMinimumSize( self.minimumSize().expandedTo(self.sizeHint()) ) - return - - pm = TQPixmap() - if ( TQImageDrag.decode( e, pm ) ) : - self.setPixmap( pm ) - self.setMinimumSize(self.minimumSize().expandedTo(self.sizeHint())) - return - - # TQStrList strings - #strings = TQStrList() - strings = [] - if ( TQUriDrag.decode( e, strings ) ) : - m = TQString("Full URLs:\n") - for u in strings: - m = m + " " + u + '\n' - # TQStringList files - files = [] - if ( TQUriDrag.decodeLocalFiles( e, files ) ) : - m += "Files:\n" - # for (TQStringList.Iterator i=files.begin() i!=files.end() ++i) - for i in files: - m = m + " " + i + '\n' - self.setText( m ) - self.setMinimumSize(self.minimumSize().expandedTo(self.sizeHint())) - return - - str = secret.decode( e ) - if str: - self.setText( str ) - self.setMinimumSize(self.minimumSize().expandedTo(self.sizeHint())) - return diff --git a/examples3/fileopen.xpm b/examples3/fileopen.xpm deleted file mode 100644 index 880417e..0000000 --- a/examples3/fileopen.xpm +++ /dev/null @@ -1,22 +0,0 @@ -/* XPM */ -static const char *fileopen[] = { -" 16 13 5 1", -". c #040404", -"# c #808304", -"a c None", -"b c #f3f704", -"c c #f3f7f3", -"aaaaaaaaa...aaaa", -"aaaaaaaa.aaa.a.a", -"aaaaaaaaaaaaa..a", -"a...aaaaaaaa...a", -".bcb.......aaaaa", -".cbcbcbcbc.aaaaa", -".bcbcbcbcb.aaaaa", -".cbcb...........", -".bcb.#########.a", -".cb.#########.aa", -".b.#########.aaa", -"..#########.aaaa", -"...........aaaaa" -}; diff --git a/examples3/fontdisplayer.py b/examples3/fontdisplayer.py deleted file mode 100755 index 1f616bf..0000000 --- a/examples3/fontdisplayer.py +++ /dev/null @@ -1,148 +0,0 @@ -#!/usr/bin/env python - -"""************************************************************************** -** $Id: fontdisplayer.py,v 1.2 2004/07/19 18:41:53 phil Exp $ -** -** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. -** -** This file is part of an example program for TQt. This example -** program may be used, distributed and modified without limitation. -** -***************************************************************************""" - -import sys -from python_tqt.qt import * - -class FontRowTable( TQFrame ): - def __init__( self, parent=None, name=None ): - TQFrame.__init__( self, parent, name ) - - self.setBackgroundMode(self.PaletteBase) - self.setFrameStyle(self.Panel|self.Sunken) - self.setMargin(8) - self.setRow(0) - self.row = 0 - self.tablefont = TQFont( TQApplication.font() ) - - def sizeHint( self ) : - width = 16*self.cellSize().width()+TQSize(2,2).width()*(self.margin()+self.frameWidth()) - height = 16*self.cellSize().height()+TQSize(2,2).height()*(self.margin()+self.frameWidth()) - return TQSize(width,height) - - def cellSize( self ) : - fm = self.fontMetrics() - return TQSize( fm.maxWidth(), fm.lineSpacing() + 1 ) - - def paintEvent( self, e ): - TQFrame.paintEvent(self, e) - p = TQPainter(self) - p.setClipRegion(e.region()) - r = TQRect(e.rect()) - fm = self.fontMetrics() - ml = self.frameWidth() + self.margin() + 1 + max(0,-fm.minLeftBearing()) - mt = self.frameWidth() + self.margin() - cell = TQSize(int((self.width()-15-ml)/16),int((self.height()-15-mt)/16)) - - if not cell.width() or not cell.height() : - return - - mini = int(r.left() / cell.width()) - maxi = int((r.right()+cell.width()-1) / cell.width()) - minj = int(r.top() / cell.height()) - maxj = int((r.bottom()+cell.height()-1) / cell.height()) - - h = fm.height() - - body = TQColor(255,255,192); - negative = TQColor(255,192,192); - positive = TQColor(192,192,255); - rnegative = TQColor(255,128,128); - rpositive = TQColor(128,128,255); - - for j in range(minj, maxj+1, 1) : - for i in range(mini, maxi+1, 1) : - if i < 16 and j < 16 : - x = i*cell.width() - y = j*cell.height() - - ch = TQChar(j*16+i) #,self.row) # just accept one argument!!! - - if fm.inFont(ch) : - w = fm.width(ch) - l = fm.leftBearing(ch) - r = fm.rightBearing(ch) - - x += ml - y += mt+h - - p.fillRect(x,y,w,-h,TQBrush(body)) - - if w : - if l : - if l < 0: sign = negative - else: sign = positive - if l > 0: lsign = 0 - else: lsign = 1 - p.fillRect(x+lsign, int(y-h/2), abs(l),int(-h/2), TQBrush(sign)) - if r : - if r < 0: sign = rnegative - else: sign = rpositive - if r > 0: rsign = r - else: rsign = 0 - p.fillRect(int(x+w-rsign),y+2, abs(r),int(-h/2), TQBrush(sign)) - s = TQString( ch ) - p.setPen(TQPen(TQt.black)) - p.drawText(x,y,s) - - def setRow( self, r ) : - self.row = r - - fm = self.fontMetrics() - str = " minLB=%d minRB=%d maxW=%d" % (fm.minLeftBearing(), fm.minRightBearing(), fm.maxWidth()) - self.emit( PYSIGNAL("fontInformation"), ( TQString(str), ) ) - self.update() - - def chooseFont( self ) : - ok = 0 - oldfont = TQFont( self.tablefont ) - self.tablefont, ok = TQFontDialog.getFont(oldfont, self) - if ok: - self.setFont(self.tablefont) - else: - self.tablefont = oldfont - -class FontDisplayer( TQMainWindow ) : - def __init__( self, parent=None, name=None ): - TQMainWindow.__init__( self, parent, name ) - table = FontRowTable(self) - controls = TQToolBar(self) - - TQLabel(self.tr("Row:"), controls) - self.row = TQSpinBox(0,255,1,controls) - controls.addSeparator() - fontbutton = TQPushButton(self.tr("Font..."), controls) - status = TQStatusBar(self) - - self.connect( self.row, SIGNAL("valueChanged(int)"), table.setRow ) - self.connect( fontbutton, SIGNAL("clicked()"), table.chooseFont ) - self.connect( table, PYSIGNAL("fontInformation"), - status, SLOT("message(const TQString&)") ) - table.setRow(0) - self.setCentralWidget(table) - -def main( args ): - # Use an interesting font - TQApplication.setFont(TQFont("unifont",16)) - app = TQApplication(sys.argv) - - m = FontDisplayer() - sh = TQSize( m.centralWidget().sizeHint() ) - m.resize(sh.width(), sh.height() + 3 * m.statusBar().height()) - app.setMainWidget(m); - m.setCaption("TQt Example - TQFD"); - m.show() - - app.exec_loop() - -if __name__=="__main__": - main(sys.argv) diff --git a/examples3/fonts.py b/examples3/fonts.py deleted file mode 100755 index 145b815..0000000 --- a/examples3/fonts.py +++ /dev/null @@ -1,149 +0,0 @@ -#!/usr/bin/env python - -"""************************************************************************** -** $Id: fonts.py,v 1.1 2003/07/01 14:18:37 phil Exp $ -** -** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. -** -** This file is part of an example program for TQt. This example -** program may be used, distributed and modified without limitation. -** -***************************************************************************""" - -import sys -from python_tqt.qt import * - -class Viewer( TQWidget ): - def __init__( self ): - TQWidget.__init__( self ) - - self.setFontSubstitutions() - - greeting_heb = TQString.fromUtf8( b"\327\251\327\234\327\225\327\235" ) - greeting_ru = TQString.fromUtf8( b"\320\227\320\264\321\200\320\260\320\262\321\201\321\202\320\262\321\203\320\271\321\202\320\265" ) - greeting_en = "Hello" - - self.greetings = TQTextView( self, "textview" ) - - self.greetings.setText( greeting_en + "\n" + - greeting_ru + "\n" + - greeting_heb ) - - self.fontInfo = TQTextView( self, "fontinfo" ) - - self.setDefault() - - self.defaultButton = TQPushButton( "Default", self, "pushbutton1" ) - self.defaultButton.setFont( TQFont( "times" ) ) - self.connect( self.defaultButton, SIGNAL("clicked()"), self.setDefault ) - - self.sansSerifButton = TQPushButton( "Sans Serif", self, "pushbutton2" ) - self.sansSerifButton.setFont( TQFont( "Helvetica", 12 ) ) - self.connect( self.sansSerifButton, SIGNAL("clicked()"), self.setSansSerif ) - - self.italicsButton = TQPushButton( "Italics", self, "pushbutton3" ) - self.italicsButton.setFont( TQFont( "lucida", 12, TQFont.Bold, True ) ) - self.connect( self.italicsButton, SIGNAL("clicked()"), self.setItalics ) - - self.layout() - - def setDefault( self ): - font = TQFont( "Bavaria" ) - font.setPointSize( 24 ) - font.setWeight( TQFont.Bold ) - font.setUnderline( True ) - - self.greetings.setFont( font ) - - self.showFontInfo( font ) - - def setSansSerif( self ): - font = TQFont( "Newyork", 18 ) - font.setStyleHint( TQFont.SansSerif ) - - self.greetings.setFont( font ) - - self.showFontInfo( font ) - - def setItalics( self ): - font = TQFont( "Tokyo" ) - font.setPointSize( 32 ) - font.setWeight( TQFont.Bold ) - font.setItalic( True ) - - self.greetings.setFont( font ) - - self.showFontInfo( font ) - - def showFontInfo( self, font ): - info = TQFontInfo( font ) - - messageText = "Font requested: \"" + str(font.family()) + "\" " \ - + str(TQString.number( font.pointSize() )) + "pt
" \ - + "Font used: \"" + str(info.family()) + "\" " \ - + str(TQString.number( info.pointSize() )) + "pt

" - - if not self.substitutes.isEmpty() : - messageText += "The following substitutions exist for " + \ - str(font.family()) + ":

    " - for i in self.substitutes : - messageText += "
  • \"" + str(i) + "\"" - messageText += "
"; - else : - messageText += "No substitutions exist for " + \ - str(font.family()) + "." - - self.fontInfo.setText( messageText ) - - def setFontSubstitutions( self ): - self.substitutes = TQStringList() - self.substitutes.append( "Times" ) - self.substitutes.append( "Mincho" ) - self.substitutes.append( "Arabic Newspaper" ) - self.substitutes.append( "crox" ) - #TQFont.insertSubstitutions( "Bavaria", self.substitutes ) - TQFont.insertSubstitution( "Bavaria", "Times" ) - TQFont.insertSubstitution( "Tokyo", "Lucida" ) - - # For those who prefer to use TQt Designer for creating GUIs - # the following function might not be of particular interest: - # all it does is creating the widget layout. - def layout( self ): - textViewContainer = TQHBoxLayout() - textViewContainer.addWidget( self.greetings ) - textViewContainer.addWidget( self.fontInfo ) - - buttonContainer = TQHBoxLayout() - buttonContainer.addWidget( self.defaultButton ) - buttonContainer.addWidget( self.sansSerifButton ) - buttonContainer.addWidget( self.italicsButton ) - - maxButtonHeight = self.defaultButton.height() - - if self.sansSerifButton.height() > maxButtonHeight : - maxButtonHeight = self.sansSerifButton.height() - if self.italicsButton.height() > maxButtonHeight : - maxButtonHeight = self.italicsButton.height() - - self.defaultButton.setFixedHeight( maxButtonHeight ) - self.sansSerifButton.setFixedHeight( maxButtonHeight ) - self.italicsButton.setFixedHeight( maxButtonHeight ) - - container = TQVBoxLayout( self ) - container.addLayout( textViewContainer ) - container.addLayout( buttonContainer ) - - self.resize( 700, 250 ) - -def main( args ): - app = TQApplication(sys.argv) # application object - - textViewer = Viewer() - textViewer.setCaption( "TQt Example - Simple TQFont Demo" ) - app.setMainWidget( textViewer ) - textViewer.show() - - app.exec_loop() - -if __name__=="__main__": - main(sys.argv) diff --git a/examples3/gears.py b/examples3/gears.py deleted file mode 100755 index e98df55..0000000 --- a/examples3/gears.py +++ /dev/null @@ -1,235 +0,0 @@ -#!/usr/bin/env python - - -import sys -import math -from python_tqt.qt import * -from python_tqt.qtgl import * -from OpenGL.GL import * - -def gear(inner_radius,outer_radius,width,teeth,tooth_depth): - r0 = inner_radius - r1 = outer_radius - tooth_depth/2.0 - r2 = outer_radius + tooth_depth/2.0 - - da = 2.0*math.pi/teeth/4.0 - - glShadeModel(GL_FLAT) - - glNormal3f(0.0,0.0,1.0) - - # draw front face - - glBegin(GL_QUAD_STRIP) - - for i in range(teeth+1): - angle = i * 2.0*math.pi/teeth - glVertex3f(r0*math.cos(angle), r0*math.sin(angle), width*0.5 ) - glVertex3f(r1*math.cos(angle), r1*math.sin(angle), width*0.5 ) - glVertex3f(r0*math.cos(angle), r0*math.sin(angle), width*0.5 ) - glVertex3f(r1*math.cos(angle+3*da), r1*math.sin(angle+3*da), width*0.5 ) - - glEnd() - - # draw front sides of teeth - - da = 2.0*math.pi/teeth/4.0 - - glBegin(GL_QUADS) - - for i in range(teeth): - angle = i*2.0*math.pi/teeth - - glVertex3f( r1*math.cos(angle), r1*math.sin(angle), width*0.5 ) - glVertex3f( r2*math.cos(angle+da), r2*math.sin(angle+da), width*0.5 ) - glVertex3f( r2*math.cos(angle+2*da), r2*math.sin(angle+2*da), width*0.5 ) - glVertex3f( r1*math.cos(angle+3*da), r1*math.sin(angle+3*da), width*0.5 ) - - glEnd() - - - glNormal3f( 0.0, 0.0, -1.0 ) - - # draw back face - - glBegin( GL_QUAD_STRIP ) - - for i in range(teeth+1): - angle = i*2.0*math.pi/teeth - - glVertex3f( r1*math.cos(angle), r1*math.sin(angle), -width*0.5 ) - glVertex3f( r0*math.cos(angle), r0*math.sin(angle), -width*0.5 ) - glVertex3f( r1*math.cos(angle+3*da), r1*math.sin(angle+3*da), -width*0.5 ) - glVertex3f( r0*math.cos(angle), r0*math.sin(angle), -width*0.5 ) - - glEnd() - - # draw back sides of teeth - - da = 2.0*math.pi/teeth/4.0 - - glBegin( GL_QUADS ) - - for i in range(teeth): - angle = i*2.0*math.pi/teeth - - glVertex3f( r1*math.cos(angle+3*da), r1*math.sin(angle+3*da), -width*0.5 ) - glVertex3f( r2*math.cos(angle+2*da), r2*math.sin(angle+2*da), -width*0.5 ) - glVertex3f( r2*math.cos(angle+da), r2*math.sin(angle+da), -width*0.5 ) - glVertex3f( r1*math.cos(angle), r1*math.sin(angle), -width*0.5 ) - - glEnd() - - # draw outward faces of teeth - - glBegin( GL_QUAD_STRIP ) - - for i in range(teeth): - angle = i*2.0*math.pi/teeth - - glVertex3f( r1*math.cos(angle), r1*math.sin(angle), width*0.5 ) - glVertex3f( r1*math.cos(angle), r1*math.sin(angle), -width*0.5 ) - - u = r2*math.cos(angle+da) - r1*math.cos(angle) - v = r2*math.sin(angle+da) - r1*math.sin(angle) - - len = math.sqrt( u*u + v*v ) - u /= len - v /= len - glNormal3f( v, -u, 0.0 ) - glVertex3f( r2*math.cos(angle+da), r2*math.sin(angle+da), width*0.5 ) - glVertex3f( r2*math.cos(angle+da), r2*math.sin(angle+da), -width*0.5 ) - glNormal3f( math.cos(angle), math.sin(angle), 0.0 ) - glVertex3f( r2*math.cos(angle+2*da), r2*math.sin(angle+2*da), width*0.5 ) - glVertex3f( r2*math.cos(angle+2*da), r2*math.sin(angle+2*da), -width*0.5 ) - u = r1*math.cos(angle+3*da) - r2*math.cos(angle+2*da) - v = r1*math.sin(angle+3*da) - r2*math.sin(angle+2*da) - glNormal3f( v, -u, 0.0 ) - glVertex3f( r1*math.cos(angle+3*da), r1*math.sin(angle+3*da), width*0.5 ) - glVertex3f( r1*math.cos(angle+3*da), r1*math.sin(angle+3*da), -width*0.5 ) - glNormal3f( math.cos(angle), math.sin(angle), 0.0 ) - - glVertex3f( r1*math.cos(0.0), r1*math.sin(0.0), width*0.5 ) - glVertex3f( r1*math.cos(0.0), r1*math.sin(0.0), -width*0.5 ) - - glEnd() - - glShadeModel (GL_SMOOTH) - - # draw inside radius cylinder - - glBegin( GL_QUAD_STRIP ) - - for i in range(teeth+1): - angle = i * 2.0*math.pi / teeth - glNormal3f( -math.cos(angle), -math.sin(angle), 0.0 ) - glVertex3f( r0*math.cos(angle), r0*math.sin(angle), -width*0.5 ) - glVertex3f( r0*math.cos(angle), r0*math.sin(angle), width*0.5 ) - - glEnd() - -############################################################################## -class GearWidget(TQGLWidget): - def __init__(self,parent=None,name=None): - TQGLWidget.__init__(self,parent,name) - - self.angle=0.0 - self.view_rotx=0.0 - self.view_roty=0.0 - self.view_rotz=0.0 - - self.startTimer(10) - - def timerEvent(self,event): - self.updateGL() - - def paintGL(self): - self.angle = self.angle + 2.0 - self.view_rotx = self.view_rotx + 1.0 - self.view_roty = self.view_roty + 3.0 - self.view_rotz = self.view_rotz + 2.0 - - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ) - - glPushMatrix() - glRotatef( self.view_rotx, 1.0, 0.0, 0.0 ) - glRotatef( self.view_roty, 0.0, 1.0, 0.0 ) - glRotatef( self.view_rotz, 0.0, 0.0, 1.0 ) - - glPushMatrix() - glTranslatef( -3.0, -2.0, 0.0 ) - glRotatef( self.angle, 0.0, 0.0, 1.0 ) - glCallList(self.gear1) - glPopMatrix() - - glPushMatrix() - glTranslatef( 3.1, -2.0, 0.0 ) - glRotatef( -2.0*self.angle-9.0, 0.0, 0.0, 1.0 ) - glCallList(self.gear2) - glPopMatrix() - - glPushMatrix() - glTranslatef( -3.1, 2.2, -1.8 ) - glRotatef( 90.0, 1.0, 0.0, 0.0 ) - glRotatef( 2.0*self.angle-2.0, 0.0, 0.0, 1.0 ) - glCallList(self.gear3) - glPopMatrix() - - glPopMatrix() - - def resizeGL(self,width,height): - w = width / float(height) - h = 1.0 - - glViewport( 0, 0, width, height ) - glMatrixMode(GL_PROJECTION) - glLoadIdentity() - glFrustum( -w, w, -h, h, 5.0, 60.0 ) - glMatrixMode(GL_MODELVIEW) - glLoadIdentity() - glTranslatef( 0.0, 0.0, -40.0 ) - - def initializeGL(self): - pos=(5.0, 5.0, 10.0, 1.0 ) - ared=(0.8, 0.1, 0.0, 1.0 ) - agreen=(0.0, 0.8, 0.2, 1.0 ) - ablue=(0.2, 0.2, 1.0, 1.0 ) - - glLightfv(GL_LIGHT0,GL_POSITION,pos) - glEnable(GL_CULL_FACE) - glEnable(GL_LIGHTING) - glEnable(GL_LIGHT0) - glEnable(GL_DEPTH_TEST) - - self.gear1=glGenLists(1) - glNewList(self.gear1,GL_COMPILE) - glMaterialfv(GL_FRONT,GL_AMBIENT_AND_DIFFUSE,ared) - gear(1.0,4.0,1.0,20,0.7) - glEndList() - - self.gear2=glGenLists(1) - glNewList(self.gear2,GL_COMPILE) - glMaterialfv(GL_FRONT,GL_AMBIENT_AND_DIFFUSE,agreen) - gear(0.5,2.0,2.0,10,0.7) - glEndList() - - self.gear3=glGenLists(1) - glNewList(self.gear3,GL_COMPILE) - glMaterialfv(GL_FRONT,GL_AMBIENT_AND_DIFFUSE,ablue) - gear(1.3,2.0,0.5,10,0.7) - glEndList() - - glEnable(GL_NORMALIZE) - -############################################################################## -if __name__=='__main__': - TQApplication.setColorSpec(TQApplication.CustomColor) - app=TQApplication(sys.argv) - - if not TQGLFormat.hasOpenGL(): - raise Exception('No TQt OpenGL support.') - - widget=GearWidget() - app.setMainWidget(widget) - widget.show() - app.exec_loop() diff --git a/examples3/i18n/i18n.pro b/examples3/i18n/i18n.pro deleted file mode 100644 index fc55895..0000000 --- a/examples3/i18n/i18n.pro +++ /dev/null @@ -1,15 +0,0 @@ -SOURCES = mywidget.py \ - i18n.py - -TRANSLATIONS = mywidget_cs.ts \ - mywidget_de.ts \ - mywidget_el.ts \ - mywidget_en.ts \ - mywidget_eo.ts \ - mywidget_fr.ts \ - mywidget_it.ts \ - mywidget_jp.ts \ - mywidget_ko.ts \ - mywidget_no.ts \ - mywidget_ru.ts \ - mywidget_zh.ts diff --git a/examples3/i18n/i18n.py b/examples3/i18n/i18n.py deleted file mode 100755 index b4dc42a..0000000 --- a/examples3/i18n/i18n.py +++ /dev/null @@ -1,147 +0,0 @@ -#!/usr/bin/env python - -# Copyright (c) 2002 Detlev Offenbach - -from whrandom import randint -import sys - -from python_tqt.qt import * - -from mywidget import MyWidget - -class TQVDialog(TQDialog): - def __init__(self, parent=None, name=None, modal=0, flags=0): - TQDialog.__init__(self, parent, name, modal, flags) - - self.vb = TQVBoxLayout(self, 8) - self.vb.setAutoAdd(1) - - self.hb = None - self.map = {} - #self.sm = TQSignalMapper(self) - self.connect(self, PYSIGNAL('mapped(int)'), self.done) - - def addButtons(self, cancel=None, ok=None, mid1=None, mid2=None, mid3=None): - if ok is None: - self.addButton(self.tr("OK"),1) - else: - self.addButton(ok,1) - - if mid1 is not None: - self.addButton(mid1,2) - - if mid2 is not None: - self.addButton(mid2,3) - - if mid3 is not None: - self.addButton(mid3,4) - - if cancel is None: - self.addButton(self.tr('Cancel'),0) - else: - self.addButton(cancel,0) - - def addButton(self, text, result): - if self.hb is None: - self.hb = TQHBox(self) - c = TQPushButton(text, self.hb) - self.setMapping(c, result) - self.connect(c, SIGNAL('clicked()'), self.mapit) - - def setMapping(self, c, result): - self.map[c] = result - - def mapit(self): - qo = self.sender() - self.emit(PYSIGNAL('mapped(int)'), (self.map[qo],)) - -translator = None -wlist = [] # keep reference to widgets - -def showLang(lang): - global translator - - tqApp.setPalette(TQPalette(TQColor(220-randint(0,64),220-randint(0,64),220-randint(0,64)))) - - language = "mywidget_"+lang+".qm" - fi = TQFileInfo(language) - - if not fi.exists(): - TQMessageBox.warning(None, "File error", - "Cannot find translation for language: "+lang+\ - "\n(try eg. 'de' or 'en')") - return None - - if translator is not None: - tqApp.removeTranslator(translator) - translator = None - - translator = TQTranslator(None) - translator.load(language,".") - tqApp.installTranslator(translator) - m = MyWidget() - m.setCaption("PyTQt Example - i18n - " + str(m.caption())) - wlist.append(m) - return m - -def main(argv): - app = TQApplication(argv) - - qm = ["cs", "de", "el", "en", "eo", "fr", "it", "jp", "ko", "no", "ru", "zh"] - - lang = None - if len(argv) == 2: - lang = argv[1] - - if (len(argv) != 2) or (lang == "all"): - dlg = TQVDialog(None, None, 1) - qmb = [] - r = 0 - if lang == "all": - r=2 - else: - bg = TQButtonGroup(4, TQt.Vertical, "Choose Locales", dlg) - loc = TQTextCodec.locale() - for i in range(0,len(qm)): - qmb.append(TQCheckBox(qm[i], bg)) - qmb[i].setChecked(str(loc) == qm[i]) - dlg.addButtons("Cancel","OK","All") - r = dlg.exec_loop() - - if r: - tight = tqApp.desktop().screen().width < 1024 - x = 5 - y = 25 - for i in range(0,len(qm)): - if (r == 2) or (qmb[i].isChecked()): - w = showLang(qm[i]) - - if w == None: - sys.exit(0) - - app.connect(app, SIGNAL('lastWindowClosed()'), tqApp, SLOT('quit()')) - w.setGeometry(x,y,197,356) - w.show() - if tight: - x += 8 - y += 8 - else: - x += 205 - if x > 1000: - x = 5 - y += 384 - - else: - sys.exit(0) - - else: - lang = argv[1] - m = showLang(lang) - app.setMainWidget(m) - m.setCaption("PyTQt Example - i18n") - m.show() - - return app.exec_loop() - -if __name__ == "__main__": - main(sys.argv) diff --git a/examples3/i18n/mywidget.py b/examples3/i18n/mywidget.py deleted file mode 100644 index 8013c1c..0000000 --- a/examples3/i18n/mywidget.py +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright (c) 2002 Detlev Offenbach - -from python_tqt.qt import * - -class MyWidget(TQMainWindow): - - def __init__(self, parent=None, name=None): - TQMainWindow.__init__(self, parent, name) - - self.central = TQVBox(self) - self.central.setMargin(5) - self.central.setSpacing(5) - self.setCentralWidget(self.central) - - self.setCaption(self.trUtf8("""Internationalization Example""")) - - self.file = TQPopupMenu(self) - self.file.insertItem(self.trUtf8("E&xit"), tqApp, SLOT("quit()"), - TQKeySequence(self.trUtf8("Ctrl+Q","File|Quit"))) - self.menuBar().insertItem(self.trUtf8("&File"), self.file) - - self.statusBar().message(self.trUtf8('''Language: English''')) - - self.label = TQLabel(self.trUtf8("The Main Window"), self.central) - - self.gbox = TQButtonGroup(1, TQGroupBox.Horizontal, - self.trUtf8("View"), self.central) - rb = TQRadioButton(tqApp.translate('MyWidget','Perspective'), self.gbox) - rb = TQRadioButton(tqApp.translate('MyWidget','Isometric'), self.gbox) - rb = TQRadioButton(tqApp.translate('MyWidget','Oblique'), self.gbox) - - self.initChoices(self.central) - - choices = [ - QT_TRANSLATE_NOOP("MyWidget", "First"), - QT_TRANSLATE_NOOP("MyWidget", "Second"), - QT_TRANSLATE_NOOP("MyWidget", "Third") - ] - - def initChoices(self, parent): - self.lb = TQListBox(parent) - for ch in self.choices: - self.lb.insertItem(self.trUtf8(ch)) - - def closeEvent(self, e): - TQWidget.closeEvent(self, e) - self.emit(PYSIGNAL('closed'), ()) diff --git a/examples3/i18n/mywidget_cs.qm b/examples3/i18n/mywidget_cs.qm deleted file mode 100644 index f95090d..0000000 Binary files a/examples3/i18n/mywidget_cs.qm and /dev/null differ diff --git a/examples3/i18n/mywidget_cs.ts b/examples3/i18n/mywidget_cs.ts deleted file mode 100644 index 2b82f04..0000000 --- a/examples3/i18n/mywidget_cs.ts +++ /dev/null @@ -1,75 +0,0 @@ - - - MyWidget - - View - Pohled - - - &File - &Soubor - - - E&xit - &Konec - - - First - První - - - Third - TÅ™etí - - - Language: English - Jayzk: ÄŒeský - - - The Main Window - Hlavní okno - - - Ctrl+Q - Ctrl+Q - - - Oblique - NaklonÄ›ný - - - Second - Druhý - - - Isometric - Isometrický - - - Perspective - Perspektivní - - - Internationalization Example - Ukázka lokalizace - - - - TQAccel - - Ctrl - Ctrl - - - - TQVDialog - - OK - - - - Cancel - - - - diff --git a/examples3/i18n/mywidget_de.qm b/examples3/i18n/mywidget_de.qm deleted file mode 100644 index 6433855..0000000 Binary files a/examples3/i18n/mywidget_de.qm and /dev/null differ diff --git a/examples3/i18n/mywidget_de.ts b/examples3/i18n/mywidget_de.ts deleted file mode 100644 index 0a60c2b..0000000 --- a/examples3/i18n/mywidget_de.ts +++ /dev/null @@ -1,69 +0,0 @@ - - - MyWidget - - First - Erstens - - - Second - Zweitens - - - Third - Drittens - - - Internationalization Example - Internationalisierungsbeispiel - - - E&xit - Be&enden - - - &File - &Datei - - - Language: English - Sprache: Deutsch - - - The Main Window - Das Hauptfenster - - - View - Ansicht - - - Perspective - Perspektivisch - - - Isometric - Isometrisch - - - Oblique - Schief - - - Ctrl+Q - File|Quit - Strg+Q - - - - TQVDialog - - OK - OK - - - Cancel - Abbruch - - - diff --git a/examples3/i18n/mywidget_el.qm b/examples3/i18n/mywidget_el.qm deleted file mode 100644 index 15d7689..0000000 Binary files a/examples3/i18n/mywidget_el.qm and /dev/null differ diff --git a/examples3/i18n/mywidget_el.ts b/examples3/i18n/mywidget_el.ts deleted file mode 100644 index 0d7a5dc..0000000 --- a/examples3/i18n/mywidget_el.ts +++ /dev/null @@ -1,68 +0,0 @@ - - - MyWidget - - &File - &ΑÏχείο - - - Ctrl+Q - Ctrl+Q - - - E&xit - Έ&ξοδος - - - First - ΠÏώτο - - - Internationalization Example - ΠαÏάδειγμα διεθνοποίησης - - - Isometric - ΙσομετÏική - - - Language: English - Γλώσσα: Ελληνικά - - - Oblique - Πλάγια - - - Perspective - ΠÏοοπτική - - - Second - ΔεÏτεÏο - - - The Main Window - ΚÏÏιο παÏάθυÏο - - - Third - ΤÏίτο - - - View - Όψη - - - - TQVDialog - - OK - - - - Cancel - - - - diff --git a/examples3/i18n/mywidget_en.qm b/examples3/i18n/mywidget_en.qm deleted file mode 100644 index 6bd22c4..0000000 Binary files a/examples3/i18n/mywidget_en.qm and /dev/null differ diff --git a/examples3/i18n/mywidget_en.ts b/examples3/i18n/mywidget_en.ts deleted file mode 100644 index 30a6e66..0000000 --- a/examples3/i18n/mywidget_en.ts +++ /dev/null @@ -1,69 +0,0 @@ - - - MyWidget - - First - - - - Second - - - - Third - - - - Internationalization Example - - - - E&xit - - - - &File - - - - Language: English - - - - The Main Window - - - - View - - - - Perspective - - - - Isometric - - - - Oblique - - - - Ctrl+Q - File|Quit - - - - - TQVDialog - - OK - - - - Cancel - - - - diff --git a/examples3/i18n/mywidget_eo.qm b/examples3/i18n/mywidget_eo.qm deleted file mode 100644 index 372cf79..0000000 Binary files a/examples3/i18n/mywidget_eo.qm and /dev/null differ diff --git a/examples3/i18n/mywidget_eo.ts b/examples3/i18n/mywidget_eo.ts deleted file mode 100644 index f4eaef4..0000000 --- a/examples3/i18n/mywidget_eo.ts +++ /dev/null @@ -1,72 +0,0 @@ - - - MyWidget - - &File - &Dosiero - - - Ctrl+Q - Ctrl+F - - - E&xit... - &Fini... - - - First - Unue - - - Internationalization Example - Ekzemplo pri internaciigo - - - Isometric - Isometria - - - Language: English - Lingvo: Esperanto (ĈĜĤĴŜŬĉÄĥĵÅÅ­) - - - Oblique - Oblikva - - - Perspective - Perspektiva - - - Second - Due - - - The Main Window - La Ĉeffenestro - - - Third - Trie - - - View - Aspekto - - - E&xit - - - - - TQVDialog - - OK - - - - Cancel - - - - diff --git a/examples3/i18n/mywidget_fr.qm b/examples3/i18n/mywidget_fr.qm deleted file mode 100644 index 12a8464..0000000 Binary files a/examples3/i18n/mywidget_fr.qm and /dev/null differ diff --git a/examples3/i18n/mywidget_fr.ts b/examples3/i18n/mywidget_fr.ts deleted file mode 100644 index 3fa0191..0000000 --- a/examples3/i18n/mywidget_fr.ts +++ /dev/null @@ -1,68 +0,0 @@ - - - MyWidget - - View - Vue - - - &File - &Fichier - - - E&xit - &Quitter - - - First - Premier - - - Third - Troisième - - - Language: English - Langage : Français - - - The Main Window - La fenêtre principale - - - Ctrl+Q - Ctrl+Q - - - Oblique - Oblique - - - Second - Second - - - Isometric - Isométrique - - - Perspective - Perspective - - - Internationalization Example - Exemple d'internationalisation - - - - TQVDialog - - OK - - - - Cancel - - - - diff --git a/examples3/i18n/mywidget_it.qm b/examples3/i18n/mywidget_it.qm deleted file mode 100644 index 075bee2..0000000 Binary files a/examples3/i18n/mywidget_it.qm and /dev/null differ diff --git a/examples3/i18n/mywidget_it.ts b/examples3/i18n/mywidget_it.ts deleted file mode 100644 index 4fa708c..0000000 --- a/examples3/i18n/mywidget_it.ts +++ /dev/null @@ -1,72 +0,0 @@ - - - MyWidget - - E&xit... - &Esci... - - - First - Primo - - - Internationalization Example - Esempio di localizzazione - - - Isometric - Isometrica - - - Language: English - Lingua: Italiano - - - Oblique - Obliqua - - - Perspective - Prospettica - - - Second - Secondo - - - The Main Window - La Finestra Principale - - - Third - Terzo - - - View - Vista - - - E&xit - - - - Ctrl+Q - - - - &File - - - - - TQVDialog - - OK - - - - Cancel - - - - diff --git a/examples3/i18n/mywidget_jp.qm b/examples3/i18n/mywidget_jp.qm deleted file mode 100644 index 8942dd7..0000000 Binary files a/examples3/i18n/mywidget_jp.qm and /dev/null differ diff --git a/examples3/i18n/mywidget_jp.ts b/examples3/i18n/mywidget_jp.ts deleted file mode 100644 index 029dd0e..0000000 --- a/examples3/i18n/mywidget_jp.ts +++ /dev/null @@ -1,68 +0,0 @@ - - - MyWidget - - &File - ファイル(&F) - - - Ctrl+Q - Ctrl+Q - - - E&xit - 終了(&X) - - - First - 第一行 - - - Internationalization Example - 国際化(i18n)ã®ä¾‹ - - - Isometric - 等角投影法 - - - Language: English - 言語: 日本語 - - - Oblique - æ–œã‚投影法 - - - Perspective - é è¿‘法 - - - Second - 第二行 - - - The Main Window - メインウィンドウ - - - Third - 第三行 - - - View - è¡¨ç¤ºæ–¹å¼ - - - - TQVDialog - - OK - - - - Cancel - - - - diff --git a/examples3/i18n/mywidget_ko.qm b/examples3/i18n/mywidget_ko.qm deleted file mode 100644 index dccc2ba..0000000 Binary files a/examples3/i18n/mywidget_ko.qm and /dev/null differ diff --git a/examples3/i18n/mywidget_ko.ts b/examples3/i18n/mywidget_ko.ts deleted file mode 100644 index 632f8a7..0000000 --- a/examples3/i18n/mywidget_ko.ts +++ /dev/null @@ -1,68 +0,0 @@ - - - MyWidget - - &File - 파ì¼&F - - - Ctrl+Q - Ctrl+E - - - E&xit - 종료&X - - - First - 첫번째 - - - Internationalization Example - 국제화 예제 - - - Isometric - Isometric - - - Language: English - 언어 : 한국어 - - - Oblique - Oblique - - - Perspective - Perspective - - - Second - ë‘번째 - - - The Main Window - ë©”ì¸ ìœˆë„ìš° - - - Third - 세번째 - - - View - 보기 - - - - TQVDialog - - OK - - - - Cancel - - - - diff --git a/examples3/i18n/mywidget_no.qm b/examples3/i18n/mywidget_no.qm deleted file mode 100644 index 2adc136..0000000 Binary files a/examples3/i18n/mywidget_no.qm and /dev/null differ diff --git a/examples3/i18n/mywidget_no.ts b/examples3/i18n/mywidget_no.ts deleted file mode 100644 index b91293c..0000000 --- a/examples3/i18n/mywidget_no.ts +++ /dev/null @@ -1,68 +0,0 @@ - - - MyWidget - - View - Visning - - - &File - &Fil - - - E&xit - &Slutt - - - First - Første - - - Third - Tredje - - - Language: English - SprÃ¥k: Norsk - - - The Main Window - Hovedvinduet - - - Ctrl+Q - Ctrl+S - - - Oblique - Skjev - - - Second - Andre - - - Isometric - Isometrisk - - - Perspective - Perspektiv - - - Internationalization Example - Internasjonaliseringseksempel - - - - TQVDialog - - OK - - - - Cancel - - - - diff --git a/examples3/i18n/mywidget_ru.qm b/examples3/i18n/mywidget_ru.qm deleted file mode 100644 index ebc512e..0000000 Binary files a/examples3/i18n/mywidget_ru.qm and /dev/null differ diff --git a/examples3/i18n/mywidget_ru.ts b/examples3/i18n/mywidget_ru.ts deleted file mode 100644 index d279ed1..0000000 --- a/examples3/i18n/mywidget_ru.ts +++ /dev/null @@ -1,68 +0,0 @@ - - - MyWidget - - View - Вид - - - &File - Файл - - - E&xit - Выход - - - First - Первый - - - Third - Третий - - - Language: English - Язык: РуÑÑкий - - - The Main Window - Главное окно - - - Oblique - КурÑив - - - Second - Второй - - - Isometric - ИзометричеÑкий - - - Perspective - ПерÑпектива - - - Internationalization Example - Пример интернациноализации - - - Ctrl+Q - - - - - TQVDialog - - OK - - - - Cancel - - - - diff --git a/examples3/i18n/mywidget_zh.qm b/examples3/i18n/mywidget_zh.qm deleted file mode 100644 index a890c09..0000000 Binary files a/examples3/i18n/mywidget_zh.qm and /dev/null differ diff --git a/examples3/i18n/mywidget_zh.ts b/examples3/i18n/mywidget_zh.ts deleted file mode 100644 index 0dcb2df..0000000 --- a/examples3/i18n/mywidget_zh.ts +++ /dev/null @@ -1,68 +0,0 @@ - - - MyWidget - - View - 视图 - - - &File - 文件[&F] - - - E&xit - 退出[&x] - - - First - 第一个 - - - Third - 第三个 - - - Language: English - 语言: 简体中文 - - - The Main Window - ä¸»çª—å£ - - - Ctrl+Q - Ctrl+Q - - - Oblique - 斜投影 - - - Second - 第二个 - - - Isometric - 等角投影 - - - Perspective - é€è§†æŠ•å½± - - - Internationalization Example - 国际化范例 - - - - TQVDialog - - OK - - - - Cancel - - - - diff --git a/examples3/lineedits.py b/examples3/lineedits.py deleted file mode 100755 index 0093f40..0000000 --- a/examples3/lineedits.py +++ /dev/null @@ -1,140 +0,0 @@ -#!/usr/bin/env python - -#**************************************************************************** -#** $Id: lineedits.py,v 1.1 2002/06/19 07:56:07 phil Exp $ -#** -#** Copyright (C) 1992-1998 Troll Tech AS. All rights reserved. -#** -#** This file is part of an example program for PyTQt. This example -#** program may be used, distributed and modified without limitation. -#** -#*****************************************************************************/ - -import sys -from python_tqt.qt import * - -TRUE = 1 -FALSE = 0 - -class LineEdits(TQGroupBox): - def __init__(self, parent = None, name = None): - TQGroupBox.__init__(self, 0, TQt.Horizontal, "Line Edits", parent, name) - - self.setMargin(10) - - box = TQVBoxLayout(self.layout()) - - row1 = TQHBoxLayout(box) - row1.setMargin(5) - - label = TQLabel("Echo Mode: ", self) - row1.addWidget(label) - - combo1 = TQComboBox(FALSE, self) - row1.addWidget(combo1) - combo1.insertItem("Normal", -1) - combo1.insertItem("Password", -1) - combo1.insertItem("No Echo", -1) - - self.connect(combo1, SIGNAL("activated(int)"), self.slotEchoChanged) - self.lined1 = TQLineEdit(self) - box.addWidget(self.lined1) - - row2 = TQHBoxLayout(box) - row2.setMargin(5) - - label = TQLabel("Validator: ", self) - row2.addWidget(label) - - combo2 = TQComboBox(FALSE, self) - row2.addWidget(combo2) - combo2.insertItem("No Validator", -1) - combo2.insertItem("Integer Validator", -1) - combo2.insertItem("Double Validator", -1) - - self.connect(combo2, SIGNAL("activated(int)"), self.slotValidatorChanged) - - self.lined2 = TQLineEdit(self) - box.addWidget(self.lined2) - - row3 = TQHBoxLayout(box) - row3.setMargin(5) - - label = TQLabel("Alignment: ", self) - row3.addWidget(label) - - combo3 = TQComboBox(FALSE, self) - row3.addWidget(combo3) - combo3.insertItem("Left", -1) - combo3.insertItem("Centered", -1) - combo3.insertItem("Right", -1) - - self.connect(combo3, SIGNAL("activated(int)"), self.slotAlignmentChanged) - self.lined3 = TQLineEdit(self) - box.addWidget(self.lined3) - - row4 = TQHBox(self) - box.addWidget(row4) - row4.setMargin(5) - - TQLabel("Read-Only: ", row4) - - combo4 = TQComboBox(FALSE, row4) - combo4.insertItem("False", -1) - combo4.insertItem("True", -1) - - self.connect(combo4, SIGNAL("activated(int)"), self.slotReadOnlyChanged) - - self.lined4 = TQLineEdit(self) - box.addWidget(self.lined4) - - self.lined1.setFocus() - - def slotEchoChanged(self, i): - if i == 0: - self.lined1.setEchoMode(TQLineEdit.Normal) - elif i == 1: - self.lined1.setEchoMode(TQLineEdit.Password) - elif i == 2: - self.lined1.setEchoMode(TQLineEdit.NoEcho) - - self.lined1.setFocus() - - def slotValidatorChanged(self, i): - if i == 0: - self.lined2.setValidator(None) - elif i == 1: - self.lined2.setValidator(TQIntValidator(self.lined2)) - elif i == 2: - self.lined2.setValidator(TQDoubleValidator(-999.0, 999.0, 2, self.lined2)) - - self.lined2.setText("") - self.lined2.setFocus() - - def slotAlignmentChanged(self, i): - if i == 0: - self.lined3.setAlignment(TQLineEdit.AlignLeft) - elif i == 1: - self.lined3.setAlignment(TQLineEdit.AlignCenter) - elif i == 2: - self.lined3.setAlignment(TQLineEdit.AlignRight) - - self.lined3.setFocus() - - def slotReadOnlyChanged(self, i): - if i == 0: - self.lined4.setReadOnly(FALSE) - elif i == 1: - self.lined4.setReadOnly(TRUE) - - self.lined4.setFocus() - - -if __name__=='__main__': - app = TQApplication( sys.argv ) - - lineedits = LineEdits() - lineedits.setCaption("Lineedits - PyTQt Example") - lineedits.show() - app.setMainWidget(lineedits) - app.exec_loop() diff --git a/examples3/listbox.py b/examples3/listbox.py deleted file mode 100755 index fce0cc8..0000000 --- a/examples3/listbox.py +++ /dev/null @@ -1,176 +0,0 @@ -#!/usr/bin/env python - -"""************************************************************************** -** $Id: listbox.py,v 1.1 2003/05/30 17:47:57 phil Exp $ -** -** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. -** -** This file is part of an example program for TQt. This example -** program may be used, distributed and modified without limitation. -** -***************************************************************************""" - -import sys -from python_tqt.qt import * - -FALSE = 0 -TRUE = 1 - -class ListBoxDemo( TQWidget ): - def __init__( self, parent=None, name=None ): - TQWidget.__init__( self, parent, name ) - b = FALSE - g = TQGridLayout( self, 2, 2, 6 ) - - g.addWidget( TQLabel( "Configuration:", self ), 0, 0 ) - g.addWidget( TQLabel( "Result:", self ), 0, 1 ) - - self.l = TQListBox( self ) - g.addWidget( self.l, 1, 1 ) - self.l.setFocusPolicy( TQWidget.StrongFocus ) - - v = TQVBoxLayout( ) - g.addLayout( v, 1, 0 ) - - bg = TQButtonGroup( self, None ) - - b = TQRadioButton( "Fixed number of columns,\n" - "as many rows as needed.", - self ) - bg.insert( b ) - v.addWidget( b ) - b.setChecked( TRUE ) - self.connect( b, SIGNAL("clicked()"), self.setNumCols ) - h = TQHBoxLayout() - v.addLayout( h ) - h.addSpacing( 30 ) - h.addSpacing( 100 ) - h.addWidget( TQLabel( "Columns:", self ) ) - self.columns = TQSpinBox( self ) - h.addWidget( self.columns ) - - v.addSpacing( 12 ) - - b = TQRadioButton( "As many columns as fit on-screen,\n" - "as many rows as needed.", - self ) - bg.insert( b ) - v.addWidget( b ) - self.connect( b, SIGNAL("clicked()"), self.setColsByWidth ) - - v.addSpacing( 12 ) - - b = TQRadioButton( "Fixed number of rows,\n" - "as many columns as needed.", - self ) - bg.insert( b ) - v.addWidget( b ) - self.connect( b, SIGNAL("clicked()"), self.setNumRows ) - h = TQHBoxLayout() - v.addLayout( h ) - h.addSpacing( 30 ) - h.addSpacing( 100 ) - h.addWidget( TQLabel( "Rows:", self ) ) - self.rows = TQSpinBox( self ) - self.rows.setEnabled( FALSE ) - h.addWidget( self.rows ) - - v.addSpacing( 12 ) - - b = TQRadioButton( "As many rows as fit on-screen,\n" - "as many columns as needed.", - self ) - bg.insert( b ) - v.addWidget( b ) - self.connect( b, SIGNAL("clicked()"), self.setRowsByHeight ) - - v.addSpacing( 12 ) - - cb = TQCheckBox( "Variable-height rows", self ) - cb.setChecked( TRUE ) - self.connect( cb, SIGNAL("toggled(bool)"), self.setVariableHeight ) - v.addWidget( cb ) - v.addSpacing( 6 ) - - cb = TQCheckBox( "Variable-width columns", self ) - self.connect( cb, SIGNAL("toggled(bool)"), self.setVariableWidth ) - v.addWidget( cb ) - - cb = TQCheckBox( "Extended-Selection", self ) - self.connect( cb, SIGNAL("toggled(bool)"), self.setMultiSelection ) - v.addWidget( cb ) - - pb = TQPushButton( "Sort ascending", self ) - self.connect( pb, SIGNAL("clicked()"), self.sortAscending ) - v.addWidget( pb ) - - pb = TQPushButton( "Sort descending", self ) - self.connect( pb, SIGNAL("clicked()"), self.sortDescending ) - v.addWidget( pb ) - - v.addStretch( 100 ) - - i = 0 - while i <= 2560: - i+=1 - self.l.insertItem( str(TQString.fromLatin1( "Item " )) + str(TQString.number( i )), i ) - self.columns.setRange( 1, 256 ) - self.columns.setValue( 1 ) - self.rows.setRange( 1, 256 ) - self.rows.setValue( 256 ) - - self.connect( self.columns, SIGNAL("valueChanged(int)"), self.setNumCols ) - self.connect( self.rows, SIGNAL("valueChanged(int)"), self.setNumRows ) - - # slots - def setNumCols( self ): - self.columns.setEnabled( TRUE ) - self.rows.setEnabled( FALSE ) - self.l.setColumnMode( self.columns.value() ) - - def setNumRows( self ): - self.columns.setEnabled( FALSE ) - self.rows.setEnabled( TRUE ) - self.l.setRowMode( self.rows.value() ) - - def setRowsByHeight( self ): - self.columns.setEnabled( FALSE ) - self.rows.setEnabled( FALSE ) - self.l.setRowMode( TQListBox.FitToHeight ) - - def setColsByWidth( self ): - self.columns.setEnabled( FALSE ) - self.rows.setEnabled( FALSE ) - self.l.setColumnMode( TQListBox.FitToWidth ) - - def setVariableWidth( self, b ): - self.l.setVariableWidth( b ) - - def setVariableHeight( self, b ): - self.l.setVariableHeight( b ) - - def setMultiSelection( self, b ): - self.l.clearSelection() - if b : - self.l.setSelectionMode( TQListBox.Extended ) - else: - self.l.setSelectionMode( TQListBox.Single ) - - def sortAscending( self ): - self.l.sort( TRUE ) - - def sortDescending( self ): - self.l.sort( FALSE ) - - -def main( args ): - a = TQApplication( args ) - t = ListBoxDemo() - t.setCaption( "TQt Example - Listbox" ) - a.setMainWidget( t ) - t.show() - - a.exec_loop() - -if __name__=="__main__": - main(sys.argv) diff --git a/examples3/listboxcombo.py b/examples3/listboxcombo.py deleted file mode 100755 index baca5d2..0000000 --- a/examples3/listboxcombo.py +++ /dev/null @@ -1,167 +0,0 @@ -#!/usr/bin/env python - -"""************************************************************************** -** $Id: listboxcombo.py,v 1.1 2003/05/30 17:47:57 phil Exp $ -** -** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. -** -** This file is part of an example program for TQt. This example -** program may be used, distributed and modified without limitation. -** -***************************************************************************""" - -import sys -from python_tqt.qt import * - -FALSE = 0 -TRUE = 1 - -class ListBoxCombo( TQVBox ): - # Constructor - # Creates child widgets of the ListBoxCombo widget - def __init__( self, parent=None, name=None ): - TQVBox.__init__( self, parent, name ) - - self.setMargin( 5 ) - self.setSpacing( 5 ) - - i = 0 - row1 = TQHBox( self ) - row1.setSpacing( 5 ) - - # Create a multi-selection ListBox... - self.lb1 = TQListBox( row1 ) - self.lb1.setSelectionMode( TQListBox.Multi ) - - # ...insert a pixmap item... - xpm = TQPixmap( "qtlogo.png" ) - txt = TQString() - TQListBoxPixmap( self.lb1, xpm, txt ) - - # ...and 100 text items - for i in range(0, 100, 1) : - xpm = TQPixmap() - txt = TQString( "Listbox Item %1" ).arg( i ) - if not i % 4 : - xpm = TQPixmap( "fileopen.xpm" ) - TQListBoxPixmap( self.lb1, xpm, txt ) - - # Create a pushbutton... - arrow1 = TQPushButton( " -> ", row1 ) - # ...and connect the clicked SIGNAL with the SLOT slotLeft2Right - self.connect( arrow1, SIGNAL("clicked()"), self.slotLeft2Right ) - - # create an empty single-selection ListBox - self.lb2 = TQListBox( row1 ) - - row2 = TQHBox( self ) - row2.setSpacing( 5 ) - - box1 = TQVBox( row2 ) - box1.setSpacing( 5 ) - - # Create a non-editable Combobox and a label below... - cb1 = TQComboBox( FALSE, box1 ) - self.label1 = TQLabel( "Current Item: Combobox Item 0", box1 ) - self.label1.setMaximumHeight( self.label1.sizeHint().height() * 2 ) - self.label1.setFrameStyle( TQFrame.Panel | TQFrame.Sunken ) - - #...and insert 50 items into the Combobox - for i in range( 0, 50, 1 ) : - txt = str( TQString( "Combobox Item %1" ).arg( i ) ) - if i % 9 : - cb1.insertItem( txt ) - else : - cb1.listBox().insertItem( MyListBoxItem() ) - - box2 = TQVBox( row2 ) - box2.setSpacing( 5 ) - - # Create an editable Combobox and a label below... - cb2 = TQComboBox( TRUE, box2 ) - self.label2 = TQLabel( "Current Item: Combobox Item 0", box2 ) - self.label2.setMaximumHeight( self.label2.sizeHint().height() * 2 ) - self.label2.setFrameStyle( TQFrame.Panel | TQFrame.Sunken ) - - # ... and insert 50 items into the Combobox - for i in range(0, 50, 1 ) : - txt = str(TQString( "Combobox Item %1" ).arg( i )) - if not i % 4 : - cb2.insertItem( TQPixmap( "fileopen.xpm" ), txt ) - else : - cb2.insertItem( txt ) - - # Connect the activated SIGNALs of the Comboboxes with SLOTs - self.connect( cb1, SIGNAL("activated( const TQString & )"), self.slotCombo1Activated ) - self.connect( cb2, SIGNAL("activated( const TQString & )"), self.slotCombo2Activated ) - - """ SLOT slotLeft2Right - * Copies all selected items of the first ListBox into the second ListBox - """ - def slotLeft2Right( self ): - # Go through all items of the first ListBox - for i in range( 0, self.lb1.count(), 1 ) : - item = self.lb1.item( i ) - # if the item is selected... - if self.lb1.isSelected( i ): #item.isSelected() : - # ...and it is a text item... - if item.pixmap() and not(item.text().isEmpty()): - self.lb2.insertItem( item.pixmap(), item.text() ) - elif not( item.pixmap() ): - self.lb2.insertItem( item.text() ) - elif item.text().isEmpty() : - self.lb2.insertItem( item.pixmap() ) - - """ SLOT slotCombo1Activated( const TQString &s ) - * Sets the text of the item which the user just selected in the - * first Combobox (and is now the value of s) to the first Label. - """ - def slotCombo1Activated( self, s ) : - self.label1.setText( str(TQString( "Current Item: %1" ).arg( s ) ) ) - - """ SLOT slotCombo2Activated( const TQString &s ) - * Sets the text of the item which the user just selected in the - * second Combobox (and is now the value of s) to the second Label. - """ - def slotCombo2Activated( self, s ) : - self.label2.setText( str(TQString( "Current Item: %1" ).arg( s ) ) ) - - -class MyListBoxItem( TQListBoxItem ): - def __init__( self, parent=None, name=None ): - TQListBoxItem.__init__( self, parent, name ) - self.setCustomHighlighting( TRUE ) - - def paint( self, painter ): - # evil trick: find out whether we are painted onto our listbox - in_list_box = 0 - if self.listBox() and self.listBox().viewport() == painter.device(): - in_list_box = 1 - r = TQRect( 0, 0, self.width( self.listBox() ), self.height( self.listBox() ) ) - brush = TQBrush( TQt.red, TQt.SolidPattern ) - if in_list_box and isSelected(): - painter.eraseRect( r ) - painter.fillRect( 5, 5, self.width( self.listBox() ) - 10, self.height( self.listBox() ) - 10, brush ) - if in_list_box and isCurrent(): - self.listBox().style().drawPrimitive( TQStyle.PE_FocusRect, painter, r, self.listBox().colorGroup() ) - - def width( self, TQListBox ): - return 100 - - def height( self, TQListBox ): - return 16 - - -def main( args ): - a = TQApplication( args ) - - listboxcombo = ListBoxCombo() - listboxcombo.resize( 400, 270 ) - listboxcombo.setCaption( "TQt Example - Listboxes and Comboboxes" ) - a.setMainWidget( listboxcombo ) - listboxcombo.show(); - - a.exec_loop() - -if __name__=="__main__": - main(sys.argv) diff --git a/examples3/marble.png b/examples3/marble.png deleted file mode 100644 index 9c32530..0000000 Binary files a/examples3/marble.png and /dev/null differ diff --git a/examples3/mdi.py b/examples3/mdi.py deleted file mode 100755 index ca3d33b..0000000 --- a/examples3/mdi.py +++ /dev/null @@ -1,360 +0,0 @@ -#!/usr/bin/env python - -# A simple application. - - -import sys, string -from python_tqt.qt import * - - -fileopen = [ - '16 13 5 1', - '. c #040404', - '# c #808304', - 'a c None', - 'b c #f3f704', - 'c c #f3f7f3', - 'aaaaaaaaa...aaaa', - 'aaaaaaaa.aaa.a.a', - 'aaaaaaaaaaaaa..a', - 'a...aaaaaaaa...a', - '.bcb.......aaaaa', - '.cbcbcbcbc.aaaaa', - '.bcbcbcbcb.aaaaa', - '.cbcb...........', - '.bcb.#########.a', - '.cb.#########.aa', - '.b.#########.aaa', - '..#########.aaaa', - '...........aaaaa' -] - -filesave = [ - '14 14 4 1', - '. c #040404', - '# c #808304', - 'a c #bfc2bf', - 'b c None', - '..............', - '.#.aaaaaaaa.a.', - '.#.aaaaaaaa...', - '.#.aaaaaaaa.#.', - '.#.aaaaaaaa.#.', - '.#.aaaaaaaa.#.', - '.#.aaaaaaaa.#.', - '.##........##.', - '.############.', - '.##.........#.', - '.##......aa.#.', - '.##......aa.#.', - '.##......aa.#.', - 'b.............' -] - -fileprint = [ - '16 14 6 1', - '. c #000000', - '# c #848284', - 'a c #c6c3c6', - 'b c #ffff00', - 'c c #ffffff', - 'd c None', - 'ddddd.........dd', - 'dddd.cccccccc.dd', - 'dddd.c.....c.ddd', - 'ddd.cccccccc.ddd', - 'ddd.c.....c....d', - 'dd.cccccccc.a.a.', - 'd..........a.a..', - '.aaaaaaaaaa.a.a.', - '.............aa.', - '.aaaaaa###aa.a.d', - '.aaaaaabbbaa...d', - '.............a.d', - 'd.aaaaaaaaa.a.dd', - 'dd...........ddd' -] - -document = [ -"12 16 6 1", -" c #040404", -". c None", -"X c white", -"o c #808304", -"O c black", -"+ c #f3f7f3", -" .....", -" XXXXX ....", -" XXXXX X ...", -" XXXXX XX ..", -" XooXX O.", -" X+XXX+XXXO.", -" XXXXXXXXXO.", -" XoooXooXXO.", -" XXXXXXXXXO.", -" XXXXXXXXXO.", -" XoXXoooXXO.", -" XXXXXXXXXO.", -"OXXXXXXXXXO.", -"OXXXXXXXXXO.", -"OOOOOOOOOOO.", -"............" -] - -fileOpenText = \ -''' -Click this button to open a new file.

-You can also select the Open command from the File menu.''' - -fileSaveText = \ -'''Click this button to save the file you are editing.

-You will be prompted for a filename.

-You can also select the Save command from the File menu.''' - -filePrintText = \ -'''Click this button to print the file you are editing.

-You can also select the Print command from the File menu.''' - -#True=1 -#False=0 - -class ApplicationWindow(TQMainWindow): - def __init__(self): - TQMainWindow.__init__(self,None,'example application main window',TQt.WDestructiveClose) - - self.filename = TQString.null - self.printer = TQPrinter() - - self.fileTools = TQToolBar(self,'file operations') - - openIcon = TQPixmap(fileopen) - self.fileOpen = TQToolButton(TQIconSet(openIcon),'Open File',TQString.null,self.load,self.fileTools,'open file') - - saveIcon = TQPixmap(filesave) - self.fileSave = TQToolButton(TQIconSet(saveIcon),'Save File',TQString.null,self.save,self.fileTools,'save file') - printIcon = TQPixmap(fileprint) - self.filePrint = TQToolButton(TQIconSet(printIcon),'Print File',TQString.null,self.printDoc,self.fileTools,'print file') - - TQWhatsThis.whatsThisButton(self.fileTools) - - TQWhatsThis.add(self.fileOpen,fileOpenText) - TQMimeSourceFactory.defaultFactory().setPixmap('fileopen',openIcon) - TQWhatsThis.add(self.fileSave,fileSaveText) - TQWhatsThis.add(self.filePrint,filePrintText) - - self.file = TQPopupMenu(self) - self.menuBar().insertItem('&File',self.file) - - self.file.insertItem('&New',self.newDoc,TQt.CTRL + TQt.Key_N) - - id = self.file.insertItem(TQIconSet(openIcon),'&Open',self.load,TQt.CTRL + TQt.Key_O) - self.file.setWhatsThis(id,fileOpenText) - - id = self.file.insertItem(TQIconSet(saveIcon),'&Save',self.save,TQt.CTRL + TQt.Key_S) - self.file.setWhatsThis(id,fileSaveText) - - id = self.file.insertItem('Save &as',self.saveAs) - self.file.setWhatsThis(id,fileSaveText) - - self.file.insertSeparator() - - id = self.file.insertItem(TQIconSet(printIcon),'&Print',self.printDoc,TQt.CTRL + TQt.Key_P) - self.file.setWhatsThis(id,filePrintText) - - self.file.insertSeparator() - - self.file.insertItem('&Close',self,SLOT('close()'),TQt.CTRL + TQt.Key_W) - self.file.insertItem('&Quit',tqApp,SLOT('closeAllWindows()'),TQt.CTRL + TQt.Key_Q) - - self.menuBar().insertSeparator() - self.windows = TQPopupMenu( self ) - self.windows.setCheckable( True ) - self.connect( self.windows, SIGNAL( "aboutToShow()" ), - self.windowsMenuAboutToShow ) - self.menuBar().insertItem( "&Windows", self.windows ) - - self.help = TQPopupMenu(self) - self.menuBar().insertSeparator() - self.menuBar().insertItem('&Help',self.help) - - self.help.insertItem('&About',self.about,TQt.Key_F1) - self.help.insertItem('About &TQt',self.aboutTQt) - self.help.insertSeparator() - self.help.insertItem( "What's &This", self, SLOT("whatsThis()"), TQt.SHIFT+TQt.Key_F1) - - self.menuBar().insertSeparator() - - self.vb = TQVBox( self ) - self.vb.setFrameStyle( TQFrame.StyledPanel | TQFrame.Sunken ) - self.ws = TQWorkspace( self.vb ) - self.ws.setScrollBarsEnabled( True ) - self.setCentralWidget( self.vb ) - - self.statusBar().message('Ready',2000) - #self.resize(450,600) - - def newDoc(self): - w = MDIWindow( self.ws, "", TQt.WDestructiveClose ) - self.connect( w, PYSIGNAL( "message" ), self.statusBar(), SLOT( "message(const TQString&, int )") ) - w.setCaption("unnamed document") - w.setIcon( TQPixmap(document) ) - # show the very first window in maximized mode - if len(self.ws.windowList())==0: - w.showMaximized() - else: - w.show() - return w - - def load(self): - fn = TQFileDialog.getOpenFileName( TQString.null, TQString.null, self ) - if not fn.isEmpty(): - w = self.newDoc() - w.load( fn ) - else: - self.statusBar().message( "Loading aborted", 2000 ) - - def save(self): - m = self.ws.activeWindow() - if m: - m.save() - - def saveAs(self): - m = self.ws.activeWindow() - if m: - m.saveAs() - - def printDoc(self): - m = self.ws.activeWindow() - if m: - m.printDoc( self.printer ) - - def closeWindow(self): - m = self.ws.activeWindow() - if m: - m.close() - - def about(self): - TQMessageBox.about( self, "TQt Application Example", - "This example demonstrates simple use of\n " - "TQt's Multiple Document Interface (MDI).") - - def aboutTQt(self): - TQMessageBox.aboutTQt( self, "TQt Application Example" ) - - def windowsMenuAboutToShow(self): - self.windows.clear() - cascadeId = self.windows.insertItem("&Cascade", self.ws, SLOT("cascade() ") ) - tileId = self.windows.insertItem("&Tile", self.ws, SLOT("tile()" ) ) - if len(self.ws.windowList())==0 : - self.windows.setItemEnabled( cascadeId, False ) - self.windows.setItemEnabled( tileId, False ) - self.windows.insertSeparator() - windows = self.ws.windowList() - cnt=0 - for i in windows: - id =self.windows.insertItem(i.caption(),self.windowsMenuActivated ) - self.windows.setItemParameter( id, cnt ); - self.windows.setItemChecked( id, self.ws.activeWindow() == i ) - cnt=cnt+1 - - def windowsMenuActivated(self,sid ): - w = self.ws.windowList().at( id ) - if w: - w.showNormal() - w.setFocus() - - -class MDIWindow( TQMainWindow): - def __init__(self,parent, name, wflags ): - TQMainWindow.__init__(self,parent, name, wflags ) - self.mmovie = 0 - self.medit = TQMultiLineEdit( self ) - self.setFocusProxy( self.medit ) - self.setCentralWidget( self.medit ); - - - def load(self, fn ): - self.filename = fn - self.f=TQFile( self.filename ) - if not self.f.open( IO_ReadOnly ): - return - - if fn.contains(".gif"): - tmp=TQWidget(self) - self.setFocusProxy(tmp) - self.setCentralWidget(tmp) - self.medit.hide() - del self.medit - qm=TQMovie(fn) - #ifdef Q_WS_QWS // temporary speed-test hack - #qm->setDisplayWidget(tmp); - #endif - tmp.setBackgroundMode(TQWidget.NoBackground) - tmp.show() - self.mmovie=qm - else : - self.mmovie = 0 - t=TQTextStream(self.f) - s = t.read() - self.medit.setText( s ) - self.f.close() - self.setCaption( self.filename ) - self.emit(PYSIGNAL( "message"),(TQString("Loaded document %1").arg(self.filename),2000 )) - - def save(self): - if self.filename.isEmpty(): - self.saveAs() - return - text = self.medit.text() - output=open(str(self.filename),'w') - output.write(str(text)) - #emit message( TQString("Could not write to %1").arg(filename), 2000 ); - #return - output.close() - self.setCaption(self.filename) - self.emit(PYSIGNAL( "message"),(TQString("File %1 saved").arg(self.filename),2000 )) - - def saveAs(self): - fn = TQFileDialog.getSaveFileName( self.filename, TQString.null, self ) - if not fn.isEmpty(): - self.filename = fn - self.save() - else : - self.emit(PYSIGNAL( "message"),(TQString("Saving aborted"),2000 )) - - def printDoc(self,printer): - Margin = 10 - pageNo = 1 - - if printer.setup(self): - self.emit(PYSIGNAL( "message"),(TQString("Printing..."),2000 )) - p = TQPainter() - p.begin(printer) - p.setFont(self.medit.font()) - yPos = 0 - fm = p.fontMetrics() - metrics = TQPaintDeviceMetrics(printer) - - for i in range(self.medit.numLines()): - if Margin + yPos > metrics.height() - Margin: - pageNo = pageNo + 1 - self.emit(PYSIGNAL( "message"),(TQString("Printing (page %1) ...").arg(pageNo),2000 )) - printer.newPage() - yPos = 0 - - p.drawText(Margin,Margin + yPos,metrics.width(),fm.lineSpacing(),TQt.ExpandTabs | TQt.DontClip,self.medit.textLine(i)) - yPos = yPos + fm.lineSpacing() - - p.end() - self.emit(PYSIGNAL( "message"),(TQString("Printing completed"),2000 )) - else: - self.emit(PYSIGNAL( "message"),(TQString("Printing aborted"),2000 )) - - -if __name__=='__main__': - a = TQApplication(sys.argv) - mw = ApplicationWindow() - mw.setCaption("PyTQt Example - Multiple Documents Interface (MDI)") - mw.show() - a.connect(a, SIGNAL('lastWindowClosed()'), a, SLOT('quit()')) - a.exec_loop() diff --git a/examples3/menu.py b/examples3/menu.py deleted file mode 100755 index 31fadd9..0000000 --- a/examples3/menu.py +++ /dev/null @@ -1,286 +0,0 @@ -#!/usr/bin/env python - -#**************************************************************************** -#** $Id: menu.py,v 1.3 2003/06/06 12:59:26 phil Exp $ -#** -#** Copyright (C) 1992-1998 Troll Tech AS. All rights reserved. -#** -#** This file is part of an example program for PyTQt. This example -#** program may be used, distributed and modified without limitation. -#** -#*****************************************************************************/ - -import sys, string -from python_tqt.qt import * - -TRUE = 1 -FALSE = 0 - -# XPM -p1_xpm = [ -"16 16 3 1", -" c None", -". c #000000000000", -"X c #FFFFFFFF0000", -" ", -" ", -" .... ", -" .XXXX. ", -" .............. ", -" .XXXXXXXXXXXX. ", -" .XXXXXXXXXXXX. ", -" .XXXXXXXXXXXX. ", -" .XXXXXXXXXXXX. ", -" .XXXXXXXXXXXX. ", -" .XXXXXXXXXXXX. ", -" .XXXXXXXXXXXX. ", -" .XXXXXXXXXXXX. ", -" .XXXXXXXXXXXX. ", -" .............. ", -" " -] - -# XPM -p2_xpm = [ -"16 16 3 1", -" c None", -". c #000000000000", -"X c #FFFFFFFFFFFF", -" ", -" ...... ", -" .XXX.X. ", -" .XXX.XX. ", -" .XXX.XXX. ", -" .XXX..... ", -" .XXXXXXX. ", -" .XXXXXXX. ", -" .XXXXXXX. ", -" .XXXXXXX. ", -" .XXXXXXX. ", -" .XXXXXXX. ", -" .XXXXXXX. ", -" ......... ", -" ", -" " -] - -# XPM -p3_xpm = [ -"16 16 3 1", -" c None", -". c #000000000000", -"X c #FFFFFFFFFFFF", -" ", -" ", -" ......... ", -" ........... ", -" ........ .. ", -" ........... ", -" ........... ", -" ........... ", -" ........... ", -" ...XXXXX... ", -" ...XXXXX... ", -" ...XXXXX... ", -" ...XXXXX... ", -" ......... ", -" ", -" " -] - - -# Auxiliary class to provide fancy menu items with different fonts. -# Used for the "bold" and "underline" menu items in the options menu. - -class MyMenuItem( TQCustomMenuItem ): - def __init__( self, s, f ): - TQCustomMenuItem.__init__( self ) - self.string = s - self.font = f - - def paint( self, p, cg, act, enabled, x, y, w, h ) : - p.setFont ( self.font ) - p.drawText( x, y, w, h, TQt.AlignLeft | TQt.AlignVCenter | TQt.ShowPrefix | TQt.DontClip, self.string ) - - def sizeHint( self ): - return TQFontMetrics( self.font ).size( TQt.AlignLeft | TQt.AlignVCenter | TQt.ShowPrefix | TQt.DontClip, self.string ) - - -# Implementation of MenuExample class - -class MenuExample( TQWidget ): - def __init__( self, parent=None, name=None ): - TQWidget.__init__( self, parent, name ) - self.p1 = TQIconSet( TQPixmap ( p1_xpm ) ) - self.p2 = TQIconSet( TQPixmap ( p2_xpm ) ) - self.p3 = TQIconSet( TQPixmap ( p3_xpm ) ) - - self.printer = TQPopupMenu( self ) - self.printer.insertTearOffHandle() - self.printer.insertItem( "&Print to printer", self.printDoc ) - self.printer.insertItem( "Print to &file", self.printFile ) - self.printer.insertItem( "Print to fa&x", self.fax ) - self.printer.insertSeparator() - self.printer.insertItem( "Printer &Setup", self.printerSetup ) - - self.file = TQPopupMenu( self ) - self.file.insertItem( self.p1, "&Open", self.open, TQt.CTRL+TQt.Key_O ) - self.file.insertItem( self.p2, "&New", self.news, TQt.CTRL+TQt.Key_N ) - self.file.insertItem( self.p3, "&Save", self.save, TQt.CTRL+TQt.Key_S ) - self.file.insertItem( "&Close", self.closeDoc, TQt.CTRL+TQt.Key_W ) - self.file.insertSeparator() - self.file.insertItem( "&Print", self.printer, TQt.CTRL+TQt.Key_P ) - self.file.insertSeparator() - self.file.insertItem( "E&xit", tqApp, SLOT( "quit()" ), TQt.CTRL+TQt.Key_Q ) - - self.edit = TQPopupMenu( self ) - undoID = self.edit.insertItem( "&Undo", self.undo ) - redoID = self.edit.insertItem( "&Redo", self.redo ) - self.edit.setItemEnabled( undoID, FALSE ) - self.edit.setItemEnabled( redoID, FALSE ) - - self.options = TQPopupMenu( self ) - self.options.insertTearOffHandle() - self.options.setCaption( "Options" ) - self.options.insertItem( "&Normal Font", self.normal ) - self.options.insertSeparator() - - self.options.polish() # adjust system settings - f = self.options.font() - f.setBold( TRUE ) - self.boldID = self.options.insertItem( MyMenuItem( "Bold", f ) ) - self.options.setAccel( TQt.CTRL+TQt.Key_B, self.boldID ) - self.options.connectItem( self.boldID, self.bold ) - - f = self.options.font() - f.setUnderline( TRUE ) - self.underlineID = self.options.insertItem( MyMenuItem( "Underline", f ) ) - self.options.setAccel( TQt.CTRL+TQt.Key_U, self.underlineID ) - self.options.connectItem( self.underlineID, self.underline ) - - self.isBold = FALSE - self.isUnderline = FALSE - self.options.setCheckable( TRUE ) - - self.help = TQPopupMenu( self ) - self.help.insertItem( "&About", self.about, TQt.CTRL+TQt.Key_H ) - self.help.insertItem( "About &TQt", self.aboutTQt ) - - self.menu = TQMenuBar( self ) - self.menu.insertItem( "&File", self.file ) - self.menu.insertItem( "&Edit", self.edit ) - self.menu.insertItem( "&Options", self.options ) - self.menu.insertSeparator() - self.menu.insertItem( "&Help", self.help ) - self.menu.setSeparator( TQMenuBar.InWindowsStyle ) - - msg = TQLabel( self ) - msg.setText( "A context menu is available.\n" - "Invoke it by right-clicking or by" - " pressing the 'context' button." ) - msg.setGeometry( 0, self.height() - 60, self.width(), 60 ) - msg.setAlignment( TQt.AlignCenter ) - - self.label = TQLabel( self ) - self.label.setGeometry( 20, self.rect().center().y()-20, self.width()-40, 40 ) - self.label.setFrameStyle( TQFrame.Box | TQFrame.Raised ) - self.label.setLineWidth( 1 ) - self.label.setAlignment( TQt.AlignCenter ) - - self.connect( self, PYSIGNAL( "explain" ), self.label, SLOT( "setText(const TQString &" ) ) - - self.setMinimumSize( 100, 80 ) - self.setFocusPolicy( TQWidget.ClickFocus ) - - def contextMenuEvent(self, cmev): - contextMenu = TQPopupMenu( self ) - caption = TQLabel( "Context Menu", self ) - caption.setAlignment( TQt.AlignCenter ) - contextMenu.insertItem( caption ) - contextMenu.insertItem( "&New", self.news, TQt.CTRL+TQt.Key_N ) - contextMenu.insertItem( "&Open...", self.open, TQt.CTRL+TQt.Key_O ) - contextMenu.insertItem( "&Save", self.save, TQt.CTRL+TQt.Key_S ) - submenu = TQPopupMenu( self ) - submenu.insertItem( "&Print to printer", self.printDoc ) - submenu.insertItem( "Print to &file", self.printFile ) - submenu.insertItem( "Print to fa&x", self.fax ) - contextMenu.insertItem( "&Print", submenu ) - contextMenu.exec_loop( TQCursor.pos() ) - - def open( self ): - self.emit( PYSIGNAL( "explain" ), ( "File/Open selected", ) ) - - def news( self ): - self.emit( PYSIGNAL( "explain" ), ( "File/New selected", ) ) - - def save( self ): - self.emit( PYSIGNAL( "explain" ), ( "File/Save selected", ) ) - - def closeDoc( self ): - self.emit( PYSIGNAL( "explain" ), ( "File/Close selected", ) ) - - def undo( self ): - self.emit( PYSIGNAL( "explain" ), ( "Edit/Undo selected", ) ) - - def redo( self ): - self.emit( PYSIGNAL( "explain" ), ( "Edit/Redo selected", ) ) - - def normal( self ): - self.isBold = FALSE - self.isUnderline = FALSE - font = TQFont() - self.label.setFont( font ) - self.options.setItemChecked( self.boldID, self.isBold ) - self.options.setItemChecked( self.underlineID, self.isUnderline ) - self.emit( PYSIGNAL( "explain" ), ( "Options/Normal selected", ) ) - - def bold( self ): - self.isBold = not self.isBold - font = TQFont() - font.setBold( self.isBold ) - font.setUnderline( self.isUnderline ) - self.label.setFont( font ) - self.options.setItemChecked( self.boldID, self.isBold ) - self.emit( PYSIGNAL( "explain" ), ( "Options/Bold selected", ) ) - - def underline( self ): - self.isUnderline = not self.isUnderline - font = TQFont() - font.setBold( self.isBold ) - font.setUnderline( self.isUnderline ) - self.label.setFont( font ) - self.options.setItemChecked( self.underlineID, self.isUnderline ) - self.emit( PYSIGNAL("explain"), ( "Options/Underline selected", )) - - def about( self ): - TQMessageBox.about( self, "TQt Menu Example", - "This example demonstrates simple use of TQt menus.\n" - "You can cut and paste lines from it to your own\n" - "programs." ) - - def aboutTQt( self ): - TQMessageBox.aboutTQt( self, "TQt Menu Example" ) - - def printDoc( self ): - self.emit( PYSIGNAL( "explain" ), ( "File/Printer/Print selected", ) ) - - def printFile( self ): - self.emit( PYSIGNAL( "explain" ), ( "File/Printer/Print To File selected", ) ) - - def fax( self ): - self.emit( PYSIGNAL( "explain" ), ( "File/Printer/Print To Fax selected", ) ) - - def printerSetup( self ): - self.emit( PYSIGNAL( "explain" ), ( "File/Printer/Printer Setup selected", ) ) - - def resizeEvent( self, ev ): - self.label.setGeometry( 20, self.rect().center().y()-20, self.width()-40, 40 ) - - -a = TQApplication( sys.argv ) -m = MenuExample() - -m.setCaption( "TQt Examples - Menus" ) -a.setMainWidget( m ) -m.show() -a.exec_loop() diff --git a/examples3/progress.py b/examples3/progress.py deleted file mode 100755 index 3ebdd12..0000000 --- a/examples3/progress.py +++ /dev/null @@ -1,281 +0,0 @@ -#!/usr/bin/env python - -#/**************************************************************************** -#** $Id: progress.py 3.3.7 edited Aug 31 2005 $ -#** -#** Copyright (C) 1992-2005 Trolltech AS. All rights reserved. -#** -#** This file is part of an example program for TQt. This example -#** program may be used, distributed and modified without limitation. -#** -#** Converted to PyTQt3 by Hans-Peter Jansen -#** -#*****************************************************************************/ - -import sys -from python_tqt.qt import * -from random import randint - -class AnimatedThingy(TQLabel): - def __init__(self, parent, s): - TQLabel.__init__(self, parent) - self.label = TQString(s) - self.setEraseColor(TQt.white) - self.label.append("\n... and wasting CPU\nwith this animation!\n") - self.step = 0 - self.nqix = 10 - self.stepoff = 2 - self.stepmax = 7 - self.lwidth = 2 - self.tdelay = 100 - self.ox, self.oy = [], [] - for i in range(self.nqix): - self.ox.append((0, 0)) - self.oy.append((0, 0)) - self.x0, self.y0, self.x1, self.y1 = 0, 0, 0, 0 - self.dx0 = randint(0, self.stepmax) + self.stepoff - self.dy0 = randint(0, self.stepmax) + self.stepoff - self.dx1 = randint(0, self.stepmax) + self.stepoff - self.dy1 = randint(0, self.stepmax) + self.stepoff - - def show(self): - if not self.isVisible(): - self.startTimer(self.tdelay) - TQWidget.show(self) - - def hide(self): - TQWidget.hide(self) - self.killTimers() - - def sizeHint(self): - return TQSize(120, 100) - - def timerEvent(self, e): - p, pn = self._painter() - pn.setColor(self.eraseColor()) - p.setPen(pn) - self.step = step = (self.step + 1) % self.nqix - # erase line - p.drawLine(self.ox[step][0], self.oy[step][0], - self.ox[step][1], self.oy[step][1]) - # calc new line coordinates - ww, wh = self.width(), self.height() - self.x0, self.dx0 = self._inc(self.x0, self.dx0, ww) - self.y0, self.dy0 = self._inc(self.y0, self.dy0, wh) - self.x1, self.dx1 = self._inc(self.x1, self.dx1, ww) - self.y1, self.dy1 = self._inc(self.y1, self.dy1, wh) - self.ox[step] = (self.x0, self.x1) - self.oy[step] = (self.y0, self.y1) - self._drawqix(p, pn, step) - self._drawtxt(p) - - def paintEvent(self, event): - p, pn = self._painter() - p.setClipRect(event.rect()) - for i in range(self.nqix): - self._drawqix(p, pn, i) - self._drawtxt(p) - - def _painter(self): - p = TQPainter(self) - # we need to create a new pen from p.pen() with TQPen() in order - # to make it fully functional (changes are discarded otherwise) - pn = TQPen(p.pen()) - pn.setWidth(self.lwidth) - p.setPen(pn) - return p, pn - - def _drawqix(self, p, pn, step): - # rainbow effect - pn.setColor(TQColor(int((step * 255)/self.nqix), 255, 255, TQColor.Hsv)) - p.setPen(pn) - p.drawLine(self.ox[step][0], self.oy[step][0], - self.ox[step][1], self.oy[step][1]) - - def _drawtxt(self, p): - p.setPen(self.colorGroup().text()) - p.drawText(self.rect(), TQt.AlignCenter, self.label) - - def _inc(self, x, dx, b): - x += dx - if x < 0: - x = 0 - dx = randint(0, self.stepmax) + self.stepoff; - elif x >= b: - x = b - 1 - dx = -(randint(0, self.stepmax) + self.stepoff) - return x, dx - - -class CPUWaster(TQWidget): - def __init__(self): - TQWidget.__init__(self) - self.first_draw_item = 1000 - self.last_draw_item = 1006 - self.rects = 0 - self.timer_driven = 0 - self.default_label = 0 - self.got_stop = False - self.pb = None # non modal progress dialog - self.menubar = menubar = TQMenuBar(self, "menu") - self.file_ = file_ = TQPopupMenu() - menubar.insertItem("&File", file_) - for i in range(self.first_draw_item, self.last_draw_item + 1): - file_.insertItem(self.drawItemText(i), i) - file_.setAccel(TQKeySequence( - "Ctrl+%s" % (i - self.first_draw_item)), i) - self.connect(menubar, SIGNAL("activated(int)"), self.doMenuItem) - file_.insertSeparator() - file_.insertItem("Quit", tqApp, SLOT("quit()"), TQKeySequence("Ctrl+Q")) - self.options = options = TQPopupMenu() - menubar.insertItem("&Options", options) - self.ld_id = options.insertItem("Loop driven", self.loopDriven, - TQKeySequence("Alt+L")) - self.td_id = options.insertItem("Timer driven", self.timerDriven, - TQKeySequence("Alt+T")) - options.insertSeparator() - self.dl_id = options.insertItem("Default label", self.defaultLabel, - TQKeySequence("Alt+D")) - self.cl_id = options.insertItem("Custom label", self.customLabel, - TQKeySequence("Alt+C")) - options.insertSeparator() - self.md_id = options.insertItem("No minimum duration", - self.toggleMinimumDuration, - TQKeySequence("Alt+M")) - options.setCheckable(True) - # default option settings - self.timerDriven() - self.customLabel() - self.toggleMinimumDuration() - self.resize(400, 300) - self.setEraseColor(TQt.black) - - def drawItemRects(self, id_): - r = 100 - for n in range(id_ - self.first_draw_item): - if not n % 3: - r *= 4 - else: - r *= 5 - return r - - def drawItemText(self, id_): - return TQString("%d Rectangles" % self.drawItemRects(id_)) - - def enableDrawingItems(self, yes): - for i in range(self.first_draw_item, self.last_draw_item + 1): - self.menubar.setItemEnabled(i, yes) - - # slots - def doMenuItem(self, id_): - if id_ >= self.first_draw_item and id_ <= self.last_draw_item: - self.draw(self.drawItemRects(id_)) - - def timerDriven(self): - self.timer_driven = True - self.options.setItemChecked(self.td_id, True) - self.options.setItemChecked(self.ld_id, False) - - def loopDriven(self): - self.timer_driven = False - self.options.setItemChecked(self.ld_id, True) - self.options.setItemChecked(self.td_id, False) - - def defaultLabel(self): - self.default_label = True - self.options.setItemChecked(self.dl_id, True) - self.options.setItemChecked(self.cl_id, False) - - def customLabel(self): - self.default_label = False - self.options.setItemChecked(self.dl_id, False) - self.options.setItemChecked(self.cl_id, True) - - def toggleMinimumDuration(self): - self.options.setItemChecked(self.md_id, - not self.options.isItemChecked(self.md_id)) - - def stopDrawing(self): - self.got_stop = True - - def newProgressDialog(self, label, steps, modal): - d = TQProgressDialog(label, "Cancel", steps, self, "progress", modal) - if self.options.isItemChecked(self.md_id): - d.setMinimumDuration(0) - if not self.default_label: - d.setLabel(AnimatedThingy(d, label)) - d.setCaption("Please Wait") - return d - - def draw(self, n): - if self.timer_driven: - if self.pb: - tqWarning("This cannot happen!") - return - - self.rects = n - self.pb = self.newProgressDialog("Drawing rectangles.\n" - "Using timer event.", n, False) - self.connect(self.pb, SIGNAL("cancelled()"), self.stopDrawing) - self.enableDrawingItems(False) - self.startTimer(0) - self.got_stop = False - else: # loop driven with modal progress dialog - lpb = self.newProgressDialog("Drawing rectangles.\n" - "Using loop.", n, True) - p = TQPainter(self) - for i in range(n): - lpb.setProgress(i) - if lpb.wasCancelled(): - break - self._draw(p) - self._clear(p) - lpb.cancel() - del lpb - - def timerEvent(self, e): - if not self.got_stop: - self.pb.setProgress(self.pb.totalSteps() - self.rects) - self.rects -= 1 - p = TQPainter(self) - self._draw(p) - - if not self.rects or self.got_stop: - if not self.got_stop: - self.pb.setProgress(self.pb.totalSteps()) - self._clear(p) - self.enableDrawingItems(True) - self.killTimers() - self.pb.cancel() - del self.pb - self.pb = None - - def _draw(self, p): - ww = self.width() - wh = self.height() - if ww > 8 and wh > 8: - c = TQColor(randint(0, 255), randint(0, 255), randint(0, 255)) - x = randint(0, ww - 8) - y = randint(0, wh - 8) - w = randint(0, ww - x) - h = randint(0, wh - y) - p.fillRect(x, y, w, h, TQBrush(c)) - - def _clear(self, p): - p.fillRect(0, 0, self.width(), self.height(), TQBrush(self.eraseColor())) - - -if __name__ == "__main__": - app = TQApplication(sys.argv) - try: - n = int(sys.argv[1]) - except: - n = 1 - wlst = [] # keep a ref around - for i in range(n): - cpuw = CPUWaster() - if i == 0: - app.setMainWidget(cpuw) - cpuw.show() - wlst.append(cpuw) - app.exec_loop() diff --git a/examples3/progressbar.py b/examples3/progressbar.py deleted file mode 100755 index e33362e..0000000 --- a/examples3/progressbar.py +++ /dev/null @@ -1,155 +0,0 @@ -#!/usr/bin/env python - -"""*********************************************************************** -** $Id: progressbar.py,v 1.1 2003/06/10 14:51:24 phil Exp $ -** -** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. -** -** This file is part of an example program for TQt. This example -** program may be used, distributed and modified without limitation. -** -**************************************************************************""" - -#import pdb -import sys -from python_tqt.qt import * - -FALSE = 0 -TRUE = 1 - -class ProgressBar( TQButtonGroup ): - # Constructor - # Creates child widgets of the ProgressBar widget - def __init__( self, parent=None, name=None ): - TQButtonGroup.__init__( self, 0, TQt.Horizontal, "Progress Bar", parent, name ) - - self.timer = TQTimer() - - self.setMargin( 10 ) - toplayout = TQGridLayout( self.layout(), 2, 2, 5) - - self.setRadioButtonExclusive( TRUE ) - - # insert three radiobuttons which the user can use - # to set the speed of the progress and two pushbuttons - # to start/pause/continue and reset the progress - self.slow = TQRadioButton( "&Slow", self ) - self.normal = TQRadioButton( "&Normal", self ) - self.fast = TQRadioButton( "&Fast", self ) - vb1 = TQVBoxLayout( ) - toplayout.addLayout( vb1, 0, 0 ) - vb1.addWidget( self.slow ) - vb1.addWidget( self.normal ) - vb1.addWidget( self.fast ) - - # two push buttons, one for start, for for reset. - self.start = TQPushButton( "&Start", self ) - self.reset = TQPushButton( "&Reset", self ) - - vb2 = TQVBoxLayout() - toplayout.addLayout( vb2, 0, 1 ) - vb2.addWidget( self.start ) - vb2.addWidget( self.reset ) - - # Create the progressbar - self.progress = TQProgressBar( 100, self ) - #self.progress.setStyle( TQMotifStyle() ) - toplayout.addMultiCellWidget( self.progress, 1, 1, 0, 1 ) - - # connect the clicked() SIGNALs of the pushbuttons to SLOTs - self.connect( self.start, SIGNAL("clicked()"), self.slotStart ) - self.connect( self.reset, SIGNAL("clicked()"), self.slotReset ) - - # connect the timeout() SIGNAL of the progress-timer to a SLOT - self.connect( self.timer, SIGNAL("timeout()"), self.slotTimeout ) - # Let's start with normal speed... - self.normal.setChecked( TRUE ) - - # some contraints - self.start.setFixedWidth( 80 ) - self.setMinimumWidth( 300 ) - - # SLOT slotStart - # This SLOT is called if the user clicks start/pause/continue button - def slotStart( self ): - # If the progress bar is at the beginning... - if self.progress.progress() == -1 : - # ...set according to the checked speed-radiobutton the - # the number of steps which are needed to complete the process - if self.slow.isChecked(): - self.progress.setTotalSteps( 10000 ) - elif self.normal.isChecked() : - self.progress.setTotalSteps( 1000 ) - else : - self.progress.setTotalSteps( 50 ) - - # disable the speed-radiobuttons - self.slow.setEnabled( FALSE ) - self.normal.setEnabled( FALSE ) - self.fast.setEnabled( FALSE ) - - # If the progress is not running... - if not self.timer.isActive() : - # ...start the timer (and so the progress) with a interval of 1 ms... - self.timer.start( 1 ) - # ...and rename the start/pause/continue button to Pause - self.start.setText( "&Pause" ) - else : # if the prgress is running... - # ...stop the timer (and so the prgress)... - self.timer.stop() - # ...and rename the start/pause/continue button to Continue - self.start.setText( "&Continue" ) - - # SLOT slotReset - # This SLOT is called when the user clicks the reset button - def slotReset( self ): - # stop the timer and progress - self.timer.stop() - - # rename the start/pause/continue button to Start... - self.start.setText( "&Start" ) - # ...and enable this button - self.start.setEnabled( TRUE ) - - # enable the speed-radiobuttons - self.slow.setEnabled( TRUE ) - self.normal.setEnabled( TRUE ) - self.fast.setEnabled( TRUE ) - - # reset the progressbar - self.progress.reset() - - # SLOT slotTimeout - # This SLOT is called each ms when the timer is - # active (== progress is running) - def slotTimeout( self ): - p = self.progress.progress() - - # If the progress is complete... - if p == self.progress.totalSteps() : - # ...rename the start/pause/continue button to Start... - self.start.setText( "&Start" ) - # ...and disable it... - self.start.setEnabled( FALSE ) - # ...and return - return - - # If the process is not complete increase it - p += 1 - self.progress.setProgress( p ) - - - #TQPushButton *start, *pause, *reset; - -def main( args ): - a = TQApplication( args ) - - progressbar = ProgressBar() - progressbar.setCaption("TQt Example - ProgressBar") - a.setMainWidget(progressbar) - progressbar.show() - - a.exec_loop() - -if __name__=="__main__": - main(sys.argv) diff --git a/examples3/qdir.py b/examples3/qdir.py deleted file mode 100755 index 358c796..0000000 --- a/examples3/qdir.py +++ /dev/null @@ -1,324 +0,0 @@ -#!/usr/bin/env python -# -# 2005-02-12 initial version hp - -from __future__ import print_function -import os -import pickle -from python_tqt.qt import * -from dirview import Directory, DirectoryView - -bookmarks = [ - "22 14 8 1", - "# c #000080", - "a c #585858", - "b c #000000", - "c c #ffffff", - "d c #ffffff", - "e c #ffffff", - "f c #000000", - ". c None", - "...bb.................", - "..bacb....bbb.........", - "..badcb.bbccbab.......", - "..bacccbadccbab.......", - "..baecdbcccdbab.......", - "..bacccbacccbab.......", - "..badcdbcecdfab.......", - "..bacecbacccbab.......", - "..baccdbcccdbab.......", - "...badcbacdbbab.......", - "....bacbcbbccab.......", - ".....babbaaaaab.......", - ".....bbabbbbbbb.......", - "......bb.............." -] - -home = [ - "16 15 4 1", - "# c #000000", - "a c #ffffff", - "b c #c0c0c0", - ". c None", - ".......##.......", - "..#...####......", - "..#..#aabb#.....", - "..#.#aaaabb#....", - "..##aaaaaabb#...", - "..#aaaaaaaabb#..", - ".#aaaaaaaaabbb#.", - "###aaaaaaaabb###", - "..#aaaaaaaabb#..", - "..#aaa###aabb#..", - "..#aaa#.#aabb#..", - "..#aaa#.#aabb#..", - "..#aaa#.#aabb#..", - "..#aaa#.#aabb#..", - "..#####.######.." -] - - -class PixmapView(TQScrollView): - def __init__(self, parent): - TQScrollView.__init__(self, parent) - self.pixmap = None - self.viewport().setBackgroundMode(self.PaletteBase) - - def setPixmap(self, pix): - self.pixmap = pix - self.resizeContents(pix.size().width(), pix.size().height()) - self.viewport().repaint(False) - - def drawContents(self, p, cx, cy, cw, ch): - p.fillRect(cx, cy, cw, ch, self.colorGroup().brush(TQColorGroup.Base)) - p.drawPixmap(0, 0, self.pixmap) - - -class Preview(TQWidgetStack): - def __init__(self, parent): - TQWidgetStack.__init__(self, parent) - self.normalText = TQMultiLineEdit(self) - self.normalText.setReadOnly(True) - self.html = TQTextView(self) - self.pixmap = PixmapView(self) - self.raiseWidget(self.normalText) - - def showPreview(self, url, size): - if url.isLocalFile(): - path = url.path() - fi = TQFileInfo(path) - if fi.isFile() and fi.size() > size * 1000: - self.normalText.setText( - "The File\n%s\nis too large, so I don't show it!" % path) - self.raiseWidget(self.normalText) - return - pix = TQPixmap(path) - if pix.isNull(): - if fi.isFile(): - err = False - try: - text = open(path.latin1(), "r").read() - except IOError as msg: - text = TQString(str(msg)) - err = True - if not err and fi.extension().lower().contains("htm"): - url = self.html.mimeSourceFactory().makeAbsolute( - path, self.html.context()) - self.html.setText(text, url) - self.raiseWidget(self.html) - return - else: - self.normalText.setText(text) - self.raiseWidget(self.normalText) - return - else: - self.normalText.setText("") - self.raiseWidget(self.normalText) - else: - self.pixmap.setPixmap(pix) - self.raiseWidget(self.pixmap) - else: - self.normalText.setText("I only show local files!") - self.raiseWidget(self.normalText) - - -# We can't instantiate TQFilePreview directly because it is abstract. Note that -# the previewUrl() abstract is patched in later to work around the fact that -# you can't multiply inherit from more than one wrapped class. -class FilePreview(TQFilePreview): - pass - - -class PreviewWidget(TQVBox): - def __init__(self, parent): - TQVBox.__init__(self, parent) - self.setSpacing( 5 ) - self.setMargin( 5 ) - row = TQHBox(self) - row.setSpacing(5) - TQLabel("Only show files smaller than: ", row) - self.sizeSpinBox = TQSpinBox(1, 10000, 1, row) - self.sizeSpinBox.setSuffix(" KB") - self.sizeSpinBox.setValue(128) - row.setFixedHeight(10 + self.sizeSpinBox.sizeHint().height()) - self.__preview = Preview(self) - # workaround sip inability of multiple inheritance - # create a local TQFilePreview instance and redirect - # the method, which is called on preview, to us - self.preview = FilePreview() - self.preview.previewUrl = self.previewUrl - - def previewUrl(self, url): - self.__preview.showPreview(url, self.sizeSpinBox.value()) - - -class CustomFileDialog(TQFileDialog): - def __init__(self, preview = False): - TQFileDialog.__init__(self, None, None, True) - self.bookmarkFile = ".pybookmarks" - self.bookmarkList = [] - if os.path.exists(self.bookmarkFile): - try: - self.bookmarkList = pickle.loads(open(self.bookmarkFile, "rb").read()) - except IOError as msg: - print(msg) - self.setDir("/") - self.dirView = DirectoryView(self, None, True) - self.dirView.addColumn("") - self.dirView.header().hide() - root = Directory(self.dirView, "/") - root.setOpen(True) - self.dirView.setFixedWidth(200) - self.addLeftWidget(self.dirView) - p = TQPushButton(self) - p.setPixmap(TQPixmap(bookmarks)) - TQToolTip.add(p, "Bookmarks") - self.bookmarkMenu = TQPopupMenu(self) - self.connect(self.bookmarkMenu, SIGNAL("activated(int)"), - self.bookmarkChosen) - self.addId = self.bookmarkMenu.insertItem("Add bookmark") - self.bookmarkMenu.insertSeparator() - for l in self.bookmarkList: - self.bookmarkMenu.insertItem(l) - p.setPopup(self.bookmarkMenu) - self.addToolButton(p, True) - self.connect(self.dirView, PYSIGNAL("folderSelected(const TQString &)"), - self.setDir2) - self.connect(self, SIGNAL("dirEntered(const TQString &)"), - self.dirView.setDir) - b = TQToolButton(self) - TQToolTip.add(b, "Go Home!") - b.setPixmap(TQPixmap(home)) - self.connect(b, SIGNAL("clicked()"), self.goHome) - self.addToolButton(b) - - if preview: - self.setContentsPreviewEnabled(True) - pw = PreviewWidget(self) - self.setContentsPreview(pw, pw.preview) - self.setViewMode(TQFileDialog.List) - self.setPreviewMode(TQFileDialog.Contents) - - w = self.width() - h = self.height() - if preview: - self.resize(w + w / 2, h + h / 3) - else: - self.resize(w + w / 3, h + h / 4) - - def done(self, r): - if self.bookmarkList: - try: - open(self.bookmarkFile, "wb").write(pickle.dumps(self.bookmarkList)) - except IOError as msg: - print(msg) - return TQFileDialog.done(self, r) - - def showEvent(self, e): - TQFileDialog.showEvent(self, e) - self.dirView.setDir(self.dirPath()) - - def setDir2(self, path): - self.blockSignals(True) - self.setDir(path) - self.blockSignals(False) - - def bookmarkChosen(self, i): - if i == self.addId: - # keep bookmarks pythonic - dp = self.dirPath().latin1() - if dp not in self.bookmarkList: - self.bookmarkList.append(dp) - self.bookmarkMenu.insertItem(dp) - else: - self.setDir(self.bookmarkMenu.text(i)) - - def goHome(self): - if os.getenv("HOME"): - self.setDir(os.getenv("HOME")) - else: - self.setDir("/") - - -if __name__ == '__main__': - import sys - import getopt - - def usage(msg = None): - if msg: - print(msg, file=sys.stderr) - print("""\ -usage: qdir [--any | --dir | --custom] [--preview] [--default f] {--filter f} [caption ...] - --any Get any filename, need not exist. - --dir Return a directory rather than a file. - --custom Opens a customized TQFileDialog with - dir browser, bookmark menu, etc. - --preview Show a preview widget. - --default f Start from directory/file f. - --filter f eg. '*.gif' '*.bmp' - caption ... Caption for dialog. -""", file=sys.stderr) - sys.exit(1) - - def main(): - options = ["help", "any", "dir", "custom", "preview", "default=", "filter="] - mode = TQFileDialog.ExistingFile - preview = False - custom = False - start = None - filter = TQString.null - app = TQApplication(sys.argv) - - try: - optlist, args = getopt.getopt(sys.argv[1:], "h", options) - except getopt.error as msg: - usage(msg) - - for opt, par in optlist: - if opt in ("-h", "--help"): - usage() - elif opt == "--any": - mode = TQFileDialog.AnyFile - elif opt == "--dir": - mode = TQFileDialog.Directory - elif opt == "--default": - start = par - elif opt == "--filter": - filter = par - elif opt == "--preview": - preview = True - elif opt == "--custom": - custom = True - if args: - caption = " ".join(args) - elif mode == TQFileDialog.Directory: - caption = "Choose directory..." - else: - caption = "Choose file..." - if not start: - start = TQDir.currentDirPath() - if not custom: - fd = TQFileDialog(TQString.null, filter, None, None, True) - fd.setMode(mode) - if preview: - fd.setContentsPreviewEnabled(True) - pw = PreviewWidget(fd) - fd.setContentsPreview(pw, pw.preview) - fd.setViewMode(TQFileDialog.List) - fd.setPreviewMode(TQFileDialog.Contents) - w = fd.width() - h = fd.height() - fd.resize(w + w / 3, h + h / 4) - fd.setCaption(caption) - fd.setSelection(start) - if fd.exec_loop() == TQDialog.Accepted: - print("%s\n" % fd.selectedFile().latin1()) - return 0 - else: - return 1 - else: - fd = CustomFileDialog(preview) - fd.exec_loop() - return 1 - - sys.exit(main()) diff --git a/examples3/qmag.py b/examples3/qmag.py deleted file mode 100755 index 186a473..0000000 --- a/examples3/qmag.py +++ /dev/null @@ -1,233 +0,0 @@ -#!/usr/bin/env python - -#**************************************************************************** -#** $Id: qmag.py,v 1.1 2002/06/20 18:52:31 phil Exp $ -#** -#** Copyright (C) 1992-1998 Troll Tech AS. All rights reserved. -#** -#** This file is part of an example program for PyTQt. This example -#** program may be used, distributed and modified without limitation. -#** -#*****************************************************************************/ - -import sys -from python_tqt.qt import * - -TRUE = 1 -FALSE = 0 - -zoomfactors = ["100%","200%","300%","400%","500%","600%","700%","800%","1600%"] - -refreshrates = [ - "No autorefresh", "50 per second", "4 per second", "3 per second", - "2 per second", "Every second", "Every two seconds", "Every three seconds", - "Every five seconds", "Every ten seconds"] - -timer = (0, 20, 250, 333, 500, 1000, 2000, 3000, 5000, 10000) - -class MagWidget(TQWidget): - def __init__(self, tqApp, parent = None, name = None): - self.qApp = tqApp - TQWidget.__init__(self, parent, name) - self.pm = TQPixmap() # pixmap magnified - self.p = TQPixmap() # pixmap - self.image = TQImage() # image of pixmap (for RGB) - self.z = 0 # zoom factor - self.r = 0 # autorefresh rate (index into refreshrates) - self.grabbing = FALSE # TRUE if currently grabbing - self.grabx = -1 - self.graby = -1 - - self.zoom = TQComboBox(FALSE, self) - self.zoom.insertStrList(zoomfactors, len(zoomfactors)) - self.connect(self.zoom, SIGNAL("activated(int)"), - self.setZoom) - - self.refresh = TQComboBox(FALSE, self) - self.refresh.insertStrList(refreshrates, len(refreshrates)) - self.connect(self.refresh, SIGNAL("activated(int)"), - self.setRefresh) - - x = 0 - w = 0 - h = 20 - for s in zoomfactors: - cw = self.zoom.fontMetrics().width(s) - w = max(cw, w) - self.zoom.setGeometry(x, 2, w + 30, h) - - x = w + 34 - w = 0 - for s in refreshrates: - cw = self.refresh.fontMetrics().width(s) - w = max(cw, w) - self.refresh.setGeometry(x, 2, w + 30, h) - - self.saveButton = TQPushButton(self) - self.connect(self.saveButton, SIGNAL("clicked()"), self.save) - self.saveButton.setText("Save") - self.saveButton.setGeometry(x + w + 30 + 2, 2, - 10 + self.saveButton.fontMetrics().width("Save"), h) - - self.quitButton = TQPushButton(self) - self.connect(self.quitButton, SIGNAL("clicked()"), self.qApp, SLOT("quit()")) - self.quitButton.setText("Quit") - self.quitButton.setGeometry(self.saveButton.geometry().right() + 2, 2, - 10 + self.quitButton.fontMetrics().width("Quit"), h) - - self.rgb = TQLabel(self) - self.rgb.setText("") - self.rgb.setAlignment(TQt.AlignVCenter) - self.rgb.resize(self.width(), self.rgb.fontMetrics().height() + 4) - - self.yoffset = self.zoom.height() + 4 + self.rgb.height() - self.setMinimumSize(self.quitButton.geometry().topRight().x() + 2, - self.yoffset + 20) - w = self.quitButton.geometry().topRight().x() + 2 - self.resize(w, w) - - self.setMouseTracking(TRUE) - self.grabx = self.qApp.desktop().width() / 2 - self.graby = self.qApp.desktop().height() / 2 - self.grabAround(TQPoint(self.grabx, self.graby)) - - #self.zoom.setCurrentItem(1) # grabAround sets zoom factor - #self.setZoom(1) - self.refresh.setCurrentItem(5) - self.setRefresh(5) - - def setZoom(self, index): - if index == 8: - self.z = 16 - else: - self.z = index + 1 - self.grab() - - def setRefresh(self, index): - self.r = index - self.killTimers() - if index and not self.grabbing: - #print "st:", timer[index] - self.startTimer(timer[index]) - - def save(self): - if not self.p.isNull(): - self.killTimers() - fn = TQFileDialog.getSaveFileName() - if not fn.isEmpty(): - self.p.save(fn, "BMP") - if self.r: - self.startTimer(timer[self.r]) - - def grab(self): - if not self.isVisible() or self.grabx < 0 or self.graby < 0: - return - - w = (self.width() + self.z - 1) / self.z - h = (self.height() + self.z - 1 - self.yoffset) / self.z - - if w < 1 or h < 1: - return - - x = self.grabx - w / 2 - y = self.graby - h / 2 - - if x + w > TQApplication.desktop().width(): - x = TQApplication.desktop().width() - w - elif x < 0: - x = 0 - - if y + h > TQApplication.desktop().height(): - y = TQApplication.desktop().height() - h - elif y < 0: - y = 0 - - self.p = TQPixmap.grabWindow(TQApplication.desktop().winId(), x, y, w, h) - self.image = self.p.convertToImage() - m = TQWMatrix() - #print "z:", self.z - m.scale(float(self.z), float(self.z)) - self.pm = self.p.xForm(m) - self.repaint(FALSE) - - def paintEvent(self, e): - if not self.pm.isNull(): - paint = TQPainter(self) - paint.drawPixmap(0, self.zoom.height() + 4, self.pm, - 0, 0, self.width(), self.height() - self.yoffset) - - def mousePressEvent(self, e): - if not self.grabbing: - self.grabbing = TRUE - self.killTimers() - self.grabMouse(TQt.crossCursor) - self.grabx = -1 - self.graby = -1 - else: - self.grabx = self.mapToGlobal(e.pos()).x() - self.graby = self.mapToGlobal(e.pos()).y() - - def mouseReleaseEvent(self, e): - if self.grabbing and self.grabx >= 0 and self.graby >= 0: - self.grabbing = FALSE - self.grabAround(e.pos()) - self.releaseMouse() - - def grabAround(self, pos): - rx = self.mapToGlobal(pos).x() - ry = self.mapToGlobal(pos).y() - w = abs(rx - self.grabx) - h = abs(ry - self.graby) - if w > 10 and h > 10: - pz = 1 - while w*pz*h*pz < self.width()*(self.height()-self.yoffset) and \ - w*pz < TQApplication.desktop().width() and \ - h*pz < TQApplication.desktop().height(): - pz += 1 - if (w*pz*h*pz - self.width()*(self.height()-self.yoffset)) > \ - (self.width()*(self.height()-self.yoffset) - w*(pz-1)*h*(pz-1)): - pz -= 1 - if pz < 1: - pz = 1 - elif pz > 8: - pz = 8 - self.zoom.setCurrentItem(pz-1) - self.z = pz - self.grabx = min(rx, self.grabx) + w / 2 - self.graby = min(ry, self.graby) + h / 2 - #self.resize(w*self.z, h*self.z*self.yoffset) - self.grab() - - def mouseMoveEvent(self, e): - if self.grabbing or self.pm.isNull() or \ - e.pos().y() > self.height() - self.zoom.fontMetrics().height() - 4 or \ - e.pos().y() < self.zoom.height() + 4: - self.rgb.setText("") - else: - x = e.pos().x() / self.z - y = (e.pos().y() - self.zoom.height() - 4) / self.z - pixelinfo = "" - if self.image.valid(x, y): - px = self.image.pixel(x, y) - pixelinfo = "%3d,%3d,%3d #%02x%02x%02x" % ( - tqRed(px), tqGreen(px), tqBlue(px), - tqRed(px), tqGreen(px), tqBlue(px)) - self.rgb.setText("x=%d, y=%d %s" % \ - (x + self.grabx, y + self.graby, pixelinfo)) - - def focusOutEvent(self, e): - self.rgb.setText("") - - def timerEvent(self, e): - self.grab() - - def resizeEvent(self, e): - self.rgb.setGeometry(0, self.height() - self.rgb.height(), - self.width(), self.rgb.height()) - -if __name__=='__main__': - app = TQApplication( sys.argv ) - m = MagWidget(app) - app.setMainWidget(m) - m.show() - app.exec_loop() diff --git a/examples3/qt.png b/examples3/qt.png deleted file mode 100644 index d63e16f..0000000 Binary files a/examples3/qt.png and /dev/null differ diff --git a/examples3/qtlogo.png b/examples3/qtlogo.png deleted file mode 100644 index c83c7b2..0000000 Binary files a/examples3/qtlogo.png and /dev/null differ diff --git a/examples3/rangecontrols.py b/examples3/rangecontrols.py deleted file mode 100755 index 14588c8..0000000 --- a/examples3/rangecontrols.py +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/env python - -"""************************************************************************** -** $Id: rangecontrols.py,v 1.1 2003/07/01 14:18:37 phil Exp $ -** -** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. -** -** This file is part of an example program for TQt. This example -** program may be used, distributed and modified without limitation. -** -***************************************************************************""" - -import sys -from python_tqt.qt import * - -INT_MAX = sys.maxsize - -class RangeControls( TQVBox ): - def __init__( self, parent=None, name=None ): - TQVBox.__init__( self, parent, name ) - - row1 = TQHBox( self ) - cell2 = TQVBox( row1 ) - cell2.setMargin( 10 ) - cell2.setFrameStyle( TQFrame.WinPanel | TQFrame.Sunken ) - - TQWidget( cell2 ) - - label1 = TQLabel( TQString( "Enter a value between\n%1 and %2:" ).arg( -INT_MAX ).arg( INT_MAX ), cell2 ) - label1.setMaximumHeight( label1.sizeHint().height() ) - sb1 = TQSpinBox( -INT_MAX, INT_MAX, 1, cell2 ) - sb1.setValue( 0 ) - - label2 = TQLabel( "Enter a zoom value:", cell2 ) - label2.setMaximumHeight( label2.sizeHint().height() ) - sb2 = TQSpinBox( 0, 1000, 10, cell2 ) - sb2.setSuffix( " %" ) - sb2.setSpecialValueText( "Automatic" ) - - label3 = TQLabel( "Enter a price:", cell2 ) - label3.setMaximumHeight( label3.sizeHint().height() ) - sb3 = TQSpinBox( 0, INT_MAX, 1, cell2 ) - sb3.setPrefix( "$" ) - sb3.setValue( 355 ) - - TQWidget( cell2 ) - - row2 = TQHBox( self ) - - cell3 = TQVBox( row2 ) - cell3.setMargin( 10 ) - cell3.setFrameStyle( TQFrame.WinPanel | TQFrame.Sunken ) - hslider = TQSlider( 0, 64, 1, 33, TQt.Horizontal, cell3 ) - lcd2 = TQLCDNumber( 2, cell3 ) - lcd2.display( 33 ) - lcd2.setSegmentStyle( TQLCDNumber.Filled ) - self.connect( hslider, SIGNAL("valueChanged( int )"), lcd2, SLOT("display( int )") ) - - cell4 = TQHBox( row2 ) - cell4.setFrameStyle( TQFrame.WinPanel | TQFrame.Sunken ) - cell4.setMargin( 10 ) - vslider = TQSlider( 0, 64, 1, 8, TQt.Vertical, cell4 ) - lcd3 = TQLCDNumber( 3, cell4 ) - lcd3.display( 8 ) - self.connect( vslider, SIGNAL("valueChanged( int )"), lcd3, SLOT("display( int )") ) - -def main( args ): - a = TQApplication( args ) - - rangecontrols = RangeControls() - rangecontrols.resize( 500, 300 ) - rangecontrols.setCaption( "TQt Example - Range Control Widgets" ); - a.setMainWidget( rangecontrols ) - rangecontrols.show() - - a.exec_loop() - -if __name__=="__main__": - main(sys.argv) diff --git a/examples3/richtext.py b/examples3/richtext.py deleted file mode 100755 index 2e6abac..0000000 --- a/examples3/richtext.py +++ /dev/null @@ -1,136 +0,0 @@ -#!/usr/bin/env python - -"""************************************************************************** -** $Id: richtext.py,v 1.1 2003/07/01 14:18:37 phil Exp $ -** -** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. -** -** This file is part of an example program for TQt. This example -** program may be used, distributed and modified without limitation. -** -***************************************************************************""" - -import sys -from python_tqt.qt import * - -sayings = [ - "Saying 1:
" - "


" - "Evil is that which one believes of others. It is a sin to believe evil " - "of others, but it is seldom a mistake.

" - "
-- H.L. Mencken
", - - "Saying 2:
" - "


" - "A well-used door needs no oil on its hinges.
" - "A swift-flowing steam does not grow stagnant.
" - "Neither sound nor thoughts can travel through a vacuum.
" - "Software rots if not used.

" - "These are great mysteries.


" - "
-- Geoffrey James, \"The Tao of Programming\"
", - - "Saying 3:
" - "


" - "Show business is just like high school, except you get paid.

" - "
-- Martin Mull
", - - "Saying 4:
" - "


" - "The Least Successful Executions
" - "

History has furnished us with two executioners worthy of attention. " - "The first performed in Sydney in Australia. In 1803 three attempts were " - "made to hang a Mr. Joseph Samuels. On the first two of these the rope " - "snapped, while on the third Mr. Samuels just hung there peacefully until he " - "and everyone else got bored. Since he had proved unsusceptible to capital " - "punishment, he was reprieved.

" - "

The most important British executioner was Mr. James Berry who " - "tried three times in 1885 to hang Mr. John Lee at Exeter Jail, but on each " - "occasion failed to get the trap door open." - "

In recognition of this achievement, the Home Secretary commuted " - "Lee's sentence to \"life\" imprisonment. He was released in 1917, emigrated " - "to America and lived until 1933.



" - "
-- Stephen Pile, \"The Book of Heroic Failures\"
", - - "Saying 5:
" - "


" - "If you can, help others. If you can't, at least don't hurt others.

" - "
-- the Dalai Lama
", - - "Saying 6:
" - "


" - "Television has brought back murder into the home -- where it belongs.

" - "
-- Alfred Hitchcock
", - - "Saying 7:
" - "


" - "I don't know who my grandfather was; I am much more concerned to know " - "what his grandson will be.

" - "
-- Abraham Lincoln
", - - 0 -] - -class MyRichText( TQVBox ): - def __init__( self, parent = None, name = None ): - TQVBox.__init__( self, parent, name ) - - self.setMargin( 5 ) - - self.view = TQTextView( self ) - #self.view.setText( "This is a Test with italic stuff" ) - paper = TQBrush() - paper.setPixmap( TQPixmap( "marble.png" ) ) - if paper.pixmap() != 0 : - self.view.setPaper( paper ) - else : - self.view.setPaper( white ) - - self.view.setText( sayings[0] ) - self.view.setMinimumSize( 450, 250 ) - - buttons = TQHBox( self ) - buttons.setMargin( 5 ) - - self.bClose = TQPushButton( "&Close", buttons ) - self.bPrev = TQPushButton( "<< &Prev", buttons ) - self.bNext = TQPushButton( "&Next >>", buttons ) - - self.bPrev.setEnabled( False ) - - self.connect( self.bClose, SIGNAL("clicked()"), tqApp, SLOT("quit()") ) - self.connect( self.bPrev, SIGNAL("clicked()"), self.prev ) - self.connect( self.bNext, SIGNAL("clicked()"), self.__next__ ) - - self.num = 0 - - def prev( self ): - if self.num <= 0 : - return - self.num -= 1 - self.view.setText( sayings[self.num] ) - if self.num == 0 : - self.bPrev.setEnabled( False ) - self.bNext.setEnabled( True ) - - def __next__( self ): - self.num += 1 - if not sayings[self.num]: - return - self.view.setText( sayings[self.num] ) - if not sayings[self.num + 1]: - self.bNext.setEnabled( False ) - self.bPrev.setEnabled( True ) - -def main( args ): - a = TQApplication(sys.argv) # application object - - richtext = MyRichText() - richtext.resize( 450, 350 ); - richtext.setCaption( "TQt Example - Richtext" ) - a.setMainWidget( richtext ) - richtext.show() - - a.exec_loop() - -if __name__=="__main__": - main(sys.argv) diff --git a/examples3/secret.py b/examples3/secret.py deleted file mode 100644 index 34560ed..0000000 --- a/examples3/secret.py +++ /dev/null @@ -1,65 +0,0 @@ -# This is part of the dragdrop example. - - -from python_tqt.qt import * - - -def canDecode(e): - return e.provides( "secret/magic" ) - - -def decode(e): - payload = str(e.data( "secret/magic" )) - if ( str(payload) != '' ): - e.accept() - return TQString("The secret number is "+str(ord(payload)) ) - - return None - - -class SecretDrag(TQStoredDrag): - def __init__(self, secret, parent=None, name=None): - TQStoredDrag.__init__(self, 'secret/magic', parent, name) - data = TQByteArray(chr(secret)) - self.setEncodedData( data ) - - -# XPM -picture_xpm = [ - "16 16 3 1", - " c None", - ". c #000000", - "X c #FFFF00", - " ..... ", - " ..XXXXX.. ", - " .XXXXXXXXX. ", - " .XXXXXXXXXXX. ", - " .XX..XXX..XX. ", - ".XXXXXXXXXXXXX. ", - ".XX...XXX...XX. ", - ".XXX..XXX..XXX. ", - ".XXXXXXXXXXXXX. ", - ".XXXXXX.XXXXXX. ", - " .XX.XX.XX.XX. ", - " .XXX..X..XXX. ", - " .XXXXXXXXX. ", - " ..XXXXX.. ", - " ..... ", - " " -] - - -class SecretSource(TQLabel): - def __init__(self, secret, parent=None, name=None): - TQLabel.__init__(self, "Secret", parent, name) - self.setEraseColor( TQt.blue.light() ) - self.setFrameStyle( TQLabel.Box | TQLabel.Sunken ) - self.setMinimumHeight( self.sizeHint().height()*2 ) - self.setAlignment( TQLabel.AlignCenter ) - self.mySecret = secret - - def mousePressEvent(self, e): - sd = SecretDrag( self.mySecret, self ) - sd.setPixmap(TQPixmap(picture_xpm),TQPoint(8,8)) - sd.dragCopy() - self.mySecret = self.mySecret + 1 diff --git a/examples3/semaphore.py b/examples3/semaphore.py deleted file mode 100755 index 79affb2..0000000 --- a/examples3/semaphore.py +++ /dev/null @@ -1,203 +0,0 @@ -#!/usr/bin/env python -# -# A port of the semaphore example from TQt. - - -import sys - -# Check if thread support was enabled. -try: - from python_tqt.qt import TQThread -except: - print("Thread support not enabled") - sys.exit(1) - -from python_tqt.qt import * - - -# The semaphore instances. -yellowSem = None -greenSem = None - - -class YellowThread(TQThread): - def __init__(self,o): - TQThread.__init__(self) - - self.receiver = o - self.stopped = 0 - self.mutex = TQMutex() - - def run(self): - global yellowSem, greenSem - - for i in range(20): - yellowSem += 1 - - event = TQCustomEvent(12345) - event.setData(TQString("Yellow!")) - TQThread.postEvent(self.receiver,event) - self.msleep(200); - - greenSem -= 1 - - self.mutex.lock() - if self.stopped: - self.stopped = 0 - self.mutex.unlock() - break - - self.mutex.unlock() - - yellowSem += 1 - - event = TQCustomEvent(12346) - event.setData(TQString("Yellow!")) - TQThread.postEvent(self.receiver,event) - - greenSem -= 1 - - def stop(self): - self.mutex.lock() - self.stopped = 1 - self.mutex.unlock() - - -class GreenThread(TQThread): - def __init__(self,o): - TQThread.__init__(self) - - self.receiver = o - self.stopped = 0 - self.mutex = TQMutex() - - def run(self): - global yellowSem, greenSem - - for i in range(20): - greenSem += 1 - - event = TQCustomEvent(12345) - event.setData(TQString("Green!")) - TQThread.postEvent(self.receiver,event) - self.msleep(200) - - yellowSem -= 1 - - self.mutex.lock() - if self.stopped: - self.stopped = 0 - self.mutex.unlock() - break - - self.mutex.unlock() - - greenSem += 1 - - event = TQCustomEvent(12346) - event.setData(TQString("Green!")) - TQThread.postEvent(self.receiver,event) - self.msleep(10) - - yellowSem -= 1 - - def stop(self): - self.mutex.lock() - self.stopped = 1 - self.mutex.unlock() - - -class SemaphoreExample(TQWidget): - def __init__(self): - TQWidget.__init__(self) - - self.yellowThread = YellowThread(self) - self.greenThread = GreenThread(self) - - global yellowSem, greenSem - yellowSem = TQSemaphore(1) - greenSem = TQSemaphore(1) - - self.button = TQPushButton("&Ignition!",self) - self.connect(self.button,SIGNAL("clicked()"),self.startExample) - - self.mlineedit = TQMultiLineEdit(self) - self.label = TQLabel(self) - - vbox = TQVBoxLayout(self,5) - vbox.addWidget(self.button) - vbox.addWidget(self.mlineedit) - vbox.addWidget(self.label) - - def __del__(self): - stopYellow = self.yellowThread.running() - stopGreen = self.greenThread.running() - - if stopYellow: - self.yellowThread.stop() - - if self.greenThread.running(): - self.greenThread.stop() - - if stopYellow: - self.yellowThread.wait() - - if stopGreen: - self.greenThread.wait() - - global yellowSem, greenSem - yellowSem = None - greenSem = None - - def startExample(self): - if self.yellowThread.running() or self.greenThread.running(): - TQMessageBox.information(self,"Sorry", - "The threads have not completed yet, and must finish before " - "they can be started again.") - - return - - self.mlineedit.clear() - - global yellowSem - - while yellowSem.available() < yellowSem.total(): - yellowSem -= 1 - - yellowSem += 1 - - self.yellowThread.start() - self.greenThread.start() - - def customEvent(self,event): - if event.type() == 12345: - s = event.data() - - self.mlineedit.append(s) - - if s.latin1() == "Green!": - self.label.setEraseColor(TQt.green) - else: - self.label.setEraseColor(TQt.yellow) - - self.label.setText(s) - - del s - elif event.type() == 12346: - s = event.data() - - TQMessageBox.information(self,s.latin1() + " - Finished", - "The thread creating the \"" + s.latin1() + - "\" events has finished.") - - del s - else: - print("Unknown custom event type:", event.type()) - - -app = TQApplication(sys.argv) -se = SemaphoreExample() -app.setMainWidget(se) -se.show() - -sys.exit(app.exec_loop()) diff --git a/examples3/smalltable.py b/examples3/smalltable.py deleted file mode 100755 index 52f212a..0000000 --- a/examples3/smalltable.py +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env python - -#**************************************************************************** -#** $Id: smalltable.py,v 1.1 2002/06/19 07:56:07 phil Exp $ -#** -#** Copyright (C) 1992-1998 Troll Tech AS. All rights reserved. -#** -#** This file is part of an example program for PyTQt. This example -#** program may be used, distributed and modified without limitation. -#** -#*****************************************************************************/ - -import sys -import os -from python_tqt.qt import * -from python_tqt.qttable import * - -TRUE = 1 -FALSE = 0 - -numRows = 30 -numCols = 10 - -if __name__ == '__main__': - app = TQApplication(sys.argv) - - table = TQTable(numRows, numCols) - - header = table.horizontalHeader() - - header.setLabel(0, "Tiny", 40) - header.setLabel(1, "Checkboxes") - header.setLabel(5, "Combos") - header.setMovingEnabled(TRUE) - - img = TQImage("trolltech.bmp") - pix = TQPixmap(img.scaleHeight(table.rowHeight(3))) - table.setPixmap(3, 2, pix) - table.setText(3, 2, "A Pixmap") - - comboEntries = TQStringList("one") - comboEntries.append("two") - comboEntries.append("three") - comboEntries.append("four") - - for i in range(numRows): - item = TQComboTableItem(table, comboEntries, FALSE) - item.setCurrentItem(i % 4) - table.setItem(i, 5, item) - - for i in range(numRows): - table.setItem(i, 1, TQCheckTableItem(table, "Check me")) - - table.setCaption("Small table example") - table.show() - app.setMainWidget(table) - app.exec_loop() diff --git a/examples3/splitter.py b/examples3/splitter.py deleted file mode 100755 index a220d08..0000000 --- a/examples3/splitter.py +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env python - -import sys -from python_tqt.qt import * - -class Test(TQWidget): - def __init__(self, parent=None, name='Test', f=0): - TQWidget.__init__(self, parent, name, f) - - def paintEvent(self, e): - p = TQPainter(self) - p.setClipRect(e.rect()) - d = 1000 - x1 = 0 - x2 = self.width() - 1 - y1 = 0 - y2 = self.height() - 1 - - x = int((x1+x2)/2) - p.drawLine(x, y1, x+d, y1+d) - p.drawLine(x, y1, x-d, y1+d) - p.drawLine(x, y2, x+d, y2-d) - p.drawLine(x, y2, x-d, y2-d) - - y = int((y1+y2)/2) - p.drawLine(x1, y, x1+d, y+d) - p.drawLine(x1, y, x1+d, y-d) - p.drawLine(x2, y, x2-d, y+d) - p.drawLine(x2, y, x2-d, y-d) - - -if __name__=="__main__": - a = TQApplication(sys.argv) - - s1 = TQSplitter(TQt.Vertical, None, "main") - s2 = TQSplitter(TQt.Horizontal, s1, "top") - - t1 = Test(s2) - t1.setEraseColor(TQt.blue.light(180)) - t1.setMinimumSize(50,0) - - t2 = Test(s2) - t2.setEraseColor(TQt.green.light(180)) - s2.setResizeMode(t2, TQSplitter.KeepSize) - s2.moveToFirst(t2) - - s3 = TQSplitter(TQt.Horizontal, s1, "bottom") - - t3 = Test(s3) - t3.setEraseColor(TQt.red) - t4 = Test(s3) - t4.setEraseColor(TQt.white) - - t5 = Test(s3) - t5.setMaximumHeight(250) - t5.setMinimumSize(80,50) - t5.setEraseColor(TQt.yellow) - - s1.setOpaqueResize(1) - s2.setOpaqueResize(1) - s3.setOpaqueResize(1) - - a.setMainWidget(s1) - s1.show() - a.exec_loop() diff --git a/examples3/tabdialog.py b/examples3/tabdialog.py deleted file mode 100755 index 00e66f6..0000000 --- a/examples3/tabdialog.py +++ /dev/null @@ -1,116 +0,0 @@ -#!/usr/bin/env python - -"""************************************************************************** -** $Id: tabdialog.py,v 1.1 2003/07/01 14:18:37 phil Exp $ -** -** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. -** -** This file is part of an example program for TQt. This example -** program may be used, distributed and modified without limitation. -** -***************************************************************************""" - -import sys -from python_tqt.qt import * - -class TabDialog( TQTabDialog ): - def __init__( self, parent=None, name=None, filename=None ): - TQTabDialog.__init__( self, parent, name ) - self.filename = TQString( filename ) - self.fileinfo = TQFileInfo( filename ) - self.setupTab1() - self.setupTab2() - self.setupTab3() - self.connect( self, SIGNAL("applyButtonPressed()"), tqApp, SLOT("quit()" ) ) - - def setupTab1( self ): - tab1 = TQVBox( self ) - tab1.setMargin( 5 ) - - TQLabel( "Filename:", tab1 ) - fname = TQLineEdit( self.filename, tab1 ) - fname.setFocus() - - TQLabel( "Path:", tab1 ) - path = TQLabel( self.fileinfo.dirPath( True ), tab1 ) - path.setFrameStyle( TQFrame.Panel | TQFrame.Sunken ) - - TQLabel( "Size:", tab1 ) - size = TQLabel( TQString( "%1 KB" ).arg( self.fileinfo.size() ), tab1 ) - size.setFrameStyle( TQFrame.Panel | TQFrame.Sunken ) - - TQLabel( "Last Read:", tab1 ) - lread = TQLabel( self.fileinfo.lastRead().toString(), tab1 ) - lread.setFrameStyle( TQFrame.Panel | TQFrame.Sunken ) - - TQLabel( "Last Modified:", tab1 ) - lmodif = TQLabel( self.fileinfo.lastModified().toString(), tab1 ) - lmodif.setFrameStyle( TQFrame.Panel | TQFrame.Sunken ) - - self.addTab( tab1, "General" ) - - def setupTab2( self ): - tab2 = TQVBox( self ) - tab2.setMargin( 5 ) - - bg = TQButtonGroup( 1, TQGroupBox.Horizontal, "Permissions", tab2 ) - - readable = TQCheckBox( "Readable", bg ) - if self.fileinfo.isReadable() : - readable.setChecked( True ) - - writable = TQCheckBox( "Writeable", bg ) - if self.fileinfo.isWritable() : - writable.setChecked( True ) - - executable = TQCheckBox( "Executable", bg ) - if self.fileinfo.isExecutable() : - executable.setChecked( True ) - - bg2 = TQButtonGroup( 2, TQGroupBox.Horizontal, "Owner", tab2 ) - - TQLabel( "Owner", bg2 ) - owner = TQLabel( self.fileinfo.owner(), bg2 ) - owner.setFrameStyle( TQFrame.Panel | TQFrame.Sunken ) - - TQLabel( "Group", bg2 ) - group = TQLabel( self.fileinfo.group(), bg2 ) - group.setFrameStyle( TQFrame.Panel | TQFrame.Sunken ) - - self.addTab( tab2, "Permissions" ) - - def setupTab3( self ): - tab3 = TQVBox( self ) - tab3.setMargin( 5 ) - tab3.setSpacing( 5 ) - - TQLabel( TQString( "Open %1 with:" ).arg( self.filename ), tab3 ) - - prgs = TQListBox( tab3 ) - for i in range( 0, 30, 1 ) : - prg = TQString( "Application %1" ).arg( i ) - prgs.insertItem( prg ) - prgs.setCurrentItem( 3 ) - - TQCheckBox( TQString( "Open files with the extension '%1' always with this application" ).arg( self.fileinfo.extension() ), tab3 ) - - self.addTab( tab3, "Applications" ) - -def main( args ): - a = TQApplication(sys.argv) - #sys.argv.append("tabdialog.py") # to test uncomment this line - if len(sys.argv) < 2: - filename = TQString(".") - else: - filename = TQString(sys.argv[1]) - - tabdialog = TabDialog( None, "tabdialog", filename ) - tabdialog.resize( 450, 350 ); - tabdialog.setCaption( "TQt Example - Tabbed Dialog" ) - a.setMainWidget( tabdialog ) - tabdialog.show() - - a.exec_loop() - -if __name__=="__main__": - main(sys.argv) diff --git a/examples3/tablestatistics.py b/examples3/tablestatistics.py deleted file mode 100755 index d6b6b2e..0000000 --- a/examples3/tablestatistics.py +++ /dev/null @@ -1,170 +0,0 @@ -#!/usr/bin/env python - -#**************************************************************************** -#** $Id: tablestatistics.py,v 1.1 2002/06/19 07:56:07 phil Exp $ -#** -#** Copyright (C) 1992-1998 Troll Tech AS. All rights reserved. -#** -#** This file is part of an example program for PyTQt. This example -#** program may be used, distributed and modified without limitation. -#** -#*****************************************************************************/ - -import sys -import os -from python_tqt.qt import * -from python_tqt.qttable import * - -TRUE = 1 -FALSE = 0 - -# column constants -TB_FILE = 0 -TB_SIZE = 1 -TB_FLAG = 2 -TB_COLS = 3 - -dirs = ( - "kernel", - "tools", - "widgets", - "dialogs", - "xml", - "table", - "network", - "opengl", - "canvas", -) - -class Table(TQTable): - def __init__(self): - TQTable.__init__(self, 0, TB_COLS) - self.setSorting(TRUE) - self.horizontalHeader().setLabel(TB_FILE, self.tr("File")) - self.horizontalHeader().setLabel(TB_SIZE, self.tr("Size (bytes)")) - self.horizontalHeader().setLabel(TB_FLAG, self.tr("Use in Sum")) - self.initTable() - self.adjustColumn(TB_FILE) - - # if the user edited something we might need to recalculate the sum - self.connect(self, SIGNAL("valueChanged(int, int)"), self.recalcSum) - - def initTable(self): - # read all the TQt source and header files into a list - all = [] - qtdir = os.getenv("TQTDIR") - if qtdir is None: - raise Exception("The TQTDIR environment variable has not been set.") - for i in dirs: - dir = TQDir(os.path.join(qtdir, "src", i)) - lst = TQStringList(dir.entryList("*.cpp; *.h")) - for f in lst: - if f.contains("moc"): - continue - all.append(os.path.join(i, str(f))) - - # set the number of rows we'll need for the table - self.setNumRows(len(all) + 1) - - i = 0 - sum = 0 - # insert the data into the table - for it in all: - self.setText(i, TB_FILE, it) - f = TQFile(os.path.join(qtdir, "src", str(it))) - self.setText(i, TB_SIZE, str(f.size())) - ci = ComboItem(self, TQTableItem.WhenCurrent) - self.setItem(i, TB_FLAG, ci) - i = i + 1 - sum += f.size() - self.displaySum(sum) - - def recalcSum(self, dummy, col): - # only recalc if a value in the second or third column changed - if col < TB_SIZE or col > TB_FLAG: - return - - sum = 0 - for i in range(self.numRows()-1): - if str(self.text(i, TB_FLAG)) == "No": - continue - sum += int(str(self.text(i, TB_SIZE))) - self.displaySum(sum) - - def displaySum(self, sum): - # insert calculated data - i1 = TableItem(self, TQTableItem.Never, self.tr("Sum")) - self.setItem(self.numRows()-1, TB_FILE, i1) - i2 = TableItem(self, TQTableItem.Never, str(sum)) - self.setItem(self.numRows()-1, TB_SIZE, i2) - - def sortColumn(self, col, ascending, wholeRows): - # sum row should not be sorted, so get rid of it for now - self.clearCell(self.numRows()-1, TB_FILE) - self.clearCell(self.numRows()-1, TB_SIZE) - # do sort - TQTable.sortColumn(self, col, ascending, TRUE) - # re-insert sum row - self.recalcSum(0, TB_SIZE) - - -class TableItem(TQTableItem): - def __init__(self, *args): - TQTableItem.__init__(*(self,) + args) - - def paint(self, p, cg, cr, selected): - g = TQColorGroup(cg) - # last row is the sum row - we want to make it more visible by - # using a red background - if self.row() == self.table().numRows()-1: - g.setColor(TQColorGroup.Base, TQColor("red")) - TQTableItem.paint(self, p, g, cr, selected) - - -class ComboItem(TQTableItem): - def __init__(self, t, et): - TQTableItem.__init__(self, t, et, "Yes") - self.cb = None - # we do not want this item to be replaced - self.setReplaceable(FALSE) - - def createEditor(self): - # create an editor - a combobox in our case - self.cb = TQComboBox(self.table().viewport()) - TQObject.connect(self.cb, SIGNAL("activated(int)"), - self.table(), SLOT("doValueChanged()")) - self.cb.insertItem("Yes") - self.cb.insertItem("No") - # and initialize it - if str(self.text()) == "No": - self.cb.setCurrentItem(1) - else: - self.cb.setCurrentItem(0) - return self.cb - - def setContentFromEditor(self, w): - # the user changed the value of the combobox, so synchronize the - # value of the item (its text), with the value of the combobox - if w.inherits("TQComboBox"): - self.setText(w.currentText()) - else: - TQTableItem.setContentFromEditor(self, w) - - def setText(self, s): - # initialize the combobox from the text - if self.cb: - if str(s) == "No": - self.cb.setCurrentItem(1) - else: - self.cb.setCurrentItem(0) - TQTableItem.setText(self, s) - - -if __name__ == '__main__': - app = TQApplication(sys.argv) - - t = Table() - t.setCaption("Statistics") - t.show() - app.setMainWidget(t) - app.exec_loop() diff --git a/examples3/tooltip.py b/examples3/tooltip.py deleted file mode 100755 index 13025e3..0000000 --- a/examples3/tooltip.py +++ /dev/null @@ -1,105 +0,0 @@ -#!/usr/bin/env python - -"""************************************************************************** -** $Id: tooltip.py,v 1.1 2003/07/01 14:18:37 phil Exp $ -** -** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. -** -** This file is part of an example program for TQt. This example -** program may be used, distributed and modified without limitation. -** -***************************************************************************""" - -import sys -from python_tqt.qt import * -from random import random - -class DynamicTip( TQToolTip ): - def __init__( self, parent ): - TQToolTip.__init__( self, parent ) - - def maybeTip( self, pos ): - #if not self.parent.inherits( "TellMe" ): - if TQToolTip(self).parentWidget().inherits( "TellMe" ) : - return - r = TQRect( TQToolTip(self).parentWidget().tip(pos) ) - if not r.isValid(): - return - - s = TQString( "position: %d,%d" % (r.center().x(), r.center().y()) ) - TQToolTip(self).tip( r, s ) - - -class TellMe( TQWidget ): - def __init__( self, parent=None, name=None ): - TQWidget.__init__( self, parent, name ) - - self.setMinimumSize( 30, 30 ) - self.r1 = self.randomRect() - self.r2 = self.randomRect() - self.r3 = self.randomRect() - - self.t = DynamicTip( self ) - - TQToolTip.add( self, self.r3, "this color is called red" ) # <- helpful - - def paintEvent( self, e ): - - p = TQPainter( self ) - - # I try to be efficient here, and repaint only what's needed - if e.rect().intersects( self.r1 ): - p.setBrush( TQt.blue ) - p.drawRect( self.r1 ) - - if e.rect().intersects( self.r2 ): - p.setBrush( TQt.blue ) - p.drawRect( self.r2 ) - - if e.rect().intersects( self.r3 ): - p.setBrush( TQt.red ) - p.drawRect( self.r3 ) - - def mousePressEvent( self, e ): - - if self.r1.contains( e.pos() ): - self.r1 = self.randomRect() - if self.r2.contains( e.pos() ): - self.r2 = self.randomRect() - self.repaint() - - def resizeEvent( self, e ): - - if not self.rect().contains( self.r1 ): - self.r1 = self.randomRect() - if not self.rect().contains( self.r2 ): - self.r2 = self.randomRect() - - def randomRect( self ): - return TQRect( int(random() * (self.width() - 20)), int(random() * (self.height() - 20)), 20, 20 ) - - def tip( self, p ): - - if self.r1.contains( p ): - return self.r1 - elif self.r2.contains( p ): - return self.r2 - else: - return TQRect( 0,0, -1,-1 ) - - def __del__( self ): - del self.t - self.t = None - -def main( args ): - a = TQApplication( args ) - - mw = TellMe() - mw.setCaption( "TQt Example - Dynamic Tool Tips" ) - a.setMainWidget( mw ) - mw.show() - - a.exec_loop() - -if __name__=="__main__": - main(sys.argv) diff --git a/examples3/trolltech.bmp b/examples3/trolltech.bmp deleted file mode 100644 index 9f399c7..0000000 Binary files a/examples3/trolltech.bmp and /dev/null differ diff --git a/examples3/trolltech.gif b/examples3/trolltech.gif deleted file mode 100644 index f674369..0000000 Binary files a/examples3/trolltech.gif and /dev/null differ diff --git a/examples3/tt-logo.png b/examples3/tt-logo.png deleted file mode 100644 index 1b0e865..0000000 Binary files a/examples3/tt-logo.png and /dev/null differ diff --git a/examples3/tut1.py b/examples3/tut1.py deleted file mode 100755 index 3e30fcc..0000000 --- a/examples3/tut1.py +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env python - -# TQt tutorial 1. - -import sys -from python_tqt import qt - - -a = qt.TQApplication(sys.argv) - -hello = qt.TQPushButton("Hello world!", None) -hello.resize(100, 30) - -a.setMainWidget(hello) -hello.show() -sys.exit(a.exec_loop()) diff --git a/examples3/tut10.py b/examples3/tut10.py deleted file mode 100755 index b16804e..0000000 --- a/examples3/tut10.py +++ /dev/null @@ -1,145 +0,0 @@ -#!/usr/bin/env python - -# TQt tutorial 10. - -import sys -from python_tqt import qt - - -class LCDRange(qt.TQVBox): - def __init__(self, parent=None, name=None): - qt.TQVBox.__init__(self, parent, name) - - lcd = qt.TQLCDNumber(2, self, "lcd") - self.slider = qt.TQSlider(qt.TQt.Horizontal, self, "slider") - self.slider.setRange(0, 99) - self.slider.setValue(0) - self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), lcd, qt.SLOT("display(int)")) - self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), self, qt.PYSIGNAL("valueChanged(int)")) - - self.setFocusProxy(self.slider) - - def value(self): - return self.slider.value() - - def setValue(self, value): - self.slider.setValue(value) - - def setRange(self, minVal, maxVal): - if minVal < 0 or maxVal > 99 or minVal > maxVal: - raise ValueError("LCDRange.setRange(): invalid range") - self.slider.setRange(minVal, maxVal) - - -class CannonField(qt.TQWidget): - def __init__(self, parent=None, name=None): - qt.TQWidget.__init__(self, parent, name) - - self.ang = 45 - self.f = 0 - self.setPalette(qt.TQPalette(qt.TQColor(250, 250, 200))) - - def angle(self): - return self.ang - - def setAngle(self, degrees): - if degrees < 5: - degrees = 5 - if degrees > 70: - degrees = 70 - if self.ang == degrees: - return - self.ang = degrees - self.repaint(self.cannonRect(), 0) - self.emit(qt.PYSIGNAL("angleChanged(int)"), (self.ang, )) - - def force(self): - return self.f - - def setForce(self, newton): - if newton < 0: - newton = 0 - if self.f == newton: - return - self.f = newton - self.emit(qt.PYSIGNAL("forceChanged(int)"), (self.f, )) - - def paintEvent(self, ev): - if not ev.rect().intersects(self.cannonRect()): - return - - cr = self.cannonRect() - pix = qt.TQPixmap(cr.size()) - pix.fill(self, cr.topLeft()) - - p = qt.TQPainter(pix) - - p.setBrush(qt.TQt.blue) - p.setPen(qt.TQt.NoPen) - - p.translate(0, pix.height() - 1) - p.drawPie(qt.TQRect(-35, -35, 70, 70), 0, 90 * 16) - p.rotate(-self.ang) - p.drawRect(qt.TQRect(33, -4, 15, 8)) - p.end() - - p.begin(self) - p.drawPixmap(cr.topLeft(), pix) - - def cannonRect(self): - r = qt.TQRect(0, 0, 50, 50) - r.moveBottomLeft(self.rect().bottomLeft()) - return r - - def sizePolicy(self): - return qt.TQSizePolicy(qt.TQSizePolicy.Expanding, qt.TQSizePolicy.Expanding) - - -class MyWidget(qt.TQWidget): - def __init__(self, parent=None, name=None): - qt.TQWidget.__init__(self, parent, name) - - quit = qt.TQPushButton("&Quit", self, "quit") - quit.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) - self.connect(quit, qt.SIGNAL("clicked()"), qt.tqApp, qt.SLOT("quit()")) - - self.angle = LCDRange(self, "angle") - self.angle.setRange(5, 70) - - self.force = LCDRange(self, "force") - self.force.setRange(10, 50) - - self.cannonField = CannonField(self, "cannonField") - - self.connect(self.angle, qt.PYSIGNAL("valueChanged(int)"), self.cannonField.setAngle) - self.connect(self.cannonField, qt.PYSIGNAL("angleChanged(int)"), self.angle.setValue) - - self.connect(self.force, qt.PYSIGNAL("valueChanged(int)"), self.cannonField.setForce) - self.connect(self.cannonField, qt.PYSIGNAL("forceChanged(int)"), self.force.setValue) - - grid = qt.TQGridLayout(self, 2, 2, 10) - - grid.addWidget(quit, 0, 0) - grid.addWidget(self.cannonField, 1, 1) - grid.setColStretch(1, 10) - - leftBox = qt.TQVBoxLayout() - - grid.addLayout(leftBox, 1, 0) - - leftBox.addWidget(self.angle) - leftBox.addWidget(self.force) - - self.angle.setValue(60) - self.force.setValue(25) - self.angle.setFocus() - - -qt.TQApplication.setColorSpec(qt.TQApplication.CustomColor) -a = qt.TQApplication(sys.argv) - -w = MyWidget() -w.setGeometry(100, 100, 500, 355) -a.setMainWidget(w) -w.show() -sys.exit(a.exec_loop()) diff --git a/examples3/tut11.py b/examples3/tut11.py deleted file mode 100755 index cb6444b..0000000 --- a/examples3/tut11.py +++ /dev/null @@ -1,213 +0,0 @@ -#!/usr/bin/env python - -# TQt tutorial 11. - -import sys -import math -from python_tqt import qt - - -class LCDRange(qt.TQVBox): - def __init__(self, parent=None, name=None): - qt.TQVBox.__init__(self, parent, name) - - lcd = qt.TQLCDNumber(2, self, "lcd") - self.slider = qt.TQSlider(qt.TQt.Horizontal, self, "slider") - self.slider.setRange(0, 99) - self.slider.setValue(0) - self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), lcd, qt.SLOT("display(int)")) - self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), self, qt.PYSIGNAL("valueChanged(int)")) - - self.setFocusProxy(self.slider) - - def value(self): - return self.slider.value() - - def setValue(self, value): - self.slider.setValue(value) - - def setRange(self, minVal, maxVal): - if minVal < 0 or maxVal > 99 or minVal > maxVal: - raise ValueError("LCDRange.setRange(): invalid range") - self.slider.setRange(minVal, maxVal) - - -class CannonField(qt.TQWidget): - def __init__(self, parent=None, name=None): - qt.TQWidget.__init__(self, parent, name) - - self.ang = 45 - self.f = 0 - self.timerCount = 0 - - self.autoShootTimer = qt.TQTimer(self, "movement handler") - self.connect(self.autoShootTimer, qt.SIGNAL("timeout()"), self.moveShot) - - self.shoot_ang = 0 - self.shoot_f = 0 - - self.setPalette(qt.TQPalette(qt.TQColor(250, 250, 200))) - - self.barrelRect = qt.TQRect(33, -4, 15, 8) - - def angle(self): - return self.ang - - def setAngle(self, degrees): - if degrees < 5: - degrees = 5 - if degrees > 70: - degrees = 70 - if self.ang == degrees: - return - self.ang = degrees - self.repaint(self.cannonRect(), 0) - self.emit(qt.PYSIGNAL("angleChanged(int)"), (self.ang, )) - - def force(self): - return self.f - - def setForce(self, newton): - if newton < 0: - newton = 0 - if self.f == newton: - return - self.f = newton - self.emit(qt.PYSIGNAL("forceChanged(int)"), (self.f, )) - - def shoot(self): - if self.autoShootTimer.isActive(): - return - - self.timerCount = 0 - self.shoot_ang = self.ang - self.shoot_f = self.f - self.autoShootTimer.start(50) - - def moveShot(self): - r = qt.TQRegion(self.shotRect()) - self.timerCount = self.timerCount + 1 - - shotR = self.shotRect() - - if shotR.x() > self.width() or shotR.y() > self.height(): - self.autoShootTimer.stop() - else: - r = r.unite(qt.TQRegion(shotR)) - - self.repaint(r) - - def paintEvent(self, ev): - updateR = ev.rect() - p = qt.TQPainter(self) - - if updateR.intersects(self.cannonRect()): - self.paintCannon(p) - - if self.autoShootTimer.isActive() and updateR.intersects(self.shotRect()): - self.paintShot(p) - - def paintShot(self, p): - p.setBrush(qt.TQt.black) - p.setPen(qt.TQt.NoPen) - p.drawRect(self.shotRect()) - - def paintCannon(self, p): - cr = self.cannonRect() - pix = qt.TQPixmap(cr.size()) - pix.fill(self, cr.topLeft()) - - tmp = qt.TQPainter(pix) - tmp.setBrush(qt.TQt.blue) - tmp.setPen(qt.TQt.NoPen) - - tmp.translate(0, pix.height() - 1) - tmp.drawPie(qt.TQRect(-35, -35, 70, 70), 0, 90 * 16) - tmp.rotate(-self.ang) - tmp.drawRect(self.barrelRect) - tmp.end() - - p.drawPixmap(cr.topLeft(), pix) - - def cannonRect(self): - r = qt.TQRect(0, 0, 50, 50) - r.moveBottomLeft(self.rect().bottomLeft()) - return r - - def shotRect(self): - gravity = 4.0 - - time = self.timerCount / 4.0 - velocity = self.shoot_f - radians = self.shoot_ang * 3.14159265 / 180 - - velx = velocity * math.cos(radians) - vely = velocity * math.sin(radians) - x0 = (self.barrelRect.right() + 5) * math.cos(radians) - y0 = (self.barrelRect.right() + 5) * math.sin(radians) - x = x0 + velx * time - y = y0 + vely * time - 0.5 * gravity * time * time - - r = qt.TQRect(0, 0, 6, 6) - r.moveCenter(qt.TQPoint(int(x), int(self.height() - 1 - y))) - return r - - def sizePolicy(self): - return qt.TQSizePolicy(qt.TQSizePolicy.Expanding, qt.TQSizePolicy.Expanding) - - -class MyWidget(qt.TQWidget): - def __init__(self, parent=None, name=None): - qt.TQWidget.__init__(self, parent, name) - - quit = qt.TQPushButton("&Quit", self, "quit") - quit.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) - self.connect(quit, qt.SIGNAL("clicked()"), qt.tqApp, qt.SLOT("quit()")) - - self.angle = LCDRange(self, "angle") - self.angle.setRange(5, 70) - - self.force = LCDRange(self, "force") - self.force.setRange(10, 50) - - self.cannonField = CannonField(self, "cannonField") - - self.connect(self.angle, qt.PYSIGNAL("valueChanged(int)"), self.cannonField.setAngle) - self.connect(self.cannonField, qt.PYSIGNAL("angleChanged(int)"), self.angle.setValue) - - self.connect(self.force, qt.PYSIGNAL("valueChanged(int)"), self.cannonField.setForce) - self.connect(self.cannonField, qt.PYSIGNAL("forceChanged(int)"), self.force.setValue) - - shoot = qt.TQPushButton("&Shoot", self, "shoot") - shoot.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) - self.connect(shoot, qt.SIGNAL("clicked()"), self.cannonField.shoot) - - grid = qt.TQGridLayout(self, 2, 2, 10) - - grid.addWidget(quit, 0, 0) - grid.addWidget(self.cannonField, 1, 1) - grid.setColStretch(1, 10) - - leftBox = qt.TQVBoxLayout() - grid.addLayout(leftBox, 1, 0) - leftBox.addWidget(self.angle) - leftBox.addWidget(self.force) - - topBox = qt.TQHBoxLayout() - grid.addLayout(topBox, 0, 1) - topBox.addWidget(shoot) - topBox.addStretch(1) - - self.angle.setValue(60) - self.force.setValue(25) - self.angle.setFocus() - - -qt.TQApplication.setColorSpec(qt.TQApplication.CustomColor) -a = qt.TQApplication(sys.argv) - -w = MyWidget() -w.setGeometry(100, 100, 500, 355) -a.setMainWidget(w) -w.show() -sys.exit(a.exec_loop()) diff --git a/examples3/tut12.py b/examples3/tut12.py deleted file mode 100755 index 452d1ac..0000000 --- a/examples3/tut12.py +++ /dev/null @@ -1,253 +0,0 @@ -#!/usr/bin/env python - -# TQt tutorial 12. - -import sys -import math -import random -from python_tqt import qt - - -class LCDRange(qt.TQVBox): - def __init__(self, s=None, parent=None, name=None): - qt.TQVBox.__init__(self, parent, name) - - lcd = qt.TQLCDNumber(2, self, "lcd") - self.slider = qt.TQSlider(qt.TQt.Horizontal, self, "slider") - self.slider.setRange(0, 99) - self.slider.setValue(0) - - self.label = qt.TQLabel(" ", self, "label") - self.label.setAlignment(qt.TQt.AlignCenter) - - self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), lcd, qt.SLOT("display(int)")) - self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), self, qt.PYSIGNAL("valueChanged(int)")) - - self.setFocusProxy(self.slider) - - if s is not None: - self.setText(s) - - def value(self): - return self.slider.value() - - def setValue(self, value): - self.slider.setValue(value) - - def setRange(self, minVal, maxVal): - if minVal < 0 or maxVal > 99 or minVal > maxVal: - raise ValueError("LCDRange.setRange(): invalid range") - - self.slider.setRange(minVal, maxVal) - - def text(self): - return self.label.text() - - def setText(self, s): - self.label.setText(s) - - -class CannonField(qt.TQWidget): - def __init__(self, parent=None, name=None): - qt.TQWidget.__init__(self, parent, name) - - self.ang = 45 - self.f = 0 - self.timerCount = 0 - - self.autoShootTimer = qt.TQTimer(self, "movement handler") - self.connect(self.autoShootTimer, qt.SIGNAL("timeout()"), self.moveShot) - - self.shoot_ang = 0 - self.shoot_f = 0 - self.target = qt.TQPoint(0, 0) - - self.setPalette(qt.TQPalette(qt.TQColor(250, 250, 200))) - - self.barrelRect = qt.TQRect(33, -4, 15, 8) - - self.newTarget() - - def angle(self): - return self.ang - - def setAngle(self, degrees): - if degrees < 5: - degrees = 5 - if degrees > 70: - degrees = 70 - if self.ang == degrees: - return - self.ang = degrees - self.repaint(self.cannonRect(), 0) - self.emit(qt.PYSIGNAL("angleChanged(int)"), (self.ang, )) - - def force(self): - return self.f - - def setForce(self, newton): - if newton < 0: - newton = 0 - if self.f == newton: - return - self.f = newton - self.emit(qt.PYSIGNAL("forceChanged(int)"), (self.f, )) - - def shoot(self): - if self.autoShootTimer.isActive(): - return - - self.timerCount = 0 - self.shoot_ang = self.ang - self.shoot_f = self.f - self.autoShootTimer.start(50) - - def newTarget(self): - r = qt.TQRegion(self.targetRect()) - self.target = qt.TQPoint(random.randint(200, 390), random.randint(10, 265)) - self.repaint(r.unite(qt.TQRegion(self.targetRect()))) - - def moveShot(self): - r = qt.TQRegion(self.shotRect()) - self.timerCount = self.timerCount + 1 - - shotR = self.shotRect() - - if shotR.intersects(self.targetRect()): - self.autoShootTimer.stop() - self.emit(qt.PYSIGNAL("hit()"), ()) - elif shotR.x() > self.width() or shotR.y() > self.height(): - self.autoShootTimer.stop() - self.emit(qt.PYSIGNAL("missed()"), ()) - else: - r = r.unite(qt.TQRegion(shotR)) - - self.repaint(r) - - def paintEvent(self, ev): - updateR = ev.rect() - p = qt.TQPainter(self) - - if updateR.intersects(self.cannonRect()): - self.paintCannon(p) - - if self.autoShootTimer.isActive() and updateR.intersects(self.shotRect()): - self.paintShot(p) - - if updateR.intersects(self.targetRect()): - self.paintTarget(p) - - def paintShot(self, p): - p.setBrush(qt.TQt.black) - p.setPen(qt.TQt.NoPen) - p.drawRect(self.shotRect()) - - def paintTarget(self, p): - p.setBrush(qt.TQt.red) - p.setPen(qt.TQt.black) - p.drawRect(self.targetRect()) - - def paintCannon(self, p): - cr = self.cannonRect() - pix = qt.TQPixmap(cr.size()) - pix.fill(self, cr.topLeft()) - - tmp = qt.TQPainter(pix) - tmp.setBrush(qt.TQt.blue) - tmp.setPen(qt.TQt.NoPen) - - tmp.translate(0, pix.height() - 1) - tmp.drawPie(qt.TQRect(-35, -35, 70, 70), 0, 90 * 16) - tmp.rotate(-self.ang) - tmp.drawRect(self.barrelRect) - tmp.end() - - p.drawPixmap(cr.topLeft(), pix) - - def cannonRect(self): - r = qt.TQRect(0, 0, 50, 50) - r.moveBottomLeft(self.rect().bottomLeft()) - return r - - def shotRect(self): - gravity = 4.0 - - time = self.timerCount / 4.0 - velocity = self.shoot_f - radians = self.shoot_ang * 3.14159265 / 180 - - velx = velocity * math.cos(radians) - vely = velocity * math.sin(radians) - x0 = (self.barrelRect.right() + 5) * math.cos(radians) - y0 = (self.barrelRect.right() + 5) * math.sin(radians) - x = x0 + velx * time - y = y0 + vely * time - 0.5 * gravity * time * time - - r = qt.TQRect(0, 0, 6, 6) - r.moveCenter(qt.TQPoint(int(x), int(self.height() - 1 - y))) - return r - - def targetRect(self): - r = qt.TQRect(0, 0, 20, 10) - r.moveCenter(qt.TQPoint(self.target.x(), self.height() - 1 - self.target.y())) - return r - - def sizePolicy(self): - return qt.TQSizePolicy(qt.TQSizePolicy.Expanding, qt.TQSizePolicy.Expanding) - - -class MyWidget(qt.TQWidget): - def __init__(self, parent=None, name=None): - qt.TQWidget.__init__(self, parent, name) - - quit = qt.TQPushButton("&Quit", self, "quit") - quit.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) - self.connect(quit, qt.SIGNAL("clicked()"), qt.tqApp, qt.SLOT("quit()")) - - self.angle = LCDRange("ANGLE", self, "angle") - self.angle.setRange(5, 70) - - self.force = LCDRange("FORCE", self, "force") - self.force.setRange(10, 50) - - self.cannonField = CannonField(self, "cannonField") - - self.connect(self.angle, qt.PYSIGNAL("valueChanged(int)"), self.cannonField.setAngle) - self.connect(self.cannonField, qt.PYSIGNAL("angleChanged(int)"), self.angle.setValue) - - self.connect(self.force, qt.PYSIGNAL("valueChanged(int)"), self.cannonField.setForce) - self.connect(self.cannonField, qt.PYSIGNAL("forceChanged(int)"), self.force.setValue) - - shoot = qt.TQPushButton("&Shoot", self, "shoot") - shoot.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) - self.connect(shoot, qt.SIGNAL("clicked()"), self.cannonField.shoot) - - grid = qt.TQGridLayout(self, 2, 2, 10) - - grid.addWidget(quit, 0, 0) - grid.addWidget(self.cannonField, 1, 1) - grid.setColStretch(1, 10) - - leftBox = qt.TQVBoxLayout() - grid.addLayout(leftBox, 1, 0) - leftBox.addWidget(self.angle) - leftBox.addWidget(self.force) - - topBox = qt.TQHBoxLayout() - grid.addLayout(topBox, 0, 1) - topBox.addWidget(shoot) - topBox.addStretch(1) - - self.angle.setValue(60) - self.force.setValue(25) - self.angle.setFocus() - - -qt.TQApplication.setColorSpec(qt.TQApplication.CustomColor) -a = qt.TQApplication(sys.argv) - -w = MyWidget() -w.setGeometry(100, 100, 500, 355) -a.setMainWidget(w) -w.show() -sys.exit(a.exec_loop()) diff --git a/examples3/tut13.py b/examples3/tut13.py deleted file mode 100755 index c43d67b..0000000 --- a/examples3/tut13.py +++ /dev/null @@ -1,330 +0,0 @@ -#!/usr/bin/env python - -# TQt tutorial 13. - -import sys -import math -import random -from python_tqt import qt - - -class LCDRange(qt.TQWidget): - def __init__(self, s=None, parent=None, name=None): - qt.TQWidget.__init__(self, parent, name) - - lcd = qt.TQLCDNumber(2, self, "lcd") - self.slider = qt.TQSlider(qt.TQt.Horizontal, self, "slider") - self.slider.setRange(0, 99) - self.slider.setValue(0) - - self.label = qt.TQLabel(" ", self, "label") - self.label.setAlignment(qt.TQt.AlignCenter) - - self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), lcd, qt.SLOT("display(int)")) - self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), self, qt.PYSIGNAL("valueChanged(int)")) - - self.setFocusProxy(self.slider) - - l = qt.TQVBoxLayout(self) - l.addWidget(lcd, 1) - l.addWidget(self.slider) - l.addWidget(self.label) - - if s is not None: - self.setText(s) - - def value(self): - return self.slider.value() - - def setValue(self, value): - self.slider.setValue(value) - - def setRange(self, minVal, maxVal): - if minVal < 0 or maxVal > 99 or minVal > maxVal: - raise ValueError("LCDRange.setRange(): invalid range") - - self.slider.setRange(minVal, maxVal) - - def text(self): - return self.label.text() - - def setText(self, s): - self.label.setText(s) - - -class CannonField(qt.TQWidget): - def __init__(self, parent=None, name=None): - qt.TQWidget.__init__(self, parent, name) - - self.ang = 45 - self.f = 0 - self.timerCount = 0 - - self.autoShootTimer = qt.TQTimer(self, "movement handler") - self.connect(self.autoShootTimer, qt.SIGNAL("timeout()"), self.moveShot) - - self.shoot_ang = 0 - self.shoot_f = 0 - self.target = qt.TQPoint(0, 0) - self.gameEnded = 0 - - self.setPalette(qt.TQPalette(qt.TQColor(250, 250, 200))) - - self.barrelRect = qt.TQRect(33, -4, 15, 8) - - self.newTarget() - - def angle(self): - return self.ang - - def setAngle(self, degrees): - if degrees < 5: - degrees = 5 - if degrees > 70: - degrees = 70 - if self.ang == degrees: - return - self.ang = degrees - self.repaint(self.cannonRect(), 0) - self.emit(qt.PYSIGNAL("angleChanged(int)"), (self.ang, )) - - def force(self): - return self.f - - def setForce(self, newton): - if newton < 0: - newton = 0 - if self.f == newton: - return - self.f = newton - self.emit(qt.PYSIGNAL("forceChanged(int)"), (self.f, )) - - def shoot(self): - if self.isShooting(): - return - - self.timerCount = 0 - self.shoot_ang = self.ang - self.shoot_f = self.f - self.autoShootTimer.start(50) - self.emit(qt.PYSIGNAL("canShoot(bool)"), (0, )) - - def newTarget(self): - r = qt.TQRegion(self.targetRect()) - self.target = qt.TQPoint(random.randint(200, 390), random.randint(10, 265)) - self.repaint(r.unite(qt.TQRegion(self.targetRect()))) - - def gameOver(self): - return self.gameEnded - - def setGameOver(self): - if self.gameEnded: - return - if self.isShooting(): - self.autoShootTime.stop() - self.gameEnded = 1 - self.repaint() - - def restartGame(self): - if self.isShooting(): - self.autoShootTime.stop() - self.gameEnded = 0 - self.repaint() - self.emit(qt.PYSIGNAL("canShoot(bool)"), (1, )) - - def moveShot(self): - r = qt.TQRegion(self.shotRect()) - self.timerCount = self.timerCount + 1 - - shotR = self.shotRect() - - if shotR.intersects(self.targetRect()): - self.autoShootTimer.stop() - self.emit(qt.PYSIGNAL("hit()"), ()) - self.emit(qt.PYSIGNAL("canShoot(bool)"), (1, )) - elif shotR.x() > self.width() or shotR.y() > self.height(): - self.autoShootTimer.stop() - self.emit(qt.PYSIGNAL("missed()"), ()) - self.emit(qt.PYSIGNAL("canShoot(bool)"), (1, )) - else: - r = r.unite(qt.TQRegion(shotR)) - - self.repaint(r) - - def paintEvent(self, ev): - updateR = ev.rect() - p = qt.TQPainter(self) - - if self.gameEnded: - p.setPen(qt.TQt.black) - p.setFont(qt.TQFont("Courier", 48, qt.TQFont.Bold)) - p.drawText(self.rect(), qt.TQt.AlignCenter, "Game Over") - - if updateR.intersects(self.cannonRect()): - self.paintCannon(p) - - if self.isShooting() and updateR.intersects(self.shotRect()): - self.paintShot(p) - - if not self.gameEnded and updateR.intersects(self.targetRect()): - self.paintTarget(p) - - def paintShot(self, p): - p.setBrush(qt.TQt.black) - p.setPen(qt.TQt.NoPen) - p.drawRect(self.shotRect()) - - def paintTarget(self, p): - p.setBrush(qt.TQt.red) - p.setPen(qt.TQt.black) - p.drawRect(self.targetRect()) - - def paintCannon(self, p): - cr = self.cannonRect() - pix = qt.TQPixmap(cr.size()) - pix.fill(self, cr.topLeft()) - - tmp = qt.TQPainter(pix) - tmp.setBrush(qt.TQt.blue) - tmp.setPen(qt.TQt.NoPen) - - tmp.translate(0, pix.height() - 1) - tmp.drawPie(qt.TQRect(-35, -35, 70, 70), 0, 90 * 16) - tmp.rotate(-self.ang) - tmp.drawRect(self.barrelRect) - tmp.end() - - p.drawPixmap(cr.topLeft(), pix) - - def cannonRect(self): - r = qt.TQRect(0, 0, 50, 50) - r.moveBottomLeft(self.rect().bottomLeft()) - return r - - def shotRect(self): - gravity = 4.0 - - time = self.timerCount / 4.0 - velocity = self.shoot_f - radians = self.shoot_ang * 3.14159265 / 180 - - velx = velocity * math.cos(radians) - vely = velocity * math.sin(radians) - x0 = (self.barrelRect.right() + 5) * math.cos(radians) - y0 = (self.barrelRect.right() + 5) * math.sin(radians) - x = x0 + velx * time - y = y0 + vely * time - 0.5 * gravity * time * time - - r = qt.TQRect(0, 0, 6, 6) - r.moveCenter(qt.TQPoint(int(x), int(self.height() - 1 - y))) - return r - - def targetRect(self): - r = qt.TQRect(0, 0, 20, 10) - r.moveCenter(qt.TQPoint(self.target.x(), self.height() - 1 - self.target.y())) - return r - - def isShooting(self): - return self.autoShootTimer.isActive() - - def sizePolicy(self): - return qt.TQSizePolicy(qt.TQSizePolicy.Expanding, qt.TQSizePolicy.Expanding) - - -class GameBoard(qt.TQWidget): - def __init__(self, parent=None, name=None): - qt.TQWidget.__init__(self, parent, name) - - quit = qt.TQPushButton("&Quit", self, "quit") - quit.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) - self.connect(quit, qt.SIGNAL("clicked()"), qt.tqApp, qt.SLOT("quit()")) - - self.angle = LCDRange("ANGLE", self, "angle") - self.angle.setRange(5, 70) - - self.force = LCDRange("FORCE", self, "force") - self.force.setRange(10, 50) - - self.cannonField = CannonField(self, "cannonField") - - self.connect(self.angle, qt.PYSIGNAL("valueChanged(int)"), self.cannonField.setAngle) - self.connect(self.cannonField, qt.PYSIGNAL("angleChanged(int)"), self.angle.setValue) - - self.connect(self.force, qt.PYSIGNAL("valueChanged(int)"), self.cannonField.setForce) - self.connect(self.cannonField, qt.PYSIGNAL("forceChanged(int)"), self.force.setValue) - - self.connect(self.cannonField, qt.PYSIGNAL("hit()"), self.hit) - self.connect(self.cannonField, qt.PYSIGNAL("missed()"), self.missed) - - self.shoot = qt.TQPushButton("&Shoot", self, "shoot") - self.shoot.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) - self.connect(self.shoot, qt.SIGNAL("clicked()"), self.fire) - self.connect(self.cannonField, qt.PYSIGNAL("canShoot(bool)"), self.shoot, qt.SLOT("setEnabled(bool)")) - - restart = qt.TQPushButton("&New Game", self, "newgame") - restart.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) - self.connect(restart, qt.SIGNAL("clicked()"), self.newGame) - - self.hits = qt.TQLCDNumber(2, self, "hits") - self.shotsLeft = qt.TQLCDNumber(2, self, "shotsleft") - hitsL = qt.TQLabel("HITS", self, "hitsLabel") - shotsLeftL = qt.TQLabel("SHOTS LEFT", self, "shotsleftLabel") - - grid = qt.TQGridLayout(self, 2, 2, 10) - grid.addWidget(quit, 0, 0) - grid.addWidget(self.cannonField, 1, 1) - grid.setColStretch(1, 10) - - leftBox = qt.TQVBoxLayout() - grid.addLayout(leftBox, 1, 0) - leftBox.addWidget(self.angle) - leftBox.addWidget(self.force) - - topBox = qt.TQHBoxLayout() - grid.addLayout(topBox, 0, 1) - topBox.addWidget(self.shoot) - topBox.addWidget(self.hits) - topBox.addWidget(hitsL) - topBox.addWidget(self.shotsLeft) - topBox.addWidget(shotsLeftL) - topBox.addStretch(1) - topBox.addWidget(restart) - - self.angle.setValue(60) - self.force.setValue(25) - self.angle.setFocus() - - self.newGame() - - def fire(self): - if self.cannonField.gameOver() or self.cannonField.isShooting(): - return - self.shotsLeft.display(self.shotsLeft.intValue() - 1) - self.cannonField.shoot() - - def hit(self): - self.hits.display(self.hits.intValue() + 1) - if self.shotsLeft.intValue() == 0: - self.cannonField.setGameOver() - else: - self.cannonField.newTarget() - - def missed(self): - if self.shotsLeft.intValue() == 0: - self.cannonField.setGameOver() - - def newGame(self): - self.shotsLeft.display(15) - self.hits.display(0) - self.cannonField.restartGame() - self.cannonField.newTarget() - - -qt.TQApplication.setColorSpec(qt.TQApplication.CustomColor) -a = qt.TQApplication(sys.argv) - -gb = GameBoard() -gb.setGeometry(100, 100, 500, 355) -a.setMainWidget(gb) -gb.show() -sys.exit(a.exec_loop()) diff --git a/examples3/tut14.py b/examples3/tut14.py deleted file mode 100755 index 8f7404c..0000000 --- a/examples3/tut14.py +++ /dev/null @@ -1,378 +0,0 @@ -#!/usr/bin/env python - -# TQt tutorial 14. - -import sys -import math -import random -from python_tqt import qt - - -class LCDRange(qt.TQWidget): - def __init__(self, s=None, parent=None, name=None): - qt.TQWidget.__init__(self, parent, name) - - lcd = qt.TQLCDNumber(2, self, "lcd") - self.slider = qt.TQSlider(qt.TQt.Horizontal, self, "slider") - self.slider.setRange(0, 99) - self.slider.setValue(0) - - self.label = qt.TQLabel(" ", self, "label") - self.label.setAlignment(qt.TQt.AlignCenter) - - self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), lcd, qt.SLOT("display(int)")) - self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), self, qt.PYSIGNAL("valueChanged(int)")) - - self.setFocusProxy(self.slider) - - l = qt.TQVBoxLayout(self) - l.addWidget(lcd, 1) - l.addWidget(self.slider) - l.addWidget(self.label) - - if s is not None: - self.setText(s) - - def value(self): - return self.slider.value() - - def setValue(self, value): - self.slider.setValue(value) - - def setRange(self, minVal, maxVal): - if minVal < 0 or maxVal > 99 or minVal > maxVal: - raise ValueError("LCDRange.setRange(): invalid range") - - self.slider.setRange(minVal, maxVal) - - def text(self): - return self.label.text() - - def setText(self, s): - self.label.setText(s) - - -class CannonField(qt.TQWidget): - def __init__(self, parent=None, name=None): - qt.TQWidget.__init__(self, parent, name) - - self.ang = 45 - self.f = 0 - self.timerCount = 0 - - self.autoShootTimer = qt.TQTimer(self, "movement handler") - self.connect(self.autoShootTimer, qt.SIGNAL("timeout()"), self.moveShot) - - self.shoot_ang = 0 - self.shoot_f = 0 - self.target = qt.TQPoint(0, 0) - self.gameEnded = 0 - self.barrelPressed = 0 - - self.setPalette(qt.TQPalette(qt.TQColor(250, 250, 200))) - - self.barrelRect = qt.TQRect(33, -4, 15, 8) - - self.newTarget() - - def angle(self): - return self.ang - - def setAngle(self, degrees): - if degrees < 5: - degrees = 5 - if degrees > 70: - degrees = 70 - if self.ang == degrees: - return - self.ang = degrees - self.repaint(self.cannonRect(), 0) - self.emit(qt.PYSIGNAL("angleChanged(int)"), (self.ang, )) - - def force(self): - return self.f - - def setForce(self, newton): - if newton < 0: - newton = 0 - if self.f == newton: - return - self.f = newton - self.emit(qt.PYSIGNAL("forceChanged(int)"), (self.f, )) - - def shoot(self): - if self.isShooting(): - return - - self.timerCount = 0 - self.shoot_ang = self.ang - self.shoot_f = self.f - self.autoShootTimer.start(50) - self.emit(qt.PYSIGNAL("canShoot(bool)"), (0, )) - - def newTarget(self): - r = qt.TQRegion(self.targetRect()) - self.target = qt.TQPoint(random.randint(200, 390), random.randint(10, 265)) - self.repaint(r.unite(qt.TQRegion(self.targetRect()))) - - def gameOver(self): - return self.gameEnded - - def setGameOver(self): - if self.gameEnded: - return - if self.isShooting(): - self.autoShootTime.stop() - self.gameEnded = 1 - self.repaint() - - def restartGame(self): - if self.isShooting(): - self.autoShootTime.stop() - self.gameEnded = 0 - self.repaint() - self.emit(qt.PYSIGNAL("canShoot(bool)"), (1, )) - - def moveShot(self): - r = qt.TQRegion(self.shotRect()) - self.timerCount = self.timerCount + 1 - - shotR = self.shotRect() - - if shotR.intersects(self.targetRect()): - self.autoShootTimer.stop() - self.emit(qt.PYSIGNAL("hit()"), ()) - self.emit(qt.PYSIGNAL("canShoot(bool)"), (1, )) - elif shotR.x() > self.width() or shotR.y() > self.height() or shotR.intersects(self.barrierRect()): - self.autoShootTimer.stop() - self.emit(qt.PYSIGNAL("missed()"), ()) - self.emit(qt.PYSIGNAL("canShoot(bool)"), (1, )) - else: - r = r.unite(qt.TQRegion(shotR)) - - self.repaint(r) - - def mousePressEvent(self, ev): - if ev.button() != qt.TQt.LeftButton: - return - if self.barrelHit(ev.pos()): - self.barrelPressed = 1 - - def mouseMoveEvent(self, ev): - if not self.barrelPressed: - return - pnt = ev.pos() - if pnt.x() <= 0: - pnt.setX(1) - if pnt.y() >= self.height(): - pnt.setY(self.height() - 1) - rad = math.atan(float(self.rect().bottom() - pnt.y()) / pnt.x()) - self.setAngle(int(round(rad * 180 / math.pi))) - - def mouseReleaseEvent(self, ev): - if ev.button() == qt.TQt.LeftButton: - self.barrelPressed = 0 - - def paintEvent(self, ev): - updateR = ev.rect() - p = qt.TQPainter(self) - - if self.gameEnded: - p.setPen(qt.TQt.black) - p.setFont(qt.TQFont("Courier", 48, qt.TQFont.Bold)) - p.drawText(self.rect(), qt.TQt.AlignCenter, "Game Over") - - if updateR.intersects(self.cannonRect()): - self.paintCannon(p) - - if updateR.intersects(self.barrierRect()): - self.paintBarrier(p) - - if self.isShooting() and updateR.intersects(self.shotRect()): - self.paintShot(p) - - if not self.gameEnded and updateR.intersects(self.targetRect()): - self.paintTarget(p) - - def paintShot(self, p): - p.setBrush(qt.TQt.black) - p.setPen(qt.TQt.NoPen) - p.drawRect(self.shotRect()) - - def paintTarget(self, p): - p.setBrush(qt.TQt.red) - p.setPen(qt.TQt.black) - p.drawRect(self.targetRect()) - - def paintBarrier(self, p): - p.setBrush(qt.TQt.yellow) - p.setPen(qt.TQt.black) - p.drawRect(self.barrierRect()) - - def paintCannon(self, p): - cr = self.cannonRect() - pix = qt.TQPixmap(cr.size()) - pix.fill(self, cr.topLeft()) - - tmp = qt.TQPainter(pix) - tmp.setBrush(qt.TQt.blue) - tmp.setPen(qt.TQt.NoPen) - - tmp.translate(0, pix.height() - 1) - tmp.drawPie(qt.TQRect(-35, -35, 70, 70), 0, 90 * 16) - tmp.rotate(-self.ang) - tmp.drawRect(self.barrelRect) - tmp.end() - - p.drawPixmap(cr.topLeft(), pix) - - def cannonRect(self): - r = qt.TQRect(0, 0, 50, 50) - r.moveBottomLeft(self.rect().bottomLeft()) - return r - - def shotRect(self): - gravity = 4.0 - - time = self.timerCount / 4.0 - velocity = self.shoot_f - radians = self.shoot_ang * math.pi / 180 - - velx = velocity * math.cos(radians) - vely = velocity * math.sin(radians) - x0 = (self.barrelRect.right() + 5) * math.cos(radians) - y0 = (self.barrelRect.right() + 5) * math.sin(radians) - x = x0 + velx * time - y = y0 + vely * time - 0.5 * gravity * time * time - - r = qt.TQRect(0, 0, 6, 6) - r.moveCenter(qt.TQPoint(int(x), int(self.height() - 1 - y))) - return r - - def targetRect(self): - r = qt.TQRect(0, 0, 20, 10) - r.moveCenter(qt.TQPoint(self.target.x(), self.height() - 1 - self.target.y())) - return r - - def barrierRect(self): - return qt.TQRect(145, self.height() - 100, 15, 100) - - def barrelHit(self, p): - mtx = qt.TQWMatrix() - mtx.translate(0, self.height() - 1) - mtx.rotate(-self.ang) - (mtx, invertable) = mtx.invert() - return self.barrelRect.contains(mtx.map(p)) - - def isShooting(self): - return self.autoShootTimer.isActive() - - def sizePolicy(self): - return qt.TQSizePolicy(qt.TQSizePolicy.Expanding, qt.TQSizePolicy.Expanding) - - -class GameBoard(qt.TQWidget): - def __init__(self, parent=None, name=None): - qt.TQWidget.__init__(self, parent, name) - - quit = qt.TQPushButton("&Quit", self, "quit") - quit.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) - self.connect(quit, qt.SIGNAL("clicked()"), qt.tqApp, qt.SLOT("quit()")) - - self.angle = LCDRange("ANGLE", self, "angle") - self.angle.setRange(5, 70) - - self.force = LCDRange("FORCE", self, "force") - self.force.setRange(10, 50) - - box = qt.TQVBox(self, "cannonFrame") - box.setFrameStyle(qt.TQFrame.WinPanel | qt.TQFrame.Sunken) - - self.cannonField = CannonField(box, "cannonField") - - self.connect(self.angle, qt.PYSIGNAL("valueChanged(int)"), self.cannonField.setAngle) - self.connect(self.cannonField, qt.PYSIGNAL("angleChanged(int)"), self.angle.setValue) - - self.connect(self.force, qt.PYSIGNAL("valueChanged(int)"), self.cannonField.setForce) - self.connect(self.cannonField, qt.PYSIGNAL("forceChanged(int)"), self.force.setValue) - - self.connect(self.cannonField, qt.PYSIGNAL("hit()"), self.hit) - self.connect(self.cannonField, qt.PYSIGNAL("missed()"), self.missed) - - self.shoot = qt.TQPushButton("&Shoot", self, "shoot") - self.shoot.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) - self.connect(self.shoot, qt.SIGNAL("clicked()"), self.fire) - self.connect(self.cannonField, qt.PYSIGNAL("canShoot(bool)"), self.shoot, qt.SLOT("setEnabled(bool)")) - - restart = qt.TQPushButton("&New Game", self, "newgame") - restart.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) - self.connect(restart, qt.SIGNAL("clicked()"), self.newGame) - - self.hits = qt.TQLCDNumber(2, self, "hits") - self.shotsLeft = qt.TQLCDNumber(2, self, "shotsleft") - hitsL = qt.TQLabel("HITS", self, "hitsLabel") - shotsLeftL = qt.TQLabel("SHOTS LEFT", self, "shotsleftLabel") - - accel = qt.TQAccel(self) - accel.connectItem(accel.insertItem(qt.TQt.Key_Enter), self.fire) - accel.connectItem(accel.insertItem(qt.TQt.Key_Return), self.fire) - accel.connectItem(accel.insertItem(qt.TQt.CTRL + qt.TQt.Key_Q), qt.tqApp, qt.SLOT("quit()")) - - grid = qt.TQGridLayout(self, 2, 2, 10) - grid.addWidget(quit, 0, 0) - grid.addWidget(box, 1, 1) - grid.setColStretch(1, 10) - - leftBox = qt.TQVBoxLayout() - grid.addLayout(leftBox, 1, 0) - leftBox.addWidget(self.angle) - leftBox.addWidget(self.force) - - topBox = qt.TQHBoxLayout() - grid.addLayout(topBox, 0, 1) - topBox.addWidget(self.shoot) - topBox.addWidget(self.hits) - topBox.addWidget(hitsL) - topBox.addWidget(self.shotsLeft) - topBox.addWidget(shotsLeftL) - topBox.addStretch(1) - topBox.addWidget(restart) - - self.angle.setValue(60) - self.force.setValue(25) - self.angle.setFocus() - - self.newGame() - - def fire(self): - if self.cannonField.gameOver() or self.cannonField.isShooting(): - return - self.shotsLeft.display(self.shotsLeft.intValue() - 1) - self.cannonField.shoot() - - def hit(self): - self.hits.display(self.hits.intValue() + 1) - if self.shotsLeft.intValue() == 0: - self.cannonField.setGameOver() - else: - self.cannonField.newTarget() - - def missed(self): - if self.shotsLeft.intValue() == 0: - self.cannonField.setGameOver() - - def newGame(self): - self.shotsLeft.display(15) - self.hits.display(0) - self.cannonField.restartGame() - self.cannonField.newTarget() - - -qt.TQApplication.setColorSpec(qt.TQApplication.CustomColor) -a = qt.TQApplication(sys.argv) - -gb = GameBoard() -gb.setGeometry(100, 100, 500, 355) -a.setMainWidget(gb) -gb.show() -sys.exit(a.exec_loop()) diff --git a/examples3/tut2.py b/examples3/tut2.py deleted file mode 100755 index 80fe48f..0000000 --- a/examples3/tut2.py +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env python - -# TQt tutorial 2. - -import sys -from python_tqt import qt - - -a = qt.TQApplication(sys.argv) - -quit = qt.TQPushButton("Quit", None) -quit.resize(75, 30) -quit.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) - -qt.TQObject.connect(quit, qt.SIGNAL("clicked()"), a, qt.SLOT("quit()")) - -a.setMainWidget(quit) -quit.show() -sys.exit(a.exec_loop()) diff --git a/examples3/tut3.py b/examples3/tut3.py deleted file mode 100755 index 277c352..0000000 --- a/examples3/tut3.py +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env python - -# TQt tutorial 3. - -import sys -from python_tqt import qt - - -a = qt.TQApplication(sys.argv) - -box = qt.TQVBox() -box.resize(200, 120) - -quit = qt.TQPushButton("Quit", box) -quit.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) - -qt.TQObject.connect(quit, qt.SIGNAL("clicked()"), a, qt.SLOT("quit()")) - -a.setMainWidget(box) -box.show() -sys.exit(a.exec_loop()) diff --git a/examples3/tut4.py b/examples3/tut4.py deleted file mode 100755 index 41417f5..0000000 --- a/examples3/tut4.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env python - -# TQt tutorial 4. - -import sys -from python_tqt import qt - - -class MyWidget(qt.TQWidget): - def __init__(self, parent=None, name=None): - qt.TQWidget.__init__(self, parent, name) - - self.setMinimumSize(200, 120) - self.setMaximumSize(200, 120) - - quit = qt.TQPushButton("Quit", self, "quit") - quit.setGeometry(62, 40, 75, 30) - quit.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) - - self.connect(quit, qt.SIGNAL("clicked()"), qt.tqApp, qt.SLOT("quit()")) - - -a = qt.TQApplication(sys.argv) - -w = MyWidget() -w.setGeometry(100, 100, 200, 120) -a.setMainWidget(w) -w.show() -sys.exit(a.exec_loop()) diff --git a/examples3/tut5.py b/examples3/tut5.py deleted file mode 100755 index 19cb6f7..0000000 --- a/examples3/tut5.py +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env python - -# TQt tutorial 5. - -import sys -from python_tqt import qt - - -class MyWidget(qt.TQVBox): - def __init__(self, parent=None, name=None): - qt.TQVBox.__init__(self, parent, name) - - quit = qt.TQPushButton("Quit", self, "quit") - quit.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) - - self.connect(quit, qt.SIGNAL("clicked()"), qt.tqApp, qt.SLOT("quit()")) - - lcd = qt.TQLCDNumber(2, self, "lcd") - - slider = qt.TQSlider(qt.TQt.Horizontal, self, "slider") - slider.setRange(0, 99) - slider.setValue(0) - - self.connect(slider, qt.SIGNAL("valueChanged(int)"), lcd, qt.SLOT("display(int)")) - - -a = qt.TQApplication(sys.argv) - -w = MyWidget() -a.setMainWidget(w) -w.show() -sys.exit(a.exec_loop()) diff --git a/examples3/tut6.py b/examples3/tut6.py deleted file mode 100755 index d10eaa5..0000000 --- a/examples3/tut6.py +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env python - -# TQt tutorial 6. - -import sys -from python_tqt import qt - - -class LCDRange(qt.TQVBox): - def __init__(self, parent=None, name=None): - qt.TQVBox.__init__(self, parent, name) - - lcd = qt.TQLCDNumber(2, self, "lcd") - slider = qt.TQSlider(qt.TQt.Horizontal, self, "slider") - slider.setRange(0, 99) - slider.setValue(0) - self.connect(slider, qt.SIGNAL("valueChanged(int)"), lcd, qt.SLOT("display(int)")) - - -class MyWidget(qt.TQVBox): - def __init__(self, parent=None, name=None): - qt.TQVBox.__init__(self, parent, name) - - quit = qt.TQPushButton("Quit", self, "quit") - quit.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) - - self.connect(quit, qt.SIGNAL("clicked()"), qt.tqApp, qt.SLOT("quit()")) - - grid = qt.TQGrid(4, self) - - for c in range(4): - for r in range(4): - LCDRange(grid) - - -a = qt.TQApplication(sys.argv) - -w = MyWidget() -a.setMainWidget(w) -w.show() -sys.exit(a.exec_loop()) diff --git a/examples3/tut7.py b/examples3/tut7.py deleted file mode 100755 index 3c9deea..0000000 --- a/examples3/tut7.py +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env python - -# TQt tutorial 7. - -import sys -from python_tqt import qt - - -class LCDRange(qt.TQVBox): - def __init__(self, parent=None, name=None): - qt.TQVBox.__init__(self, parent, name) - - lcd = qt.TQLCDNumber(2, self, "lcd") - self.slider = qt.TQSlider(qt.TQt.Horizontal, self, "slider") - self.slider.setRange(0, 99) - self.slider.setValue(0) - self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), lcd, qt.SLOT("display(int)")) - self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), self, qt.PYSIGNAL("valueChanged(int)")) - - def value(self): - return self.slider.value() - - def setValue(self, value): - self.slider.setValue(value) - - -class MyWidget(qt.TQVBox): - def __init__(self, parent=None, name=None): - qt.TQVBox.__init__(self, parent, name) - - quit = qt.TQPushButton("Quit", self, "quit") - quit.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) - - self.connect(quit, qt.SIGNAL("clicked()"), qt.tqApp, qt.SLOT("quit()")) - - grid = qt.TQGrid(4, self) - - self.lcdlist = [] - previous = None - - for r in range(4): - for c in range(4): - lr = LCDRange(grid) - - if previous: - self.connect(lr, qt.PYSIGNAL("valueChanged(int)"), previous.setValue) - - previous = lr - self.lcdlist.append(lr) - - -a = qt.TQApplication(sys.argv) - -w = MyWidget() -a.setMainWidget(w) -w.show() -sys.exit(a.exec_loop()) diff --git a/examples3/tut8.py b/examples3/tut8.py deleted file mode 100755 index 2e81a94..0000000 --- a/examples3/tut8.py +++ /dev/null @@ -1,97 +0,0 @@ -#!/usr/bin/env python - -# TQt tutorial 8. - -import sys -from python_tqt import qt - - -class LCDRange(qt.TQVBox): - def __init__(self, parent=None, name=None): - qt.TQVBox.__init__(self, parent, name) - - lcd = qt.TQLCDNumber(2, self, "lcd") - self.slider = qt.TQSlider(qt.TQt.Horizontal, self, "slider") - self.slider.setRange(0, 99) - self.slider.setValue(0) - self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), lcd, qt.SLOT("display(int)")) - self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), self, qt.PYSIGNAL("valueChanged(int)")) - - self.setFocusProxy(self.slider) - - def value(self): - return self.slider.value() - - def setValue(self, value): - self.slider.setValue(value) - - def setRange(self, minVal, maxVal): - if minVal < 0 or maxVal > 99 or minVal > maxVal: - raise ValueError("LCDRange.setRange(): invalid range") - - self.slider.setRange(minVal, maxVal) - - -class CannonField(qt.TQWidget): - def __init__(self, parent=None, name=None): - qt.TQWidget.__init__(self, parent, name) - - self.ang = 45 - self.setPalette(qt.TQPalette(qt.TQColor(250, 250, 200))) - - def angle(self): - return self.ang - - def setAngle(self, degrees): - if degrees < 5: - degrees = 5 - if degrees > 70: - degrees = 70 - if self.ang == degrees: - return - self.ang = degrees - self.repaint() - self.emit(qt.PYSIGNAL("angleChanged(int)"), (self.ang, )) - - def paintEvent(self, ev): - p = qt.TQPainter(self) - p.drawText(200, 200, "Angle = %d" % (self.ang)) - - def sizePolicy(self): - return qt.TQSizePolicy(qt.TQSizePolicy.Expanding, qt.TQSizePolicy.Expanding) - - -class MyWidget(qt.TQWidget): - def __init__(self, parent=None, name=None): - qt.TQWidget.__init__(self, parent, name) - - quit = qt.TQPushButton("Quit", self, "quit") - quit.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) - self.connect(quit, qt.SIGNAL("clicked()"), qt.tqApp, qt.SLOT("quit()")) - - self.angle = LCDRange(self, "angle") - self.angle.setRange(5, 70) - - self.cannonField = CannonField(self, "cannonField") - - self.connect(self.angle, qt.PYSIGNAL("valueChanged(int)"), self.cannonField.setAngle) - self.connect(self.cannonField, qt.PYSIGNAL("angleChanged(int)"), self.angle.setValue) - - grid = qt.TQGridLayout(self, 2, 2, 10) - - grid.addWidget(quit, 0, 0) - grid.addWidget(self.angle, 1, 0, qt.TQt.AlignTop) - grid.addWidget(self.cannonField, 1, 1) - grid.setColStretch(1, 10) - - self.angle.setValue(60) - self.angle.setFocus() - - -a = qt.TQApplication(sys.argv) - -w = MyWidget() -w.setGeometry(100, 100, 500, 355) -a.setMainWidget(w) -w.show() -sys.exit(a.exec_loop()) diff --git a/examples3/tut9.py b/examples3/tut9.py deleted file mode 100755 index 3eafed7..0000000 --- a/examples3/tut9.py +++ /dev/null @@ -1,104 +0,0 @@ -#!/usr/bin/env python - -# TQt tutorial 9. - -import sys -from python_tqt import qt - - -class LCDRange(qt.TQVBox): - def __init__(self, parent=None, name=None): - qt.TQVBox.__init__(self, parent, name) - - lcd = qt.TQLCDNumber(2, self, "lcd") - self.slider = qt.TQSlider(qt.TQt.Horizontal, self, "slider") - self.slider.setRange(0, 99) - self.slider.setValue(0) - self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), lcd, qt.SLOT("display(int)")) - self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), self, qt.PYSIGNAL("valueChanged(int)")) - - self.setFocusProxy(self.slider) - - def value(self): - return self.slider.value() - - def setValue(self, value): - self.slider.setValue(value) - - def setRange(self, minVal, maxVal): - if minVal < 0 or maxVal > 99 or minVal > maxVal: - raise ValueError("LCDRange.setRange(): invalid range") - self.slider.setRange(minVal, maxVal) - - -class CannonField(qt.TQWidget): - def __init__(self, parent=None, name=None): - qt.TQWidget.__init__(self, parent, name) - - self.ang = 45 - self.setPalette(qt.TQPalette(qt.TQColor(250, 250, 200))) - - def angle(self): - return self.ang - - def setAngle(self, degrees): - if degrees < 5: - degrees = 5 - if degrees > 70: - degrees = 70 - if self.ang == degrees: - return - self.ang = degrees - self.repaint() - self.emit(qt.PYSIGNAL("angleChanged(int)"), (self.ang, )) - - def paintEvent(self, ev): - p = qt.TQPainter(self) - - p.setBrush(qt.TQt.blue) - p.setPen(qt.TQt.NoPen) - - p.translate(0, self.rect().bottom()) - p.drawPie(qt.TQRect(-35, -35, 70, 70), 0, 90 * 16) - p.rotate(-self.ang) - p.drawRect(qt.TQRect(33, -4, 15, 8)) - - def sizePolicy(self): - return qt.TQSizePolicy(qt.TQSizePolicy.Expanding, qt.TQSizePolicy.Expanding) - - -class MyWidget(qt.TQWidget): - def __init__(self, parent=None, name=None): - qt.TQWidget.__init__(self, parent, name) - - quit = qt.TQPushButton("&Quit", self, "quit") - quit.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) - self.connect(quit, qt.SIGNAL("clicked()"), qt.tqApp, qt.SLOT("quit()")) - - self.angle = LCDRange(self, "angle") - self.angle.setRange(5, 70) - - self.cannonField = CannonField(self, "cannonField") - - self.connect(self.angle, qt.PYSIGNAL("valueChanged(int)"), self.cannonField.setAngle) - self.connect(self.cannonField, qt.PYSIGNAL("angleChanged(int)"), self.angle.setValue) - - grid = qt.TQGridLayout(self, 2, 2, 10) - - grid.addWidget(quit, 0, 0) - grid.addWidget(self.angle, 1, 0, qt.TQt.AlignTop) - grid.addWidget(self.cannonField, 1, 1) - grid.setColStretch(1, 10) - - self.angle.setValue(60) - self.angle.setFocus() - - -qt.TQApplication.setColorSpec(qt.TQApplication.CustomColor) -a = qt.TQApplication(sys.argv) - -w = MyWidget() -w.setGeometry(100, 100, 500, 355) -a.setMainWidget(w) -w.show() -sys.exit(a.exec_loop()) diff --git a/examples3/webbrowser/mainwindow.py b/examples3/webbrowser/mainwindow.py deleted file mode 100644 index 14929de..0000000 --- a/examples3/webbrowser/mainwindow.py +++ /dev/null @@ -1,1097 +0,0 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'mainwindow.ui' -# -# Created: Sun Dec 5 14:50:47 2004 -# by: The PyTQt User Interface Compiler (pyuic) snapshot-20041203 -# -# WARNING! All changes made in this file will be lost! - - -from python_tqt.qt import * -from python_tqt.qtaxcontainer import TQAxWidget - -image0_data = [ -"32 32 3 1", -". c None", -"a c #000080", -"# c #808080", -"................................", -"................................", -"................................", -"................................", -"................................", -"................................", -"................................", -"................................", -".......#aaaaaaaaa...............", -"......#aaaaaaaaaaa.........a....", -".....#aaa.......aaa.......aa....", -"....#aaa.........aaaa....aaa....", -"....aaa...........aaaa..aaaa....", -"....aa..............aaaaaaaa....", -"....aa...............aaaaaaa....", -"....aa...............aaaaaaa....", -"....aa..............aaaaaaaa....", -"....aa.............aaaaaaaaa....", -"....#aa...........aaaaaaaaaa....", -".....#aa.........aaaaaaaaaaa....", -"......aa#.......................", -".......aa#......................", -"................................", -"................................", -"................................", -"................................", -"................................", -"................................", -"................................", -"................................", -"................................", -"................................" -] -image1_data = [ -"32 32 142 2", -"TQt c None", -"#O c #0010f7", -"#P c #0021ef", -"#R c #0021f7", -"#S c #0021ff", -"#T c #0029ff", -"ah c #0031ff", -"#N c #0829f7", -"#x c #0831ff", -"#C c #0839ff", -"#E c #1029e7", -"#r c #1039ff", -"#o c #1042ff", -"#Q c #1831de", -"ak c #1831e7", -"#k c #1842ff", -"#H c #184aff", -"aj c #2139e7", -"#s c #2142de", -"#G c #214aff", -".9 c #2152ff", -"#2 c #2939c6", -"ag c #2939d6", -"a# c #2942ce", -"#p c #2942de", -"#U c #2952ff", -"ae c #295aff", -"#y c #3152de", -".2 c #3152e7", -"#I c #315aff", -"#z c #3163ff", -"#1 c #394abd", -"#L c #394ade", -"#B c #3963ff", -"#w c #396bff", -"#V c #4252d6", -"#l c #4252de", -"#W c #4263ef", -"#q c #426bff", -".1 c #4273ff", -"#5 c #4a5ad6", -"#J c #4a73ff", -"#K c #4a7bff", -"ac c #4a84ff", -"ab c #5263c6", -".T c #5263ce", -".M c #5273d6", -".c c #5273e7", -".U c #527bde", -"#t c #527bf7", -"#A c #5284ff", -"#X c #5a63ad", -".V c #5a84ef", -"#F c #5a84ff", -"#v c #5a8cff", -"ad c #636bbd", -".e c #637bc6", -".W c #637bce", -".3 c #637bd6", -".Q c #6384de", -".5 c #638cef", -"#b c #638cff", -"#j c #6394ff", -"af c #6b73bd", -"#0 c #6b73c6", -".S c #6b84ce", -"#u c #6b94ff", -".C c #6b9cff", -"ai c #737bce", -".z c #7384b5", -".j c #7384c6", -"#6 c #738cce", -".4 c #738cd6", -".b c #739ce7", -".I c #73a5ff", -"#n c #73adff", -"#Z c #7b84b5", -".R c #7b8cbd", -".J c #7b94bd", -".n c #7ba5e7", -".P c #7badff", -"#c c #7bb5ff", -"#M c #84849c", -"#3 c #8484ad", -".i c #848cc6", -"al c #8494bd", -"aa c #849cc6", -".y c #84adff", -".O c #84b5ff", -"#a c #84bdff", -".t c #8c94ad", -".a c #8c94b5", -".D c #8c9cbd", -".m c #8c9cce", -".A c #8ca5ef", -".f c #8cadf7", -".H c #8cbdff", -"#D c #9494a5", -"#8 c #9494bd", -"#9 c #9494c6", -"a. c #949cbd", -".r c #94c6ff", -"#d c #94ceff", -"#4 c #9ca5ad", -"#7 c #9ca5b5", -".u c #9cbdf7", -".6 c #9cc6ff", -".0 c #9cceff", -".x c #9cd6ff", -".L c #a5a5b5", -"#Y c #a5a5bd", -"#e c #a5ceff", -"## c #a5d6ff", -".X c #adadb5", -".k c #adc6ff", -"#i c #add6ff", -".E c #b5b5b5", -".d c #b5b5bd", -".K c #b5bdc6", -".F c #b5ceff", -".N c #b5d6ff", -".B c #b5deff", -".s c #bdbdbd", -".# c #bdbdc6", -"#. c #bdd6ff", -".G c #bde7ff", -"#h c #c6e7ff", -"#f c #c6efff", -".w c #c6f7ff", -".h c #ced6ff", -".Y c #cee7ff", -".q c #ceefff", -".Z c #cef7ff", -".l c #d6efff", -".8 c #d6f7ff", -".o c #deefff", -".7 c #def7ff", -"#m c #deffff", -"#g c #e7ffff", -".v c #efffff", -".p c #f7ffff", -".g c #ffffff", -"TQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt", -"TQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt", -"TQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt", -"TQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt", -"TQtTQtTQtTQtTQtTQtTQtTQtTQtTQt.#.a.b.c.aTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt", -"TQtTQtTQtTQtTQtTQtTQtTQtTQt.d.e.f.g.h.iTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt", -"TQtTQtTQtTQtTQtTQtTQtTQt.d.j.k.g.g.l.mTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt", -"TQtTQtTQtTQtTQtTQtTQt.a.n.o.g.p.q.r.mTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt", -"TQ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P c #0831ff", -"#4 c #1021d6", -"#R c #1021de", -"#L c #1029d6", -"#V c #1029e7", -"#n c #1039f7", -"#W c #1039ff", -"#O c #1042ff", -"ah c #1831ce", -"#y c #1842ff", -"aj c #2131c6", -"#S c #2131ce", -"#z c #2139de", -".0 c #2142de", -"ai c #2142e7", -".t c #214aef", -"#D c #214aff", -".x c #2152ff", -"al c #2939de", -"#d c #294ae7", -"#I c #2952ff", -"#J c #295aff", -"#T c #3142bd", -"#N c #315aff", -"#s c #3163ff", -"#F c #394ac6", -"#G c #3952d6", -"ag c #395ae7", -".B c #3963f7", -"ae c #3963ff", -".g c #396bff", -"#U c #424ab5", -"#2 c #4252b5", -".J c #425ace", -"#A c #4263de", -".b c #426be7", -"#p c #426bef", -"#x c #426bff", -".n c #4273ff", -".o c #4a63ce", -"#t c #4a6be7", -".Q c #4a73de", -"#3 c #4a73ff", -"#C c #4a7bff", -"#Z c #525abd", -".1 c #526bbd", -".W c #526bc6", -".R c #526bce", -".P c #527be7", -"#w c #5284ff", -"#m c #528cff", -"ac c #5a63bd", -"ak c #5a6bbd", -".O c #5a7bf7", -"#H c #5a84ff", -"#9 c #5a8cff", -"af c #636bb5", -".h c #636bbd", -"ab c #6384ef", -"#v c #638cff", -".w c #6394ff", -".s c #639cff", -"#M c #6b73b5", -".C c #6b73bd", -"#u c #6b9cff", -".c c #737bb5", -".S c #7384ce", -".N c #738ce7", -".a c #7394de", -".8 c #7394ef", -"#8 c #739cf7", -"#B c #739cff", -".A c #73a5ff", -"#0 c #7b84b5", -".T c #7b8cbd", -".9 c #7b94c6", -"#. c #7b94d6", -".7 c #7ba5ff", -".X c #7badff", -".I c #7bb5ff", -"#5 c #848ca5", -".y c #848cad", -".M c #8494b5", -"## c #849cd6", -"#c c #84adff", -".G c #84b5ff", -".Z c #84bdff", -"#o c #8c8cad", -"#a c #8ca5ce", -".Y c #8cb5ff", -".H c #8cbdff", -"#1 c #9494a5", -".U c #9494ad", -"#7 c #949cad", -"#b c #94ade7", -".z c #94c6ff", -".v c #94ceff", -".j c #9c9cad", -".u c #9ca5ad", -"#r c #9cc6ff", -".m c #9cceff", -".d c #a5a5a5", -"#6 c #a5a5ad", -".V c #a5a5b5", -".K c #a5adb5", -".2 c #a5ceff", -".r c #a5d6ff", -".L c #adadad", -".i c #adadb5", -".p c #adadbd", -".q c #addeff", -"#e c #ade7ff", -"#X c #b5b5b5", -".D c #b5b5bd", -".E c #b5b5c6", -".F c #b5bdc6", -".f c #b5deff", -"#q c #b5efff", -".# c #bdbdbd", -"ad c #bdbdc6", -".6 c #bddeff", -"#i c #bde7ff", -"#h c #bdefff", -"#g c #c6f7ff", -"#l c #cee7ff", -"#j c #cef7ff", -"#f c #ceffff", -".k c #d6efff", -"#k c #d6f7ff", -".l c #d6ffff", -".e c #deefff", -".5 c #e7ffff", -".4 c #efffff", -".3 c #f7ffff", -"TQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt", -"TQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt", -"TQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt", -"TQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt", -"TQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt.#.a.b.c.#TQtTQtTQtTQtTQtTQtTQtTQtTQtTQt", -"TQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt.d.e.f.g.h.iTQtTQtTQtTQtTQtTQtTQtTQt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tTQtTQt", -"TQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt" -] -image3_data = [ -"25 25 2 1", -"# c #000000", -". c #ffffff", -".........................", -".........................", -".........................", -".........######..........", -".......##########........", -"......####....####.......", -".....###........###......", -"....#####........###.....", -"....##.###........##.....", -"...###..###.......###....", -"...##....###.......##....", -"...##.....###......##....", -"...##......###.....##....", -"...##.......###....##....", -"...###.......###..###....", -"....##........###.##.....", -"....###........#####.....", -".....###........###......", -"......####....####.......", -".......##########........", -".........######..........", -".........................", -".........................", -".........................", -"........................." -] -image4_data = [ -"32 32 3 1", -". c None", -"# c #000080", -"a c #808080", -"................................", -"................................", -"................................", -"................................", -"................................", -"................................", -"................................", -"................................", -"................................", -"...............#########a.......", -"....#.........###########a......", -"....##.......###.......###a.....", -"....###....####.........###a....", -"....####..####...........###....", -"....########..............##....", -"....#######...............##....", -"....#######...............##....", -"....########..............##....", -"....#########.............##....", -"....##########...........##a....", -"....###########.........##a.....", -".......................a##......", -"......................a##.......", -"................................", -"................................", -"................................", -"................................", -"................................", -"................................", -"................................", -"................................", -"................................" -] -image5_data = [ -"32 32 211 2", -"TQt c None", -"aJ c #000000", -"#W c #080800", -"#N c #100800", -"#V c #101000", -"#E c #101008", -"#M c #181000", -"#L c #181800", -"#D c #181808", -"#F c #181810", -"as c #211800", -"#K c #211808", -"#J c #212110", -"#G c #212118", -"#q c #212121", -"an c #292100", -"#I c #292110", -"aN c #292910", -"#H c #292918", -"#y c #292921", -"aF c #312900", -"#C c #312918", -"#i c #312929", -".0 c #313131", -"#7 c #393100", -"#U c #393108", -"aG c #393931", -".M c #393939", -"#u c #423939", -"#c c #424a42", -"aE c #4a4200", -"aY c #4a4210", -".V c #4a4239", -"#B c #4a4a39", -".m c #4a4a42", -"aP c #4a5218", -".G c #4a5252", -".z c #4a5a52", -"aO c #524200", -"am c #524a00", -"#T c #524a08", -"#p c #524a4a", -".s c #525252", -"#a c #525a52", -".7 c #52635a", -"#b c #526363", -"az c #5a4a00", -"#6 c #5a5208", -"aw c #5a5210", -".Z c #5a524a", -".L c #5a5a52", -".y c #5a5a5a", -".F c #5a635a", -"#S c #635208", -"ax c #635a10", -".U c #635a52", -".r c #635a5a", -"aZ c #636321", -"## c #63635a", -".A c #636363", -"#h c #636b6b", -"aL c #637329", -"af c #6b5a00", -".6 c #6b635a", -"#o c #6b6363", -".E c #6b6b63", -"a4 c #6b7321", -"aS c #6b7329", -"aR c #6b7331", -"aX c #736300", -"al c #736308", -"#R c #736b10", -".T c #736b63", -"a5 c #737329", -".i c #73736b", -".K c #737373", -"a7 c #737b29", -"#g c #737b73", -"a9 c #7b7318", -"#A c #7b7373", -"a8 c #7b7b21", -"aV c #7b7b29", -"aQ c #7b7b5a", -".J c #7b7b73", -".1 c #7b7b7b", -"b# c #7b8431", -"a3 c #7b844a", -".8 c #7b847b", -"ay c #847308", -"#5 c #847310", -"aT c #847b21", -"b. c #847b29", -".S c #847b73", -".d c #847b7b", -"aW c #848421", -"a1 c #848429", -"a0 c #848431", -"bq c #84844a", -".H c #848484", -"ae c #8c7b08", -"ak c #8c7b10", -"#j c #8c8484", -"ba c #8c8c63", -"a2 c #8c8c7b", -".x c #8c8c84", -".2 c #8c948c", -".9 c #8cada5", -"aC c #947b08", -".Y c #947b73", -"aK c #948c10", -"#Q c #948c18", -"a6 c #948c29", -"#m c #948c84", -"bp c #949442", -"aH c #949484", -".D c #94948c", -".n c #949494", -"bn c #949c4a", -"bl c #949c5a", -"bj c #949c63", -".u c #949c94", -".v c #94a59c", -"aI c #9c8c10", -"#4 c #9c8c18", -"#O c #9c8c29", -"aM c #9c9418", -"#r c #9c948c", -"bo c #9c9c4a", -"bm c #9c9c52", -"bk c #9c9c5a", -"bh c #9c9c6b", -".k c #9c9c94", -".a c #9c9c9c", -"bi c #9ca56b", -"bf c #9ca573", -".h c #9ca59c", -"#f c #9ca5a5", -".B c #9cbdb5", -"#P c #a59400", -"aB c #a59418", -"#k c #a5948c", -"ar c #a59c29", -".N c #a59c8c", -".P c #a59c94", -".W c #a59c9c", -"bg c #a5a573", -"bd c #a5a584", -".q c #a5a59c", -".c c #a5a5a5", -"be c #a5ad7b", -".o c #a5ada5", -".C c #a5adad", -".I c #a5b5ad", -"#d c #a5bdb5", -".w c #a5c6bd", -"ad c #ad9c10", -"aj c #ad9c18", -"#w c #ad9c94", -".f c #ada59c", -"bc c #adad7b", -"bb c #adad84", -".# c #adada5", -".t c #adadad", -".4 c #adb5ad", -"ai c #b5a518", -"aq c #b5a529", -"aD c #b5a542", -"ao c #b5a54a", -".O c #b5a594", -"#v c #b5a59c", -"at c #b5ad52", -"#z c #b5ad9c", -".5 c #b5ada5", -".j c #b5b5ad", -".e c #b5b5b5", -".3 c #b5bdb5", -".Q c #b5bdbd", -"#e c #b5cec6", -"#8 c #bda539", -"#x c #bda59c", -"#3 c #bdad29", -"#X c #bdad31", -"ag c #bdad42", -"#n c #bdb5ad", -".b c #bdbdbd", -".X c #bdcec6", -"aU c #c6b510", -"#. c #c6c6bd", -".p c #c6cece", -".g c #c6ded6", -"ac c #cebd31", -"#l c #ced6ce", -"#s c #ced6d6", -"#t c #cedede", -"#9 c #d6c610", -"#2 c #d6c631", -"ap c #dec608", -"ah c #dece10", -"ab c #dece31", -".l c #deefe7", -".R c #deefef", -"au c #e7ce08", -"a. c #e7d621", -"a# c #e7d631", -"aa c #e7d639", -"#1 c #e7de39", -"#Y c #efde10", -"av c #efde21", -"aA c #efde29", -"#Z c #f7e729", -"#0 c #f7e739", -"TQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt.#.aTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt", -"TQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt.b.c.d.eTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt", -"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TQtTQtTQtTQtTQt", -"TQtTQtTQtTQtTQtTQtTQt.qaLaIahavaM#WaJ#W#DaN#RaealaOan#NaNaPaTQTQtTQtTQtTQtTQt", -"TQtTQtTQtTQtTQtTQt.jaRaSaTaUavaB#WaNaPaLaVaWaeaX#6aYaZa0a1a2TQtTQtTQtTQtTQt", -"TQtTQtTQtTQtTQt.ba3a4a5a5aVa6a1aZa7aSaSa5a8a9a4a5b.b#a5a5.kTQtTQtTQtTQtTQt", -"TQtTQtTQtTQtTQtbaa7a7aVa0b.b#a7b#a0a7a7a7aSaSa7b.aVa0aVaR.#TQtTQtTQtTQtTQt", -"TQtTQtTQtTQtTQtbbbcbdbebebfbgbhbhbibjbjbkbkblbmbmbnbobpbq.bTQtTQtTQtTQtTQt" -] -image6_data = [ -"22 22 165 2", -"TQt c None", -".h c #000000", -".o c #010101", -"aF c #030303", -"#n c #060606", -".H c #080808", -".r c #0c0c0c", -".q c #121212", -"#V c #124e7f", -"#m c #131313", -".G c #161615", -"aI c #172cac", -".6 c #181818", -"aH c #1841b2", -".p c #191919", -"#8 c #1928ba", -"#W c #1929ba", -"aj c #192aba", -"av c #1a31c2", -"aE c #1b1b1b", -"aD c #1b2bc8", -"at c #1c79d2", -"ah c #1c7dd4", -"aA c #1d1d1d", -"aC c #1d7ad7", -"#6 c #1d7eda", -".5 c #1e1e1e", -"#7 c #1e8ae0", -"ai c #1e8de0", -"au c #1e90e0", -".g c #242424", -"#5 c #313b6c", -"aB c #343d8d", -"#3 c #393939", -".f c #3d3d3d", -"ak c #433967", -"#C c #434442", -"aw c #443c6e", -"#l c #454643", -"as c #454fa3", -".4 c #474845", -"#R c #474846", -".e c #484848", -"aG c #4856a0", -".d c #4a4a4a", -"#9 c #4c416a", -".c c #4c4c4c", -"ag c #4c5cae", -"#X c #4d4669", -"#z c #4dc2b2", -"#P c #4e445a", -"#G c #53504e", -".l c #545454", -".b c #555555", -"#Q c #595274", -"#i c #62b2a2", -".a c #676767", -"#j c #69b6a3", -".F c #6f6f6a", -".K c #6f8b89", -"ax c #747474", -"#a c #76a1a0", -".# c #797979", -"#A c #7bd7e8", -"ay c #7d7d7d", -"#U c #7e7d73", -".I c #808080", -".O c #81a3b8", -"az c #828282", -"#y c #82d1c0", -"#S c #848484", -"#O c #857e7c", -"#F c #86add2", -"#k c #86cdda", -"#N c #89b1bd", -"#h c #8acec3", -"#o c #8c8c8c", -"#L c #8cbbca", -"al c #8d8d8d", -".s c #8f8f8f", -"#H c #909090", -"#K c #90bac9", -"#M c #91c4cf", -"#t c #929292", -".X c #94c2cf", -".N c #94c2d0", -".W c #959595", -"#B c #96b9cb", -".3 c #97bede", -".L c #98c2ce", -".P c #9b9b9b", -"a. c #9c9c9c", -"am c #9d9d9d", -"#s c #9dbdc4", -"#b c #9e9e9e", -"#Y c #a0a0a0", -"an c #a6a6a6", -"#v c #a6d1d6", -".Z c #a7a1a1", -"#I c #a7a7a7", -"#D c #a7edde", -".M c #a8d8e5", -"#u c #aeaeae", -"ac c #b1b1b1", -"a# c #b2b2b2", -".2 c #b5cbd6", -".V c #b6b6b6", -"ar c #b7b7b7", -"#Z c #b8b8b8", -"#2 c #bababa", -".Q c #babbb9", -"aq c #bbbbbb", -"#c c #bcbcbc", -".8 c #bfbfbf", -"ap c #c0c0c0", -".1 c #c1d9d2", -"aa c #c8c8c8", -"ab c #cacaca", -"ao c #cbcbcb", -".Y c #ccf8f1", -"#J c #cdcdcd", -".R c #cecece", -"#p c #d1f9f4", -"#4 c #d5d5d5", -"#w c #d5ece4", -".9 c #d5f6f5", -"#0 c #d6d6d6", -".U c #d7d7d7", -"af c #d8d8d8", -".x c #dadada", -".y c #dbdbdb", -".w c #dcdcdc", -"#e c #dcf7f4", -"#1 c #dddddd", -"ae c #dedede", -".E c #dfdfdf", -".z c #e0e0e0", -"#g c #e0ebe4", -"#q c #e1edea", -"#d c #e2e2e2", -"#x c #e2ebe2", -".0 c #e2eee5", -".v c #e3e3e3", -"## c #e3e7d5", -"#r c #e4ebd9", -"#E c #e4f2ec", -".u c #e5e5e5", -".S c #e7e7e7", -".k c #e9e9e9", -".A c #ebebeb", -".D c #ededed", -".t c #f0f0f0", -"#T c #f4f4f4", -".n c #f6f6f6", -".C c #f7f7f7", -"#f c #f8f5f2", -".m c #f8f8f8", -".7 c #f9f9f9", -"ad c #fafafa", -"#. c #fbf0eb", -".J c #fbfbfb", -".T c #fcfcfc", -".B c #fdfdfd", -".j c #fefefe", -".i c #ffffff", -"TQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt", -"TQtTQtTQtTQtTQt.#.a.b.c.d.d.e.f.g.hTQtTQtTQtTQtTQtTQtTQt", -"TQtTQtTQtTQt.#.i.i.i.i.i.i.i.i.i.h.hTQtTQtTQtTQtTQtTQt", -"TQtTQtTQtTQt.a.j.j.j.j.j.j.i.i.i.h.k.hTQtTQtTQtTQtTQt", -"TQtTQtTQtTQt.l.m.n.o.p.q.r.s.j.i.h.t.u.hTQtTQtTQtTQt", -"TQtTQtTQtTQt.e.v.w.x.y.z.A.n.B.B.h.C.D.E.hTQtTQtTQt", -"TQtTQtTQt.h.h.h.h.h.F.G.H.I.n.J.h.h.h.h.h.hTQtTQt", -"TQtTQt.h.K.L.M.N.O.h.P.Q.R.S.n.T.j.U.V.W.hTQtTQt", -"TQt.h.X.Y.Z.0.1.2.3.h.4.5.6.q.r.s.7.v.8.hTQtTQt", -"TQt.h.9#..###.F.F.F#a.h#b#c#d.m.j.7.v#c.hTQtTQt", -"TQt.h#e#f.a#g#h#i#j#k.h#l#m.r#n#o.7.v#c.hTQtTQt", -"TQt.h#p#q.a#r.F.F.F#s.h#t#u.x.n.j.7.v#c.hTQtTQt", -"TQt.h#v#w.##x#y#z#A#B.h#C#m#m.q#o.7.v#c.hTQtTQt", -"TQtTQt.h#D.Z#E.F.F#F.h#G#H#I#J.A.7.m.v#c.hTQtTQt", -"TQtTQtTQt.h#K#L#M#N.h#O#P#Q#R#m.q#S#T#d#c.hTQtTQt", -"TQtTQtTQtTQt.h.h.h.h.Z#U#V#W#X#Y#Z#0.S#1#2.hTQtTQt", -"TQtTQtTQtTQt#3.t.v.x#4#5#6#7#8#9a.a#aaabac.hTQtTQt", -"TQtTQtTQtTQt.6ad.kae.yafagahaiajakalamana..oTQtTQt", -"TQtTQtTQtTQt.haeaoapaqaqarasatauavawaxayaz.oTQtTQt", -"TQtTQtTQtTQtTQt.h.h.h.h.haA.oaBaCaiaD.HaEaFTQtTQtTQt", -"TQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtaGaHaITQtTQtTQtTQtTQtTQt", -"TQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQtTQt" -] - -class MainWindow(TQMainWindow): - def __init__(self,parent = None,name = None,fl = 0): - TQMainWindow.__init__(self,parent,name,fl) - self.statusBar() - - self.image0 = TQPixmap(image0_data) - self.image1 = TQPixmap(image1_data) - self.image2 = TQPixmap(image2_data) - self.image3 = TQPixmap(image3_data) - self.image4 = TQPixmap(image4_data) - self.image5 = TQPixmap(image5_data) - self.image6 = TQPixmap(image6_data) - - if not name: - self.setName("MainWindow") - - - self.setCentralWidget(TQWidget(self,"qt_central_widget")) - MainWindowLayout = TQHBoxLayout(self.centralWidget(),0,6,"MainWindowLayout") - - self.Frame3 = TQFrame(self.centralWidget(),"Frame3") - self.Frame3.setFrameShape(TQFrame.StyledPanel) - self.Frame3.setFrameShadow(TQFrame.Sunken) - Frame3Layout = TQVBoxLayout(self.Frame3,1,0,"Frame3Layout") - - self.WebBrowser = TQAxWidget(self.Frame3,"WebBrowser") - self.WebBrowser.setControl("{8856F961-340A-11D0-A96B-00C04FD705A2}") - self.WebBrowser.setFocusPolicy(TQAxWidget.StrongFocus) - Frame3Layout.addWidget(self.WebBrowser) - MainWindowLayout.addWidget(self.Frame3) - - self.actionGo = TQAction(self,"actionGo") - self.actionGo.setIconSet(TQIconSet(self.image0)) - self.actionBack = TQAction(self,"actionBack") - self.actionBack.setIconSet(TQIconSet(self.image1)) - self.actionForward = TQAction(self,"actionForward") - self.actionForward.setIconSet(TQIconSet(self.image2)) - self.actionStop = TQAction(self,"actionStop") - self.actionStop.setIconSet(TQIconSet(self.image3)) - self.actionRefresh = TQAction(self,"actionRefresh") - self.actionRefresh.setIconSet(TQIconSet(self.image4)) - self.actionHome = TQAction(self,"actionHome") - self.actionHome.setIconSet(TQIconSet(self.image5)) - self.actionFileClose = TQAction(self,"actionFileClose") - self.FileNewGroup = TQActionGroup(self,"FileNewGroup") - self.FileNewGroup.setUsesDropDown(1) - self.actionNewWindow = TQAction(self.FileNewGroup,"actionNewWindow") - self.actionSearch = TQAction(self,"actionSearch") - self.actionSearch.setIconSet(TQIconSet(self.image6)) - self.actionAbout = TQAction(self,"actionAbout") - self.actionAboutTQt = TQAction(self,"actionAboutTQt") - - - self.Toolbar = TQToolBar(TQString(""),self,TQt.DockTop) - - self.actionBack.addTo(self.Toolbar) - self.actionForward.addTo(self.Toolbar) - self.actionStop.addTo(self.Toolbar) - self.actionRefresh.addTo(self.Toolbar) - self.actionHome.addTo(self.Toolbar) - self.Toolbar.addSeparator() - self.actionSearch.addTo(self.Toolbar) - self.Toolbar_2 = TQToolBar(TQString(""),self,TQt.DockTop) - - self.Toolbar_2.setHorizontallyStretchable(1) - - self.lblAddress = TQLabel(self.Toolbar_2,"lblAddress") - - self.addressEdit = TQLineEdit(self.Toolbar_2,"addressEdit") - self.actionGo.addTo(self.Toolbar_2) - - - self.menubar = TQMenuBar(self,"menubar") - - - self.PopupMenu = TQPopupMenu(self) - self.FileNewGroup_2 = TQPopupMenu(self) - self.PopupMenu.setAccel(TQString.null,self.PopupMenu.insertItem(self.FileNewGroup.iconSet(),self.__tr("New"),self.FileNewGroup_2)) - self.actionNewWindow.addTo(self.FileNewGroup_2) - self.PopupMenu.insertSeparator() - self.actionFileClose.addTo(self.PopupMenu) - self.menubar.insertItem(TQString(""),self.PopupMenu,1) - - self.unnamed = TQPopupMenu(self) - self.actionAbout.addTo(self.unnamed) - self.actionAboutTQt.addTo(self.unnamed) - self.menubar.insertItem(TQString(""),self.unnamed,2) - - - self.languageChange() - - self.resize(TQSize(812,605).expandedTo(self.minimumSizeHint())) - self.clearWState(TQt.WState_Polished) - - self.connect(self.actionHome,SIGNAL("activated()"),self.WebBrowser,SLOT("GoHome()")) - self.connect(self.actionRefresh,SIGNAL("activated()"),self.WebBrowser,SLOT("Refresh()")) - self.connect(self.actionStop,SIGNAL("activated()"),self.WebBrowser,SLOT("Stop()")) - self.connect(self.actionForward,SIGNAL("activated()"),self.WebBrowser,SLOT("GoForward()")) - self.connect(self.actionBack,SIGNAL("activated()"),self.WebBrowser,SLOT("GoBack()")) - self.connect(self.actionGo,SIGNAL("activated()"),self.go) - self.connect(self.actionFileClose,SIGNAL("activated()"),self.close) - self.connect(self.actionSearch,SIGNAL("activated()"),self.WebBrowser,SLOT("GoSearch()")) - self.connect(self.addressEdit,SIGNAL("returnPressed()"),self.go) - self.connect(self.WebBrowser,SIGNAL("NavigateComplete(const TQString&)"),self.addressEdit.setText) - self.connect(self.WebBrowser,SIGNAL("TitleChange(const TQString&)"),self.setTitle) - self.connect(self.WebBrowser,SIGNAL("NavigateComplete(const TQString&)"),self.navigateComplete) - self.connect(self.WebBrowser,SIGNAL("CommandStateChange(int,bool)"),self.setCommandState) - self.connect(self.WebBrowser,SIGNAL("BeforeNavigate(const TQString&,int,const TQString&,const TQVariant&,const TQString&,bool&)"),self.navigateBegin) - self.connect(self.actionStop,SIGNAL("activated()"),self.navigateComplete) - self.connect(self.actionNewWindow,SIGNAL("activated()"),self.newWindow) - self.connect(self.actionAbout,SIGNAL("activated()"),self.aboutSlot) - self.connect(self.actionAboutTQt,SIGNAL("activated()"),self.aboutTQtSlot) - - self.init() - - - def languageChange(self): - self.setCaption(self.__tr("TQt WebBrowser")) - self.WebBrowser.setControl(self.__tr("{8856F961-340A-11D0-A96B-00C04FD705A2}")) - self.actionGo.setText(self.__tr("Go")) - self.actionGo.setMenuText(self.__tr("Go")) - self.actionBack.setText(self.__tr("Back")) - self.actionBack.setAccel(self.__tr("Backspace")) - self.actionBack.setMenuText(self.__tr("Back")) - self.actionForward.setText(self.__tr("Forward")) - self.actionForward.setMenuText(self.__tr("Forward")) - self.actionStop.setText(self.__tr("Stop")) - self.actionStop.setMenuText(self.__tr("Stop")) - self.actionRefresh.setText(self.__tr("Refresh")) - self.actionRefresh.setMenuText(self.__tr("Refresh")) - self.actionHome.setText(self.__tr("Home")) - self.actionHome.setMenuText(self.__tr("Home")) - self.actionFileClose.setText(self.__tr("Close")) - self.actionFileClose.setMenuText(self.__tr("C&lose")) - self.FileNewGroup.setText(self.__tr("New")) - self.actionNewWindow.setText(self.__tr("Window")) - self.actionNewWindow.setAccel(self.__tr("Ctrl+N")) - self.actionNewWindow.setMenuText(self.__tr("Window")) - self.FileNewGroup.setMenuText(self.__tr("New")) - self.actionSearch.setText(self.__tr("Search")) - self.actionSearch.setMenuText(self.__tr("Search")) - self.actionAbout.setText(self.__tr("About")) - self.actionAbout.setMenuText(self.__tr("About")) - self.actionAboutTQt.setText(self.__tr("About TQt")) - self.actionAboutTQt.setMenuText(self.__tr("About TQt")) - self.Toolbar.setLabel(self.__tr("Toolbar")) - self.Toolbar_2.setLabel(self.__tr("Toolbar_2")) - self.lblAddress.setText(self.__tr("Address")) - self.PopupMenu.changeItem(self.PopupMenu.idAt(0),self.__tr("New")) - if self.menubar.findItem(1): - self.menubar.findItem(1).setText(self.__tr("&File")) - if self.menubar.findItem(2): - self.menubar.findItem(2).setText(self.__tr("&Help")) - - - def go(self): - print("MainWindow.go(): Not implemented yet") - - def newWindow(self): - print("MainWindow.newWindow(): Not implemented yet") - - def setProgress(self,a0,a1): - print("MainWindow.setProgress(int,int): Not implemented yet") - - def init(self): - pass - - def setTitle(self,a0): - print("MainWindow.setTitle(const TQString&): Not implemented yet") - - def setCommandState(self,a0,a1): - print("MainWindow.setCommandState(int,bool): Not implemented yet") - - def navigateComplete(self): - print("MainWindow.navigateComplete(): Not implemented yet") - - def navigateBegin(self): - print("MainWindow.navigateBegin(): Not implemented yet") - - def aboutSlot(self): - print("MainWindow.aboutSlot(): Not implemented yet") - - def aboutTQtSlot(self): - print("MainWindow.aboutTQtSlot(): Not implemented yet") - - def __tr(self,s,c = None): - return tqApp.translate("MainWindow",s,c) diff --git a/examples3/webbrowser/mainwindow.ui b/examples3/webbrowser/mainwindow.ui deleted file mode 100644 index 446a717..0000000 --- a/examples3/webbrowser/mainwindow.ui +++ /dev/null @@ -1,410 +0,0 @@ - -MainWindow - - - MainWindow - - - - 0 - 0 - 812 - 605 - - - - TQt WebBrowser - - - - unnamed - - - 0 - - - 6 - - - - Frame3 - - - StyledPanel - - - Sunken - - - - unnamed - - - 1 - - - 0 - - - - WebBrowser - - - StrongFocus - - - {8856F961-340A-11D0-A96B-00C04FD705A2} - - - - - - - - - menubar - - - - - - - - - - - - - - - - - - Toolbar - - - Toolbar - - - - - - - - - - - - Toolbar_2 - - - true - - - Toolbar_2 - - - - lblAddress - - - Address - - - - - addressEdit - - - - - - - - - - - actionGo - - - image0 - - - Go - - - - - actionBack - - - image1 - - - Back - - - Backspace - - - - - actionForward - - - image2 - - - Forward - - - - - actionStop - - - image3 - - - Stop - - - - - actionRefresh - - - image4 - - - Refresh - - - - - actionHome - - - image5 - - - Home - - - - - actionFileClose - - - Close - - - C&lose - - - - - FileNewGroup - - - New - - - true - - - - actionNewWindow - - - Window - - - Ctrl+N - - - - - - actionSearch - - - image6 - - - Search - - - - - actionAbout - - - About - - - - - actionAboutTQt - - - About TQt - - - - - - 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232365200210543251d2e253d856405bffcbc54103b11c8563600020b03105719c4b530b08072f50880513560a09c080338d5209420294a4451a38c90426621ab5146d10de524a2aa417505445122861a547722bb0c971a3d2aa921c2ae446c6a9431fc85a9064551220e354009653dec00294e712a1ac4e97078a9a9b5e6020013b3f563 - - - 789ce596497332470c86effe15947573a5f4c1cc30cc542a07ef60bc808dd7540e3d9b6df006186c93ca7f8fba2535ce57be98dc9292313c487a2575f7ccf063a376d53baa6dfc589bbe9ad7fbbc96df99496da3983d3e7efcfec76f7faead87418dfe1a51500bd67f595befbfd6f2daf1f35369014e08a05e6fd4ab96e31e73d0282bc7a7cae23ff3ccfe8170ca6cee9843f51f3b4ec8cff9efccdebf2d2cf9b06bb9417a25c74f98bdff99390a84fb8e49af70f39891b2e40bfbf8b6b0917e87968346a8f5a6cc51c07ab02f2cf1983237552f709c86691e3bbd5be5821998a32067bd1765d13f67563d530a4b3df8b01c523d8ec74059faed086bfc82390e851b8ed3c86485e34365a9bfc5ece3df8433e10bcb5140f5dd3cf0e099f32f99e350cecb5858f2b1c1dc52fda663d334a277c0ecfd5d61c9373973120967969b548fd71b079e797d8e985b21eb63aecceb85e7c299f4ffaa2ce7739359ebc195631387c6ad1f5e302791ccbba72cf173e15cfa2d2cc7619cf1fa63c9dccaa4ff4bcfdc7fa82cfdf7999348f6bf299c4bfd4c59ea0f99535dafca71d60a65ffebca52ff8c3989e47cce98351fb785759e7bcbad65bf0be624ca9a8e87caac0fb1702ef191b2cc9731a7b9ec4f87d934659e27e142f8c671e6eb9d0ae7b2be07cc6924ccf999698a7e4f58f572e64cebb9f393444994e68e4365d9ff7be15caef70766ad678cb0f8f18359ebe109b3af27f199fadd794cf254eb196599774758e77d5496f5dd64a67959af122ef87c639b59eb81d34ba97fe3f4215196f3922acbbc28acf527cc792c7a857029ecf63bcded05efb8a52cf3cc9833ed2f66563dac0b8b1ebe3317ea77f73352173db8f6ccf54a66df0f30fb7c777d9bc214d2cf88d9cf73cfece3ddf3296b66da7fe199d7a32b5cc8feef31fbfe8f99bdde96b0faddf3272bac390665b99e90d9e7ef33972de9d73d7ff3d873255c49fc1b73257ee4f8d2eb5d336b3e8e8535ff86d9e7bbf35f2cf51366ef77cfeb6299df62563f3c0a8b1fdcf3d3569778773f756e66f7fcac967e175f797ffff5dfd9ff4103010d6698a35955030b2cb1c25bbcc3fbd5344861882352b8c5077c5c45836678c267ca7fc1314ebeaf81537cc599eb608e6ff88e1f2b682c705314b6486182dbb8f31d0ddca529f644619ff2db641d3cf82a8bfa9d62d7da670d3cc4233c760a63eaa08d2734478fac8f87ffc833788a6738c073bc20ebe3255eb1069d863e5e3b851bacfb7c6b0d0c30c488f24a3a2d4ddaf1986a3d600b13179be280ef597809e876e206000c69d8ec0e590f32c8a18012b7a0825b9799e018eee0de4e0b4318c103ff2ea2985b78c47d28a487ce276b634cca40356d1655801c3bf044af2136e0195ef8b711be4045ab50ff42e16bdbb6463d8e610253fe3d4855ec3ed80abd9f62397ef9c9e6cee835249bc31bbc731ff0010beacbcdbfaca29f2836a3e839fd1f3acb5cb6fd6e13b6605b34766097d6664cdf0d7faad9813dd827df08daf4de812ddaa7061c4017baf43ea6daef70c8fb0247704c932dc897b94e67da09553a811ef4a94a0f4ee10c069435216b630ae7a43b800b7fc6164ea543ea73ea75663b22a50e5cc215ec50956beaf606ead08080147b64c76403d20ebdc6142268528d3655ee3a1db6f88b535ee015b42081d4205ee1f4f335878501ea7644331dc81acecdb7ef63b86b32eae59956cff63237f92af7319c9a82669c989256bd0b6fa6fabe86bbfe0ecdadb9a399ce61b49a86355adfbedd45736756bc27b30afd161a9a9179585de33bf69fd2f8ebd7b5bf014644b906 - - - 789ce5965b4f23471085dff915d6d6db2aaac5e3b92aca037703cbc55c8c21ca43cf8c8d0dd85c6c307694ff9eeaaed3bd68771f968d14298a0a109fabebd4e99a9ef17cfad8e81d1f343e7e5a99cecc6c5435aaa1796a7cac9fc7e3c5ef7ffcf6e7ca8756d4909f661c35a20fbfac7ce8cc1a55e3f07ed2b7409702b4badaccfb996563020f5c7ecbf340b9a31c3591dff7ac7943e002cc8e73cf74acdcc27a8a2d37a5be4e1d9f04567f9fc105f25dcfea9726caad62a07c1158f58f94e3087e868ea57fa5fa0be590bfb11c3525affd4e03ebfa25b8507fbcaa1c47ca66e459fdf10c6c30af4dcfda8f5f9513dfffce71e1f5a956967adddfaeb25f4f7b60e8d199e596f42f6bc787ca213f554e5be06dc7a28ffdee282791cedb5c83d19fd795a55ecf4b3fb0ee07ebd312fae796e3283665e238524e2265de031bcc774d396d61be25b8c4fe1f02abfeab67f49f2867decfbd6393b6a03f03438f3bca19fa51cb33fc6f80fd7eae2c27e257e7cb4de5b4045f78d679f24960ddcfb172e6f73357ce63e88fc115ce43e558fcabbeb905fb7e47cae24ff5daca41af007bbd81e5b425f53aff6160d52f95f318f37d01a39ee7ca05f4790a469e0e1c97590bfa1b81f53c3e2bfbf5ecf697b532efe754398f31af437085eb65948b18e723f70cbf9e2bcc633db0f65b533609fcbafb372bf318fdcfc015e65b281731ee0ff6acf70767ca5e8f7be01abcab5cfa7e89e53cce2ba3fd1681b5df8172013f44e00acfbf4a39e8ef287b7dbe02234feefce795d727a36c12ccf75239d4b7c1bede9def42fcc0ef7960d5cbc05ebf543635aed752b94aa1ff02ee83ddf3b6a87c3d3f2b9b047a4fcaa17e0cf6f5eef928ab13f5476960d5eb7ac6f5dd07d7e04839e83d29d7be9ffbfe31b50dc723cfa87f08acf947e51a7ad457ee6760773ecaa4f47e36036bfd96673c3fb6c13578a01cf41f9505d5af3b2f655dc28fa93da33e550ef523e5e06f08861eb9e7b94cdfe7ddf753d50feb6f94437e00f67edcf3aa4e831ed8afe73bb05fefe655f7c37edcfd62bb81ddfb82935776cfeb41c87766ff2cfe7f1a4c6cb8e48ae91f68d4dce7015ff390473fad71c3b77cc7639ef03d3ffcb48f013ff293a84c79c6d54f693c8bc28b28589539bff2e2ed647e586389184bacf13a6ff0e6d71a32f92dde96bfdf9dbccc6387dba2d086caae4c668ff7bf68f0673ee0433ee263eef0099ff2199f8b62d0e32e5f704fea2fe5b70d3f57729556b91b349a1c718b634e64faa9fc7fc919e772220a91213254ca273b884bf72b4a54f1846ad925e93b1af56940d734a4110fe4efb5c40dddda907311734c7752d10b3a1ae289c634a17b7dafe331e995b3b124fbdfd25d85471763596fab7aa2a4f53d444653ded3773bb96e8faeae1de2ea8dff9da0b0ebfcd858e3357aa667bb1f68b4a5e7d256853559e8f56d64aefe85e6f44a0b5aea3bac5c2bebf74b8775fb6bfbb858771e7a6f1df09c36f89a36698bb6f53d5c4ef08ee4e6a2dd269b9d488729ed4a171b7bd40ece3228cce5d305edd3673ed7773139bd133a14d5233a96cff7a9237142a77446e7125dba900e70681564f5a6acdc1285ae9e0feaf150d675e8d2d59dd315ad52931fec2973d1a5489c6698e29c5a508829797bd629a52665bcf9fdd32ed95c1d50217b5c18b67390f34befb8e78873a9b6b39ad285216328a2de3bef5b32a59db5ccec42a6b565aaf7dffba6e663d3972b211ea86b065f3cbccbc7b53890399a21a55f677f5863e4f670c337df667f58e3d6dc99dbef3dd5ff6bdf73ff82c65fbfaefc0d4fb5b868 - - - 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232325500210543251d2e25658564056503300071f540dc3430007371012a492a830156496538c094848922c9c2259134c099304914e3604c8424aa5e6449b0044216ca824ba2da8b4512218b4d122e8b55520fee5974072164511da487ea490c7f22cba249e20d3efc018f3fcae0d2702eb5d2106992b5d65c00b9a48974 - - - 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232365200210543251d2e253d856405bffcbc54105b19c8563600020b03103711c4b530b08072f50880513524ab518681443435ca984ae08ae06a94114a10ac443435ca3043904d4c4453a38ca604ae11590d9a0ab80bd0d46078914c35c4d885a608871a547f61f81d5d117a1862018930e5b8d5c0950c741a1b1e6a6aadb90086a9d853 - - - 789ca5985973db480ec7dff3295cc15b6a0b2351a428d6d63ef83e255bbe647b6a1fd02465dd872d9f53f3dd076c005dc926ce6a32eed8553f37fadf7fa0c1a69cdfbe6cdc9cb537befcf6e97145ab61be910fe861e34bf1349dbefdfedffffcf1e97323dae07f51bdbe117dfed7a7cfddd546bed199cfca0ae888016afeab62e8796ef110ee545caf05be16ae5bfc6ee096e7b6e756983f51b6f53b81257ecfb8eee7e9b162f66af1c78125fe48987f23f3fb81657e691cd5bddecc7316d555efd058f7eb2867aa771058f4de8c55cffb6dd4a34cf5b68d357e681c6515634db81a7e3ef59c35cccf5560bf9ef6953389c77660af074f15c751e05c38a6d81f2ef9f3a848f4e9d658f2c36b635dbfa54cc2383556bd33e12492fc70df38f1f3f8ae4cc2745a711285fda7caa4f95e06967a2d8c63f27a8fc2a60fa4acfa980a371b898f0767dc6cf8fdbc9f84c27e4de124d2fabe186b3dee8c75ff1365dbef2db0ccef0987fd2f2a6632fd576552fd2b63d57b08ecd7d39d70b321fd0560acfb6d1a4b7e3050764de7d79f08a70de937ea7b7689e68f4de1e0776e2c7ab8abecb47eb170aa7ee822b0e89f1b4b7fd24dc529abe9794f02cbf99e2b3badc7a5b1ee97089b3e0e8d253f3c364e253e5576120ff7c63a9f7966d2e771d358e75bca4ef3bb0e2cf9758db5fe47c6b21eeb81bd3f07c2ad58ebd130d67e6a194b3cf97e62b2fa24c67a1f5d2aab3f8781a53e17c6eaa7082cfa3de156acf9d5034b7e3563f1eb96c6eaf7c0b815fbf8d2739e3aedefb1b1de9723618b77a49cebf946c6e20f5f8d251e753e8b5bb9e74c980a4afc7a7fbf66b1ed8fb7c67a9ec7c2ad5cfd74038bdfa6b1f6cbd458fd2e84b358efbb0363f5b71358fccd8c33596f9c4bfddcc458fac78d8cf5797b3296f5f82c4c49e6f5c9bf9fb23ce41307967e3935d6f36c0b67b1ce3f188b5f3757367f5363b98fdc38b0cc0f8cf5f90bf3ea97028bfe50981289777d63edcf81b1c4439897f3c52d615738cfe0df371c1deb7db265acf98d8d253f7a50d67a60c758cfcbf4cc7f2fb0f8bf1736bfae30d6f35f1a4b3ce6c6e2df95ca85f6f7dc58f3db0e5c783e14e6ebc533e87e963fbe0873f9fd3cc97c91693fd028b0d4e3c558f3eb0b9b5f972bab3fe78c353f3056bfabc0e2371636bfe4cf9b29d1e76b69acfdb863accfd33cb0dc2fa7c6e2179e03cb79ae940b7dffbf1b6bfd1363f53b12367f581a6b3d1bca56df6e60a9bfc6e765def4ecef6bc7eafaf9e8d558fbb7a15ce87d7263acf7ffbdb1e40f33e1e0cf29ebfea8eb6d7ff29f17f8f4137dfe51d8fa0117ca65ee3fbfe3bd705116b2de9f775e3af50313e1a229f1f0682cf1b052e6e1d9dfbf1cddd4fd2363cdcfef5fb05b7d1f0c944bed4f67ac9f5f27c265bf4c3d9f07eefb787f1f96695eaa1e0a174d7d7f81b1ee4f81a5fe75e552d9bf1fca7e617e9e8d556f33b0c4fbcf5ffdb44c956bc6a2d75dfd6c2020fd3ce2ff69a0c31c0b2cff91461fef71804374bfaa81231ce3044b9ce2ecd734380fc2392e70890ff888bfa6f184cff8c24e5ef10ddf71f3a37c3ed6c015afdec26dfeb983bbb887fb78f0f734380fe031c7437f3247788c27d8fe713e1f6a1076f014cfb08be7ac7481977885d75c951fe4f3630dcea3c3eb7b9cc70d6b9ce12d9fee26de610debeb69b0fb578cb89a0d8c399711e794609373d9c39455f2b53466d8c20c17809c45cc7a3c00f011081cffccff379fef35388f1d0428a0c401f459e58c3d45700f0003cee71d8678fc730d7430e2557d3c8331f7568c37308129cc7006733e9d262c6008cb6ff3f94ea3c72bc678ca3f1fb80a637884154c71c974c55d72c91a4feca4fdf553f8ad46554d8e9ee30a9eb1efab31611f2ff0ca346427bb9c11e114debe7e7ebed328318702e7f0ce9dbee47a1c724655b745b0c94ea6b0c55519f059b98f73d19a6cc30eecc21eecfb7100877004c770026de8e070bdfe805338832e9cc3055cc2955f7b0d3de8f0cfebb5356ee016eea0c6a30e11342086049a907aadcd35355a90111250f5e5288706bfdb4bea572a78b49e06ddd3a0d2807a2502110d6944639ad09466ebf9e8ae684e0bf5b1a4075ab28f11ffa1df678dc7f57cb0c68a9ee899355e7c2ddbf40a31bdb1c63bcdfe86c6803669cb9f4555c76b38a76dcee57d5d1f5c8f1d5af0b9745581bb029a5c8f3eedd21eed73b70ebe56fa91061dd061f05139e9d1116b1cfb9aee55c4fcf6330d5cd289d778a6b65fdd831dea702e256b9cf2b974a84367d4fd580347744e17744957acc13e7cfc095d538f356ed8cd2ddd518dea147da4c1956890ffcf295ed5e4c83b4a59f182b9455935e3b801ab791c7fa4e188d7a4bcbee66353feaef9df8852ca2f3e9ee3ef73840f359cabfec22979f4ddbd1bf018ba118f318f899bf298b9b95bb8e537cffe9ffffef4171c39a0bf - - - 789c8d96c9521c490c86ef3c458775734cc8ddd5b5c6c41c303b180cc60b66620eaacc2c9aa5599b7562de7da45fc5180c8e98fa39f091522e4a49c9bbb783bdedcdc1db77735733991d864198c8e5e06dbc9e4eeffffceb8fbfe7de64d9407f466531c8defc36f76667360883adb3d364c013051ae2039f8147266359068f4dc6740a2e4db05f05d726f0253898c017c6a3cc04ffafce79aa3af0143c36c17e055caa0aacbf06aeb2203e5f09ae4d185f75ce472de6e7737063c2fcb57356b702fed673e32c473d4bcf3760198f02e69325706b022f3a676df0f567e05035d1ed273dc79883e7c1d1045e70ae2456d84fd9738a589f0b703261bc72ae25e17ee4b0e7d8f3b5733374e603e32c37c11ff36970db12f193f7e07c1c6bec87c6e0c604ff0e1c4db03f36cec7e3a6f4fd2e38e779eee7bd05e7e350fa7e4fc0455ee6b84fb9eab913bfdf1c5ce5758efba54fffb1e75302d726f8af3817a5f8f922584cf06fc0211f951ebfd0b30afe07ce4510dfdf1e38e665e9f9f1e01c32cf1fda06a73c2f7c7eac5f8c8b61eef582f315b909dc82f1c17e07dc1459e5f1c77d953abb787e0ab832611cf957366dd9c707f556762a3fcf8673ddd6d8afdc1957b909fe98af2a65d4c787c08d09e3c8bfaad504f378de83a309e35fc049d9d747bda19c7dbe8f602d88d6fd11af3a33c1ffde398e02ec69178c0b04bb7fa12be03e08e7ab4b895e2f74ec1ca2e73f6d811b2d37df1feaa9969082f71ff4a73a98c01f9cdb3678fde27eea58f7f9cdc8bfba33c11efda2199ac01bcead048fd72678a4e9e3f6a86f6d172acc87fc69f290f9386f3d72f478a1bf348509fea8b7a66c9b80fec1a8b7a66a53f47cc2fe9b5ae77346fe35ad09e761703081d12f9b68c2fc57ce6d0c1e6fe463934ce0efc63234c11ffd5b4a13c66f9cb53d79fded832bcd27f47f5aeb59055e744eb1df3fe2251aeee4e7453f9264c27aa847b44f7f4f909fda3efb7ae30c5c84b65f1fef435b9a608ff7a4ad4c981ffb6b6b13d8fda5edfb37eff4dcb65e2f787f5a7cb0f7fd0413ecf13eb49d09f6783ff07cf97d8ec0a3f8d8df516f483faf07c45b1f27e9f30ff989e9fdbe11ff1034fd3c9eebe068c238fa9f6677f2fb27ac1f475dd3f97da25fc6c204be755673ef3f8db3360c1f1f824b13c651df2877c44fd0df511efe5ea39f44318151cf9a4e2ab0af870d63fee4dc55fdfe109f880ff3fb788a8ff98df733762630fa471aa6febda2839e5b3f0fe1bef4f18bc9fb01fa7dca4ce0bb9e5b671ef69c3cff18f99cc626d853cf551f3fe453ca531bbdde979cbb2c793e207f536102a39fa5ca0446bf4279f97b89feaabb5181511f38bedf2ffa47373461bdcfe0dc8471d46387860fc6fbaad155c11ef7a5d953747ede69cf2a30fe3fd06c5121fe88572726f8a37f68720ffbfdadf7ac02fb7e82098c7e85ebf2fde37dea92098cf7acc367bc33fbff7a6ecfc4c22d078eaac41d1ff0e4d7f66a7df84293e71ecfec858f9ee8d1fef8a9c733fb139ef2299ff1395ff0255fc167c233befee1f1cc3ef10ddff21ddff303cfabe77bd584177891971e3d7ed8db4e7b2df30aaff29a7aac3ff9ebe4a9bdf2067fe04ddee28ffafb36eff027de558fcfbaab2ffc95bf3db5578b3dfecefb3ce411673c56ceb9e0b23f47a5fbac7fb26f889988742f2a129e504b81a246e0c8ec293cb7a7441d0b1dd0840ee9883486744253bea4533a7bd5fe9c2ed4feb29fff4aff32a36b8dd5e92fe6bfa15bddcf1dddd303cd93c6911668aa2b5cbc363f3c16799f9630fbb2d20aadd21aadeb3d547a8617f6f0d8a00fb4495bfadb47daa61dfa84f977e933c597f64f6e6c9fbed057fa467bf49df669c8bb34a2eca53d8d35576ef88e722aa8a48a6a6a448320a20fd36bf3eb7f407c2c89efb5500f6422877224c77222533915e6b397fbd117f54ccee54275295732936bb9915bb9937b797869ff34e7649ecfe4bd2ce81a8bbc2a4bb2fc5a3dfe2c59915559fb75fdfe8f7affe7f7b97f011cdd9635 - - - - - actionHome - activated() - WebBrowser - GoHome() - - - actionRefresh - activated() - WebBrowser - Refresh() - - - actionStop - activated() - WebBrowser - Stop() - - - actionForward - activated() - WebBrowser - GoForward() - - - actionBack - activated() - WebBrowser - GoBack() - - - actionGo - activated() - MainWindow - go() - - - actionFileClose - activated() - MainWindow - close() - - - actionSearch - activated() - WebBrowser - GoSearch() - - - addressEdit - returnPressed() - MainWindow - go() - - - WebBrowser - NavigateComplete(const TQString&) - addressEdit - setText(const TQString&) - - - WebBrowser - TitleChange(const TQString&) - MainWindow - setTitle(const TQString&) - - - WebBrowser - NavigateComplete(const TQString&) - MainWindow - navigateComplete() - - - WebBrowser - CommandStateChange(int,bool) - MainWindow - setCommandState(int,bool) - - - WebBrowser - BeforeNavigate(const TQString&,int,const TQString&,const TQVariant&,const TQString&,bool&) - MainWindow - navigateBegin() - - - actionStop - activated() - MainWindow - navigateComplete() - - - actionNewWindow - activated() - MainWindow - newWindow() - - - actionAbout - activated() - MainWindow - aboutSlot() - - - actionAboutTQt - activated() - MainWindow - aboutTQtSlot() - - - - class TQProgressBar - - - TQProgressBar *pb; - - - go() - newWindow() - setProgress( int a, int b ) - init() - setTitle( const TQString & title ) - setCommandState( int cmd, bool on ) - navigateComplete() - navigateBegin() - aboutSlot() - aboutTQtSlot() - - - - qaxwidget.h - - diff --git a/examples3/webbrowser/webbrowser.py b/examples3/webbrowser/webbrowser.py deleted file mode 100644 index 12f6f1c..0000000 --- a/examples3/webbrowser/webbrowser.py +++ /dev/null @@ -1,91 +0,0 @@ -# Copyright (C) 2001-2002 Trolltech AS. All rights reserved. -# Copyright (C) 2004 Riverbank Computing Ltd. All rights reserved. -# -# This file is part of an example program for the ActiveTQt integration. -# This example program may be used, distributed and modified without -# limitation. - - -import sys -from python_tqt import qt -from python_tqt import qtaxcontainer - -import mainwindow - - -class MainWindowImpl(mainwindow.MainWindow): - def init(self): - self.pb = qt.TQProgressBar(self.statusBar()) - self.pb.setPercentageVisible(False) - self.pb.hide() - self.statusBar().addWidget(self.pb, 0, True) - - self.connect(self.WebBrowser, qt.SIGNAL("ProgressChange(int,int)"), self.setProgress) - self.connect(self.WebBrowser, qt.SIGNAL("StatusTextChange(const TQString&)"), self.statusBar(), qt.SLOT("message(const TQString&)")) - - self.WebBrowser.dynamicCall("GoHome()"); - - self.subwindows = [] - - def go(self): - self.actionStop.setEnabled(True) - self.WebBrowser.dynamicCall("Navigate(const TQString&)", qt.TQVariant(self.addressEdit.text())) - - def setTitle(self, title): - self.setCaption("TQt WebBrowser - " + title.latin1()) - - def setProgress(self, a, b): - if a <= 0 or b <= 0: - self.pb.hide() - return - - self.pb.show() - self.pb.setTotalSteps(b) - self.pb.setProgress(a) - - def setCommandState(self, cmd, on): - if cmd == 1: - self.actionForward.setEnabled(on) - elif cmd == 2: - self.actionBack.setEnabled(on) - - def navigateBegin(self): - self.actionStop.setEnabled(True) - - def navigateComplete(self): - self.actionStop.setEnabled(False) - - def newWindow(self): - window = MainWindowImpl() - window.show() - - if self.addressEdit.text().isEmpty(): - return - - window.addressEdit.setText(self.addressEdit.text()) - window.actionStop.setEnabled(True) - window.go() - - self.subwindows += window - - def aboutSlot(self): - qt.TQMessageBox.about(self, self.tr("About WebBrowser"), self.tr( -"""This Example has been created using the ActiveTQt integration into TQt Designer. -It demonstrates the use of TQAxWidget to embed the Internet Explorer ActiveX -control into a TQt application.""")) - - def aboutTQtSlot(self): - qt.TQMessageBox.aboutTQt(self, self.tr("About TQt")) - - -def main(args): - a = qt.TQApplication(args) - w = MainWindowImpl() - a.setMainWidget(w) - w.show() - - return a.exec_loop() - - -if __name__ == "__main__": - sys.exit(main(sys.argv)) diff --git a/examples3/widgets.py b/examples3/widgets.py deleted file mode 100755 index fe36049..0000000 --- a/examples3/widgets.py +++ /dev/null @@ -1,500 +0,0 @@ -#!/usr/bin/env python - - -import sys, string -from python_tqt.qt import * - -# -## Constructs an analog clock widget that uses an internal TQTimer. -# -def TQMIN( x, y ): - if y > x: - return y - return x - -# -## Constructs an analog clock widget that uses an internal TQTimer. -# - -class AnalogClock( TQWidget ): - def __init__( self, *args ): - TQWidget.__init__(*(self,) + args) - self.time = TQTime.currentTime() # get current time - internalTimer = TQTimer( self ) # create internal timer - self.connect( internalTimer, SIGNAL("timeout()"), self.timeout ) - internalTimer.start( 5000 ) # emit signal every 5 seconds - -# -## The TQTimer::timeout() signal is received by this slot. -# - - def timeout( self ): - new_time = TQTime.currentTime() # get the current time - if new_time.minute() != self.time.minute(): # minute has changed - self.update() - -# -## The clock is painted using a 1000x1000 square coordinate system. -# - def paintEvent( self, qe ): # paint clock - if not self.isVisible(): # is is invisible - return - self.time = TQTime.currentTime() # save current time - - pts = TQPointArray() - paint = TQPainter( self ) - paint.setBrush( self.foregroundColor() ) # fill with foreground color - - cp = TQPoint( self.rect().center() ) # widget center point - d = TQMIN( self.width(), self.height() ) # we want a circular clock - - matrix = TQWMatrix() # setup transformation matrix - matrix.translate( cp.x(), cp.y() ) # origin at widget center - matrix.scale( d / 1000.0, d / 1000.0 ) # scale coordinate system - - h_angle = 30 * ( self.time.hour() % 12 - 3 ) + self.time.minute() / 2 - matrix.rotate( h_angle ) # rotate to draw hour hand - paint.setWorldMatrix( matrix ) - pts.setPoints( [ -20,0, 0,-20, 300,0, 0,20 ] ) - paint.drawPolygon( pts ) # draw hour hand - matrix.rotate( -h_angle ) # rotate back to zero - - m_angle = ( self.time.minute() - 15 ) * 6 - matrix.rotate( m_angle ) # rotate to draw minute hand - paint.setWorldMatrix( matrix ) - pts.setPoints( [ -10,0, 0,-10, 400,0, 0,10 ] ) - paint.drawPolygon( pts ) # draw minute hand - matrix.rotate( -m_angle ) # rotate back to zero - - for i in range( 0, 12 ): # draw hour lines - paint.setWorldMatrix( matrix ) - paint.drawLine( 450,0, 500,0 ) - matrix.rotate( 30 ) - - -class DigitalClock( TQLCDNumber ): - def __init__( self, *args ): - TQLCDNumber.__init__(*(self,) + args) - self.showingColon = 0 - self.setFrameStyle(TQFrame.Panel | TQFrame.Raised) - self.setLineWidth( 2 ) - self.showTime() - self.normalTimer = self.startTimer( 500 ) - self.showDateTimer = -1 - - def timerEvent( self, e ): - if e.timerId() == self.showDateTimer: - self.stopDate() - else: - if self.showDateTimer == -1: - self.showTime() - - def mousePressEvent( self, e ): - if e.button() == TQt.LeftButton: - self.showDate() - - def showDate( self ): - if self.showDateTimer != -1: - return - d = TQDate.currentDate() - self.display('%2d %2d' % (d.month(), d.day())) - self.showDateTimer = self.startTimer(2000) - - def stopDate( self ): - self.killTimer(self.showDateTimer) - self.showDateTimer = -1 - self.showTime() - - def showTime( self ): - self.showingColon = not self.showingColon - s = list(str(TQTime.currentTime().toString())[:5]) #.left(5) - if not self.showingColon: - s[2] = ' ' - if s[0] == '0': - s[0] = ' ' - s = ''.join(s) - self.display( s ) - - def TQMIN( x, y ): - if y > x: - return y - return x - -TRUE = 1 -FALSE = 0 -MOVIEFILENAME = "trolltech.gif" - -# -# WidgetView contains lots of TQt widgets. -# - -class WidgetView ( TQWidget ): - def __init__( self, *args ): - TQWidget.__init__(*(self,) + args) - - # Set the window caption/title - self.setCaption( "TQt Widgets Demo Application" ) - - # Install an application-global event filter - tqApp.installEventFilter( self ) - - # Create a layout to position the widgets - self.topLayout = TQVBoxLayout( self, 10 ) - - # Create a grid layout to hold most of the widgets - self.grid = TQGridLayout( 6, 3 ) - - # This layout will get all of the stretch - self.topLayout.addLayout( self.grid, 10 ) - - # Create a menubar - self.menubar = TQMenuBar( self ) - self.menubar.setSeparator( TQMenuBar.InWindowsStyle ) - - # Create an easter egg - TQToolTip.add( self.menubar, TQRect( 0, 0, 2, 2 ), "easter egg" ) - - self.popup = TQPopupMenu() - self.id = self.popup.insertItem( "&New" ) - self.popup.setItemEnabled( self.id, FALSE ) - self.id = self.popup.insertItem( "&Open" ) - self.popup.setItemEnabled( self.id, FALSE ) - self.popup.insertSeparator() - self.popup.insertItem( "&Quit", tqApp, SLOT("quit()"), TQt.CTRL+TQt.Key_Q ) - - self.menubar.insertItem( "&File", self.popup ) - - # Must tell the layout about a menubar in a widget - self.topLayout.setMenuBar( self.menubar ) - - # Create an analog and a digital clock - self.aclock = AnalogClock( self ) - self.aclock.resize( 50, 50 ) - self.dclock = DigitalClock( self ) - self.dclock.setMaximumWidth( 200 ) - self.grid.addWidget( self.aclock, 0, 2 ) - self.grid.addWidget( self.dclock, 1, 2 ) - - # Give the dclock widget a blue palette - col = TQColor() - col.setRgb( 0xaa, 0xbe, 0xff ) - self.dclock.setPalette( TQPalette( col ) ) - - # make tool tips for both of them - TQToolTip.add( self.aclock, "custom widget: analog clock" ) - TQToolTip.add( self.dclock, "custom widget: digital clock" ) - - # Create a push button. - self.pb = TQPushButton( self, "button1" ) # create button 1 - self.pb.setText( "Push button 1" ) - self.pb.setFixedHeight( self.pb.sizeHint().height() ) - self.grid.addWidget( self.pb, 0, 0, TQt.AlignVCenter ) - self.connect( self.pb, SIGNAL("clicked()"), self.button1Clicked ) - TQToolTip.add( self.pb, "push button 1" ) - self.pm = TQPixmap() - self.pix = self.pm.load( "qt.png" ) # load pixmap for button 2 - if not self.pix: - TQMessageBox.information( None, "TQt Widgets Example", - "Could not load the file \"qt.png\", which\n" - "contains an icon used...\n\n" - "The text \"line 42\" will be substituted.", - TQMessageBox.Ok + TQMessageBox.Default ) - - # Create a label containing a TQMovie - self.movielabel = TQLabel( self, "label0" ) - self.movie = TQMovie( MOVIEFILENAME ) - self.movie.connectStatus( self.movieStatus ) - self.movie.connectUpdate( self.movieUpdate ) - self.movielabel.setFrameStyle( TQFrame.Box | TQFrame.Plain ) - self.movielabel.setMovie( self.movie ) - self.movielabel.setMargin( 0 ) - self.movielabel.setFixedSize( 128 + self.movielabel.frameWidth() * 2, - 64 + self.movielabel.frameWidth() * 2 ) - self.grid.addWidget( self.movielabel, 0, 1, TQt.AlignCenter ) - TQToolTip.add( self.movielabel, "movie" ) - - # Create a group of check boxes - self.bg = TQButtonGroup( self, "checkGroup" ) - self.bg.setTitle( "Check Boxes" ) - self.grid.addWidget( self.bg, 1, 0 ) - - # Create a layout for the check boxes - self.vbox = TQVBoxLayout(self.bg, 10) - - self.vbox.addSpacing( self.bg.fontMetrics().height() ) - - self.cb = list(range(3)) - self.cb[0] = TQCheckBox( self.bg ) - self.cb[0].setText( "Read" ) - self.vbox.addWidget( self.cb[0] ) - self.cb[0].setMinimumSize( self.cb[0].sizeHint() ) - self.cb[1] = TQCheckBox( self.bg ) - self.cb[1].setText( "Write" ) - self.vbox.addWidget( self.cb[1] ) - self.cb[1].setMinimumSize( self.cb[1].sizeHint() ) - self.cb[2] = TQCheckBox( self.bg ) - self.cb[2].setText( "Execute" ) - self.cb[2].setMinimumSize( self.cb[2].sizeHint() ) - self.vbox.addWidget( self.cb[2] ) - self.bg.setMinimumSize( self.bg.childrenRect().size() ) - self.vbox.activate() - - self.connect( self.bg, SIGNAL("clicked(int)"), self.checkBoxClicked ) - - TQToolTip.add( self.cb[0], "check box 1" ) - TQToolTip.add( self.cb[1], "check box 2" ) - TQToolTip.add( self.cb[2], "check box 3" ) - - # Create a group of radio buttons - self.bg = TQButtonGroup( self, "radioGroup" ) - self.bg.setTitle( "Radio buttons" ) - - self.grid.addWidget( self.bg, 1, 1 ) - - # Create a layout for the radio buttons - self.vbox = TQVBoxLayout( self.bg, 10 ) - - self.vbox.addSpacing( self.bg.fontMetrics().height() ) - self.rb = TQRadioButton( self.bg ) - self.rb.setText( "&AM" ) - self.rb.setChecked( TRUE ) - self.vbox.addWidget( self.rb ) - self.rb.setMinimumSize( self.rb.sizeHint() ) - TQToolTip.add( self.rb, "radio button 1" ) - self.rb = TQRadioButton( self.bg ) - self.rb.setText( "&FM" ) - self.vbox.addWidget( self.rb ) - self.rb.setMinimumSize( self.rb.sizeHint() ) - TQToolTip.add( self.rb, "radio button 2" ) - self.rb = TQRadioButton( self.bg ) - self.rb.setText( "&Short Wave" ) - self.vbox.addWidget( self.rb ) - self.rb.setMinimumSize( self.rb.sizeHint() ) - self.vbox.activate() - - self.connect( self.bg, SIGNAL("clicked(int)"), self.radioButtonClicked ) - TQToolTip.add( self.rb, "radio button 3" ) - - # Create a list box - self.lb = TQListBox( self, "listBox" ) - for i in range( 0, 100, 1 ): # fill list box - txt = TQString() - txt = "line %d" % i - if i == 42 and self.pix: - self.lb.insertItem( self.pm ) - else: - self.lb.insertItem( txt ) - - self.grid.addMultiCellWidget( self.lb, 2, 4, 0, 0 ) - self.connect( self.lb, SIGNAL("selected(int)"), self.listBoxItemSelected ) - TQToolTip.add( self.lb, "list box" ) - - self.vbox = TQVBoxLayout( 8 ) - self.grid.addLayout( self.vbox, 2, 1 ) - - # Create a slider - self.sb = TQSlider( 0, 300, 1, 100, TQSlider.Horizontal, self, "Slider" ) - self.sb.setTickmarks( TQSlider.Below ) - self.sb.setTickInterval( 10 ) - self.sb.setFocusPolicy( TQWidget.TabFocus ) - self.sb.setFixedHeight( self.sb.sizeHint().height() ) - self.vbox.addWidget( self.sb ) - - self.connect( self.sb, SIGNAL("valueChanged(int)"), self.sliderValueChanged ) - TQToolTip.add( self.sb, "slider" ) - - # Create a combo box - self.combo = TQComboBox( FALSE, self, "comboBox" ) - self.combo.insertItem( "darkBlue" ) - self.combo.insertItem( "darkRed" ) - self.combo.insertItem( "darkGreen" ) - self.combo.insertItem( "blue" ) - self.combo.insertItem( "red" ) - self.combo.setFixedHeight( self.combo.sizeHint().height() ) - self.vbox.addWidget( self.combo ) - self.connect( self.combo, SIGNAL("activated(int)"), self.comboBoxItemActivated ) - TQToolTip.add( self.combo, "read-only combo box" ) - - # Create an editable combo box - self.edCombo = TQComboBox( TRUE, self, "edComboBox" ) - self.edCombo.insertItem( "Permutable" ) - self.edCombo.insertItem( "Malleable" ) - self.edCombo.insertItem( "Adaptable" ) - self.edCombo.insertItem( "Alterable" ) - self.edCombo.insertItem( "Inconstant" ) - self.edCombo.setFixedHeight( self.edCombo.sizeHint().height() ) - self.vbox.addWidget( self.edCombo ) - self.connect( self.edCombo, SIGNAL("activated(const TQString &)"), self.edComboBoxItemActivated) - TQToolTip.add( self.edCombo, "editable combo box" ) - - self.edCombo.setAutoCompletion( TRUE ) - - self.vbox.addStretch( 1 ) - - self.vbox = TQVBoxLayout( 8 ) - self.grid.addLayout( self.vbox, 2, 2 ) - - # Create a spin box - self.spin = TQSpinBox( 0, 10, 1, self, "spin" ) - self.spin.setSuffix( " mm" ) - self.spin.setSpecialValueText( "Auto" ) - self.spin.setMinimumSize( self.spin.sizeHint() ) - self.connect( self.spin, SIGNAL( "valueChanged(const TQString &)" ), self.spinBoxValueChanged ) - TQToolTip.add( self.spin, "spin box" ) - self.vbox.addWidget( self.spin ) - - self.vbox.addStretch( 1 ) - - # Create a multi line edit - self.mle = TQMultiLineEdit( self, "multiLineEdit" ) - - self.grid.addMultiCellWidget( self.mle, 3, 3, 1, 2 ) - self.mle.setMinimumHeight( self.mle.fontMetrics().height() * 3 ) - self.mle.setText("This is a TQMultiLineEdit widget,\n" - "useful for small multi-line\n" - "input fields.") - TQToolTip.add( self.mle, "multi line editor" ) - - # Create a single line edit - self.le = TQLineEdit( self, "lineEdit" ) - self.grid.addMultiCellWidget( self.le, 4, 4, 1, 2 ) - self.le.setFixedHeight( self.le.sizeHint().height() ) - self.connect( self.le, SIGNAL("textChanged(const TQString &)"), self.lineEditTextChanged ) - TQToolTip.add( self.le, "single line editor" ) - - # Create a horizontal line (sort of TQFrame) above the message line - self.separator = TQFrame( self, "separatorLine" ) - self.separator.setFrameStyle( TQFrame.HLine | TQFrame.Sunken ) - self.separator.setFixedHeight( self.separator.sizeHint().height() ) - self.grid.addMultiCellWidget( self.separator, 5, 5, 0, 2 ) - TQToolTip.add( self.separator, "tool tips on a separator! wow!" ) - - self.grid.setRowStretch( 0, 0 ) - self.grid.setRowStretch( 1, 0 ) - self.grid.setRowStretch( 2, 0 ) - self.grid.setRowStretch( 3, 1 ) - self.grid.setRowStretch( 4, 1 ) - self.grid.setRowStretch( 5, 0 ) - - self.grid.setColStretch( 0, 1 ) - self.grid.setColStretch( 1, 1 ) - self.grid.setColStretch( 2, 1 ) - - # Create an label and a message in a plain widget - # The message is updated when buttons are clicked etc. - - self.hbox = TQHBoxLayout() - self.topLayout.addLayout( self.hbox ) - self.msgLabel = TQLabel( self, "msgLabel" ) - self.msgLabel.setText( "Message:" ) - self.msgLabel.setAlignment( TQt.AlignHCenter | TQt.AlignVCenter ) - self.msgLabel.setFixedSize( self.msgLabel.sizeHint() ) - self.hbox.addWidget( self.msgLabel ) - TQToolTip.add( self.msgLabel, "label 1" ) - - self.msg = TQLabel( self, "message" ) - self.msg.setFrameStyle( TQFrame.Panel | TQFrame.Sunken ) - self.msg.setAlignment( TQt.AlignCenter ) - self.msg.setFont( TQFont( "times", 12, TQFont.Bold ) ) - self.msg.setText( "Message" ) - self.msg.setFixedHeight( self.msg.sizeHint().height() ) - self.msg.setText( "" ) - self.hbox.addWidget( self.msg, 5 ) - TQToolTip.add( self.msg, "label 2" ) - - self.topLayout.activate() - - def setStatus(self, text): - self.msg.setText( text ) - - def movieUpdate( self, r ): - # Uncomment this to test animated icons on your window manager - self.setIcon( self.movie.framePixmap() ) - - def movieStatus( self, s ): - if s == TQMovie.SourceEmpty or s == TQMovie.UnrecognizedFormat: - pm = TQPixmap('tt-logo.png') - self.movielabel.setPixmap(pm) - self.movielabel.setFixedSize(pm.size()) - else: - if ( self.movielabel.movie() ): # for flicker-free animation: - self.movielabel.setBackgroundMode( TQWidget.NoBackground ) - - def button1Clicked( self ): - self.msg.setText( "The first push button was clicked" ) - - def checkBoxClicked( self, id ): - txt = "Check box %s clicked : " % str(id) - chk = ["-","-","-"] - if self.cb[0].isChecked(): - chk[0] = "r" - if self.cb[1].isChecked(): - chk[1] = "w" - if self.cb[2].isChecked(): - chk[2] = "x" - txt = txt + str(chk[0]+chk[1]+chk[2]) - self.msg.setText( txt ) - - def edComboBoxItemActivated( self, text): - self.msg.setText( "Editable Combo Box set to %s" % text ) - - def radioButtonClicked( self, id ): - self.msg.setText( "Radio button #%d clicked" % id ) - - def listBoxItemSelected( self, index ): - self.msg.setText( "List box item %d selected" % index ) - - def sliderValueChanged( self, value ): - self.msg.setText( "Movie set to %d%% of normal speed" % value ) - self.movie.setSpeed( value ) - - def comboBoxItemActivated( self, index ): - self.msg.setText( "Combo box item %d activated" % index ) - p = TQApplication.palette() - if index == 0: - p.setColor( TQColorGroup.Highlight, TQt.darkBlue ) - elif index == 1: - p.setColor( TQColorGroup.Highlight, TQt.darkRed ) - elif index == 2: - p.setColor( TQColorGroup.Highlight, TQt.darkGreen ) - elif index == 3: - p.setColor( TQColorGroup.Highlight, TQt.blue ) - elif index == 4: - p.setColor( TQColorGroup.Highlight, TQt.red ) - TQApplication.setPalette( p, TRUE ) - - def lineEditTextChanged( self, newText ): - self.msg.setText("Line edit text: " + str(newText)) - - def spinBoxValueChanged( self, valueText ): - self.msg.setText("Spin box value: " + str(valueText)) - - # All application events are passed throught this event filter. - # We're using it to display some information about a clicked - # widget (right mouse button + CTRL). - #def eventFilter( self, event ): - # identify_now = TRUE - # if event.type() == Event_MouseButtonPress and identify_now: - # e = TQMouseEvent( event ) - # if (e.button() == TQt.RightButton) and (e.state() & TQt.ControlButton) != 0: - # txt = TQString( "The clicked widget is a\n" ) - # txt = txt + TQObect.className() - # txt = txt + "\nThe widget's name is\n" - # if TQObject.name(): - # txt = txt + TQObject.name() - # else: - # txt = txt + "" - # identify_now = FALSE # don't do it in message box - # TQMessageBox.message( "Identify Widget", txt, 0, TQObject ) - # identify_now = TRUE; # allow it again - # return FALSE # don't eat event - -################################################################################################ - -#TQApplication.setColourSpec( TQApplication.CustomColor ) -a = TQApplication( sys.argv ) - -w = WidgetView() -a.setMainWidget( w ) -w.show() -a.exec_loop() diff --git a/pyuic2/COPYING b/pyuic2/COPYING deleted file mode 100644 index c7aea18..0000000 --- a/pyuic2/COPYING +++ /dev/null @@ -1,280 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 675 Mass Ave, Cambridge, MA 02139, USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS diff --git a/pyuic2/domtool.cpp b/pyuic2/domtool.cpp deleted file mode 100644 index 8a0cff2..0000000 --- a/pyuic2/domtool.cpp +++ /dev/null @@ -1,260 +0,0 @@ -/********************************************************************** -** Copyright (C) 2000 Trolltech AS. All rights reserved. -** Copyright (C) 2000, 2001 Phil Thompson -** -** This file is part of TQt Designer. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.trolltech.com/gpl/ for GPL licensing information. -** -** Contact info@trolltech.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - -#include "domtool.h" - -#include -#include -#include -#include -#include -#include - - -/*! - \class DomTool domtool.h - \brief Tools for the dom - - A collection of static functions used by Resource (part of the - designer) and Uic. - -*/ - - -/*! - Returns the contents of property \a name of object \a e as - variant or the variant passed as \a defValue if the property does - not exist. - - \sa hasProperty() - */ -TQVariant DomTool::readProperty( const TQDomElement& e, const TQString& name, const TQVariant& defValue ) -{ - TQDomElement n; - for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { - if ( n.tagName() == "property" ) { - TQDomElement n2 = n.firstChild().toElement(); - if ( n2.tagName() == "name" ) { - TQString prop = n2.firstChild().toText().data(); - if ( prop == name ) - return elementToVariant( n2.nextSibling().toElement(), defValue ); - } - } - } - return defValue; -} - -/*! - Returns wheter object \a e defines property \a name or not. - - \sa readProperty() - */ -bool DomTool::hasProperty( const TQDomElement& e, const TQString& name ) -{ - TQDomElement n; - for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { - if ( n.tagName() == "property" ) { - TQDomElement n2 = n.firstChild().toElement(); - if ( n2.tagName() == "name" ) { - TQString prop = n2.firstChild().toText().data(); - if ( prop == name ) - return TRUE; - } - } - } - return FALSE; -} - -TQVariant DomTool::elementToVariant( const TQDomElement& e, const TQVariant& defValue ) -{ - TQString dummy; - return elementToVariant( e, defValue, dummy ); -} - -/*! - Interprets element \a e as variant and returns the result of the interpretation. - */ -TQVariant DomTool::elementToVariant( const TQDomElement& e, const TQVariant& defValue, TQString &comment ) -{ - TQVariant v; - if ( e.tagName() == "rect" ) { - TQDomElement n3 = e.firstChild().toElement(); - int x = 0, y = 0, w = 0, h = 0; - while ( !n3.isNull() ) { - if ( n3.tagName() == "x" ) - x = n3.firstChild().toText().data().toInt(); - else if ( n3.tagName() == "y" ) - y = n3.firstChild().toText().data().toInt(); - else if ( n3.tagName() == "width" ) - w = n3.firstChild().toText().data().toInt(); - else if ( n3.tagName() == "height" ) - h = n3.firstChild().toText().data().toInt(); - n3 = n3.nextSibling().toElement(); - } - v = TQVariant( TQRect( x, y, w, h ) ); - } else if ( e.tagName() == "point" ) { - TQDomElement n3 = e.firstChild().toElement(); - int x = 0, y = 0; - while ( !n3.isNull() ) { - if ( n3.tagName() == "x" ) - x = n3.firstChild().toText().data().toInt(); - else if ( n3.tagName() == "y" ) - y = n3.firstChild().toText().data().toInt(); - n3 = n3.nextSibling().toElement(); - } - v = TQVariant( TQPoint( x, y ) ); - } else if ( e.tagName() == "size" ) { - TQDomElement n3 = e.firstChild().toElement(); - int w = 0, h = 0; - while ( !n3.isNull() ) { - if ( n3.tagName() == "width" ) - w = n3.firstChild().toText().data().toInt(); - else if ( n3.tagName() == "height" ) - h = n3.firstChild().toText().data().toInt(); - n3 = n3.nextSibling().toElement(); - } - v = TQVariant( TQSize( w, h ) ); - } else if ( e.tagName() == "color" ) { - v = TQVariant( readColor( e ) ); - } else if ( e.tagName() == "font" ) { - TQDomElement n3 = e.firstChild().toElement(); - TQFont f( defValue.toFont() ); - while ( !n3.isNull() ) { - if ( n3.tagName() == "family" ) - f.setFamily( n3.firstChild().toText().data() ); - else if ( n3.tagName() == "pointsize" ) - f.setPointSize( n3.firstChild().toText().data().toInt() ); - else if ( n3.tagName() == "bold" ) - f.setBold( n3.firstChild().toText().data().toInt() ); - else if ( n3.tagName() == "italic" ) - f.setItalic( n3.firstChild().toText().data().toInt() ); - else if ( n3.tagName() == "underline" ) - f.setUnderline( n3.firstChild().toText().data().toInt() ); - else if ( n3.tagName() == "strikeout" ) - f.setStrikeOut( n3.firstChild().toText().data().toInt() ); - n3 = n3.nextSibling().toElement(); - } - v = TQVariant( f ); - } else if ( e.tagName() == "string" ) { - v = TQVariant( e.firstChild().toText().data() ); - TQDomElement n = e; - n = n.nextSibling().toElement(); - if ( n.tagName() == "comment" ) - comment = n.firstChild().toText().data(); - } else if ( e.tagName() == "cstring" ) { - v = TQVariant( TQCString( e.firstChild().toText().data() ) ); - } else if ( e.tagName() == "number" ) { - v = TQVariant( e.firstChild().toText().data().toInt() ); - } else if ( e.tagName() == "bool" ) { - TQString t = e.firstChild().toText().data(); - v = TQVariant( t == "true" || t == "1" ); - } else if ( e.tagName() == "pixmap" ) { - v = TQVariant( e.firstChild().toText().data() ); - } else if ( e.tagName() == "iconset" ) { - v = TQVariant( e.firstChild().toText().data() ); - } else if ( e.tagName() == "image" ) { - v = TQVariant( e.firstChild().toText().data() ); - } else if ( e.tagName() == "enum" ) { - v = TQVariant( e.firstChild().toText().data() ); - } else if ( e.tagName() == "set" ) { - v = TQVariant( e.firstChild().toText().data() ); - } else if ( e.tagName() == "sizepolicy" ) { - TQDomElement n3 = e.firstChild().toElement(); - TQSizePolicy sp; - while ( !n3.isNull() ) { - if ( n3.tagName() == "hsizetype" ) - sp.setHorData( (TQSizePolicy::SizeType)n3.firstChild().toText().data().toInt() ); - else if ( n3.tagName() == "vsizetype" ) - sp.setVerData( (TQSizePolicy::SizeType)n3.firstChild().toText().data().toInt() ); - n3 = n3.nextSibling().toElement(); - } - v = TQVariant( sp ); - } else if ( e.tagName() == "cursor" ) { - v = TQVariant( TQCursor( e.firstChild().toText().data().toInt() ) ); - } - - return v; -} - - -/*! Returns the color which is returned in the dom element \a e. - */ - -TQColor DomTool::readColor( const TQDomElement &e ) -{ - TQDomElement n = e.firstChild().toElement(); - int r= 0, g = 0, b = 0; - while ( !n.isNull() ) { - if ( n.tagName() == "red" ) - r = n.firstChild().toText().data().toInt(); - else if ( n.tagName() == "green" ) - g = n.firstChild().toText().data().toInt(); - else if ( n.tagName() == "blue" ) - b = n.firstChild().toText().data().toInt(); - n = n.nextSibling().toElement(); - } - - return TQColor( r, g, b ); -} - -/*! - Returns the contents of attribute \a name of object \a e as - variant or the variant passed as \a defValue if the attribute does - not exist. - - \sa hasAttribute() - */ -TQVariant DomTool::readAttribute( const TQDomElement& e, const TQString& name, const TQVariant& defValue ) -{ - TQDomElement n; - for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { - if ( n.tagName() == "attribute" ) { - TQDomElement n2 = n.firstChild().toElement(); - if ( n2.tagName() == "name" ) { - TQString prop = n2.firstChild().toText().data(); - if ( prop == name ) - return elementToVariant( n2.nextSibling().toElement(), defValue ); - } - } - } - return defValue; -} - -/*! - Returns wheter object \a e defines attribute \a name or not. - - \sa readAttribute() - */ -bool DomTool::hasAttribute( const TQDomElement& e, const TQString& name ) -{ - TQDomElement n; - for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { - if ( n.tagName() == "attribute" ) { - TQDomElement n2 = n.firstChild().toElement(); - if ( n2.tagName() == "name" ) { - TQString prop = n2.firstChild().toText().data(); - if ( prop == name ) - return TRUE; - } - } - } - return FALSE; -} diff --git a/pyuic2/domtool.h b/pyuic2/domtool.h deleted file mode 100644 index b3f833c..0000000 --- a/pyuic2/domtool.h +++ /dev/null @@ -1,41 +0,0 @@ -/********************************************************************** -** Copyright (C) 2000 Troll Tech AS. All rights reserved. -** Copyright (C) 2000, 2001 Phil Thompson -** -** This file is part of TQt GUI Designer. -** -** This file may be distributed under the terms of the GNU General -** Public License version 2 as published by the Free Software -** Foundation and appearing in the file COPYING included in the -** packaging of this file. If you did not get the file, send email -** to info@trolltech.com -** -** The file is provided AS IS with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. -** -**********************************************************************/ - -#ifndef DOMTOOL_H -#define DOMTOOL_H - -#include -#include -#include - - -class DomTool : public TQt -{ -public: - static TQVariant readProperty( const TQDomElement& e, const TQString& name, const TQVariant& defValue ); - static bool hasProperty( const TQDomElement& e, const TQString& name ); - static TQVariant elementToVariant( const TQDomElement& e, const TQVariant& defValue ); - static TQVariant elementToVariant( const TQDomElement& e, const TQVariant& defValue, TQString &comment ); - static TQVariant readAttribute( const TQDomElement& e, const TQString& name, const TQVariant& defValue ); - static bool hasAttribute( const TQDomElement& e, const TQString& name ); - static TQColor readColor( const TQDomElement &e ); - -}; - - -#endif // DOMTOOL_H diff --git a/pyuic2/globaldefs.h b/pyuic2/globaldefs.h deleted file mode 100644 index a5fa077..0000000 --- a/pyuic2/globaldefs.h +++ /dev/null @@ -1,33 +0,0 @@ -/********************************************************************** -** Copyright (C) 2000 Trolltech AS. All rights reserved. -** -** This file is part of TQt Designer. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.trolltech.com/gpl/ for GPL licensing information. -** -** Contact info@trolltech.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - -#ifndef GLOBALDEFS_H -#define GLOBALDEFS_H - -#include - -#define BOXLAYOUT_DEFAULT_MARGIN 11 -#define BOXLAYOUT_DEFAULT_SPACING 6 - -static TQColor backColor1( 226, 244, 216 ); -static TQColor backColor2( 235, 235, 235 ); -static TQColor selectedBack( 192, 192, 192 ); - -#endif diff --git a/pyuic2/pyuic.pro.in b/pyuic2/pyuic.pro.in deleted file mode 100644 index beeea65..0000000 --- a/pyuic2/pyuic.pro.in +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (c) 2000, 2001 -# Phil Thompson -# Copyright (c) 2002, 2003 -# Riverbank Computing Limited -# -# The project file for pyuic for TQt v2. - - -TEMPLATE = app -CONFIG = qt console warn_on release -INCLUDEPATH = @BLX_INCLUDEPATH@ $(TQTDIR)/src/3rdparty/zlib -DEFINES = UIC @BLX_DEFINES@ - -DESTDIR = @PYQT_BINDIR@ -TARGET = pyuic - -HEADERS = domtool.h \ - globaldefs.h \ - uic.h \ - widgetdatabase.h - -SOURCES = domtool.cpp \ - uic.cpp \ - widgetdatabase.cpp diff --git a/pyuic2/pyuic.sbf b/pyuic2/pyuic.sbf deleted file mode 100644 index 9f1e8ef..0000000 --- a/pyuic2/pyuic.sbf +++ /dev/null @@ -1,24 +0,0 @@ -# This is the build file for pyuic for TQt v2. -# -# Copyright (c) 2007 -# Riverbank Computing Limited -# -# This file is part of PyTQt. -# -# This copy of PyTQt is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the Free -# Software Foundation; either version 2, or (at your option) any later -# version. -# -# PyTQt is supplied in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# PyTQt; see the file LICENSE. If not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -target = pyuic -sources = uic.cpp widgetdatabase.cpp domtool.cpp -headers = uic.h widgetdatabase.h domtool.h globaldefs.h diff --git a/pyuic2/uic.cpp b/pyuic2/uic.cpp deleted file mode 100644 index 045609d..0000000 --- a/pyuic2/uic.cpp +++ /dev/null @@ -1,1600 +0,0 @@ -// Copyright (c) 2000 - 2001 Phil Thompson - -/********************************************************************** -** Copyright (C) 2000 Troll Tech AS. All rights reserved. -** -** This file is part of TQt GUI Designer. -** -** This file may be distributed under the terms of the GNU General -** Public License version 2 as published by the Free Software -** Foundation and appearing in the file COPYING included in the -** packaging of this file. If you did not get the file, send email -** to info@trolltech.com -** -** The file is provided AS IS with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. -** -**********************************************************************/ - -#include "uic.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static TQString mkBool( bool b ) -{ - return b? "1" : "0"; -} - -static TQString mkBool( const TQString& s ) -{ - return mkBool( s == "true" || s == "1" ); -} - -static bool toBool( const TQString& s ) -{ - return s == "true" || s.toInt() != 0; -} - - -// fixString is only used in conjunction with tr(). We need to write out the -// string in utf8 and make sure it's converted from utf8 when created. -static TQString fixString( const TQString &str ) -{ - TQString s( str ); - s.replace( TQRegExp( "\\\\" ), "\\\\" ); - s.replace( TQRegExp( "\"" ), "\\\"" ); - s.replace( TQRegExp( "\n" ), "\\n\"\n\"" ); - s.replace( TQRegExp( "\r" ), "\\r" ); - - bool onlyAscii = TRUE; - unsigned int i; - for ( i = 0; i < s.length(); i++ ) { - if ( s.at(i).unicode() >= 0x80 ) { - onlyAscii = FALSE; - break; - } - } - if ( onlyAscii ) - s = "\"" + s + "\""; - else - s = "TQString.fromUtf8(\"" + s + "\")"; - return s; -} - -static TQString mkStdSet( const TQString& prop ) -{ - return TQString( "set" ) + prop[0].upper() + prop.mid(1); -} - - -/*! - \class Uic uic.h - \brief User Interface Compiler - - The class Uic encapsulates the user interface compiler (uic). - */ - -static TQString className; - -Uic::Uic( TQTextStream &outStream, TQDomDocument doc, const TQString &trm ) - : out( outStream ), trmacro( trm ) -{ - item_used = cg_used = pal_used = 0; - - initIndent(); - - layouts << "hbox" << "vbox" << "grid"; - tags = layouts; - tags << "widget"; - - nameOfClass = getClassName( doc.firstChild().toElement() ); - - TQDomElement firstWidget = doc.firstChild().firstChild().toElement(); - while ( firstWidget.tagName() != "widget" ) - firstWidget = firstWidget.nextSibling().toElement(); - - if ( nameOfClass.isEmpty() ) - nameOfClass = getObjectName( firstWidget ); - - // This is a hack. - className = nameOfClass; - - createFormImpl( firstWidget ); -} - - -/*! Extracts a class name from \a e - */ -TQString Uic::getClassName( const TQDomElement& e ) -{ - TQDomElement n; - TQString cn; - for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { - if ( n.tagName() == "class" ) { - TQString s = n.firstChild().toText().data(); - int i; - while ( ( i = s.find(' ' )) != -1 ) - s[i] = '_'; - cn = s; - } else if ( n.tagName() == "pixmapfunction" ) { - pixmapLoaderFunction = n.firstChild().toText().data(); - } - } - return cn; -} - -/*! Extracts an object name from \a e. It's stored in the 'name' - property. - */ -TQString Uic::getObjectName( const TQDomElement& e ) -{ - TQDomElement n; - for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { - if ( n.tagName() == "property" ) { - TQDomElement n2 = n.firstChild().toElement(); - if ( n2.tagName() == "name" && n2.firstChild().toText().data() == "name" ) { - return n2.nextSibling().toElement().firstChild().toText().data(); - } - } - } - return TQString::null; -} - -/*! Extracts an layout name from \a e. It's stored in the 'name' - property of the preceeding sibling (the first child of a TQLayoutWidget). - */ -TQString Uic::getLayoutName( const TQDomElement& e ) -{ - TQDomElement p = e.parentNode().toElement(); - TQString tail = TQString::null; - - if (getClassName(p) != "TQLayoutWidget") - tail = "Layout"; - - TQDomElement n; - for ( n = p.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { - if ( n.tagName() == "property" ) { - TQDomElement n2 = n.firstChild().toElement(); - if ( n2.tagName() == "name" && n2.firstChild().toText().data() == "name" ) { - return n2.nextSibling().toElement().firstChild().toText().data() + tail; - } - } - } - return e.tagName(); -} - -TQByteArray unzipXPM( TQString data, ulong& length ) -{ - char *ba = new char[ data.length() / 2 ]; - for ( int i = 0; i < (int)data.length() / 2; ++i ) { - char h = data[ 2 * i ].latin1(); - char l = data[ 2 * i + 1 ].latin1(); - uchar r = 0; - if ( h <= '9' ) - r += h - '0'; - else - r += h - 'a' + 10; - r = r << 4; - if ( l <= '9' ) - r += l - '0'; - else - r += l - 'a' + 10; - ba[ i ] = r; - } - if ( length < data.length() * 5 ) - length = data.length() * 5; - TQByteArray baunzip( length ); - ::uncompress( (uchar*) baunzip.data(), &length, (uchar*) ba, data.length()/2 ); - return baunzip; -} - - -/*! - Creates an implementation ( cpp-file ) for the form given in \a e - - \sa createFormDecl(), createObjectImpl() - */ -void Uic::createFormImpl( const TQDomElement &e ) -{ - TQStringList::Iterator it; - TQDomElement n; - TQDomNodeList nl; - int i; - TQString objClass = getClassName( e ); - if ( objClass.isEmpty() ) - return; - TQString objName = getObjectName( e ); - - // Handle custom widgets. - for (n = e; !n.isNull(); n = n.nextSibling().toElement()) - { - if (n.tagName() != "customwidgets") - continue; - - TQDomElement n2 = n.firstChild().toElement(); - - while (!n2.isNull()) - { - if (n2.tagName() == "customwidget") - { - TQDomElement n3 = n2.firstChild().toElement(); - TQString cname, header; - - while (!n3.isNull()) - { - if (n3.tagName() == "class") - cname = n3.firstChild().toText().data(); - else if (n3.tagName() == "header") - header = n3.firstChild().toText().data(); - - n3 = n3.nextSibling().toElement(); - } - - if (cname.isEmpty()) - cname = "UnnamedCustomClass"; - - int ext = header.findRev('.'); - - if (ext >= 0) - header.truncate(ext); - - if (header.isEmpty()) - header = cname.lower(); - - out << "from " << header << " import " << cname << endl; - } - - n2 = n2.nextSibling().toElement(); - } - } - - // find out what images are required - TQStringList requiredImages; - nl = e.elementsByTagName( "pixmap" ); - for ( int j = 0; j < (int) nl.length(); j++ ) { - requiredImages += nl.item(j).firstChild().toText().data(); - } - - TQStringList images; - TQStringList xpmImages; - if ( pixmapLoaderFunction.isEmpty() ) { - // create images - for ( n = e; !n.isNull(); n = n.nextSibling().toElement() ) { - if ( n.tagName() == "images" ) { - nl = n.elementsByTagName( "image" ); - for ( i = 0; i < (int) nl.length(); i++ ) { - TQDomElement tmp = nl.item(i).firstChild().toElement(); - TQString img = registerObject( tmp.firstChild().toText().data() ); - if ( !requiredImages.contains( img ) ) - continue; - tmp = tmp.nextSibling().toElement(); - TQString format = tmp.attribute("format", "PNG" ); - TQString data = tmp.firstChild().toText().data(); - - out << endl; - out << endl; - - if ( format == "XPM.GZ" ) { - xpmImages += img; - ulong length = tmp.attribute("length").toULong(); - TQByteArray baunzip = unzipXPM( data, length ); - int a = 0; - out << indent << img << "_data = [" << endl; - while ( baunzip[a] != '\"' ) - a++; - for ( ; a < (int) length; a++ ) - { - char ch; - - if ((ch = baunzip[a]) == '}') - { - out << endl << "]" << endl; - break; - } - - if (ch == '\"') - ch = '\''; - - out << ch; - } - } else { - images += img; - out << indent << img << "_data = \\" << endl; - pushIndent(); - out << indent << "'"; - int a ; - for ( a = 0; a < (int) (data.length()/2)-1; a++ ) { - out << "\\x" << TQString(data[2*a]) << TQString(data[2*a+1]); - if ( a % 12 == 11 ) - out << "' \\" << endl << indent << "'"; - } - out << "\\x" << TQString(data[2*a]) << TQString(data[2*a+1]) << "'" << endl; - popIndent(); - } - } - } - } - } - - // register the object and unify its name - objName = registerObject( objName ); - - - // constructor - - out << endl; - out << endl; - out << indent << "class " << nameOfClass << "(" << objClass << "):" << endl; - pushIndent(); - - if ( objClass == "TQDialog" || objClass == "TQWizard" ) { - out << indent << "def __init__(self,parent = None,name = None,modal = 0,fl = 0):" << endl; - pushIndent(); - out << indent << objClass << ".__init__(self,parent,name,modal,fl)" << endl; - } else if ( objClass == "TQWidget" ) { // standard TQWidget - out << indent << "def __init__(self,parent = None,name = None,fl = 0):" << endl; - pushIndent(); - out << indent << objClass << ".__init__(self,parent,name,fl)" << endl; - } else { - out << indent << "def __init__(self,parent = None,name = None):" << endl; - pushIndent(); - out << indent << objClass << ".__init__(self,parent,name)" << endl; - } - - out << endl; - - // create pixmaps for all images - if ( !images.isEmpty() ) { - TQStringList::Iterator it; - for ( it = images.begin(); it != images.end(); ++it ) { - out << indent << (*it) << " = TQPixmap()" << endl; - out << indent << (*it) << ".loadFromData(" << (*it) << "_data,'PNG')" << endl; - } - - out << endl; - } - // create pixmaps for all images - if ( !xpmImages.isEmpty() ) { - for ( it = xpmImages.begin(); it != xpmImages.end(); ++it ) { - out << indent << (*it) << " = TQPixmap(" << (*it) << "_data)" << endl; - } - - out << endl; - } - - - // set the properties - for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { - if ( n.tagName() == "property" ) { - bool stdset = toBool( n.attribute( "stdset" ) ); - TQDomElement n2 = n.firstChild().toElement(); - - if ( n2.tagName() == "name" ) { - TQString prop = n2.firstChild().toText().data(); - TQString value = setObjectProperty( objClass, TQString::null, prop, n2.nextSibling().toElement(), stdset ); - - if ( value.isEmpty() ) - continue; - - if ( prop == "name" ) { - out << indent << "if name == None:" << endl; - pushIndent(); - } - - out << indent; - - if ( prop == "geometry" && n2.nextSibling().toElement().tagName() == "rect") { - TQDomElement n3 = n2.nextSibling().toElement().firstChild().toElement(); - int w = 0, h = 0; - - while ( !n3.isNull() ) { - if ( n3.tagName() == "width" ) - w = n3.firstChild().toText().data().toInt(); - else if ( n3.tagName() == "height" ) - h = n3.firstChild().toText().data().toInt(); - n3 = n3.nextSibling().toElement(); - } - - out << "self.resize(" << w << "," << h << ")" << endl; - } else { - if ( stdset ) - out << "self." << mkStdSet(prop) << "(" << value << ")" << endl; - else - out << "self.setProperty('" << prop << "',TQVariant(" << value << "))" << endl; - } - - if (prop == "name") { - popIndent(); - out << endl; - } - } - } - } - - - // create all children, some forms have special requirements - - if ( objClass == "TQWizard" ) { - for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { - if ( tags.contains( n.tagName() ) ) { - TQString page = createObjectImpl( n, objClass, "self" ); - TQString label = DomTool::readAttribute( n, "title", "" ).toString(); - out << indent << "self.addPage(" << page << ","<< trmacro << "(" << fixString( label ) << "))" << endl; - TQVariant def( FALSE ); - if ( DomTool::hasAttribute( n, "backEnabled" ) ) - out << indent << "self.setBackEnabled(" << page << "," << mkBool( DomTool::readAttribute( n, "backEnabled", def).toBool() ) << ")" << endl; - if ( DomTool::hasAttribute( n, "nextEnabled" ) ) - out << indent << "self.setNextEnabled(" << page << "," << mkBool( DomTool::readAttribute( n, "nextEnabled", def).toBool() ) << ")" << endl; - if ( DomTool::hasAttribute( n, "finishEnabled" ) ) - out << indent << "self.setFinishEnabled(" << page << "," << mkBool( DomTool::readAttribute( n, "finishEnabled", def).toBool() ) << ")" << endl; - if ( DomTool::hasAttribute( n, "helpEnabled" ) ) - out << indent << "self.setHelpEnabled(" << page << "," << mkBool( DomTool::readAttribute( n, "helpEnabled", def).toBool() ) << ")" << endl; - if ( DomTool::hasAttribute( n, "finish" ) ) - out << indent << "self.setFinish(" << page << "," << mkBool( DomTool::readAttribute( n, "finish", def).toBool() ) << ")" << endl; - } - } - } else { // standard widgets - for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { - if ( tags.contains( n.tagName() ) ) - createObjectImpl( n, objName, "self" ); - } - } - - // Get the list of any user defined slots. - - TQStringList userSlots; - - for ( n = e; !n.isNull(); n = n.nextSibling().toElement() ) { - if ( n.tagName() == "connections" ) { - for ( TQDomElement n2 = n.firstChild().toElement(); !n2.isNull(); n2 = n2.nextSibling().toElement() ) { - if ( n2.tagName() == "slot" ) { - userSlots += n2.firstChild().toText().data(); - } - } - } - } - - for ( n = e; !n.isNull(); n = n.nextSibling().toElement() ) { - if ( n.tagName() == "connections" ) { - // setup signals and slots connections - out << endl; - nl = n.elementsByTagName( "connection" ); - for ( i = 0; i < (int) nl.length(); i++ ) { - TQString sender, receiver, signal, slot; - for ( TQDomElement n2 = nl.item(i).firstChild().toElement(); !n2.isNull(); n2 = n2.nextSibling().toElement() ) { - if ( n2.tagName() == "sender" ) - sender = n2.firstChild().toText().data(); - else if ( n2.tagName() == "receiver" ) - receiver = n2.firstChild().toText().data(); - else if ( n2.tagName() == "signal" ) - signal = n2.firstChild().toText().data(); - else if ( n2.tagName() == "slot" ) - slot = n2.firstChild().toText().data(); - } - if ( sender.isEmpty() || receiver.isEmpty() || signal.isEmpty() || slot.isEmpty() ) - continue; - - sender = registeredName( sender ); - receiver = registeredName( receiver ); - - // translate formwindow name to "self" - if ( sender == objName ) - sender = "self"; - else - sender = "self." + sender; - if ( receiver == objName ) - receiver = "self"; - else - receiver = "self." + receiver; - - // Note that we never use the SLOT() macro in case we have - // custom widgets implemented in Python. - out << indent << "self.connect(" << sender - << ",SIGNAL('" << signal << "'),self." - << slot.left(slot.find('(')) << ")" << endl; - } - } else if ( n.tagName() == "tabstops" ) { - // setup tab order - out << endl; - TQString lastName; - TQDomElement n2 = n.firstChild().toElement(); - while ( !n2.isNull() ) { - if ( n2.tagName() == "tabstop" ) { - TQString name = n2.firstChild().toText().data(); - name = registeredName( name ); - if ( !lastName.isEmpty() ) - out << indent << "self.setTabOrder(self." << lastName << ",self." << name << ")" << endl; - lastName = name; - } - n2 = n2.nextSibling().toElement(); - } - } - } - - - // buddies - bool firstBuddy = TRUE; - for ( TQValueList::Iterator buddy = buddies.begin(); buddy != buddies.end(); ++buddy ) { - if ( isObjectRegistered( (*buddy).buddy ) ) { - if ( firstBuddy ) { - out << endl; - } - out << indent << "self." << (*buddy).key << ".setBuddy(self." << registeredName( (*buddy).buddy ) << ")" << endl; - firstBuddy = FALSE; - } - - } - - // end of constructor - popIndent(); - - // handle application font changes if required - nl = e.elementsByTagName( "widget" ); - bool needEventHandler = FALSE; - for ( i = 0; i < (int) nl.length(); i++ ) { - if ( DomTool::hasProperty( nl.item(i).toElement() , "font" ) ) { - needEventHandler = TRUE; - break; - } - } - if ( needEventHandler ) { - out << endl; - out << indent << "def event(self,ev):" << endl; - pushIndent(); - out << indent << "ret = " << objClass << ".event(self,ev)" << endl; - out << endl; - out << indent << "if ev.type() == TQEvent.ApplicationFontChange:" << endl; - pushIndent(); - - for ( i = 0; i < (int) nl.length(); i++ ) { - n = nl.item(i).toElement(); - if ( DomTool::hasProperty( n, "font" ) ) - createExclusiveProperty( n, "font" ); - } - - out << endl; - popIndent(); - out << indent << "return ret" << endl; - popIndent(); - } - - - // Generate user defined slot hooks. - - for (it = userSlots.begin(); it != userSlots.end(); ++it) { - int astart = (*it).find('('); - - out << endl; - out << indent << "def " << (*it).left(astart) << "(self"; - - // We don't reproduce the argument names (if any) because we would have - // to remove the types - too complicated for the moment, so we just - // count them and give them names based on their position. - - TQString args = (*it).mid(astart + 1,(*it).find(')') - astart - 1).stripWhiteSpace(); - - if (!args.isEmpty()) { - int nrargs = args.contains(',') + 1; - - for (int i = 0; i < nrargs; ++i) - out << ",a" << i; - } - - out << "):" << endl; - pushIndent(); - out << indent << "print '" << nameOfClass << "." << *it << ": not implemented yet'" << endl; - popIndent(); - } - - popIndent(); -} - - -/*! - Creates an implementation for the object given in \a e. - - Traverses recursively over all children. - - Returns the name of the generated child object. - - \sa createObjectDecl() - */ -TQString Uic::createObjectImpl( const TQDomElement &e, const TQString& parentClass, const TQString& parent, const TQString& layout ) -{ - - TQDomElement n; - TQString objClass, objName, fullObjName; - - if ( layouts.contains( e.tagName() ) ) - return createLayoutImpl( e, parentClass, parent, layout ); - - objClass = getClassName( e ); - if ( objClass.isEmpty() ) - return objName; - objName = getObjectName( e ); - - TQString definedName = objName; - bool isTmpObject = objName.isEmpty() || objClass == "TQLayoutWidget"; - if ( isTmpObject ) { - if ( objClass[0] == 'Q' ) - objName = objClass.mid(1); - else - objName = objClass.lower(); - } - - bool isLine = objClass == "Line"; - if ( isLine ) - objClass = "TQFrame"; - - out << endl; - if ( objClass == "TQLayoutWidget" ) { - if ( layout.isEmpty() ) { - // register the object and unify its name - objName = registerObject( objName ); - out << indent << objName << " = TQWidget(" << parent << ",'" << definedName << "')" << endl; - } else { - // the layout widget is not necessary, hide it by creating its child in the parent - TQString result; - for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { - if (tags.contains( n.tagName() ) ) - result = createObjectImpl( n, parentClass, parent, layout ); - } - return result; - } - - // Layouts don't go into the class instance dictionary. - fullObjName = objName; - } else { - // register the object and unify its name - objName = registerObject( objName ); - - // Temporary objects don't go into the class instance dictionary. - fullObjName = isTmpObject ? objName : "self." + objName; - - out << indent << fullObjName << " = " << createObjectInstance( objClass, parent, objName ) << endl; - } - - lastItem = "None"; - // set the properties and insert items - for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { - if ( n.tagName() == "property" ) { - bool stdset = toBool( n.attribute( "stdset" ) ); - TQDomElement n2 = n.firstChild().toElement(); - - if ( n2.tagName() == "name" ) { - TQString prop = n2.firstChild().toText().data(); - TQString value = setObjectProperty( objClass, objName, prop, n2.nextSibling().toElement(), stdset ); - - if ( value.isEmpty() ) - continue; - if ( prop == "name" ) - continue; - if ( prop == "buddy" && value[0] == '\'' && value[(int)value.length()-1] == '\'' ) { - buddies << Buddy( objName, value.mid(1, value.length() - 2 ) ); - continue; - } - if ( isLine && prop == "orientation" ) { - prop = "frameStyle"; - if ( value.right(10) == "Horizontal" ) - value = "TQFrame.HLine | TQFrame.Sunken"; - else - value = "TQFrame.VLine | TQFrame.Sunken"; - } - if ( prop == "buttonGroupId" ) { - if ( parentClass == "TQButtonGroup" ) - out << indent << parent << ".insert(" << fullObjName << "," << value << ")" << endl; - continue; - } - if ( prop == "geometry") { - out << indent << fullObjName << ".setGeometry(" << value << ")" << endl; - } else { - if ( stdset ) - out << indent << fullObjName << "." << mkStdSet(prop) << "(" << value << ")" << endl; - else - out << indent << fullObjName << ".setProperty('" << prop << "',TQVariant(" << value << "))" << endl; - } - - } - } else if ( n.tagName() == "item" ) { - if ( objClass.mid(1) == "ListBox" ) { - TQString s = createListBoxItemImpl( n, fullObjName ); - if ( !s.isEmpty() ) - out << indent << s << endl; - } else if ( objClass.mid(1) == "ComboBox" ) { - TQString s = createListBoxItemImpl( n, fullObjName ); - if ( !s.isEmpty() ) - out << indent << s << endl; - } else if ( objClass.mid(1) == "IconView" ) { - TQString s = createIconViewItemImpl( n, fullObjName ); - if ( !s.isEmpty() ) - out << indent << s << endl; - } else if ( objClass.mid(1) == "ListView" ) { - TQString s = createListViewItemImpl( n, fullObjName, TQString::null ); - if ( !s.isEmpty() ) - out << s << endl; - } - } else if ( n.tagName() == "column" ) { - if ( objClass.mid(1) == "ListView" ) { - TQString s = createListViewColumnImpl( n, fullObjName ); - if ( !s.isEmpty() ) - out << s; - } - } - } - - // create all children, some widgets have special requirements - - if ( objClass == "TQTabWidget" ) { - for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { - if ( tags.contains( n.tagName() ) ) { - TQString page = createObjectImpl( n, objClass, fullObjName ); - TQString label = DomTool::readAttribute( n, "title", "" ).toString(); - out << indent << fullObjName << ".insertTab(" << page << "," << trmacro << "(" << fixString( label ) << "))" << endl; - } - } - } else { // standard widgets - for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { - if ( tags.contains( n.tagName() ) ) - createObjectImpl( n, objClass, fullObjName ); - } - } - - return fullObjName; -} - -/*! - Creates implementation of an listbox item tag. -*/ - -TQString Uic::createListBoxItemImpl( const TQDomElement &e, const TQString &parent ) -{ - TQDomElement n = e.firstChild().toElement(); - TQString txt; - TQString pix; - while ( !n.isNull() ) { - if ( n.tagName() == "property" ) { - TQDomElement n2 = n.firstChild().toElement(); - if ( n2.tagName() == "name" ) { - TQString attrib = n2.firstChild().toText().data(); - TQVariant v = DomTool::elementToVariant( n2.nextSibling().toElement(), TQVariant() ); - if ( attrib == "text" ) - txt = v.toString(); - else if ( attrib == "pixmap" ) { - pix = v.toString(); - if ( !pix.isEmpty() && !pixmapLoaderFunction.isEmpty() ) { - pix.prepend( pixmapLoaderFunction + "(" ); - pix.append( ")" ); - } - } - } - } - n = n.nextSibling().toElement(); - } - - return pix.isEmpty() ? - parent + ".insertItem(" + trmacro + "(" + fixString( txt ) + "))": - parent + ".insertItem(" + pix + "," + trmacro + "(" + fixString( txt ) + "))"; -} - -/*! - Creates implementation of an iconview item tag. -*/ - -TQString Uic::createIconViewItemImpl( const TQDomElement &e, const TQString &parent ) -{ - TQDomElement n = e.firstChild().toElement(); - TQString txt; - TQString pix; - while ( !n.isNull() ) { - if ( n.tagName() == "property" ) { - TQDomElement n2 = n.firstChild().toElement(); - if ( n2.tagName() == "name" ) { - TQString attrib = n2.firstChild().toText().data(); - TQVariant v = DomTool::elementToVariant( n2.nextSibling().toElement(), TQVariant() ); - if ( attrib == "text" ) - txt = v.toString(); - else if ( attrib == "pixmap" ) { - pix = v.toString(); - if ( !pix.isEmpty() && !pixmapLoaderFunction.isEmpty() ) { - pix.prepend( pixmapLoaderFunction + "( " ); - pix.append( " )" ); - } - } - } - } - n = n.nextSibling().toElement(); - } - - if ( pix.isEmpty() ) - return "TQIconViewItem(" + parent + "," + trmacro + "(" + fixString( txt ) + "))"; - return "TQIconViewItem(" + parent + "," + trmacro + "(" + fixString( txt ) + ")," + pix + ")"; - -} - -/*! - Creates implementation of an listview item tag. -*/ - -TQString Uic::createListViewItemImpl( const TQDomElement &e, const TQString &parent, - const TQString &parentItem ) -{ - TQString s; - - TQDomElement n = e.firstChild().toElement(); - - bool hasChildren = e.elementsByTagName( "item" ).count() > 0; - TQString item; - - if ( hasChildren ) { - item = registerObject( "item" ); - s = indent + item + " = "; - } else { - item = "item"; - if ( item_used ) - s = indent + item + " = "; - else - s = indent + item + " = "; - item_used = TRUE; - } - - if ( !parentItem.isEmpty() ) - s += "TQListViewItem(" + parentItem + "," + lastItem + ")\n"; - else - s += "TQListViewItem(" + parent + "," + lastItem + ")\n"; - - TQStringList textes; - TQStringList pixmaps; - while ( !n.isNull() ) { - if ( n.tagName() == "property" ) { - TQDomElement n2 = n.firstChild().toElement(); - if ( n2.tagName() == "name" ) { - TQString attrib = n2.firstChild().toText().data(); - TQVariant v = DomTool::elementToVariant( n2.nextSibling().toElement(), TQVariant() ); - if ( attrib == "text" ) - textes << v.toString(); - else if ( attrib == "pixmap" ) { - TQString pix = v.toString(); - if ( !pix.isEmpty() && !pixmapLoaderFunction.isEmpty() ) { - pix.prepend( pixmapLoaderFunction + "( " ); - pix.append( " )" ); - } - pixmaps << pix; - } - } - } else if ( n.tagName() == "item" ) { - s += indent + item + ".setOpen(1)\n"; - s += createListViewItemImpl( n, parent, item ); - } - n = n.nextSibling().toElement(); - } - - for ( int i = 0; i < (int)textes.count(); ++i ) { - if ( !textes[ i ].isEmpty() ) - s += indent + item + ".setText(" + TQString::number( i ) + "," + trmacro + "(" + fixString( textes[ i ] ) + "))\n"; - if ( !pixmaps[ i ].isEmpty() ) - s += indent + item + ".setPixmap(" + TQString::number( i ) + "," + pixmaps[ i ] + ")\n"; - } - - lastItem = item; - return s; -} - -/*! - Creates implementation of an listview column tag. -*/ - -TQString Uic::createListViewColumnImpl( const TQDomElement &e, const TQString &parent ) -{ - TQDomElement n = e.firstChild().toElement(); - TQString txt; - TQString pix; - bool clickable = FALSE, resizeable = FALSE; - while ( !n.isNull() ) { - if ( n.tagName() == "property" ) { - TQDomElement n2 = n.firstChild().toElement(); - if ( n2.tagName() == "name" ) { - TQString attrib = n2.firstChild().toText().data(); - TQVariant v = DomTool::elementToVariant( n2.nextSibling().toElement(), TQVariant() ); - if ( attrib == "text" ) - txt = v.toString(); - else if ( attrib == "pixmap" ) { - pix = v.toString(); - if ( !pix.isEmpty() && !pixmapLoaderFunction.isEmpty() ) { - pix.prepend( pixmapLoaderFunction + "( " ); - pix.append( " )" ); - } - } else if ( attrib == "clickable" ) - clickable = v.toBool(); - else if ( attrib == "resizeable" ) - resizeable = v.toBool(); - } - } - n = n.nextSibling().toElement(); - } - - TQString s; - s = indent + parent + ".addColumn(" + trmacro + "(" + fixString( txt ) + "))\n"; - if ( !pix.isEmpty() ) - s += indent + parent + ".header().setLabel(" + parent + ".header().count() - 1," + pix + "," + trmacro + "(" + fixString( txt ) + "))\n"; - if ( !clickable ) - s += indent + parent + ".header().setClickEnabled(0," + parent + ".header().count() - 1)\n"; - if ( !resizeable ) - s += indent + parent + ".header().setResizeEnabled(0," + parent + ".header().count() - 1)\n"; - - return s; -} - -/*! - Creates the implementation of a layout tag. Called from createObjectImpl(). - */ -TQString Uic::createLayoutImpl( const TQDomElement &e, const TQString& parentClass, const TQString& parent, const TQString& layout ) -{ - TQDomElement n; - TQString objClass, objName; - objClass = e.tagName(); - - TQString qlayout = "TQVBoxLayout"; - if ( objClass == "hbox" ) - qlayout = "TQHBoxLayout"; - else if ( objClass == "grid" ) - qlayout = "TQGridLayout"; - - bool isGrid = e.tagName() == "grid" ; - objName = registerObject( getLayoutName( e ) ); - layoutObjects += objName; - int margin = DomTool::readProperty( e, "margin", BOXLAYOUT_DEFAULT_MARGIN ).toInt(); - int spacing = DomTool::readProperty( e, "spacing", BOXLAYOUT_DEFAULT_SPACING ).toInt(); - - if ( (parentClass == "TQGroupBox" || parentClass == "TQButtonGroup") && layout.isEmpty() ) { - // special case for group box - out << indent << parent << ".setColumnLayout(0,TQt.Vertical)" << endl; - out << indent << parent << ".layout().setSpacing(0)" << endl; - out << indent << parent << ".layout().setMargin(0)" << endl; - out << indent << objName << " = " << qlayout << "(" << parent << ".layout())" << endl; - out << indent << objName << ".setAlignment(TQt.AlignTop)" << endl; - } else { - if ( layout.isEmpty() ) - out << indent << objName << " = " << qlayout << "(" << parent << ")" << endl; - else - out << indent << objName << " = " << qlayout << "()" << endl; - } - - out << indent << objName << ".setSpacing(" << spacing << ")" << endl; - out << indent << objName << ".setMargin(" << margin << ")" << endl; - - if ( !isGrid ) { - for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { - if ( n.tagName() == "spacer" ) { - TQString child = createSpacerImpl( n, parentClass, parent, objName ); - out << indent << objName << ".addItem(" << child << ")" << endl; - } else if ( tags.contains( n.tagName() ) ) { - TQString child = createObjectImpl( n, parentClass, parent, objName ); - if ( isLayout( child ) ) - out << indent << objName << ".addLayout(" << child << ")" << endl; - else - out << indent << objName << ".addWidget(" << child << ")" << endl; - } - } - } else { - for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { - TQDomElement ae = n; - int row = ae.attribute( "row" ).toInt(); - int col = ae.attribute( "column" ).toInt(); - int rowspan = ae.attribute( "rowspan" ).toInt(); - int colspan = ae.attribute( "colspan" ).toInt(); - if ( rowspan < 1 ) - rowspan = 1; - if ( colspan < 1 ) - colspan = 1; - if ( n.tagName() == "spacer" ) { - TQString child = createSpacerImpl( n, parentClass, parent, objName ); - if ( rowspan * colspan != 1 ) - out << indent << objName << ".addMultiCell(" << child << "," - << row << "," << row + rowspan - 1 << "," << col << "," - << col + colspan - 1 << ")" << endl; - else - out << indent << objName << ".addItem(" << child << "," - << row << "," << col << ")" << endl; - } else if ( tags.contains( n.tagName() ) ) { - TQString child = createObjectImpl( n, parentClass, parent, objName ); - out << endl; - TQString o = "Widget"; - if ( isLayout( child ) ) - o = "Layout"; - if ( rowspan * colspan != 1 ) - out << indent << objName << ".addMultiCell" << o << "(" << child << "," - << row << "," << row + rowspan - 1 << "," << col << "," << col + colspan - 1 << ")" << endl; - else - out << indent << objName << ".add" << o << "(" << child << "," - << row << "," << col << ")" << endl; - } - } - } - - return objName; -} - - - -TQString Uic::createSpacerImpl( const TQDomElement &e, const TQString& /*parentClass*/, const TQString& /*parent*/, const TQString& /*layout*/) -{ - TQDomElement n; - TQString objClass, objName; - objClass = e.tagName(); - objName = registerObject( "spacer" ); - - TQSize size = DomTool::readProperty( e, "sizeHint", TQSize(0,0) ).toSize(); - TQString sizeType = DomTool::readProperty( e, "sizeType", "Expanding" ).toString(); - bool isVspacer = DomTool::readProperty( e, "orientation", "Horizontal" ) == "Vertical"; - - if ( sizeType != "Expanding" && sizeType != "MinimumExpanding" && - DomTool::hasProperty( e, "geometry" ) ) { // compatibility TQt 2.2 - TQRect geom = DomTool::readProperty( e, "geometry", TQRect(0,0,0,0) ).toRect(); - size = geom.size(); - } - - if ( isVspacer ) - out << indent << objName << " = TQSpacerItem(" - << size.width() << "," << size.height() - << ",TQSizePolicy.Minimum,TQSizePolicy." << sizeType << ")" << endl; - else - out << indent << objName << " = TQSpacerItem(" - << size.width() << "," << size.height() - << ",TQSizePolicy." << sizeType << ",TQSizePolicy.Minimum)" << endl; - - return objName; -} - -/*! - Creates a set-call for property \a exclusiveProp of the object - given in \a e. - - If the object does not have this property, the function does nothing. - - Exclusive properties are used to generate the implementation of - application font or palette change handlers in createFormImpl(). - - */ -void Uic::createExclusiveProperty( const TQDomElement & e, const TQString& exclusiveProp ) -{ - TQDomElement n; - TQString objClass = getClassName( e ); - if ( objClass.isEmpty() ) - return; - TQString objName = getObjectName( e ); - if ( objClass.isEmpty() ) - return; - for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { - if ( n.tagName() == "property" ) { - bool stdset = toBool( n.attribute( "stdset" ) ); - TQDomElement n2 = n.firstChild().toElement(); - if ( n2.tagName() == "name" ) { - TQString prop = n2.firstChild().toText().data(); - if ( prop != exclusiveProp ) - continue; - TQString value = setObjectProperty( objClass, objName, prop, n2.nextSibling().toElement(), stdset ); - if ( value.isEmpty() ) - continue; - out << indent << objName << ".setProperty('" << prop << "',TQVariant(" << value << "))" << endl; - } - } - } - -} - - -const char* const ColorRole[] = { - "Foreground", "Button", "Light", "Midlight", "Dark", "Mid", - "Text", "BrightText", "ButtonText", "Base", "Background", "Shadow", - "Highlight", "HighlightedText", 0 -}; - - -/*! - Attention: this function has to be in sync with Resource::setWidgetProperty(). If you change one, change both. - */ -TQString Uic::setObjectProperty( const TQString& objClass, const TQString& obj, const TQString &prop, const TQDomElement &e, bool stdset ) -{ - TQString v; - if ( e.tagName() == "rect" ) { - TQDomElement n3 = e.firstChild().toElement(); - int x = 0, y = 0, w = 0, h = 0; - while ( !n3.isNull() ) { - if ( n3.tagName() == "x" ) - x = n3.firstChild().toText().data().toInt(); - else if ( n3.tagName() == "y" ) - y = n3.firstChild().toText().data().toInt(); - else if ( n3.tagName() == "width" ) - w = n3.firstChild().toText().data().toInt(); - else if ( n3.tagName() == "height" ) - h = n3.firstChild().toText().data().toInt(); - n3 = n3.nextSibling().toElement(); - } - v = "TQRect(%1,%2,%3,%4)"; - v = v.arg(x).arg(y).arg(w).arg(h); - - } else if ( e.tagName() == "point" ) { - TQDomElement n3 = e.firstChild().toElement(); - int x = 0, y = 0; - while ( !n3.isNull() ) { - if ( n3.tagName() == "x" ) - x = n3.firstChild().toText().data().toInt(); - else if ( n3.tagName() == "y" ) - y = n3.firstChild().toText().data().toInt(); - n3 = n3.nextSibling().toElement(); - } - v = "TQPoint(%1,%2)"; - v = v.arg(x).arg(y); - } else if ( e.tagName() == "size" ) { - TQDomElement n3 = e.firstChild().toElement(); - int w = 0, h = 0; - while ( !n3.isNull() ) { - if ( n3.tagName() == "width" ) - w = n3.firstChild().toText().data().toInt(); - else if ( n3.tagName() == "height" ) - h = n3.firstChild().toText().data().toInt(); - n3 = n3.nextSibling().toElement(); - } - v = "TQSize(%1,%2)"; - v = v.arg(w).arg(h); - } else if ( e.tagName() == "color" ) { - TQDomElement n3 = e.firstChild().toElement(); - int r= 0, g = 0, b = 0; - while ( !n3.isNull() ) { - if ( n3.tagName() == "red" ) - r = n3.firstChild().toText().data().toInt(); - else if ( n3.tagName() == "green" ) - g = n3.firstChild().toText().data().toInt(); - else if ( n3.tagName() == "blue" ) - b = n3.firstChild().toText().data().toInt(); - n3 = n3.nextSibling().toElement(); - } - v = "TQColor(%1,%2,%3)"; - v = v.arg(r).arg(g).arg(b); - } else if ( e.tagName() == "font" ) { - TQDomElement n3 = e.firstChild().toElement(); - TQString fontname = "f"; - if ( !obj.isEmpty() ) { - fontname = obj + "_font"; - out << indent << fontname << " = TQFont(self." << obj << ".font())" << endl; - } else { - out << indent << fontname << " = TQFont(self.font())" << endl; - } - while ( !n3.isNull() ) { - if ( n3.tagName() == "family" ) - out << indent << fontname << ".setFamily('" << n3.firstChild().toText().data() << "')" << endl; - else if ( n3.tagName() == "pointsize" ) - out << indent << fontname << ".setPointSize(" << n3.firstChild().toText().data() << ")" << endl; - else if ( n3.tagName() == "bold" ) - out << indent << fontname << ".setBold(" << mkBool( n3.firstChild().toText().data() ) << ")" << endl; - else if ( n3.tagName() == "italic" ) - out << indent << fontname << ".setItalic(" << mkBool( n3.firstChild().toText().data() ) << ")" << endl; - else if ( n3.tagName() == "underline" ) - out << indent << fontname << ".setUnderline(" << mkBool( n3.firstChild().toText().data() ) << ")" << endl; - else if ( n3.tagName() == "strikeout" ) - out << indent << fontname << ".setStrikeOut(" << mkBool( n3.firstChild().toText().data() ) << ")" << endl; - n3 = n3.nextSibling().toElement(); - } - - if ( prop == "font" ) { - if ( !obj.isEmpty() ) - out << indent << "self." << obj << ".setFont(" << fontname << ")" << endl; - else - out << indent << "self.setFont(" << fontname << ")" << endl; - } else { - v = fontname; - } - } else if ( e.tagName() == "string" ) { - if ( prop == "toolTip" ) { - if ( !obj.isEmpty() ) - out << indent << "TQToolTip.add(self." << obj << "," + trmacro + "(" << fixString( e.firstChild().toText().data() ) << "))" << endl; - else - out << indent << "TQToolTip.add(self," + trmacro + "(" << fixString( e.firstChild().toText().data() ) << "))" << endl; - } else if ( prop == "whatsThis" ) { - if ( !obj.isEmpty() ) - out << indent << "TQWhatsThis.add(self." << obj << "," << trmacro << "(" << fixString( e.firstChild().toText().data() ) << "))" << endl; - else - out << indent << "TQWhatsThis.add(self," << trmacro << "(" << fixString( e.firstChild().toText().data() ) << "))" << endl; - } else { - v = trmacro + "(%1)"; - v = v.arg( fixString( e.firstChild().toText().data() ) ); - } - } else if ( e.tagName() == "cstring" ) { - v = "'%1'"; - v = v.arg( e.firstChild().toText().data() ); - } else if ( e.tagName() == "number" ) { - v = "%1"; - v = v.arg( e.firstChild().toText().data() ); - } else if ( e.tagName() == "bool" ) { - if ( stdset ) - v = "%1"; - else - v = "%1,0"; - v = v.arg( mkBool( e.firstChild().toText().data() ) ); - } else if ( e.tagName() == "pixmap" ) { - v = e.firstChild().toText().data(); - if ( !pixmapLoaderFunction.isEmpty() ) { - v.prepend( pixmapLoaderFunction + "( " ); - v.append( " )" ); - } - } else if ( e.tagName() == "iconset" ) { - v = "TQIconSet(%1)"; - v = v.arg( e.firstChild().toText().data() ); - } else if ( e.tagName() == "image" ) { - v = e.firstChild().toText().data() + ".convertToImage()"; - } else if ( e.tagName() == "enum" ) { - v = "%1.%2"; - TQString oc = objClass; - TQString ev = e.firstChild().toText().data(); - if ( oc == "TQListView" && ev == "Manual" ) // #### workaround, rename TQListView::Manual of WithMode enum in 3.0 - oc = "TQScrollView"; - v = v.arg( oc ).arg( ev ); - } else if ( e.tagName() == "set" ) { - TQString keys( e.firstChild().toText().data() ); - TQStringList lst = TQStringList::split( '|', keys ); - v = ""; - for ( TQStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { - v += objClass + "." + *it; - if ( it != lst.fromLast() ) - v += " | "; - } - } else if ( e.tagName() == "sizepolicy" ) { - TQDomElement n3 = e.firstChild().toElement(); - TQSizePolicy sp; - while ( !n3.isNull() ) { - if ( n3.tagName() == "hsizetype" ) - sp.setHorData( (TQSizePolicy::SizeType)n3.firstChild().toText().data().toInt() ); - else if ( n3.tagName() == "vsizetype" ) - sp.setVerData( (TQSizePolicy::SizeType)n3.firstChild().toText().data().toInt() ); - n3 = n3.nextSibling().toElement(); - } - TQString tmp; - if ( !obj.isEmpty() ) - tmp = "self." + obj; - else - tmp = "self"; - v = "TQSizePolicy(%1,%2," + tmp + ".sizePolicy().hasHeightForWidth())"; - v = v.arg( (int)sp.horData() ).arg( (int)sp.verData() ); - } else if ( e.tagName() == "palette" ) { - TQPalette pal; - bool no_pixmaps = e.elementsByTagName( "pixmap" ).count() == 0; - TQDomElement n; - if ( no_pixmaps ) { - n = e.firstChild().toElement(); - while ( !n.isNull() ) { - TQColorGroup cg; - if ( n.tagName() == "active" ) { - cg = loadColorGroup( n ); - pal.setActive( cg ); - } else if ( n.tagName() == "inactive" ) { - cg = loadColorGroup( n ); - pal.setInactive( cg ); - } else if ( n.tagName() == "disabled" ) { - cg = loadColorGroup( n ); - pal.setDisabled( cg ); - } - n = n.nextSibling().toElement(); - } - } - if ( no_pixmaps && pal == TQPalette( pal.active().button(), pal.active().background() ) ) { - v = "TQPalette(TQColor(%1,%2,%3),TQColor(%1,%2,%3))"; - v = v.arg( pal.active().button().red() ).arg( pal.active().button().green() ).arg( pal.active().button().blue() ); - v = v.arg( pal.active().background().red() ).arg( pal.active().background().green() ).arg( pal.active().background().blue() ); - } else { - TQString palette = "pal"; - if ( !pal_used ) { - out << indent << palette << " = TQPalette()" << endl; - pal_used = TRUE; - } - TQString cg = "cg"; - if ( !cg_used ) { - out << indent << cg << " = TQColorGroup()" << endl; - cg_used = TRUE; - } - n = e.firstChild().toElement(); - while ( !n.isNull() && n.tagName() != "active") - n = n.nextSibling().toElement(); - createColorGroupImpl( cg, n ); - out << indent << palette << ".setActive(" << cg << ")" << endl; - - n = e.firstChild().toElement(); - while ( !n.isNull() && n.tagName() != "inactive") - n = n.nextSibling().toElement(); - createColorGroupImpl( cg, n ); - out << indent << palette << ".setInactive(" << cg << ")" << endl; - - n = e.firstChild().toElement(); - while ( !n.isNull() && n.tagName() != "disabled") - n = n.nextSibling().toElement(); - createColorGroupImpl( cg, n ); - out << indent << palette << ".setDisabled(" << cg << ")" << endl; - v = palette; - } - } else if ( e.tagName() == "cursor" ) { - v = "TQCursor(%1)"; - v = v.arg( e.firstChild().toText().data() ); - } - return v; -} - - - -/*! - Creates a colorgroup with name \a name from the color group \a cg - */ -void Uic::createColorGroupImpl( const TQString& name, const TQDomElement& e ) -{ - TQColorGroup cg; - int r = -1; - TQDomElement n = e.firstChild().toElement(); - TQString color; - while ( !n.isNull() ) { - if ( n.tagName() == "color" ) { - r++; - TQColor col = DomTool::readColor( n ); - color = "TQColor(%1,%2,%3)"; - color = color.arg( col.red() ).arg( col.green() ).arg( col.blue() ); - if ( col == white ) - color = "TQt.white"; - else if ( col == black ) - color = "TQt.black"; - if ( n.nextSibling().toElement().tagName() != "pixmap" ) { - out << indent << name << ".setColor(TQColorGroup." << ColorRole[r] << "," << color << ")" << endl; - } - } else if ( n.tagName() == "pixmap" ) { - TQString pixmap = n.firstChild().toText().data(); - if ( !pixmapLoaderFunction.isEmpty() ) { - pixmap.prepend( pixmapLoaderFunction + "(" ); - pixmap.append( ")" ); - } - out << indent << name << ".setBrush(TQColorGroup." - << ColorRole[r] << ",TQBrush(" << color << "," << pixmap << "))" << endl; - } - n = n.nextSibling().toElement(); - } -} - -/*! - Auxiliary function to load a color group. The colorgroup must not - contain pixmaps. - */ -TQColorGroup Uic::loadColorGroup( const TQDomElement &e ) -{ - TQColorGroup cg; - int r = -1; - TQDomElement n = e.firstChild().toElement(); - TQColor col; - while ( !n.isNull() ) { - if ( n.tagName() == "color" ) { - r++; - cg.setColor( (TQColorGroup::ColorRole)r, (col = DomTool::readColor( n ) ) ); - } - n = n.nextSibling().toElement(); - } - return cg; -} - - - -/*! - Registers an object with name \a name. - - The returned name is a valid variable identifier, as similar to \a - name as possible and guaranteed to be unique within the form. - - \sa registeredName(), isObjectRegistered() - */ -TQString Uic::registerObject( const TQString& name ) -{ - if ( objectNames.isEmpty() ) { - // some temporary variables we need - objectNames += "img"; - objectNames += "item"; - objectNames += "cg"; - objectNames += "pal"; - } - - TQString result = name; - int i; - while ( ( i = result.find(' ' )) != -1 ) { - result[i] = '_'; - } - - if ( objectNames.contains( result ) ) { - int i = 2; - while ( objectNames.contains( result + "_" + TQString::number(i) ) ) - i++; - result += "_"; - result += TQString::number(i); - } - objectNames += result; - objectMapper.insert( name, result ); - return result; -} - -/*! - Returns the registered name for the original name \a name - or \a name if \a name wasn't registered. - - \sa registerObject(), isObjectRegistered() - */ -TQString Uic::registeredName( const TQString& name ) -{ - if ( !objectMapper.contains( name ) ) - return name; - return objectMapper[name]; -} - -/*! - Returns whether the object \a name was registered yet or not. - */ -bool Uic::isObjectRegistered( const TQString& name ) -{ - return objectMapper.contains( name ); -} - - -/*! - Unifies the entries in stringlist \a list. Should really be a TQStringList feature. - */ -TQStringList Uic::unique( const TQStringList& list ) -{ - TQStringList result; - if (list.isEmpty() ) - return result; - TQStringList l = list; - l.sort(); - result += l.first(); - for ( TQStringList::Iterator it = l.begin(); it != l.end(); ++it ) { - if ( *it != result.last() ) - result += *it; - } - return result; -} - - - -/*! - Creates an instance of class \a objClass, with parent \a parent and name \a objName - */ -TQString Uic::createObjectInstance( const TQString& objClass, const TQString& parent, const TQString& objName ) -{ - - if ( objClass.mid(1) == "ComboBox" ) { - return objClass + "(0," + parent + ",'" + objName + "')"; - } - return objClass + "(" + parent + ",'" + objName + "')"; -} - -bool Uic::isLayout( const TQString& name ) const -{ - return layoutObjects.contains( name ); -} - - -#if defined(BLACKADDER) -#include "ba.h" - -int BA::compilePython(const TQString &fileName,const TQString &outputFile, - const TQString &trmacro,bool execCode) -{ -#else -int main( int argc, char * argv[] ) -{ - const char *error = 0; - TQString fileName; - TQString outputFile; - TQString trmacro; - bool execCode = FALSE; - - for ( int n = 1; n < argc && error == 0; n++ ) { - TQCString arg = argv[n]; - if ( arg[0] == '-' ) { // option - TQCString opt = &arg[1]; - if ( opt[0] == 'o' ) { // output redirection - if ( opt[1] == '\0' ) { - if ( !(n < argc-1) ) { - error = "Missing output-file name"; - break; - } - outputFile = argv[++n]; - } else - outputFile = &opt[1]; - } else if ( opt == "tr" ) { - if ( opt == "tr" || opt[1] == '\0' ) { - if ( !(n < argc-1) ) { - error = "Missing tr macro."; - break; - } - trmacro = argv[++n]; - } else { - trmacro = &opt[1]; - } - } else if ( opt == "x" ) { - execCode = TRUE; - } - } else { - if (!fileName.isEmpty()) // can handle only one file - error = "Too many input files specified"; - else - fileName = argv[n]; - } - } - - if ( argc < 2 || error || fileName.isEmpty() ) { - fprintf( stderr, "PyTQt user interface compiler\n" ); - if ( error ) - fprintf( stderr, "pyuic: %s\n", error ); - - fprintf( stderr, "Usage: %s [options] \n" - "\nGenerate PyTQt implementation:\n" - " %s [options] \n" - "Options:\n" - "\t-o file Write output to file rather than stdout\n" - "\t-tr func Use func(...) rather than tr(...) for i18n\n" - "\t-x Generate extra code to test the class\n" - , argv[0], argv[0]); - exit( 1 ); - } -#endif - - TQFile file( fileName ); - if ( !file.open( IO_ReadOnly ) ) - tqFatal( "pyuic: Could not open file '%s' ", (const char *)fileName ); - - TQFile fileOut; - if (!outputFile.isEmpty()) { - fileOut.setName( outputFile ); - if (!fileOut.open( IO_WriteOnly ) ) - tqFatal( "pyuic: Could not open output file '%s'", (const char *)outputFile ); - } else { - fileOut.open( IO_WriteOnly, stdout ); - } - TQTextStream out( &fileOut ); - out.setEncoding( TQTextStream::UnicodeUTF8 ); - - TQDomDocument doc; - if ( !doc.setContent( &file ) ) - tqFatal( "pyuic: Failed to parse %s\n", (const char *)fileName ); - - out << "# Form implementation generated from reading ui file '" << fileName << "'" << endl; - out << "#" << endl; - out << "# Created by: The Python User Interface Compiler (pyuic) " << PYTQT_VERSION << endl; - out << "#" << endl; - out << "# WARNING! All changes made in this file will be lost!" << endl; - out << endl; - out << endl; - - if (execCode) - out << "import sys" << endl; - - out << "from python_tqt.qt import *" << endl; - - Uic( out, doc, trmacro.isEmpty() ? TQString("self.tr") : trmacro ); - - if (execCode) { - out << endl; - out << endl; - out << "if __name__ == '__main__':" << endl; - out << " a = TQApplication(sys.argv)" << endl; - out << " TQObject.connect(a,SIGNAL('lastWindowClosed()'),a,SLOT('quit()'))" << endl; - out << " w = " << className << "()" << endl; - out << " a.setMainWidget(w)" << endl; - out << " w.show()" << endl; - out << " a.exec_loop()" << endl; - } - - return 0; -} diff --git a/pyuic2/uic.h b/pyuic2/uic.h deleted file mode 100644 index b772aca..0000000 --- a/pyuic2/uic.h +++ /dev/null @@ -1,133 +0,0 @@ -/********************************************************************** -** Copyright (C) 2000 Troll Tech AS. All rights reserved. -** Copyright (C) 2000, 2001 Phil Thompson -** -** This file is part of TQt GUI Designer. -** -** This file may be distributed under the terms of the GNU General -** Public License version 2 as published by the Free Software -** Foundation and appearing in the file COPYING included in the -** packaging of this file. If you did not get the file, send email -** to info@trolltech.com -** -** The file is provided AS IS with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. -** -**********************************************************************/ - -#ifndef UIC_H -#define UIC_H - -#include -#include -#include -#include -#include -#include -#include - - -#define PYTQT_VERSION "3.18.1" - - -class Uic : public TQt -{ -public: - Uic( TQTextStream& out, TQDomDocument doc, const TQString &trm ); - - void createFormImpl( const TQDomElement &e ); - - TQString createObjectImpl( const TQDomElement &e, const TQString& parentClass, const TQString& parent, const TQString& layout = TQString::null ); - TQString createLayoutImpl( const TQDomElement &e, const TQString& parentClass, const TQString& parent, const TQString& layout = TQString::null ); - TQString createObjectInstance( const TQString& objClass, const TQString& parent, const TQString& objName ); - TQString createSpacerImpl( const TQDomElement &e, const TQString& parentClass, const TQString& parent, const TQString& layout = TQString::null ); - void createExclusiveProperty( const TQDomElement & e, const TQString& exclusiveProp ); - TQString createListBoxItemImpl( const TQDomElement &e, const TQString &parent ); - TQString createIconViewItemImpl( const TQDomElement &e, const TQString &parent ); - TQString createListViewColumnImpl( const TQDomElement &e, const TQString &parent ); - TQString createListViewItemImpl( const TQDomElement &e, const TQString &parent, - const TQString &parentItem ); - void createColorGroupImpl( const TQString& cg, const TQDomElement& e ); - TQColorGroup loadColorGroup( const TQDomElement &e ); - - TQString getClassName( const TQDomElement& e ); - TQString getObjectName( const TQDomElement& e ); - TQString getLayoutName( const TQDomElement& e ); - - TQString setObjectProperty( const TQString& objClass, const TQString& obj, const TQString &prop, const TQDomElement &e, bool stdset ); - - TQString registerObject( const TQString& name ); - TQString registeredName( const TQString& name ); - bool isObjectRegistered( const TQString& name ); - TQStringList unique( const TQStringList& ); - -private: - void pushIndent() - { - ++nrindents; - setIndent(); - } - - void popIndent() - { - --nrindents; - setIndent(); - } - - void setIndent() - { - indent = ""; - - for (int i = 0; i < nrindents; ++i) - indent += newindent; - } - - void initIndent() - { - newindent = " "; - indent = ""; - nrindents = 0; - } - - TQString indent, newindent; - int nrindents; - - TQTextStream& out; - TQStringList objectNames; - TQMap objectMapper; - TQStringList tags; - TQStringList layouts; - TQString formName; - TQString lastItem; - TQString trmacro; - - struct Buddy - { - Buddy( const TQString& k, const TQString& b ) - : key( k ), buddy( b ) {} - Buddy(){}; // for valuelist - TQString key; - TQString buddy; - bool operator==( const Buddy& other ) const - { return (key == other.key); } - }; - struct CustomInclude - { - TQString header; - TQString location; - }; - TQValueList buddies; - - TQStringList layoutObjects; - bool isLayout( const TQString& name ) const; - - uint item_used : 1; - uint cg_used : 1; - uint pal_used : 1; - - TQString pixmapLoaderFunction; - TQString nameOfClass; -}; - -#endif diff --git a/pyuic2/widgetdatabase.cpp b/pyuic2/widgetdatabase.cpp deleted file mode 100644 index c241ad0..0000000 --- a/pyuic2/widgetdatabase.cpp +++ /dev/null @@ -1,640 +0,0 @@ -/********************************************************************** -** Copyright (C) 2000 Trolltech AS. All rights reserved. -** -** This file is part of TQt Designer. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.trolltech.com/gpl/ for GPL licensing information. -** -** Contact info@trolltech.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - -#include // HP-UX compiler needs this here - -#include "widgetdatabase.h" - -#if defined(DESIGNER) -#include "../designer/formwindow.h" -#include "../designer/pixmapchooser.h" -#endif - -//#include "../integration/tdevelop/tdewidgets.h" - -#include -#include -#include -#include -#include - -#include - -const int dbsize = 300; -const int dbcustom = 200; -const int dbdictsize = 211; -static WidgetDatabaseRecord* db[ dbsize ]; -static TQDict *className2Id = 0; -static int dbcount = 0; -static int dbcustomcount = 200; -static TQStrList *wGroups; -static TQStrList *invisibleGroups; -static bool whatsThisLoaded = FALSE; - - -WidgetDatabaseRecord::WidgetDatabaseRecord() -{ - isContainer = FALSE; - icon = 0; - nameCounter = 0; -} - -WidgetDatabaseRecord::~WidgetDatabaseRecord() -{ - delete icon; -} - - -/*! - \class WidgetDatabase widgetdatabase.h - \brief The WidgetDatabase class holds information about widgets - - The WidgetDatabase holds information about widgets like toolTip(), - iconSet(), ... It works Id-based, so all access functions take the - widget id as parameter. To get the id for a widget (classname), use - idFromClassName(). - - All access functions are static. Having multiple widgetdatabases in - one application doesn't make sense anyway and so you don't need more - than an instance of the widgetdatabase. - - For creating widgets, layouts, etc. see WidgetFactory. -*/ - -/*! - Creatse widget database. Does nothing -*/ - -WidgetDatabase::WidgetDatabase() -{ -} - -/*! Sets up the widget database. If the static widgetdatabase already - exists, the functions returns immediately. -*/ - -void WidgetDatabase::setupDataBase() -{ - if ( dbcount ) - return; - - wGroups = new TQStrList; - invisibleGroups = new TQStrList; - invisibleGroups->append( "Forms" ); - invisibleGroups->append( "Temp" ); - className2Id = new TQDict( dbdictsize ); - className2Id->setAutoDelete( TRUE ); - - WidgetDatabaseRecord *r = 0; - - r = new WidgetDatabaseRecord; - r->iconSet = "pushbutton.xpm"; - r->name = "TQPushButton"; - r->group = widgetGroup( "Buttons" ); - r->toolTip = "Push Button"; - - append( r ); - - r = new WidgetDatabaseRecord; - r->iconSet = "toolbutton.xpm"; - r->name = "TQToolButton"; - r->group = widgetGroup( "Buttons" ); - r->toolTip = "Tool Button"; - - append( r ); - - r = new WidgetDatabaseRecord; - r->iconSet = "radiobutton.xpm"; - r->name = "TQRadioButton"; - r->group = widgetGroup( "Buttons" ); - r->toolTip = "Radio Button"; - - append( r ); - - r = new WidgetDatabaseRecord; - r->iconSet = "checkbox.xpm"; - r->name = "TQCheckBox"; - r->group = widgetGroup( "Buttons" ); - r->toolTip = "Check Box"; - - - - - append( r ); - r = new WidgetDatabaseRecord; - r->iconSet = "groupbox.xpm"; - r->name = "TQGroupBox"; - r->group = widgetGroup( "Containers" ); - r->toolTip = "Group Box"; - r->isContainer = TRUE; - - append( r ); - - r = new WidgetDatabaseRecord; - r->iconSet = "buttongroup.xpm"; - r->name = "TQButtonGroup"; - r->group = widgetGroup( "Containers" ); - r->toolTip = "Button Group"; - r->isContainer = TRUE; - - append( r ); - - r = new WidgetDatabaseRecord; - r->iconSet = "frame.xpm"; - r->name = "TQFrame"; - r->group = widgetGroup( "Containers" ); - r->toolTip = "Frame"; - r->isContainer = TRUE; - - append( r ); - - r = new WidgetDatabaseRecord; - r->iconSet = "tabwidget.xpm"; - r->name = "TQTabWidget"; - r->group = widgetGroup( "Containers" ); - r->toolTip = "Tabwidget"; - r->isContainer = TRUE; - - append( r ); - - - r = new WidgetDatabaseRecord; - r->iconSet = "listbox.xpm"; - r->name = "TQListBox"; - r->group = widgetGroup( "Views" ); - r->toolTip = "List Box"; - - append( r ); - - r = new WidgetDatabaseRecord; - r->iconSet = "listview.xpm"; - r->name = "TQListView"; - r->group = widgetGroup( "Views" ); - r->toolTip = "List View"; - - append( r ); - -#if defined(TQT_MODULE_ICONVIEW) || defined(UIC) - r = new WidgetDatabaseRecord; - r->iconSet = "iconview.xpm"; - r->name = "TQIconView"; - r->group = widgetGroup( "Views" ); - r->toolTip = "Icon View"; - - append( r ); -#endif - -#if defined(TQT_MODULE_TABLE) - r = new WidgetDatabaseRecord; - r->iconSet = "table.xpm"; - r->name = "TQTable"; - r->group = widgetGroup( "Views" ); - r->toolTip = "Table"; - - append( r ); -#endif - - - r = new WidgetDatabaseRecord; - r->iconSet = "lineedit.xpm"; - r->name = "TQLineEdit"; - r->group = widgetGroup( "Input" ); - r->toolTip = "Line Edit"; - - append( r ); - - r = new WidgetDatabaseRecord; - r->iconSet = "spinbox.xpm"; - r->name = "TQSpinBox"; - r->group = widgetGroup( "Input" ); - r->toolTip = "Spin Box"; - - append( r ); - - r = new WidgetDatabaseRecord; - r->iconSet = "multilineedit.xpm"; - r->name = "TQMultiLineEdit"; - r->group = widgetGroup( "Input" ); - r->toolTip = "Multi Line Edit"; - - append( r ); - - r = new WidgetDatabaseRecord; - r->iconSet = "combobox.xpm"; - r->name = "TQComboBox"; - r->group = widgetGroup( "Input" ); - r->toolTip = "Combo Box"; - - append( r ); - - r = new WidgetDatabaseRecord; - r->iconSet = "slider.xpm"; - r->name = "TQSlider"; - r->group = widgetGroup( "Input" ); - r->toolTip = "Slider"; - - append( r ); - - r = new WidgetDatabaseRecord; - r->iconSet = "dial.xpm"; - r->name = "TQDial"; - r->group = widgetGroup( "Input" ); - r->toolTip = "Dial"; - - append( r ); - - r = new WidgetDatabaseRecord; - r->iconSet = "label.xpm"; - r->name = "TQLabel"; - r->group = widgetGroup( "Temp" ); - r->toolTip = "Label"; - - append( r ); - - r = new WidgetDatabaseRecord; - r->iconSet = "label.xpm"; - r->name = "TextLabel"; - r->group = widgetGroup( "Display" ); - r->toolTip = "Text Label"; - r->whatsThis = "The Text Label provides a widget to display static text."; - - append( r ); - - r = new WidgetDatabaseRecord; - r->iconSet = "pixlabel.xpm"; - r->name = "PixmapLabel"; - r->group = widgetGroup( "Display" ); - r->toolTip = "Pixmap Label"; - r->whatsThis = "The Pixmap Label provides a widget to display pixmaps."; - - append( r ); - - r = new WidgetDatabaseRecord; - r->iconSet = "lcdnumber.xpm"; - r->name = "TQLCDNumber"; - r->group = widgetGroup( "Display" ); - r->toolTip = "LCD Number"; - - append( r ); - - r = new WidgetDatabaseRecord; - r->iconSet = "line.xpm"; - r->name = "Line"; - r->group = widgetGroup( "Display" ); - r->toolTip = "Line"; - r->includeFile = "qframe.h"; - r->whatsThis = "The Line widget provides horizontal and vertical lines."; - - append( r ); - - r = new WidgetDatabaseRecord; - r->iconSet = "progress.xpm"; - r->name = "TQProgressBar"; - r->group = widgetGroup( "Display" ); - r->toolTip = "Progress Bar"; - - append( r ); - - r = new WidgetDatabaseRecord; - r->iconSet = "textview.xpm"; - r->name = "TQTextView"; - r->group = widgetGroup( "Display" ); - r->toolTip = "Text View"; - - append( r ); - - r = new WidgetDatabaseRecord; - r->iconSet = "textbrowser.xpm"; - r->name = "TQTextBrowser"; - r->group = widgetGroup( "Display" ); - r->toolTip = "Text Browser"; - - append( r ); - - r = new WidgetDatabaseRecord; - r->iconSet = "spacer.xpm"; - r->name = "Spacer"; - r->group = widgetGroup( "Temp" ); - r->toolTip = "Spacer"; - r->whatsThis = "The Spacer provides horizontal and vertical spacing to be able to manipulate the bahviour of layouts."; - - append( r ); - - r = new WidgetDatabaseRecord; - r->name = "TQWidget"; - r->isContainer = FALSE; - r->group = widgetGroup( "Forms" ); - - append( r ); - - r = new WidgetDatabaseRecord; - r->name = "TQDialog"; - r->group = widgetGroup( "Forms" ); - r->isContainer = FALSE; - - append( r ); - - r = new WidgetDatabaseRecord; - r->name = "TQWizard"; - r->group = widgetGroup( "Forms" ); - r->isContainer = TRUE; - - append( r ); - - r = new WidgetDatabaseRecord; - r->name = "TQDesignerWizard"; - r->group = widgetGroup( "Forms" ); - r->isContainer = TRUE; - - append( r ); - - r = new WidgetDatabaseRecord; - r->name = "TQLayoutWidget"; - r->group = widgetGroup( "Temp" ); - r->includeFile = ""; - r->isContainer = TRUE; - - append( r ); - - r = new WidgetDatabaseRecord; - r->iconSet = "tabwidget.xpm"; - r->name = "TQDesignerTabWidget"; - r->group = widgetGroup( "Temp" ); - r->isContainer = TRUE; - - append( r ); - - r = new WidgetDatabaseRecord; - r->iconSet = "tabwidget.xpm"; - r->name = "TQDesignerWidget"; - r->group = widgetGroup( "Temp" ); - r->isContainer = TRUE; - - append( r ); - - r = new WidgetDatabaseRecord; - r->iconSet = "tabwidget.xpm"; - r->name = "TQDesignerDialog"; - r->group = widgetGroup( "Temp" ); - r->isContainer = TRUE; - - append( r ); - -// tqt_init_kde_widget_database(); -} - -/*! - Returns the number of elements in the widget database. -*/ - -int WidgetDatabase::count() -{ - setupDataBase(); - return dbcount; -} - -/*! - Returns the id at which the ids of custom widgets start. -*/ - -int WidgetDatabase::startCustom() -{ - setupDataBase(); - return dbcustom; -} - -/*! Returns the iconset which represents the class registered as \a - id. -*/ - -TQIconSet WidgetDatabase::iconSet( int id ) -{ - setupDataBase(); - WidgetDatabaseRecord *r = at( id ); - if ( !r ) - return TQIconSet(); -#if defined(DESIGNER) - if ( !r->icon ) - r->icon = new TQIconSet( PixmapChooser::loadPixmap( r->iconSet, PixmapChooser::Small ), - PixmapChooser::loadPixmap( r->iconSet, PixmapChooser::Large ) ); - return *r->icon; -#endif - - return TQIconSet(); -} - -/*! - Returns the classname of the widget which is registered as \a id. -*/ - -TQString WidgetDatabase::className( int id ) -{ - setupDataBase(); - WidgetDatabaseRecord *r = at( id ); - if ( !r ) - return TQString::null; - return r->name; -} - -/*! - Returns the group to which the widget registered as \a id belongs. -*/ - -TQString WidgetDatabase::group( int id ) -{ - setupDataBase(); - WidgetDatabaseRecord *r = at( id ); - if ( !r ) - return TQString::null; - return r->group; -} - -/*! Returns the tooltip text of the widget which is registered as \a - id. -*/ - -TQString WidgetDatabase::toolTip( int id ) -{ - setupDataBase(); - WidgetDatabaseRecord *r = at( id ); - if ( !r ) - return TQString::null; - return r->toolTip; -} - -/*! Returns the what's this? test of the widget which is registered - as \a id. -*/ - -TQString WidgetDatabase::whatsThis( int id ) -{ - setupDataBase(); - WidgetDatabaseRecord *r = at( id ); - if ( !r ) - return TQString::null; - return r->whatsThis; -} - -/*! - Returns the include file if the widget which is registered as \a id. -*/ - -TQString WidgetDatabase::includeFile( int id ) -{ - setupDataBase(); - WidgetDatabaseRecord *r = at( id ); - if ( !r ) - return TQString::null; - if ( r->includeFile.isNull() ) - return r->name.lower() + ".h"; - return r->includeFile; -} - -/*! Returns wheather the widget registered as \a id is a container - (can have children) or not. -*/ - -bool WidgetDatabase::isContainer( int id ) -{ - setupDataBase(); - WidgetDatabaseRecord *r = at( id ); - if ( !r ) - return FALSE; - return r->isContainer; -} - -TQString WidgetDatabase::createWidgetName( int id ) -{ - setupDataBase(); - TQString n = className( id ); - if ( n == "TQLayoutWidget" ) - n = "Layout"; - if ( n[ 0 ] == 'Q' ) - n = n.mid( 1 ); - WidgetDatabaseRecord *r = at( id ); - if ( !r ) - return n; - n += TQString::number( ++r->nameCounter ); - return n; -} - -/*! Returns the id for \a name or -1 if \a name is unknown. - */ -int WidgetDatabase::idFromClassName( const TQString &name ) -{ - setupDataBase(); - if ( name.isEmpty() ) - return 0; - int *i = className2Id->find( name ); - if ( i ) - return *i; - if ( name == "FormWindow" ) - return idFromClassName( "TQLayoutWidget" ); - return -1; -} - -WidgetDatabaseRecord *WidgetDatabase::at( int index ) -{ - if ( index < 0 ) - return 0; - if ( index >= dbcustom && index < dbcustomcount ) - return db[ index ]; - if ( index < dbcount ) - return db[ index ]; - return 0; -} - -void WidgetDatabase::insert( int index, WidgetDatabaseRecord *r ) -{ - if ( index < 0 || index >= dbsize ) - return; - db[ index ] = r; - className2Id->insert( r->name, new int( index ) ); - if ( index < dbcustom ) - dbcount = TQMAX( dbcount, index ); -} - -void WidgetDatabase::append( WidgetDatabaseRecord *r ) -{ - insert( dbcount++, r ); -} - -TQString WidgetDatabase::widgetGroup( const TQString &g ) -{ - if ( wGroups->find( g ) == -1 ) - wGroups->append( g ); - return g; -} - -TQString WidgetDatabase::widgetGroup( int i ) -{ - setupDataBase(); - if ( i >= 0 && i < (int)wGroups->count() ) - return wGroups->at( i ); - return TQString::null; -} - -int WidgetDatabase::numWidgetGroups() -{ - setupDataBase(); - return wGroups->count(); -} - -bool WidgetDatabase::isGroupVisible( const TQString &g ) -{ - setupDataBase(); - return invisibleGroups->find( g ) == -1; -} - -int WidgetDatabase::addCustomWidget( WidgetDatabaseRecord *r ) -{ - insert( dbcustomcount++, r ); - return dbcustomcount - 1; -} - -bool WidgetDatabase::isCustomWidget( int id ) -{ - if ( id >= dbcustom && id < dbcustomcount ) - return TRUE; - return FALSE; -} - -bool WidgetDatabase::isWhatsThisLoaded() -{ - return whatsThisLoaded; -} - -void WidgetDatabase::loadWhatsThis( const TQString &docPath ) -{ - TQString whatsthisFile = docPath + "/whatsthis"; - TQFile f( whatsthisFile ); - if ( !f.open( IO_ReadOnly ) ) - return; - TQTextStream ts( &f ); - while ( !ts.atEnd() ) { - TQString s = ts.readLine(); - TQStringList l = TQStringList::split( " | ", s ); - int id = idFromClassName( l[ 1 ] ); - WidgetDatabaseRecord *r = at( id ); - if ( r ) - r->whatsThis = l[ 0 ]; - } - whatsThisLoaded = TRUE; -} diff --git a/pyuic2/widgetdatabase.h b/pyuic2/widgetdatabase.h deleted file mode 100644 index 9a44919..0000000 --- a/pyuic2/widgetdatabase.h +++ /dev/null @@ -1,75 +0,0 @@ -/********************************************************************** -** Copyright (C) 2000 Trolltech AS. All rights reserved. -** -** This file is part of TQt Designer. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.trolltech.com/gpl/ for GPL licensing information. -** -** Contact info@trolltech.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - -#ifndef WIDGETDATABASE_H -#define WIDGETDATABASE_H - -#include -#include -#include - -struct WidgetDatabaseRecord -{ - WidgetDatabaseRecord(); - ~WidgetDatabaseRecord(); - TQString iconSet, name, group, toolTip, whatsThis, includeFile; - uint isContainer : 1; - TQIconSet *icon; - int nameCounter; -}; - -class WidgetDatabase : public TQt -{ -public: - WidgetDatabase(); - static void setupDataBase(); - - static int count(); - static int startCustom(); - - static TQIconSet iconSet( int id ); - static TQString className( int id ); - static TQString group( int id ); - static TQString toolTip( int id ); - static TQString whatsThis( int id ); - static TQString includeFile( int id ); - static bool isContainer( int id ); - - static int idFromClassName( const TQString &name ); - static TQString createWidgetName( int id ); - - static WidgetDatabaseRecord *at( int index ); - static void insert( int index, WidgetDatabaseRecord *r ); - static void append( WidgetDatabaseRecord *r ); - - static TQString widgetGroup( const TQString &g ); - static TQString widgetGroup( int i ); - static int numWidgetGroups(); - static bool isGroupVisible( const TQString &g ); - - static int addCustomWidget( WidgetDatabaseRecord *r ); - static bool isCustomWidget( int id ); - - static bool isWhatsThisLoaded(); - static void loadWhatsThis( const TQString &docPath ); - -}; - -#endif -- cgit v1.2.3