nullboard
nullboard copied to clipboard
import from planner
Hello,
I really appreciate your work, and his simplicity ! I'm trying to interact from nullboard to pythonscript (href = action.py).
I'm not experienced in js/css. How should i add a class in note (text, raw, min and... "class" ?) in order to custumize them ? Something like that :
.board .note.class {
background: #75B843;
margin-top: 5px;
box-shadow: 0 1px 2px #bbb, 0 0 1px #ddd;
position: relative;
}
I propose this if it could help someone to import Planner kanban with Python :
import pandas as pd
import json
compartiments = {}
for index, row in planner.iterrows():
nom_compartiment = row["Nom du compartiment"]
nom_tache = row["Nom de tâche"]
description = row["Description"]
elements_liste_controle = row["Éléments de la liste de contrôle"]
if nom_compartiment not in compartiments:
compartiments[nom_compartiment] = {"title": nom_compartiment, "notes": []}
# Name of task only
# Add task raw = True
compartiments[nom_compartiment]["notes"].append({
"text": nom_tache,
"raw": True,
"min": False
})
# Vérifier si la description est NaN
if pd.notna(description):
if description.startswith("_x000d_\n"): # Vérifier si la description commence par _x000d_\n
description = description.replace("_x000d_\n", "")
else:
description = description.replace("_x000d_\n", "\n") # Remplacer ailleurs dans la chaîne
description = description.replace("_x000d_", "") # Remplacer ailleurs dans la chaîne
if len(description) > 0:
compartiments[nom_compartiment]["notes"].append({
"text": description,
"raw": False,
"min": True
})
# Add Elements control under the task
# Vérifier si Elements de contrôles est NaN
if pd.notna(elements_liste_controle):
elements_liste_controle = elements_liste_controle.replace("_x000d_\n", "\n") # Pour les premières lignes
elements_liste_controle = elements_liste_controle.replace("_x000d_", "")
items_controle = elements_liste_controle.split(";") # Découper la chaîne en items
# Ajouter chaque item séparément au JSON
for item in items_controle:
if len(item) > 0:
compartiments[nom_compartiment]["notes"].append({
"text": item.strip(), # Supprimer les espaces en début et fin d'item
"raw": False,
"min": False
})
GENIAL_json = {
'format': 20190412,
'id': 1,
'revision': 1,
'title': 'Titre',
'lists': [],
}
GENIAL_json["lists"] = list(compartiments.values())
open('GenIA-L.nbx', 'w') as f:
json.dump(GENIAL_json, f, indent=4)