├── .idea ├── .name ├── PyQT-Exaples.iml ├── encodings.xml ├── misc.xml ├── modules.xml ├── scopes │ └── scope_settings.xml └── vcs.xml ├── README.txt ├── chap01 ├── answers.txt └── hello.py ├── chap02 ├── answers.py ├── frange.py └── simplified.py ├── chap03 ├── SortedDict.py ├── __init__.py ├── balloon.py ├── dimension.py ├── item.py ├── length.py ├── ordereddict.py ├── rectangle.py ├── stack.py └── tribool.py ├── chap04 ├── alert.pyw ├── alert_extra.pyw ├── calculate.pyw ├── connections.pyw ├── currency.pyw ├── currency2.pyw ├── interest.pyw └── signals.pyw ├── chap05 ├── numberformatdlg1.py ├── numberformatdlg2.py ├── numberformatdlg3.py ├── numbers.pyw ├── pen.pyw ├── stringlistdlg.py └── stringlistdlg_bonus.pyw ├── chap06 ├── MainWindow.py ├── MainWindow_ans.py ├── help │ ├── editmenu.html │ ├── filemenu.html │ └── index.html ├── helpform.py ├── imagechanger.pyw ├── imagechanger_ans.pyw ├── images │ ├── back.png │ ├── editinvert.png │ ├── editmirror.png │ ├── editmirrorhoriz.png │ ├── editmirrorvert.png │ ├── editresize.png │ ├── editswap.png │ ├── editunmirror.png │ ├── editzoom.png │ ├── filenew.png │ ├── fileopen.png │ ├── fileprint.png │ ├── filequit.png │ ├── filesave.png │ ├── filesaveas.png │ ├── home.png │ └── icon.png ├── newimagedlg.py ├── newimagedlg.ui ├── resizedlg.py └── resources.qrc ├── chap07 ├── findandreplacedlg.py ├── findandreplacedlg.ui ├── ticketorderdlg.py ├── ticketorderdlg1.ui └── ticketorderdlg2.ui ├── chap08 ├── addeditmoviedlg.py ├── addeditmoviedlg.ui ├── addeditmoviedlg_ans.py ├── addeditmoviedlg_ans.ui ├── images │ ├── editadd.png │ ├── editdelete.png │ ├── editedit.png │ ├── filenew.png │ ├── fileopen.png │ ├── filequit.png │ ├── filesave.png │ ├── filesaveas.png │ └── icon.png ├── moviedata.py ├── moviedata_ans.py ├── mymovies.mqb ├── mymovies.pyw ├── mymovies_ans.pyw └── resources.qrc ├── chap09 ├── bill-of-rights.txt ├── findandreplacedlg.py ├── findandreplacedlg.pyw ├── findandreplacedlg.ui ├── human-rights.txt ├── images │ ├── editadd.png │ ├── editcopy.png │ ├── editcut.png │ ├── editdelete.png │ ├── editedit.png │ ├── editpaste.png │ ├── filenew.png │ ├── fileopen.png │ ├── filequit.png │ ├── filesave.png │ ├── filesaveas.png │ └── icon.png ├── independence.txt ├── newsreader.pyw ├── paymentdlg.py ├── paymentdlg.pyw ├── paymentdlg.ui ├── resources.qrc ├── sditexteditor.pyw ├── sditexteditor2.pyw ├── tabbededitor.pyw ├── textedit.py ├── texteditor.pyw ├── vehiclerentaldlg.py ├── vehiclerentaldlg.pyw └── vehiclerentaldlg.ui ├── chap10 ├── clipboard.pyw ├── customdraganddrop.pyw ├── customdraganddrop_ans.pyw ├── draganddrop.pyw ├── events.pyw └── images │ ├── abiword.png │ ├── blender.png │ ├── clock.png │ ├── designer.png │ ├── emacs.png │ ├── firefox.png │ ├── gnumeric.png │ ├── gv.png │ ├── gvim.png │ ├── kwin.png │ ├── mozilla.png │ ├── nedit.png │ ├── opera.png │ ├── penguin.png │ ├── scribus.png │ ├── tux.png │ ├── usb.png │ ├── vnc.png │ └── x.png ├── chap11 ├── contactdlg.py ├── counters.py ├── counters_dnd.py ├── fractionslider.py ├── labelledwidgets.py ├── romanspinbox.py └── ypipewidget.py ├── chap12 ├── multipedes.pyw ├── multipedes2.pyw ├── multipedes3.pyw ├── pagedesigner.pyw └── pagedesigner_ans.pyw ├── chap13 ├── images │ ├── editadd.png │ ├── editcopy.png │ ├── editcut.png │ ├── editdelete.png │ ├── editedit.png │ ├── editindent.png │ ├── editpaste.png │ ├── editunindent.png │ ├── filenew.png │ ├── fileopen.png │ ├── filequit.png │ ├── filesave.png │ ├── filesaveas.png │ ├── icon.png │ └── logo.png ├── printing.pyw ├── printing2.pyw ├── pythoneditor.pyw ├── pythoneditor2.pyw ├── pythoneditor_ans.pyw ├── resources.qrc └── richtextlineedit.py ├── chap14 ├── richtextlineedit.py ├── ships-delegate.pyw ├── ships-delegate_ans.pyw ├── ships-dict.pyw ├── ships-model.pyw ├── ships.py └── ships_ans.py ├── chap15 ├── assetmanager.pyw ├── images │ ├── add.png │ ├── assetmanagersplash.png │ ├── delete.png │ ├── first.png │ ├── last.png │ ├── next.png │ ├── phonelogsplash.png │ ├── prev.png │ └── quit.png ├── phonelog-fk.pyw ├── phonelog-fk2.pyw ├── phonelog.pyw ├── referencedata.pyw └── resources.qrc ├── chap16 ├── bargrapher.pyw ├── carhirelog.pyw ├── flags │ ├── Aaland.png │ ├── Abkhazia.png │ ├── Afghanistan.png │ ├── Albania.png │ ├── Algeria.png │ ├── American_Samoa.png │ ├── Andorra.png │ ├── Angola.png │ ├── Anguilla.png │ ├── Antigua_and_Barbuda.png │ ├── Argentina.png │ ├── Armenia.png │ ├── Aruba.png │ ├── Australia.png │ ├── Austria.png │ ├── Azerbaijan.png │ ├── Bahamas.png │ ├── Bahrain.png │ ├── Bangladesh.png │ ├── Barbados.png │ ├── Belarus.png │ ├── Belgium.png │ ├── Belize.png │ ├── Benin.png │ ├── Bermuda.png │ ├── Bhutan.png │ ├── Bolivia_state.png │ ├── Bosnia_and_Herzegovina.png │ ├── Botswana.png │ ├── Brazil.png │ ├── British_Virgin_Islands.png │ ├── Brunei.png │ ├── Bulgaria.png │ ├── Burkina_Faso.png │ ├── Burundi.png │ ├── Cambodia.png │ ├── Cameroon.png │ ├── Canada.png │ ├── Cape_Verde.png │ ├── Cayman_Islands.png │ ├── Central_African_Republic.png │ ├── Chad.png │ ├── Chile.png │ ├── Christmas_Island.png │ ├── Cocos_Keeling_Islands.png │ ├── Colombia.png │ ├── Comoros.png │ ├── Cook_Islands.png │ ├── Costa_Rica.png │ ├── Cote_dIvoire.png │ ├── Croatia.png │ ├── Cuba.png │ ├── Cyprus.png │ ├── Czech_Republic.png │ ├── Democratic_Republic_of_the_Congo.png │ ├── Denmark.png │ ├── Djibouti.png │ ├── Dominica.png │ ├── Dominican_Republic.png │ ├── East_Timor.png │ ├── Ecuador.png │ ├── Egypt.png │ ├── El_Salvador.png │ ├── Equatorial_Guinea.png │ ├── Eritrea.png │ ├── Estonia.png │ ├── Ethiopia.png │ ├── Falkland_Islands.png │ ├── Faroe_Islands.png │ ├── Fiji.png │ ├── Finland.png │ ├── France.png │ ├── French_Polynesia.png │ ├── Gabon.png │ ├── Georgia.png │ ├── Germany.png │ ├── Ghana.png │ ├── Gibraltar.png │ ├── Greece.png │ ├── Greenland.png │ ├── Grenada.png │ ├── Guam.png │ ├── Guatemala.png │ ├── Guernsey.png │ ├── Guinea-Bissau.png │ ├── Guinea.png │ ├── Guyana.png │ ├── Haiti.png │ ├── Honduras.png │ ├── Hong_Kong.png │ ├── Hungary.png │ ├── Iceland.png │ ├── India.png │ ├── Indonesia.png │ ├── Iran.png │ ├── Iraq.png │ ├── Ireland.png │ ├── Isle_of_Man.png │ ├── Israel.png │ ├── Italy.png │ ├── Jamaica.png │ ├── Japan.png │ ├── Jersey.png │ ├── Jordan.png │ ├── Kazakhstan.png │ ├── Kenya.png │ ├── Kiribati.png │ ├── Kuwait.png │ ├── Kyrgyzstan.png │ ├── Laos.png │ ├── Latvia.png │ ├── Lebanon.png │ ├── Lesotho.png │ ├── Liberia.png │ ├── Libya.png │ ├── Liechtenstein.png │ ├── Lithuania.png │ ├── Luxembourg.png │ ├── Macau.png │ ├── Macedonia.png │ ├── Madagascar.png │ ├── Malawi.png │ ├── Malaysia.png │ ├── Maldives.png │ ├── Mali.png │ ├── Malta.png │ ├── Marshall_Islands.png │ ├── Mauritania.png │ ├── Mauritius.png │ ├── Mexico.png │ ├── Micronesia.png │ ├── Moldova.png │ ├── Monaco.png │ ├── Mongolia.png │ ├── Montenegro.png │ ├── Montserrat.png │ ├── Morocco.png │ ├── Mozambique.png │ ├── Myanmar.png │ ├── Nagorno-Karabakh.png │ ├── Namibia.png │ ├── Nauru.png │ ├── Nepal.png │ ├── Netherlands.png │ ├── Netherlands_Antilles.png │ ├── New_Zealand.png │ ├── Nicaragua.png │ ├── Niger.png │ ├── Nigeria.png │ ├── Niue.png │ ├── Norfolk_Island.png │ ├── North_Korea.png │ ├── Northern_Mariana_Islands.png │ ├── Norway.png │ ├── Oman.png │ ├── Pakistan.png │ ├── Palau.png │ ├── Panama.png │ ├── Papua_New_Guinea.png │ ├── Paraguay.png │ ├── Peoples_Republic_of_China.png │ ├── Peru.png │ ├── Philippines.png │ ├── Pitcairn_Islands.png │ ├── Poland.png │ ├── Portugal.png │ ├── Puerto_Rico.png │ ├── Qatar.png │ ├── Republic_of_China.png │ ├── Republic_of_the_Congo.png │ ├── Romania.png │ ├── Russia.png │ ├── Rwanda.png │ ├── Saint_Helena.png │ ├── Saint_Kitts_and_Nevis.png │ ├── Saint_Lucia.png │ ├── Saint_Vincent_and_the_Grenadines.png │ ├── Samoa.png │ ├── San_Marino.png │ ├── Sao_Tome_and_Principe.png │ ├── Saudi_Arabia.png │ ├── Senegal.png │ ├── Serbia_state.png │ ├── Seychelles.png │ ├── Sierra_Leone.png │ ├── Singapore.png │ ├── Slovakia.png │ ├── Slovenia.png │ ├── Solomon_Islands.png │ ├── Somalia.png │ ├── Somaliland.png │ ├── South_Africa.png │ ├── South_Korea.png │ ├── South_Ossetia.png │ ├── Spain.png │ ├── Sri_Lanka.png │ ├── Sudan.png │ ├── Suriname.png │ ├── Swaziland.png │ ├── Sweden.png │ ├── Switzerland.png │ ├── Syria.png │ ├── Tajikistan.png │ ├── Tanzania.png │ ├── Thailand.png │ ├── The_Gambia.png │ ├── Togo.png │ ├── Tokelau_local.png │ ├── Tonga.png │ ├── Transnistria.png │ ├── Trinidad_and_Tobago.png │ ├── Tristan_da_Cunha.png │ ├── Tunisia.png │ ├── Turkey.png │ ├── Turkish_Republic_of_Northern_Cyprus.png │ ├── Turkmenistan.png │ ├── Turks_and_Caicos_Islands.png │ ├── Tuvalu.png │ ├── USA.png │ ├── USA_Alabama.png │ ├── USA_Alaska.png │ ├── USA_Arizona.png │ ├── USA_Arkansas.png │ ├── USA_California.png │ ├── USA_Colorado.png │ ├── USA_Connecticut.png │ ├── USA_Delaware.png │ ├── USA_Florida.png │ ├── USA_Georgia.png │ ├── USA_Hawaii.png │ ├── USA_Idaho.png │ ├── USA_Illinois.png │ ├── USA_Indiana.png │ ├── USA_Iowa.png │ ├── USA_Kansas.png │ ├── USA_Kentucky.png │ ├── USA_Louisiana.png │ ├── USA_Maine.png │ ├── USA_Maryland.png │ ├── USA_Massachusetts.png │ ├── USA_Michigan.png │ ├── USA_Minnesota.png │ ├── USA_Mississippi.png │ ├── USA_Missouri.png │ ├── USA_Montana.png │ ├── USA_Nebraska.png │ ├── USA_Nevada.png │ ├── USA_New_Hampshire.png │ ├── USA_New_Jersey.png │ ├── USA_New_Mexico.png │ ├── USA_New_York.png │ ├── USA_North_Carolina.png │ ├── USA_North_Dakota.png │ ├── USA_Ohio.png │ ├── USA_Oklahoma.png │ ├── USA_Oregon.png │ ├── USA_Pennsylvania.png │ ├── USA_Rhode_Island.png │ ├── USA_South_Carolina.png │ ├── USA_South_Dakota.png │ ├── USA_Tennessee.png │ ├── USA_Texas.png │ ├── USA_Utah.png │ ├── USA_Vermont.png │ ├── USA_Virginia.png │ ├── USA_Washington.png │ ├── USA_West_Virginia.png │ ├── USA_Wisconsin.png │ ├── USA_Wyoming.png │ ├── Uganda.png │ ├── Ukraine.png │ ├── United_Arab_Emirates.png │ ├── United_Kingdom.png │ ├── United_Nations.png │ ├── United_States_Virgin_Islands.png │ ├── Uruguay.png │ ├── Uzbekistan.png │ ├── Vanuatu.png │ ├── Vatican_City.png │ ├── Venezuela.png │ ├── Vietnam.png │ ├── Western_Sahara.png │ ├── Yemen.png │ ├── Zambia.png │ └── Zimbabwe.png ├── genericdelegates.py ├── iss013-e-14802.jpg ├── richtextlineedit.py ├── serverinfo.pyw ├── servers.txt ├── surnames.txt.gz ├── treeoftable.py ├── waterdata.csv.gz └── waterquality.pyw ├── chap17 ├── help │ ├── editmenu.html │ ├── editmenu_fr.html │ ├── filemenu.html │ ├── filemenu_fr.html │ ├── index.html │ └── index_fr.html ├── helpform.py ├── imagechanger.pro ├── imagechanger.pyw ├── imagechanger_fr.qm ├── imagechanger_fr.ts ├── images │ ├── back.png │ ├── editinvert.png │ ├── editmirror.png │ ├── editmirrorhoriz.png │ ├── editmirrorvert.png │ ├── editresize.png │ ├── editswap.png │ ├── editunmirror.png │ ├── editzoom.png │ ├── filenew.png │ ├── fileopen.png │ ├── fileprint.png │ ├── filequit.png │ ├── filesave.png │ ├── filesaveas.png │ ├── home.png │ └── icon.png ├── newimagedlg.py ├── newimagedlg.ui ├── resizedlg.py └── resources.qrc ├── chap18 ├── buildingservicesclient.pyw ├── buildingservicesclient_ans.pyw ├── buildingservicesserver.pyw └── buildingservicesserver_ans.pyw ├── chap19 ├── buildingservicesclient.pyw ├── buildingservicesserver.pyw ├── pageindexer.pyw ├── pageindexer_26.pyw ├── pageindexer_27.pyw ├── pageindexer_ans.pyw ├── walker.py ├── walker_26.py ├── walker_27.py └── walker_ans.py ├── gpl-2.0.txt ├── gpl-3.0.txt ├── makepyqt.pyw ├── mkpyqt.py └── pyqt.bat /.idea/.name: -------------------------------------------------------------------------------- 1 | PyQT-Exaples -------------------------------------------------------------------------------- /.idea/PyQT-Exaples.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/scopes/scope_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /chap01/answers.txt: -------------------------------------------------------------------------------- 1 | Answers to the exercises in Chapter 1. 2 | 3 | 1. dictionary function 4 | len() max() min() sum() 5 | one 6 36 1 91 6 | two 5 juliet foxtrot 7 | three 3 13 11 36 8 | 9 | sum() cannot be applied to dictionary two since it doesn't contain 10 | numbers. 11 | 12 | 13 | 2. The first time, v1 and v2 will be the same because they share the 14 | same list of dictionary keys. The second time they will differ 15 | because each has its own independent copy of the dictionary's keys. 16 | 17 | 18 | 3. The format string is "<%+7.2f>". The angle brackets have no special 19 | meaning and are simply printed as-is; the + means print the sign (+ 20 | or -); the 7 means that the number should occupy 7 character 21 | positions, and includes in its count the decimal place and decimal 22 | digits and the sign, so in this case with 2 decimal digits, the whole 23 | number part, including the sign, will occupy 4 character positions. 24 | 25 | -------------------------------------------------------------------------------- /chap01/hello.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | from __future__ import print_function 3 | 4 | print("Hello World") 5 | 6 | -------------------------------------------------------------------------------- /chap02/frange.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright (c) 2007-8 Qtrac Ltd. All rights reserved. 3 | # This program or module is free software: you can redistribute it and/or 4 | # modify it under the terms of the GNU General Public License as published 5 | # by the Free Software Foundation, either version 2 of the License, or 6 | # version 3 of the License, or (at your option) any later version. It is 7 | # provided for educational purposes and is distributed in the hope that 8 | # it will be useful, but WITHOUT ANY WARRANTY; without even the implied 9 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 10 | # the GNU General Public License for more details. 11 | 12 | from __future__ import division 13 | from __future__ import print_function 14 | from __future__ import unicode_literals 15 | from future_builtins import * 16 | 17 | """Provides two simple range functions for floating point numbers. 18 | """ 19 | 20 | 21 | def frange(arg0, arg1=None, arg2=None): 22 | """Returns a list of floats using range-like syntax 23 | 24 | frange(start, stop, inc) # start = arg0 stop = arg1 inc = arg2 25 | frange(start, stop) # start = arg0 stop = arg1 inc = 1.0 26 | frange(stop) # start = 0.0 stop = arg0 inc = 1.0 27 | 28 | >>> frange(5) 29 | [0.0, 1.0, 2.0, 3.0, 4.0] 30 | >>> frange(5, 10) 31 | [5, 6.0, 7.0, 8.0, 9.0] 32 | >>> frange(2, 5, 0.5) 33 | [2, 2.5, 3.0, 3.5, 4.0, 4.5] 34 | """ 35 | start = 0.0 36 | inc = 1.0 37 | if arg2 is not None: # 3 arguments given 38 | start = arg0 39 | stop = arg1 40 | inc = arg2 41 | elif arg1 is not None: # 2 arguments given 42 | start = arg0 43 | stop = arg1 44 | else: # 1 argument given 45 | stop = arg0 46 | # Build and return a list 47 | result = [] 48 | while start < (stop - (inc / 2.0)): 49 | result.append(start) 50 | start += inc 51 | return result 52 | 53 | 54 | def gfrange(arg0, arg1=None, arg2=None): 55 | """Returns a generator of floats using range-like syntax 56 | 57 | gfrange(start, stop, inc) 58 | gfrange(start, stop) # inc == 1.0 59 | gfrange(stop) # start = 0.0, inc == 1.0 60 | 61 | >>> list(gfrange(5)) 62 | [0.0, 1.0, 2.0, 3.0, 4.0] 63 | >>> list(gfrange(5, 10)) 64 | [5, 6.0, 7.0, 8.0, 9.0] 65 | >>> list(gfrange(2, 5, 0.5)) 66 | [2, 2.5, 3.0, 3.5, 4.0, 4.5] 67 | """ 68 | start = 0.0 69 | inc = 1.0 70 | if arg2 is not None: # 3 arguments given 71 | start = arg0 72 | stop = arg1 73 | inc = arg2 74 | elif arg1 is not None: # 2 arguments given 75 | start = arg0 76 | stop = arg1 77 | else: # 1 argument given 78 | stop = arg0 79 | # Return each value on demand 80 | while start < (stop - (inc / 2.0)): 81 | yield start 82 | start += inc 83 | 84 | 85 | if __name__ == "__main__": 86 | import doctest 87 | doctest.testmod() 88 | 89 | -------------------------------------------------------------------------------- /chap02/simplified.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright (c) 2007-8 Qtrac Ltd. All rights reserved. 3 | # This program or module is free software: you can redistribute it and/or 4 | # modify it under the terms of the GNU General Public License as published 5 | # by the Free Software Foundation, either version 2 of the License, or 6 | # version 3 of the License, or (at your option) any later version. It is 7 | # provided for educational purposes and is distributed in the hope that 8 | # it will be useful, but WITHOUT ANY WARRANTY; without even the implied 9 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 10 | # the GNU General Public License for more details. 11 | 12 | from __future__ import division 13 | from __future__ import print_function 14 | #from __future__ import unicode_literals # confuses doctest 15 | from future_builtins import * 16 | 17 | """Provides two simple simplify functions for strings. 18 | """ 19 | 20 | 21 | def simplify(text, space=" \t\r\n\f", delete=""): 22 | """Returns the text with multiple spaces reduced to single spaces 23 | 24 | The space parameter is a string of characters each of which is 25 | considered to be a space. 26 | Any characters in delete are excluded from the resultant string. 27 | 28 | >>> simplify(" this and\\n that\\t too") 29 | 'this and that too' 30 | >>> simplify(" Washington D.C.\\n") 31 | 'Washington D.C.' 32 | >>> simplify(" Washington D.C.\\n", delete=",;:.") 33 | 'Washington DC' 34 | >>> simplify(" disemvoweled ", delete="aeiou") 35 | 'dsmvwld' 36 | """ 37 | result = [] 38 | word = "" 39 | for char in text: 40 | if char in delete: 41 | continue 42 | elif char in space: 43 | if word: 44 | result.append(word) 45 | word = "" 46 | else: 47 | word += char 48 | if word: 49 | result.append(word) 50 | return " ".join(result) 51 | 52 | 53 | def simplified(text, delete=""): 54 | """Returns text with multiple whitespace reduced to single spaces 55 | 56 | Any characters in delete are excluded from the resultant string. 57 | 58 | >>> simplified(" this and\\n that\\t too") 59 | 'this and that too' 60 | >>> simplified(" Washington D.C.\\n") 61 | 'Washington D.C.' 62 | >>> simplified(" Washington D.C.\\n", delete=",;:.") 63 | 'Washington DC' 64 | >>> simplified(" disemvoweled ", delete="aeiou") 65 | 'dsmvwld' 66 | """ 67 | result = [] 68 | word = [] 69 | for char in text: 70 | if char in delete: 71 | continue 72 | elif char.isspace(): 73 | if word: 74 | result.append("".join(word)) 75 | word = [] 76 | else: 77 | word.append(char) 78 | if word: 79 | result.append("".join(word)) 80 | return " ".join(result) 81 | 82 | 83 | if __name__ == "__main__": 84 | import doctest 85 | doctest.testmod() 86 | 87 | -------------------------------------------------------------------------------- /chap03/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap03/__init__.py -------------------------------------------------------------------------------- /chap03/balloon.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright (c) 2008 Qtrac Ltd. All rights reserved. 3 | # This program or module is free software: you can redistribute it and/or 4 | # modify it under the terms of the GNU General Public License as published 5 | # by the Free Software Foundation, either version 2 of the License, or 6 | # version 3 of the License, or (at your option) any later version. It is 7 | # provided for educational purposes and is distributed in the hope that 8 | # it will be useful, but WITHOUT ANY WARRANTY; without even the implied 9 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 10 | # the GNU General Public License for more details. 11 | 12 | from __future__ import division 13 | from __future__ import print_function 14 | from __future__ import unicode_literals 15 | from future_builtins import * 16 | 17 | """Provides the Balloon example class. 18 | """ 19 | 20 | class Balloon(object): 21 | 22 | unique_colors = set() 23 | 24 | def __init__(self, color): 25 | self.color = color 26 | Balloon.unique_colors.add(color) 27 | 28 | @staticmethod 29 | def uniqueColorCount(): 30 | return len(Balloon.unique_colors) 31 | 32 | @staticmethod 33 | def uniqueColors(): 34 | return Balloon.unique_colors.copy() 35 | 36 | def __repr__(self): 37 | return "Balloon('{0}')".format(self.color) 38 | 39 | 40 | -------------------------------------------------------------------------------- /chap03/dimension.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright (c) 2008 Qtrac Ltd. All rights reserved. 3 | # This program or module is free software: you can redistribute it and/or 4 | # modify it under the terms of the GNU General Public License as published 5 | # by the Free Software Foundation, either version 2 of the License, or 6 | # version 3 of the License, or (at your option) any later version. It is 7 | # provided for educational purposes and is distributed in the hope that 8 | # it will be useful, but WITHOUT ANY WARRANTY; without even the implied 9 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 10 | # the GNU General Public License for more details. 11 | 12 | from __future__ import division 13 | from __future__ import print_function 14 | from __future__ import unicode_literals 15 | from future_builtins import * 16 | 17 | """Provides the Dimension example classes. 18 | """ 19 | 20 | class Dimension(object): 21 | 22 | def area(self): 23 | raise NotImplementedError() 24 | 25 | 26 | def volume(self): 27 | raise NotImplementedError() 28 | 29 | 30 | 31 | class Item(object): 32 | 33 | def __init__(self, artist, title, year=None): 34 | self.__artist = artist 35 | self.__title = title 36 | self.__year = year 37 | 38 | 39 | def artist(self): 40 | return self.__artist 41 | 42 | 43 | def setArtist(self, artist): 44 | self.__artist = artist 45 | 46 | 47 | def title(self): 48 | return self.__title 49 | 50 | 51 | def setTitle(self, title): 52 | self.__title = title 53 | 54 | 55 | def year(self): 56 | return self.__year 57 | 58 | 59 | def setYear(self, year): 60 | self.__year = year 61 | 62 | 63 | def __str__(self): 64 | year = "" 65 | if self.__year is not None: 66 | year = " in {0}".format(self.__year) 67 | return "{0} by {1}{2}".format(self.__title, self.__artist, year) 68 | 69 | 70 | class Painting(Item, Dimension): 71 | 72 | def __init__(self, artist, title, year=None, width=None, 73 | height=None): 74 | super(Painting, self).__init__(artist, title, year) 75 | self.__width = width 76 | self.__height = height 77 | 78 | 79 | def area(self): 80 | if self.__width is None or self.__height is None: 81 | return None 82 | return self.__width * self.__height 83 | 84 | 85 | def volume(self): 86 | return None 87 | 88 | 89 | class Sculpture(Item, Dimension): 90 | 91 | def __init__(self, artist, title, year=None, material=None): 92 | super(Sculpture, self).__init__(artist, title, year) 93 | self.__material = material 94 | 95 | 96 | def material(self): 97 | return self.__material 98 | 99 | 100 | def setMaterial(self, material): 101 | self.__material = material 102 | 103 | 104 | def __str__(self): 105 | material = "" 106 | if self.__material is not None: 107 | material = " ({0})".format(self.__material) 108 | return "{1}{2}".format(super(Sculpture, self).__str__(), material) 109 | 110 | 111 | if __name__ == "__main__": 112 | painting = Painting("Cecil Collins", "The Poet", 1941, 298, 400) 113 | print(painting.area(), painting.volume()) 114 | sculpture = Sculpture("Auguste Rodin", "The Secret", 1925, "bronze") 115 | try: 116 | print(sculpture.area(), sculpture.volume()) 117 | except NotImplementedError: 118 | print("Ooops, we forgot to implement area() and volume() for" + 119 | " Sculptures") 120 | 121 | -------------------------------------------------------------------------------- /chap03/rectangle.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright (c) 2008 Qtrac Ltd. All rights reserved. 3 | # This program or module is free software: you can redistribute it and/or 4 | # modify it under the terms of the GNU General Public License as published 5 | # by the Free Software Foundation, either version 2 of the License, or 6 | # version 3 of the License, or (at your option) any later version. It is 7 | # provided for educational purposes and is distributed in the hope that 8 | # it will be useful, but WITHOUT ANY WARRANTY; without even the implied 9 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 10 | # the GNU General Public License for more details. 11 | 12 | from __future__ import division 13 | from __future__ import print_function 14 | from __future__ import unicode_literals 15 | from future_builtins import * 16 | 17 | """Provides the Rectangle example classes. 18 | """ 19 | 20 | class Rectangle(object): 21 | 22 | def __init__(self, width, height): 23 | self.width = width 24 | self.height = height 25 | 26 | def getWidth(self): 27 | return self.width 28 | 29 | def setWidth(self, width): 30 | self.width = width 31 | 32 | def getHeight(self): 33 | return self.height 34 | 35 | def setHeight(self, height): 36 | self.height = height 37 | 38 | def area(self): 39 | return self.getWidth() * self.getHeight() 40 | 41 | def __hash__(self): 42 | return super(Rectangle, self).__hash__() 43 | 44 | def __eq__(self, other): 45 | return self.area() == other.area() 46 | 47 | def __lt__(self, other): 48 | return self.area() < other.area() 49 | 50 | def __nonzero__(self): 51 | return self.width or self.height 52 | 53 | def __repr__(self): 54 | return "Rectangle({0}, {1})".format(self.width, self.height) 55 | 56 | 57 | class Rectangle(object): 58 | 59 | def __init__(self, width, height): 60 | self.width = width 61 | self.height = height 62 | 63 | def _area(self): 64 | return self.width * self.height 65 | area = property(fget=_area) 66 | 67 | def __hash__(self): 68 | return super(Rectangle, self).__hash__() 69 | 70 | def __eq__(self, other): 71 | return self.area == other.area 72 | 73 | def __lt__(self, other): 74 | return self.area < other.area 75 | 76 | def __nonzero__(self): 77 | return self.width or self.height 78 | 79 | def __repr__(self): 80 | return "Rectangle({0}, {1})".format(self.width, self.height) 81 | 82 | 83 | class Rectangle(object): 84 | 85 | def __init__(self, width, height): 86 | self.__width = width 87 | self.__height = height 88 | 89 | def _area(self): 90 | return self.__width * self.__height 91 | area = property(fget=_area) 92 | 93 | def _height(self): 94 | return self.__height 95 | 96 | def _setHeight(self, height): 97 | # Perform computation 98 | self.__height = height 99 | 100 | height = property(fget=_height, fset=_setHeight) 101 | 102 | def _width(self): 103 | return self.__width 104 | 105 | def _setWidth(self, width): 106 | # Perform computation 107 | self.__width = width 108 | 109 | width = property(fget=_width, fset=_setWidth) 110 | 111 | def __hash__(self): 112 | return super(Rectangle, self).__hash__() 113 | 114 | def __eq__(self, other): 115 | return self.area == other.area 116 | 117 | def __lt__(self, other): 118 | return self.area < other.area 119 | 120 | def __nonzero__(self): 121 | return self.__width or self.__height 122 | 123 | def __repr__(self): 124 | return "Rectangle({0}, {1})".format(self.__width, self.__height) 125 | 126 | -------------------------------------------------------------------------------- /chap03/stack.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright (c) 2008 Qtrac Ltd. All rights reserved. 3 | # This program or module is free software: you can redistribute it and/or 4 | # modify it under the terms of the GNU General Public License as published 5 | # by the Free Software Foundation, either version 2 of the License, or 6 | # version 3 of the License, or (at your option) any later version. It is 7 | # provided for educational purposes and is distributed in the hope that 8 | # it will be useful, but WITHOUT ANY WARRANTY; without even the implied 9 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 10 | # the GNU General Public License for more details. 11 | 12 | from __future__ import division 13 | from __future__ import print_function 14 | #from __future__ import unicode_literals # confuses doctest 15 | from future_builtins import * 16 | 17 | 18 | class EmptyStackError(Exception): pass 19 | 20 | 21 | class Stack(object): 22 | 23 | def __init__(self): 24 | """A stack class that supports pop(), top(), and push(), and 25 | special methods to support str() and len() 26 | 27 | >>> s = Stack() 28 | >>> print(s) 29 | [] 30 | """ 31 | self.__items = [] 32 | 33 | 34 | def pop(self): 35 | """Returns and removes the stack's most recent (right-most) item 36 | 37 | >>> s = Stack() 38 | >>> s.push(1) 39 | >>> s.push(2) 40 | >>> print(s) 41 | [1, 2] 42 | >>> s.pop() 43 | 2 44 | >>> s.pop() 45 | 1 46 | >>> s.pop() 47 | Traceback (most recent call last): 48 | ... 49 | EmptyStackError 50 | """ 51 | if not self.__items: 52 | raise EmptyStackError 53 | return self.__items.pop() 54 | 55 | 56 | def top(self): 57 | """Returns the stack's most recent (right-most) item 58 | 59 | >>> s = Stack() 60 | >>> s.push(1) 61 | >>> s.push(2) 62 | >>> s.top() 63 | 2 64 | >>> s.pop() 65 | 2 66 | >>> s.top() 67 | 1 68 | """ 69 | if not self.__items: 70 | raise EmptyStackError 71 | return self.__items[-1] 72 | 73 | 74 | def push(self, item): 75 | """Pushes the given item onto (right-end of) the stack 76 | 77 | >>> s = Stack() 78 | >>> s.push(1) 79 | >>> s.push(2) 80 | >>> print(s) 81 | [1, 2] 82 | """ 83 | self.__items.append(item) 84 | 85 | 86 | def __len__(self): 87 | """Returns the number of items in the stack 88 | 89 | >>> s = Stack() 90 | >>> len(s) 91 | 0 92 | >>> s.push(1) 93 | >>> s.push(2) 94 | >>> s.push("X") 95 | >>> len(s) 96 | 3 97 | """ 98 | return len(self.__items) 99 | 100 | 101 | def __str__(self): 102 | """Returns a string representation of the stack's contents from 103 | bottom to top 104 | 105 | >>> s = Stack() 106 | >>> s.push(1) 107 | >>> s.push(2) 108 | >>> s.push("X") 109 | >>> print(s) 110 | [1, 2, 'X'] 111 | """ 112 | return "[{0}]".format(", ".join(["{0!r}".format(x) 113 | for x in self.__items])) 114 | # Alternatively: 115 | # pieces = [] 116 | # for x in self.__items: 117 | # pieces.append("{0!r}".format(x)) 118 | # return "[{0}]".format(", ".join(pieces)) 119 | 120 | 121 | 122 | if __name__ == "__main__": 123 | import doctest 124 | doctest.testmod() 125 | 126 | -------------------------------------------------------------------------------- /chap04/alert.pyw: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright (c) 2008-14 Qtrac Ltd. All rights reserved. 3 | # This program or module is free software: you can redistribute it and/or 4 | # modify it under the terms of the GNU General Public License as published 5 | # by the Free Software Foundation, either version 2 of the License, or 6 | # version 3 of the License, or (at your option) any later version. It is 7 | # provided for educational purposes and is distributed in the hope that 8 | # it will be useful, but WITHOUT ANY WARRANTY; without even the implied 9 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 10 | # the GNU General Public License for more details. 11 | 12 | from __future__ import division 13 | from __future__ import print_function 14 | from __future__ import unicode_literals 15 | from future_builtins import * 16 | 17 | import sys 18 | import time 19 | from PyQt4.QtCore import (QTime, QTimer, Qt) 20 | from PyQt4.QtGui import (QApplication, QLabel) 21 | 22 | 23 | app = QApplication(sys.argv) 24 | 25 | try: 26 | due = QTime.currentTime() 27 | message = "Alert!" 28 | if len(sys.argv) < 2: 29 | raise ValueError 30 | hours, mins = sys.argv[1].split(":") 31 | due = QTime(int(hours), int(mins)) 32 | if not due.isValid(): 33 | raise ValueError 34 | if len(sys.argv) > 2: 35 | message = " ".join(sys.argv[2:]) 36 | except ValueError: 37 | message = "Usage: alert.pyw HH:MM [optional message]" # 24hr clock 38 | 39 | while QTime.currentTime() < due: 40 | time.sleep(20) # 20 seconds 41 | 42 | label = QLabel("{0}" 43 | .format(message)) 44 | label.setWindowFlags(Qt.SplashScreen) 45 | label.show() 46 | QTimer.singleShot(60000, app.quit) # 1 minute 47 | app.exec_() 48 | 49 | -------------------------------------------------------------------------------- /chap04/alert_extra.pyw: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright (c) 2008-14 Qtrac Ltd. All rights reserved. 3 | # This program or module is free software: you can redistribute it and/or 4 | # modify it under the terms of the GNU General Public License as published 5 | # by the Free Software Foundation, either version 2 of the License, or 6 | # version 3 of the License, or (at your option) any later version. It is 7 | # provided for educational purposes and is distributed in the hope that 8 | # it will be useful, but WITHOUT ANY WARRANTY; without even the implied 9 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 10 | # the GNU General Public License for more details. 11 | 12 | from __future__ import division 13 | from __future__ import print_function 14 | from __future__ import unicode_literals 15 | from future_builtins import * 16 | 17 | import sys 18 | import time 19 | from PyQt4.QtCore import (QTime, QTimer, Qt) 20 | from PyQt4.QtCore import pyqtSignal as Signal 21 | from PyQt4.QtGui import (QApplication, QFont, QFontMetrics, QLabel, 22 | QPainter, QPixmap, QTextDocument) 23 | 24 | 25 | app = QApplication(sys.argv) 26 | 27 | try: 28 | due = QTime.currentTime() 29 | message = "Alert!" 30 | if len(sys.argv) < 2: 31 | raise ValueError 32 | hours, mins = sys.argv[1].split(":") 33 | due = QTime(int(hours), int(mins)) 34 | if not due.isValid(): 35 | raise ValueError 36 | if len(sys.argv) > 2: 37 | message = " ".join(sys.argv[2:]) 38 | except ValueError: 39 | message = "Usage: alert.pyw HH:MM [optional message]" # 24hr clock 40 | 41 | while QTime.currentTime() < due: 42 | time.sleep(20) # 20 seconds 43 | 44 | font = QFont("Helvetica", 36, QFont.Bold) 45 | fm = QFontMetrics(font) 46 | pixmap = QPixmap(fm.width(message) + 5, fm.height() + 5) 47 | pixmap.fill(Qt.white) 48 | painter = QPainter(pixmap) 49 | document = QTextDocument() 50 | document.setDefaultFont(font) 51 | document.setHtml("{0}".format(message)) 52 | document.drawContents(painter) 53 | painter.end() 54 | label = QLabel() 55 | label.setPixmap(pixmap) 56 | label.setMask(pixmap.createMaskFromColor(Qt.white)) 57 | label.setWindowFlags(Qt.SplashScreen|Qt.FramelessWindowHint) 58 | label.show() 59 | QTimer.singleShot(60000, app.quit) # 1 minute 60 | app.exec_() 61 | 62 | -------------------------------------------------------------------------------- /chap04/calculate.pyw: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright (c) 2008-14 Qtrac Ltd. All rights reserved. 3 | # This program or module is free software: you can redistribute it and/or 4 | # modify it under the terms of the GNU General Public License as published 5 | # by the Free Software Foundation, either version 2 of the License, or 6 | # version 3 of the License, or (at your option) any later version. It is 7 | # provided for educational purposes and is distributed in the hope that 8 | # it will be useful, but WITHOUT ANY WARRANTY; without even the implied 9 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 10 | # the GNU General Public License for more details. 11 | 12 | from __future__ import division 13 | from __future__ import print_function 14 | from __future__ import unicode_literals 15 | from future_builtins import * 16 | 17 | import sys 18 | from math import * 19 | from PyQt4.QtCore import Qt 20 | from PyQt4.QtCore import pyqtSignal as Signal 21 | from PyQt4.QtGui import (QApplication, QDialog, QLineEdit, QTextBrowser, 22 | QVBoxLayout) 23 | 24 | 25 | class Form(QDialog): 26 | 27 | def __init__(self, parent=None): 28 | super(Form, self).__init__(parent) 29 | self.browser = QTextBrowser() 30 | self.lineedit = QLineEdit("Type an expression and press Enter") 31 | self.lineedit.selectAll() 32 | layout = QVBoxLayout() 33 | layout.addWidget(self.browser) 34 | layout.addWidget(self.lineedit) 35 | self.setLayout(layout) 36 | self.lineedit.setFocus() 37 | self.lineedit.returnPressed.connect(self.updateUi) 38 | self.setWindowTitle("Calculate") 39 | 40 | 41 | def updateUi(self): 42 | try: 43 | text = unicode(self.lineedit.text()) 44 | self.browser.append("{0} = {1}".format(text, 45 | eval(text))) 46 | except: 47 | self.browser.append("{0} is invalid!" 48 | .format(text)) 49 | 50 | 51 | if __name__ == "__main__": 52 | app = QApplication(sys.argv) 53 | form = Form() 54 | form.show() 55 | app.exec_() 56 | -------------------------------------------------------------------------------- /chap04/connections.pyw: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright (c) 2008-14 Qtrac Ltd. All rights reserved. 3 | # This program or module is free software: you can redistribute it and/or 4 | # modify it under the terms of the GNU General Public License as published 5 | # by the Free Software Foundation, either version 2 of the License, or 6 | # version 3 of the License, or (at your option) any later version. It is 7 | # provided for educational purposes and is distributed in the hope that 8 | # it will be useful, but WITHOUT ANY WARRANTY; without even the implied 9 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 10 | # the GNU General Public License for more details. 11 | 12 | from __future__ import division 13 | from __future__ import print_function 14 | from __future__ import unicode_literals 15 | from future_builtins import * 16 | 17 | import functools 18 | import sys 19 | from PyQt4.QtCore import Qt 20 | from PyQt4.QtCore import pyqtSignal as Signal 21 | from PyQt4.QtGui import (QApplication, QDialog, QHBoxLayout, QLabel, 22 | QPushButton) 23 | 24 | 25 | class Form(QDialog): 26 | 27 | def __init__(self, parent=None): 28 | super(Form, self).__init__(parent) 29 | 30 | button1 = QPushButton("One") 31 | button2 = QPushButton("Two") 32 | button3 = QPushButton("Three") 33 | button4 = QPushButton("Four") 34 | button5 = QPushButton("Five") 35 | self.label = QLabel("Click a button...") 36 | 37 | layout = QHBoxLayout() 38 | layout.addWidget(button1) 39 | layout.addWidget(button2) 40 | layout.addWidget(button3) 41 | layout.addWidget(button4) 42 | layout.addWidget(button5) 43 | layout.addStretch() 44 | layout.addWidget(self.label) 45 | self.setLayout(layout) 46 | 47 | button1.clicked.connect(self.one) 48 | self.button2callback = functools.partial(self.anyButton, "Two") 49 | button2.clicked.connect(self.button2callback) 50 | self.button3callback = lambda who="Three": self.anyButton(who) 51 | button3.clicked.connect(self.button3callback) 52 | button4.clicked.connect(self.clicked) 53 | button5.clicked.connect(self.clicked) 54 | 55 | self.setWindowTitle("Connections") 56 | 57 | 58 | def one(self): 59 | self.label.setText("You clicked button 'One'") 60 | 61 | 62 | def anyButton(self, who): 63 | self.label.setText("You clicked button '{0}'".format(who)) 64 | 65 | 66 | def clicked(self): 67 | button = self.sender() 68 | if button is None or not isinstance(button, QPushButton): 69 | return 70 | self.label.setText("You clicked button '{0}'".format( 71 | button.text())) 72 | 73 | 74 | if __name__ == "__main__": 75 | app = QApplication(sys.argv) 76 | form = Form() 77 | form.show() 78 | app.exec_() 79 | -------------------------------------------------------------------------------- /chap04/currency.pyw: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright (c) 2008-14 Qtrac Ltd. All rights reserved. 3 | # This program or module is free software: you can redistribute it and/or 4 | # modify it under the terms of the GNU General Public License as published 5 | # by the Free Software Foundation, either version 2 of the License, or 6 | # version 3 of the License, or (at your option) any later version. It is 7 | # provided for educational purposes and is distributed in the hope that 8 | # it will be useful, but WITHOUT ANY WARRANTY; without even the implied 9 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 10 | # the GNU General Public License for more details. 11 | 12 | from __future__ import division 13 | from __future__ import print_function 14 | from __future__ import unicode_literals 15 | from future_builtins import * 16 | 17 | import sys 18 | import urllib2 19 | from PyQt4.QtCore import Qt 20 | from PyQt4.QtCore import pyqtSignal as Signal 21 | from PyQt4.QtGui import (QApplication, QComboBox, QDialog, 22 | QDoubleSpinBox, QGridLayout, QLabel) 23 | 24 | 25 | class Form(QDialog): 26 | 27 | def __init__(self, parent=None): 28 | super(Form, self).__init__(parent) 29 | self.create_widgets() 30 | self.layout_widgets() 31 | self.create_connections() 32 | self.prepare() 33 | self.setWindowTitle("Currency") 34 | 35 | 36 | def create_widgets(self): 37 | self.dateLabel = QLabel() 38 | self.fromComboBox = QComboBox() 39 | self.fromSpinBox = QDoubleSpinBox() 40 | self.fromSpinBox.setRange(0.01, 10000000.00) 41 | self.fromSpinBox.setValue(1.00) 42 | self.toComboBox = QComboBox() 43 | self.toLabel = QLabel("1.00") 44 | 45 | 46 | def layout_widgets(self): 47 | grid = QGridLayout() 48 | grid.addWidget(self.dateLabel, 0, 0) 49 | grid.addWidget(self.fromComboBox, 1, 0) 50 | grid.addWidget(self.fromSpinBox, 1, 1) 51 | grid.addWidget(self.toComboBox, 2, 0) 52 | grid.addWidget(self.toLabel, 2, 1) 53 | self.setLayout(grid) 54 | 55 | 56 | def create_connections(self): 57 | self.fromComboBox.currentIndexChanged.connect(self.updateUi) 58 | self.toComboBox.currentIndexChanged.connect(self.updateUi) 59 | self.fromSpinBox.valueChanged.connect(self.updateUi) 60 | 61 | 62 | def prepare(self): 63 | date = self.getdata() 64 | self.dateLabel.setText(date) 65 | rates = sorted(self.rates.keys()) 66 | self.fromComboBox.addItems(rates) 67 | self.toComboBox.addItems(rates) 68 | 69 | 70 | def updateUi(self): 71 | to = unicode(self.toComboBox.currentText()) 72 | from_ = unicode(self.fromComboBox.currentText()) 73 | if to and from_: 74 | amount = ((self.rates[from_] / self.rates[to]) * 75 | self.fromSpinBox.value()) 76 | self.toLabel.setText("{0:.2f}".format(amount)) 77 | 78 | 79 | def getdata(self): # Idea taken from the Python Cookbook 80 | self.rates = {} 81 | try: 82 | date = "Unknown" 83 | fh = urllib2.urlopen("http://www.bankofcanada.ca" 84 | "/en/markets/csv/exchange_eng.csv") 85 | for line in fh: 86 | line = line.rstrip() 87 | if not line or line.startswith(("#", "Closing ")): 88 | continue 89 | fields = line.split(",") 90 | if line.startswith("Date "): 91 | date = fields[-1] 92 | else: 93 | try: 94 | value = float(fields[-1]) 95 | self.rates[unicode(fields[0])] = value 96 | except ValueError: 97 | pass 98 | return "Exchange Rates Date: " + date 99 | except Exception, err: 100 | return "Failed to download:\n{0}".format(err) 101 | 102 | 103 | if __name__ == "__main__": 104 | app = QApplication(sys.argv) 105 | form = Form() 106 | form.show() 107 | app.exec_() 108 | 109 | -------------------------------------------------------------------------------- /chap04/currency2.pyw: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright (c) 2008-14 Qtrac Ltd. All rights reserved. 3 | # This program or module is free software: you can redistribute it and/or 4 | # modify it under the terms of the GNU General Public License as published 5 | # by the Free Software Foundation, either version 2 of the License, or 6 | # version 3 of the License, or (at your option) any later version. It is 7 | # provided for educational purposes and is distributed in the hope that 8 | # it will be useful, but WITHOUT ANY WARRANTY; without even the implied 9 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 10 | # the GNU General Public License for more details. 11 | 12 | from __future__ import division 13 | from __future__ import print_function 14 | from __future__ import unicode_literals 15 | from future_builtins import * 16 | 17 | import locale 18 | locale.setlocale(locale.LC_ALL, "") 19 | 20 | import sys 21 | import urllib2 22 | from PyQt4.QtCore import Qt 23 | from PyQt4.QtCore import pyqtSignal as Signal 24 | from PyQt4.QtGui import (QApplication, QComboBox, QDialog, 25 | QDoubleSpinBox, QGridLayout, QLabel) 26 | 27 | 28 | class Form(QDialog): 29 | 30 | def __init__(self, parent=None): 31 | super(Form, self).__init__(parent) 32 | 33 | date = self.getdata() 34 | rates = sorted(self.rates.keys(), key=unicode.lower) 35 | 36 | dateLabel = QLabel(date) 37 | self.fromComboBox = QComboBox() 38 | self.fromComboBox.addItems(rates) 39 | self.fromSpinBox = QDoubleSpinBox() 40 | self.fromSpinBox.setRange(0.01, 10000000.00) 41 | self.fromSpinBox.setValue(1.00) 42 | self.toComboBox = QComboBox() 43 | self.toComboBox.addItems(rates) 44 | self.toLabel = QLabel("1.00") 45 | grid = QGridLayout() 46 | grid.addWidget(dateLabel, 0, 0) 47 | grid.addWidget(self.fromComboBox, 1, 0) 48 | grid.addWidget(self.fromSpinBox, 1, 1) 49 | grid.addWidget(self.toComboBox, 2, 0) 50 | grid.addWidget(self.toLabel, 2, 1) 51 | self.setLayout(grid) 52 | self.fromComboBox.currentIndexChanged.connect(self.updateUi) 53 | self.toComboBox.currentIndexChanged.connect(self.updateUi) 54 | self.fromSpinBox.valueChanged.connect(self.updateUi) 55 | self.setWindowTitle("Currency") 56 | 57 | 58 | def updateUi(self): 59 | to = unicode(self.toComboBox.currentText()) 60 | from_ = unicode(self.fromComboBox.currentText()) 61 | amount = ((self.rates[from_] / self.rates[to]) * 62 | self.fromSpinBox.value()) 63 | self.toLabel.setText(locale.format("%0.2f", amount, True)) 64 | 65 | 66 | def getdata(self): # Idea taken from the Python Cookbook 67 | self.rates = {} 68 | try: 69 | date = "Unknown" 70 | fh = urllib2.urlopen("http://www.bankofcanada.ca" 71 | "/en/markets/csv/exchange_eng.csv") 72 | for line in fh: 73 | line = line.rstrip() 74 | if not line or line.startswith(("#", "Closing ")): 75 | continue 76 | fields = line.split(",") 77 | if line.startswith("Date "): 78 | date = fields[-1] 79 | else: 80 | try: 81 | value = float(fields[-1]) 82 | self.rates[unicode(fields[0])] = value 83 | except ValueError: 84 | pass 85 | self.rates[u"Canadian Dollar"] = 1.00 86 | return "Exchange Rates Date: " + date 87 | except Exception, err: 88 | return "Failed to download:\n{0}".format(err) 89 | 90 | 91 | if __name__ == "__main__": 92 | app = QApplication(sys.argv) 93 | form = Form() 94 | form.show() 95 | app.exec_() 96 | -------------------------------------------------------------------------------- /chap04/interest.pyw: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright (c) 2008-14 Qtrac Ltd. All rights reserved. 3 | # This program or module is free software: you can redistribute it and/or 4 | # modify it under the terms of the GNU General Public License as published 5 | # by the Free Software Foundation, either version 2 of the License, or 6 | # version 3 of the License, or (at your option) any later version. It is 7 | # provided for educational purposes and is distributed in the hope that 8 | # it will be useful, but WITHOUT ANY WARRANTY; without even the implied 9 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 10 | # the GNU General Public License for more details. 11 | 12 | from __future__ import division 13 | from __future__ import print_function 14 | from __future__ import unicode_literals 15 | from future_builtins import * 16 | 17 | import sys 18 | from PyQt4.QtCore import Qt 19 | from PyQt4.QtCore import pyqtSignal as Signal 20 | from PyQt4.QtGui import (QApplication, QComboBox, QDialog, 21 | QDoubleSpinBox, QGridLayout, QLabel) 22 | 23 | 24 | class Form(QDialog): 25 | 26 | def __init__(self, parent=None): 27 | super(Form, self).__init__(parent) 28 | self.create_widgets() 29 | self.layout_widgets() 30 | self.create_connections() 31 | self.setWindowTitle("Interest") 32 | self.updateUi() 33 | 34 | 35 | def create_widgets(self): 36 | self.principalLabel = QLabel("Principal:") 37 | self.principalSpinBox = QDoubleSpinBox() 38 | self.principalSpinBox.setRange(1, 1000000000) 39 | self.principalSpinBox.setValue(1000) 40 | self.principalSpinBox.setPrefix("$ ") 41 | self.rateLabel = QLabel("Rate:") 42 | self.rateSpinBox = QDoubleSpinBox() 43 | self.rateSpinBox.setRange(1, 100) 44 | self.rateSpinBox.setValue(5) 45 | self.rateSpinBox.setSuffix(" %") 46 | self.yearsLabel = QLabel("Years:") 47 | self.yearsComboBox = QComboBox() 48 | self.yearsComboBox.addItem("1 year") 49 | self.yearsComboBox.addItems( 50 | ["{0} years".format(x) for x in range(2, 26)]) 51 | self.amountLabel = QLabel("Amount") 52 | self.amountResultLabel = QLabel() 53 | 54 | 55 | def layout_widgets(self): 56 | grid = QGridLayout() 57 | grid.addWidget(self.principalLabel, 0, 0) 58 | grid.addWidget(self.principalSpinBox, 0, 1) 59 | grid.addWidget(self.rateLabel, 1, 0) 60 | grid.addWidget(self.rateSpinBox, 1, 1) 61 | grid.addWidget(self.yearsLabel, 2, 0) 62 | grid.addWidget(self.yearsComboBox, 2, 1) 63 | grid.addWidget(self.amountLabel, 3, 0) 64 | grid.addWidget(self.amountResultLabel, 3, 1) 65 | self.setLayout(grid) 66 | 67 | 68 | def create_connections(self): 69 | self.principalSpinBox.valueChanged.connect(self.updateUi) 70 | self.rateSpinBox.valueChanged.connect(self.updateUi) 71 | self.yearsComboBox.currentIndexChanged.connect(self.updateUi) 72 | 73 | 74 | def updateUi(self): 75 | """Calculates compound interest""" 76 | principal = self.principalSpinBox.value() 77 | rate = self.rateSpinBox.value() 78 | years = self.yearsComboBox.currentIndex() + 1 79 | amount = principal * ((1 + (rate / 100.0)) ** years) 80 | self.amountResultLabel.setText("$ {0:.2f}".format(amount)) 81 | 82 | 83 | if __name__ == "__main__": 84 | app = QApplication(sys.argv) 85 | form = Form() 86 | form.show() 87 | app.exec_() 88 | 89 | -------------------------------------------------------------------------------- /chap06/help/editmenu.html: -------------------------------------------------------------------------------- 1 | 2 | Image Changer - Edit Menu 3 | 4 |

