def post(self):
        self.response.headers['Content-Type'] = 'text/html'

        # If the user clicks on the delete button
        if self.request.get('button') == 'Delete':
            check = self.request.get('hidden_id')
            myuser_key = ndb.Key('Gpu', check)
            myuser_key.delete()

            result = Gpu.query().fetch()
            logout = users.create_logout_url('/')

            # generate a map that contains everything that we need to pass to the template
            template_values = {'result': result, 'logout': logout}

            # asking jinja to render the template files with the template values
            template = JINJA_ENVIRONMENT.get_template('main.html')
            self.response.write(template.render(template_values))

        else:
            result = Gpu.query().fetch()
            logout = users.create_logout_url('/')

            # generate a map that contains everything that we need to pass to the template
            template_values = {'result': result, 'logout': logout}

            # asking jinja to render the template files with the template values
            template = JINJA_ENVIRONMENT.get_template('main.html')
            self.response.write(template.render(template_values))
Esempio n. 2
0
class Emu(object):
    def __init__(self, debug, graphicsScale):
        self.rom = Rom()
        self.gpu = Gpu(graphicsScale)
        self.cpu = Cpu(self.gpu)
        self.gpu.setCpu(self.cpu)
        self.debugger = None
        self.debugger = Debugger(self.cpu)
        if True == debug:
            self.debugger.activate()

    def run(self, binPath):
        self.rom.load(binPath)
        self.cpu.execProg(self.rom.romData, self.debugger)
        self.pyGameMainLoop()

    def pyGameMainLoop(self):
        while 1:
            event = pygame.event.wait()
            if event.type == pygame.KEYDOWN:
                keysPressed = pygame.key.get_pressed()
                self.cpu.keyboard.keyPressedIndication(keysPressed)
                if keysPressed[pygame.K_q]:
                    self.cpu.stop()
            if event.type == pygame.QUIT:
                self.cpu.stop()

            if False == self.cpu.running:
                raise SystemExit
