You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+58Lines changed: 58 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,6 +19,15 @@ Then open the url given in a web browser to view the site.
19
19
20
20
Any changes you make to a page should automatically updated when viewing locally. If nothing changes, check the terminal from where jekyll has been run to see if there are any errors.
21
21
22
+
If you are making a draft post and want to preview it locally you can run the following.
23
+
24
+
```
25
+
$ jekyll serve --w --drafts
26
+
```
27
+
28
+
The draft blog post will appear as the latest post.
29
+
30
+
22
31
## Contributing
23
32
24
33
You are welcome to contribute to the code club website, we need as much
@@ -51,3 +60,52 @@ page
51
60
```
52
61
so for example if the URL for a particular gist was ```https://gist.github.com/johnsmith/57fd5d7s8fd6``` then
53
62
in your webpage you would put ```{% gist johnsmith/57fd5d7s8fd6 %} ```
63
+
64
+
65
+
### Testing Framework
66
+
67
+
#### Running tests:
68
+
69
+
Functional tests have been written using [selenium](http://www.seleniumhq.org/).
70
+
To run these you will need the selenium python package:
Note that the testing framework requires [Firefox](https://www.mozilla.org/en-GB/firefox/new/) (it is possible to run other browsers but Firefox works out of the box).
93
+
When running these functional tests the browser will open up and navigate as dictated by the tests.
94
+
95
+
**Tests should be run after every pull and before every push (as well as throughout any other development).**
96
+
97
+
#### Writing tests
98
+
99
+
The functional tests are class based and all classes include a 'User Story'.
100
+
Whenever a new feature/page is added to the site a corresponding test should be written (note that at present not all tests that are needed are written).
101
+
In fact 'Test Driven Development' is the correct way to write any code:
102
+
103
+
1. Write a test
104
+
2. Check that tests fails
105
+
3. Write feature that stops test from failing
106
+
107
+
> Obey the Testing Goat! Do Nothing Until You Have a Test
A great explanation of this process is given in [this book](http://chimera.labs.oreilly.com/books/1234000000754/ch01.html) (free to read online and where the goat image is taken from).
Here's a picture of one of the moments during which a group of students and I were trying to figure out the best database to use for a neat project that we will hopefully finish next term:
Copy file name to clipboardExpand all lines: _posts/2015-01-16-making-an-app-in-python-using-kivy-1.md
+20-22Lines changed: 20 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,61 +7,59 @@ author : Timothy
7
7
comments : true
8
8
---
9
9
10
-
In the summer semester for the Computing for Mathematics module we were required to create 'companies' of 4.
11
-
The goal was for each company to create a 'product' which involves programming and mathematics.
12
-
For this my company decided to make an mobile app, to aid with learning mathematics through giving content and quiz.
10
+
In the summer semester for the Computing for Mathematics module we were required to create 'companies' of 4.
11
+
The goal was for each company to create a 'product' which involves programming and mathematics.
12
+
For this my company decided to make an mobile app, to aid with learning mathematics through giving content and quiz.
13
13
14
14
Once we have decided to make the app I looked at varies [GUI frameworks](https://wiki.python.org/moin/GuiProgramming) based on python which we could use.
15
-
From this list we decided that [Kivy](http://kivy.org/) would be best suited for what we required.
15
+
From this list we decided that [Kivy](http://kivy.org/) would be best suited for what we required.
16
16
17
17
## Creating a basic Kivy app
18
18
19
-
Below is the code for a basic app that has the label of 'Hello World'.
19
+
Below is the code for a basic app that has the label of 'Hello World'.
Copy file name to clipboardExpand all lines: _posts/2015-01-28-making-an-app-in-python-using-kivy-2.md
+28-28Lines changed: 28 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,29 +7,29 @@ author : Timothy
7
7
comments : ture
8
8
---
9
9
10
-
In the [first part]({% post_url 2015-01-16-making-an-app-in-python-using-kivy-1 %}) I talked about how to create an app.
10
+
In the [first part]({% post_url 2015-01-16-making-an-app-in-python-using-kivy-1 %}) I talked about how to create an app.
11
11
Now I'm going to talk about the some of different widgets that can be used in Kivy, that I found helpful.
12
12
13
13
## Widgets
14
14
15
-
In Kivy widgets are the building blocks of the GUI interface, which we created for our app.
16
-
The main app takes 1 widget, as the root widget, when built.
15
+
In Kivy widgets are the building blocks of the GUI interface, which we created for our app.
16
+
The main app takes 1 widget, as the root widget, when built.
17
17
18
-
Kivy includes examples of how to use each of the widgets.
19
-
I would recommend looking through these to identify the best widget to use for each element of the app.
18
+
Kivy includes examples of how to use each of the widgets.
19
+
I would recommend looking through these to identify the best widget to use for each element of the app.
20
20
21
-
In the [Hello World example](https://gist.github.com/timothyf1/75b20064a50e51651efa) from part 1 we see that on line 5 I imported the label widget, so that it can be used in line 11 to create an label.
21
+
In the [Hello World example](https://gist.github.com/timothyf1/75b20064a50e51651efa) from part 1 we see that on line 5 I imported the label widget, so that it can be used in line 11 to create an label.
22
22
For each widget you want to use it is needed to be imported.
23
23
24
-
### Screen Manager
24
+
### Screen Manager
25
25
26
-
In most apps you will require a different layout for each type of page.
27
-
For this I would recommend using the [screen manager](http://kivy.org/docs/api-kivy.uix.screenmanager.html),
26
+
In most apps you will require a different layout for each type of page.
27
+
For this I would recommend using the [screen manager](http://kivy.org/docs/api-kivy.uix.screenmanager.html),
28
28
although there are other options such as [carousel](http://kivy.org/docs/api-kivy.uix.carousel.html) depending on your needs.
29
29
30
-
Below is a sample of the different screens we used in our group last year.
30
+
Below is a sample of the different screens we used in our group last year.
Note that the screen manager doesn't need to be the root widget leading to the whole screen changing.
35
35
For example you can have a vertical boxlayout (layouts are explained next), with an header as the first widget and the screen manager as the second.
@@ -38,37 +38,37 @@ For example you can have a vertical boxlayout (layouts are explained next), with
38
38
39
39
The KV code can be found [here](https://gist.github.com/timothyf1/1f51fc7cdcf9b7a12694#file-screenmanager-kv)
40
40
41
-
Here we making the screen manager the root widget with there being 4 screens added to the manager.
42
-
Each of the screens are similar with a different background colour and number.
41
+
Here we making the screen manager the root widget with there being 4 screens added to the manager.
42
+
Each of the screens are similar with a different background colour and number.
43
43
44
44
If we take a look at the code for the next button in the KV we have
45
45
46
46
{% gist 72af082e37599e19887d NextButton %}
47
47
48
48
- Text is the text that is displayed on the button
49
49
- size_hint is used by default to decide on how big a widget will be, it defaults to (1, 1).
50
-
- pos_hint
50
+
- pos_hint
51
51
- size is how big the button is, note that if size_hint isn't set to (None, None) then this doesn't have an effect.
52
-
- on_release is the action that occurs once a user has click on and released the button.
52
+
- on_release is the action that occurs once a user has click on and released the button.
53
53
54
54
Lets take a closer look at what on_release is doing.
55
55
Firstly root refers to the custom screen as looking in the KV code it comes under _CustomScreen_.
56
-
Next we are referring to the [manager attribute](http://kivy.org/docs/api-kivy.uix.screenmanager.html#kivy.uix.screenmanager.Screen.manager) of the screen which gives us the screen manager it's attached to.
57
-
We are then setting the [current attribute](http://kivy.org/docs/api-kivy.uix.screenmanager.html#kivy.uix.screenmanager.ScreenManager.current) of the screen manager to change the screen.
56
+
Next we are referring to the [manager attribute](http://kivy.org/docs/api-kivy.uix.screenmanager.html#kivy.uix.screenmanager.Screen.manager) of the screen which gives us the screen manager it's attached to.
57
+
We are then setting the [current attribute](http://kivy.org/docs/api-kivy.uix.screenmanager.html#kivy.uix.screenmanager.ScreenManager.current) of the screen manager to change the screen.
58
58
59
-
Now to see what it's being set to we see that it follows the root.manager again.
59
+
Now to see what it's being set to we see that it follows the root.manager again.
60
60
But this time we are using the [next method](http://kivy.org/docs/api-kivy.uix.screenmanager.html#kivy.uix.screenmanager.ScreenManager.next) of the screen manager to get the name of next screen.
61
-
The next method looks at the [screen_names](http://kivy.org/docs/api-kivy.uix.screenmanager.html#kivy.uix.screenmanager.ScreenManager.screen_names), which is a list the screens added to the screen manager.
62
-
The order in which next() and similarly [previous()](http://kivy.org/docs/api-kivy.uix.screenmanager.html#kivy.uix.screenmanager.ScreenManager.previous) works is based upon the order that the screens were added to the screen manager.
61
+
The next method looks at the [screen_names](http://kivy.org/docs/api-kivy.uix.screenmanager.html#kivy.uix.screenmanager.ScreenManager.screen_names), which is a list the screens added to the screen manager.
62
+
The order in which next() and similarly [previous()](http://kivy.org/docs/api-kivy.uix.screenmanager.html#kivy.uix.screenmanager.ScreenManager.previous) works is based upon the order that the screens were added to the screen manager.
63
63
64
64
#### Transitions
65
65
66
-
We also see that in the above example there are multiple transitions.
67
-
The transitions are changed by changing the screen managers [transition attribute](http://kivy.org/docs/api-kivy.uix.screenmanager.html#kivy.uix.screenmanager.ScreenManager.transition).
66
+
We also see that in the above example there are multiple transitions.
67
+
The transitions are changed by changing the screen managers [transition attribute](http://kivy.org/docs/api-kivy.uix.screenmanager.html#kivy.uix.screenmanager.ScreenManager.transition).
68
68
69
-
### Layouts
69
+
### Layouts
70
70
71
-
In order to have multiple widgets there are layout out widgets that allow multiple widgets to be attached to it.
71
+
In order to have multiple widgets there are layout out widgets that allow multiple widgets to be attached to it.
72
72
73
73
There are 6 different [layout widgets](http://kivy.org/docs/guide/widgets.html#organize-with-layouts) in kivy.
74
74
@@ -79,20 +79,20 @@ There are 6 different [layout widgets](http://kivy.org/docs/guide/widgets.html#o
0 commit comments