-
Notifications
You must be signed in to change notification settings - Fork 654
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Code for V2 added, completely new UI and lots of features
- Loading branch information
1 parent
284a127
commit 4df7797
Showing
162 changed files
with
19,923 additions
and
33,052 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
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
File renamed without changes.
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,58 @@ | ||
import json | ||
|
||
def update_state_raw(key , val ): | ||
print( "utds " + key + "___U_P_D_A_T_E___" + json.dumps(val)) | ||
|
||
|
||
registered_applets = {} | ||
|
||
def register_applet(model_container, applet_cls): | ||
applet_name = applet_cls.applet_name | ||
applet = applet_cls() | ||
applet.init_applet(model_container) | ||
registered_applets[applet_name] = applet | ||
|
||
def run_applet(applet_name , params_dict): | ||
registered_applets[applet_name].run(params_dict) | ||
|
||
|
||
class AppletBase: | ||
|
||
applet_name = None | ||
applet_title = None | ||
is_stop_avail = False | ||
applet_description = "" | ||
applet_icon = "file" | ||
applet_icon_fname = None | ||
|
||
def run(self, params): | ||
raise NotImplementedError("base cls") | ||
|
||
def get_input_form(self): | ||
return [] | ||
|
||
def update_output( self, key , val ): | ||
self.update_state( "outputs." + key , val) | ||
|
||
def update_state(self , key , val ): | ||
key = "registered_ext_applets." + self.applet_name + "." + key | ||
update_state_raw(key , val) | ||
|
||
def init_applet(self, model_container): | ||
|
||
self.model_container = model_container | ||
|
||
update_state_raw( "registered_ext_applets." + self.applet_name , {}) | ||
update_state_raw( "registered_ext_applets." + self.applet_name + ".id" , self.applet_name) | ||
update_state_raw( "registered_ext_applets." + self.applet_name + ".title" , self.applet_title) | ||
update_state_raw( "registered_ext_applets." + self.applet_name + ".description" , self.applet_description) | ||
update_state_raw( "registered_ext_applets." + self.applet_name + ".icon" , self.applet_icon ) | ||
if self.applet_icon_fname is not None: | ||
update_state_raw( "registered_ext_applets." + self.applet_name + ".img_icon" , self.applet_icon_fname ) | ||
update_state_raw( "registered_ext_applets." + self.applet_name + ".home_category" , "misc") | ||
update_state_raw( "registered_ext_applets." + self.applet_name + ".inputs" , self.get_input_form() ) | ||
update_state_raw( "registered_ext_applets." + self.applet_name + ".outputs" , [] ) | ||
update_state_raw( "registered_ext_applets." + self.applet_name + ".is_stop_avail" , self.is_stop_avail ) | ||
|
||
|
||
|
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,75 @@ | ||
import random | ||
|
||
def get_textbox(id, type="str" , default="" , title="" , description=""): | ||
|
||
types = {"str" : "text" , "int" : "number" , "float" : "number"} | ||
|
||
return { | ||
"id": str(random.randint(0,19989999)), | ||
"component": "InputWithDesc", | ||
"title": title, | ||
"description":description , | ||
"children": [ | ||
{ | ||
"id": id, | ||
"component": "Textbox", | ||
"placeholder" : "", | ||
"default_value" : default , | ||
"type" : types[type], | ||
"output_type" :type , | ||
"is_persistant" : False | ||
} | ||
] | ||
} | ||
|
||
def get_output_text(text): | ||
return { | ||
"id": str(random.randint(0,19989999)), | ||
"component": "OutputText", | ||
"text" : text | ||
} | ||
def get_output_img(img_path, save_ext='.png' , is_save=False): | ||
return { | ||
"id": str(random.randint(0,19989999)), | ||
"component": "OutputImage", | ||
"img_path" : img_path, | ||
"is_save" : is_save , | ||
"save_ext" : save_ext | ||
} | ||
|
||
def get_file_textbox(id , path_type="", title="" , description="" ): | ||
return { | ||
"id": str(random.randint(0,19989999)), | ||
"component": "InputWithDesc", | ||
"full_width": True, | ||
"title": title, | ||
"description": description, | ||
"children": [ | ||
{ | ||
"id": id , | ||
"component": "FilePathTextBox", | ||
"placeholder" : "", | ||
"is_persistant" : False, | ||
"path_type" : path_type | ||
}, | ||
] | ||
} | ||
|
||
def get_textarea(id , title="" , description="" ): | ||
return { | ||
"id": str(random.randint(0,19989999)), | ||
"component": "InputWithDesc", | ||
"full_width": True, | ||
"title": title, | ||
"description": description, | ||
"children": [ | ||
{ | ||
"id": id , | ||
"component": "Textarea", | ||
"placeholder" : title , | ||
"is_small" : True, | ||
"is_persistant" : False, | ||
}, | ||
] | ||
} | ||
|
Oops, something went wrong.
Maybe adding support for the turbo modules would be nice too. Especially for the animations.