Esempio n. 3
0
 def __init__(self, debug, graphicsScale):
     self.rom = Rom()
     self.gpu = Gpu(graphicsScale)
     self.cpu = Cpu(self.gpu)
     self.gpu.setCpu(self.cpu)
     self.debugger = None
     self.debugger = Debugger(self.cpu)
     if True == debug:
         self.debugger.activate()
    def post(self):
        self.response.headers['Content-Type'] = 'text/html'

        # If the user clicks on the Compare button
        if self.request.get('Button') == 'Compare':
            logout = users.create_logout_url('/')
            result = Gpu.query().fetch()
            list_of_devices_checked = []

            # Counter to ensure the user compares at least 2 GPUs
            counter = 0

            # Storing the values selected by the user
            for x in result:
                name = "checkbox_" + x.key.id()
                x_value = self.request.get(name)
                if x_value:
                    counter = counter + 1
                    myuser_key = ndb.Key('Gpu', x.key.id())
                    gpu = myuser_key.get()
                    list_of_devices_checked.append(gpu)

            # If the user has selected at least 2 GPUs to be compared
            if counter > 1:

                # generate a map that contains everything that we need to pass to the template
                template_values = {
                    'logout': logout,
                    'list_of_devices_checked': list_of_devices_checked
                }

                # asking jinja to render the template files with the template values
                template = JINJA_ENVIRONMENT.get_template(
                    'display_compare.html')
                self.response.write(template.render(template_values))

            # If the user has not selected at least 2 GPUs to be compared
            else:
                error_message = 'Please select atleast two gpu devices'
                result = Gpu.query().fetch()
                logout = users.create_logout_url('/')

                # generate a map that contains everything that we need to pass to the template
                template_values = {
                    'logout': logout,
                    'result': result,
                    'error_message': error_message,
                }

                # asking jinja to render the template files with the template values
                template = JINJA_ENVIRONMENT.get_template('compare.html')
                self.response.write(template.render(template_values))

        # If the user clicks on the Cancel button
        elif self.request.get('Button') == 'Cancel':
            self.redirect('/main')
    def post(self):
        self.response.headers['Content-Type'] = 'text/html'

        action = self.request.get('button')
        if action == 'Add GPU':
            name = self.request.get('name')
            manufacturer = self.request.get('manufacturer')
            dateIssued = datetime.strptime(self.request.get("dateIssued"),
                                           '%Y-%m-%d')
            geometryShader = self.request.get('geometryShader') == 'on'
            tesselationShader = self.request.get('tesselationShader') == 'on'
            shaderInt16 = self.request.get('shaderInt16') == 'on'
            sparseBinding = self.request.get('sparseBinding') == 'on'
            textureCompressionETC2 = self.request.get(
                'textureCompressionETC2') == 'on'
            vertexPipelineStoresAndAtomics = self.request.get(
                'vertexPipelineStoresAndAtomics') == 'on'

            user = users.get_current_user()

            mygpu_key = ndb.Key('Gpu', name)
            mygpu = mygpu_key.get()

            if mygpu == None:

                new_details = Gpu(
                    id=name,
                    name=name,
                    manufacturer=manufacturer,
                    dateIssued=dateIssued,
                    geometryShader=geometryShader,
                    tesselationShader=tesselationShader,
                    shaderInt16=shaderInt16,
                    sparseBinding=sparseBinding,
                    textureCompressionETC2=textureCompressionETC2,
                    vertexPipelineStoresAndAtomics=
                    vertexPipelineStoresAndAtomics)

                new_details.put()

                self.redirect('/')

            else:
                template_values = {'error': 'Gpu already in datastore'}
                template = JINJA_ENVIRONMENT.get_template('mainpage.html')
                self.response.write(template.render(template_values))

        elif action == 'Delete':
            index = int(self.request.get('index'))
            user = users.get_current_user()
            myuser_key = ndb.Key('MyUser', user.user_id())
            myuser = myuser_key.get()
            del myuser.details[index]
            myuser.put()
            self.redirect('/')
    def get(self):
        self.response.headers['Content-Type'] = 'text/html'

        user = users.get_current_user()

        if user == None:
            template_values = {
                'login_url': users.create_login_url(self.request.uri)
            }
            template = JINJA_ENVIRONMENT.get_template('mainpageguest.html')
            self.response.write(template.render(template_values))
            return

        myuser_key = ndb.Key('MyUser', user.user_id())
        myuser = myuser_key.get()

        if myuser == None:
            myuser = MyUser(id=user.user_id())
            myuser.put()

        gpu_query = Gpu().query().fetch()

        template_values = {
            'logout_url': users.create_logout_url(self.request.uri),
            'details': gpu_query
        }

        template = JINJA_ENVIRONMENT.get_template('mainpage.html')
        self.response.write(template.render(template_values))
Esempio n. 7
0
    def post(self):
        self.response.headers['Content-Type'] = 'text/html'

        if self.request.get('button') == 'Submit':

            geometryShader = bool(self.request.get('search_geometryShader'))
            tesselationShader = bool(
                self.request.get('search_tesselationShader'))
            shaderInt16 = bool(self.request.get('search_shaderInt16'))
            sparseBinding = bool(self.request.get('search_sparseBinding'))
            textureCompressionETC2 = bool(
                self.request.get('search_textureCompression'))
            vertextPipelineStoresandAtomics = bool(
                self.request.get('search_vertexPipelineStoresAndAtomics'))

            mysearchlist = Gpu.query()

            if geometryShader:
                mysearchlist = mysearchlist.filter(Gpu.geometryShader == True)
            if tesselationShader:
                mysearchlist = mysearchlist.filter(
                    Gpu.tesselationShader == True)
            if shaderInt16:
                mysearchlist = mysearchlist.filter(Gpu.shaderInt16 == True)
            if sparseBinding:
                mysearchlist = mysearchlist.filter(Gpu.sparseBinding == True)
            if textureCompressionETC2:
                mysearchlist = mysearchlist.filter(
                    Gpu.textureCompressionETC2 == True)
            if vertextPipelineStoresandAtomics:
                mysearchlist = mysearchlist.filter(
                    Gpu.vertexPipelineStoresAndAtomics == True)

        for i in mysearchlist:
            self.response.write(i.name + '<br/>')