5 | Work in progres... 6 |

7 | 8 | -------------------------------------------------------------------------------- /chap06/help/filemenu.html: -------------------------------------------------------------------------------- 1 | 2 | Image Changer - File Menu 3 | 4 |

5 | File|New 6 | Create a new plain image. 7 |

8 |

9 | File|Open 10 | Open an existing image. 11 |

12 |

13 | File|Save 14 | Save the current image. 15 |

16 |

17 | File|Save As 18 | Save the current image under a 19 | new name, and make the newly named image the current image. 20 |

21 |

22 | File|Quit 23 | Terminate the program. You will be 24 | given the chance to save any unsaved changes. 25 |

26 |
27 |

28 | If there are 29 | numbered files, these are recently opened files. Choosing one of them 30 | will cause it to be opened and to become the current 31 | image. 32 |

33 | 34 | -------------------------------------------------------------------------------- /chap06/help/index.html: -------------------------------------------------------------------------------- 1 | Image Changer 2 | 3 |

The Image Changer program provides simple image 4 | manipulations.

5 |

The File menu is used to create new 6 | images, to load existing images, and to save the current image.

7 |

The Edit 8 | menu offers the various image manipulation options. 9 |

All the most commonly used menu options are also available on the 10 | toolbar. The toolbar also provides an easy way of resizing the image.

