App 'compat' created

This commit is contained in:
Alexandro Sánchez Bach 2014-06-16 01:20:00 +02:00
parent 555c223572
commit e4d8857870
15 changed files with 191 additions and 6 deletions

View File

@ -5,12 +5,14 @@
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<Name>website</Name>
<RootNamespace>website</RootNamespace>
<CommandLineArguments />
<CommandLineArguments>
</CommandLineArguments>
<InterpreterPath />
<InterpreterArguments />
<DjangoSettingsModule>$(MSBuildProjectName).settings</DjangoSettingsModule>
<WebBrowserUrl />
<WebBrowserPort>8000</WebBrowserPort>
<EnableNativeCodeDebugging>False</EnableNativeCodeDebugging>
</PropertyGroup>
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -35,11 +37,18 @@
</PropertyGroup>
<ItemGroup>
<Compile Include="manage.py" />
<Compile Include="website\compat\admin.py" />
<Compile Include="website\compat\models.py" />
<Compile Include="website\compat\tests.py" />
<Compile Include="website\compat\urls.py" />
<Compile Include="website\compat\views.py" />
<Compile Include="website\compat\__init__.py" />
<Compile Include="website\home\admin.py" />
<Compile Include="website\home\models.py" />
<Compile Include="website\home\tests.py" />
<Compile Include="website\home\views.py" />
<Compile Include="website\home\__init__.py" />
<Compile Include="website\constants.py" />
<Compile Include="website\__init__.py" />
<Compile Include="website\settings.py" />
<Compile Include="website\urls.py" />
@ -59,6 +68,8 @@
</ItemGroup>
<ItemGroup>
<Folder Include="website\" />
<Folder Include="website\compat\" />
<Folder Include="website\compat\templates\" />
<Folder Include="website\home\" />
<Folder Include="website\home\templates\" />
<Folder Include="website\static\" />
@ -67,6 +78,9 @@
<Folder Include="website\templates\" />
</ItemGroup>
<ItemGroup>
<Content Include="website\compat\templates\classify.html" />
<Content Include="website\compat\templates\list.html" />
<Content Include="website\compat\templates\index.html" />
<Content Include="website\home\templates\home.html" />
<Content Include="website\static\css\base.css" />
<Content Include="website\templates\base.html" />

View File

4
website/compat/admin.py Normal file
View File

@ -0,0 +1,4 @@
from django.contrib import admin
from website.compat.models import Title
admin.site.register(Title)

16
website/compat/models.py Normal file
View File

@ -0,0 +1,16 @@
from django.db import models
from website.constants import *
class Title(models.Model):
# Static
titleid = models.CharField(max_length=9)
name = models.CharField(max_length=64)
publisher = models.CharField(max_length=64)
developer = models.CharField(max_length=64)
genre = models.CharField(max_length=32)
release = models.DateField()
firmware = models.CharField(max_length=8)
# Dynamic
compatibility = models.SmallIntegerField(choices=C.COMPATIBILITY)

View File

@ -0,0 +1,7 @@
<div class="text-center">
<ul class="pagination">
{% for char in chars %}
<li><a href='/compat/{{ char }}/'>{{ char }}</a></li>
{% endfor %}
</ul>
</div>

View File

@ -0,0 +1,69 @@
{% extends 'base.html' %}
{% block intro %}
{% include 'classify.html' %}
{% endblock %}
{% block content %}
<div class='row'>
<h1>Compatibility</h1>
<div class='col-md-4'>
<h3>Stats</h3>
<dl>
<dt>Perfect: {{ strResults.0 }} %</dt>
<dd>
<div class='progress'>
<div class='progress-bar' role='progressbar' aria-valuenow='{{ intResults.0 }}' aria-valuemin='0' aria-valuemax='100' style='width: {{ strResults.0 }}%'>
</div>
</div>
</dd>
<dt>Playable: {{ strResults.1 }} %</dt>
<dd>
<div class='progress'>
<div class='progress-bar progress-bar-success' role='progressbar' aria-valuenow='{{ intResults.1 }}' aria-valuemin='0' aria-valuemax='100' style='width:{{ strResults.1 }}%;'>
</div>
</div>
</dd>
<dt>Ingame: {{ strResults.2 }} %</dt>
<dd>
<div class='progress'>
<div class='progress-bar progress-bar-warning' role='progressbar' aria-valuenow='{{ intResults.2 }}' aria-valuemin='0' aria-valuemax='100' style='width:{{ strResults.2 }}%;'>
</div>
</div>
</dd>
<dt>Intro: {{ strResults.3 }} %</dt>
<dd>
<div class='progress'>
<div class='progress-bar progress-bar-danger' role='progressbar' aria-valuenow='{{ intResults.3 }}' aria-valuemin='0' aria-valuemax='100' style='width:{{ strResults.3 }}%;'>
</div>
</div>
</dd>
<dt>Nothing: {{ strResults.4 }} %</dt>
<dd>
<div class='progress'>
<div class='progress-bar' role='progressbar' aria-valuenow='{{ intResults.4 }}' aria-valuemin='0' aria-valuemax='100' style='width:{{ strResults.4 }}%; background-color: #555'>
</div>
</div>
</dd>
</dl>
</div>
<div class='col-md-8'>
<h3>Information</h3>
<p>
Almost every commercial game will not run, because RPCS3 it's in an early stage of development. A lot of features required to run commercial games still have not been implemented. Commercial games will be supported when the hardware emulation is accurate enough to run them.
<ul>
<li><p><b>Perfect</b>: No issues at all.</p></li>
<li><p><b>Playable</b>: Runs well from beginning to end, only with minor audio or video glitches.</p></li>
<li><p><b>Ingame</b>: Starts, it can be played, but with crashes or major graphical/audio glitches.</p></li>
<li><p><b>Intro</b>: Hangs/crashes somewhere between booting and starting.</p></li>
<li><p><b>Nothing</b>: Crashes/exits before anything is displayed.</p></li>
</ul>
</p>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,8 @@
{% extends 'base.html' %}
{% block intro %}
{% include 'classify.html' %}
{% endblock %}
{% block content %}
{% endblock %}

