-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f37288d
commit f555d76
Showing
6 changed files
with
53 additions
and
10 deletions.
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
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,40 @@ | ||
''' | ||
Created on 2022-09-07 | ||
@author: wf | ||
''' | ||
class Context: | ||
""" | ||
legacy context handler, encapsulates context | ||
""" | ||
|
||
def __init__(self,context_dict:dict): | ||
self.context_dict=context_dict | ||
self.page_options=PageOptions(context_dict.get("page_options",{})) | ||
|
||
def as_javascript(self): | ||
""" | ||
generate my initial JavaScript | ||
""" | ||
title=self.page_options.getTitle() | ||
debug=str(self.page_options.getDebug()).lower() | ||
javascript=f"""let justpy_core=new JustpyCore( | ||
this, // window | ||
'{title}', // title | ||
{debug} // debug | ||
);""" | ||
return javascript | ||
|
||
class PageOptions: | ||
""" | ||
legacy page_options handler, encapsulating page_options | ||
""" | ||
|
||
def __init__(self,page_options_dict:dict): | ||
self.page_options_dict=page_options_dict | ||
|
||
def getTitle(self): | ||
return self.page_options_dict.get("title","JustPy") | ||
|
||
def getDebug(self): | ||
return self.page_options_dict.get("debug",False) |
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
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