Esempio n. 8
0
 def __init__(self, rom):
     self.rom = rom
     self.cpu = Cpu()
     self.gpu = Gpu()
     self.cpu.gpu = self.gpu
     # fill ram/rom
     for index, byte in enumerate(self.rom.rom):
         self.cpu.write_8bit(index, byte)
    def post(self):
        self.response.headers['Content-Type'] = 'text/html'

        action = self.request.get('button')
        if action == 'Add GPU':
            name = self.request.get('name')
            manufacturer = self.request.get('manufacturer')
            dateIssued = datetime.strptime(self.request.get("dateIssued"),
                                           '%Y-%m-%d')
            geometryShader = self.request.get('geometryShader') == 'on'
            tesselationShader = self.request.get('tesselationShader') == 'on'
            shaderInt16 = self.request.get('shaderInt16') == 'on'
            sparseBinding = self.request.get('sparseBinding') == 'on'
            textureCompressionETC2 = self.request.get(
                'textureCompressionETC2') == 'on'
            vertexPipelineStoresAndAtomics = self.request.get(
                'vertexPipelineStoresAndAtomics') == 'on'

            options = Gpu.query()
            if geometryShader:
                options.filter(Gpu.geometryShader == True)

            if tesselationShader:
                options.filter(Gpu.tesselationShader == True)

            if shaderInt16:
                options.filter(Gpu.shaderInt16 == True)

            if sparseBinding:
                options.filter(Gpu.sparseBinding == True)

            if textureCompressionETC2:
                options.filter(Gpu.textureCompressionETC2 == True)

            if vertexPipelineStoresAndAtomics:
                options.filter(Gpu.vertexPipelineStoresAndAtomics == True)
            options = options.fetch()

            user = users.get_current_user()

            mygpu_key = ndb.Key('Gpu', name)
            mygpu = mygpu_key.get()

            mygpu.details.append(options)
            mygpu.put()
            template_values = {
                'options': options,
                'geometryShader': geometryShader,
                'tesselationShader': tesselationShader,
                'shaderInt16': shaderInt16,
                'sparseBinding': sparseBinding,
                'textureCompressionETC2': textureCompressionETC2,
                'vertexPipelineStoresAndAtomics':
                vertexPipelineStoresAndAtomics
            }

        template = JINJA_ENVIRONMENT.get_template('mainpage.html')
        self.response.write(template.render(template_values))
Esempio n. 10
0
    def post(self):
        self.response.headers['Content-Type'] = 'text/html'

        # If the user clicks on the Add button
        if self.request.get('button') == 'Add':
            check = self.request.get('gpu_device')
            myuser_key = ndb.Key('Gpu', check)
            gpu = myuser_key.get()

            # Add the gpu if it doesn't already exists
            if gpu == None:
                gpu = Gpu(id=check)

                gpu.geometryShader = self.request.get('gpu_geometryShader')
                gpu.tesselationShader = self.request.get(
                    'gpu_tesselationShader')
                gpu.shaderInt16 = self.request.get('gpu_shaderInt16')
                gpu.sparseBinding = self.request.get('gpu_sparseBinding')
                gpu.textureCompressionETC2 = self.request.get(
                    'gpu_textureCompressionETC2')
                gpu.vertexPipelineStoresAndAtomics = self.request.get(
                    'gpu_vertexPipelineStoresAndAtomics')
                gpu.put()

                self.redirect('/main')

            # If gpu exists
            else:
                logout = users.create_logout_url('/')
                error_message = 'A gpu with this name exists'

                # generate a map that contains everything that we need to pass to the template
                template_values = {
                    'logout': logout,
                    'error_message': error_message
                }

                # asking jinja to render the template files with the template values
                template = JINJA_ENVIRONMENT.get_template('add.html')
                self.response.write(template.render(template_values))

        # If the user clicks on the Cancel button
        elif self.request.get('button') == 'Cancel':
            self.redirect('/main')
