├── .gitignore
├── Chapter10
├── README.md
├── clipboardPyside.py
├── customdraganddropPyside.py
├── customdraganddropPyside_ans.py
├── draganddropPyside.py
├── eventsPyside.py
├── 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
└── usefulStuff.md
├── Chapter11
├── README.md
├── contactdlgPyside.py
├── countersPyside.py
├── fractionsliderPyside.py
├── labelledwidgetsPyside.py
├── romanspinboxPyside.py
├── usefulStuff.md
└── ypipewidgetPyside.py
├── Chapter12
├── README.md
├── multipedesPyside.py
├── pagedesignerPyside.py
├── pagedesignerPyside_ans.py
├── testSave.pgd
└── usefulStuff.md
├── Chapter13
├── README.md
├── 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
├── printingPyside.py
├── pythoneditorPyside.py
├── pythoneditorPyside_ans.py
├── resources.qrc
├── richtextlineeditPyside.py
└── usefulStuff.md
├── Chapter14
├── README.md
├── richtextlineeditPyside.py
├── ships-delegateFoo.py
├── ships-delegatePyside.py
├── ships-delegatePyside_ans.py
├── ships-dictPyside.py
├── ships-modelPyside.py
├── shipsPyside.py
├── shipsPyside_ans.py
└── usefulStuff.md
├── Chapter15
├── README.md
├── assetmanagerPyside.py
├── food.db
├── images
│ ├── add.png
│ ├── assetmanagersplash.png
│ ├── delete.png
│ ├── first.png
│ ├── last.png
│ ├── next.png
│ ├── phonelogsplash.png
│ ├── prev.png
│ └── quit.png
├── phonelog-fkPyside.py
├── phonelogPyside.py
├── referencedataPyside.py
├── sqlite_resources.txt
└── usefulStuff.md
├── Chapter16
├── README.md
├── bargrapher.py
├── carhirelogPyside.py
├── 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
├── genericdelegatesPyside.py
├── iss013-e-14802.jpg
├── richtextlineeditPyside.py
├── serverinfoPyside.py
├── servers.txt
├── surnames.txt.gz
├── treeoftablePyside.py
├── usefulStuff.md
├── waterdata.csv.gz
└── waterqualityPyside.py
├── Chapter17
├── README.md
├── buttfumble.png
├── help
│ ├── editmenu.html
│ ├── editmenu_fr.html
│ ├── filemenu.html
│ ├── filemenu_fr.html
│ ├── index.html
│ └── index_fr.html
├── helpformPyside.py
├── imagechanger.pro
├── imagechangerPyside.py
├── 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
├── newimagedlgPyside.py
├── newimagedlgPyside.ui
├── qt_fr.qm
├── resources.qrc
└── usefulStuff.md
├── Chapter18
├── README.md
├── buildingservicesclientPyside.py
├── buildingservicesclient_ansPyside.py
├── buildingservicesserverPyside.py
├── buildingservicesserver_ansPyside.py
└── usefulStuff.md
├── Chapter19
├── README.md
├── buildingservicesclientPyside.py
├── buildingservicesserverPyside.py
├── pageindexerPyside.py
├── pageindexerPyside_ans.pyw
├── pageindexer_ansPyside.pyw
├── usefulStuff.md
├── walkerPyside.py
├── walkerPyside_ans.py
└── walker_ansPyside.py
├── Chapter4
├── README.md
├── alertPyside.py
├── calculatePyside.py
├── connectionsPyside.py
├── currencyPyside.py
├── interestPyside.py
├── signalsPyside.py
└── usefulStuff.md
├── Chapter5
├── README.md
├── numberformatdlg1Pyside.py
├── numberformatdlg2Pyside.py
├── numberformatdlg3Pyside.py
├── numbersPyside.py
├── penClassonlyPyside.py
├── penPyside.py
├── stringlistdlgPyside.py
└── usefulStuff.md
├── Chapter6
├── README.md
├── buttfumble.png
├── help
│ ├── editmenu.html
│ ├── filemenu.html
│ └── index.html
├── helpformPyside.py
├── imagechangerPyside.py
├── imagechanger_ansPyside.py
├── 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.ui
├── newimagedlgPyside.py
├── resizedlgPySide.py
├── resources.qrc
└── usefulStuff.md
├── Chapter7
├── README.md
├── findandreplacedlg.ui
├── findandreplacedlgPyside.py
├── ticketorderdlg1.ui
├── ticketorderdlg1Pyside.py
└── usefulStuff.md
├── Chapter8
├── README.md
├── addeditmoviedlg.ui
├── addeditmoviedlgPyside.py
├── addeditmoviedlgPyside_ans.py
├── addeditmoviedlg_ans.ui
├── images
│ ├── editadd.png
│ ├── editdelete.png
│ ├── editedit.png
│ ├── filenew.png
│ ├── fileopen.png
│ ├── filequit.png
│ ├── filesave.png
│ ├── filesaveas.png
│ └── icon.png
├── moviedataPyside.py
├── moviedataPyside_ans.py
├── mymovies.mqb
├── mymoviesPyside.py
├── mymoviesPyside_ans.py
├── resources.qrc
└── usefulStuff.md
├── Chapter9
├── README.md
├── bill-of-rights.txt
├── findandreplacedlgPyside.py
├── 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
├── newsreaderPyside.py
├── paymentdlgPyside.py
├── resources.qrc
├── sditexteditorPyside.py
├── sditexteditorPysideSet.py
├── tabbededitorPyside.py
├── texteditPyside.py
├── texteditorPyside.py
├── usefulStuff.md
└── vehiclerentaldlgPyside.py
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | *docx*
2 | ~*.*
3 | working/
4 | *.pyc
5 | resource_rc.py*
6 | ui_*.py*
--------------------------------------------------------------------------------
/Chapter10/README.md:
--------------------------------------------------------------------------------
1 | # PySide Summer Chapter 10 (Events, the Clipboard, and Drag and Drop)
2 | PySide translation of files for Chapter 10 of Mark Summerfield's 'Rapid GUI Programming with Python and Qt' (2008). Also see `usefulStuff.md` for helpful excerpts from the PySide documentation for relevant classes used in the files.
3 |
4 | ## Solution to exercise
5 | Also included is one answer to the exercise. The new code is in _customdraganddropPyside_ans.py_. Summerfield also has answers (using PyQt) at the book's web site, which is probably better than my answer.
6 |
7 | ## Notes about translation of Chapter 10
8 | `QColor().light()` is deprecated. Use `QColor.lighter()` instead.
9 |
10 | ### Licensing and such
11 | Code is under the GPL license: http://www.gnu.org/copyleft/gpl.html
12 |
13 | This script is part of the PySideSummer repository at GitHub:
14 | https://github.com/EricThomson/PySideSummer
15 |
--------------------------------------------------------------------------------
/Chapter10/clipboardPyside.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """
3 | clipboardPyside.py
4 | Annotated PySide port of clipboard.pyw from Chapter 10
5 | of Mark Summerfield's 'Rapid GUI Programming with Python and Qt' (2008)
6 | Book's web site: http://www.qtrac.eu/pyqtbook.html
7 |
8 | ------
9 | This script is part of the PySideSummer repository at GitHub:
10 | https://github.com/EricThomson/PySideSummer
11 |
12 | Code is under the GPL license: http://www.gnu.org/copyleft/gpl.html
13 | """
14 |
15 | import os
16 | import sys
17 | from PySide import QtGui, QtCore
18 |
19 | class Form(QtGui.QDialog):
20 |
21 | def __init__(self, parent=None):
22 | QtGui.QDialog.__init__(self, parent)
23 |
24 | textCopyButton = QtGui.QPushButton("&Copy Text")
25 | textPasteButton = QtGui.QPushButton("Paste &Text")
26 | htmlCopyButton = QtGui.QPushButton("C&opy HTML")
27 | htmlPasteButton = QtGui.QPushButton("Paste &HTML")
28 | imageCopyButton = QtGui.QPushButton("Co&py Image")
29 | imagePasteButton = QtGui.QPushButton("Paste &Image")
30 | self.textLabel = QtGui.QLabel("Original text")
31 | self.imageLabel = QtGui.QLabel()
32 | self.imageLabel.setPixmap(QtGui.QPixmap(os.path.join(
33 | os.path.dirname(__file__), "images/clock.png")))
34 |
35 | layout = QtGui.QGridLayout()
36 | layout.addWidget(textCopyButton, 0, 0)
37 | layout.addWidget(imageCopyButton, 0, 1)
38 | layout.addWidget(htmlCopyButton, 0, 2)
39 | layout.addWidget(textPasteButton, 1, 0)
40 | layout.addWidget(imagePasteButton, 1, 1)
41 | layout.addWidget(htmlPasteButton, 1, 2)
42 | layout.addWidget(self.textLabel, 2, 0, 1, 2)
43 | layout.addWidget(self.imageLabel, 2, 2)
44 | self.setLayout(layout)
45 |
46 | textCopyButton.clicked.connect(self.copyText)
47 | textPasteButton.clicked.connect(self.pasteText)
48 | htmlCopyButton.clicked.connect(self.copyHtml)
49 | htmlPasteButton.clicked.connect(self.pasteHtml)
50 | imageCopyButton.clicked.connect(self.copyImage)
51 | imagePasteButton.clicked.connect(self.pasteImage)
52 |
53 | self.setWindowTitle("Clipboard")
54 |
55 |
56 | def copyText(self):
57 | clipboard = QtGui.QApplication.clipboard()
58 | clipboard.setText("I've been clipped!")
59 |
60 |
61 | def pasteText(self):
62 | clipboard = QtGui.QApplication.clipboard()
63 | self.textLabel.setText(clipboard.text())
64 |
65 |
66 | def copyImage(self):
67 | clipboard = QtGui.QApplication.clipboard()
68 | clipboard.setPixmap(QtGui.QPixmap(os.path.join(
69 | os.path.dirname(__file__), "images/gvim.png")))
70 |
71 | def pasteImage(self):
72 | clipboard = QtGui.QApplication.clipboard()
73 | self.imageLabel.setPixmap(clipboard.pixmap())
74 |
75 |
76 | def copyHtml(self):
77 | mimeData = QtCore.QMimeData()
78 | mimeData.setHtml("Bold and Red")
79 | clipboard = QtGui.QApplication.clipboard()
80 | clipboard.setMimeData(mimeData)
81 |
82 |
83 | def pasteHtml(self):
84 | clipboard = QtGui.QApplication.clipboard()
85 | mimeData = clipboard.mimeData()
86 | if mimeData.hasHtml():
87 | self.textLabel.setText(mimeData.html())
88 |
89 |
90 | if __name__ == "__main__":
91 | app = QtGui.QApplication(sys.argv)
92 | form = Form()
93 | form.show()
94 | app.exec_()
95 |
--------------------------------------------------------------------------------
/Chapter10/draganddropPyside.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """
3 | draganddropPyside.py
4 | Annotated PySide port of draganddrop.pyw from Chapter 10
5 | of Mark Summerfield's 'Rapid GUI Programming with Python and Qt' (2008)
6 | Book's web site: http://www.qtrac.eu/pyqtbook.html
7 |
8 | Shows how easy it is to do basic drag and drop basically setting .setAcceptDrops
9 | if you want dragged items to be able to be planted there, and .setDragEnabled to
10 | True when you want to drag items from a widget.
11 | ------
12 | This script is part of the PySideSummer repository at GitHub:
13 | https://github.com/EricThomson/PySideSummer
14 |
15 | Code is under the GPL license: http://www.gnu.org/copyleft/gpl.html
16 | """
17 |
18 | import os
19 | import sys
20 | from PySide import QtGui, QtCore
21 |
22 | class Form(QtGui.QDialog):
23 |
24 | def __init__(self, parent=None):
25 | QtGui.QDialog.__init__(self, parent)
26 | self.create_widgets()
27 | self.layout_widgets()
28 | self.setWindowTitle("Drag and Drop")
29 |
30 |
31 | def create_widgets(self):
32 | #listWidget on left
33 | self.listWidget = QtGui.QListWidget()
34 | self.listWidget.setAcceptDrops(True)
35 | #self.listWidget.setDragEnabled(True)
36 | path = os.path.dirname(__file__)
37 | print path, "\n\n", os.listdir(path)
38 | for image in sorted(os.listdir(os.path.join(path, "images"))):
39 | if image.endswith(".png"):
40 | item = QtGui.QListWidgetItem(image.split(".")[0].capitalize())
41 | item.setIcon(QtGui.QIcon(os.path.join(path,
42 | "images/{0}".format(image))))
43 | self.listWidget.addItem(item)
44 |
45 | #large icon listwidget middle
46 | self.iconListWidget = QtGui.QListWidget()
47 | self.iconListWidget.setAcceptDrops(True)
48 | self.iconListWidget.setDragEnabled(True)
49 | #notice for this you have to set iconmode on
50 | self.iconListWidget.setViewMode(QtGui.QListWidget.IconMode)
51 |
52 | #Table widget right
53 | self.tableWidget = QtGui.QTableWidget()
54 | self.tableWidget.setRowCount(5)
55 | self.tableWidget.setColumnCount(2)
56 | self.tableWidget.setHorizontalHeaderLabels(["Column #1",
57 | "Column #2"])
58 | self.tableWidget.setAcceptDrops(True)
59 | self.tableWidget.setDragEnabled(True)
60 |
61 | #note unlike main window, don't have central widget, so we
62 | #set layout in qwidget to show properly
63 | def layout_widgets(self):
64 | splitter = QtGui.QSplitter(QtCore.Qt.Horizontal)
65 | splitter.addWidget(self.listWidget)
66 | splitter.addWidget(self.iconListWidget)
67 | splitter.addWidget(self.tableWidget)
68 | layout = QtGui.QHBoxLayout()
69 | layout.addWidget(splitter)
70 | self.setLayout(layout)
71 |
72 |
73 |
74 | if __name__ == "__main__":
75 | app = QtGui.QApplication(sys.argv)
76 | form = Form()
77 | form.show()
78 | app.exec_()
79 |
--------------------------------------------------------------------------------
/Chapter10/images/abiword.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter10/images/abiword.png
--------------------------------------------------------------------------------
/Chapter10/images/blender.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter10/images/blender.png
--------------------------------------------------------------------------------
/Chapter10/images/clock.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter10/images/clock.png
--------------------------------------------------------------------------------
/Chapter10/images/designer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter10/images/designer.png
--------------------------------------------------------------------------------
/Chapter10/images/emacs.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter10/images/emacs.png
--------------------------------------------------------------------------------
/Chapter10/images/firefox.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter10/images/firefox.png
--------------------------------------------------------------------------------
/Chapter10/images/gnumeric.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter10/images/gnumeric.png
--------------------------------------------------------------------------------
/Chapter10/images/gv.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter10/images/gv.png
--------------------------------------------------------------------------------
/Chapter10/images/gvim.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter10/images/gvim.png
--------------------------------------------------------------------------------
/Chapter10/images/kwin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter10/images/kwin.png
--------------------------------------------------------------------------------
/Chapter10/images/mozilla.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter10/images/mozilla.png
--------------------------------------------------------------------------------
/Chapter10/images/nedit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter10/images/nedit.png
--------------------------------------------------------------------------------
/Chapter10/images/opera.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter10/images/opera.png
--------------------------------------------------------------------------------
/Chapter10/images/penguin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter10/images/penguin.png
--------------------------------------------------------------------------------
/Chapter10/images/scribus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter10/images/scribus.png
--------------------------------------------------------------------------------
/Chapter10/images/tux.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter10/images/tux.png
--------------------------------------------------------------------------------
/Chapter10/images/usb.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter10/images/usb.png
--------------------------------------------------------------------------------
/Chapter10/images/vnc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter10/images/vnc.png
--------------------------------------------------------------------------------
/Chapter10/images/x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter10/images/x.png
--------------------------------------------------------------------------------
/Chapter11/README.md:
--------------------------------------------------------------------------------
1 | #PySide Summer Chapter 11 (Custom Widgets)
2 | PySide translation of files for Chapter 11 of Mark Summerfield's 'Rapid GUI Programming with Python and Qt' (2008). Also see `usefulStuff.md` for helpful excerpts from the PySide documentation for relevant classes used in the files.
3 |
4 | ##Solution to exercise
5 | Also included is one answer to the exercise. The new code is in _countersPyside.py_. Summerfield also has an answer at the book's web site, which is probably better than mine.
6 |
7 | ##Notes about translation of Chapter 11
8 | For drawPolygon, needed to change list of floats to list of QPoints. That is, if you see:
9 | painter.drawPolygon(QtGui.QPolygon([x1, y1, x2, y2]))
10 | change it to:
11 | painter.drawPolygon(QtGui.QPolygon([QtCore.QPoint(x1, y1), QtCore.QPoint(x2,y2)]))
12 |
13 |
14 | ###Licensing and such
15 | Code is under the GPL license: http://www.gnu.org/copyleft/gpl.html
16 |
17 | This script is part of the PySideSummer repository at GitHub:
18 | https://github.com/EricThomson/PySideSummer
19 |
--------------------------------------------------------------------------------
/Chapter11/romanspinboxPyside.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """
3 | romanspinboxPyside.py
4 | Annotated PySide port of romanspinbox.py from Chapter 11
5 | of Mark Summerfield's 'Rapid GUI Programming with Python and Qt' (2008)
6 | Book's web site: http://www.qtrac.eu/pyqtbook.html
7 |
8 | Subclassing QSpinbox to make a spinbox that displays roman numerals instead of
9 | decimal-based numbers.
10 | ------
11 | This script is part of the PySideSummer repository at GitHub:
12 | https://github.com/EricThomson/PySideSummer
13 |
14 | Code is under the GPL license: http://www.gnu.org/copyleft/gpl.html
15 | """
16 |
17 | import sys
18 | from PySide import QtGui, QtCore
19 |
20 |
21 | def romanFromInt(integer):
22 | """
23 | Code taken from Raymond Hettinger's code in Victor Yang's "Decimal
24 | to Roman Numerals" recipe in the Python Cookbook.
25 |
26 | >>> r = [romanFromInt(x) for x in range(1, 4000)]
27 | >>> i = [intFromRoman(x) for x in r]
28 | >>> i == [x for x in range(1, 4000)]
29 | True
30 | """
31 | coding = zip(
32 | [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1],
33 | ["M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V",
34 | "IV", "I"])
35 | if integer <= 0 or integer >= 4000 or int(integer) != integer:
36 | raise ValueError("expecting an integer between 1 and 3999")
37 | result = []
38 | for decimal, roman in coding:
39 | while integer >= decimal:
40 | result.append(roman)
41 | integer -= decimal
42 | return "".join(result)
43 |
44 |
45 | def intFromRoman(roman):
46 | """
47 | Code taken from Paul Winkler's "Roman Numerals" recipe in the Python
48 | Cookbook.
49 | """
50 | roman = roman.upper()
51 | coding = (("M", 1000, 3), ("CM", 900, 1), ("D", 500, 1),
52 | ("CD", 400, 1), ("C", 100, 3), ("XC", 90, 1),
53 | ("L", 50, 1), ("XL", 40, 1), ("X", 10, 3),
54 | ("IX", 9, 1), ("V", 5, 1), ("IV", 4, 1), ("I", 1, 3))
55 | integer, index = 0, 0
56 | for numeral, value, maxrepeat in coding:
57 | count = 0
58 | while roman[index: index +len(numeral)] == numeral:
59 | count += 1
60 | if count > maxrepeat:
61 | raise ValueError, "not a valid roman number: {0}".format(
62 | roman)
63 | integer += value
64 | index += len(numeral)
65 | if index != len(roman):
66 | raise ValueError, "not a valid roman number: {0}".format(roman)
67 | return integer
68 |
69 |
70 | # Regex adapted from Mark Pilgrim's "Dive Into Python" book
71 | class RomanSpinBox(QtGui.QSpinBox):
72 |
73 | def __init__(self, parent=None):
74 | QtGui.QSpinBox.__init__(self, parent)
75 | regex = QtCore.QRegExp(r"^M?M?M?(?:CM|CD|D?C?C?C?)"
76 | r"(?:XC|XL|L?X?X?X?)(?:IX|IV|V?I?I?I?)$")
77 | regex.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
78 | self.validator = QtGui.QRegExpValidator(regex, self)
79 | self.setRange(1, 3999)
80 | self.lineEdit().textEdited.connect(self.fixCase)
81 |
82 | #qspinbox has a lineEdit property to access contents make sure roman numerals are uppercase
83 | def fixCase(self, text):
84 | #print "text, type:\n", text, "," , type(text)
85 | self.lineEdit().setText(text.upper())
86 |
87 | #when subclassing spinbox, we need to implement validate, valueFromText, and textFromValue
88 |
89 | #Ensures user enters a valid number, won't even let them enter invalid one
90 | #Text is individual character, position is its position in string
91 | def validate(self, text, pos):
92 | #print "validate text, pos:\n", text, ",", pos
93 | return self.validator.validate(text, pos)
94 |
95 | #When user enters text, convert to integer, as spinbox represents it as an integer
96 | def valueFromText(self, text):
97 | #print "valueFromText, text: ", text
98 | return intFromRoman(unicode(text))
99 |
100 | #Used to text for box when integer in spinbox changes from hitting spinbox inc/decrement
101 | def textFromValue(self, value):
102 | #print "getting text from value...value: ", value
103 | return romanFromInt(value)
104 |
105 |
106 | if __name__ == "__main__":
107 |
108 | def report(value):
109 | print("{0:4d} {1}".format(value, romanFromInt(value)))
110 |
111 | app = QtGui.QApplication(sys.argv)
112 | spinbox = RomanSpinBox()
113 | spinbox.show()
114 | spinbox.resize(150,40)
115 | spinbox.setWindowTitle("Roman")
116 | spinbox.valueChanged.connect(report)
117 | app.exec_()
118 |
--------------------------------------------------------------------------------
/Chapter12/README.md:
--------------------------------------------------------------------------------
1 | #PySide Summer Chapter 12 (Item-Based Graphics)
2 | PySide translation of files for Chapter 12 of Mark Summerfield's 'Rapid GUI Programming with Python and Qt' (2008). Also see `usefulStuff.md` for helpful links and excerpts from the PySide documentation for relevant classes used in the files.
3 |
4 | ##Solution to exercise
5 | Also included is one answer to the chapter exercise (see _pagedesignerPyside_ans.py_). Summerfield also has a solution (using PyQt) at the book's web site, which is likely better than my answer.
6 |
7 | ##Notes about translation of Chapter 12
8 | Nothing major: main thing is there is no QMatrix or matrix operation: it is now called QTransform. See notes associated with pagedesignerPyside.py for more details.
9 |
10 | There is a slight issue with pagedesigner: if you open an old file and try to quit it, it asks you if you want to save (even if you haven't made any changes). I will get around to playing with this, but this is a faithful reproduction of the behavior of the original, so I will leave it for now as a future fix. The issue is with the way the Dirty flag is handled.
11 |
12 |
13 | ###Licensing and such
14 | Code is under the GPL license: http://www.gnu.org/copyleft/gpl.html
15 |
16 | This script is part of the PySideSummer repository at GitHub:
17 | https://github.com/EricThomson/PySideSummer
18 |
--------------------------------------------------------------------------------
/Chapter12/testSave.pgd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter12/testSave.pgd
--------------------------------------------------------------------------------
/Chapter13/README.md:
--------------------------------------------------------------------------------
1 | #PySide Summer Chapter 13 (Rich Text and Printing)
2 | PySide translation of files for Chapter 13 of Mark Summerfield's 'Rapid GUI Programming with Python and Qt' (2008). Also see `usefulStuff.md` for helpful links and excerpts from the PySide documentation for relevant classes used in the files.
3 |
4 | ##Notes about translation of Chapter 13
5 | Straightforward application of rules from previous chapters.
6 |
7 | ###Licensing and such
8 | Code is under the GPL license: http://www.gnu.org/copyleft/gpl.html
9 |
10 | This script is part of the PySideSummer repository at GitHub:
11 | https://github.com/EricThomson/PySideSummer
12 |
--------------------------------------------------------------------------------
/Chapter13/images/editadd.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter13/images/editadd.png
--------------------------------------------------------------------------------
/Chapter13/images/editcopy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter13/images/editcopy.png
--------------------------------------------------------------------------------
/Chapter13/images/editcut.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter13/images/editcut.png
--------------------------------------------------------------------------------
/Chapter13/images/editdelete.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter13/images/editdelete.png
--------------------------------------------------------------------------------
/Chapter13/images/editedit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter13/images/editedit.png
--------------------------------------------------------------------------------
/Chapter13/images/editindent.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter13/images/editindent.png
--------------------------------------------------------------------------------
/Chapter13/images/editpaste.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter13/images/editpaste.png
--------------------------------------------------------------------------------
/Chapter13/images/editunindent.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter13/images/editunindent.png
--------------------------------------------------------------------------------
/Chapter13/images/filenew.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter13/images/filenew.png
--------------------------------------------------------------------------------
/Chapter13/images/fileopen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter13/images/fileopen.png
--------------------------------------------------------------------------------
/Chapter13/images/filequit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter13/images/filequit.png
--------------------------------------------------------------------------------
/Chapter13/images/filesave.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter13/images/filesave.png
--------------------------------------------------------------------------------
/Chapter13/images/filesaveas.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter13/images/filesaveas.png
--------------------------------------------------------------------------------
/Chapter13/images/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter13/images/icon.png
--------------------------------------------------------------------------------
/Chapter13/images/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter13/images/logo.png
--------------------------------------------------------------------------------
/Chapter13/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 |
--------------------------------------------------------------------------------
/Chapter14/README.md:
--------------------------------------------------------------------------------
1 | #PySide Summer Chapter 14 (Model/View Programming)
2 | PySide translation of files in Chapter 14 of Mark Summerfield's 'Rapid GUI Programming with Python and Qt' (2008). Also see `usefulStuff.md` for helpful links and excerpts from the PySide documentation.
3 |
4 | ##Notes about translation of Chapter 14
5 | This is fairly straightforward application of tools from previous chapters.
6 |
7 | ###Licensing and such
8 | Code is under the GPL license: http://www.gnu.org/copyleft/gpl.html
9 |
10 | This script is part of the PySideSummer repository at GitHub:
11 | https://github.com/EricThomson/PySideSummer
12 |
--------------------------------------------------------------------------------
/Chapter15/README.md:
--------------------------------------------------------------------------------
1 | #PySide Summer Chapter 15 (Databases)
2 | PySide translation of files in Chapter 15 of Mark Summerfield's 'Rapid GUI Programming with Python and Qt' (2008). Also see `usefulStuff.md` for helpful links and excerpts from the PySide documentation.
3 |
4 | ##Notes about translation of Chapter 15
5 | A few things.
6 |
7 | 1. To get the database to open in all of the programs:
8 |
9 | import site
10 |
11 | And then, before the line `QtSql.QSqlDatabase.addDatabase("QSQLITE")`:
12 |
13 | site_pack_path = site.getsitepackages()[1]
14 | QtGui.QApplication.addLibraryPath('{0}\\PySide\\plugins'.format(site_pack_path))
15 |
16 | 2. Replace the single line:
17 |
18 | self.assetView.selectionModel().currentRowChanged.connect(self.assetChanged)
19 |
20 | With the two lines:
21 |
22 | selectionModel = self.assetView.selectionModel()
23 | selectionModel.currentRowChanged.connect(self.assetChanged)
24 |
25 | This seems to be due to a bug in PySide.
26 |
27 | ###Licensing and such
28 | Code is under the GPL license: http://www.gnu.org/copyleft/gpl.html
29 |
30 | This script is part of the PySideSummer repository at GitHub:
31 | https://github.com/EricThomson/PySideSummer
32 |
--------------------------------------------------------------------------------
/Chapter15/food.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter15/food.db
--------------------------------------------------------------------------------
/Chapter15/images/add.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter15/images/add.png
--------------------------------------------------------------------------------
/Chapter15/images/assetmanagersplash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter15/images/assetmanagersplash.png
--------------------------------------------------------------------------------
/Chapter15/images/delete.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter15/images/delete.png
--------------------------------------------------------------------------------
/Chapter15/images/first.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter15/images/first.png
--------------------------------------------------------------------------------
/Chapter15/images/last.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter15/images/last.png
--------------------------------------------------------------------------------
/Chapter15/images/next.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter15/images/next.png
--------------------------------------------------------------------------------
/Chapter15/images/phonelogsplash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter15/images/phonelogsplash.png
--------------------------------------------------------------------------------
/Chapter15/images/prev.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter15/images/prev.png
--------------------------------------------------------------------------------
/Chapter15/images/quit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter15/images/quit.png
--------------------------------------------------------------------------------
/Chapter15/sqlite_resources.txt:
--------------------------------------------------------------------------------
1 | Very simple, clear instructions for installing sqlite3 and creating your first database at the command line:
2 | Getting started with sqlite on windows
3 |
4 | After installing, add the folder containing sqlite3.exe to your system path (how to edit your system path).
5 |
6 | SQL
7 | Following actually describes create command
8 | http://www.sqlcourse.com/
9 |
10 | Looks ok
11 | http://www.w3schools.com/sql/default.asp
12 |
13 |
14 |
15 |
16 | Getting started (from nice little tutorial at sqlite.org).
17 | Note:
18 | Be sure to enter a semicolon at the end of each command. For Python users, this is not reflexive.
19 | Comments are indicated with two dashes.
20 |
21 | c:\sqlite> sqlite3 example1.db
22 | create table firstTable (
23 |
24 |
25 |
26 | http://zetcode.com/db/sqlite/ (not read)
27 |
28 |
29 |
30 | Python sqlite:
31 | Zetcode tutorial: http://zetcode.com/db/sqlitepythontutorial/
32 | 24 hour python book (2 chapters): (not read)
33 | Python 101 book (1 chapter): (not read)
--------------------------------------------------------------------------------
/Chapter16/README.md:
--------------------------------------------------------------------------------
1 | #PySide Summer Chapter 16 (Advanced Model/View Programming)
2 | PySide translation of files in Chapter 16 of Mark Summerfield's 'Rapid GUI Programming with Python and Qt' (2008). Also see `usefulStuff.md` for helpful links and excerpts from the PySide documentation.
3 |
4 | ##Notes about translation of Chapter 16
5 | Notes on translation:
6 |
7 | 1. There is no 'contains' method. Replace with 'in'. For instance:
8 | if "unicode" in face: #instead of face.contains("unicode"):
9 |
10 | 2. Replace obsolete Qt.TextColorRole with Qt.ForegroundRole (perhaps mentioned this in ch5, but I need to go back and do this in previous chapters, eg 14, and make sure it is consistent once done)
11 |
12 | ###Licensing and such
13 | Code is under the GPL license: http://www.gnu.org/copyleft/gpl.html
14 |
15 | This script is part of the PySideSummer repository at GitHub:
16 | https://github.com/EricThomson/PySideSummer
17 |
--------------------------------------------------------------------------------
/Chapter16/flags/Aaland.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Aaland.png
--------------------------------------------------------------------------------
/Chapter16/flags/Abkhazia.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Abkhazia.png
--------------------------------------------------------------------------------
/Chapter16/flags/Afghanistan.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Afghanistan.png
--------------------------------------------------------------------------------
/Chapter16/flags/Albania.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Albania.png
--------------------------------------------------------------------------------
/Chapter16/flags/Algeria.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Algeria.png
--------------------------------------------------------------------------------
/Chapter16/flags/American_Samoa.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/American_Samoa.png
--------------------------------------------------------------------------------
/Chapter16/flags/Andorra.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Andorra.png
--------------------------------------------------------------------------------
/Chapter16/flags/Angola.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Angola.png
--------------------------------------------------------------------------------
/Chapter16/flags/Anguilla.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Anguilla.png
--------------------------------------------------------------------------------
/Chapter16/flags/Antigua_and_Barbuda.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Antigua_and_Barbuda.png
--------------------------------------------------------------------------------
/Chapter16/flags/Argentina.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Argentina.png
--------------------------------------------------------------------------------
/Chapter16/flags/Armenia.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Armenia.png
--------------------------------------------------------------------------------
/Chapter16/flags/Aruba.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Aruba.png
--------------------------------------------------------------------------------
/Chapter16/flags/Australia.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Australia.png
--------------------------------------------------------------------------------
/Chapter16/flags/Austria.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Austria.png
--------------------------------------------------------------------------------
/Chapter16/flags/Azerbaijan.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Azerbaijan.png
--------------------------------------------------------------------------------
/Chapter16/flags/Bahamas.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Bahamas.png
--------------------------------------------------------------------------------
/Chapter16/flags/Bahrain.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Bahrain.png
--------------------------------------------------------------------------------
/Chapter16/flags/Bangladesh.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Bangladesh.png
--------------------------------------------------------------------------------
/Chapter16/flags/Barbados.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Barbados.png
--------------------------------------------------------------------------------
/Chapter16/flags/Belarus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Belarus.png
--------------------------------------------------------------------------------
/Chapter16/flags/Belgium.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Belgium.png
--------------------------------------------------------------------------------
/Chapter16/flags/Belize.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Belize.png
--------------------------------------------------------------------------------
/Chapter16/flags/Benin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Benin.png
--------------------------------------------------------------------------------
/Chapter16/flags/Bermuda.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Bermuda.png
--------------------------------------------------------------------------------
/Chapter16/flags/Bhutan.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Bhutan.png
--------------------------------------------------------------------------------
/Chapter16/flags/Bolivia_state.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Bolivia_state.png
--------------------------------------------------------------------------------
/Chapter16/flags/Bosnia_and_Herzegovina.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Bosnia_and_Herzegovina.png
--------------------------------------------------------------------------------
/Chapter16/flags/Botswana.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Botswana.png
--------------------------------------------------------------------------------
/Chapter16/flags/Brazil.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Brazil.png
--------------------------------------------------------------------------------
/Chapter16/flags/British_Virgin_Islands.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/British_Virgin_Islands.png
--------------------------------------------------------------------------------
/Chapter16/flags/Brunei.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Brunei.png
--------------------------------------------------------------------------------
/Chapter16/flags/Bulgaria.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Bulgaria.png
--------------------------------------------------------------------------------
/Chapter16/flags/Burkina_Faso.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Burkina_Faso.png
--------------------------------------------------------------------------------
/Chapter16/flags/Burundi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Burundi.png
--------------------------------------------------------------------------------
/Chapter16/flags/Cambodia.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Cambodia.png
--------------------------------------------------------------------------------
/Chapter16/flags/Cameroon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Cameroon.png
--------------------------------------------------------------------------------
/Chapter16/flags/Canada.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Canada.png
--------------------------------------------------------------------------------
/Chapter16/flags/Cape_Verde.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Cape_Verde.png
--------------------------------------------------------------------------------
/Chapter16/flags/Cayman_Islands.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Cayman_Islands.png
--------------------------------------------------------------------------------
/Chapter16/flags/Central_African_Republic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Central_African_Republic.png
--------------------------------------------------------------------------------
/Chapter16/flags/Chad.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Chad.png
--------------------------------------------------------------------------------
/Chapter16/flags/Chile.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Chile.png
--------------------------------------------------------------------------------
/Chapter16/flags/Christmas_Island.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Christmas_Island.png
--------------------------------------------------------------------------------
/Chapter16/flags/Cocos_Keeling_Islands.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Cocos_Keeling_Islands.png
--------------------------------------------------------------------------------
/Chapter16/flags/Colombia.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Colombia.png
--------------------------------------------------------------------------------
/Chapter16/flags/Comoros.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Comoros.png
--------------------------------------------------------------------------------
/Chapter16/flags/Cook_Islands.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Cook_Islands.png
--------------------------------------------------------------------------------
/Chapter16/flags/Costa_Rica.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Costa_Rica.png
--------------------------------------------------------------------------------
/Chapter16/flags/Cote_dIvoire.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Cote_dIvoire.png
--------------------------------------------------------------------------------
/Chapter16/flags/Croatia.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Croatia.png
--------------------------------------------------------------------------------
/Chapter16/flags/Cuba.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Cuba.png
--------------------------------------------------------------------------------
/Chapter16/flags/Cyprus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Cyprus.png
--------------------------------------------------------------------------------
/Chapter16/flags/Czech_Republic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Czech_Republic.png
--------------------------------------------------------------------------------
/Chapter16/flags/Democratic_Republic_of_the_Congo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Democratic_Republic_of_the_Congo.png
--------------------------------------------------------------------------------
/Chapter16/flags/Denmark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Denmark.png
--------------------------------------------------------------------------------
/Chapter16/flags/Djibouti.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Djibouti.png
--------------------------------------------------------------------------------
/Chapter16/flags/Dominica.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Dominica.png
--------------------------------------------------------------------------------
/Chapter16/flags/Dominican_Republic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Dominican_Republic.png
--------------------------------------------------------------------------------
/Chapter16/flags/East_Timor.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/East_Timor.png
--------------------------------------------------------------------------------
/Chapter16/flags/Ecuador.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Ecuador.png
--------------------------------------------------------------------------------
/Chapter16/flags/Egypt.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Egypt.png
--------------------------------------------------------------------------------
/Chapter16/flags/El_Salvador.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/El_Salvador.png
--------------------------------------------------------------------------------
/Chapter16/flags/Equatorial_Guinea.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Equatorial_Guinea.png
--------------------------------------------------------------------------------
/Chapter16/flags/Eritrea.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Eritrea.png
--------------------------------------------------------------------------------
/Chapter16/flags/Estonia.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Estonia.png
--------------------------------------------------------------------------------
/Chapter16/flags/Ethiopia.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Ethiopia.png
--------------------------------------------------------------------------------
/Chapter16/flags/Falkland_Islands.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Falkland_Islands.png
--------------------------------------------------------------------------------
/Chapter16/flags/Faroe_Islands.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Faroe_Islands.png
--------------------------------------------------------------------------------
/Chapter16/flags/Fiji.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Fiji.png
--------------------------------------------------------------------------------
/Chapter16/flags/Finland.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Finland.png
--------------------------------------------------------------------------------
/Chapter16/flags/France.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/France.png
--------------------------------------------------------------------------------
/Chapter16/flags/French_Polynesia.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/French_Polynesia.png
--------------------------------------------------------------------------------
/Chapter16/flags/Gabon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Gabon.png
--------------------------------------------------------------------------------
/Chapter16/flags/Georgia.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Georgia.png
--------------------------------------------------------------------------------
/Chapter16/flags/Germany.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Germany.png
--------------------------------------------------------------------------------
/Chapter16/flags/Ghana.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Ghana.png
--------------------------------------------------------------------------------
/Chapter16/flags/Gibraltar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Gibraltar.png
--------------------------------------------------------------------------------
/Chapter16/flags/Greece.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Greece.png
--------------------------------------------------------------------------------
/Chapter16/flags/Greenland.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Greenland.png
--------------------------------------------------------------------------------
/Chapter16/flags/Grenada.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Grenada.png
--------------------------------------------------------------------------------
/Chapter16/flags/Guam.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Guam.png
--------------------------------------------------------------------------------
/Chapter16/flags/Guatemala.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Guatemala.png
--------------------------------------------------------------------------------
/Chapter16/flags/Guernsey.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Guernsey.png
--------------------------------------------------------------------------------
/Chapter16/flags/Guinea-Bissau.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Guinea-Bissau.png
--------------------------------------------------------------------------------
/Chapter16/flags/Guinea.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Guinea.png
--------------------------------------------------------------------------------
/Chapter16/flags/Guyana.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Guyana.png
--------------------------------------------------------------------------------
/Chapter16/flags/Haiti.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Haiti.png
--------------------------------------------------------------------------------
/Chapter16/flags/Honduras.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Honduras.png
--------------------------------------------------------------------------------
/Chapter16/flags/Hong_Kong.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Hong_Kong.png
--------------------------------------------------------------------------------
/Chapter16/flags/Hungary.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Hungary.png
--------------------------------------------------------------------------------
/Chapter16/flags/Iceland.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Iceland.png
--------------------------------------------------------------------------------
/Chapter16/flags/India.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/India.png
--------------------------------------------------------------------------------
/Chapter16/flags/Indonesia.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Indonesia.png
--------------------------------------------------------------------------------
/Chapter16/flags/Iran.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Iran.png
--------------------------------------------------------------------------------
/Chapter16/flags/Iraq.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Iraq.png
--------------------------------------------------------------------------------
/Chapter16/flags/Ireland.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Ireland.png
--------------------------------------------------------------------------------
/Chapter16/flags/Isle_of_Man.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Isle_of_Man.png
--------------------------------------------------------------------------------
/Chapter16/flags/Israel.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Israel.png
--------------------------------------------------------------------------------
/Chapter16/flags/Italy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Italy.png
--------------------------------------------------------------------------------
/Chapter16/flags/Jamaica.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Jamaica.png
--------------------------------------------------------------------------------
/Chapter16/flags/Japan.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Japan.png
--------------------------------------------------------------------------------
/Chapter16/flags/Jersey.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Jersey.png
--------------------------------------------------------------------------------
/Chapter16/flags/Jordan.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Jordan.png
--------------------------------------------------------------------------------
/Chapter16/flags/Kazakhstan.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Kazakhstan.png
--------------------------------------------------------------------------------
/Chapter16/flags/Kenya.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Kenya.png
--------------------------------------------------------------------------------
/Chapter16/flags/Kiribati.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Kiribati.png
--------------------------------------------------------------------------------
/Chapter16/flags/Kuwait.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Kuwait.png
--------------------------------------------------------------------------------
/Chapter16/flags/Kyrgyzstan.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Kyrgyzstan.png
--------------------------------------------------------------------------------
/Chapter16/flags/Laos.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Laos.png
--------------------------------------------------------------------------------
/Chapter16/flags/Latvia.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Latvia.png
--------------------------------------------------------------------------------
/Chapter16/flags/Lebanon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Lebanon.png
--------------------------------------------------------------------------------
/Chapter16/flags/Lesotho.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Lesotho.png
--------------------------------------------------------------------------------
/Chapter16/flags/Liberia.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Liberia.png
--------------------------------------------------------------------------------
/Chapter16/flags/Libya.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Libya.png
--------------------------------------------------------------------------------
/Chapter16/flags/Liechtenstein.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Liechtenstein.png
--------------------------------------------------------------------------------
/Chapter16/flags/Lithuania.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Lithuania.png
--------------------------------------------------------------------------------
/Chapter16/flags/Luxembourg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Luxembourg.png
--------------------------------------------------------------------------------
/Chapter16/flags/Macau.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Macau.png
--------------------------------------------------------------------------------
/Chapter16/flags/Macedonia.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Macedonia.png
--------------------------------------------------------------------------------
/Chapter16/flags/Madagascar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Madagascar.png
--------------------------------------------------------------------------------
/Chapter16/flags/Malawi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Malawi.png
--------------------------------------------------------------------------------
/Chapter16/flags/Malaysia.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Malaysia.png
--------------------------------------------------------------------------------
/Chapter16/flags/Maldives.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Maldives.png
--------------------------------------------------------------------------------
/Chapter16/flags/Mali.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Mali.png
--------------------------------------------------------------------------------
/Chapter16/flags/Malta.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Malta.png
--------------------------------------------------------------------------------
/Chapter16/flags/Marshall_Islands.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Marshall_Islands.png
--------------------------------------------------------------------------------
/Chapter16/flags/Mauritania.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Mauritania.png
--------------------------------------------------------------------------------
/Chapter16/flags/Mauritius.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Mauritius.png
--------------------------------------------------------------------------------
/Chapter16/flags/Mexico.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Mexico.png
--------------------------------------------------------------------------------
/Chapter16/flags/Micronesia.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Micronesia.png
--------------------------------------------------------------------------------
/Chapter16/flags/Moldova.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Moldova.png
--------------------------------------------------------------------------------
/Chapter16/flags/Monaco.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Monaco.png
--------------------------------------------------------------------------------
/Chapter16/flags/Mongolia.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Mongolia.png
--------------------------------------------------------------------------------
/Chapter16/flags/Montenegro.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Montenegro.png
--------------------------------------------------------------------------------
/Chapter16/flags/Montserrat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Montserrat.png
--------------------------------------------------------------------------------
/Chapter16/flags/Morocco.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Morocco.png
--------------------------------------------------------------------------------
/Chapter16/flags/Mozambique.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Mozambique.png
--------------------------------------------------------------------------------
/Chapter16/flags/Myanmar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Myanmar.png
--------------------------------------------------------------------------------
/Chapter16/flags/Nagorno-Karabakh.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Nagorno-Karabakh.png
--------------------------------------------------------------------------------
/Chapter16/flags/Namibia.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Namibia.png
--------------------------------------------------------------------------------
/Chapter16/flags/Nauru.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Nauru.png
--------------------------------------------------------------------------------
/Chapter16/flags/Nepal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Nepal.png
--------------------------------------------------------------------------------
/Chapter16/flags/Netherlands.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Netherlands.png
--------------------------------------------------------------------------------
/Chapter16/flags/Netherlands_Antilles.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Netherlands_Antilles.png
--------------------------------------------------------------------------------
/Chapter16/flags/New_Zealand.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/New_Zealand.png
--------------------------------------------------------------------------------
/Chapter16/flags/Nicaragua.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Nicaragua.png
--------------------------------------------------------------------------------
/Chapter16/flags/Niger.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Niger.png
--------------------------------------------------------------------------------
/Chapter16/flags/Nigeria.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Nigeria.png
--------------------------------------------------------------------------------
/Chapter16/flags/Niue.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Niue.png
--------------------------------------------------------------------------------
/Chapter16/flags/Norfolk_Island.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Norfolk_Island.png
--------------------------------------------------------------------------------
/Chapter16/flags/North_Korea.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/North_Korea.png
--------------------------------------------------------------------------------
/Chapter16/flags/Northern_Mariana_Islands.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Northern_Mariana_Islands.png
--------------------------------------------------------------------------------
/Chapter16/flags/Norway.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Norway.png
--------------------------------------------------------------------------------
/Chapter16/flags/Oman.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Oman.png
--------------------------------------------------------------------------------
/Chapter16/flags/Pakistan.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Pakistan.png
--------------------------------------------------------------------------------
/Chapter16/flags/Palau.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Palau.png
--------------------------------------------------------------------------------
/Chapter16/flags/Panama.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Panama.png
--------------------------------------------------------------------------------
/Chapter16/flags/Papua_New_Guinea.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Papua_New_Guinea.png
--------------------------------------------------------------------------------
/Chapter16/flags/Paraguay.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Paraguay.png
--------------------------------------------------------------------------------
/Chapter16/flags/Peoples_Republic_of_China.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Peoples_Republic_of_China.png
--------------------------------------------------------------------------------
/Chapter16/flags/Peru.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Peru.png
--------------------------------------------------------------------------------
/Chapter16/flags/Philippines.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Philippines.png
--------------------------------------------------------------------------------
/Chapter16/flags/Pitcairn_Islands.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Pitcairn_Islands.png
--------------------------------------------------------------------------------
/Chapter16/flags/Poland.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Poland.png
--------------------------------------------------------------------------------
/Chapter16/flags/Portugal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Portugal.png
--------------------------------------------------------------------------------
/Chapter16/flags/Puerto_Rico.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Puerto_Rico.png
--------------------------------------------------------------------------------
/Chapter16/flags/Qatar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Qatar.png
--------------------------------------------------------------------------------
/Chapter16/flags/Republic_of_China.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Republic_of_China.png
--------------------------------------------------------------------------------
/Chapter16/flags/Republic_of_the_Congo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Republic_of_the_Congo.png
--------------------------------------------------------------------------------
/Chapter16/flags/Romania.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Romania.png
--------------------------------------------------------------------------------
/Chapter16/flags/Russia.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Russia.png
--------------------------------------------------------------------------------
/Chapter16/flags/Rwanda.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Rwanda.png
--------------------------------------------------------------------------------
/Chapter16/flags/Saint_Helena.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Saint_Helena.png
--------------------------------------------------------------------------------
/Chapter16/flags/Saint_Kitts_and_Nevis.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Saint_Kitts_and_Nevis.png
--------------------------------------------------------------------------------
/Chapter16/flags/Saint_Lucia.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Saint_Lucia.png
--------------------------------------------------------------------------------
/Chapter16/flags/Saint_Vincent_and_the_Grenadines.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Saint_Vincent_and_the_Grenadines.png
--------------------------------------------------------------------------------
/Chapter16/flags/Samoa.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Samoa.png
--------------------------------------------------------------------------------
/Chapter16/flags/San_Marino.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/San_Marino.png
--------------------------------------------------------------------------------
/Chapter16/flags/Sao_Tome_and_Principe.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Sao_Tome_and_Principe.png
--------------------------------------------------------------------------------
/Chapter16/flags/Saudi_Arabia.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Saudi_Arabia.png
--------------------------------------------------------------------------------
/Chapter16/flags/Senegal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Senegal.png
--------------------------------------------------------------------------------
/Chapter16/flags/Serbia_state.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Serbia_state.png
--------------------------------------------------------------------------------
/Chapter16/flags/Seychelles.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Seychelles.png
--------------------------------------------------------------------------------
/Chapter16/flags/Sierra_Leone.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Sierra_Leone.png
--------------------------------------------------------------------------------
/Chapter16/flags/Singapore.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Singapore.png
--------------------------------------------------------------------------------
/Chapter16/flags/Slovakia.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Slovakia.png
--------------------------------------------------------------------------------
/Chapter16/flags/Slovenia.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Slovenia.png
--------------------------------------------------------------------------------
/Chapter16/flags/Solomon_Islands.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Solomon_Islands.png
--------------------------------------------------------------------------------
/Chapter16/flags/Somalia.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Somalia.png
--------------------------------------------------------------------------------
/Chapter16/flags/Somaliland.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Somaliland.png
--------------------------------------------------------------------------------
/Chapter16/flags/South_Africa.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/South_Africa.png
--------------------------------------------------------------------------------
/Chapter16/flags/South_Korea.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/South_Korea.png
--------------------------------------------------------------------------------
/Chapter16/flags/South_Ossetia.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/South_Ossetia.png
--------------------------------------------------------------------------------
/Chapter16/flags/Spain.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Spain.png
--------------------------------------------------------------------------------
/Chapter16/flags/Sri_Lanka.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Sri_Lanka.png
--------------------------------------------------------------------------------
/Chapter16/flags/Sudan.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Sudan.png
--------------------------------------------------------------------------------
/Chapter16/flags/Suriname.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Suriname.png
--------------------------------------------------------------------------------
/Chapter16/flags/Swaziland.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Swaziland.png
--------------------------------------------------------------------------------
/Chapter16/flags/Sweden.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Sweden.png
--------------------------------------------------------------------------------
/Chapter16/flags/Switzerland.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Switzerland.png
--------------------------------------------------------------------------------
/Chapter16/flags/Syria.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Syria.png
--------------------------------------------------------------------------------
/Chapter16/flags/Tajikistan.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Tajikistan.png
--------------------------------------------------------------------------------
/Chapter16/flags/Tanzania.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Tanzania.png
--------------------------------------------------------------------------------
/Chapter16/flags/Thailand.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Thailand.png
--------------------------------------------------------------------------------
/Chapter16/flags/The_Gambia.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/The_Gambia.png
--------------------------------------------------------------------------------
/Chapter16/flags/Togo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Togo.png
--------------------------------------------------------------------------------
/Chapter16/flags/Tokelau_local.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Tokelau_local.png
--------------------------------------------------------------------------------
/Chapter16/flags/Tonga.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Tonga.png
--------------------------------------------------------------------------------
/Chapter16/flags/Transnistria.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Transnistria.png
--------------------------------------------------------------------------------
/Chapter16/flags/Trinidad_and_Tobago.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Trinidad_and_Tobago.png
--------------------------------------------------------------------------------
/Chapter16/flags/Tristan_da_Cunha.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Tristan_da_Cunha.png
--------------------------------------------------------------------------------
/Chapter16/flags/Tunisia.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Tunisia.png
--------------------------------------------------------------------------------
/Chapter16/flags/Turkey.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Turkey.png
--------------------------------------------------------------------------------
/Chapter16/flags/Turkish_Republic_of_Northern_Cyprus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Turkish_Republic_of_Northern_Cyprus.png
--------------------------------------------------------------------------------
/Chapter16/flags/Turkmenistan.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Turkmenistan.png
--------------------------------------------------------------------------------
/Chapter16/flags/Turks_and_Caicos_Islands.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Turks_and_Caicos_Islands.png
--------------------------------------------------------------------------------
/Chapter16/flags/Tuvalu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Tuvalu.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_Alabama.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_Alabama.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_Alaska.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_Alaska.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_Arizona.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_Arizona.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_Arkansas.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_Arkansas.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_California.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_California.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_Colorado.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_Colorado.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_Connecticut.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_Connecticut.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_Delaware.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_Delaware.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_Florida.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_Florida.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_Georgia.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_Georgia.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_Hawaii.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_Hawaii.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_Idaho.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_Idaho.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_Illinois.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_Illinois.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_Indiana.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_Indiana.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_Iowa.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_Iowa.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_Kansas.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_Kansas.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_Kentucky.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_Kentucky.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_Louisiana.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_Louisiana.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_Maine.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_Maine.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_Maryland.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_Maryland.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_Massachusetts.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_Massachusetts.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_Michigan.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_Michigan.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_Minnesota.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_Minnesota.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_Mississippi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_Mississippi.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_Missouri.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_Missouri.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_Montana.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_Montana.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_Nebraska.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_Nebraska.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_Nevada.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_Nevada.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_New_Hampshire.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_New_Hampshire.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_New_Jersey.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_New_Jersey.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_New_Mexico.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_New_Mexico.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_New_York.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_New_York.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_North_Carolina.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_North_Carolina.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_North_Dakota.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_North_Dakota.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_Ohio.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_Ohio.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_Oklahoma.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_Oklahoma.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_Oregon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_Oregon.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_Pennsylvania.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_Pennsylvania.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_Rhode_Island.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_Rhode_Island.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_South_Carolina.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_South_Carolina.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_South_Dakota.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_South_Dakota.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_Tennessee.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_Tennessee.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_Texas.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_Texas.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_Utah.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_Utah.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_Vermont.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_Vermont.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_Virginia.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_Virginia.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_Washington.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_Washington.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_West_Virginia.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_West_Virginia.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_Wisconsin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_Wisconsin.png
--------------------------------------------------------------------------------
/Chapter16/flags/USA_Wyoming.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/USA_Wyoming.png
--------------------------------------------------------------------------------
/Chapter16/flags/Uganda.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Uganda.png
--------------------------------------------------------------------------------
/Chapter16/flags/Ukraine.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Ukraine.png
--------------------------------------------------------------------------------
/Chapter16/flags/United_Arab_Emirates.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/United_Arab_Emirates.png
--------------------------------------------------------------------------------
/Chapter16/flags/United_Kingdom.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/United_Kingdom.png
--------------------------------------------------------------------------------
/Chapter16/flags/United_Nations.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/United_Nations.png
--------------------------------------------------------------------------------
/Chapter16/flags/United_States_Virgin_Islands.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/United_States_Virgin_Islands.png
--------------------------------------------------------------------------------
/Chapter16/flags/Uruguay.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Uruguay.png
--------------------------------------------------------------------------------
/Chapter16/flags/Uzbekistan.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Uzbekistan.png
--------------------------------------------------------------------------------
/Chapter16/flags/Vanuatu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Vanuatu.png
--------------------------------------------------------------------------------
/Chapter16/flags/Vatican_City.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Vatican_City.png
--------------------------------------------------------------------------------
/Chapter16/flags/Venezuela.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Venezuela.png
--------------------------------------------------------------------------------
/Chapter16/flags/Vietnam.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Vietnam.png
--------------------------------------------------------------------------------
/Chapter16/flags/Western_Sahara.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Western_Sahara.png
--------------------------------------------------------------------------------
/Chapter16/flags/Yemen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Yemen.png
--------------------------------------------------------------------------------
/Chapter16/flags/Zambia.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Zambia.png
--------------------------------------------------------------------------------
/Chapter16/flags/Zimbabwe.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/flags/Zimbabwe.png
--------------------------------------------------------------------------------
/Chapter16/iss013-e-14802.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/iss013-e-14802.jpg
--------------------------------------------------------------------------------
/Chapter16/surnames.txt.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/surnames.txt.gz
--------------------------------------------------------------------------------
/Chapter16/waterdata.csv.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter16/waterdata.csv.gz
--------------------------------------------------------------------------------
/Chapter17/README.md:
--------------------------------------------------------------------------------
1 | #PySide Summer Chapter 17 (Online help and internationalization)
2 | PySide port of files in Chapter 17 of Mark Summerfield's 'Rapid GUI Programming with Python and Qt' (2008). Also see `usefulStuff.md` for helpful links and excerpts from the PySide documentation.
3 |
4 | ##Notes on translation
5 | If you want to create a translation of an app, follow the instructions on page 514 of the book:
6 | 1. Prep your code for internationalization
7 | Wrap all strings that the user will see (e.g., "hi") within self.tr(). If in main, then wrap within QApplication.translate("hi").
8 |
9 | 2. Create a project (.pro) file
10 | Make sure you have a project file (e.g., 'imagechanger.pro') that lists the translation source files you will use (e.g., imagechanger_fr.ts), as well as other source files for the application. There must be an entry in the TRANSLATIONS section of the project file for each language other than the native language. For instance, in our example:
11 | TRANSLATIONS += imagechanger_fr.ts
12 |
13 | 3. Create the translation source (.ts) files using pyside-lupdate
14 | Note to do this just run: pyside-lupdate imagechanger.pro and it should make the appropriate .ts file listed in your .pro file. pyside-lupdate is a command line tool that finds the translatable strings in your files (e.g., the strings wrapped in tr()), and produces or updates .ts translation files.
15 |
16 | Usage: within the relevant directory, at system command line, enter:
17 | pyside-lupdate imagechanger.pro
18 | If it works nothing will happen in the command line, but imagechanger_fr.ts will show up in the directory.
19 |
20 | Note as Summerfield mentions, PyQt uses pylupdate4.
21 |
22 | 4. Do the translations by hand with the help of Qt Liniguist
23 | Use Qt Linguist to translate the .ts file's strings, saving them in the .qm file that is what is actually used in the application. It is probably in your site-packages folder for your Python distribution, and will be called 'linguist.exe'.
24 |
25 | Once you've done the translation, you can make qm file from this using 'file->release' translator uses qm file, or use lrelease (see 5).
26 |
27 | 5. Create corresponding Qt Message (.qm) files
28 | Qt message (.qm) files are binary files that contain translations used by an application at run-time. These files are generated by QtLinguist, but can also be generated by lrelease, which is a command line tool that produces qm files out of .ts files. The .qm file format is a compact binary format that is used by the localized application. It provides extremely fast lookups for translations.
29 |
30 | Usage: in relevant directory enter following in command line:
31 | lrelease imagechanger_fr.ts
32 |
33 | 6. Update and recompile resource file
34 | Once the qm files are all prepared, you usually will need to recompile your qrc file, as it usually lists the qm files the application will use.
35 |
36 |
37 | ###Licensing and such
38 | Code is under the GPL license: http://www.gnu.org/copyleft/gpl.html
39 |
40 | This script is part of the PySideSummer repository at GitHub:
41 | https://github.com/EricThomson/PySideSummer
42 |
--------------------------------------------------------------------------------
/Chapter17/buttfumble.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter17/buttfumble.png
--------------------------------------------------------------------------------
/Chapter17/help/editmenu.html:
--------------------------------------------------------------------------------
1 |
2 | Image Changer - Edit Menu
3 |
4 |
5 | Work in progress...
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Chapter17/help/editmenu_fr.html:
--------------------------------------------------------------------------------
1 |
2 | Image Changer - Edit Menu
3 |
4 | French
5 |
6 | Work in progress...
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Chapter17/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 |
--------------------------------------------------------------------------------
/Chapter17/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 |
--------------------------------------------------------------------------------
/Chapter17/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 |
--------------------------------------------------------------------------------
/Chapter17/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 |
--------------------------------------------------------------------------------
/Chapter17/helpformPyside.py:
--------------------------------------------------------------------------------
1 | # coding: utf-8
2 | '''
3 | helpformPyside.py
4 | Annotated PySide adaptation of helpform.py from Chapter 17
5 | of Mark Summerfield's 'Rapid GUI Programming with Python and Qt' (2008)
6 | Book's web site: http://www.qtrac.eu/pyqtbook.html
7 |
8 | This is imported by imagechangerPyside.py
9 |
10 | -------
11 | This script is part of the PySideSummer repository at GitHub:
12 | https://github.com/EricThomson/PySideSummer
13 |
14 | Code is under the GPL license: http://www.gnu.org/copyleft/gpl.html
15 | '''
16 | from PySide import QtGui, QtCore
17 | import resource_rc
18 |
19 | class HelpForm(QtGui.QDialog):
20 |
21 | def __init__(self, page, parent=None):
22 | QtGui.QDialog.__init__(self, parent)
23 | self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
24 | self.setAttribute(QtCore.Qt.WA_GroupLeader)
25 |
26 | backAction = QtGui.QAction(QtGui.QIcon(":/back.png"), self.tr("&Back"), self)
27 | backAction.setShortcut(QtGui.QKeySequence.Back)
28 | homeAction = QtGui.QAction(QtGui.QIcon(":/home.png"), self.tr("&Home"), self)
29 | homeAction.setShortcut("Home")
30 | self.pageLabel = QtGui.QLabel()
31 |
32 | toolBar = QtGui.QToolBar()
33 | toolBar.addAction(backAction)
34 | toolBar.addAction(homeAction)
35 | toolBar.addWidget(self.pageLabel)
36 | self.textBrowser = QtGui.QTextBrowser()
37 |
38 | layout = QtGui.QVBoxLayout()
39 | layout.addWidget(toolBar)
40 | layout.addWidget(self.textBrowser, 1)
41 | self.setLayout(layout)
42 |
43 | backAction.triggered.connect(self.textBrowser.backward)
44 | homeAction.triggered.connect(self.textBrowser.home)
45 | self.textBrowser.sourceChanged[QtCore.QUrl].connect(self.updatePageTitle) #not sure if qurl needed
46 |
47 |
48 | self.textBrowser.setSearchPaths([":/"])
49 | self.textBrowser.setSource(QtCore.QUrl(page))
50 | self.resize(400, 600)
51 | self.setWindowTitle(self.tr("{0} Help").format(
52 | QtGui.QApplication.applicationName()))
53 |
54 |
55 | def updatePageTitle(self):
56 | self.pageLabel.setText(self.textBrowser.documentTitle())
57 |
58 |
59 | if __name__ == "__main__":
60 | import sys
61 | app = QtGui.QApplication(sys.argv)
62 | form = HelpForm("index.html")
63 | form.show()
64 | app.exec_()
65 |
66 |
--------------------------------------------------------------------------------
/Chapter17/imagechanger.pro:
--------------------------------------------------------------------------------
1 | FORMS += newimagedlgPyside.ui
2 | SOURCES += helpformPyside.py
3 | SOURCES += imagechangerPyside.py
4 | SOURCES += newimagedlgPyside.py
5 | TRANSLATIONS += imagechanger_fr.ts
6 |
7 |
--------------------------------------------------------------------------------
/Chapter17/imagechanger_fr.qm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter17/imagechanger_fr.qm
--------------------------------------------------------------------------------
/Chapter17/images/back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter17/images/back.png
--------------------------------------------------------------------------------
/Chapter17/images/editinvert.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter17/images/editinvert.png
--------------------------------------------------------------------------------
/Chapter17/images/editmirror.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter17/images/editmirror.png
--------------------------------------------------------------------------------
/Chapter17/images/editmirrorhoriz.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter17/images/editmirrorhoriz.png
--------------------------------------------------------------------------------
/Chapter17/images/editmirrorvert.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter17/images/editmirrorvert.png
--------------------------------------------------------------------------------
/Chapter17/images/editresize.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter17/images/editresize.png
--------------------------------------------------------------------------------
/Chapter17/images/editswap.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter17/images/editswap.png
--------------------------------------------------------------------------------
/Chapter17/images/editunmirror.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter17/images/editunmirror.png
--------------------------------------------------------------------------------
/Chapter17/images/editzoom.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter17/images/editzoom.png
--------------------------------------------------------------------------------
/Chapter17/images/filenew.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter17/images/filenew.png
--------------------------------------------------------------------------------
/Chapter17/images/fileopen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter17/images/fileopen.png
--------------------------------------------------------------------------------
/Chapter17/images/fileprint.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter17/images/fileprint.png
--------------------------------------------------------------------------------
/Chapter17/images/filequit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter17/images/filequit.png
--------------------------------------------------------------------------------
/Chapter17/images/filesave.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter17/images/filesave.png
--------------------------------------------------------------------------------
/Chapter17/images/filesaveas.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter17/images/filesaveas.png
--------------------------------------------------------------------------------
/Chapter17/images/home.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter17/images/home.png
--------------------------------------------------------------------------------
/Chapter17/images/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter17/images/icon.png
--------------------------------------------------------------------------------
/Chapter17/newimagedlgPyside.py:
--------------------------------------------------------------------------------
1 | # coding: utf-8
2 | '''
3 | newimagedlgPyside.py
4 | Annotated PySide adaptation of newimagedlg.py from Chapter 6
5 | of Mark Summerfield's 'Rapid GUI Programming with Python and Qt' (2008)
6 | Book's web site: http://www.qtrac.eu/pyqtbook.html
7 |
8 | This is imported by imagechangerPyside.py
9 |
10 | Useful attributes of Qt to enumerate:
11 | PySide.QtCore.Qt.GlobalColor
12 | PySide.QtCore.Qt.BrushStyle
13 | -------
14 | This script is part of the PySideSummer repository at GitHub:
15 | https://github.com/EricThomson/PySideSummer
16 |
17 | Code is under the GPL license: http://www.gnu.org/copyleft/gpl.html
18 | '''
19 |
20 | from PySide import QtCore, QtGui
21 | import ui_newimagedlgPyside
22 |
23 | #QtCore: QVariant, Qt, SIGNAL
24 | #QtGui: QApplication, QBrush, QColorDialog, QDialog, QPainter, QPixmap)
25 |
26 | class NewImageDlg(QtGui.QDialog, ui_newimagedlgPyside.Ui_NewImageDlg):
27 |
28 | def __init__(self, parent=None):
29 | QtGui.QDialog.__init__(self, parent)
30 | self.setupUi(self) #imported from ui_newimagedlgPyside
31 |
32 | #Default color
33 | self.color = QtCore.Qt.red
34 | #Populate combobox with different patterns
35 | for value, text in (
36 | (QtCore.Qt.SolidPattern, self.tr("Solid")),
37 | (QtCore.Qt.Dense1Pattern, self.tr("Dense #1")),
38 | (QtCore.Qt.Dense2Pattern, self.tr("Dense #2")),
39 | (QtCore.Qt.Dense3Pattern, self.tr("Dense #3")),
40 | (QtCore.Qt.Dense4Pattern, self.tr("Dense #4")),
41 | (QtCore.Qt.Dense5Pattern, self.tr("Dense #5")),
42 | (QtCore.Qt.Dense6Pattern, self.tr("Dense #6")),
43 | (QtCore.Qt.Dense7Pattern, self.tr("Dense #7")),
44 | (QtCore.Qt.HorPattern, self.tr("Horizontal")),
45 | (QtCore.Qt.VerPattern, self.tr("Vertical")),
46 | (QtCore.Qt.CrossPattern, self.tr("Cross")),
47 | (QtCore.Qt.BDiagPattern, self.tr("Backward Diagonal")),
48 | (QtCore.Qt.FDiagPattern, self.tr("Forward Diagonal")),
49 | (QtCore.Qt.DiagCrossPattern, self.tr("Diagonal Cross"))) :
50 | self.brushComboBox.addItem(text, value) #second argument was: QtCore.QVariant(value)
51 |
52 | self.colorButton.clicked.connect(self.getColor)
53 | self.brushComboBox.activated.connect(self.setColor) #int?
54 | self.setColor()
55 | self.widthSpinBox.setFocus()
56 |
57 | #http://srinikom.github.io/pyside-docs/PySide/QtGui/QColorDialog.html
58 | def getColor(self):
59 | color = QtGui.QColorDialog.getColor(QtCore.Qt.black, self) #dialog initializes to black
60 | if color.isValid():
61 | self.color = color
62 | self.setColor()
63 |
64 |
65 | def setColor(self):
66 | pixmap = self._makePixmap(60, 30)
67 | self.colorLabel.setPixmap(pixmap)
68 |
69 |
70 | def image(self):
71 | pixmap = self._makePixmap(self.widthSpinBox.value(),
72 | self.heightSpinBox.value())
73 | return QtGui.QPixmap.toImage(pixmap) #convert qpixmap to qimage
74 |
75 |
76 | def _makePixmap(self, width, height): #why private?
77 | pixmap = QtGui.QPixmap(width, height)
78 | style = self.brushComboBox.itemData(
79 | self.brushComboBox.currentIndex()) #was: .toInt()[0]
80 | brush = QtGui.QBrush(self.color, QtCore.Qt.BrushStyle(style))
81 | painter = QtGui.QPainter(pixmap)
82 | painter.fillRect(pixmap.rect(), QtCore.Qt.white)
83 | painter.fillRect(pixmap.rect(), brush)
84 | return pixmap
85 |
86 |
87 | if __name__ == "__main__":
88 | import sys
89 | app = QtGui.QApplication(sys.argv)
90 | form = NewImageDlg()
91 | form.show()
92 | app.exec_()
93 |
94 |
--------------------------------------------------------------------------------
/Chapter17/qt_fr.qm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter17/qt_fr.qm
--------------------------------------------------------------------------------
/Chapter17/resources.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | images/filenew.png
6 | images/fileopen.png
7 | images/filesave.png
8 | images/filesaveas.png
9 | images/fileprint.png
10 | images/filequit.png
11 | images/editinvert.png
12 | images/editswap.png
13 | images/editzoom.png
14 | images/editmirror.png
15 | images/editunmirror.png
16 | images/editmirrorhoriz.png
17 | images/editmirrorvert.png
18 | images/back.png
19 | images/home.png
20 | images/icon.png
21 |
22 |
23 |
24 | qt_fr.qm
25 | imagechanger_fr.qm
26 |
27 |
28 |
29 | help/editmenu.html
30 | help/filemenu.html
31 | help/index.html
32 |
33 |
34 |
35 | help/editmenu_fr.html
36 | help/filemenu_fr.html
37 | help/index_fr.html
38 |
39 |
40 |
--------------------------------------------------------------------------------
/Chapter18/README.md:
--------------------------------------------------------------------------------
1 | #PySide Summer Chapter 18 (Networking)
2 | PySide port of files in Chapter 18 of Mark Summerfield's 'Rapid GUI Programming with Python and Qt' (2008). Also see `usefulStuff.md` for helpful links and excerpts from the PySide documentation.
3 |
4 | ##Notes about translation of Chapter 18
5 | Notes on translation:
6 | Replace .toPyDateTime with .toPython()
7 |
8 |
9 | ###Licensing and such
10 | Code is under the GPL license: http://www.gnu.org/copyleft/gpl.html
11 |
12 | This script is part of the PySideSummer repository at GitHub:
13 | https://github.com/EricThomson/PySideSummer
14 |
--------------------------------------------------------------------------------
/Chapter19/README.md:
--------------------------------------------------------------------------------
1 | #PySide Summer Chapter 19 (Multithreading)
2 | PySide translation of files in Chapter 19 of Mark Summerfield's 'Rapid GUI Programming with Python and Qt' (2008). Also see `usefulStuff.md` for helpful links and excerpts from the PySide documentation.
3 |
4 | ##Notes about translation of Chapter 19
5 | Straightforward....
6 |
7 | ###Licensing and such
8 | Code is under the GPL license: http://www.gnu.org/copyleft/gpl.html
9 |
10 | This script is part of the PySideSummer repository at GitHub:
11 | https://github.com/EricThomson/PySideSummer
12 |
--------------------------------------------------------------------------------
/Chapter19/walkerPyside.py:
--------------------------------------------------------------------------------
1 | # coding: utf-8
2 | """
3 | walkerPyside.py
4 | Annotated PySide adaptation of walker.py from Chapter 19
5 | of Mark Summerfield's 'Rapid GUI Programming with Python and Qt' (2008)
6 | Book's web site: http://www.qtrac.eu/pyqtbook.html
7 |
8 | -------
9 | This script is part of the PySideSummer repository at GitHub:
10 | https://github.com/EricThomson/PySideSummer
11 |
12 | Code is under the GPL license: http://www.gnu.org/copyleft/gpl.html
13 | """
14 |
15 |
16 | import codecs
17 | import htmlentitydefs
18 | import os
19 | import re
20 | import sys
21 | from PySide import QtCore
22 |
23 | class Walker(QtCore.QThread):
24 |
25 | finished = QtCore.Signal(bool)
26 | indexed = QtCore.Signal(str)
27 |
28 | COMMON_WORDS_THRESHOLD = 250
29 | MIN_WORD_LEN = 3
30 | MAX_WORD_LEN = 25
31 | INVALID_FIRST_OR_LAST = frozenset("0123456789_")
32 | STRIPHTML_RE = re.compile(r"<[^>]*?>", re.IGNORECASE|re.MULTILINE)
33 | ENTITY_RE = re.compile(r"&(\w+?);|(\d+?);")
34 | SPLIT_RE = re.compile(r"\W+", re.IGNORECASE|re.MULTILINE)
35 |
36 | def __init__(self, lock, parent=None):
37 | super(Walker, self).__init__(parent)
38 | self.lock = lock
39 | self.stopped = False
40 | self.mutex = QtCore.QMutex()
41 | self.path = None
42 | self.completed = False
43 |
44 |
45 | def initialize(self, path, filenamesForWords, commonWords):
46 | self.stopped = False
47 | self.path = path
48 | self.filenamesForWords = filenamesForWords
49 | self.commonWords = commonWords
50 | self.completed = False
51 |
52 |
53 | def stop(self):
54 | with QtCore.QMutexLocker(self.mutex):
55 | self.stopped = True
56 |
57 |
58 | def isStopped(self):
59 | with QtCore.QMutexLocker(self.mutex):
60 | return self.stopped
61 |
62 |
63 | def run(self):
64 | self.processFiles(self.path)
65 | self.stop()
66 | self.finished.emit(self.completed)
67 |
68 |
69 | def processFiles(self, path):
70 | for root, dirs, files in os.walk(path):
71 | if self.isStopped():
72 | return
73 | for name in [name for name in files
74 | if name.endswith((".htm", ".html"))]:
75 | fname = os.path.join(root, name)
76 | if self.isStopped():
77 | return
78 | self.processOneFile(fname)
79 | self.completed = True
80 |
81 |
82 |
83 | def processOneFile(self, fname):
84 | words = set()
85 | text = self.readFile(fname)
86 | if text is None or self.isStopped():
87 | return
88 | text = self.STRIPHTML_RE.sub("", text)
89 | text = self.ENTITY_RE.sub(unichrFromEntity, text)
90 | text = text.lower()
91 | for word in self.SPLIT_RE.split(text):
92 | if (self.MIN_WORD_LEN <= len(word) <=
93 | self.MAX_WORD_LEN and
94 | word[0] not in self.INVALID_FIRST_OR_LAST and
95 | word[-1] not in self.INVALID_FIRST_OR_LAST):
96 | with QtCore.QReadLocker(self.lock):
97 | new = word not in self.commonWords
98 | if new:
99 | words.add(word)
100 | if self.isStopped():
101 | return
102 | for word in words:
103 | with QtCore.QWriteLocker(self.lock):
104 | files = self.filenamesForWords[word]
105 | if len(files) > self.COMMON_WORDS_THRESHOLD:
106 | del self.filenamesForWords[word]
107 | self.commonWords.add(word)
108 | else:
109 | files.add(unicode(fname))
110 | self.indexed.emit(fname)
111 |
112 |
113 | def readFile(self, fname):
114 | try:
115 | with codecs.open(fname, "r", "UTF8", "ignore") as file:
116 | return file.read()
117 | except (IOError, OSError), err:
118 | sys.stderr.write("Error: {0}\n".format(err))
119 |
120 |
121 | def unichrFromEntity(match):
122 | text = match.group(match.lastindex)
123 | if text.isdigit():
124 | return unichr(int(text))
125 | u = htmlentitydefs.name2codepoint.get(text)
126 | return unichr(u) if u is not None else ""
127 |
128 |
--------------------------------------------------------------------------------
/Chapter19/walkerPyside_ans.py:
--------------------------------------------------------------------------------
1 | # coding: utf-8
2 | """
3 | walker_ansPyside.py
4 | Annotated PySide adaptation of walker_ans.py from Chapter 19
5 | of Mark Summerfield's 'Rapid GUI Programming with Python and Qt' (2008)
6 | Book's web site: http://www.qtrac.eu/pyqtbook.html
7 |
8 | -------
9 | This script is part of the PySideSummer repository at GitHub:
10 | https://github.com/EricThomson/PySideSummer
11 |
12 | Code is under the GPL license: http://www.gnu.org/copyleft/gpl.html
13 | """
14 |
15 | import codecs
16 | import htmlentitydefs
17 | import re
18 | import sys
19 |
20 | from PySide import QtCore
21 |
22 | class Walker(QtCore.QThread):
23 |
24 | finished = QtCore.Signal(bool, int)
25 | indexed = QtCore.Signal(str, int)
26 |
27 | COMMON_WORDS_THRESHOLD = 250
28 | MIN_WORD_LEN = 3
29 | MAX_WORD_LEN = 25
30 | INVALID_FIRST_OR_LAST = frozenset("0123456789_")
31 | STRIPHTML_RE = re.compile(r"<[^>]*?>", re.IGNORECASE|re.MULTILINE)
32 | ENTITY_RE = re.compile(r"&(\w+?);|(\d+?);")
33 | SPLIT_RE = re.compile(r"\W+", re.IGNORECASE|re.MULTILINE)
34 |
35 | def __init__(self, index, lock, files, filenamesForWords,
36 | commonWords, parent=None):
37 | super(Walker, self).__init__(parent)
38 | self.index = index
39 | self.lock = lock
40 | self.files = files
41 | self.filenamesForWords = filenamesForWords
42 | self.commonWords = commonWords
43 | self.stopped = False
44 | self.mutex = QtCore.QMutex()
45 | self.completed = False
46 |
47 |
48 | def stop(self):
49 | try:
50 | self.mutex.lock()
51 | self.stopped = True
52 | finally:
53 | self.mutex.unlock()
54 |
55 |
56 | def isStopped(self):
57 | try:
58 | self.mutex.lock()
59 | return self.stopped
60 | finally:
61 | self.mutex.unlock()
62 |
63 |
64 | def run(self):
65 | self.processFiles()
66 | self.stop()
67 | self.finished.emit(self.completed, self.index)
68 |
69 |
70 | def processFiles(self):
71 | for fname in self.files:
72 | if self.isStopped():
73 | return
74 | self.processOneFile(fname)
75 | self.completed = True
76 |
77 |
78 | def processOneFile(self, fname):
79 | words = set()
80 | text = self.readFile(fname)
81 | if text is None or self.isStopped():
82 | return
83 | text = self.STRIPHTML_RE.sub("", text)
84 | text = self.ENTITY_RE.sub(unichrFromEntity, text)
85 | text = text.lower()
86 | for word in self.SPLIT_RE.split(text):
87 | if (self.MIN_WORD_LEN <= len(word) <=
88 | self.MAX_WORD_LEN and
89 | word[0] not in self.INVALID_FIRST_OR_LAST and
90 | word[-1] not in self.INVALID_FIRST_OR_LAST):
91 | try:
92 | self.lock.lockForRead()
93 | new = word not in self.commonWords
94 | finally:
95 | self.lock.unlock()
96 | if new:
97 | words.add(word)
98 | if self.isStopped():
99 | return
100 | for word in words:
101 | try:
102 | self.lock.lockForWrite()
103 | files = self.filenamesForWords[word]
104 | if len(files) > self.COMMON_WORDS_THRESHOLD:
105 | del self.filenamesForWords[word]
106 | self.commonWords.add(word)
107 | else:
108 | files.add(unicode(fname))
109 | finally:
110 | self.lock.unlock()
111 | self.indexed.emit(fname, self.index)
112 |
113 |
114 | def readFile(self, fname):
115 | try:
116 | with codecs.open(fname, "r", "UTF8", "ignore") as file:
117 | return file.read()
118 | except (IOError, OSError), err:
119 | sys.stderr.write("Error: {0}\n".format(err))
120 |
121 |
122 | def unichrFromEntity(match):
123 | text = match.group(match.lastindex)
124 | if text.isdigit():
125 | return unichr(int(text))
126 | u = htmlentitydefs.name2codepoint.get(text)
127 | return unichr(u) if u is not None else ""
128 |
129 |
--------------------------------------------------------------------------------
/Chapter19/walker_ansPyside.py:
--------------------------------------------------------------------------------
1 | # coding: utf-8
2 | """
3 | walker_ansPyside.py
4 | Annotated PySide adaptation of walker_ans.py from Chapter 19
5 | of Mark Summerfield's 'Rapid GUI Programming with Python and Qt' (2008)
6 | Book's web site: http://www.qtrac.eu/pyqtbook.html
7 |
8 | -------
9 | This script is part of the PySideSummer repository at GitHub:
10 | https://github.com/EricThomson/PySideSummer
11 |
12 | Code is under the GPL license: http://www.gnu.org/copyleft/gpl.html
13 | """
14 |
15 | import codecs
16 | import htmlentitydefs
17 | import re
18 | import sys
19 |
20 | from PySide import QtCore
21 |
22 | class Walker(QtCore.QThread):
23 |
24 | finished = QtCore.Signal(bool, int)
25 | indexed = QtCore.Signal(str, int)
26 |
27 | COMMON_WORDS_THRESHOLD = 250
28 | MIN_WORD_LEN = 3
29 | MAX_WORD_LEN = 25
30 | INVALID_FIRST_OR_LAST = frozenset("0123456789_")
31 | STRIPHTML_RE = re.compile(r"<[^>]*?>", re.IGNORECASE|re.MULTILINE)
32 | ENTITY_RE = re.compile(r"&(\w+?);|(\d+?);")
33 | SPLIT_RE = re.compile(r"\W+", re.IGNORECASE|re.MULTILINE)
34 |
35 | def __init__(self, index, lock, files, filenamesForWords,
36 | commonWords, parent=None):
37 | super(Walker, self).__init__(parent)
38 | self.index = index
39 | self.lock = lock
40 | self.files = files
41 | self.filenamesForWords = filenamesForWords
42 | self.commonWords = commonWords
43 | self.stopped = False
44 | self.mutex = QtCore.QMutex()
45 | self.completed = False
46 |
47 |
48 | def stop(self):
49 | try:
50 | self.mutex.lock()
51 | self.stopped = True
52 | finally:
53 | self.mutex.unlock()
54 |
55 |
56 | def isStopped(self):
57 | try:
58 | self.mutex.lock()
59 | return self.stopped
60 | finally:
61 | self.mutex.unlock()
62 |
63 |
64 | def run(self):
65 | self.processFiles()
66 | self.stop()
67 | self.finished.emit(self.completed, self.index)
68 |
69 |
70 | def processFiles(self):
71 | for fname in self.files:
72 | if self.isStopped():
73 | return
74 | self.processOneFile(fname)
75 | self.completed = True
76 |
77 |
78 | def processOneFile(self, fname):
79 | words = set()
80 | text = self.readFile(fname)
81 | if text is None or self.isStopped():
82 | return
83 | text = self.STRIPHTML_RE.sub("", text)
84 | text = self.ENTITY_RE.sub(unichrFromEntity, text)
85 | text = text.lower()
86 | for word in self.SPLIT_RE.split(text):
87 | if (self.MIN_WORD_LEN <= len(word) <=
88 | self.MAX_WORD_LEN and
89 | word[0] not in self.INVALID_FIRST_OR_LAST and
90 | word[-1] not in self.INVALID_FIRST_OR_LAST):
91 | try:
92 | self.lock.lockForRead()
93 | new = word not in self.commonWords
94 | finally:
95 | self.lock.unlock()
96 | if new:
97 | words.add(word)
98 | if self.isStopped():
99 | return
100 | for word in words:
101 | try:
102 | self.lock.lockForWrite()
103 | files = self.filenamesForWords[word]
104 | if len(files) > self.COMMON_WORDS_THRESHOLD:
105 | del self.filenamesForWords[word]
106 | self.commonWords.add(word)
107 | else:
108 | files.add(unicode(fname))
109 | finally:
110 | self.lock.unlock()
111 | self.indexed.emit(fname, self.index)
112 |
113 |
114 | def readFile(self, fname):
115 | try:
116 | with codecs.open(fname, "r", "UTF8", "ignore") as file:
117 | return file.read()
118 | except (IOError, OSError), err:
119 | sys.stderr.write("Error: {0}\n".format(err))
120 |
121 |
122 | def unichrFromEntity(match):
123 | text = match.group(match.lastindex)
124 | if text.isdigit():
125 | return unichr(int(text))
126 | u = htmlentitydefs.name2codepoint.get(text)
127 | return unichr(u) if u is not None else ""
128 |
129 |
--------------------------------------------------------------------------------
/Chapter4/README.md:
--------------------------------------------------------------------------------
1 | #PySide Summer Chapter 4: Introduction to GUI Programming
2 | A PySide port of the code from Chapter 3 of Mark Summerfield's 'Rapid GUI Programming with Python and Qt' (2008).
3 |
4 | Also, see usefulStuff.md for potentially helpful excerpts from docs and online.
5 |
6 | ###Licensing and such
7 | Code is under the GPL license: http://www.gnu.org/copyleft/gpl.html
8 |
9 | This script is part of the PySideSummer repository at GitHub:
10 | https://github.com/EricThomson/PySideSummer
11 |
12 |
--------------------------------------------------------------------------------
/Chapter4/alertPyside.py:
--------------------------------------------------------------------------------
1 | # coding: utf-8
2 | '''
3 | alertPyside.py
4 | Heavily annotated PySide adaptation of alert.pyw from Chapter 4
5 | of Mark Summerfield's 'Rapid GUI Programming with Python and Qt' (2008)
6 |
7 | Illustrates idea of event loop execution by a QApplication.
8 |
9 | Usage:
10 | In your system (not Python) terminal, enter:
11 | python alertPyside.py HH:MM "Ugly QLabel alert!"
12 | where HH:MM is time you want message (in this case, "Ugly QLabel alert!") to trigger.
13 |
14 | -------
15 | This script is part of the PySideSummer repository at GitHub:
16 | https://github.com/EricThomson/PySideSummer
17 |
18 | Code is under the GPL license: http://www.gnu.org/copyleft/gpl.html
19 | '''
20 |
21 | from PySide import QtCore, QtGui
22 | import sys
23 | import time
24 |
25 |
26 | #Set up the message you want to show
27 | print "You entered {0} arguments: {1}".format(len(sys.argv), sys.argv) #unnecessary readout of arguments (not in original)
28 | alarmTime = QtCore.QTime.currentTime() #QTime: http://srinikom.github.io/pyside-docs/PySide/QtCore/QTime.html
29 | try:
30 | #If only one input given (alertPyside.py) raise exception
31 | if len(sys.argv) < 2:
32 | raise ValueError
33 |
34 | #at least two arguments given
35 | message = "Default message alert!"
36 | hours, mins = sys.argv[1].split(":")
37 | alarmTime = QtCore.QTime(int(hours), int(mins))
38 | if not alarmTime.isValid():
39 | raise ValueError
40 |
41 | #Case 3: three (or more) arguments given
42 | if len(sys.argv) > 2:
43 | message = " ".join(sys.argv[2:])
44 |
45 | except ValueError:
46 | message = "In terminal: alertPyside.py HH:MM {Optional message}" # 24hr clock
47 |
48 | # check every 20 seconds to see if alarmTime is greater than current time
49 | while QtCore.QTime.currentTime() < alarmTime:
50 | time.sleep(20)
51 |
52 | #Gui programming really starts now
53 | qtApp = QtGui.QApplication(sys.argv)
54 | #QLabels work with a limited set of html tags: https://qt-project.org/doc/qt-4.8/richtext-html-subset.html
55 | # label = QtGui.QLabel("{0}".format(message)) #original
56 | #While original example used html, style sheets seem to be recommended nowadays.
57 | # List of supported style sheet properties:
58 | # http://qt-project.org/doc/qt-4.8/stylesheet-reference.html#list-of-properties
59 | label=QtGui.QLabel(message)
60 | label.setStyleSheet("QLabel { color: rgb(255, 0, 0); font-weight: bold; font-size: 25px; background-color: rgb(0,0,0); \
61 | border: 5px solid rgba(0 , 255, 0, 200)}")
62 |
63 | #Flags that define behavior of label are set with the bitwise OR operator |.
64 | #Splashscreen documentation: http://srinikom.github.io/pyside-docs/PySide/QtGui/QSplashScreen.html
65 | #Lots of potential flags to explore: srinikom.github.io/pyside-docs/PySide/QtCore/Qt.html
66 | label.setWindowFlags(QtCore.Qt.SplashScreen | QtCore.Qt.WindowStaysOnTopHint)
67 |
68 | #show the label, wait, then quit the application (close the windows)
69 | label.show()
70 | waitTime=3000 #in milliseconds
71 | QtCore.QTimer.singleShot(waitTime, qtApp.quit) #http://srinikom.github.io/pyside-docs/PySide/QtCore/QTimer.html
72 |
73 | #Start the event loop with .exec_(), sys.exit makes clean exit more likely
74 | sys.exit(qtApp.exec_())
75 |
76 |
--------------------------------------------------------------------------------
/Chapter4/calculatePyside.py:
--------------------------------------------------------------------------------
1 | # coding: utf-8
2 | '''
3 | calculatePyside.py
4 | Heavily annotated PySide adaptation of calculate.pyw from Chapter 4
5 | of Mark Summerfield's 'Rapid GUI Programming with Python and Qt' (2008)
6 |
7 | Provides opportunity to work with some widgets, see how they talk to one
8 | another (signals/slots), and how to set layouts.
9 |
10 | Usage:
11 | Run the module, and play with the calculator.
12 |
13 | -------
14 | This script is part of the PySideSummer repository at GitHub:
15 | https://github.com/EricThomson/PySideSummer
16 |
17 | Code is under the GPL license: http://www.gnu.org/copyleft/gpl.html
18 |
19 |
20 | '''
21 |
22 | from __future__ import division
23 |
24 | import sys
25 | from PySide import QtGui, QtCore
26 | from math import * #not great practice to import all, but in this case the point is to show a small example
27 |
28 | class Form(QtGui.QDialog):
29 | def __init__(self, parent=None):
30 | QtGui.QDialog.__init__(self, parent)
31 | self.setWindowTitle("Pyside Calculator")
32 |
33 | #Make widgets
34 | #Is it bad form to put parent=self in here?
35 | self.browser = QtGui.QTextBrowser(parent=self) #read-only html display
36 | self.lineedit = QtGui.QLineEdit("Type an expression and press Enter", parent=self) #single editable line
37 | self.lineedit.selectAll() #so when user starts typing, initial text is replaced
38 |
39 | #Set layout
40 | layout = QtGui.QVBoxLayout() #will align widgets vertically
41 | layout.addWidget(self.browser)
42 | layout.addWidget(self.lineedit)
43 | self.setLayout(layout)
44 | self.lineedit.setFocus() #gives focus to lineedit, so user will enter text there first (must come after layout)
45 |
46 | #Connect editor to browser with signals/slots
47 | self.lineedit.returnPressed.connect(self.updateUI) #was: self.connect(self.lineedit, SIGNAL("returnPressed()"), self.updateUi)
48 |
49 | #Useful to use @QtCore.Slot decorator, even though not technically necessary:
50 | # http://stackoverflow.com/questions/14421897/is-the-pyside-slot-decorator-necessary
51 | @QtCore.Slot()
52 | def updateUI(self):
53 | try:
54 | text = unicode(self.lineedit.text()) #pull text from editor line
55 | self.browser.append("{0} = {1}".format(text, eval(text))) #note eval is dangerous!
56 | except: #bare exception frowned upon, but in this context let's not have a hissy fit.
57 | self.browser.append("'{0}' is too advanced for me!".format(text))
58 |
59 | if __name__=="__main__":
60 | app = QtGui.QApplication(sys.argv)
61 | form = Form()
62 | form.show()
63 | sys.exit(app.exec_())
64 |
65 |
--------------------------------------------------------------------------------
/Chapter4/connectionsPyside.py:
--------------------------------------------------------------------------------
1 | # coding: utf-8
2 | '''
3 | connectionsPyside.py
4 | Heavily annotated PySide adaptation of connections.pyw from Chapter 4
5 | of Mark Summerfield's 'Rapid GUI Programming with Python and Qt' (2008)
6 |
7 | Shows how slots can tell what widget sent it a signal. It shows this with
8 | 4 different methods.
9 |
10 | Usage:
11 | Run the module and start a' clickin': You should see a different message for each
12 | button you click.
13 |
14 | -------
15 | This script is part of the PySideSummer repository at GitHub:
16 | https://github.com/EricThomson/PySideSummer
17 |
18 | Code is under the GPL license: http://www.gnu.org/copyleft/gpl.html
19 | '''
20 |
21 | from PySide import QtGui, QtCore
22 | import functools
23 | import sys
24 |
25 | class Form(QtGui.QDialog):
26 |
27 | def __init__(self, parent=None):
28 | QtGui.QDialog.__init__(self, parent)
29 |
30 | #define your widgets
31 | button1 = QtGui.QPushButton("One")
32 | button2 = QtGui.QPushButton("Two")
33 | button3 = QtGui.QPushButton("Three")
34 | button4 = QtGui.QPushButton("Four")
35 | button5 = QtGui.QPushButton("Five")
36 | self.label = QtGui.QLabel("Click a button...") #is used elsewhere, so attached to self
37 |
38 | #Set layout
39 | layout = QtGui.QHBoxLayout()
40 | layout.addWidget(button1)
41 | layout.addWidget(button2)
42 | layout.addWidget(button3)
43 | layout.addWidget(button4)
44 | layout.addWidget(button5)
45 | layout.addStretch()
46 | layout.addWidget(self.label)
47 | self.setLayout(layout)
48 | self.setWindowTitle("Connections")
49 |
50 | #Connect buttons to slot
51 | #Button 1: build its own custom slot
52 | button1.clicked.connect(self.one) #special-purpose slot for button 1
53 | #Button 2: build callback using 'functools.partial'
54 | button2.clicked.connect(functools.partial(self.anyButton, "Two") )
55 | #Button 3: build callback function with lambda
56 | button3.clicked.connect(lambda who="Three" : self.anyButton(who))
57 | #Buttons 4 and 5: slot uses 'sender' to access clicked widget (see warnings above)
58 | button4.clicked.connect(self.clickedButton)
59 | button5.clicked.connect(self.clickedButton)
60 |
61 | #Same connections set using old style
62 | #self.connect(button1, SIGNAL("clicked()"), self.one)
63 | #self.button2callback = functools.partial(self.anyButton, "Two")
64 | #self.connect(button2, SIGNAL("clicked()"),
65 | # self.button2callback)
66 | #self.button3callback = lambda who="Three": self.anyButton(who)
67 | #self.connect(button3, SIGNAL("clicked()"),
68 | # self.button3callback)
69 | #self.connect(button4, SIGNAL("clicked()"), self.clicked)
70 | #self.connect(button5, SIGNAL("clicked()"), self.clicked)
71 |
72 | @QtCore.Slot()
73 | def one(self):
74 | self.label.setText("You clicked button 'One'")
75 |
76 | @QtCore.Slot()
77 | def anyButton(self, who):
78 | self.label.setText("You clicked button '{}'".format(who))
79 |
80 | #Note: The use of 'sender' is frowned upon sometimes for being nonmodular.
81 | #It is also used a lot, and extremely convenient, so you should be familiar with it.
82 | #@QtCore.Slot() breaks this slot
83 | def clickedButton(self):
84 | button = self.sender() #how could something so awesome be frowned upon?
85 | if button is None or not isinstance(button, QtGui.QPushButton):
86 | return
87 | self.label.setText("You clicked button {0}".format(button.text()))
88 |
89 |
90 | if __name__=="__main__":
91 | app = QtGui.QApplication(sys.argv)
92 | form = Form()
93 | form.show()
94 | app.exec_()
95 |
96 |
--------------------------------------------------------------------------------
/Chapter4/interestPyside.py:
--------------------------------------------------------------------------------
1 | # coding: utf-8
2 | '''
3 | interestPyside.py
4 | One possible solution to the exercise at the end of Chapter 4
5 | of Mark Summerfield's 'Rapid GUI Programming with Python and Qt' (2008)
6 |
7 | Usage:
8 | Run the module, and then play around with your money!
9 |
10 | -------
11 | This script is part of the PySideSummer repository at GitHub:
12 | https://github.com/EricThomson/PySideSummer
13 |
14 | Code is under the GPL license: http://www.gnu.org/copyleft/gpl.html
15 |
16 | '''
17 |
18 | from PySide import QtGui, QtCore
19 | import sys
20 |
21 |
22 | class Form(QtGui.QDialog):
23 | def __init__(self, parent=None):
24 | QtGui.QDialog.__init__(self, parent)
25 | self.setWindowTitle("Compound it")
26 |
27 | #make widgets to display in QDialog
28 | #Principal amount
29 | principalLabel=QtGui.QLabel("Principal:", parent=self)
30 | self.principal=QtGui.QDoubleSpinBox(parent=self)
31 | self.principal.setRange(0.0, 10000000.00)
32 | self.principal.setValue(100.00)
33 | self.principal.setPrefix("$ ")
34 |
35 | #Interest rates
36 | rateLabel=QtGui.QLabel("Rate:", parent=self)
37 | self.rate=QtGui.QDoubleSpinBox(parent=self)
38 | self.rate.setRange(0.0, 1000.00)
39 | self.rate.setValue(5.00)
40 | self.rate.setSuffix(" %")
41 |
42 | #years to calculate
43 | yearLabel=QtGui.QLabel("Years:", parent=self)
44 | self.years=QtGui.QComboBox(parent=self)
45 | numYears=[str(i) for i in range(11)] #0 to 10 years
46 | self.years.addItems(numYears)
47 | self.years.setCurrentIndex(1)
48 |
49 | #Amount
50 | amountLabel=QtGui.QLabel("Amount:", parent=self)
51 | initAmount="$100.00"
52 | self.amountValue=QtGui.QLabel(initAmount)
53 | self.updateUi() #initialize values appropriately
54 |
55 | #Set layout using grid
56 | grid = QtGui.QGridLayout()
57 | grid.addWidget(principalLabel, 0, 0) #why does dateLabel not property of self?
58 | grid.addWidget(self.principal, 0,1)
59 | grid.addWidget(rateLabel, 1, 0)
60 | grid.addWidget(self.rate, 1, 1)
61 | grid.addWidget(yearLabel, 2, 0)
62 | grid.addWidget(self.years, 2,1)
63 | grid.addWidget(amountLabel,3,0)
64 | grid.addWidget(self.amountValue, 3, 1)
65 | self.setLayout(grid)
66 |
67 | #Set up signals to connect to update slot when user interacts with widgets
68 | self.principal.valueChanged.connect(self.updateUi) #when starting amount changes
69 | self.rate.valueChanged.connect(self.updateUi) #change interest rates
70 | self.years.currentIndexChanged.connect(self.updateUi) #index of years
71 |
72 | def updateUi(self):
73 | principal=float(self.principal.value())
74 | rate=float(self.rate.value())
75 | numYears=int(self.years.currentText())
76 | newAmount=principal*((1+(rate/100.0))**numYears)
77 | self.amountValue.setText("${0:.2f}".format(newAmount))
78 |
79 |
80 | if __name__=="__main__":
81 | qtApp = QtGui.QApplication(sys.argv)
82 | #Customize the style:
83 | # http://qt-project.org/doc/qt-4.8/gallery.html
84 | #Note not all styles available on your os, to print out styles
85 | #available on your platform, uncomment the following line:
86 | #print QtGui.QStyleFactory.keys()
87 | QtGui.QApplication.setStyle(QtGui.QStyleFactory.create("Plastique"))
88 | form = Form()
89 | form.show()
90 | sys.exit(qtApp.exec_())
91 |
92 |
--------------------------------------------------------------------------------
/Chapter4/usefulStuff.md:
--------------------------------------------------------------------------------
1 | Things that might be useful when working through Chapter 4 of PySideSummer repository (https://github.com/EricThomson/PySideSummer)
2 |
3 | #Useful links
4 | ##List of supported style sheet properties:
5 | http://qt-project.org/doc/qt-4.8/stylesheet-reference.html#list-of-properties
6 |
7 | ##Similar example using new-style signals/slots:
8 | http://www.blog.pythonlibrary.org/2013/04/10/pyside-connecting-multiple-widgets-to-the-same-slot/
9 |
10 | ##On partial functions:
11 | http://www.learnpython.org/en/Partial_functions
12 | http://www.techrepublic.com/article/partial-function-application-in-python/
13 |
14 | ##On lambda functions:
15 | http://www.diveintopython.net/power_of_introspection/lambda_functions.html
16 | http://www.blog.pythonlibrary.org/2010/07/19/the-python-lambda/
17 |
18 | ##On currency converters
19 | http://www.blog.pythonlibrary.org/2013/04/09/pyside-creating-a-currency-converter/
20 |
21 |
22 | #Useful Documentation
23 |
24 | ##QtCore.QTimer
25 | http://srinikom.github.io/pyside-docs/PySide/QtCore/QTimer.html
26 |
27 | The PySide.QtCore.QTimer class provides repetitive and single-shot timers.
28 |
29 | The PySide.QtCore.QTimer class provides a high-level programming interface for timers. To use it, create a PySide.QtCore.QTimer , connect its PySide.QtCore.QTimer.timeout() signal to the appropriate slots, and call PySide.QtCore.QTimer.start() . From then on it will emit the PySide.QtCore.QTimer.timeout() signal at constant intervals.
30 |
31 | Example for a one second (1000 millisecond) timer (from the Analog Clock example):
32 |
33 | timer = QTimer(self)
34 | self.connect(timer, SIGNAL("timeout()"), self.update)
35 | timer.start(1000)
36 |
37 | From then on, the update() slot is called every second.
38 |
39 | You can set a timer to time out only once by calling setSingleShot(true). You can also use the static QTimer.singleShot() function to call a slot after a specified interval:
40 |
41 | QTimer.singleShot(200, self.updateCaption)
42 |
43 | In multithreaded applications, you can use PySide.QtCore.QTimer in any thread that has an event loop. To start an event loop from a non-GUI thread, use QThread.exec() . Qt uses the timer’s thread affinity to determine which thread will emit the PySide.QtCore.QTimer.timeout() signal. Because of this, you must start and stop the timer in its thread; it is not possible to start a timer from another thread.
44 |
45 | As a special case, a PySide.QtCore.QTimer with a timeout of 0 will time out as soon as all the events in the window system’s event queue have been processed. This can be used to do heavy work while providing a snappy user interface:
46 |
47 | timer = QTimer(self)
48 | timer.timeout.connect(self.processOneThing)
49 | timer.start()
50 |
51 | processOneThing() will from then on be called repeatedly. It should be written in such a way that it always returns quickly (typically after processing one data item) so that Qt can deliver events to widgets and stop the timer as soon as it has done all its work. This is the traditional way of implementing heavy work in GUI applications; multithreading is now becoming available on more and more platforms, and we expect that zero-millisecond QTimers will gradually be replaced by PySide.QtCore.QThread s.
52 |
53 | ###Accuracy and Timer Resolution
54 |
55 | Timers will never time out earlier than the specified timeout value and they are not guaranteed to time out at the exact value specified. In many situations, they may time out late by a period of time that depends on the accuracy of the system timers.
56 |
57 | The accuracy of timers depends on the underlying operating system and hardware. Most platforms support a resolution of 1 millisecond, though the accuracy of the timer will not equal this resolution in many real-world situations.
58 |
59 | If Qt is unable to deliver the requested number of timer clicks, it will silently discard some.
60 |
61 | ###Alternatives to QTimer
62 |
63 | An alternative to using PySide.QtCore.QTimer is to call QObject.startTimer() for your object and reimplement the QObject.timerEvent() event handler in your class (which must inherit PySide.QtCore.QObject ). The disadvantage is that PySide.QtCore.QTimer.timerEvent() does not support such high-level features as single-shot timers or signals.
64 |
65 | Another alternative to using PySide.QtCore.QTimer is to use PySide.QtCore.QBasicTimer . It is typically less cumbersome than using QObject.startTimer() directly. See Timers for an overview of all three approaches.
66 |
67 | Some operating systems limit the number of timers that may be used; Qt tries to work around these limitations.
--------------------------------------------------------------------------------
/Chapter5/README.md:
--------------------------------------------------------------------------------
1 | #PySide Summer Chapter 5: Dialogs
2 | A PySide port of the code from Chapter 5 of Mark Summerfield's 'Rapid GUI Programming with Python and Qt' (2008).
3 |
4 | Also, see usefulStuff.md for potentially helpful excerpts from docs and online.
5 |
6 | ###Licensing and such
7 | Code is under the GPL license: http://www.gnu.org/copyleft/gpl.html
8 |
9 | This script is part of the PySideSummer repository at GitHub:
10 | https://github.com/EricThomson/PySideSummer
11 |
12 |
--------------------------------------------------------------------------------
/Chapter5/numberformatdlg3Pyside.py:
--------------------------------------------------------------------------------
1 | # coding: utf-8
2 |
3 | '''
4 | numberformatdlg3Pyside.py
5 | Annotated PySide adaptation of numberformatdlg3.py from Chapter 5
6 | of Mark Summerfield's 'Rapid GUI Programming with Python and Qt' (2008)
7 |
8 | This is imported into numbersPyside.py
9 |
10 | If you followed numbers 1 and 2, this one should seem relatively
11 | straightforward. The calling class (Form) passes a callback function
12 | that allows for on-the-fly updating of the appearance of the table of numbers
13 | we have been working with. We pay for this power with some loss
14 | of modularity.
15 |
16 | -------
17 | This script is part of the PySideSummer repository at GitHub:
18 | https://github.com/EricThomson/PySideSummer
19 |
20 | Code is under the GPL license: http://www.gnu.org/copyleft/gpl.html
21 |
22 | '''
23 |
24 | from PySide import QtGui, QtCore
25 |
26 |
27 | class NumberFormatDlg(QtGui.QDialog):
28 |
29 | def __init__(self, format, callback, parent=None):
30 | QtGui.QDialog.__init__(self, parent)
31 |
32 | punctuationRe = QtCore.QRegExp(r"[ ,;:.]")
33 | thousandsLabel = QtGui.QLabel("&Thousands separator")
34 | self.thousandsEdit = QtGui.QLineEdit(format["thousandsseparator"])
35 | thousandsLabel.setBuddy(self.thousandsEdit)
36 | self.thousandsEdit.setMaxLength(1)
37 | self.thousandsEdit.setValidator(QtGui.QRegExpValidator(
38 | punctuationRe, self))
39 | decimalMarkerLabel = QtGui.QLabel("Decimal &marker")
40 | self.decimalMarkerEdit = QtGui.QLineEdit(format["decimalmarker"])
41 | decimalMarkerLabel.setBuddy(self.decimalMarkerEdit)
42 | self.decimalMarkerEdit.setMaxLength(1)
43 | self.decimalMarkerEdit.setValidator(QtGui.QRegExpValidator(
44 | punctuationRe, self))
45 | self.decimalMarkerEdit.setInputMask("X")
46 |
47 | decimalPlacesLabel = QtGui.QLabel("&Decimal places")
48 | self.decimalPlacesSpinBox = QtGui.QSpinBox()
49 | decimalPlacesLabel.setBuddy(self.decimalPlacesSpinBox)
50 | self.decimalPlacesSpinBox.setRange(0, 6)
51 | self.decimalPlacesSpinBox.setValue(format["decimalplaces"])
52 | self.redNegativesCheckBox = QtGui.QCheckBox("&Red negative numbers")
53 | self.redNegativesCheckBox.setChecked(format["rednegatives"])
54 |
55 | self.format = format
56 | self.callback = callback
57 |
58 | grid = QtGui.QGridLayout()
59 | grid.addWidget(thousandsLabel, 0, 0)
60 | grid.addWidget(self.thousandsEdit, 0, 1)
61 | grid.addWidget(decimalMarkerLabel, 1, 0)
62 | grid.addWidget(self.decimalMarkerEdit, 1, 1)
63 | grid.addWidget(decimalPlacesLabel, 2, 0)
64 | grid.addWidget(self.decimalPlacesSpinBox, 2, 1)
65 | grid.addWidget(self.redNegativesCheckBox, 3, 0, 1, 2)
66 | self.setLayout(grid)
67 | self.setWindowTitle("Set Number Format (`Live')")
68 |
69 | #some of the following are probably custom signals
70 | self.thousandsEdit.textEdited.connect(self.checkAndFix) #does textedited need [str]
71 | self.decimalMarkerEdit.textEdited.connect(self.checkAndFix)
72 | self.decimalPlacesSpinBox.valueChanged.connect(self.apply)
73 | self.redNegativesCheckBox.toggled.connect(self.apply)
74 |
75 | def checkAndFix(self):
76 | thousands = self.thousandsEdit.text()
77 | decimal = self.decimalMarkerEdit.text()
78 | if thousands == decimal:
79 | self.thousandsEdit.clear()
80 | self.thousandsEdit.setFocus()
81 | if len(decimal) == 0:
82 | self.decimalMarkerEdit.setText(".")
83 | self.decimalMarkerEdit.selectAll()
84 | self.decimalMarkerEdit.setFocus()
85 | self.apply()
86 |
87 |
88 | def apply(self):
89 | self.format["thousandsseparator"] = self.thousandsEdit.text()
90 | self.format["decimalmarker"] = self.decimalMarkerEdit.text()
91 | self.format["decimalplaces"] = self.decimalPlacesSpinBox.value()
92 | self.format["rednegatives"] = self.redNegativesCheckBox.isChecked()
93 | self.callback()
94 |
95 |
96 |
--------------------------------------------------------------------------------
/Chapter6/README.md:
--------------------------------------------------------------------------------
1 | # PySide Summer Chapter 6: Main Windows
2 | A PySide port of the code from Chapter 6 of Mark Summerfield's 'Rapid GUI Programming with Python and Qt' (2008). The central module is _imagechanger.py_. It lets you load an image and edit it various ways. The port also includes an answer to the exercise (_imagechanger_ansPyside.py_ and its associated dialog builder _resizedlgPyside.py_).
3 |
4 | Also, see usefulDocumentation.txt for helpful excerpts from the PySide documentation for relevant classes used in the files.
5 |
6 | ## Structure of Package
7 | The main module is _imagechangerPyside.py_. It uses the following:
8 | * newimagedlgPyside.py
9 | * helpformPyside.py
10 | * resources.qrc
11 | * newimagedlg.ui
12 | * images/ (contains icons for the menus/toolbars)
13 |
14 | This directory also includes a sample image, _buttfumble.png_, a picture from the most wonderful play of football in all time. Google it.
15 |
16 | ## Compiling the resource file
17 | To compile the resource file (_resources.qrc_) you should use something like the following command at your system prompt, with the containing folder as working directory:
18 |
19 | `pyside-rcc resources.qrc -o resource_rc.py`
20 |
21 | This assumes the folder containing pyside-rcc.exe is on your system path (you may have to add it yourself).
22 |
23 | As we are following the usual PySide conventions, we are naming the compiled file a little differently than Summerfield (_resource_rc.py_ instead of _qrc_resources.py_), but you can name it whatever you wish.
24 |
25 | ## Generating the dialog from the ui-file
26 | The file _newimagedlg.ui_ was created by _Qt Designer_ (a GUI for designing Qt applications). Such ui files must be converted into Python modules using a dedicated program (see Chapter 7). In PySide, you can perform this conversion using _pyside-uic.exe_ (whose containing directory should be added to your system path, if it isn't already there). With PySideSummer/Chapter 6 as your working directory, enter the following at your system prompt:
27 |
28 | `pyside-uic newimagedlg.ui -o ui_newimagedlgPyside.py`
29 |
30 | This should create the required Python module that is loaded into the program.
31 |
32 | ### Licensing and such
33 | Code is under the GPL license: http://www.gnu.org/copyleft/gpl.html
34 |
35 | This script is part of the PySideSummer repository at GitHub:
36 | https://github.com/EricThomson/PySideSummer
37 |
38 |
--------------------------------------------------------------------------------
/Chapter6/buttfumble.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter6/buttfumble.png
--------------------------------------------------------------------------------
/Chapter6/help/editmenu.html:
--------------------------------------------------------------------------------
1 |
2 | Image Changer - Edit Menu
3 |
4 |
5 | Work in progres...
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Chapter6/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 |
--------------------------------------------------------------------------------
/Chapter6/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 |
--------------------------------------------------------------------------------
/Chapter6/helpformPyside.py:
--------------------------------------------------------------------------------
1 | # coding: utf-8
2 | '''
3 | helpformPyside.py
4 | Annotated PySide adaptation of helpform.py from Chapter 6
5 | of Mark Summerfield's 'Rapid GUI Programming with Python and Qt' (2008)
6 | Book's web site: http://www.qtrac.eu/pyqtbook.html
7 |
8 | This is imported by imagechangerPyside.py
9 |
10 | -------
11 | This script is part of the PySideSummer repository at GitHub:
12 | https://github.com/EricThomson/PySideSummer
13 |
14 | Code is under the GPL license: http://www.gnu.org/copyleft/gpl.html
15 | '''
16 | from PySide import QtGui, QtCore
17 | import resource_rc
18 |
19 | #QtCore: QUrl, Qt, SIGNAL, SLOT
20 | #QtGui: QAction, QApplication, QDialog, QIcon,
21 | # QKeySequence, QLabel, QTextBrowser, QToolBar, QVBoxLayout
22 |
23 | class HelpForm(QtGui.QDialog):
24 |
25 | def __init__(self, page, parent=None):
26 | QtGui.QDialog.__init__(self, parent)
27 | self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
28 | self.setAttribute(QtCore.Qt.WA_GroupLeader)
29 |
30 | backAction = QtGui.QAction(QtGui.QIcon(":/back.png"), "&Back", self)
31 | backAction.setShortcut(QtGui.QKeySequence.Back)
32 | homeAction = QtGui.QAction(QtGui.QIcon(":/home.png"), "&Home", self)
33 | homeAction.setShortcut("Home")
34 | self.pageLabel = QtGui.QLabel()
35 |
36 | toolBar = QtGui.QToolBar()
37 | toolBar.addAction(backAction)
38 | toolBar.addAction(homeAction)
39 | toolBar.addWidget(self.pageLabel)
40 | self.textBrowser = QtGui.QTextBrowser()
41 |
42 | layout = QtGui.QVBoxLayout()
43 | layout.addWidget(toolBar)
44 | layout.addWidget(self.textBrowser, 1)
45 | self.setLayout(layout)
46 |
47 | backAction.triggered.connect(self.textBrowser.backward)
48 | homeAction.triggered.connect(self.textBrowser.home)
49 | self.textBrowser.sourceChanged[QtCore.QUrl].connect(self.updatePageTitle) #not sure if qurl needed
50 |
51 |
52 | self.textBrowser.setSearchPaths([":/help"])
53 | self.textBrowser.setSource(QtCore.QUrl(page))
54 | self.resize(400, 600)
55 | self.setWindowTitle("{0} Help".format(
56 | QtGui.QApplication.applicationName()))
57 |
58 |
59 | def updatePageTitle(self):
60 | self.pageLabel.setText(self.textBrowser.documentTitle())
61 |
62 |
63 | if __name__ == "__main__":
64 | import sys
65 |
66 | app = QtGui.QApplication(sys.argv)
67 | form = HelpForm("index.html")
68 | form.show()
69 | app.exec_()
70 |
71 |
--------------------------------------------------------------------------------
/Chapter6/images/back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter6/images/back.png
--------------------------------------------------------------------------------
/Chapter6/images/editinvert.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter6/images/editinvert.png
--------------------------------------------------------------------------------
/Chapter6/images/editmirror.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter6/images/editmirror.png
--------------------------------------------------------------------------------
/Chapter6/images/editmirrorhoriz.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter6/images/editmirrorhoriz.png
--------------------------------------------------------------------------------
/Chapter6/images/editmirrorvert.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter6/images/editmirrorvert.png
--------------------------------------------------------------------------------
/Chapter6/images/editresize.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter6/images/editresize.png
--------------------------------------------------------------------------------
/Chapter6/images/editswap.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter6/images/editswap.png
--------------------------------------------------------------------------------
/Chapter6/images/editunmirror.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter6/images/editunmirror.png
--------------------------------------------------------------------------------
/Chapter6/images/editzoom.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter6/images/editzoom.png
--------------------------------------------------------------------------------
/Chapter6/images/filenew.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter6/images/filenew.png
--------------------------------------------------------------------------------
/Chapter6/images/fileopen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter6/images/fileopen.png
--------------------------------------------------------------------------------
/Chapter6/images/fileprint.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter6/images/fileprint.png
--------------------------------------------------------------------------------
/Chapter6/images/filequit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter6/images/filequit.png
--------------------------------------------------------------------------------
/Chapter6/images/filesave.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter6/images/filesave.png
--------------------------------------------------------------------------------
/Chapter6/images/filesaveas.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter6/images/filesaveas.png
--------------------------------------------------------------------------------
/Chapter6/images/home.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter6/images/home.png
--------------------------------------------------------------------------------
/Chapter6/images/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter6/images/icon.png
--------------------------------------------------------------------------------
/Chapter6/newimagedlgPyside.py:
--------------------------------------------------------------------------------
1 | # coding: utf-8
2 | '''
3 | newimagedlgPyside.py
4 | Annotated PySide adaptation of newimagedlg.py from Chapter 6
5 | of Mark Summerfield's 'Rapid GUI Programming with Python and Qt' (2008)
6 | Book's web site: http://www.qtrac.eu/pyqtbook.html
7 |
8 | This is imported by imagechangerPyside.py
9 |
10 | Useful attributes of Qt to enumerate:
11 | PySide.QtCore.Qt.GlobalColor
12 | PySide.QtCore.Qt.BrushStyle
13 | -------
14 | This script is part of the PySideSummer repository at GitHub:
15 | https://github.com/EricThomson/PySideSummer
16 |
17 | Code is under the GPL license: http://www.gnu.org/copyleft/gpl.html
18 | '''
19 |
20 | from PySide import QtCore, QtGui
21 | import ui_newimagedlgPyside
22 |
23 | #QtCore: QVariant, Qt, SIGNAL
24 | #QtGui: QApplication, QBrush, QColorDialog, QDialog, QPainter, QPixmap)
25 |
26 | class NewImageDlg(QtGui.QDialog, ui_newimagedlgPyside.Ui_NewImageDlg):
27 |
28 | def __init__(self, parent=None):
29 | QtGui.QDialog.__init__(self, parent)
30 | self.setupUi(self) #imported from ui_newimagedlgPyside
31 |
32 | #Default color
33 | self.color = QtCore.Qt.red
34 | #Populate combobox with different patterns
35 | for value, text in (
36 | (QtCore.Qt.SolidPattern, "Solid"),
37 | (QtCore.Qt.Dense1Pattern, "Dense #1"),
38 | (QtCore.Qt.Dense2Pattern, "Dense #2"),
39 | (QtCore.Qt.Dense3Pattern, "Dense #3"),
40 | (QtCore.Qt.Dense4Pattern, "Dense #4"),
41 | (QtCore.Qt.Dense5Pattern, "Dense #5"),
42 | (QtCore.Qt.Dense6Pattern, "Dense #6"),
43 | (QtCore.Qt.Dense7Pattern, "Dense #7"),
44 | (QtCore.Qt.HorPattern, "Horizontal"),
45 | (QtCore.Qt.VerPattern, "Vertical"),
46 | (QtCore.Qt.CrossPattern, "Cross"),
47 | (QtCore.Qt.BDiagPattern, "Backward Diagonal"),
48 | (QtCore.Qt.FDiagPattern, "Forward Diagonal"),
49 | (QtCore.Qt.DiagCrossPattern, "Diagonal Cross")) :
50 | self.brushComboBox.addItem(text, value) #second argument was: QtCore.QVariant(value)
51 |
52 | self.colorButton.clicked.connect(self.getColor)
53 | self.brushComboBox.activated.connect(self.setColor) #int?
54 | self.setColor()
55 | self.widthSpinBox.setFocus()
56 |
57 | #http://srinikom.github.io/pyside-docs/PySide/QtGui/QColorDialog.html
58 | def getColor(self):
59 | color = QtGui.QColorDialog.getColor(QtCore.Qt.black, self) #dialog initializes to black
60 | if color.isValid():
61 | self.color = color
62 | self.setColor()
63 |
64 |
65 | def setColor(self):
66 | pixmap = self._makePixmap(60, 30)
67 | self.colorLabel.setPixmap(pixmap)
68 |
69 |
70 | def image(self):
71 | pixmap = self._makePixmap(self.widthSpinBox.value(),
72 | self.heightSpinBox.value())
73 | return QtGui.QPixmap.toImage(pixmap) #convert qpixmap to qimage
74 |
75 |
76 | def _makePixmap(self, width, height): #why private?
77 | pixmap = QtGui.QPixmap(width, height)
78 | style = self.brushComboBox.itemData(
79 | self.brushComboBox.currentIndex()) #was: .toInt()[0]
80 | brush = QtGui.QBrush(self.color, QtCore.Qt.BrushStyle(style))
81 | painter = QtGui.QPainter(pixmap)
82 | painter.fillRect(pixmap.rect(), QtCore.Qt.white)
83 | painter.fillRect(pixmap.rect(), brush)
84 | return pixmap
85 |
86 |
87 | if __name__ == "__main__":
88 | import sys
89 | app = QtGui.QApplication(sys.argv)
90 | form = NewImageDlg()
91 | form.show()
92 | app.exec_()
93 |
94 |
--------------------------------------------------------------------------------
/Chapter6/resizedlgPySide.py:
--------------------------------------------------------------------------------
1 | # coding: utf-8
2 | """
3 | resizedlgPyside.py
4 | Resizing dialog for Image Changer.
5 |
6 | One aspect of a solution to the exercise in Chapter 6 of
7 | Mark Summerfield's 'Rapid GUI Programming with Python and Qt' (2008)
8 | Book's web site: http://www.qtrac.eu/pyqtbook.html
9 |
10 | Note Summerfield provides a slightly different solution on his web site
11 |
12 | -------
13 | This script is part of the PySideSummer repository at GitHub:
14 | https://github.com/EricThomson/PySideSummer
15 |
16 | Code is under the GPL license: http://www.gnu.org/copyleft/gpl.html
17 |
18 | """
19 |
20 | from PySide import QtGui, QtCore
21 | import sys
22 |
23 | class ResizeDlg(QtGui.QDialog):
24 | def __init__(self, width, height, parent=None):
25 | QtGui.QDialog.__init__(self, parent)
26 | self.setWindowTitle("Resize dialog")
27 | self.height=int(height)
28 | self.width=int(width)
29 |
30 | maxWidth=self.width*4
31 | maxHeight=self.height*4
32 | #Width
33 | widthLabel=QtGui.QLabel("&Width:")
34 | self.widthSpinbox=QtGui.QDoubleSpinBox()
35 | self.widthSpinbox.setRange(4, maxWidth)
36 | self.widthSpinbox.setValue(width)
37 | self.widthSpinbox.setDecimals(0)
38 | widthLabel.setBuddy(self.widthSpinbox)
39 | #Height
40 | heightLabel=QtGui.QLabel("&Height:")
41 | self.heightSpinbox=QtGui.QDoubleSpinBox()
42 | self.heightSpinbox.setRange(4, maxHeight)
43 | self.heightSpinbox.setValue(height)
44 | self.heightSpinbox.setDecimals(0)
45 | heightLabel.setBuddy(self.heightSpinbox)
46 | buttonBox = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok|
47 | QtGui.QDialogButtonBox.Cancel)
48 | buttonBox.accepted.connect(self.accept) #accepted goes with OK automatically (reimplement accept)
49 | buttonBox.rejected.connect(self.reject) #rejected goes with cancel automatically
50 |
51 | #Layout
52 | layout=QtGui.QGridLayout()
53 | layout.addWidget(widthLabel, 0, 0)
54 | layout.addWidget(self.widthSpinbox,0,1)
55 | layout.addWidget(heightLabel,1,0)
56 | layout.addWidget(self.heightSpinbox, 1,1)
57 | layout.addWidget(buttonBox, 2, 1, 2)
58 | self.setLayout(layout)
59 |
60 | def accept(self):
61 | self.width = int(self.widthSpinbox.value())
62 | self.height = int(self.heightSpinbox.value())
63 | QtGui.QDialog.accept(self) #calling base classes accept method (what will be returned to exec_)
64 |
65 | def result(self):
66 | return self.width, self.height
67 |
68 |
69 |
70 |
71 | if __name__=="__main__":
72 | app=QtGui.QApplication(sys.argv)
73 | sizeDialog=ResizeDlg(100,100)
74 | sizeDialog.show()
75 | if sizeDialog.exec_():
76 | print "Done", sizeDialog.result() #dialog is hidden, not deleted, so can still get attributes
77 | print sizeDialog.width
78 | else:
79 | print "Cancelled"
80 |
81 |
82 |
83 |
--------------------------------------------------------------------------------
/Chapter6/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/editresize.png
11 | images/editswap.png
12 | images/editzoom.png
13 | images/editmirror.png
14 | images/editunmirror.png
15 | images/editmirrorhoriz.png
16 | images/editmirrorvert.png
17 | images/back.png
18 | images/home.png
19 | images/icon.png
20 |
21 | help/editmenu.html
22 | help/filemenu.html
23 | help/index.html
24 |
25 |
26 |
--------------------------------------------------------------------------------
/Chapter7/README.md:
--------------------------------------------------------------------------------
1 | #PySide Summer Chapter 7 (Using Qt Designer)
2 | PySide translation of files for Chapter 7 of Mark Summerfield's 'Rapid GUI Programming with Python and Qt' (2008). This chapter goes over building Dialogs using Qt Designer, the visual design tool for GUI construction.
3 |
4 | ###Generating the GUI module
5 | As with the .ui file in Chapter 6, once we have saved the desired .ui file built in the first part of the chapter, to use it we convert it into a Python file. To do this, as we discussed in more detail in the README for Chapter 6, we use pyside-uic.exe:
6 |
7 | `pyside-uic findandreplacedlg.ui -o ui_findandreplacedlgPyside.py`
8 |
9 | This will create, in the same folder, the designated Python file which is ready to be used as a base class. The same applies to the exercise, which I've called ticketorderdlg1.ui here. Frankly, I focused more on doing the exercise than the example from the chapter, as the main goal is to learn to use Qt Designer. So `findandreplacedlgPyside.py` could probably use some work.
10 |
11 | ###Licensing and such
12 | Code is under the GPL license: http://www.gnu.org/copyleft/gpl.html
13 |
14 | This script is part of the PySideSummer repository at GitHub:
15 | https://github.com/EricThomson/PySideSummer
16 |
17 |
--------------------------------------------------------------------------------
/Chapter7/usefulStuff.md:
--------------------------------------------------------------------------------
1 | Useful stuff to accompany Chapter 7 of PySideSummer repository:
2 | https://github.com/EricThomson/PySideSummer
3 |
4 | #Useful links
5 | On using code generated in Qt Designer:
6 | http://pyqt.sourceforge.net/Docs/PyQt4/designer.html#using-the-generated-code
7 | There are three main ways discussed, and Summerfield uses the third. I show examples
8 | of all three in Chapter7/working/openDlgi.py (i=1-3), which I have not yet exported to GitHub.
9 |
10 | Some of the following material on autoconnecting with slots is adapted from:
11 | http://joat-programmer.blogspot.com/2012/02/pyqt-signal-and-slots-to-capture-events.html
12 |
13 |
14 | #Useful PySide Documentation
15 |
16 | ##QtGui.QDateTimeEdit
17 | http://srinikom.github.io/pyside-docs/PySide/QtGui/QDateTimeEdit.html
18 | The PySide.QtGui.QDateTimeEdit class provides a widget for editing dates and times.
19 |
20 | PySide.QtGui.QDateTimeEdit allows the user to edit dates by using the keyboard or the arrow keys to increase and decrease date and time values. The arrow keys can be used to move from section to section within the PySide.QtGui.QDateTimeEdit box. Dates and times appear in accordance with the format set; see PySide.QtGui.QDateTimeEdit.setDisplayFormat().
21 |
22 | getDateTime returns type QtCore.QDatetime type.
23 |
24 | ##QDateTime class
25 | http://srinikom.github.io/pyside-docs/PySide/QtCore/QDateTime.html
26 |
--------------------------------------------------------------------------------
/Chapter8/README.md:
--------------------------------------------------------------------------------
1 | #PySide Summer Chapter 8 (Data Handling and Custom File Formats)
2 | PySide translation of files for Chapter 8 of Mark Summerfield's 'Rapid GUI Programming with Python and Qt' (2008). The GUI design is similar to that for Chapter 6, but in this chapter this focus is on loading/saving data in different formats. The central medule is _mymoviesPyside.py_.
3 |
4 | Also see `usefulStuff.md` for helpful excerpts from the PySide documentation for relevant classes used in the files.
5 |
6 | ##Structure of Package
7 | The main module is _mymoviesPyside.py_. It uses the following:
8 | * moviedataPyside.py
9 | * addeditmoviedlgPyside.py (calls dialog)
10 | * addeditmoviedlg.ui (use `pyside-uic` to build ui_addeditmoviedlgPyside.py)
11 | * resources.qrc (use `pyside-rcc` to compile)
12 | * images/ (folder contains icons for the menus/toolbars)
13 |
14 | The Chapter 8 directory also includes sample data: _mymovies.mqb_ is the original dataset Summerfield provides. It is useful to start with that, and go from there (to and from mqt, mpt, mpb, and XML, to make sure everything is working as expected).
15 |
16 | There is a lot of test code in `__main__` in `moviedataPyside.py`. It is useful for debugging.
17 |
18 | ##Solution to exercise
19 | Also included is one answer to the exercise. The new code is in _mymoviesPyside_ans.py_, _moviedataPyside_ans.py_, _addeditmoviedlgPyside_ans.py_, and _addeditmoviedlg_ans.ui_ (which you should convert to a ui_*.py file, as we've already covered in the previous two chapters).
20 |
21 | Summerfield also has answers (using PyQt) at the book's web site, which is probably better than my answer.
22 |
23 | ##Notes about translation of Chapter 8
24 | Qt.escape() is no longer in use, so replace it with xml.sax.saxutils.escape().
25 |
26 | ###Licensing and such
27 | Code is under the GPL license: http://www.gnu.org/copyleft/gpl.html
28 |
29 | This script is part of the PySideSummer repository at GitHub:
30 | https://github.com/EricThomson/PySideSummer
31 |
--------------------------------------------------------------------------------
/Chapter8/addeditmoviedlgPyside.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """
3 | addeditmoviedlgPyside.py
4 | Annotated PySide adaptation of addeditmoviedlg.py from Chapter 8
5 | of Mark Summerfield's 'Rapid GUI Programming with Python and Qt' (2008)
6 | Book's web site: http://www.qtrac.eu/pyqtbook.html
7 |
8 | Imports dialog ui_addedetmoviedlgPyside to build dialog for adding/editing movies
9 |
10 | ------
11 | This script is part of the PySideSummer repository at GitHub:
12 | https://github.com/EricThomson/PySideSummer
13 |
14 | Code is under the GPL license: http://www.gnu.org/copyleft/gpl.html
15 | """
16 | from PySide import QtGui, QtCore
17 | import moviedataPyside
18 | import ui_addeditmoviedlgPyside
19 |
20 |
21 | class AddEditMovieDlg(QtGui.QDialog, ui_addeditmoviedlgPyside.Ui_AddEditMovieDlg):
22 |
23 | def __init__(self, movies, movie=None, parent=None):
24 | QtGui.QDialog.__init__(self, parent)
25 | self.setupUi(self)
26 |
27 | self.movies = movies
28 | self.movie = movie
29 | self.acquiredDateEdit.setDisplayFormat(moviedataPyside.DATEFORMAT)
30 | if movie is not None:
31 | self.titleLineEdit.setText(movie.title)
32 | self.yearSpinBox.setValue(movie.year)
33 | self.minutesSpinBox.setValue(movie.minutes)
34 | self.acquiredDateEdit.setDate(movie.acquired)
35 | self.acquiredDateEdit.setEnabled(False)
36 | self.notesTextEdit.setPlainText(movie.notes)
37 | self.notesTextEdit.setFocus()
38 | self.buttonBox.button(QtGui.QDialogButtonBox.Ok).setText(
39 | "&Accept")
40 | self.setWindowTitle("My Movies - Edit Movie")
41 | else:
42 | today = QtCore.QDate.currentDate()
43 | self.acquiredDateEdit.setDateRange(today.addDays(-5),
44 | today)
45 | self.acquiredDateEdit.setDate(today)
46 | self.titleLineEdit.setFocus()
47 | self.on_titleLineEdit_textEdited("")
48 |
49 |
50 | @QtCore.Slot(str)
51 | def on_titleLineEdit_textEdited(self, text):
52 | self.buttonBox.button(QtGui.QDialogButtonBox.Ok).setEnabled(bool(self.titleLineEdit.text()))
53 |
54 |
55 | def accept(self):
56 | title = self.titleLineEdit.text()
57 | year = self.yearSpinBox.value()
58 | minutes = self.minutesSpinBox.value()
59 | notes = self.notesTextEdit.toPlainText()
60 | if self.movie is None:
61 | acquired = self.acquiredDateEdit.date()
62 | self.movie = moviedataPyside.Movie(title, year, minutes, acquired, notes)
63 |
64 | if self.movies == 27705: #just for the test below...otherwise will get an error
65 | print "Test success"
66 | else:
67 | self.movies.add(self.movie)
68 |
69 | else:
70 | self.movies.updateMovie(self.movie, title, year, minutes, notes)
71 | QtGui.QDialog.accept(self)
72 |
73 |
74 | if __name__ == "__main__":
75 | import sys
76 | app = QtGui.QApplication(sys.argv)
77 | form = AddEditMovieDlg(27705)
78 | form.show()
79 | app.exec_()
80 |
81 |
--------------------------------------------------------------------------------
/Chapter8/addeditmoviedlgPyside_ans.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """
3 | addeditmoviedlgPyside_ans.py
4 | Annotated PySide adaptation of addeditmoviedlg.py from Chapter 8
5 | of Mark Summerfield's 'Rapid GUI Programming with Python and Qt' (2008)
6 | Book's web site: http://www.qtrac.eu/pyqtbook.html
7 |
8 | Imports dialog ui_addedetmoviedlgPyside to build dialog for adding/editing movies
9 |
10 | ------
11 | This script is part of the PySideSummer repository at GitHub:
12 | https://github.com/EricThomson/PySideSummer
13 |
14 | Code is under the GPL license: http://www.gnu.org/copyleft/gpl.html
15 | """
16 | from PySide import QtGui, QtCore
17 | import moviedataPyside_ans
18 | import ui_addeditmoviedlg_ans
19 |
20 |
21 | class AddEditMovieDlg(QtGui.QDialog, ui_addeditmoviedlg_ans.Ui_AddEditMovieDlg):
22 |
23 | def __init__(self, movies, movie=None, parent=None):
24 | QtGui.QDialog.__init__(self, parent)
25 | self.setupUi(self)
26 |
27 | self.movies = movies
28 | self.movie = movie
29 | self.acquiredDateEdit.setDisplayFormat(moviedataPyside_ans.DATEFORMAT)
30 | #How to display edit box
31 | if movie is not None:
32 | self.titleLineEdit.setText(movie.title)
33 | self.yearSpinBox.setValue(movie.year)
34 | self.minutesSpinBox.setValue(movie.minutes)
35 | self.acquiredDateEdit.setDate(movie.acquired)
36 | self.acquiredDateEdit.setEnabled(False)
37 | self.notesTextEdit.setPlainText(movie.notes)
38 | self.locationLineEdit.setText(movie.location)
39 | self.notesTextEdit.setFocus()
40 | self.buttonBox.button(QtGui.QDialogButtonBox.Ok).setText(
41 | "&Accept")
42 | self.setWindowTitle("My Movies - Edit Movie")
43 | else:
44 | today = QtCore.QDate.currentDate()
45 | self.acquiredDateEdit.setDateRange(today.addDays(-365),
46 | today)
47 | self.acquiredDateEdit.setDate(today)
48 | self.titleLineEdit.setFocus()
49 | self.on_titleLineEdit_textEdited("")
50 |
51 | #Enable OK button on button box when title is entered (and not deleted)
52 | @QtCore.Slot(str)
53 | def on_titleLineEdit_textEdited(self, text):
54 | self.buttonBox.button(QtGui.QDialogButtonBox.Ok).setEnabled(bool(self.titleLineEdit.text()))
55 |
56 |
57 | def accept(self):
58 | title = self.titleLineEdit.text()
59 | year = self.yearSpinBox.value()
60 | minutes = self.minutesSpinBox.value()
61 | notes = self.notesTextEdit.toPlainText()
62 | location=self.locationLineEdit.text()
63 | if self.movie is None:
64 | acquired = self.acquiredDateEdit.date()
65 | self.movie = moviedataPyside_ans.Movie(title, year, minutes, acquired, notes, location)
66 | if self.movies == 27705: #just for the test below...otherwise will get an error
67 | print "Test success"
68 | else:
69 | self.movies.add(self.movie)
70 |
71 | else:
72 | self.movies.updateMovie(self.movie, title, year, minutes, notes, location)
73 | QtGui.QDialog.accept(self)
74 |
75 |
76 | if __name__ == "__main__":
77 | #Primitive test to make sure GUI isn't breaking
78 | import sys
79 | app = QtGui.QApplication(sys.argv)
80 | form = AddEditMovieDlg(27705)
81 | form.show()
82 | app.exec_()
--------------------------------------------------------------------------------
/Chapter8/images/editadd.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter8/images/editadd.png
--------------------------------------------------------------------------------
/Chapter8/images/editdelete.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter8/images/editdelete.png
--------------------------------------------------------------------------------
/Chapter8/images/editedit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter8/images/editedit.png
--------------------------------------------------------------------------------
/Chapter8/images/filenew.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter8/images/filenew.png
--------------------------------------------------------------------------------
/Chapter8/images/fileopen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter8/images/fileopen.png
--------------------------------------------------------------------------------
/Chapter8/images/filequit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter8/images/filequit.png
--------------------------------------------------------------------------------
/Chapter8/images/filesave.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter8/images/filesave.png
--------------------------------------------------------------------------------
/Chapter8/images/filesaveas.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter8/images/filesaveas.png
--------------------------------------------------------------------------------
/Chapter8/images/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter8/images/icon.png
--------------------------------------------------------------------------------
/Chapter8/mymovies.mqb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter8/mymovies.mqb
--------------------------------------------------------------------------------
/Chapter8/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 |
--------------------------------------------------------------------------------
/Chapter9/README.md:
--------------------------------------------------------------------------------
1 | #PySide Summer Chapter 9 (Layouts and Multiple Documents)
2 | PySide translation of files for Chapter 9 of Mark Summerfield's 'Rapid GUI Programming with Python and Qt' (2008). Also see `usefulStuff.md` for helpful excerpts from the PySide documentation for relevant classes used in the files.
3 |
4 | ##Solution to exercise
5 | Also included is one answer to the exercise. The new code is in _tabbededitorPyside.py_. Summerfield also has answers (using PyQt) at the book's web site, which is probably better than my answer.
6 |
7 | ##Notes about translation of Chapter 9
8 | As Summerfield notes at his web site, it is nontrivial in PySide to check to see if an instance of an object has been deleted or not (this is what his isAlive method did). See my notes in _sditexteditorPyside.py_ for a workaround that works nicely.
9 |
10 | Because QWorkspace is deprecated, I used the recommended QMdiArea class instead for the MDI editor. See texteditorPyside.py for a description of what this change entailed, and UsefulStuff.md for some of the more helpful documentation.
11 |
12 | ###Licensing and such
13 | Code is under the GPL license: http://www.gnu.org/copyleft/gpl.html
14 |
15 | This script is part of the PySideSummer repository at GitHub:
16 | https://github.com/EricThomson/PySideSummer
17 |
--------------------------------------------------------------------------------
/Chapter9/images/editadd.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter9/images/editadd.png
--------------------------------------------------------------------------------
/Chapter9/images/editcopy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter9/images/editcopy.png
--------------------------------------------------------------------------------
/Chapter9/images/editcut.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter9/images/editcut.png
--------------------------------------------------------------------------------
/Chapter9/images/editdelete.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter9/images/editdelete.png
--------------------------------------------------------------------------------
/Chapter9/images/editedit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter9/images/editedit.png
--------------------------------------------------------------------------------
/Chapter9/images/editpaste.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter9/images/editpaste.png
--------------------------------------------------------------------------------
/Chapter9/images/filenew.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter9/images/filenew.png
--------------------------------------------------------------------------------
/Chapter9/images/fileopen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter9/images/fileopen.png
--------------------------------------------------------------------------------
/Chapter9/images/filequit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter9/images/filequit.png
--------------------------------------------------------------------------------
/Chapter9/images/filesave.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter9/images/filesave.png
--------------------------------------------------------------------------------
/Chapter9/images/filesaveas.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter9/images/filesaveas.png
--------------------------------------------------------------------------------
/Chapter9/images/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EricThomson/PySideSummer/d5c9f418eb24178e0ff5fd3d833666e746c64bec/Chapter9/images/icon.png
--------------------------------------------------------------------------------
/Chapter9/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 |
--------------------------------------------------------------------------------
/Chapter9/texteditPyside.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """
3 | texteditPyside.py
4 | Annotated PySide port of textedit.pyw from Chapter 9
5 | of Mark Summerfield's 'Rapid GUI Programming with Python and Qt' (2008)
6 | Book's web site: http://www.qtrac.eu/pyqtbook.html
7 |
8 | Imported by texteditorPyside.py
9 |
10 | ------
11 | This script is part of the PySideSummer repository at GitHub:
12 | https://github.com/EricThomson/PySideSummer
13 |
14 | Code is under the GPL license: http://www.gnu.org/copyleft/gpl.html
15 | """
16 |
17 | import codecs
18 | from PySide import QtGui, QtCore
19 |
20 | class TextEdit(QtGui.QTextEdit):
21 |
22 | #for unnamed files
23 | NextId = 1
24 |
25 | def __init__(self, filename="", parent=None):
26 | QtGui.QTextEdit.__init__(self, parent)
27 | self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
28 | #print "TextEdit init filename: ", filename
29 | self.filename = filename
30 | if self.filename=="":
31 | self.filename = unicode("Unnamed-{0}.txt".format(TextEdit.NextId))
32 | TextEdit.NextId += 1
33 | self.document().setModified(False)
34 | #print "type(self.document()): ", type(self.document())
35 | #print "type(self): ", type(self)
36 | pathlessName=QtCore.QFileInfo(self.filename).fileName()
37 | self.setWindowTitle(pathlessName)
38 |
39 | def closeEvent(self, event):
40 | error=None
41 | if (self.document().isModified() and
42 | QtGui.QMessageBox.question(self,
43 | "Text Editor - Unsaved Changes",
44 | "Save unsaved changes in {0}?".format(self.filename),
45 | QtGui.QMessageBox.Yes|QtGui.QMessageBox.No) ==
46 | QtGui.QMessageBox.Yes):
47 | try:
48 | self.save()
49 | except (IOError, OSError), err:
50 | error=err
51 | except Exception as err:
52 | error=err
53 | if error is not None:
54 | QtGui.QMessageBox.warning(self,
55 | "textedit closeEvent save error",
56 | "Failed to save {0}: {1}".format(self.filename, error))
57 |
58 | def isModified(self):
59 | #print "checking to see if modified file type: ", type(self.document())
60 | #built-in isModified() returns true if the text has been modified since
61 | #it was either loaded or since the last call to setModified with false
62 | #as argument.
63 | return self.document().isModified() #qtextedit built-in method
64 |
65 | def save(self):
66 | #If no name yet, query for name
67 | if self.filename.startswith("Unnamed"):
68 | filename = QtGui.QFileDialog.getSaveFileName(self,
69 | "Text Editor -- file needs name", self.filename,
70 | "Text files (*.txt *.*)")[0]
71 | #print "textEdit.save() filename: ", filename
72 | if filename=="":
73 | return
74 | self.filename = filename
75 |
76 | #In the following, why not replace argument with self.filename?
77 | self.setWindowTitle(QtCore.QFileInfo(self.filename).fileName())
78 | #print "textedit save: filename ", self.filename
79 | with codecs.open(self.filename, "w", encoding="utf-8") as file:
80 | #print "textedit save codecs opened ", self.filename
81 | try:
82 | file.write(self.toPlainText())
83 | except Exception as err:
84 | print "textedit save failed with Exception {0}".format(err)
85 | self.document().setModified(False)
86 |
87 | def load(self):
88 | with codecs.open(self.filename, encoding="utf-8") as file:
89 | #print "textedit class self.filename: ", self.filename
90 | self.setPlainText(file.read())
91 | self.document().setModified(False)
92 |
--------------------------------------------------------------------------------