Commit 8f3ca735 authored by Sanyam Khurana's avatar Sanyam Khurana

Merge branch 'adding-dashboard' into 'master'

Adds Dashboard feature

See merge request new-contributor-wizard-team/new-contributor-wizard!6
parents 26413bd3 9f575257
v0.0.1
## June 11 2018
- Adding Dashboard feature
- Adding blog, cli, communication, encryption, how_to_use, vcs and way_ahead modules for courseware
- Adding application, profile and theme modules for settings
## June 3 2018
- Reporting coverage while running Gitlab CI.
......
......@@ -87,3 +87,36 @@ There are two type of testing being done for this application.
- `tests` - This directory should and only contain the Test written for the application, both for application logic and GUI.
- `ui` - This directory should and only contain the `.kv` files which uses Kivy Language in order to create the widget tree. Hence, making the UI designing easier.
### The Dashboard
- `modules/dashboard/` contains modules for Dashboard features. They can be described as below.
- `dashboard.py` contains Dashboard class for integration with courseware modules (blog, cli, communication, encryption, how_to_use, vcs and way_ahead), settings (application, profile and theme), and the UI
- `ui/dashboard.py` contains KIVY widget tree which in turn renders the UI for the Dashboard module.
### The Courseware
- How To Use - This module helps user getting started with New Contributor Wizard application and is placed in `how_to_use/`
- Communication - This module helps user understand importance of communication and the tools involved like IRC and mailing lists and is places in `communication/`
- CLI - This module helps user learn about Command Line Interface and is places in `cli/`
- Blog - This module helps user create and deploy blogs and is placed in `blog/`
- Version Control - This module helps user get started with managing projects using Version Control System like git and is places in `vcs/`
- Encryption - This module helps user understand the importance of encryption with the help of tools used for the same and is places in `encryption/`
- Way Ahead - This module helps user reach out to differnt communities and explore open source projects and events like Google Summer of Code and is placed in `way_ahead`
### The Settings
- The settings for the entire New Contributor Wizard in places in `settings/`. They can be described as below.
- `application.py` module contains application specific settings like language
- `profile.py` module contains user related settings like name, email etc
- `theme.py` module contains application theme related settings like color
......@@ -4,7 +4,7 @@ Root Kivy Application
from kivy.app import App
from kivy.config import Config
from modules.welcome import WelcomeScreen
from modules.dashboard.dashboard import Dashboard
class NewContributorWizard(App):
......@@ -13,7 +13,7 @@ class NewContributorWizard(App):
'''
def build(self):
return WelcomeScreen()
return Dashboard()
if __name__ == '__main__':
......
'''
Modules containing Blog classes
'''
from kivy.uix.boxlayout import BoxLayout
from kivy.lang import Builder
Builder.load_file('./ui/blog.kv')
class Blog(BoxLayout):
'''
Blog class for tutorials and tools
'''
pass
'''
Modules containing CLI classes
'''
from kivy.uix.boxlayout import BoxLayout
from kivy.lang import Builder
Builder.load_file('./ui/cli.kv')
class CLI(BoxLayout):
'''
Command Line Interface class for tutorials and tools
'''
pass
'''
Modules containing Communication classes
'''
from kivy.uix.boxlayout import BoxLayout
from kivy.lang import Builder
Builder.load_file('./ui/communication.kv')
class Communication(BoxLayout):
'''
Communication class for tutorials and tools
'''
pass
'''
Sample module just to showcase how pytest should be used
'''
from datetime import datetime as dt
import calendar
class SampleCommunicationModule():
'''
Sample class to showcase testing
'''
@staticmethod
def return_datetime_object(date_time, given_format):
'''
Sample method to change given date time to unix timestamp
'''
given_datetime_object = dt.strptime(date_time, given_format)
return given_datetime_object
@staticmethod
def unix_time_of_communication(date_time, given_format):
'''
Sample method to change given date time to unix timestamp
'''
given_date_time = dt.strptime(date_time, given_format)
unix_time = calendar.timegm(given_date_time.utctimetuple())
return unix_time
'''
Dashboard module includes classes to showcase Dashboard with different courseware and settings
'''
from copy import copy as cp
from kivy.uix.boxlayout import BoxLayout
from kivy.lang import Builder
from modules.blog.blog import Blog
from modules.cli.cli import CLI
from modules.communication.communication import Communication
from modules.encryption.encryption import Encryption
from modules.how_to_use.how_to_use import HowToUse
from modules.vcs.vcs import VCS
from modules.way_ahead.way_ahead import WayAhead
from modules.settings.application import ApplicationSettings
from modules.settings.profile import ProfileSettings
from modules.settings.theme import ThemeSettings
Builder.load_file('./ui/dashboard.kv')
class Dashboard(BoxLayout):
'''
Dashboard class to integrate courseware and settings
'''
def __init__(self, **kwargs):
super(Dashboard, self).__init__(**kwargs)
self.all_menu_screens = {
'application_settings': ApplicationSettings(),
'blog': Blog(),
'cli': CLI(),
'communication': Communication(),
'encryption': Encryption(),
'how_to_use': HowToUse(),
'profile_settings': ProfileSettings(),
'theme_settings': ThemeSettings(),
'vcs': VCS(),
'way_ahead': WayAhead(),
}
self.all_menu_items = list(self.all_menu_screens.keys())
self.enable_menu('how_to_use')
def on_touch_down(self, touch):
'''
on_touch_down is triggered when user clicks the application anywhere
overiding this function here to perform actions on selection of menu items
'''
for menu_item in self.all_menu_items:
if self.ids[menu_item+'_box'].collide_point(*touch.pos):
self.enable_menu(menu_item)
def enable_menu(self, menu_item_to_enable):
'''
enable_menu function focuses on concerned menu items or settings which is clicked and
removes focus from all other menu items and settings
'''
menu_item_to_enable_widget = self.ids[menu_item_to_enable+'_box']
menu_item_to_enable_color = menu_item_to_enable_widget.canvas.before.children[0].rgba
if menu_item_to_enable_color != [1, 1, 1, 1] or 'settings' in menu_item_to_enable:
self.ids['module_screen'].add_widget(self.all_menu_screens[menu_item_to_enable])
if 'settings' not in menu_item_to_enable:
self.ids[menu_item_to_enable+'_box'].canvas.before.children[0].rgba = [1, 1, 1, 1]
self.ids[menu_item_to_enable+'_label'].color = (0, 0, 0, 1)
all_menu_items_copy = cp(self.all_menu_items)
all_menu_items_copy.remove(menu_item_to_enable)
for menu_item in all_menu_items_copy:
if 'settings' not in menu_item:
self.ids[menu_item+'_box'].canvas.before.children[0].rgba = [0, 0, 0, 1]
self.ids[menu_item+'_label'].color = (1, 1, 1, 1)
self.ids['module_screen'].remove_widget(self.all_menu_screens[menu_item])
'''
Modules containing Encryption classes
'''
from kivy.uix.boxlayout import BoxLayout
from kivy.lang import Builder
Builder.load_file('./ui/encryption.kv')
class Encryption(BoxLayout):
'''
Encryption class for tutorials and tools
'''
pass
'''
Modules containing How To Use classes
'''
from kivy.uix.boxlayout import BoxLayout
from kivy.lang import Builder
Builder.load_file('./ui/how_to_use.kv')
class HowToUse(BoxLayout):
'''
HowToUser class for introduction on how to user New
Contributor Wizard
'''
pass
'''
Modules containing Application Settings classes
'''
from kivy.uix.boxlayout import BoxLayout
from kivy.lang import Builder
Builder.load_file('./ui/application_settings.kv')
class ApplicationSettings(BoxLayout):
'''
ApplicationSettings class for settings related to New
Contributor Wizard application
'''
pass
'''
Modules containing Profile Settings classes
'''
from kivy.uix.boxlayout import BoxLayout
from kivy.lang import Builder
Builder.load_file('./ui/profile_settings.kv')
class ProfileSettings(BoxLayout):
'''
ProfileSettings class for settings related to signed in user
'''
pass
'''
Modules containing Theme Settings classes
'''
from kivy.uix.boxlayout import BoxLayout
from kivy.lang import Builder
Builder.load_file('./ui/theme_settings.kv')
class ThemeSettings(BoxLayout):
'''
ThemeSettings class for settings related to Theme of application
'''
pass
'''
Modules containing Version Control System classes
'''
from kivy.uix.boxlayout import BoxLayout
from kivy.lang import Builder
Builder.load_file('./ui/vcs.kv')
class VCS(BoxLayout):
'''
VCS class for tutorials and tools
'''
pass
'''
Modules containing Way Ahead classes
'''
from kivy.uix.boxlayout import BoxLayout
from kivy.lang import Builder
Builder.load_file('./ui/way_ahead.kv')
class WayAhead(BoxLayout):
'''
WayAhead class for tutorials and tools
'''
pass
\ No newline at end of file
'''
Class for Welcome Screen
'''
from kivy.uix.gridlayout import GridLayout
from kivy.lang import Builder
Builder.load_file('./ui/welcome.kv')
class WelcomeScreen(GridLayout):
'''
Declaration of Welcome Screen which is the first screen to show
after Kivy application is running
'''
def __init__(self, **kwargs):
super(WelcomeScreen, self).__init__(**kwargs)
import pytest
from datetime import datetime as dt
from modules.communication.sample_module import SampleCommunicationModule
@pytest.mark.incremental
class Testsample:
def test_return_datetime_object(self):
resultant_datetime_object = SampleCommunicationModule.return_datetime_object("3/3/2018 12:02", "%m/%d/%Y %H:%M")
assert type(dt.now()) == type(resultant_datetime_object)
class TestSample:
def test_unix_time_of_communication(self):
resultant_unix_timestamp = SampleCommunicationModule.unix_time_of_communication("3/3/2018 12:02", "%m/%d/%Y %H:%M")
assert 1520078520 == resultant_unix_timestamp
def test_sample(self):
assert type(True) != type('This is a sample test!')
<ApplicationSettings>:
orientation: 'vertical'
canvas.before:
Color:
rgba: 1, 1, 1, 1
Rectangle:
pos: self.pos
size: self.size
Label:
text: 'Application'
font_name: 'ui/assets/fonts/VarelaRound-Regular.ttf'
font_size: 50
color: 0, 0, 0, 1
Label:
text: 'Settings'
font_name: 'ui/assets/fonts/VarelaRound-Regular.ttf'
font_size: 50
color: 0, 0, 0, 1
<Blog>:
Label:
text: 'Blog'
font_name: 'ui/assets/fonts/VarelaRound-Regular.ttf'
font_size: 50
\ No newline at end of file
<CLI>:
orientation: 'vertical'
Label:
text: 'Command'
font_name: 'ui/assets/fonts/VarelaRound-Regular.ttf'
font_size: 50
Label:
text: 'Line'
font_name: 'ui/assets/fonts/VarelaRound-Regular.ttf'
font_size: 50
Label:
text: 'Inteface'
font_name: 'ui/assets/fonts/VarelaRound-Regular.ttf'
font_size: 50
\ No newline at end of file
<Communication>:
Label:
text: 'Communication'
font_name: 'ui/assets/fonts/VarelaRound-Regular.ttf'
font_size: 50
\ No newline at end of file
<Dashboard>:
BoxLayout:
size_hint: 0.3, 1
orientation: 'vertical'
BoxLayout:
size_hint: 1, 0.1
BoxLayout:
size_hint: 1, 0.8
orientation: 'vertical'
id: dashboard_menu
BoxLayout:
size_hint: 1, 0.142
padding: 0, 0, 10, 0
id: how_to_use_box
canvas.before:
Color:
rgba: 0, 0, 0, 1
Rectangle:
pos: self.pos
size: self.size
Label:
text_size: self.size
size: self.texture_size
valign: 'middle'
halign: 'right'
font_name: 'ui/assets/fonts/VarelaRound-Regular.ttf'
font_size: 20
text: 'How To Use'
id: how_to_use_label
BoxLayout:
size_hint: 1, 0.142
padding: 0, 0, 10, 0
id: communication_box
canvas.before:
Color:
rgba: 0, 0, 0, 1
Rectangle:
pos: self.pos
size: self.size
Label:
text: 'Communication'
text_size: self.size
size: self.texture_size
valign: 'middle'
halign: 'right'
font_name: 'ui/assets/fonts/VarelaRound-Regular.ttf'
font_size: 20
id: communication_label
BoxLayout:
size_hint: 1, 0.142
padding: 0, 0, 10, 0
id: cli_box
canvas.before:
Color:
rgba: 0, 0, 0, 1
Rectangle:
pos: self.pos
size: self.size
Label:
text: 'CLI'
text_size: self.size
size: self.texture_size
valign: 'middle'
halign: 'right'
font_name: 'ui/assets/fonts/VarelaRound-Regular.ttf'
font_size: 20
id: cli_label
BoxLayout:
size_hint: 1, 0.142
padding: 0, 0, 10, 0
id: blog_box
canvas.before:
Color:
rgba: 0, 0, 0, 1
Rectangle:
pos: self.pos
size: self.size
Label:
text: 'Blog'
text_size: self.size
size: self.texture_size
valign: 'middle'
halign: 'right'
font_name: 'ui/assets/fonts/VarelaRound-Regular.ttf'
font_size: 20
id: blog_label
BoxLayout:
size_hint: 1, 0.142
padding: 0, 0, 10, 0
id: vcs_box
canvas.before:
Color:
rgba: 0, 0, 0, 1
Rectangle:
pos: self.pos
size: self.size
Label:
text: 'Version Control'
text_size: self.size
size: self.texture_size
valign: 'middle'
halign: 'right'
font_name: 'ui/assets/fonts/VarelaRound-Regular.ttf'
font_size: 20
id: vcs_label
BoxLayout:
size_hint: 1, 0.142
padding: 0, 0, 10, 0
id: encryption_box
canvas.before:
Color:
rgba: 0, 0, 0, 1
Rectangle:
pos: self.pos
size: self.size
Label:
text: 'Encryption'
text_size: self.size
size: self.texture_size
valign: 'middle'
halign: 'right'
font_name: 'ui/assets/fonts/VarelaRound-Regular.ttf'
font_size: 20
id: encryption_label
BoxLayout:
size_hint: 1, 0.142
padding: 0, 0, 10, 0
id: way_ahead_box
canvas.before:
Color:
rgba: 0, 0, 0, 1
Rectangle:
pos: self.pos
size: self.size
Label:
text: 'Way Ahead'
text_size: self.size
size: self.texture_size
valign: 'middle'
halign: 'right'
font_name: 'ui/assets/fonts/VarelaRound-Regular.ttf'
font_size: 20
id: way_ahead_label
BoxLayout
size_hint: 1, 0.05
padding: 0, 0, 10, 0
BoxLayout:
size_hint: 1, 0.15
BoxLayout:
size_hint: 0.33, 0.8
id: profile_settings_box
canvas.before:
Color:
rgba: 1, 1, 1, 1
Rectangle:
pos: self.pos
size: self.size
Image:
source: 'ui/assets/images/avatar.png'
BoxLayout:
size_hint: 0.33, 0.8
id: theme_settings_box
canvas.before:
Color:
rgba: 1, 1, 1, 1
Rectangle:
pos: self.pos
size: self.size
Image:
source: 'ui/assets/images/paint.png'
BoxLayout:
size_hint: 0.33, 0.8
id: application_settings_box
canvas.before:
Color:
rgba: 1, 1, 1, 1
Rectangle:
pos: self.pos
size: self.size
Image:
source: 'ui/assets/images/settings.png'
BoxLayout:
size_hint: 0.7, 1
canvas.before:
Color:
rgba: 0.114, 0.306, 0.537, 1
Rectangle:
pos: self.pos
size: self.size
BoxLayout:
id: module_screen
<Encryption>:
Label:
text: 'Encryption'
font_name: 'ui/assets/fonts/VarelaRound-Regular.ttf'
font_size: 50
\ No newline at end of file
<HowToUse>:
Label:
text: 'How To Use'
font_name: 'ui/assets/fonts/VarelaRound-Regular.ttf'
font_size: 50
\ No newline at end of file
<ProfileSettings>:
orientation: 'vertical'
canvas.before:
Color:
rgba: 1, 1, 1, 1
Rectangle:
pos: self.pos
size: self.size
Label:
text: 'Profile'
font_name: 'ui/assets/fonts/VarelaRound-Regular.ttf'
font_size: 50
color: 0, 0, 0, 1
Label:
text: 'Settings'
font_name: 'ui/assets/fonts/VarelaRound-Regular.ttf'
font_size: 50
color: 0, 0, 0, 1
\ No newline at end of file
<ThemeSettings>:
orientation: 'vertical'
canvas.before:
Color:
rgba: 1, 1, 1, 1
Rectangle:
pos: self.pos
size: self.size
Label:
text: 'Theme'
font_name: 'ui/assets/fonts/VarelaRound-Regular.ttf'
font_size: 50
color: 0, 0, 0, 1
Label:
text: 'Settings'
font_name: 'ui/assets/fonts/VarelaRound-Regular.ttf'
font_size: 50
color: 0, 0, 0, 1
<VCS>:
orientation: 'vertical'
Label:
text: 'Version'
font_name: 'ui/assets/fonts/VarelaRound-Regular.ttf'
font_size: 50
Label:
text: 'Control'
font_name: 'ui/assets/fonts/VarelaRound-Regular.ttf'
font_size: 50
Label:
text: 'System'
font_name: 'ui/assets/fonts/VarelaRound-Regular.ttf'
font_size: 50
<WayAhead>:
Label:
text: 'Way Ahead'
font_name: 'ui/assets/fonts/VarelaRound-Regular.ttf'
font_size: 50
\ No newline at end of file
<WelcomeScreen>:
cols: 2
Label:
text: "Hello"
Label:
text: "World"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment