Skip to content

Commit 998c8c1

Browse files
committed
Merge branch 'blah' into collapsoblestuff
Conflicts: README.md _data/past_sessions.yml css/sessions.css index.html sessions.html
2 parents 9f711d3 + 0cd9d32 commit 998c8c1

37 files changed

+330
-86
lines changed

README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@ Then open the url given in a web browser to view the site.
1919

2020
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.
2121

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+
2231
## Contributing
2332

2433
You are welcome to contribute to the code club website, we need as much
@@ -51,3 +60,52 @@ page
5160
```
5261
so for example if the URL for a particular gist was ```https://gist.github.com/johnsmith/57fd5d7s8fd6``` then
5362
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:
71+
72+
$ pip install selenium
73+
74+
To run the tests set the dev server running:
75+
76+
$ jekyll serve
77+
78+
then run the `functional_tests.py` file:
79+
80+
$ python functional_tests.py
81+
82+
The output should look something like this:
83+
84+
```
85+
.....
86+
----------------------------------------------------------------------
87+
Ran 5 tests in 13.083s
88+
89+
OK
90+
```
91+
92+
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
108+
109+
![](http://orm-chimera-prod.s3.amazonaws.com/1234000000754/images/twdp_0101.png)
110+
111+
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).

_data/contributors.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
title: gramma correction for the real coder
1919
emoji:
2020

21+
- name : Geraint Palmer
22+
title: The Traitor
23+
2124
- name : Jason Young
2225
title: If there is a problem then it's his fault
2326
emoji:

_data/past_sessions.yml

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
- year: "2015-2016"
2-
term1: "Autumn"
3-
sessions1:
4-
- week : 1
5-
name : Test
6-
quote : I hope this works.
7-
author : Adam 2<sup>nd</sup> Year
8-
91
- year: "2014-2015"
102
term1: "Autumn"
113
sessions1:
@@ -17,17 +9,17 @@
179
- week : 2
1810
name : On the Fly
1911
quote : Love the fact that I'm learning Vim on the fly!
20-
author : Adam 2nd Year
12+
author : Adam 2<sup>nd</sup> Year
2113

2214
- week : 3
2315
name : The one where Vince ran away
2416
quote : It's amazing how quiet it is without Jason
25-
author : Tim 2nd Year
17+
author : Tim 2<sup>nd</sup> Year
2618

2719
- week : 4
2820
name : What Django is for
2921
quote : I know that Pinterest uses it but I can't see the connection
30-
author : Alex 2nd Year
22+
author : Alex 2<sup>nd</sup> Year
3123

3224
- week : 5
3325
name : Oh MongoDB
@@ -42,7 +34,7 @@
4234
- week : 7
4335
name : Jekyll and Hyde
4436
quote : What if we use Jekyll for the base view and Hyde for the dynamic stuff
45-
author : Alex 2nd Year
37+
author : Alex 2<sup>nd</sup> Year
4638

4739
- week : 8
4840
name : Atom
@@ -63,7 +55,7 @@
6355
name : Risk
6456
quote : 6! You die.
6557
author : Ellie 1st Year (Master dice roller)
66-
58+
6759
term2: "Spring"
6860
sessions2:
6961
- week : 1

_data/projects.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,12 @@
44
- name: 'A module planner'
55
github: https://github.com/alcarney/Module-Planner
66
description: 'A web based tool to graphically display course choice options.'
7+
link: http://module-planner.readthedocs.org/en/latest/
8+
- name: 'Axelrod'
9+
github: https://github.com/drvinceknight/Axelrod
10+
description: 'A repository used to reproduce Axelrods tournament.'
11+
link: http://axelrod.readthedocs.org/
12+
- name: 'The game has changed'
13+
github: https://github.com/CardiffMathematicsCodeClub/unknown-horizons
14+
description: 'A game challenge run by github (progress... ongoing...)'
15+
link: https://github.com/blog/1972-the-game-has-changed

_posts/2014-12-14-A-first-blog-post.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ I look forward to seeing this continue and am very grateful to the students who
1818

1919
Here's a picture of the last Code club of term during which we tested out Ambrose's work analysing Monopoly:
2020