11 | 12 | -------------------------------------------------------------------------------- /chap06/helpform.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright (c) 2008-14 Qtrac Ltd. All rights reserved. 3 | # This program or module is free software: you can redistribute it and/or 4 | # modify it under the terms of the GNU General Public License as published 5 | # by the Free Software Foundation, either version 2 of the License, or 6 | # version 3 of the License, or (at your option) any later version. It is 7 | # provided for educational purposes and is distributed in the hope that 8 | # it will be useful, but WITHOUT ANY WARRANTY; without even the implied 9 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 10 | # the GNU General Public License for more details. 11 | 12 | from __future__ import division 13 | from __future__ import print_function 14 | from __future__ import unicode_literals 15 | from future_builtins import * 16 | 17 | from PyQt4.QtCore import (QUrl, Qt) 18 | from PyQt4.QtCore import pyqtSignal as Signal 19 | from PyQt4.QtGui import (QAction, QApplication, QDialog, QIcon, 20 | QKeySequence, QLabel, QTextBrowser, QToolBar, QVBoxLayout) 21 | import qrc_resources 22 | 23 | 24 | class HelpForm(QDialog): 25 | 26 | def __init__(self, page, parent=None): 27 | super(HelpForm, self).__init__(parent) 28 | self.setAttribute(Qt.WA_DeleteOnClose) 29 | self.setAttribute(Qt.WA_GroupLeader) 30 | self.create_widgets() 31 | self.layout_widgets() 32 | self.create_connections() 33 | self.textBrowser.setSearchPaths([":/help"]) 34 | self.textBrowser.setSource(QUrl(page)) 35 | self.resize(400, 600) 36 | self.setWindowTitle("{0} Help".format( 37 | QApplication.applicationName())) 38 | 39 | 40 | def create_widgets(self): 41 | self.backAction = QAction(QIcon(":/back.png"), "&Back", self) 42 | self.backAction.setShortcut(QKeySequence.Back) 43 | self.homeAction = QAction(QIcon(":/home.png"), "&Home", self) 44 | self.homeAction.setShortcut("Home") 45 | self.pageLabel = QLabel() 46 | 47 | self.toolBar = QToolBar() 48 | self.toolBar.addAction(self.backAction) 49 | self.toolBar.addAction(self.homeAction) 50 | self.toolBar.addWidget(self.pageLabel) 51 | self.textBrowser = QTextBrowser() 52 | 53 | 54 | def layout_widgets(self): 55 | layout = QVBoxLayout() 56 | layout.addWidget(self.toolBar) 57 | layout.addWidget(self.textBrowser, 1) 58 | self.setLayout(layout) 59 | 60 | 61 | def create_connections(self): 62 | self.backAction.triggered.connect(self.textBrowser.backward) 63 | self.homeAction.triggered.connect(self.textBrowser.home) 64 | self.textBrowser.sourceChanged.connect(self.updatePageTitle) 65 | 66 | 67 | def updatePageTitle(self): 68 | self.pageLabel.setText(self.textBrowser.documentTitle()) 69 | 70 | 71 | if __name__ == "__main__": 72 | import sys 73 | 74 | app = QApplication(sys.argv) 75 | form = HelpForm("index.html") 76 | form.show() 77 | app.exec_() 78 | 79 | -------------------------------------------------------------------------------- /chap06/imagechanger.pyw: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright (c) 2008-14 Qtrac Ltd. All rights reserved. 3 | # This program or module is free software: you can redistribute it and/or 4 | # modify it under the terms of the GNU General Public License as published 5 | # by the Free Software Foundation, either version 2 of the License, or 6 | # version 3 of the License, or (at your option) any later version. It is 7 | # provided for educational purposes and is distributed in the hope that 8 | # it will be useful, but WITHOUT ANY WARRANTY; without even the implied 9 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 10 | # the GNU General Public License for more details. 11 | 12 | from __future__ import division 13 | from __future__ import print_function 14 | from __future__ import unicode_literals 15 | from future_builtins import * 16 | 17 | import sys 18 | from PyQt4.QtGui import QApplication, QIcon 19 | import MainWindow 20 | 21 | 22 | def main(): 23 | app = QApplication(sys.argv) 24 | app.setOrganizationName("Qtrac Ltd.") 25 | app.setOrganizationDomain("qtrac.eu") 26 | app.setApplicationName("Image Changer") 27 | app.setWindowIcon(QIcon(":/icon.png")) 28 | window = MainWindow.Window() 29 | window.show() 30 | app.exec_() 31 | 32 | 33 | if __name__ == "__main__": 34 | main() 35 | -------------------------------------------------------------------------------- /chap06/imagechanger_ans.pyw: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright (c) 2008-14 Qtrac Ltd. All rights reserved. 3 | # This program or module is free software: you can redistribute it and/or 4 | # modify it under the terms of the GNU General Public License as published 5 | # by the Free Software Foundation, either version 2 of the License, or 6 | # version 3 of the License, or (at your option) any later version. It is 7 | # provided for educational purposes and is distributed in the hope that 8 | # it will be useful, but WITHOUT ANY WARRANTY; without even the implied 9 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 10 | # the GNU General Public License for more details. 11 | 12 | from __future__ import division 13 | from __future__ import print_function 14 | from __future__ import unicode_literals 15 | from future_builtins import * 16 | 17 | import sys 18 | from PyQt4.QtGui import QApplication, QIcon 19 | import MainWindow_ans as MainWindow 20 | 21 | 22 | def main(): 23 | app = QApplication(sys.argv) 24 | app.setOrganizationName("Qtrac Ltd.") 25 | app.setOrganizationDomain("qtrac.eu") 26 | app.setApplicationName("Image Changer") 27 | app.setWindowIcon(QIcon(":/icon.png")) 28 | window = MainWindow.Window() 29 | window.show() 30 | app.exec_() 31 | 32 | 33 | if __name__ == "__main__": 34 | main() 35 | -------------------------------------------------------------------------------- /chap06/images/back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap06/images/back.png -------------------------------------------------------------------------------- /chap06/images/editinvert.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap06/images/editinvert.png -------------------------------------------------------------------------------- /chap06/images/editmirror.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap06/images/editmirror.png -------------------------------------------------------------------------------- /chap06/images/editmirrorhoriz.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap06/images/editmirrorhoriz.png -------------------------------------------------------------------------------- /chap06/images/editmirrorvert.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap06/images/editmirrorvert.png -------------------------------------------------------------------------------- /chap06/images/editresize.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap06/images/editresize.png -------------------------------------------------------------------------------- /chap06/images/editswap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap06/images/editswap.png -------------------------------------------------------------------------------- /chap06/images/editunmirror.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap06/images/editunmirror.png -------------------------------------------------------------------------------- /chap06/images/editzoom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap06/images/editzoom.png -------------------------------------------------------------------------------- /chap06/images/filenew.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap06/images/filenew.png -------------------------------------------------------------------------------- /chap06/images/fileopen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap06/images/fileopen.png -------------------------------------------------------------------------------- /chap06/images/fileprint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap06/images/fileprint.png -------------------------------------------------------------------------------- /chap06/images/filequit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap06/images/filequit.png -------------------------------------------------------------------------------- /chap06/images/filesave.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap06/images/filesave.png -------------------------------------------------------------------------------- /chap06/images/filesaveas.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap06/images/filesaveas.png -------------------------------------------------------------------------------- /chap06/images/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap06/images/home.png -------------------------------------------------------------------------------- /chap06/images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap06/images/icon.png -------------------------------------------------------------------------------- /chap06/newimagedlg.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright (c) 2008-14 Qtrac Ltd. All rights reserved. 3 | # This program or module is free software: you can redistribute it and/or 4 | # modify it under the terms of the GNU General Public License as published 5 | # by the Free Software Foundation, either version 2 of the License, or 6 | # version 3 of the License, or (at your option) any later version. It is 7 | # provided for educational purposes and is distributed in the hope that 8 | # it will be useful, but WITHOUT ANY WARRANTY; without even the implied 9 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 10 | # the GNU General Public License for more details. 11 | 12 | from __future__ import division 13 | from __future__ import print_function 14 | from __future__ import unicode_literals 15 | from future_builtins import * 16 | 17 | from PyQt4.QtCore import (QVariant, Qt) 18 | from PyQt4.QtCore import pyqtSignal as Signal 19 | from PyQt4.QtGui import (QApplication, QBrush, QColorDialog, QDialog, 20 | QPainter, QPixmap) 21 | import ui_newimagedlg 22 | 23 | 24 | class NewImageDlg(QDialog, ui_newimagedlg.Ui_NewImageDlg): 25 | 26 | def __init__(self, parent=None): 27 | super(NewImageDlg, self).__init__(parent) 28 | self.setupUi(self) 29 | 30 | self.color = Qt.red 31 | for value, text in ( 32 | (Qt.SolidPattern, "Solid"), 33 | (Qt.Dense1Pattern, "Dense #1"), 34 | (Qt.Dense2Pattern, "Dense #2"), 35 | (Qt.Dense3Pattern, "Dense #3"), 36 | (Qt.Dense4Pattern, "Dense #4"), 37 | (Qt.Dense5Pattern, "Dense #5"), 38 | (Qt.Dense6Pattern, "Dense #6"), 39 | (Qt.Dense7Pattern, "Dense #7"), 40 | (Qt.HorPattern, "Horizontal"), 41 | (Qt.VerPattern, "Vertical"), 42 | (Qt.CrossPattern, "Cross"), 43 | (Qt.BDiagPattern, "Backward Diagonal"), 44 | (Qt.FDiagPattern, "Forward Diagonal"), 45 | (Qt.DiagCrossPattern, "Diagonal Cross")): 46 | self.brushComboBox.addItem(text, QVariant(value)) 47 | 48 | self.colorButton.clicked.connect(self.getColor) 49 | self.brushComboBox.activated.connect(self.setColor) 50 | self.setColor() 51 | self.widthSpinBox.setFocus() 52 | 53 | 54 | def getColor(self): 55 | color = QColorDialog.getColor(Qt.black, self) 56 | if color.isValid(): 57 | self.color = color 58 | self.setColor() 59 | 60 | 61 | def setColor(self): 62 | pixmap = self._makePixmap(60, 30) 63 | self.colorLabel.setPixmap(pixmap) 64 | 65 | 66 | def image(self): 67 | pixmap = self._makePixmap(self.widthSpinBox.value(), 68 | self.heightSpinBox.value()) 69 | return QPixmap.toImage(pixmap) 70 | 71 | 72 | def _makePixmap(self, width, height): 73 | pixmap = QPixmap(width, height) 74 | style = self.brushComboBox.itemData( 75 | self.brushComboBox.currentIndex()).toInt()[0] 76 | brush = QBrush(self.color, Qt.BrushStyle(style)) 77 | painter = QPainter(pixmap) 78 | painter.fillRect(pixmap.rect(), Qt.white) 79 | painter.fillRect(pixmap.rect(), brush) 80 | return pixmap 81 | 82 | 83 | if __name__ == "__main__": 84 | import sys 85 | 86 | app = QApplication(sys.argv) 87 | form = NewImageDlg() 88 | form.show() 89 | app.exec_() 90 | 91 | -------------------------------------------------------------------------------- /chap06/resizedlg.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright (c) 2008-14 Qtrac Ltd. All rights reserved. 3 | # This program or module is free software: you can redistribute it and/or 4 | # modify it under the terms of the GNU General Public License as published 5 | # by the Free Software Foundation, either version 2 of the License, or 6 | # version 3 of the License, or (at your option) any later version. It is 7 | # provided for educational purposes and is distributed in the hope that 8 | # it will be useful, but WITHOUT ANY WARRANTY; without even the implied 9 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 10 | # the GNU General Public License for more details. 11 | 12 | from __future__ import division 13 | from __future__ import print_function 14 | from __future__ import unicode_literals 15 | from future_builtins import * 16 | 17 | from PyQt4.QtCore import Qt 18 | from PyQt4.QtCore import pyqtSignal as Signal 19 | from PyQt4.QtGui import (QApplication, QDialog, QDialogButtonBox, 20 | QGridLayout, QLabel, QSpinBox) 21 | 22 | 23 | class ResizeDlg(QDialog): 24 | 25 | def __init__(self, width, height, parent=None): 26 | super(ResizeDlg, self).__init__(parent) 27 | self.create_widgets(width, height) 28 | self.layout_widgets() 29 | self.create_connections() 30 | 31 | 32 | def create_widgets(self, width, height): 33 | self.widthLabel = QLabel("&Width:") 34 | self.widthSpinBox = QSpinBox() 35 | self.widthLabel.setBuddy(self.widthSpinBox) 36 | self.widthSpinBox.setAlignment(Qt.AlignRight|Qt.AlignVCenter) 37 | self.widthSpinBox.setRange(4, width * 4) 38 | self.widthSpinBox.setValue(width) 39 | self.heightLabel = QLabel("&Height:") 40 | self.heightSpinBox = QSpinBox() 41 | self.heightLabel.setBuddy(self.heightSpinBox) 42 | self.heightSpinBox.setAlignment(Qt.AlignRight| 43 | Qt.AlignVCenter) 44 | self.heightSpinBox.setRange(4, height * 4) 45 | self.heightSpinBox.setValue(height) 46 | 47 | self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok| 48 | QDialogButtonBox.Cancel) 49 | 50 | 51 | def layout_widgets(self): 52 | layout = QGridLayout() 53 | layout.addWidget(self.widthLabel, 0, 0) 54 | layout.addWidget(self.widthSpinBox, 0, 1) 55 | layout.addWidget(self.heightLabel, 1, 0) 56 | layout.addWidget(self.heightSpinBox, 1, 1) 57 | layout.addWidget(self.buttonBox, 2, 0, 1, 2) 58 | self.setLayout(layout) 59 | 60 | 61 | def create_connections(self): 62 | self.buttonBox.accepted.connect(self.accept) 63 | self.buttonBox.rejected.connect(self.reject) 64 | 65 | self.setWindowTitle("Image Changer - Resize") 66 | 67 | 68 | def result(self): 69 | return self.widthSpinBox.value(), self.heightSpinBox.value() 70 | 71 | 72 | if __name__ == "__main__": 73 | import sys 74 | 75 | app = QApplication(sys.argv) 76 | form = ResizeDlg(64, 128) 77 | form.show() 78 | app.exec_() 79 | 80 | -------------------------------------------------------------------------------- /chap06/resources.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | images/filenew.png 4 | images/fileopen.png 5 | images/filesave.png 6 | images/filesaveas.png 7 | images/fileprint.png 8 | images/filequit.png 9 | images/editinvert.png 10 | images/editswap.png 11 | images/editzoom.png 12 | images/editmirror.png 13 | images/editunmirror.png 14 | images/editmirrorhoriz.png 15 | images/editmirrorvert.png 16 | images/back.png 17 | images/home.png 18 | images/icon.png 19 | 20 | help/editmenu.html 21 | help/filemenu.html 22 | help/index.html 23 | 24 | 25 | -------------------------------------------------------------------------------- /chap07/ticketorderdlg.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright (c) 2008-14 Qtrac Ltd. All rights reserved. 3 | # This program or module is free software: you can redistribute it and/or 4 | # modify it under the terms of the GNU General Public License as published 5 | # by the Free Software Foundation, either version 2 of the License, or 6 | # version 3 of the License, or (at your option) any later version. It is 7 | # provided for educational purposes and is distributed in the hope that 8 | # it will be useful, but WITHOUT ANY WARRANTY; without even the implied 9 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 10 | # the GNU General Public License for more details. 11 | 12 | from __future__ import division 13 | from __future__ import print_function 14 | from __future__ import unicode_literals 15 | from future_builtins import * 16 | 17 | import random 18 | from PyQt4.QtCore import (QDate, Qt, QString) 19 | from PyQt4.QtCore import pyqtSignal as Signal 20 | from PyQt4.QtCore import pyqtSlot as Slot 21 | from PyQt4.QtGui import (QApplication, QDialog, QDialogButtonBox) 22 | 23 | 24 | if random.choice((1, 2)) == 1: 25 | import ui_ticketorderdlg1 as ui_ticketorderdlg 26 | else: 27 | import ui_ticketorderdlg2 as ui_ticketorderdlg 28 | 29 | 30 | class TicketOrderDlg(QDialog, 31 | ui_ticketorderdlg.Ui_TicketOrderDlg): 32 | 33 | def __init__(self, parent=None): 34 | super(TicketOrderDlg, self).__init__(parent) 35 | self.setupUi(self) 36 | today = QDate.currentDate() 37 | self.whenDateTimeEdit.setDateRange(today.addDays(1), 38 | today.addYears(1)) 39 | self.updateUi() 40 | self.customerLineEdit.setFocus() 41 | 42 | 43 | @Slot(QString) 44 | def on_customerLineEdit_textEdited(self, text): 45 | self.updateUi() 46 | 47 | 48 | @Slot(float) 49 | def on_priceSpinBox_valueChanged(self, value): 50 | self.updateUi() 51 | 52 | 53 | @Slot(int) 54 | def on_quantitySpinBox_valueChanged(self, value): 55 | self.updateUi() 56 | 57 | 58 | def updateUi(self): 59 | amount = (self.priceSpinBox.value() * 60 | self.quantitySpinBox.value()) 61 | enable = not self.customerLineEdit.text().isEmpty() and amount 62 | self.buttonBox.button( 63 | QDialogButtonBox.Ok).setEnabled(enable) 64 | self.amountLabel.setText("$ {0:.2f}".format(amount)) 65 | 66 | 67 | def result(self): 68 | when = self.whenDateTimeEdit.dateTime().toPyDateTime() 69 | return (unicode(self.customerLineEdit.text()), when, 70 | self.priceSpinBox.value(), self.quantitySpinBox.value()) 71 | 72 | 73 | if __name__ == "__main__": 74 | import sys 75 | 76 | app = QApplication(sys.argv) 77 | form = TicketOrderDlg() 78 | form.show() 79 | app.exec_() 80 | print(form.result()) 81 | 82 | -------------------------------------------------------------------------------- /chap08/addeditmoviedlg.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright (c) 2008-14 Qtrac Ltd. All rights reserved. 3 | # This program or module is free software: you can redistribute it and/or 4 | # modify it under the terms of the GNU General Public License as published 5 | # by the Free Software Foundation, either version 2 of the License, or 6 | # version 3 of the License, or (at your option) any later version. It is 7 | # provided for educational purposes and is distributed in the hope that 8 | # it will be useful, but WITHOUT ANY WARRANTY; without even the implied 9 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 10 | # the GNU General Public License for more details. 11 | 12 | from __future__ import division 13 | from __future__ import print_function 14 | from __future__ import unicode_literals 15 | from future_builtins import * 16 | 17 | from PyQt4.QtCore import (QDate, QString, Qt) 18 | from PyQt4.QtCore import pyqtSignal as Signal 19 | from PyQt4.QtCore import pyqtSlot as Slot 20 | from PyQt4.QtGui import (QApplication, QDialog, QDialogButtonBox) 21 | import moviedata 22 | import ui_addeditmoviedlg 23 | 24 | 25 | class AddEditMovieDlg(QDialog, 26 | ui_addeditmoviedlg.Ui_AddEditMovieDlg): 27 | 28 | def __init__(self, movies, movie=None, parent=None): 29 | super(AddEditMovieDlg, self).__init__(parent) 30 | self.setupUi(self) 31 | 32 | self.movies = movies 33 | self.movie = movie 34 | self.acquiredDateEdit.setDisplayFormat(moviedata.DATEFORMAT) 35 | if movie is not None: 36 | self.titleLineEdit.setText(movie.title) 37 | self.yearSpinBox.setValue(movie.year) 38 | self.minutesSpinBox.setValue(movie.minutes) 39 | self.acquiredDateEdit.setDate(movie.acquired) 40 | self.acquiredDateEdit.setEnabled(False) 41 | self.notesTextEdit.setPlainText(movie.notes) 42 | self.notesTextEdit.setFocus() 43 | self.buttonBox.button(QDialogButtonBox.Ok).setText( 44 | "&Accept") 45 | self.setWindowTitle("My Movies - Edit Movie") 46 | else: 47 | today = QDate.currentDate() 48 | self.acquiredDateEdit.setDateRange(today.addDays(-5), 49 | today) 50 | self.acquiredDateEdit.setDate(today) 51 | self.titleLineEdit.setFocus() 52 | self.on_titleLineEdit_textEdited(QString()) 53 | 54 | 55 | @Slot(QString) 56 | def on_titleLineEdit_textEdited(self, text): 57 | self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( 58 | not self.titleLineEdit.text().isEmpty()) 59 | 60 | 61 | def accept(self): 62 | title = self.titleLineEdit.text() 63 | year = self.yearSpinBox.value() 64 | minutes = self.minutesSpinBox.value() 65 | notes = self.notesTextEdit.toPlainText() 66 | if self.movie is None: 67 | acquired = self.acquiredDateEdit.date() 68 | self.movie = moviedata.Movie(title, year, minutes, 69 | acquired, notes) 70 | self.movies.add(self.movie) 71 | else: 72 | self.movies.updateMovie(self.movie, title, year, 73 | minutes, notes) 74 | QDialog.accept(self) 75 | 76 | 77 | if __name__ == "__main__": 78 | import sys 79 | 80 | app = QApplication(sys.argv) 81 | form = AddEditMovieDlg(set()) 82 | form.show() 83 | app.exec_() 84 | 85 | -------------------------------------------------------------------------------- /chap08/addeditmoviedlg_ans.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright (c) 2008-14 Qtrac Ltd. All rights reserved. 3 | # This program or module is free software: you can redistribute it and/or 4 | # modify it under the terms of the GNU General Public License as published 5 | # by the Free Software Foundation, either version 2 of the License, or 6 | # version 3 of the License, or (at your option) any later version. It is 7 | # provided for educational purposes and is distributed in the hope that 8 | # it will be useful, but WITHOUT ANY WARRANTY; without even the implied 9 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 10 | # the GNU General Public License for more details. 11 | 12 | from __future__ import division 13 | from __future__ import print_function 14 | from __future__ import unicode_literals 15 | from future_builtins import * 16 | 17 | from PyQt4.QtCore import (QDate, QString, Qt) 18 | from PyQt4.QtCore import pyqtSignal as Signal 19 | from PyQt4.QtCore import pyqtSlot as Slot 20 | from PyQt4.QtGui import (QApplication, QDialog, QDialogButtonBox) 21 | import moviedata_ans as moviedata 22 | import ui_addeditmoviedlg_ans as ui_addeditmoviedlg 23 | 24 | 25 | class AddEditMovieDlg(QDialog, 26 | ui_addeditmoviedlg.Ui_AddEditMovieDlg): 27 | 28 | def __init__(self, movies, movie=None, parent=None): 29 | super(AddEditMovieDlg, self).__init__(parent) 30 | self.setupUi(self) 31 | 32 | self.movies = movies 33 | self.movie = movie 34 | self.acquiredDateEdit.setDisplayFormat(moviedata.DATEFORMAT) 35 | if movie is not None: 36 | self.titleLineEdit.setText(movie.title) 37 | self.yearSpinBox.setValue(movie.year) 38 | self.minutesSpinBox.setValue(movie.minutes) 39 | self.acquiredDateEdit.setDate(movie.acquired) 40 | self.acquiredDateEdit.setEnabled(False) 41 | self.locationLineEdit.setText(movie.location) 42 | self.notesTextEdit.setPlainText(movie.notes) 43 | self.notesTextEdit.setFocus() 44 | self.buttonBox.button(QDialogButtonBox.Ok).setText( 45 | "&Accept") 46 | self.setWindowTitle("My Movies - Edit Movie") 47 | else: 48 | today = QDate.currentDate() 49 | self.acquiredDateEdit.setDateRange(today.addDays(-5), 50 | today) 51 | self.acquiredDateEdit.setDate(today) 52 | self.titleLineEdit.setFocus() 53 | self.on_titleLineEdit_textEdited(QString()) 54 | 55 | 56 | @Slot(QString) 57 | def on_titleLineEdit_textEdited(self, text): 58 | self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( 59 | not self.titleLineEdit.text().isEmpty()) 60 | 61 | 62 | def accept(self): 63 | title = self.titleLineEdit.text() 64 | year = self.yearSpinBox.value() 65 | minutes = self.minutesSpinBox.value() 66 | location = self.locationLineEdit.text() 67 | notes = self.notesTextEdit.toPlainText() 68 | if self.movie is None: 69 | acquired = self.acquiredDateEdit.date() 70 | self.movie = moviedata.Movie(title, year, minutes, 71 | acquired, location, notes) 72 | self.movies.add(self.movie) 73 | else: 74 | self.movies.updateMovie(self.movie, title, year, 75 | minutes, location, notes) 76 | QDialog.accept(self) 77 | 78 | 79 | if __name__ == "__main__": 80 | import sys 81 | 82 | app = QApplication(sys.argv) 83 | form = AddEditMovieDlg(set(), 0) 84 | form.show() 85 | app.exec_() 86 | 87 | -------------------------------------------------------------------------------- /chap08/images/editadd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap08/images/editadd.png -------------------------------------------------------------------------------- /chap08/images/editdelete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap08/images/editdelete.png -------------------------------------------------------------------------------- /chap08/images/editedit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap08/images/editedit.png -------------------------------------------------------------------------------- /chap08/images/filenew.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap08/images/filenew.png -------------------------------------------------------------------------------- /chap08/images/fileopen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap08/images/fileopen.png -------------------------------------------------------------------------------- /chap08/images/filequit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap08/images/filequit.png -------------------------------------------------------------------------------- /chap08/images/filesave.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap08/images/filesave.png -------------------------------------------------------------------------------- /chap08/images/filesaveas.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap08/images/filesaveas.png -------------------------------------------------------------------------------- /chap08/images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap08/images/icon.png -------------------------------------------------------------------------------- /chap08/mymovies.mqb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap08/mymovies.mqb -------------------------------------------------------------------------------- /chap08/resources.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | images/filenew.png 4 | images/fileopen.png 5 | images/filesave.png 6 | images/filesaveas.png 7 | images/filequit.png 8 | images/editadd.png 9 | images/editedit.png 10 | images/editdelete.png 11 | images/icon.png 12 | 13 | 14 | -------------------------------------------------------------------------------- /chap09/findandreplacedlg.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright (c) 2008-14 Qtrac Ltd. All rights reserved. 3 | # This program or module is free software: you can redistribute it and/or 4 | # modify it under the terms of the GNU General Public License as published 5 | # by the Free Software Foundation, either version 2 of the License, or 6 | # version 3 of the License, or (at your option) any later version. It is 7 | # provided for educational purposes and is distributed in the hope that 8 | # it will be useful, but WITHOUT ANY WARRANTY; without even the implied 9 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 10 | # the GNU General Public License for more details. 11 | 12 | from __future__ import division 13 | from __future__ import print_function 14 | from __future__ import unicode_literals 15 | from future_builtins import * 16 | 17 | from PyQt4.QtCore import (Qt, QString) 18 | from PyQt4.QtCore import pyqtSignal as Signal 19 | from PyQt4.QtCore import pyqtSlot as Slot 20 | from PyQt4.QtGui import (QApplication, QDialog, QLayout) 21 | import ui_findandreplacedlg 22 | 23 | 24 | class FindAndReplaceDlg(QDialog, 25 | ui_findandreplacedlg.Ui_FindAndReplaceDlg): 26 | 27 | find = Signal(QString, bool, bool, bool, bool, bool) 28 | replace = Signal(QString, QString, bool, bool, bool, bool, bool) 29 | 30 | def __init__(self, parent=None): 31 | super(FindAndReplaceDlg, self).__init__(parent) 32 | self.setupUi(self) 33 | self.moreFrame.hide() 34 | self.layout().setSizeConstraint(QLayout.SetFixedSize) 35 | self.updateUi() 36 | 37 | 38 | @Slot(QString) 39 | def on_findLineEdit_textEdited(self, text): 40 | self.updateUi() 41 | 42 | 43 | @Slot() 44 | def on_findButton_clicked(self): 45 | self.find.emit(self.findLineEdit.text(), 46 | self.caseCheckBox.isChecked(), 47 | self.wholeCheckBox.isChecked(), 48 | self.backwardsCheckBox.isChecked(), 49 | self.regexCheckBox.isChecked(), 50 | self.ignoreNotesCheckBox.isChecked()) 51 | 52 | 53 | @Slot() 54 | def on_replaceButton_clicked(self): 55 | self.replace.emit(self.findLineEdit.text(), 56 | self.replaceLineEdit.text(), 57 | self.caseCheckBox.isChecked(), 58 | self.wholeCheckBox.isChecked(), 59 | self.backwardsCheckBox.isChecked(), 60 | self.regexCheckBox.isChecked(), 61 | self.ignoreNotesCheckBox.isChecked()) 62 | 63 | 64 | def updateUi(self): 65 | enable = not self.findLineEdit.text().isEmpty() 66 | self.findButton.setEnabled(enable) 67 | self.replaceButton.setEnabled(enable) 68 | 69 | 70 | 71 | if __name__ == "__main__": 72 | import sys 73 | 74 | def find(what, *args): 75 | print("Find {0} {1}".format(what, [x for x in args])) 76 | 77 | def replace(old, new, *args): 78 | print("Replace {0} with {1} {2}".format( 79 | old, new, [x for x in args])) 80 | 81 | app = QApplication(sys.argv) 82 | form = FindAndReplaceDlg() 83 | form.find.connect(find) 84 | form.replace.connect(replace) 85 | form.show() 86 | app.exec_() 87 | 88 | -------------------------------------------------------------------------------- /chap09/images/editadd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap09/images/editadd.png -------------------------------------------------------------------------------- /chap09/images/editcopy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap09/images/editcopy.png -------------------------------------------------------------------------------- /chap09/images/editcut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap09/images/editcut.png -------------------------------------------------------------------------------- /chap09/images/editdelete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap09/images/editdelete.png -------------------------------------------------------------------------------- /chap09/images/editedit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap09/images/editedit.png -------------------------------------------------------------------------------- /chap09/images/editpaste.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap09/images/editpaste.png -------------------------------------------------------------------------------- /chap09/images/filenew.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap09/images/filenew.png -------------------------------------------------------------------------------- /chap09/images/fileopen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap09/images/fileopen.png -------------------------------------------------------------------------------- /chap09/images/filequit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap09/images/filequit.png -------------------------------------------------------------------------------- /chap09/images/filesave.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap09/images/filesave.png -------------------------------------------------------------------------------- /chap09/images/filesaveas.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap09/images/filesaveas.png -------------------------------------------------------------------------------- /chap09/images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap09/images/icon.png -------------------------------------------------------------------------------- /chap09/paymentdlg.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright (c) 2008-14 Qtrac Ltd. All rights reserved. 3 | # This program or module is free software: you can redistribute it and/or 4 | # modify it under the terms of the GNU General Public License as published 5 | # by the Free Software Foundation, either version 2 of the License, or 6 | # version 3 of the License, or (at your option) any later version. It is 7 | # provided for educational purposes and is distributed in the hope that 8 | # it will be useful, but WITHOUT ANY WARRANTY; without even the implied 9 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 10 | # the GNU General Public License for more details. 11 | 12 | from __future__ import division 13 | from __future__ import print_function 14 | from __future__ import unicode_literals 15 | from future_builtins import * 16 | 17 | import sys 18 | from PyQt4.QtCore import (QDate, Qt) 19 | from PyQt4.QtGui import (QApplication, QDialog, QDialogButtonBox) 20 | import ui_paymentdlg 21 | 22 | 23 | class PaymentDlg(QDialog, ui_paymentdlg.Ui_PaymentDlg): 24 | 25 | def __init__(self, parent=None): 26 | super(PaymentDlg, self).__init__(parent) 27 | self.setupUi(self) 28 | for lineEdit in (self.forenameLineEdit, self.surnameLineEdit, 29 | self.checkNumLineEdit, self.accountNumLineEdit, 30 | self.bankLineEdit, self.sortCodeLineEdit, 31 | self.creditCardLineEdit): 32 | lineEdit.textEdited.connect(self.updateUi) 33 | for dateEdit in (self.validFromDateEdit, self.expiryDateEdit): 34 | dateEdit.dateChanged.connect(self.updateUi) 35 | self.paidCheckBox.clicked.connect(self.updateUi) 36 | self.updateUi() 37 | self.forenameLineEdit.setFocus() 38 | 39 | 40 | def updateUi(self): 41 | today = QDate.currentDate() 42 | enable = (not (self.forenameLineEdit.text().isEmpty() or 43 | self.surnameLineEdit.text().isEmpty())) 44 | if enable: 45 | enable = (self.paidCheckBox.isChecked() or 46 | (not (self.checkNumLineEdit.text().isEmpty() or 47 | self.accountNumLineEdit.text().isEmpty() or 48 | self.bankLineEdit.text().isEmpty() or 49 | self.sortCodeLineEdit.text().isEmpty())) or 50 | (not self.creditCardLineEdit.text().isEmpty() and 51 | self.validFromDateEdit.date() <= today and 52 | self.expiryDateEdit.date() >= today)) 53 | self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enable) 54 | 55 | 56 | if __name__ == "__main__": 57 | app = QApplication(sys.argv) 58 | form = PaymentDlg() 59 | form.show() 60 | app.exec_() 61 | 62 | -------------------------------------------------------------------------------- /chap09/resources.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | images/icon.png 4 | images/filenew.png 5 | images/fileopen.png 6 | images/filesave.png 7 | images/filesaveas.png 8 | images/filequit.png 9 | images/filequit.png 10 | images/editcut.png 11 | images/editcopy.png 12 | images/editpaste.png 13 | images/editadd.png 14 | images/editedit.png 15 | images/editdelete.png 16 | 17 | 18 | -------------------------------------------------------------------------------- /chap09/textedit.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright (c) 2008-14 Qtrac Ltd. All rights reserved. 3 | # This program or module is free software: you can redistribute it and/or 4 | # modify it under the terms of the GNU General Public License as published 5 | # by the Free Software Foundation, either version 2 of the License, or 6 | # version 3 of the License, or (at your option) any later version. It is 7 | # provided for educational purposes and is distributed in the hope that 8 | # it will be useful, but WITHOUT ANY WARRANTY; without even the implied 9 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 10 | # the GNU General Public License for more details. 11 | 12 | from __future__ import division 13 | from __future__ import print_function 14 | from __future__ import unicode_literals 15 | from future_builtins import * 16 | 17 | import codecs 18 | from PyQt4.QtCore import (QFile, QFileInfo, QIODevice, QString, 19 | QTextStream, Qt) 20 | from PyQt4.QtGui import (QFileDialog, QMessageBox, QTextEdit) 21 | 22 | 23 | class TextEdit(QTextEdit): 24 | 25 | NextId = 1 26 | 27 | def __init__(self, filename=QString(), parent=None): 28 | super(TextEdit, self).__init__(parent) 29 | self.setAttribute(Qt.WA_DeleteOnClose) 30 | self.filename = filename 31 | if self.filename.isEmpty(): 32 | self.filename = QString("Unnamed-{0}.txt".format( 33 | TextEdit.NextId)) 34 | TextEdit.NextId += 1 35 | self.document().setModified(False) 36 | self.setWindowTitle(QFileInfo(self.filename).fileName()) 37 | 38 | 39 | def closeEvent(self, event): 40 | if (self.document().isModified() and 41 | QMessageBox.question(self, 42 | "Text Editor - Unsaved Changes", 43 | "Save unsaved changes in {0}?".format(self.filename), 44 | QMessageBox.Yes|QMessageBox.No) == 45 | QMessageBox.Yes): 46 | try: 47 | self.save() 48 | except (IOError, OSError), err: 49 | QMessageBox.warning(self, 50 | "Text Editor -- Save Error", 51 | "Failed to save {0}: {1}".format(self.filename, err)) 52 | 53 | 54 | def isModified(self): 55 | return self.document().isModified() 56 | 57 | 58 | def save(self): 59 | if self.filename.startsWith("Unnamed"): 60 | filename = QFileDialog.getSaveFileName(self, 61 | "Text Editor -- Save File As", self.filename, 62 | "Text files (*.txt *.*)") 63 | if filename.isEmpty(): 64 | return 65 | self.filename = filename 66 | self.setWindowTitle(QFileInfo(self.filename).fileName()) 67 | with codecs.open(self.filename, "wt", encoding="utf-8") as file: 68 | file.write(self.toPlainText()) 69 | self.document().setModified(False) 70 | 71 | 72 | def load(self): 73 | with codecs.open(self.filename, encoding="utf-8") as file: 74 | self.setPlainText(file.read()) 75 | self.document().setModified(False) 76 | -------------------------------------------------------------------------------- /chap09/vehiclerentaldlg.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright (c) 2008-14 Qtrac Ltd. All rights reserved. 3 | # This program or module is free software: you can redistribute it and/or 4 | # modify it under the terms of the GNU General Public License as published 5 | # by the Free Software Foundation, either version 2 of the License, or 6 | # version 3 of the License, or (at your option) any later version. It is 7 | # provided for educational purposes and is distributed in the hope that 8 | # it will be useful, but WITHOUT ANY WARRANTY; without even the implied 9 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 10 | # the GNU General Public License for more details. 11 | 12 | from __future__ import division 13 | from __future__ import print_function 14 | from __future__ import unicode_literals 15 | from future_builtins import * 16 | 17 | import sys 18 | from PyQt4.QtCore import (Qt, QString) 19 | from PyQt4.QtCore import pyqtSignal as Signal 20 | from PyQt4.QtCore import pyqtSlot as Slot 21 | from PyQt4.QtGui import (QApplication, QDialog) 22 | import ui_vehiclerentaldlg 23 | 24 | 25 | class VehicleRentalDlg(QDialog, 26 | ui_vehiclerentaldlg.Ui_VehicleRentalDlg): 27 | 28 | def __init__(self, parent=None): 29 | super(VehicleRentalDlg, self).__init__(parent) 30 | self.setupUi(self) 31 | self.vehicleComboBox.setFocus() 32 | 33 | 34 | @Slot(QString) 35 | def on_vehicleComboBox_currentIndexChanged(self, text): 36 | if text == "Car": 37 | self.mileageLabel.setText("1000 miles") 38 | else: 39 | self.on_weightSpinBox_valueChanged( 40 | self.weightSpinBox.value()) 41 | 42 | 43 | @Slot(int) 44 | def on_weightSpinBox_valueChanged(self, amount): 45 | self.mileageLabel.setText("{0} miles".format(8000 / amount)) 46 | 47 | 48 | if __name__ == "__main__": 49 | app = QApplication(sys.argv) 50 | form = VehicleRentalDlg() 51 | form.show() 52 | app.exec_() 53 | -------------------------------------------------------------------------------- /chap10/clipboard.pyw: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright (c) 2008-14 Qtrac Ltd. All rights reserved. 3 | # This program or module is free software: you can redistribute it and/or 4 | # modify it under the terms of the GNU General Public License as published 5 | # by the Free Software Foundation, either version 2 of the License, or 6 | # version 3 of the License, or (at your option) any later version. It is 7 | # provided for educational purposes and is distributed in the hope that 8 | # it will be useful, but WITHOUT ANY WARRANTY; without even the implied 9 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 10 | # the GNU General Public License for more details. 11 | 12 | from __future__ import division 13 | from __future__ import print_function 14 | from __future__ import unicode_literals 15 | from future_builtins import * 16 | 17 | import os 18 | import sys 19 | from PyQt4.QtCore import (QMimeData, Qt) 20 | from PyQt4.QtCore import pyqtSignal as Signal 21 | from PyQt4.QtGui import (QApplication, QDialog, QGridLayout, QLabel, 22 | QPixmap, QPushButton) 23 | 24 | 25 | class Form(QDialog): 26 | 27 | def __init__(self, parent=None): 28 | super(Form, self).__init__(parent) 29 | 30 | textCopyButton = QPushButton("&Copy Text") 31 | textPasteButton = QPushButton("Paste &Text") 32 | htmlCopyButton = QPushButton("C&opy HTML") 33 | htmlPasteButton = QPushButton("Paste &HTML") 34 | imageCopyButton = QPushButton("Co&py Image") 35 | imagePasteButton = QPushButton("Paste &Image") 36 | self.textLabel = QLabel("Original text") 37 | self.imageLabel = QLabel() 38 | self.imageLabel.setPixmap(QPixmap(os.path.join( 39 | os.path.dirname(__file__), "images/clock.png"))) 40 | 41 | layout = QGridLayout() 42 | layout.addWidget(textCopyButton, 0, 0) 43 | layout.addWidget(imageCopyButton, 0, 1) 44 | layout.addWidget(htmlCopyButton, 0, 2) 45 | layout.addWidget(textPasteButton, 1, 0) 46 | layout.addWidget(imagePasteButton, 1, 1) 47 | layout.addWidget(htmlPasteButton, 1, 2) 48 | layout.addWidget(self.textLabel, 2, 0, 1, 2) 49 | layout.addWidget(self.imageLabel, 2, 2) 50 | self.setLayout(layout) 51 | 52 | textCopyButton.clicked.connect(self.copyText) 53 | textPasteButton.clicked.connect(self.pasteText) 54 | htmlCopyButton.clicked.connect(self.copyHtml) 55 | htmlPasteButton.clicked.connect(self.pasteHtml) 56 | imageCopyButton.clicked.connect(self.copyImage) 57 | imagePasteButton.clicked.connect(self.pasteImage) 58 | 59 | self.setWindowTitle("Clipboard") 60 | 61 | 62 | def copyText(self): 63 | clipboard = QApplication.clipboard() 64 | clipboard.setText("I've been clipped!") 65 | 66 | 67 | def pasteText(self): 68 | clipboard = QApplication.clipboard() 69 | self.textLabel.setText(clipboard.text()) 70 | 71 | 72 | def copyImage(self): 73 | clipboard = QApplication.clipboard() 74 | clipboard.setPixmap(QPixmap(os.path.join( 75 | os.path.dirname(__file__), "images/gvim.png"))) 76 | 77 | def pasteImage(self): 78 | clipboard = QApplication.clipboard() 79 | self.imageLabel.setPixmap(clipboard.pixmap()) 80 | 81 | 82 | def copyHtml(self): 83 | mimeData = QMimeData() 84 | mimeData.setHtml("Bold and Red") 85 | clipboard = QApplication.clipboard() 86 | clipboard.setMimeData(mimeData) 87 | 88 | 89 | def pasteHtml(self): 90 | clipboard = QApplication.clipboard() 91 | mimeData = clipboard.mimeData() 92 | if mimeData.hasHtml(): 93 | self.textLabel.setText(mimeData.html()) 94 | 95 | 96 | if __name__ == "__main__": 97 | app = QApplication(sys.argv) 98 | form = Form() 99 | form.show() 100 | app.exec_() 101 | -------------------------------------------------------------------------------- /chap10/draganddrop.pyw: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright (c) 2008-14 Qtrac Ltd. All rights reserved. 3 | # This program or module is free software: you can redistribute it and/or 4 | # modify it under the terms of the GNU General Public License as published 5 | # by the Free Software Foundation, either version 2 of the License, or 6 | # version 3 of the License, or (at your option) any later version. It is 7 | # provided for educational purposes and is distributed in the hope that 8 | # it will be useful, but WITHOUT ANY WARRANTY; without even the implied 9 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 10 | # the GNU General Public License for more details. 11 | 12 | from __future__ import division 13 | from __future__ import print_function 14 | from __future__ import unicode_literals 15 | from future_builtins import * 16 | 17 | import os 18 | import sys 19 | from PyQt4.QtCore import Qt 20 | from PyQt4.QtGui import (QApplication, QDialog, QHBoxLayout, QIcon, 21 | QListWidget, QListWidgetItem, QSplitter, QTableWidget) 22 | 23 | 24 | class Form(QDialog): 25 | 26 | def __init__(self, parent=None): 27 | super(Form, self).__init__(parent) 28 | self.create_widgets() 29 | self.layout_widgets() 30 | self.setWindowTitle("Drag and Drop") 31 | 32 | 33 | def create_widgets(self): 34 | self.listWidget = QListWidget() 35 | self.listWidget.setAcceptDrops(True) 36 | self.listWidget.setDragEnabled(True) 37 | path = os.path.dirname(__file__) 38 | for image in sorted(os.listdir(os.path.join(path, "images"))): 39 | if image.endswith(".png"): 40 | item = QListWidgetItem(image.split(".")[0].capitalize()) 41 | item.setIcon(QIcon(os.path.join(path, 42 | "images/{0}".format(image)))) 43 | self.listWidget.addItem(item) 44 | self.iconListWidget = QListWidget() 45 | self.iconListWidget.setAcceptDrops(True) 46 | self.iconListWidget.setDragEnabled(True) 47 | self.iconListWidget.setViewMode(QListWidget.IconMode) 48 | self.tableWidget = QTableWidget() 49 | self.tableWidget.setRowCount(5) 50 | self.tableWidget.setColumnCount(2) 51 | self.tableWidget.setHorizontalHeaderLabels(["Column #1", 52 | "Column #2"]) 53 | self.tableWidget.setAcceptDrops(True) 54 | self.tableWidget.setDragEnabled(True) 55 | 56 | 57 | def layout_widgets(self): 58 | splitter = QSplitter(Qt.Horizontal) 59 | splitter.addWidget(self.listWidget) 60 | splitter.addWidget(self.iconListWidget) 61 | splitter.addWidget(self.tableWidget) 62 | layout = QHBoxLayout() 63 | layout.addWidget(splitter) 64 | self.setLayout(layout) 65 | 66 | 67 | 68 | if __name__ == "__main__": 69 | app = QApplication(sys.argv) 70 | form = Form() 71 | form.show() 72 | app.exec_() 73 | -------------------------------------------------------------------------------- /chap10/images/abiword.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap10/images/abiword.png -------------------------------------------------------------------------------- /chap10/images/blender.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap10/images/blender.png -------------------------------------------------------------------------------- /chap10/images/clock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap10/images/clock.png -------------------------------------------------------------------------------- /chap10/images/designer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap10/images/designer.png -------------------------------------------------------------------------------- /chap10/images/emacs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap10/images/emacs.png -------------------------------------------------------------------------------- /chap10/images/firefox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap10/images/firefox.png -------------------------------------------------------------------------------- /chap10/images/gnumeric.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap10/images/gnumeric.png -------------------------------------------------------------------------------- /chap10/images/gv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap10/images/gv.png -------------------------------------------------------------------------------- /chap10/images/gvim.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap10/images/gvim.png -------------------------------------------------------------------------------- /chap10/images/kwin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap10/images/kwin.png -------------------------------------------------------------------------------- /chap10/images/mozilla.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap10/images/mozilla.png -------------------------------------------------------------------------------- /chap10/images/nedit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap10/images/nedit.png -------------------------------------------------------------------------------- /chap10/images/opera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap10/images/opera.png -------------------------------------------------------------------------------- /chap10/images/penguin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap10/images/penguin.png -------------------------------------------------------------------------------- /chap10/images/scribus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap10/images/scribus.png -------------------------------------------------------------------------------- /chap10/images/tux.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap10/images/tux.png -------------------------------------------------------------------------------- /chap10/images/usb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap10/images/usb.png -------------------------------------------------------------------------------- /chap10/images/vnc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap10/images/vnc.png -------------------------------------------------------------------------------- /chap10/images/x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap10/images/x.png -------------------------------------------------------------------------------- /chap11/romanspinbox.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright (c) 2008-14 Qtrac Ltd. All rights reserved. 3 | # This program or module is free software: you can redistribute it and/or 4 | # modify it under the terms of the GNU General Public License as published 5 | # by the Free Software Foundation, either version 2 of the License, or 6 | # version 3 of the License, or (at your option) any later version. It is 7 | # provided for educational purposes and is distributed in the hope that 8 | # it will be useful, but WITHOUT ANY WARRANTY; without even the implied 9 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 10 | # the GNU General Public License for more details. 11 | 12 | from __future__ import division 13 | from __future__ import print_function 14 | from __future__ import unicode_literals 15 | from future_builtins import * 16 | 17 | import re 18 | import sys 19 | from PyQt4.QtCore import (QRegExp, Qt) 20 | from PyQt4.QtGui import (QApplication, QRegExpValidator, QSpinBox) 21 | 22 | 23 | def romanFromInt(integer): 24 | """ 25 | Code taken from Raymond Hettinger's code in Victor Yang's "Decimal 26 | to Roman Numerals" recipe in the Python Cookbook. 27 | 28 | >>> r = [romanFromInt(x) for x in range(1, 4000)] 29 | >>> i = [intFromRoman(x) for x in r] 30 | >>> i == [x for x in range(1, 4000)] 31 | True 32 | """ 33 | coding = zip( 34 | [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1], 35 | ["M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", 36 | "IV", "I"]) 37 | if integer <= 0 or integer >= 4000 or int(integer) != integer: 38 | raise ValueError("expecting an integer between 1 and 3999") 39 | result = [] 40 | for decimal, roman in coding: 41 | while integer >= decimal: 42 | result.append(roman) 43 | integer -= decimal 44 | return "".join(result) 45 | 46 | 47 | def intFromRoman(roman): 48 | """ 49 | Code taken from Paul Winkler's "Roman Numerals" recipe in the Python 50 | Cookbook. 51 | """ 52 | roman = roman.upper() 53 | coding = (("M", 1000, 3), ("CM", 900, 1), ("D", 500, 1), 54 | ("CD", 400, 1), ("C", 100, 3), ("XC", 90, 1), 55 | ("L", 50, 1), ("XL", 40, 1), ("X", 10, 3), 56 | ("IX", 9, 1), ("V", 5, 1), ("IV", 4, 1), ("I", 1, 3)) 57 | integer, index = 0, 0 58 | for numeral, value, maxrepeat in coding: 59 | count = 0 60 | while roman[index: index +len(numeral)] == numeral: 61 | count += 1 62 | if count > maxrepeat: 63 | raise ValueError, "not a valid roman number: {0}".format( 64 | roman) 65 | integer += value 66 | index += len(numeral) 67 | if index != len(roman): 68 | raise ValueError, "not a valid roman number: {0}".format(roman) 69 | return integer 70 | 71 | 72 | # Regex adapted from Mark Pilgrim's "Dive Into Python" book 73 | class RomanSpinBox(QSpinBox): 74 | 75 | def __init__(self, parent=None): 76 | super(RomanSpinBox, self).__init__(parent) 77 | regex = QRegExp(r"^M?M?M?(?:CM|CD|D?C?C?C?)" 78 | r"(?:XC|XL|L?X?X?X?)(?:IX|IV|V?I?I?I?)$") 79 | regex.setCaseSensitivity(Qt.CaseInsensitive) 80 | self.validator = QRegExpValidator(regex, self) 81 | self.setRange(1, 3999) 82 | self.lineEdit().textEdited.connect(self.fixCase) 83 | 84 | 85 | def fixCase(self, text): 86 | self.lineEdit().setText(text.toUpper()) 87 | 88 | 89 | def validate(self, text, pos): 90 | return self.validator.validate(text, pos) 91 | 92 | 93 | def valueFromText(self, text): 94 | return intFromRoman(unicode(text)) 95 | 96 | 97 | def textFromValue(self, value): 98 | return romanFromInt(value) 99 | 100 | 101 | if __name__ == "__main__": 102 | def report(value): 103 | print("{0:4d} {1}".format(value, romanFromInt(value))) 104 | 105 | app = QApplication(sys.argv) 106 | spinbox = RomanSpinBox() 107 | spinbox.show() 108 | spinbox.setWindowTitle("Roman") 109 | spinbox.valueChanged.connect(report) 110 | app.exec_() 111 | -------------------------------------------------------------------------------- /chap13/images/editadd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap13/images/editadd.png -------------------------------------------------------------------------------- /chap13/images/editcopy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap13/images/editcopy.png -------------------------------------------------------------------------------- /chap13/images/editcut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap13/images/editcut.png -------------------------------------------------------------------------------- /chap13/images/editdelete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap13/images/editdelete.png -------------------------------------------------------------------------------- /chap13/images/editedit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap13/images/editedit.png -------------------------------------------------------------------------------- /chap13/images/editindent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap13/images/editindent.png -------------------------------------------------------------------------------- /chap13/images/editpaste.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap13/images/editpaste.png -------------------------------------------------------------------------------- /chap13/images/editunindent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap13/images/editunindent.png -------------------------------------------------------------------------------- /chap13/images/filenew.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap13/images/filenew.png -------------------------------------------------------------------------------- /chap13/images/fileopen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap13/images/fileopen.png -------------------------------------------------------------------------------- /chap13/images/filequit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap13/images/filequit.png -------------------------------------------------------------------------------- /chap13/images/filesave.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap13/images/filesave.png -------------------------------------------------------------------------------- /chap13/images/filesaveas.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap13/images/filesaveas.png -------------------------------------------------------------------------------- /chap13/images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap13/images/icon.png -------------------------------------------------------------------------------- /chap13/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap13/images/logo.png -------------------------------------------------------------------------------- /chap13/resources.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | images/logo.png 4 | images/icon.png 5 | images/filenew.png 6 | images/fileopen.png 7 | images/filesave.png 8 | images/filesaveas.png 9 | images/filequit.png 10 | images/editcut.png 11 | images/editcopy.png 12 | images/editpaste.png 13 | images/editadd.png 14 | images/editedit.png 15 | images/editdelete.png 16 | images/editindent.png 17 | images/editunindent.png 18 | 19 | 20 | -------------------------------------------------------------------------------- /chap15/images/add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap15/images/add.png -------------------------------------------------------------------------------- /chap15/images/assetmanagersplash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap15/images/assetmanagersplash.png -------------------------------------------------------------------------------- /chap15/images/delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap15/images/delete.png -------------------------------------------------------------------------------- /chap15/images/first.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap15/images/first.png -------------------------------------------------------------------------------- /chap15/images/last.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap15/images/last.png -------------------------------------------------------------------------------- /chap15/images/next.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap15/images/next.png -------------------------------------------------------------------------------- /chap15/images/phonelogsplash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap15/images/phonelogsplash.png -------------------------------------------------------------------------------- /chap15/images/prev.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap15/images/prev.png -------------------------------------------------------------------------------- /chap15/images/quit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap15/images/quit.png -------------------------------------------------------------------------------- /chap15/resources.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | images/first.png 4 | images/prev.png 5 | images/next.png 6 | images/last.png 7 | images/add.png 8 | images/delete.png 9 | images/quit.png 10 | images/assetmanagersplash.png 11 | images/phonelogsplash.png 12 | 13 | 14 | -------------------------------------------------------------------------------- /chap16/flags/Aaland.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Aaland.png -------------------------------------------------------------------------------- /chap16/flags/Abkhazia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Abkhazia.png -------------------------------------------------------------------------------- /chap16/flags/Afghanistan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Afghanistan.png -------------------------------------------------------------------------------- /chap16/flags/Albania.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Albania.png -------------------------------------------------------------------------------- /chap16/flags/Algeria.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Algeria.png -------------------------------------------------------------------------------- /chap16/flags/American_Samoa.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/American_Samoa.png -------------------------------------------------------------------------------- /chap16/flags/Andorra.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Andorra.png -------------------------------------------------------------------------------- /chap16/flags/Angola.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Angola.png -------------------------------------------------------------------------------- /chap16/flags/Anguilla.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Anguilla.png -------------------------------------------------------------------------------- /chap16/flags/Antigua_and_Barbuda.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Antigua_and_Barbuda.png -------------------------------------------------------------------------------- /chap16/flags/Argentina.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Argentina.png -------------------------------------------------------------------------------- /chap16/flags/Armenia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Armenia.png -------------------------------------------------------------------------------- /chap16/flags/Aruba.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Aruba.png -------------------------------------------------------------------------------- /chap16/flags/Australia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Australia.png -------------------------------------------------------------------------------- /chap16/flags/Austria.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Austria.png -------------------------------------------------------------------------------- /chap16/flags/Azerbaijan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Azerbaijan.png -------------------------------------------------------------------------------- /chap16/flags/Bahamas.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Bahamas.png -------------------------------------------------------------------------------- /chap16/flags/Bahrain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Bahrain.png -------------------------------------------------------------------------------- /chap16/flags/Bangladesh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Bangladesh.png -------------------------------------------------------------------------------- /chap16/flags/Barbados.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Barbados.png -------------------------------------------------------------------------------- /chap16/flags/Belarus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Belarus.png -------------------------------------------------------------------------------- /chap16/flags/Belgium.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Belgium.png -------------------------------------------------------------------------------- /chap16/flags/Belize.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Belize.png -------------------------------------------------------------------------------- /chap16/flags/Benin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Benin.png -------------------------------------------------------------------------------- /chap16/flags/Bermuda.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Bermuda.png -------------------------------------------------------------------------------- /chap16/flags/Bhutan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Bhutan.png -------------------------------------------------------------------------------- /chap16/flags/Bolivia_state.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Bolivia_state.png -------------------------------------------------------------------------------- /chap16/flags/Bosnia_and_Herzegovina.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Bosnia_and_Herzegovina.png -------------------------------------------------------------------------------- /chap16/flags/Botswana.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Botswana.png -------------------------------------------------------------------------------- /chap16/flags/Brazil.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Brazil.png -------------------------------------------------------------------------------- /chap16/flags/British_Virgin_Islands.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/British_Virgin_Islands.png -------------------------------------------------------------------------------- /chap16/flags/Brunei.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Brunei.png -------------------------------------------------------------------------------- /chap16/flags/Bulgaria.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Bulgaria.png -------------------------------------------------------------------------------- /chap16/flags/Burkina_Faso.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Burkina_Faso.png -------------------------------------------------------------------------------- /chap16/flags/Burundi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Burundi.png -------------------------------------------------------------------------------- /chap16/flags/Cambodia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Cambodia.png -------------------------------------------------------------------------------- /chap16/flags/Cameroon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Cameroon.png -------------------------------------------------------------------------------- /chap16/flags/Canada.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Canada.png -------------------------------------------------------------------------------- /chap16/flags/Cape_Verde.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Cape_Verde.png -------------------------------------------------------------------------------- /chap16/flags/Cayman_Islands.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Cayman_Islands.png -------------------------------------------------------------------------------- /chap16/flags/Central_African_Republic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Central_African_Republic.png -------------------------------------------------------------------------------- /chap16/flags/Chad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Chad.png -------------------------------------------------------------------------------- /chap16/flags/Chile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Chile.png -------------------------------------------------------------------------------- /chap16/flags/Christmas_Island.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Christmas_Island.png -------------------------------------------------------------------------------- /chap16/flags/Cocos_Keeling_Islands.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Cocos_Keeling_Islands.png -------------------------------------------------------------------------------- /chap16/flags/Colombia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Colombia.png -------------------------------------------------------------------------------- /chap16/flags/Comoros.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Comoros.png -------------------------------------------------------------------------------- /chap16/flags/Cook_Islands.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Cook_Islands.png -------------------------------------------------------------------------------- /chap16/flags/Costa_Rica.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Costa_Rica.png -------------------------------------------------------------------------------- /chap16/flags/Cote_dIvoire.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Cote_dIvoire.png -------------------------------------------------------------------------------- /chap16/flags/Croatia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Croatia.png -------------------------------------------------------------------------------- /chap16/flags/Cuba.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Cuba.png -------------------------------------------------------------------------------- /chap16/flags/Cyprus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Cyprus.png -------------------------------------------------------------------------------- /chap16/flags/Czech_Republic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Czech_Republic.png -------------------------------------------------------------------------------- /chap16/flags/Democratic_Republic_of_the_Congo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Democratic_Republic_of_the_Congo.png -------------------------------------------------------------------------------- /chap16/flags/Denmark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Denmark.png -------------------------------------------------------------------------------- /chap16/flags/Djibouti.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Djibouti.png -------------------------------------------------------------------------------- /chap16/flags/Dominica.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Dominica.png -------------------------------------------------------------------------------- /chap16/flags/Dominican_Republic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Dominican_Republic.png -------------------------------------------------------------------------------- /chap16/flags/East_Timor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/East_Timor.png -------------------------------------------------------------------------------- /chap16/flags/Ecuador.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Ecuador.png -------------------------------------------------------------------------------- /chap16/flags/Egypt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Egypt.png -------------------------------------------------------------------------------- /chap16/flags/El_Salvador.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/El_Salvador.png -------------------------------------------------------------------------------- /chap16/flags/Equatorial_Guinea.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Equatorial_Guinea.png -------------------------------------------------------------------------------- /chap16/flags/Eritrea.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Eritrea.png -------------------------------------------------------------------------------- /chap16/flags/Estonia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Estonia.png -------------------------------------------------------------------------------- /chap16/flags/Ethiopia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Ethiopia.png -------------------------------------------------------------------------------- /chap16/flags/Falkland_Islands.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Falkland_Islands.png -------------------------------------------------------------------------------- /chap16/flags/Faroe_Islands.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Faroe_Islands.png -------------------------------------------------------------------------------- /chap16/flags/Fiji.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Fiji.png -------------------------------------------------------------------------------- /chap16/flags/Finland.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Finland.png -------------------------------------------------------------------------------- /chap16/flags/France.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/France.png -------------------------------------------------------------------------------- /chap16/flags/French_Polynesia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/French_Polynesia.png -------------------------------------------------------------------------------- /chap16/flags/Gabon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Gabon.png -------------------------------------------------------------------------------- /chap16/flags/Georgia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Georgia.png -------------------------------------------------------------------------------- /chap16/flags/Germany.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Germany.png -------------------------------------------------------------------------------- /chap16/flags/Ghana.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Ghana.png -------------------------------------------------------------------------------- /chap16/flags/Gibraltar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Gibraltar.png -------------------------------------------------------------------------------- /chap16/flags/Greece.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Greece.png -------------------------------------------------------------------------------- /chap16/flags/Greenland.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Greenland.png -------------------------------------------------------------------------------- /chap16/flags/Grenada.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Grenada.png -------------------------------------------------------------------------------- /chap16/flags/Guam.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Guam.png -------------------------------------------------------------------------------- /chap16/flags/Guatemala.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Guatemala.png -------------------------------------------------------------------------------- /chap16/flags/Guernsey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Guernsey.png -------------------------------------------------------------------------------- /chap16/flags/Guinea-Bissau.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Guinea-Bissau.png -------------------------------------------------------------------------------- /chap16/flags/Guinea.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Guinea.png -------------------------------------------------------------------------------- /chap16/flags/Guyana.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Guyana.png -------------------------------------------------------------------------------- /chap16/flags/Haiti.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Haiti.png -------------------------------------------------------------------------------- /chap16/flags/Honduras.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Honduras.png -------------------------------------------------------------------------------- /chap16/flags/Hong_Kong.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Hong_Kong.png -------------------------------------------------------------------------------- /chap16/flags/Hungary.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Hungary.png -------------------------------------------------------------------------------- /chap16/flags/Iceland.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Iceland.png -------------------------------------------------------------------------------- /chap16/flags/India.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/India.png -------------------------------------------------------------------------------- /chap16/flags/Indonesia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Indonesia.png -------------------------------------------------------------------------------- /chap16/flags/Iran.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Iran.png -------------------------------------------------------------------------------- /chap16/flags/Iraq.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Iraq.png -------------------------------------------------------------------------------- /chap16/flags/Ireland.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Ireland.png -------------------------------------------------------------------------------- /chap16/flags/Isle_of_Man.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Isle_of_Man.png -------------------------------------------------------------------------------- /chap16/flags/Israel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Israel.png -------------------------------------------------------------------------------- /chap16/flags/Italy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Italy.png -------------------------------------------------------------------------------- /chap16/flags/Jamaica.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Jamaica.png -------------------------------------------------------------------------------- /chap16/flags/Japan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Japan.png -------------------------------------------------------------------------------- /chap16/flags/Jersey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Jersey.png -------------------------------------------------------------------------------- /chap16/flags/Jordan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Jordan.png -------------------------------------------------------------------------------- /chap16/flags/Kazakhstan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Kazakhstan.png -------------------------------------------------------------------------------- /chap16/flags/Kenya.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Kenya.png -------------------------------------------------------------------------------- /chap16/flags/Kiribati.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Kiribati.png -------------------------------------------------------------------------------- /chap16/flags/Kuwait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Kuwait.png -------------------------------------------------------------------------------- /chap16/flags/Kyrgyzstan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Kyrgyzstan.png -------------------------------------------------------------------------------- /chap16/flags/Laos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Laos.png -------------------------------------------------------------------------------- /chap16/flags/Latvia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Latvia.png -------------------------------------------------------------------------------- /chap16/flags/Lebanon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Lebanon.png -------------------------------------------------------------------------------- /chap16/flags/Lesotho.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Lesotho.png -------------------------------------------------------------------------------- /chap16/flags/Liberia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Liberia.png -------------------------------------------------------------------------------- /chap16/flags/Libya.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Libya.png -------------------------------------------------------------------------------- /chap16/flags/Liechtenstein.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Liechtenstein.png -------------------------------------------------------------------------------- /chap16/flags/Lithuania.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Lithuania.png -------------------------------------------------------------------------------- /chap16/flags/Luxembourg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Luxembourg.png -------------------------------------------------------------------------------- /chap16/flags/Macau.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Macau.png -------------------------------------------------------------------------------- /chap16/flags/Macedonia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Macedonia.png -------------------------------------------------------------------------------- /chap16/flags/Madagascar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Madagascar.png -------------------------------------------------------------------------------- /chap16/flags/Malawi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Malawi.png -------------------------------------------------------------------------------- /chap16/flags/Malaysia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Malaysia.png -------------------------------------------------------------------------------- /chap16/flags/Maldives.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Maldives.png -------------------------------------------------------------------------------- /chap16/flags/Mali.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Mali.png -------------------------------------------------------------------------------- /chap16/flags/Malta.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Malta.png -------------------------------------------------------------------------------- /chap16/flags/Marshall_Islands.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Marshall_Islands.png -------------------------------------------------------------------------------- /chap16/flags/Mauritania.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Mauritania.png -------------------------------------------------------------------------------- /chap16/flags/Mauritius.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Mauritius.png -------------------------------------------------------------------------------- /chap16/flags/Mexico.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Mexico.png -------------------------------------------------------------------------------- /chap16/flags/Micronesia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Micronesia.png -------------------------------------------------------------------------------- /chap16/flags/Moldova.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Moldova.png -------------------------------------------------------------------------------- /chap16/flags/Monaco.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Monaco.png -------------------------------------------------------------------------------- /chap16/flags/Mongolia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Mongolia.png -------------------------------------------------------------------------------- /chap16/flags/Montenegro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Montenegro.png -------------------------------------------------------------------------------- /chap16/flags/Montserrat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Montserrat.png -------------------------------------------------------------------------------- /chap16/flags/Morocco.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Morocco.png -------------------------------------------------------------------------------- /chap16/flags/Mozambique.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Mozambique.png -------------------------------------------------------------------------------- /chap16/flags/Myanmar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Myanmar.png -------------------------------------------------------------------------------- /chap16/flags/Nagorno-Karabakh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Nagorno-Karabakh.png -------------------------------------------------------------------------------- /chap16/flags/Namibia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Namibia.png -------------------------------------------------------------------------------- /chap16/flags/Nauru.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Nauru.png -------------------------------------------------------------------------------- /chap16/flags/Nepal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Nepal.png -------------------------------------------------------------------------------- /chap16/flags/Netherlands.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Netherlands.png -------------------------------------------------------------------------------- /chap16/flags/Netherlands_Antilles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Netherlands_Antilles.png -------------------------------------------------------------------------------- /chap16/flags/New_Zealand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/New_Zealand.png -------------------------------------------------------------------------------- /chap16/flags/Nicaragua.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Nicaragua.png -------------------------------------------------------------------------------- /chap16/flags/Niger.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Niger.png -------------------------------------------------------------------------------- /chap16/flags/Nigeria.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Nigeria.png -------------------------------------------------------------------------------- /chap16/flags/Niue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Niue.png -------------------------------------------------------------------------------- /chap16/flags/Norfolk_Island.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Norfolk_Island.png -------------------------------------------------------------------------------- /chap16/flags/North_Korea.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/North_Korea.png -------------------------------------------------------------------------------- /chap16/flags/Northern_Mariana_Islands.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Northern_Mariana_Islands.png -------------------------------------------------------------------------------- /chap16/flags/Norway.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Norway.png -------------------------------------------------------------------------------- /chap16/flags/Oman.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Oman.png -------------------------------------------------------------------------------- /chap16/flags/Pakistan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Pakistan.png -------------------------------------------------------------------------------- /chap16/flags/Palau.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Palau.png -------------------------------------------------------------------------------- /chap16/flags/Panama.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Panama.png -------------------------------------------------------------------------------- /chap16/flags/Papua_New_Guinea.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Papua_New_Guinea.png -------------------------------------------------------------------------------- /chap16/flags/Paraguay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Paraguay.png -------------------------------------------------------------------------------- /chap16/flags/Peoples_Republic_of_China.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Peoples_Republic_of_China.png -------------------------------------------------------------------------------- /chap16/flags/Peru.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Peru.png -------------------------------------------------------------------------------- /chap16/flags/Philippines.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Philippines.png -------------------------------------------------------------------------------- /chap16/flags/Pitcairn_Islands.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Pitcairn_Islands.png -------------------------------------------------------------------------------- /chap16/flags/Poland.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Poland.png -------------------------------------------------------------------------------- /chap16/flags/Portugal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Portugal.png -------------------------------------------------------------------------------- /chap16/flags/Puerto_Rico.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Puerto_Rico.png -------------------------------------------------------------------------------- /chap16/flags/Qatar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Qatar.png -------------------------------------------------------------------------------- /chap16/flags/Republic_of_China.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Republic_of_China.png -------------------------------------------------------------------------------- /chap16/flags/Republic_of_the_Congo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Republic_of_the_Congo.png -------------------------------------------------------------------------------- /chap16/flags/Romania.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Romania.png -------------------------------------------------------------------------------- /chap16/flags/Russia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Russia.png -------------------------------------------------------------------------------- /chap16/flags/Rwanda.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Rwanda.png -------------------------------------------------------------------------------- /chap16/flags/Saint_Helena.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Saint_Helena.png -------------------------------------------------------------------------------- /chap16/flags/Saint_Kitts_and_Nevis.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Saint_Kitts_and_Nevis.png -------------------------------------------------------------------------------- /chap16/flags/Saint_Lucia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Saint_Lucia.png -------------------------------------------------------------------------------- /chap16/flags/Saint_Vincent_and_the_Grenadines.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Saint_Vincent_and_the_Grenadines.png -------------------------------------------------------------------------------- /chap16/flags/Samoa.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Samoa.png -------------------------------------------------------------------------------- /chap16/flags/San_Marino.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/San_Marino.png -------------------------------------------------------------------------------- /chap16/flags/Sao_Tome_and_Principe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Sao_Tome_and_Principe.png -------------------------------------------------------------------------------- /chap16/flags/Saudi_Arabia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Saudi_Arabia.png -------------------------------------------------------------------------------- /chap16/flags/Senegal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Senegal.png -------------------------------------------------------------------------------- /chap16/flags/Serbia_state.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Serbia_state.png -------------------------------------------------------------------------------- /chap16/flags/Seychelles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Seychelles.png -------------------------------------------------------------------------------- /chap16/flags/Sierra_Leone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Sierra_Leone.png -------------------------------------------------------------------------------- /chap16/flags/Singapore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Singapore.png -------------------------------------------------------------------------------- /chap16/flags/Slovakia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Slovakia.png -------------------------------------------------------------------------------- /chap16/flags/Slovenia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Slovenia.png -------------------------------------------------------------------------------- /chap16/flags/Solomon_Islands.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Solomon_Islands.png -------------------------------------------------------------------------------- /chap16/flags/Somalia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Somalia.png -------------------------------------------------------------------------------- /chap16/flags/Somaliland.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Somaliland.png -------------------------------------------------------------------------------- /chap16/flags/South_Africa.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/South_Africa.png -------------------------------------------------------------------------------- /chap16/flags/South_Korea.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/South_Korea.png -------------------------------------------------------------------------------- /chap16/flags/South_Ossetia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/South_Ossetia.png -------------------------------------------------------------------------------- /chap16/flags/Spain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Spain.png -------------------------------------------------------------------------------- /chap16/flags/Sri_Lanka.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Sri_Lanka.png -------------------------------------------------------------------------------- /chap16/flags/Sudan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Sudan.png -------------------------------------------------------------------------------- /chap16/flags/Suriname.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Suriname.png -------------------------------------------------------------------------------- /chap16/flags/Swaziland.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Swaziland.png -------------------------------------------------------------------------------- /chap16/flags/Sweden.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Sweden.png -------------------------------------------------------------------------------- /chap16/flags/Switzerland.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Switzerland.png -------------------------------------------------------------------------------- /chap16/flags/Syria.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Syria.png -------------------------------------------------------------------------------- /chap16/flags/Tajikistan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Tajikistan.png -------------------------------------------------------------------------------- /chap16/flags/Tanzania.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Tanzania.png -------------------------------------------------------------------------------- /chap16/flags/Thailand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Thailand.png -------------------------------------------------------------------------------- /chap16/flags/The_Gambia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/The_Gambia.png -------------------------------------------------------------------------------- /chap16/flags/Togo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Togo.png -------------------------------------------------------------------------------- /chap16/flags/Tokelau_local.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Tokelau_local.png -------------------------------------------------------------------------------- /chap16/flags/Tonga.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Tonga.png -------------------------------------------------------------------------------- /chap16/flags/Transnistria.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Transnistria.png -------------------------------------------------------------------------------- /chap16/flags/Trinidad_and_Tobago.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Trinidad_and_Tobago.png -------------------------------------------------------------------------------- /chap16/flags/Tristan_da_Cunha.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Tristan_da_Cunha.png -------------------------------------------------------------------------------- /chap16/flags/Tunisia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Tunisia.png -------------------------------------------------------------------------------- /chap16/flags/Turkey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Turkey.png -------------------------------------------------------------------------------- /chap16/flags/Turkish_Republic_of_Northern_Cyprus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Turkish_Republic_of_Northern_Cyprus.png -------------------------------------------------------------------------------- /chap16/flags/Turkmenistan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Turkmenistan.png -------------------------------------------------------------------------------- /chap16/flags/Turks_and_Caicos_Islands.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Turks_and_Caicos_Islands.png -------------------------------------------------------------------------------- /chap16/flags/Tuvalu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Tuvalu.png -------------------------------------------------------------------------------- /chap16/flags/USA.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA.png -------------------------------------------------------------------------------- /chap16/flags/USA_Alabama.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_Alabama.png -------------------------------------------------------------------------------- /chap16/flags/USA_Alaska.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_Alaska.png -------------------------------------------------------------------------------- /chap16/flags/USA_Arizona.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_Arizona.png -------------------------------------------------------------------------------- /chap16/flags/USA_Arkansas.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_Arkansas.png -------------------------------------------------------------------------------- /chap16/flags/USA_California.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_California.png -------------------------------------------------------------------------------- /chap16/flags/USA_Colorado.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_Colorado.png -------------------------------------------------------------------------------- /chap16/flags/USA_Connecticut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_Connecticut.png -------------------------------------------------------------------------------- /chap16/flags/USA_Delaware.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_Delaware.png -------------------------------------------------------------------------------- /chap16/flags/USA_Florida.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_Florida.png -------------------------------------------------------------------------------- /chap16/flags/USA_Georgia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_Georgia.png -------------------------------------------------------------------------------- /chap16/flags/USA_Hawaii.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_Hawaii.png -------------------------------------------------------------------------------- /chap16/flags/USA_Idaho.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_Idaho.png -------------------------------------------------------------------------------- /chap16/flags/USA_Illinois.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_Illinois.png -------------------------------------------------------------------------------- /chap16/flags/USA_Indiana.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_Indiana.png -------------------------------------------------------------------------------- /chap16/flags/USA_Iowa.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_Iowa.png -------------------------------------------------------------------------------- /chap16/flags/USA_Kansas.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_Kansas.png -------------------------------------------------------------------------------- /chap16/flags/USA_Kentucky.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_Kentucky.png -------------------------------------------------------------------------------- /chap16/flags/USA_Louisiana.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_Louisiana.png -------------------------------------------------------------------------------- /chap16/flags/USA_Maine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_Maine.png -------------------------------------------------------------------------------- /chap16/flags/USA_Maryland.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_Maryland.png -------------------------------------------------------------------------------- /chap16/flags/USA_Massachusetts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_Massachusetts.png -------------------------------------------------------------------------------- /chap16/flags/USA_Michigan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_Michigan.png -------------------------------------------------------------------------------- /chap16/flags/USA_Minnesota.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_Minnesota.png -------------------------------------------------------------------------------- /chap16/flags/USA_Mississippi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_Mississippi.png -------------------------------------------------------------------------------- /chap16/flags/USA_Missouri.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_Missouri.png -------------------------------------------------------------------------------- /chap16/flags/USA_Montana.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_Montana.png -------------------------------------------------------------------------------- /chap16/flags/USA_Nebraska.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_Nebraska.png -------------------------------------------------------------------------------- /chap16/flags/USA_Nevada.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_Nevada.png -------------------------------------------------------------------------------- /chap16/flags/USA_New_Hampshire.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_New_Hampshire.png -------------------------------------------------------------------------------- /chap16/flags/USA_New_Jersey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_New_Jersey.png -------------------------------------------------------------------------------- /chap16/flags/USA_New_Mexico.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_New_Mexico.png -------------------------------------------------------------------------------- /chap16/flags/USA_New_York.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_New_York.png -------------------------------------------------------------------------------- /chap16/flags/USA_North_Carolina.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_North_Carolina.png -------------------------------------------------------------------------------- /chap16/flags/USA_North_Dakota.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_North_Dakota.png -------------------------------------------------------------------------------- /chap16/flags/USA_Ohio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_Ohio.png -------------------------------------------------------------------------------- /chap16/flags/USA_Oklahoma.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_Oklahoma.png -------------------------------------------------------------------------------- /chap16/flags/USA_Oregon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_Oregon.png -------------------------------------------------------------------------------- /chap16/flags/USA_Pennsylvania.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_Pennsylvania.png -------------------------------------------------------------------------------- /chap16/flags/USA_Rhode_Island.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_Rhode_Island.png -------------------------------------------------------------------------------- /chap16/flags/USA_South_Carolina.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_South_Carolina.png -------------------------------------------------------------------------------- /chap16/flags/USA_South_Dakota.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_South_Dakota.png -------------------------------------------------------------------------------- /chap16/flags/USA_Tennessee.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_Tennessee.png -------------------------------------------------------------------------------- /chap16/flags/USA_Texas.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_Texas.png -------------------------------------------------------------------------------- /chap16/flags/USA_Utah.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_Utah.png -------------------------------------------------------------------------------- /chap16/flags/USA_Vermont.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_Vermont.png -------------------------------------------------------------------------------- /chap16/flags/USA_Virginia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_Virginia.png -------------------------------------------------------------------------------- /chap16/flags/USA_Washington.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_Washington.png -------------------------------------------------------------------------------- /chap16/flags/USA_West_Virginia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_West_Virginia.png -------------------------------------------------------------------------------- /chap16/flags/USA_Wisconsin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_Wisconsin.png -------------------------------------------------------------------------------- /chap16/flags/USA_Wyoming.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/USA_Wyoming.png -------------------------------------------------------------------------------- /chap16/flags/Uganda.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Uganda.png -------------------------------------------------------------------------------- /chap16/flags/Ukraine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Ukraine.png -------------------------------------------------------------------------------- /chap16/flags/United_Arab_Emirates.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/United_Arab_Emirates.png -------------------------------------------------------------------------------- /chap16/flags/United_Kingdom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/United_Kingdom.png -------------------------------------------------------------------------------- /chap16/flags/United_Nations.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/United_Nations.png -------------------------------------------------------------------------------- /chap16/flags/United_States_Virgin_Islands.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/United_States_Virgin_Islands.png -------------------------------------------------------------------------------- /chap16/flags/Uruguay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Uruguay.png -------------------------------------------------------------------------------- /chap16/flags/Uzbekistan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Uzbekistan.png -------------------------------------------------------------------------------- /chap16/flags/Vanuatu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Vanuatu.png -------------------------------------------------------------------------------- /chap16/flags/Vatican_City.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Vatican_City.png -------------------------------------------------------------------------------- /chap16/flags/Venezuela.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Venezuela.png -------------------------------------------------------------------------------- /chap16/flags/Vietnam.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Vietnam.png -------------------------------------------------------------------------------- /chap16/flags/Western_Sahara.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Western_Sahara.png -------------------------------------------------------------------------------- /chap16/flags/Yemen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Yemen.png -------------------------------------------------------------------------------- /chap16/flags/Zambia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Zambia.png -------------------------------------------------------------------------------- /chap16/flags/Zimbabwe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/flags/Zimbabwe.png -------------------------------------------------------------------------------- /chap16/iss013-e-14802.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/iss013-e-14802.jpg -------------------------------------------------------------------------------- /chap16/surnames.txt.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/surnames.txt.gz -------------------------------------------------------------------------------- /chap16/waterdata.csv.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap16/waterdata.csv.gz -------------------------------------------------------------------------------- /chap17/help/editmenu.html: -------------------------------------------------------------------------------- 1 | 2 | Image Changer - Edit Menu 3 | 4 |

