コード例 #1
0
    def load_view_from_json(self, view_name: str):
        """loads the set of views from json file
        This creates a View object for each view
        """
        views_json = ConfigLoader.load('views.json')

        if view_name in views_json.keys():
            setattr(self, view_name,
                    View(self.app, view_name, views_json[view_name]))
            return True
        return False
コード例 #2
0
ファイル: menus.py プロジェクト: jamesros161/wpui2
    def get_menu(self, menu_name):
        """getter for view's menu

        Returns:
            boolean, attr
        """
        try:
            menus_json = ConfigLoader.load('menus.json')
            setattr(self, menu_name, Menu(menu_name, menus_json[menu_name]))
        except AttributeError:
            warning = ("No Menu Exists by the name " + menu_name +
                       "!!! Menu Retrieval Failed!")
            self.log.warning(warning)
            self.app.errors.append(warning)
            return False
        else:
            return getattr(self, menu_name)
コード例 #3
0
ファイル: settings.py プロジェクト: jamesros161/wpui2
 def __init__(self):
     self.imported_settings = ConfigLoader.load('settings.json')
     for key, value in self.imported_settings.items():
         setattr(self, key, value)
コード例 #4
0
                n += 1

            tlx, tly = fixture.position
            angle = float(fixture.angle)
            scale = float(fixture.scale)

            positions[fixture.id] = [tlx, tly, angle, scale]
            render_surfaces[fixture.id] = ts
    colorshift += 0.0075


if __name__ == '__main__':

    loader = ConfigLoader('test_surface.json')

    config = loader.load()

    if config is None:
        print "Exiting..."
        sys.exit(1)

    (width, height) = config.surfaces[0].dimensions

    pygame.init()

    size = width, height
    screen = pygame.display.set_mode(size)
    pygame.event.set_allowed([QUIT, KEYDOWN, USEREVENT])

    sc = pygame.Surface((width, height))