mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-12-13 01:34:32 -05:00
* Generator for updating the about-page in PP from github. * Rename generate_ui-about-simple.ccp.py to generate_ui-about-simple.cpp.py * Adapt changes from "fixed memory usage #2380" to the file generator.
This commit is contained in:
parent
b108d975c0
commit
280b8afc0a
@ -26,6 +26,7 @@ import requests
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
cppheader = """#include "ui_about_simple.hpp"
|
cppheader = """#include "ui_about_simple.hpp"
|
||||||
|
#include <string_view>
|
||||||
|
|
||||||
#define ROLL_SPEED_FRAME_PER_LINE 60
|
#define ROLL_SPEED_FRAME_PER_LINE 60
|
||||||
// cuz frame rate of pp screen is probably 60, scroll per sec
|
// cuz frame rate of pp screen is probably 60, scroll per sec
|
||||||
@ -33,7 +34,7 @@ cppheader = """#include "ui_about_simple.hpp"
|
|||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
// Information: a line starting with a '#' will be yellow coloured
|
// Information: a line starting with a '#' will be yellow coloured
|
||||||
const std::"""
|
constexpr std::"""
|
||||||
|
|
||||||
cppfooter = """
|
cppfooter = """
|
||||||
AboutView::AboutView(NavigationView& nav) {
|
AboutView::AboutView(NavigationView& nav) {
|
||||||
@ -52,18 +53,18 @@ AboutView::AboutView(NavigationView& nav) {
|
|||||||
button_ok.focus();
|
button_ok.focus();
|
||||||
};
|
};
|
||||||
|
|
||||||
for (const std::string& authors_line : authors_list) {
|
for (auto& authors_line : authors_list) {
|
||||||
// if it's starting with #, it's a title and we have to substract the '#' and paint yellow
|
// if it's starting with #, it's a title and we have to substract the '#' and paint yellow
|
||||||
if (authors_line.size() > 0) {
|
if (authors_line.size() > 0) {
|
||||||
if (authors_line[0] == '#') {
|
if (authors_line[0] == '#') {
|
||||||
menu_view.add_item(
|
menu_view.add_item(
|
||||||
{authors_line.substr(1, authors_line.size() - 1),
|
{(std::string)authors_line.substr(1, authors_line.size() - 1),
|
||||||
ui::Theme::getInstance()->fg_yellow->foreground,
|
ui::Theme::getInstance()->fg_yellow->foreground,
|
||||||
nullptr,
|
nullptr,
|
||||||
nullptr});
|
nullptr});
|
||||||
} else {
|
} else {
|
||||||
menu_view.add_item(
|
menu_view.add_item(
|
||||||
{authors_line,
|
{(std::string)authors_line,
|
||||||
Theme::getInstance()->bg_darkest->foreground,
|
Theme::getInstance()->bg_darkest->foreground,
|
||||||
nullptr,
|
nullptr,
|
||||||
nullptr});
|
nullptr});
|
||||||
@ -140,7 +141,7 @@ def get_contributors(url):
|
|||||||
|
|
||||||
def generate_content(projects):
|
def generate_content(projects):
|
||||||
project_contrib = []
|
project_contrib = []
|
||||||
project_contrib.append("string authors_list[] = {\n")
|
project_contrib.append("string_view authors_list[] = {\n")
|
||||||
project_contrib.append(" \"# * List of contributors * \",\n")
|
project_contrib.append(" \"# * List of contributors * \",\n")
|
||||||
for project in projects:
|
for project in projects:
|
||||||
project_contrib.append(" \" \",\n")
|
project_contrib.append(" \" \",\n")
|
||||||
@ -169,7 +170,7 @@ def pp_create_ui_about_simple_cpp(cpp_file, cppheader, cppcontent, cppfooter):
|
|||||||
|
|
||||||
def pp_change_ui_about_simple_cpp(cpp_file, cppcontent):
|
def pp_change_ui_about_simple_cpp(cpp_file, cppcontent):
|
||||||
content = []
|
content = []
|
||||||
content_pattern = re.compile(r"string authors_list\[\] = {\n(?:\s+(?:.*,\n)+\s+.*};\n)", re.MULTILINE)
|
content_pattern = re.compile(r"string_view authors_list\[\] = {\n(?:\s+(?:.*,\n)+\s+.*};\n)", re.MULTILINE)
|
||||||
|
|
||||||
# Read original file
|
# Read original file
|
||||||
with open(cpp_file, 'r') as file:
|
with open(cpp_file, 'r') as file:
|
||||||
|
Loading…
Reference in New Issue
Block a user