16
website/compat/tests.py Normal file
View File

@ -0,0 +1,16 @@
"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
Tests that 1 + 1 always equals 2.
"""
self.assertEqual(1 + 1, 2)

6
website/compat/urls.py Normal file
View File

@ -0,0 +1,6 @@
from django.conf.urls import patterns, url
urlpatterns = patterns('website.compat.views',
url(r'^$', 'compat_index', name='compat-index'),
url(r'^(?:(?P<char>[A-Z#])/)?(?:filter/(?P<filter>[12345])/)?$', 'compat_list', name='compat-list'),
)

26
website/compat/views.py Normal file
View File

@ -0,0 +1,26 @@
from django.shortcuts import render
from website.compat.models import Title
from website.constants import *
def compat_index(request):
stats = [
len(Title.objects.filter(compatibility=C.COMPATIBILITY_NOTHING)),
len(Title.objects.filter(compatibility=C.COMPATIBILITY_INTRO)),
len(Title.objects.filter(compatibility=C.COMPATIBILITY_INGAME)),
len(Title.objects.filter(compatibility=C.COMPATIBILITY_PLAYABLE)),
len(Title.objects.filter(compatibility=C.COMPATIBILITY_PERFECT)),
]
total = sum(stats)
strResults = map(lambda x: '%.2f' % (100.0*x/total if total else 0), stats)
intResults = map(lambda x: 100*x/total if total else 0, stats)
objects = {
'strResults' : strResults,
'intResults' : intResults,
'chars' : '#ABCDEFGHIJKLMNOPQRSTUVWXYZ',
}
return render(request, 'index.html', objects)
def compat_list(request, char='', filter=None):
return render(request, 'list.html')

17
website/constants.py Normal file
View File

@ -0,0 +1,17 @@
# Contants shared between all apps
class C:
COMPATIBILITY_UNKNOWN = 0
COMPATIBILITY_NOTHING = 1
COMPATIBILITY_INTRO = 2
COMPATIBILITY_INGAME = 3
COMPATIBILITY_PLAYABLE = 4
COMPATIBILITY_PERFECT = 5
COMPATIBILITY = (
(COMPATIBILITY_UNKNOWN, "Unknown"),
(COMPATIBILITY_NOTHING, "Nothing"),
(COMPATIBILITY_INTRO, "Intro"),
(COMPATIBILITY_INGAME, "Ingame"),
(COMPATIBILITY_PLAYABLE, "Playable"),
(COMPATIBILITY_PERFECT, "Perfect"),
)

View File

@ -1,7 +1,7 @@
{% extends "base.html" %}
{% load static %}
{% block jumbotron %}
{% block intro %}
<div class="jumbotron">
<div class="container">
<h1>RPCS3</h1>

View File

@ -117,6 +117,7 @@ INSTALLED_APPS = (
# Internal
'website.home',
'website.compat',
)
# A sample logging configuration. The only tangible logging

View File

@ -21,22 +21,22 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href=".">RPCS3</a>
<a class="navbar-brand" href="/">RPCS3</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href='http://www.emunewz.net/forum/forumdisplay.php?fid=199'>Downloads</a></li>
<li><a href='compatibility.php'>Compatibility</a></li>
<li><a href='/compat/'>Compatibility</a></li>
<li><a href='https://github.com/DHrpcs3/rpcs3/wiki/FAQ'>FAQ</a></li>
<li><a href='http://rpcs3.net/'>Blog</a></li>
<li><a href='http://www.emunewz.net/forum/forumdisplay.php?fid=162'>Forum</a></li>
<li><a href='contact.php'>Contact</a></li>
<li><a href='/contact/'>Contact</a></li>
</ul>
</div>
</div>
</div>
{% block jumbotron %}
{% block intro %}
{% endblock %}
<div class="container">

View File

@ -6,6 +6,7 @@ admin.autodiscover()
urlpatterns = patterns('',
# Public
url(r'^$', 'website.home.views.home', name='home'),
url(r'^compat/', include('website.compat.urls')),
# Administration
url(r'^admin/', include(admin.site.urls)),