21-
![]({{site.baseurl}}/blog/static/images/monopoly.jpg)
21+
![]({{site.baseurl}}/res/blog_pics/monopoly.jpg)
2222

2323
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:
2424

25-
![]({{site.baseurl}}/blog/static/images/mongodb.jpg)
25+
![]({{site.baseurl}}/res/blog_pics/mongodb.jpg)
2626

2727
## Thanks
2828

_posts/2015-01-15-New-computers-for-code-club.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,18 @@
22
layout : post
33
title : "New Computers for Code Club"
44
categories : website
5-
tags : blog
5+
tags : blog
66
author : Jason
77
comments : true
88
---
99

1010
An exciting new addition for the code club is two new computers!
1111

12-
![]({{site.baseurl}}/blog/static/images/newcomp.jpg)
12+
![]({{site.baseurl}}/res/blog_pics/newcomp.jpg)
1313

1414
The machines were kindly provided by the School of Mathematics.
1515
Both will have Ubuntu installed on them which will give students access to a Linux machine.
1616

17-
![]({{site.baseurl}}/blog/static/images/installubuntu.jpg)
17+
![]({{site.baseurl}}/res/blog_pics/installubuntu.jpg)
1818

1919
If a task needed a Linux machine previously, students were using the very awesome [cloud.SageMath](https://cloud.sagemath.com/).
20-
21-
22-

_posts/2015-01-16-making-an-app-in-python-using-kivy-1.md

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,61 +7,59 @@ author : Timothy
77
comments : true
88
---
99

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.
1313

1414
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.
1616

1717
## Creating a basic Kivy app
1818

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'.
2020

2121
{% gist timothyf1/75b20064a50e51651efa %}
2222

2323
The output is rather simple
2424

25-
![Hello World]({{site.baseurl}}/blog/static/images/kivy-hello-world.png)
25+
![Hello World]({{site.baseurl}}/res/blog_pics/kivy-hello-world.png)
2626

27-
On line 11 where we create a label, for kivy an label is consider an widget and we are giving it the property of 'Hello World' for text.
27+
On line 11 where we create a label, for kivy an label is consider an widget and we are giving it the property of 'Hello World' for text.
2828
We are also doing returning this in the build method of an app class.
29-
This is important as when the app is built an widget is required to be returned in order to be the root widget.
29+
This is important as when the app is built an widget is required to be returned in order to be the root widget.
3030

3131
## Kv Language
3232

33-
Kivy uses it's own [Kv Language](http://kivy.org/docs/guide/lang.html) in order to create widget trees.
34-
When testing out different layouts using the Kv language makes it easier for you to experiment with different widgets.
33+
Kivy uses it's own [Kv Language](http://kivy.org/docs/guide/lang.html) in order to create widget trees.
34+
When testing out different layouts using the Kv language makes it easier for you to experiment with different widgets.
3535

3636
For example here I have included an example of using Kv language to create an layout.
3737

3838
{% gist adeb2eaa141ac4314981 %}
3939

40-
This produces a windows with buttons in several places.
40+
This produces a windows with buttons in several places.
4141

42-
![]({{site.baseurl}}/blog/static/images/kivy-boxlayout-example.png)
42+
![]({{site.baseurl}}/res/blog_pics/kivy-boxlayout-example.png)
4343

4444
Firstly we see that the root widget is call Demo which is a grid layout with 1 column.
4545

46-
Next looking at the .kv file we can see that the widget Demo has 2 children. Both of which are boxlayouts.
46+
Next looking at the .kv file we can see that the widget Demo has 2 children. Both of which are boxlayouts.
4747

48-
The first boxlayout has been set to vertical, the default is horizontal.
48+
The first boxlayout has been set to vertical, the default is horizontal.
4949
Then 3 buttons have been added. As shown below.
5050

51-
![]({{site.baseurl}}/blog/static/images/kivy-boxlayout-example-1.png)
51+
![]({{site.baseurl}}/res/blog_pics/kivy-boxlayout-example-1.png)
5252

5353
The second boxlayout is left to it's default settings and have 3 buttons as it's children. As shown below.
5454

55-
![]({{site.baseurl}}/blog/static/images/kivy-boxlayout-example-2.png)
55+
![]({{site.baseurl}}/res/blog_pics/kivy-boxlayout-example-2.png)
5656

57-
More about the different widgets will be explained in a later part.
57+
More about the different widgets will be explained in a later part.
5858

5959
Depending on your needs you can do either of the following:
6060

61-
- Just use python code and ignore the KV Lang.
62-
- Mix python code and KV Lang for layouts.
63-
- Use KV Lang for all layouts.
61+
- Just use python code and ignore the KV Lang.
62+
- Mix python code and KV Lang for layouts.
63+
- Use KV Lang for all layouts.
6464

6565
I found this useful to only use the python code as I was building the layout depended on how many items there were in a database.
66-
67-

_posts/2015-01-28-making-an-app-in-python-using-kivy-2.md

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,29 @@ author : Timothy
77
comments : ture
88
---
99

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.
1111
Now I'm going to talk about the some of different widgets that can be used in Kivy, that I found helpful.
1212

1313
## Widgets
1414

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.
1717

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.
2020

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.
2222
For each widget you want to use it is needed to be imported.
2323

24-
### Screen Manager
24+
### Screen Manager
2525

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),
2828
although there are other options such as [carousel](http://kivy.org/docs/api-kivy.uix.carousel.html) depending on your needs.
2929

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.
3131

32-
![Screen Manager]({{site.baseurl}}/blog/static/images/kivy-screen-manager.png)
32+
![Screen Manager]({{site.baseurl}}/res/blog_pics/kivy-screen-manager.png)
3333

3434
Note that the screen manager doesn't need to be the root widget leading to the whole screen changing.
3535
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
3838

3939
The KV code can be found [here](https://gist.github.com/timothyf1/1f51fc7cdcf9b7a12694#file-screenmanager-kv)
4040

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.
4343

4444
If we take a look at the code for the next button in the KV we have
4545

4646
{% gist 72af082e37599e19887d NextButton %}
4747

4848
- Text is the text that is displayed on the button
4949
- 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
5151
- 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.
5353

5454
Lets take a closer look at what on_release is doing.
5555
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.
5858

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.
6060
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.
6363

6464
#### Transitions
6565

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).
6868

69-
### Layouts
69+
### Layouts
7070

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.
7272

7373
There are 6 different [layout widgets](http://kivy.org/docs/guide/widgets.html#organize-with-layouts) in kivy.
7474

@@ -79,20 +79,20 @@ There are 6 different [layout widgets](http://kivy.org/docs/guide/widgets.html#o
7979
- [FloatLayout](http://kivy.org/docs/api-kivy.uix.floatlayout.html)
8080
- [RelativeLayout](http://kivy.org/docs/api-kivy.uix.relativelayout.html)
8181

82-
Of the different layouts in our we used boxlayout the most and grid for tables.
82+
Of the different layouts in our we used boxlayout the most and grid for tables.
8383

8484
In the boxlayout example from part 1, [code can be found here](https://gist.github.com/timothyf1/adeb2eaa141ac4314981).
8585
We note that size hinting was used here but what does it do?
8686

87-
In the screen manager example we see that just size_hint was used.
87+
In the screen manager example we see that just size_hint was used.
8888
This took 2 values the first for the x direction and then for the y direction.
8989
But in the Boxlayout example they are changed separately.
9090

9191
So for the first block pictured below, it is a vertical boxlayout.
9292

93-
![]({{site.baseurl}}/blog/static/images/kivy-boxlayout-example-1.png)
93+
![]({{site.baseurl}}/res/blog_pics/kivy-boxlayout-example-1.png)
9494

9595
We see that the size_hint_y hasn't been changed so virtually each button is taking up a third of the available space.
9696
What has been changed is the size_hint_x, so the first and the last buttons are only 40% of the available width that they were given.
97-
The second button is given 20% of the width.
97+
The second button is given 20% of the width.
9898
Due to the positioning of each button means that they don't overlap.

0 commit comments

Comments
 (0)