-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added registry for saved penpot designs
- Loading branch information
Michael Panchenko
committed
May 27, 2024
1 parent
a6d9548
commit 53a5954
Showing
2 changed files
with
44 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import logging | ||
import os | ||
from enum import Enum | ||
|
||
from penai.config import get_config, pull_from_remote | ||
|
||
log = logging.getLogger(__name__) | ||
|
||
|
||
# Turn above list into an Enum | ||
class SavedPenpotDesign(Enum): | ||
AVATAAARS = "Avataaars by Pablo Stanley" | ||
BLACK_AND_WHITE_MOBILE_TEMPLATES = "Black & White Mobile Templates" | ||
COMMUNITY_CARDS_GRID_THEME = "Community - Cards grid theme" | ||
INTERACTIVE_MUSIC_APP = "Interactive music app" | ||
MASTODON_SOCIAL_APP = "Mastodon Social App" | ||
MATERIAL_DESIGN_3 = "Material Design 3" | ||
NEXTCLOUD_DESIGN_SYSTEM = "Nextcloud design system" | ||
PLANTS_APP = "Plants app" | ||
UX_NOTES = "UX Notes" | ||
WIREFRAMING_KIT = "Wireframing kit" | ||
|
||
def get_project_name(self) -> str: | ||
return self.value | ||
|
||
def get_path(self, pull: bool = False) -> str: | ||
result = os.path.join(get_config().penpot_designs_basedir(), self.get_project_name()) | ||
if pull: | ||
log.info(f"Pulling data for project {self.get_project_name()} to {result}") | ||
pull_from_remote(result) | ||
return result | ||
|
||
@classmethod | ||
def pull_all(cls) -> None: | ||
for design in cls: | ||
design.get_path(pull=True) |