5 | Work in progress... 6 |

7 | 8 | -------------------------------------------------------------------------------- /chap17/help/editmenu_fr.html: -------------------------------------------------------------------------------- 1 | 2 | Image Changer - Edit Menu 3 | 4 |

French

5 |

6 | Work in progress... 7 |

8 | 9 | -------------------------------------------------------------------------------- /chap17/help/filemenu.html: -------------------------------------------------------------------------------- 1 | 2 | Image Changer - File Menu 3 | 4 |

5 | File|New 6 | Create a new plain image. 7 |

8 |

9 | File|Open 10 | Open an existing image. 11 |

12 |

13 | File|Save 14 | Save the current image. 15 |

16 |

17 | File|Save As 18 | Save the current image under a 19 | new name, and make the newly named image the current image. 20 |

21 |

22 | File|Quit 23 | Terminate the program. You will be 24 | given the chance to save any unsaved changes. 25 |

26 |
27 |

28 | If there are 29 | numbered files, these are recently opened files. Choosing one of them 30 | will cause it to be opened and to become the current 31 | image. 32 |

33 | 34 | -------------------------------------------------------------------------------- /chap17/help/filemenu_fr.html: -------------------------------------------------------------------------------- 1 | 2 | Image Changer - File Menu 3 | 4 |