Esempio n. 11
0
    def get(self):
        # Retrieving information to display when the main page is loaded
        self.response.headers['Content-Type'] = 'text/html'
        result = Gpu.query().fetch()
        logout = users.create_logout_url('/')

        # generate a map that contains everything that we need to pass to the template
        template_values = {'result': result, 'logout': logout}

        # asking jinja to render the template files with the template values
        template = JINJA_ENVIRONMENT.get_template('main.html')
        self.response.write(template.render(template_values))
    def get(self):
        self.response.headers['Content-Type'] = 'text/html'
        result = Gpu.query().fetch()
        logout = users.create_logout_url('/')
        error_message = ''

        # generate a map that contains everything that we need to pass to the template
        template_values = {
            'logout': logout,
            'result': result,
            'error_message': error_message
        }

        # asking jinja to render the template files with the template values
        template = JINJA_ENVIRONMENT.get_template('compare.html')
        self.response.write(template.render(template_values))
    def post(self):
        self.response.headers['Content-Type'] = 'text/html'

        action = self.request.get('button')
        if action == 'Search':
            geometryShader = bool(self.request.get('geometryShader'))
            tesselationShader = bool(self.request.get('tesselationShader'))
            shaderInt16 = bool(self.request.get('shaderInt16'))
            sparseBinding = bool(self.request.get('sparseBinding'))
            textureCompressionETC2 = bool(
                self.request.get('textureCompressionETC2'))
            vertexPipelineStoresAndAtomics = bool(
                self.request.get('vertexPipelineStoresAndAtomics'))

            gpu_list = Gpu.query()

            if geometryShader:
                gpu_list = gpu_list.filter(Gpu.geometryShader == True)

            if tesselationShader:
                gpu_list = gpu_list.filter(Gpu.tesselationShader == True)

            if shaderInt16:
                gpu_list = gpu_list.filter(Gpu.shaderInt16 == True)

            if sparseBinding:
                gpu_list = gpu_list.filter(Gpu.sparseBinding == True)

            if textureCompressionETC2:
                gpu_list = gpu_list.filter(Gpu.textureCompressionETC2 == True)

            if vertexPipelineStoresAndAtomics:
                gpu_list = gpu_list.filter(
                    Gpu.vertexPipelineStoresAndAtomics == True)

            for i in gpu_list:
                self.response.write(i.name + '<br/>')
