|
38.
|
|
|
Lines 6‒17: Define our <code>Demo</code> class. Pay special attention to lines 13‒15, where we call 3 methods which will do the whole job. They will be detailed below.
|
|
|
(itstool) path: item/p
|
|
|
|
(no translation yet)
|
|
|
|
Located in
C/record-collection.js.page:104
|
|
39.
|
|
|
Lines 19‒23: Start the application.
|
|
|
(itstool) path: item/p
|
|
|
|
(no translation yet)
|
|
|
|
Located in
C/record-collection.js.page:105
|
|
40.
|
|
|
Designing the application
|
|
|
(itstool) path: section/title
|
|
|
|
(no translation yet)
|
|
|
|
Located in
C/record-collection.js.page:110
|
|
41.
|
|
|
Let's take a look at the <code>setupWindow</code> method. It is responsible for creating the User Interface (UI). As UI is not our focus, we will explain only the relevant parts.
|
|
|
(itstool) path: section/p
|
|
|
|
(no translation yet)
|
|
|
|
Located in
C/record-collection.js.page:111
|
|
42.
|
|
|
Lines 22 and 27: Create the 2 entries (for the two fields) in which users will type something to get inserted in the database.
|
|
|
(itstool) path: item/p
|
|
|
|
(no translation yet)
|
|
|
|
Located in
C/record-collection.js.page:162
|
|
43.
|
|
|
Lines 31‒34: Create the Insert button. We connect its <code>clicked</code> signal to the <code>_insertClicked</code> private method of the class. This method is detailed below.
|
|
|
(itstool) path: item/p
|
|
|
|
(no translation yet)
|
|
|
|
Located in
C/record-collection.js.page:163
|
|
44.
|
|
|
Line 39: Create the widget (<code>TextView</code>) where we will show the contents of the table.
|
|
|
(itstool) path: item/p
|
|
|
|
(no translation yet)
|
|
|
|
Located in
C/record-collection.js.page:164
|
|
45.
|
|
|
Line 44: Create the label where we will show the number of records in the table. Initially it's empty, it will be updated later.
|
|
|
(itstool) path: item/p
|
|
|
|
(no translation yet)
|
|
|
|
Located in
C/record-collection.js.page:165
|
|
46.
|
|
|
Connecting to and initializing the database
|
|
|
(itstool) path: section/title
|
|
|
|
(no translation yet)
|
|
|
|
Located in
C/record-collection.js.page:170
|
|
47.
|
|
|
The code which makes the connection to the database is in the <code>setupDatabase</code> method below:
|
|
|
(itstool) path: section/p
|
|
|
|
(no translation yet)
|
|
|
|
Located in
C/record-collection.js.page:171
|