French

5 |

6 | File|New 7 | Create a new plain image. 8 |

9 |

10 | File|Open 11 | Open an existing image. 12 |

13 |

14 | File|Save 15 | Save the current image. 16 |

17 |

18 | File|Save As 19 | Save the current image under a 20 | new name, and make the newly named image the current image. 21 |

22 |

23 | File|Quit 24 | Terminate the program. You will be 25 | given the chance to save any unsaved changes. 26 |

27 |
28 |

29 | If there are 30 | numbered files, these are recently opened files. Choosing one of them 31 | will cause it to be opened and to become the current 32 | image. 33 |

34 | 35 | -------------------------------------------------------------------------------- /chap17/help/index.html: -------------------------------------------------------------------------------- 1 | Image Changer 2 | 3 |

The Image Changer program provides simple image 4 | manipulations.

5 |

The File menu is used to create new 6 | images, to load existing images, and to save the current image.

7 |

The Edit 8 | menu offers the various image manipulation options. 9 |

All the most commonly used menu options are also available on the 10 | toolbar. The toolbar also provides an easy way of resizing the image.

11 | 12 | -------------------------------------------------------------------------------- /chap17/help/index_fr.html: -------------------------------------------------------------------------------- 1 | Image Changer 2 | 3 |

French

4 |

