Wednesday, September 21, 2016

Variable Pickers

Today I created functions to allow the user to select a font or colour from a list (based of the HTML/ CSS variables) which python will late insert into the html / css file. There was a small hiccup around getting the function to return the altered variable which I documented as the following:
#21-09-2016 #Error Log The font selection function should list of a number of fonts for the user to choose from, then return the choosen font as a variable set when calling the function. However when the function returns the variable it is not changed from what was originially choosen. This was solved by explicitly re-assigning the variable. So rather than creating the variable 'afont' and then using it to call the function I set it to now equal the changed variable in the function so from: afont = "blank" font_picker(afont) to: afont = "blank" afont = font_picker(afont) which reassigned the variable as initially desired.


They both also have to convert variables from a string to an integer (the answer variable after listing).

Monday, July 25, 2016

Shifting to SQlite

So today I have worked on the database creation for the 'Admin' and 'Users' tables - both within the database. It is a simple program only designed for creating the database in the first place, later-on I will be working on the adding and removal of users.

This first image shows the program accessing the database and creating the new table within the database as the program calls it. (shown below)

The second image calls the create_table function , adding a new table to the database and then proceeding to add all the relevant data columns, such as email address, username and user ID.

The user ID is a new addition from the previous excel method - which may be useful in streamlining search methods for calling data from the db later in the program.

*Edit*
This is what the table structure looks like in the database itself. (viewed using the SQlite Inspector program, as recommended by Python Schools)

Thursday, July 14, 2016

Another Update

I forgot to mention this in the last post, but I've decided to make a change to my "database" system. It has up to been now done in MS Excel, which is a spreadsheet. While it is allowed within the marking bounds of my project, I have been advised to change it in for a proper database software/ system such as SQL or Access.

Once I have a SQL viewer/ reader installed I will be re-working parts of my program to use a SQlite database rather than a spreadsheet.

CSS Colour Picker - in Tkinter

So today I started working on the 'drop-down' menu system which will allow users to choose a 'primary' and 'secondary' colour for their websites colour scheme which the program will export into a CSS file.

I wanted to try and work in a little bit of the Tkinter module on this one so I don't have to re-work the entire program at a later date once it's complete and I want to add a neat U.I

 This last image shows me testing to see if Tkinter is compatible with all the HTML Hex Colour codes I saved (shown in the last post) and it is, which is good news. :D

Monday, July 11, 2016

Working on Stylesheet Creation

So after coming back from a week's residential I can now get back to work on the project. This week I am hoping to complete the CSS file creation part of the software.

As part of this I am creating txt files which contain a html compatible colour, the hex value for that colour (which will be used to display the colour in the option menu) as well as a list of alternatives in the case that a browser doesn't support the colour.

E.g.
navy, darkblue, blue

I have currently written up files for Reds, Blues and am currently working on a grey-scale list (I have to constantly remind myself to use the American-English spellings of everything :^ )

I am using this w3schools page to get all the correct names and hex values:
http://www.w3schools.com/colors/colors_names.asp

Once I have completed all of the files I will upload them to either my Onedrive or Google Drive and link them.

Monday, June 27, 2016

Finished: User Creation

I have now completed the 'crUser' subroutine for my program, this creates a User by adding their details to an Excel Database as well as adding their own folder under the 'users' folder in the programs directory.

The first thing the program does is to check whether or not the file exists, printing an error message to the screen if the file cannot be found.

After this it creates a file directory under the 'Users' folder, using the OS module (os.mkdirs)


The next step finds the last empty row in the spreadsheet then uses a while loop to add all the details into cells in that row until all necessary details have been added.
This then ends by saving the worksheet, ending the while loop and returning a message to confirm that the user's details have been added to the database.
In addition to this, I have also created a very similar program for adding admin users - which adds different details and can only be accessed by existing program admins.

Saturday, June 18, 2016

User Database

As I have not yet finished a significant enough part of the programming in python for the main program I will (for now) explain a little about the Users database, run using an ms. excel spreadsheet.

Python is able to manipulate cells in the spreadsheet file by using an external module called 'openpyxl'.  Python Library Page

As I am having users and admins, I am using two different sheets in the same file. Both record a name, surname, username, last login and email. The main difference between the two is that the Users sheet also contains a file directory detailing where their files are stored. As the program progresses, they will be given different permissions.



Here are a few images to illustrate the structure.
The subroutine I have created to add a regular user (so-far) looks like this:
 ---
 ---
---

I will make downloads of all the files available once I have completed the project.