Esempio n. 14
0
    def post(self):
        self.response.headers['Content-Type'] = 'text/html'

        # If the user clicks on the Search Button
        if self.request.get('button') == 'Search':
            geometryShader = self.request.get('checkbox_geometryShader')
            tesselationShader = self.request.get('checkbox_tesselationShader')
            shaderInt16 = self.request.get('checkbox_shaderInt16')
            sparseBinding = self.request.get('checkbox_sparseBinding')
            textureCompressionETC2 = self.request.get(
                'checkbox_textureCompressionETC2')
            vertexPipelineStoresAndAtomics = self.request.get(
                'checkbox_vertexPipelineStoresAndAtomics')

            result_of_querying = Gpu.query()

            # Displaying features for user to select from
            if geometryShader:
                result_of_querying = result_of_querying.filter(
                    Gpu.geometryShader == 'True')
            if tesselationShader:
                result_of_querying = result_of_querying.filter(
                    Gpu.tesselationShader == 'True')
            if shaderInt16:
                result_of_querying = result_of_querying.filter(
                    Gpu.shaderInt16 == 'True')
            if sparseBinding:
                result_of_querying = result_of_querying.filter(
                    Gpu.sparseBinding == 'True')
            if textureCompressionETC2:
                result_of_querying = result_of_querying.filter(
                    Gpu.textureCompressionETC2 == 'True')
            if vertexPipelineStoresAndAtomics:
                result_of_querying = result_of_querying.filter(
                    Gpu.vertexPipelineStoresAndAtomics == 'True')

            # Retrieving available GPUs based on the requested features
            result_of_querying = result_of_querying.fetch()

            # If there exists at least one GPU with the requested features
            if result_of_querying:
                logout = users.create_logout_url('/')
                message = ''

                # generate a map that contains everything that we need to pass to the template
                template_values = {
                    'result_of_querying': result_of_querying,
                    'logout': logout,
                    'message': message
                }

                # asking jinja to render the template files with the template values
                template = JINJA_ENVIRONMENT.get_template('display.html')
                self.response.write(template.render(template_values))

            # If there are no GPUs with the requested features
            else:
                result_of_querying = ''
                message = 'Sorry no GPU exists that supports the checked features'
                logout = users.create_logout_url('/')

                # generate a map that contains everything that we need to pass to the template
                template_values = {
                    'result_of_querying': result_of_querying,
                    'message': message,
                    'logout': logout
                }

                # asking jinja to render the template files with the template values
                template = JINJA_ENVIRONMENT.get_template('display.html')
                self.response.write(template.render(template_values))

        # If the user clicks on the Cancel Button
        elif self.request.get('button') == 'Cancel':
            self.redirect('/main')
Esempio n. 15
0
    def post(self, gname):

        self.response.headers['Content-Type'] = 'text/html'
        action = self.request.get('button')

        user = users.get_current_user()

        if user == None:
            self.redirect('/')

        myuser_key = ndb.Key('MyUser', user.user_id())
        myuser = myuser_key.get()

        error = ""

        gkey = ndb.Key('Gpu', gname)
        gpu = gkey.get()

        if gpu == None:
            self.redirect('/')

        if action == 'Update':

            name = self.request.get('name')
            manufacturer = self.request.get('manufacturer')
            dateissued = self.request.get('dateissued')

            geometryShader = self.request.get('geometryShader') == 'on'
            tesselationShader = self.request.get('tesselationShader') == 'on'
            shaderInt16 = self.request.get('shaderInt16') == 'on'
            sparseBinding = self.request.get('sparseBinding') == 'on'
            textureCompressionETC2 = self.request.get(
                'textureCompressionETC2') == 'on'

            vertexPipelineStoresAndAtomics = self.request.get(
                'vertexPipelineStoresAndAtomics') == 'on'

            if name and dateissued:

                dateissued = datetime.strptime(dateissued, '%Y-%m-%d')

                if name != gpu.name:
                    nkey = ndb.Key('Gpu', name)

                    if nkey.get():
                        error = "gpu with the name already exist."

                    else:
                        gpu.key.delete()

                        gpu = Gpu(id=name, name=name)

                if error == "":
                    gpu.populate(manufacturer=manufacturer,
                                 dateissued=dateissued,
                                 geometryShader=geometryShader,
                                 tesselationShader=tesselationShader,
                                 shaderInt16=shaderInt16,
                                 sparseBinding=sparseBinding,
                                 textureCompressionETC2=textureCompressionETC2,
                                 vertexPipelineStoresAndAtomics=
                                 vertexPipelineStoresAndAtomics)
                    if gpu.put():

                        error = 'gpu updated'
                    else:
                        error = 'gpu not updated'

            else:
                error = 'name OR dateissued cannot be empty'

        template_values = {
            'logout_url': users.create_logout_url(self.request.uri),
            'gpu': gpu,
            'error': error
        }

        template = JINJA_ENVIRONMENT.get_template('edit.html')
        self.response.write(template.render(template_values))