The Image Changer program provides simple image 5 | manipulations.

6 |

The File menu is used to create new 7 | images, to load existing images, and to save the current image.

8 |

The Edit 9 | menu offers the various image manipulation options. 10 |

All the most commonly used menu options are also available on the 11 | toolbar. The toolbar also provides an easy way of resizing the image.

12 | 13 | -------------------------------------------------------------------------------- /chap17/helpform.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright (c) 2008-14 Qtrac Ltd. All rights reserved. 3 | # This program or module is free software: you can redistribute it and/or 4 | # modify it under the terms of the GNU General Public License as published 5 | # by the Free Software Foundation, either version 2 of the License, or 6 | # version 3 of the License, or (at your option) any later version. It is 7 | # provided for educational purposes and is distributed in the hope that 8 | # it will be useful, but WITHOUT ANY WARRANTY; without even the implied 9 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 10 | # the GNU General Public License for more details. 11 | 12 | from __future__ import division 13 | from __future__ import print_function 14 | from __future__ import unicode_literals 15 | from future_builtins import * 16 | 17 | from PyQt4.QtCore import (QUrl, Qt) 18 | from PyQt4.QtCore import pyqtSignal as Signal 19 | from PyQt4.QtGui import (QAction, QApplication, QDialog, QIcon, 20 | QKeySequence, QLabel, QTextBrowser, QToolBar, QVBoxLayout) 21 | import qrc_resources 22 | 23 | 24 | class HelpForm(QDialog): 25 | 26 | def __init__(self, page, parent=None): 27 | super(HelpForm, self).__init__(parent) 28 | self.setAttribute(Qt.WA_DeleteOnClose) 29 | self.setAttribute(Qt.WA_GroupLeader) 30 | self.create_widgets() 31 | self.layout_widgets() 32 | self.create_connections() 33 | self.textBrowser.setSearchPaths([":/"]) 34 | self.textBrowser.setSource(QUrl(page)) 35 | self.resize(400, 600) 36 | self.setWindowTitle(self.tr("%1 Help").arg( 37 | QApplication.applicationName())) 38 | 39 | 40 | def create_widgets(self): 41 | self.backAction = QAction(QIcon(":/back.png"), self.tr("&Back"), 42 | self) 43 | self.backAction.setShortcut(QKeySequence.Back) 44 | self.homeAction = QAction(QIcon(":/home.png"), self.tr("&Home"), 45 | self) 46 | self.homeAction.setShortcut(self.tr("Home")) 47 | self.pageLabel = QLabel() 48 | 49 | self.toolBar = QToolBar() 50 | self.toolBar.addAction(self.backAction) 51 | self.toolBar.addAction(self.homeAction) 52 | self.toolBar.addWidget(self.pageLabel) 53 | self.textBrowser = QTextBrowser() 54 | 55 | 56 | def layout_widgets(self): 57 | layout = QVBoxLayout() 58 | layout.addWidget(self.toolBar) 59 | layout.addWidget(self.textBrowser, 1) 60 | self.setLayout(layout) 61 | 62 | 63 | def create_connections(self): 64 | self.backAction.triggered.connect(self.textBrowser.backward) 65 | self.homeAction.triggered.connect(self.textBrowser.home) 66 | self.textBrowser.sourceChanged.connect(self.updatePageTitle) 67 | 68 | 69 | def updatePageTitle(self): 70 | self.pageLabel.setText(self.textBrowser.documentTitle()) 71 | 72 | 73 | if __name__ == "__main__": 74 | import sys 75 | 76 | app = QApplication(sys.argv) 77 | form = HelpForm("index.html") 78 | form.show() 79 | app.exec_() 80 | 81 | -------------------------------------------------------------------------------- /chap17/imagechanger.pro: -------------------------------------------------------------------------------- 1 | FORMS += newimagedlg.ui 2 | SOURCES += helpform.py 3 | SOURCES += imagechanger.pyw 4 | SOURCES += newimagedlg.py 5 | SOURCES += resizedlg.py 6 | TRANSLATIONS += imagechanger_fr.ts 7 | 8 | -------------------------------------------------------------------------------- /chap17/imagechanger_fr.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap17/imagechanger_fr.qm -------------------------------------------------------------------------------- /chap17/images/back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap17/images/back.png -------------------------------------------------------------------------------- /chap17/images/editinvert.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap17/images/editinvert.png -------------------------------------------------------------------------------- /chap17/images/editmirror.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap17/images/editmirror.png -------------------------------------------------------------------------------- /chap17/images/editmirrorhoriz.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap17/images/editmirrorhoriz.png -------------------------------------------------------------------------------- /chap17/images/editmirrorvert.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap17/images/editmirrorvert.png -------------------------------------------------------------------------------- /chap17/images/editresize.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap17/images/editresize.png -------------------------------------------------------------------------------- /chap17/images/editswap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap17/images/editswap.png -------------------------------------------------------------------------------- /chap17/images/editunmirror.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap17/images/editunmirror.png -------------------------------------------------------------------------------- /chap17/images/editzoom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap17/images/editzoom.png -------------------------------------------------------------------------------- /chap17/images/filenew.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap17/images/filenew.png -------------------------------------------------------------------------------- /chap17/images/fileopen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap17/images/fileopen.png -------------------------------------------------------------------------------- /chap17/images/fileprint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap17/images/fileprint.png -------------------------------------------------------------------------------- /chap17/images/filequit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap17/images/filequit.png -------------------------------------------------------------------------------- /chap17/images/filesave.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap17/images/filesave.png -------------------------------------------------------------------------------- /chap17/images/filesaveas.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap17/images/filesaveas.png -------------------------------------------------------------------------------- /chap17/images/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap17/images/home.png -------------------------------------------------------------------------------- /chap17/images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesnikos/PyQt4-Examples/62575a6ff6e68014b4909d1d1bb12b0021e62a5b/chap17/images/icon.png -------------------------------------------------------------------------------- /chap17/newimagedlg.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright (c) 2008-14 Qtrac Ltd. All rights reserved. 3 | # This program or module is free software: you can redistribute it and/or 4 | # modify it under the terms of the GNU General Public License as published 5 | # by the Free Software Foundation, either version 2 of the License, or 6 | # version 3 of the License, or (at your option) any later version. It is 7 | # provided for educational purposes and is distributed in the hope that 8 | # it will be useful, but WITHOUT ANY WARRANTY; without even the implied 9 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 10 | # the GNU General Public License for more details. 11 | 12 | from __future__ import division 13 | from __future__ import print_function 14 | from __future__ import unicode_literals 15 | from future_builtins import * 16 | 17 | from PyQt4.QtCore import (QVariant, Qt) 18 | from PyQt4.QtCore import pyqtSignal as Signal 19 | from PyQt4.QtGui import (QApplication, QBrush, QColorDialog, QDialog, 20 | QPainter, QPixmap) 21 | import ui_newimagedlg 22 | 23 | 24 | class NewImageDlg(QDialog, ui_newimagedlg.Ui_NewImageDlg): 25 | 26 | def __init__(self, parent=None): 27 | super(NewImageDlg, self).__init__(parent) 28 | self.setupUi(self) 29 | 30 | self.color = Qt.red 31 | for value, text in ( 32 | (Qt.SolidPattern, self.tr("Solid")), 33 | (Qt.Dense1Pattern, self.tr("Dense #1")), 34 | (Qt.Dense2Pattern, self.tr("Dense #2")), 35 | (Qt.Dense3Pattern, self.tr("Dense #3")), 36 | (Qt.Dense4Pattern, self.tr("Dense #4")), 37 | (Qt.Dense5Pattern, self.tr("Dense #5")), 38 | (Qt.Dense6Pattern, self.tr("Dense #6")), 39 | (Qt.Dense7Pattern, self.tr("Dense #7")), 40 | (Qt.HorPattern, self.tr("Horizontal")), 41 | (Qt.VerPattern, self.tr("Vertical")), 42 | (Qt.CrossPattern, self.tr("Cross")), 43 | (Qt.BDiagPattern, self.tr("Backward Diagonal")), 44 | (Qt.FDiagPattern, self.tr("Forward Diagonal")), 45 | (Qt.DiagCrossPattern, self.tr("Diagonal Cross"))): 46 | self.brushComboBox.addItem(text, QVariant(value)) 47 | 48 | self.colorButton.clicked.connect(self.getColor) 49 | self.brushComboBox.activated.connect(self.setColor) 50 | self.setColor() 51 | self.widthSpinBox.setFocus() 52 | 53 | 54 | def getColor(self): 55 | color = QColorDialog.getColor(Qt.black, self) 56 | if color.isValid(): 57 | self.color = color 58 | self.setColor() 59 | 60 | 61 | def setColor(self): 62 | pixmap = self._makePixmap(60, 30) 63 | self.colorLabel.setPixmap(pixmap) 64 | 65 | 66 | def image(self): 67 | pixmap = self._makePixmap(self.widthSpinBox.value(), 68 | self.heightSpinBox.value()) 69 | return QPixmap.toImage(pixmap) 70 | 71 | 72 | def _makePixmap(self, width, height): 73 | pixmap = QPixmap(width, height) 74 | style = self.brushComboBox.itemData( 75 | self.brushComboBox.currentIndex()).toInt()[0] 76 | brush = QBrush(self.color, Qt.BrushStyle(style)) 77 | painter = QPainter(pixmap) 78 | painter.fillRect(pixmap.rect(), Qt.white) 79 | painter.fillRect(pixmap.rect(), brush) 80 | return pixmap 81 | 82 | 83 | if __name__ == "__main__": 84 | import sys 85 | 86 | app = QApplication(sys.argv) 87 | form = NewImageDlg() 88 | form.show() 89 | app.exec_() 90 | 91 | -------------------------------------------------------------------------------- /chap17/resizedlg.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright (c) 2008-14 Qtrac Ltd. All rights reserved. 3 | # This program or module is free software: you can redistribute it and/or 4 | # modify it under the terms of the GNU General Public License as published 5 | # by the Free Software Foundation, either version 2 of the License, or 6 | # version 3 of the License, or (at your option) any later version. It is 7 | # provided for educational purposes and is distributed in the hope that 8 | # it will be useful, but WITHOUT ANY WARRANTY; without even the implied 9 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 10 | # the GNU General Public License for more details. 11 | 12 | from __future__ import division 13 | from __future__ import print_function 14 | from __future__ import unicode_literals 15 | from future_builtins import * 16 | 17 | from PyQt4.QtCore import Qt 18 | from PyQt4.QtCore import pyqtSignal as Signal 19 | from PyQt4.QtGui import (QApplication, QDialog, QDialogButtonBox, 20 | QGridLayout, QLabel, QSpinBox) 21 | 22 | 23 | class ResizeDlg(QDialog): 24 | 25 | def __init__(self, width, height, parent=None): 26 | super(ResizeDlg, self).__init__(parent) 27 | self.create_widgets(width, height) 28 | self.layout_widgets() 29 | self.create_connections() 30 | self.setWindowTitle(self.tr("Image Changer - Resize")) 31 | 32 | 33 | def create_widgets(self, width, height): 34 | self.widthLabel = QLabel(self.tr("&Width:")) 35 | self.widthSpinBox = QSpinBox() 36 | self.widthLabel.setBuddy(self.widthSpinBox) 37 | self.widthSpinBox.setAlignment(Qt.AlignRight|Qt.AlignVCenter) 38 | self.widthSpinBox.setRange(4, width * 4) 39 | self.widthSpinBox.setValue(width) 40 | self.heightLabel = QLabel(self.tr("&Height:")) 41 | self.heightSpinBox = QSpinBox() 42 | self.heightLabel.setBuddy(self.heightSpinBox) 43 | self.heightSpinBox.setAlignment(Qt.AlignRight|Qt.AlignVCenter) 44 | self.heightSpinBox.setRange(4, height * 4) 45 | self.heightSpinBox.setValue(height) 46 | 47 | self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok| 48 | QDialogButtonBox.Cancel) 49 | 50 | 51 | def layout_widgets(self): 52 | layout = QGridLayout() 53 | layout.addWidget(self.widthLabel, 0, 0) 54 | layout.addWidget(self.widthSpinBox, 0, 1) 55 | layout.addWidget(self.heightLabel, 1, 0) 56 | layout.addWidget(self.heightSpinBox, 1, 1) 57 | layout.addWidget(self.buttonBox, 2, 0, 1, 2) 58 | self.setLayout(layout) 59 | 60 | 61 | def create_connections(self): 62 | self.buttonBox.accepted.connect(self.accept) 63 | self.buttonBox.rejected.connect(self.reject) 64 | 65 | 66 | def result(self): 67 | return self.widthSpinBox.value(), self.heightSpinBox.value() 68 | 69 | 70 | if __name__ == "__main__": 71 | import sys 72 | 73 | app = QApplication(sys.argv) 74 | form = ResizeDlg(64, 128) 75 | form.show() 76 | app.exec_() 77 | 78 | -------------------------------------------------------------------------------- /chap17/resources.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | images/filenew.png 4 | images/fileopen.png 5 | images/filesave.png 6 | images/filesaveas.png 7 | images/fileprint.png 8 | images/filequit.png 9 | images/editinvert.png 10 | images/editswap.png 11 | images/editzoom.png 12 | images/editmirror.png 13 | images/editunmirror.png 14 | images/editmirrorhoriz.png 15 | images/editmirrorvert.png 16 | images/back.png 17 | images/home.png 18 | images/icon.png 19 | 20 | 21 | qt_fr.qm 22 | imagechanger_fr.qm 23 | 24 | 25 | help/editmenu.html 26 | help/filemenu.html 27 | help/index.html 28 | 29 | 30 | help/editmenu_fr.html 31 | help/filemenu_fr.html 32 | help/index_fr.html 33 | 34 | 35 | -------------------------------------------------------------------------------- /pyqt.bat: -------------------------------------------------------------------------------- 1 | set QMAKESPEC=win32-g++ 2 | path=C:\pyqt;C:\MinGW\bin;c:\Python26;c:\Python26\lib\idlelib;%path% 3 | --------------------------------------------------------------------------------