Skip to content

Commit

Permalink
nxt lvl
Browse files Browse the repository at this point in the history
  • Loading branch information
rikoz committed Jul 2, 2017
1 parent a3c68fc commit 232c631
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 29 deletions.
Binary file added misc/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 26 additions & 6 deletions sik-htmlpy/back_end.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import htmlPy
import json
#from sample_app import app as htmlPy_app
#from main import app as htmlPy_app


#htmlPy_app = htmlPy.AppGUI()
Expand All @@ -10,10 +10,9 @@ class sikTest(htmlPy.Object):
# GUI callable functions have to be inside a class.
# The class should be inherited from htmlPy.Object.

def __init__(self, nam):
#super(sikTest.self).__init__()
def __init__(self):
super(sikTest, self).__init__()
# Initialize the class here, if required.
self.name = nam
return

def showName(self):
Expand All @@ -29,21 +28,42 @@ def function_name(self):
# Refer to API documentation.
return

@htmlPy.Slot()
def get_started(self):
## Change HTML of the app using Jinja2 templates
htmlPy_app.template = ("./login.html", {})
return

#############################################################################################

@htmlPy.Slot(str, result=str)
def form_function_name(self, json_data):
def sikLoginForm(self, json_data):
# @htmlPy.Slot(arg1_type, arg2_type, ..., result=return_type)
# This function can be used for GUI forms.
#
form_data = json.loads(json_data)
return json.dumps(form_data)

@htmlPy.Slot(str, result=str)
def sikTestform(self, json_data):
# @htmlPy.Slot(arg1_type, arg2_type, ..., result=return_type)
# This function can be used for GUI forms.
#
form_data = json.loads(json_data)
return json.dumps(form_data)

#############################################################################################

@htmlPy.Slot()
def javascript_function(self):
# Any function decorated with @htmlPy.Slot decorater can be called
# using javascript in GUI

## Execute javascript on currently displayed HTML in the app
htmlPy_app.evaluate_javascript("alert('Hello from back-end')")
return


## You have to bind the class instance to the AppGUI instance to be
## callable from GUI
#htmlPy_app.bind(sikTest())
#htmlPy.AppGUI.bind(sikTest())
Binary file modified sik-htmlpy/back_end.pyc
Binary file not shown.
15 changes: 5 additions & 10 deletions sik-htmlpy/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,22 @@


# GUI initializations
app = htmlPy.AppGUI(title=u"SIK Test Center", maximized=True, plugins=True)
app = htmlPy.AppGUI(title=u"SIK Test Center", maximized=True, plugins=True, allow_overwrite=True)


# GUI configurations
app.static_path = os.path.join(BASE_DIR, "static/")
app.template_path = os.path.join(BASE_DIR, "templates/")

app.window.setWindowIcon(QtGui.QIcon(BASE_DIR + "/static/img/icon.png"))

#GUI Templates
#app.template = ("index.html", {})
app.template = ("login.html", {})
#app.template = ("profile.html", {})
#app.template = ("test.html", {})
#app.template = ("submission.html", {})

#app.template = ("submission.html", {"username": "htmlPy_user"})

#GUI Geometry
app.web_app.setMinimumWidth(1366)
app.web_app.setMinimumHeight(768)

Expand All @@ -49,16 +49,11 @@
from back_end import sikTest

# Register back-end functionalities
#app.bind(sikTest())
app.bind(sikTest())

"""
pers1 = sikTest("rikome")
print(pers1.showName())
"""

# Instructions for running application
if __name__ == "__main__":
# The driver file will have to be imported everywhere in back-end.
# So, always keep app.start() in if __name__ == "__main__" conditional

app.start()
Binary file modified sik-htmlpy/main.pyc
Binary file not shown.
16 changes: 8 additions & 8 deletions sik-htmlpy/static/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ body{
border-radius: 4px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
background: url(../images/user.png) no-repeat 347px 13px #eee;
background: url(../img/user.png) no-repeat 347px 13px #eee;
font-family: 'Raleway', sans-serif;
}
.mail-form input[type="password"] {
Expand All @@ -134,7 +134,7 @@ body{
border-radius: 4px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
background: url(../images/lock.png) no-repeat 347px 13px #eee;
background: url(../img/lock.png) no-repeat 347px 13px #eee;
font-family: 'Raleway', sans-serif;
}
.mail-form input[type="submit"] {
Expand Down Expand Up @@ -254,10 +254,10 @@ body{
width: 50%;
}
.mail-form input[type="text"] {
background: url(../images/user.png) no-repeat 344px 13px #eee;
background: url(../img/user.png) no-repeat 344px 13px #eee;
}
.mail-form input[type="password"] {
background: url(../images/lock.png) no-repeat 344px 13px #eee;
background: url(../img/lock.png) no-repeat 344px 13px #eee;
}
}
@media (max-width: 1080px){
Expand Down Expand Up @@ -299,10 +299,10 @@ body{
margin-top:1em;
}
.mail-form input[type="text"] {
background: url(../images/user.png) no-repeat 455px 13px #eee;
background: url(../img/user.png) no-repeat 455px 13px #eee;
}
.mail-form input[type="password"] {
background: url(../images/lock.png) no-repeat 455px 13px #eee;
background: url(../img/lock.png) no-repeat 455px 13px #eee;
}
.mail-image h2 {
font-size: 1.3em;
Expand Down Expand Up @@ -341,10 +341,10 @@ body{
width: 44%;
}
.mail-form input[type="text"] {
background: url(../images/user.png) no-repeat 260px 13px #eee;
background: url(../img/user.png) no-repeat 260px 13px #eee;
}
.mail-form input[type="password"] {
background: url(../images/lock.png) no-repeat 260px 13px #eee;
background: url(../img/lock.png) no-repeat 260px 13px #eee;
}
}
@media (max-width: 320px){
Expand Down
Binary file added sik-htmlpy/static/img/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 8 additions & 5 deletions sik-htmlpy/templates/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<!--web-fonts-->
<link href='//fonts.googleapis.com/css?family=Nunito:400,700,300' rel='stylesheet' type='text/css'>
<link href='//fonts.googleapis.com/css?family=Raleway:400,100,200,500,600,700,800,900' rel='stylesheet' type='text/css'>

<link rel="stylesheet" href="{{ 'css/font-awesome.css'|staticfile }}">
<!--web-fonts-->
<script src="{{ 'js/jquery.min.js'|staticfile }}"></script>
Expand All @@ -30,14 +31,16 @@
<div class="close"> </div>
<div class="mail-image">
<img src="{{ 'img/sik_logo.png'|staticfile }}" alt="" />
<h3 style="margin-top: 15px;">About</h3>
<a href="sikTest.function_name" id="about-link" data-bind="true"><h3 style="margin-top: 15px;">About</h3></a>
</div>
<div class="mail-form">
<form>
<input type="text" placeholder="User ID..." required=""/>
<input type="password" class="pass" placeholder="Password" required=""/>
<input type="submit" value="login">

<form action="sikTest.sikLoginForm" id="form" data-bind="true">
<input type="text" id="form_input" placeholder="User ID..." required=""/>
<input type="password" class="pass" id="form_input" placeholder="Password" required=""/>
<input type="submit" value="login" id="form_submit">
</form>

</div>
<div class="clear"> </div>
</div>
Expand Down

0 comments on commit 232c631

Please sign in to comment.