This commit is contained in:
yumoqing 2025-06-06 22:04:15 +08:00
parent 50c26a309e
commit 5fb7cbb357
18 changed files with 83 additions and 84 deletions

View File

@ -22,8 +22,8 @@ bricks.ASRClient = class extends bricks.VBox {
constructor(opts){
super(opts);
var icon_options = this.icon_options || {};
icon_options.url = this.start_icon || bricks_resource('imgs/start_recording.png');
this.icon = new bricks.Icon(icon_options);
icon_options.url = this.start_icon || bricks_resource('imgs/start_recording.svg');
this.icon = new bricks.Svg(icon_options);
this.status = 'stop';
this.icon.bind('click', this.toggle_button.bind(this));
this.add_widget(this.icon);
@ -37,7 +37,7 @@ bricks.ASRClient = class extends bricks.VBox {
}
toggle_button(){
if (this.status == 'stop'){
this.icon.set_url(this.start_icon||bricks_resource('imgs/stop_recording.png'));
this.icon.set_url(this.start_icon||bricks_resource('imgs/stop_recording.svg'));
this.status = 'start';
this.start_recording();
} else {

View File

@ -139,10 +139,9 @@ bricks.AudioRecorder = class extends bricks.HBox {
constructor(opts){
super(opts);
this.set_css('clickable');
this.start_icon = opts.start_icon || bricks_resource('imgs/start_recording.png');
this.stop_icon = opts.stop_icon || bricks_resource('imgs/stop_recording.png');
this.rec_btn = new bricks.Icon({
dynsize:true,
this.start_icon = opts.start_icon || bricks_resource('imgs/start_recording.svg');
this.stop_icon = opts.stop_icon || bricks_resource('imgs/stop_recording.svg');
this.rec_btn = new bricks.Svg({
url:this.start_icon,
rate:this.icon_rate
});

View File

@ -20,20 +20,20 @@ bricks.Camera = class extends bricks.Popup {
this.cur_camera_id = 0;
this.add_widget(filler);
this.add_widget(hbox);
var shot_btn = new bricks.Icon({
url:bricks_resource('imgs/camera.png'),
var shot_btn = new bricks.Svg({
url:bricks_resource('imgs/camera.svg'),
margin: '10px',
tip:'Take a picture',
rate:2.5
});
var switch_btn = new bricks.Icon({
url:bricks_resource('imgs/switch-camera.png'),
var switch_btn = new bricks.Svg({
url:bricks_resource('imgs/switch-camera.svg'),
tip:'switch camera',
margin: '10px',
rate:1.5
});
var del_btn = new bricks.Icon({
url:bricks_resource('imgs/delete.png'),
var del_btn = new bricks.Svg({
url:bricks_resource('imgs/delete.Svg'),
tip:'canel it',
margin: '10px',
rate:1.5

View File

@ -28,12 +28,12 @@ bricks.Conform = class extends bricks.PopupWindow {
tools:[
bricks.extend({
"name":"conform",
"icon":bricks_resource('imgs/conform.png'),
"icon":bricks_resource('imgs/conform.svg'),
"label":'Conform'
}, this.opts.conform||{}),
bricks.extend({
"name":"discard",
"icon":bricks_resource('imgs/cancel.png'),
"icon":bricks_resource('imgs/cancel.svg'),
"label":"Discard"
}, this.opts.discard||{})
]

View File

@ -117,19 +117,19 @@ bricks.DataViewer = class extends bricks.VBox {
{
name:'add',
tip:'add new record',
icon:this.editable.add_icon || bricks_resource('imgs/add.png')
icon:this.editable.add_icon || bricks_resource('imgs/add.svg')
},
{
name:'update',
tip:'update selected record',
selected_row:true,
icon:this.editable.update_icon || bricks_resource('imgs/update.png')
icon:this.editable.update_icon || bricks_resource('imgs/update.svg')
},
{
name:'delete',
tip:'delete selected record',
selected_row:true,
icon:this.editable.delete_icon || bricks_resource('imgs/delete.png')
icon:this.editable.delete_icon || bricks_resource('imgs/delete.svg')
}
];
tbdesc.tools.forEach(t => {

View File

@ -276,7 +276,7 @@ bricks.DynamicAccordion = class extends bricks.VScrollPanel {
{
"name":"add",
"tip":"add a new record",
"icon":this.editable.add_icon || bricks_resource('imgs/add.png')
"icon":this.editable.add_icon || bricks_resource('imgs/add.svg')
}
]
}
@ -350,7 +350,7 @@ bricks.DynamicAccordion = class extends bricks.VScrollPanel {
{
name:'add',
tip:'add new record',
icon:this.editable.add_icon || bricks_resource('imgs/add.png')
icon:this.editable.add_icon || bricks_resource('imgs/add.svg')
},
{
name:'blankicon'
@ -372,12 +372,12 @@ bricks.DynamicAccordion = class extends bricks.VScrollPanel {
{
name:"update",
tip:"update record in this line",
icon:this.editable.update_icon || bricks_resource('imgs/update.png')
icon:this.editable.update_icon || bricks_resource('imgs/update.svg')
},
{
name:'delete',
tip:"delete record in this line",
icon:this.editable.delete_icon || bricks_resource('imgs/delete.png')
icon:this.editable.delete_icon || bricks_resource('imgs/delete.svg')
}
]
desc.tools = edit_tools.concat(desc.tools);

View File

@ -62,7 +62,7 @@ bricks.IconBar = class extends bricks.HBox {
});
}
opts.url = opts.icon;
var w = new bricks.Icon(opts);
var w = new bricks.Svg(opts);
w.bind('click', this.regen_event.bind(this, opts));
return w;
}
@ -92,7 +92,7 @@ bricks.IconTextBar = class extends bricks.IconBar {
rate:opts.rate || rate,
dynsize:opts.dynsize||true
};
var w = new bricks.Icon(desc);
var w = new bricks.Svg(desc);
box.add_widget(w);
}
if (opts.label){
@ -118,7 +118,7 @@ bricks.IconTextBar = class extends bricks.IconBar {
bricks.FloatIconBar = class extends bricks.HBox {
constructor(opts){
super(opts);
this.float_w = new bricks.Icon({url:bricks_resource('imgs/float-out.png')});
this.float_w = new bricks.Svg({url:bricks_resource('imgs/float-out.png')});
this.float_w.bind('mousemove', this.show_icons.bind(this));
this.add_widget(this.float_w);
this.icons_box = this.build_bar(opts);

View File

@ -97,19 +97,19 @@ bricks.FormBase = class extends bricks.Layout {
widget.add_widget(box);
var tools = [
{
icon:bricks_resource('imgs/submit.png'),
icon:bricks_resource('imgs/submit.svg'),
name:'submit',
css:'submit_btn',
label:'Submit'
},
{
icon:bricks_resource('imgs/reset.png'),
icon:bricks_resource('imgs/reset.svg'),
name:'reset',
css:'reset_btn',
label:'Reset'
},
{
icon:bricks_resource('imgs/cancel.png'),
icon:bricks_resource('imgs/cancel.svg'),
name:'cancel',
css:'clear_btn',
label:'Cancel'

View File

@ -269,8 +269,8 @@ bricks.UiSearch = class extends bricks.HBox {
readonly:true
}
this.str_in = new bricks.UiStr(inputdesc);
this.search_icon = new bricks.Icon({
url:bricks_resource('imgs/search.png'),
this.search_icon = new bricks.Svg({
url:bricks_resource('imgs/search.svg'),
rate:1.5
});
this.str_in.set_css('filler');
@ -491,8 +491,8 @@ bricks.UiImage =class extends bricks.VBox {
opts.name = opts.name || 'image';
super(opts);
this.uitype='image';
this.camera_w = new bricks.Icon({
url:bricks_resource('imgs/camera.png'),
this.camera_w = new bricks.Svg({
url:bricks_resource('imgs/camera.svg'),
tip:'use cemera to take a picture',
rate:2});
this.add_widget(this.camera_w);
@ -556,7 +556,7 @@ bricks.UiImage =class extends bricks.VBox {
reader.readAsDataURL(file);
}
set_formdata(fd){
// fd.append(this.name, this.resultValue(), 'test.png');
// fd.append(this.name, this.resultValue(), 'test.svg');
fd.append(this.name, this.resultValue());
}
resultValue(){
@ -593,8 +593,8 @@ bricks.UiCheck =class extends bricks.UiType {
this.ms_icon = new bricks.MultipleStateIcon({
state:state,
urls:{
checked:bricks_resource('imgs/checkbox-checked.png'),
unchecked:bricks_resource('imgs/checkbox-unchecked.png')
checked:bricks_resource('imgs/checkbox-checked.svg'),
unchecked:bricks_resource('imgs/checkbox-unchecked.svg')
}
});
@ -1060,8 +1060,8 @@ bricks.UiAudio =class extends bricks.UiStr {
this.uitype = 'audio';
this.autoplay = opts.autoplay;
this.readonly = opts.readonly;
this.icon = new bricks.Icon({
url: bricks_resource('imgs/right_arrow.png')});
this.icon = new bricks.Svg({
url: bricks_resource('imgs/right_arrow.svg')});
this.add_widget(this.icon);
this.icon.bind('click', this.play_audio.bind(this));
this.player = new bricks.AudioPlayer({
@ -1095,8 +1095,8 @@ bricks.UiVideo =class extends bricks.UiStr {
this.uitype = 'video';
this.autoplay = opts.autoplay;
this.readonly = opts.readonly;
this.icon = new bricks.Icon({
url: bricks_resource('imgs/right_arrow.png')});
this.icon = new bricks.Svg({
url: bricks_resource('imgs/right_arrow.svg')});
this.add_widget(this.icon);
this.icon.bind('click', this.play_audio.bind(this));
this.player = new bricks.VideoPlayer({

View File

@ -56,10 +56,10 @@ bricks.ModelOutput = class extends bricks.VBox {
opts.height = 'auto';
super(opts);
var hb = new bricks.HBox({width:'100%', cheight:2});
this.img = new bricks.Icon({
this.img = new bricks.Svg({
rate:2,
tip:this.opts.model,
url:this.icon||bricks_resource('imgs/llm.png')
url:this.icon||bricks_resource('imgs/llm.svg')
});
hb.add_widget(this.img);
var mname = new bricks.Text({text:this.opts.model});
@ -85,8 +85,8 @@ bricks.ModelOutput = class extends bricks.VBox {
otext:'结果满意吗?',
i18n:true,
});
var likew = new bricks.Icon({rate:2, url:bricks_resource('imgs/like.png')});
var unlikew = new bricks.Icon({rate:2, url:bricks_resource('imgs/unlike.png')});
var likew = new bricks.Svg({rate:2, url:bricks_resource('imgs/like.svg')});
var unlikew = new bricks.Svg({rate:2, url:bricks_resource('imgs/unlike.svg')});
likew.bind('click', this.estimate_llm.bind(this, 1));
unlikew.bind('click', this.estimate_llm.bind(this, -1))
this.estimate_w.add_widget(txtw);
@ -183,10 +183,10 @@ bricks.LlmModel = class extends bricks.JsWidget {
render_title(){
var w = new bricks.HBox({padding:'15px'});
w.bind('click', this.show_setup_panel.bind(this))
var img = new bricks.Icon({
var img = new bricks.Svg({
rate:2,
tip:this.opts.model,
url:this.opts.icon||bricks_resource('imgs/llm.png')
url:this.opts.icon||bricks_resource('imgs/llm.svg')
});
// var txt = new bricks.Text({text:this.opts.model});
w.add_widget(img);
@ -318,16 +318,16 @@ bricks.LlmIO = class extends bricks.VBox {
this.llmmodels = [];
this.title_w = new bricks.HBox({cheight:3});
var bottom_box = new bricks.HBox({cheight:3});
this.i_w = new bricks.Icon({
this.i_w = new bricks.Svg({
rate:2,
url:bricks_resource('imgs/input.png'),
url:bricks_resource('imgs/input.svg'),
margin:'14px',
tip:'input data',
css:'clickable'
});
this.nm_w = new bricks.Icon({
this.nm_w = new bricks.Svg({
rate:2,
url:bricks_resource('imgs/add.png'),
url:bricks_resource('imgs/add.svg'),
margin:'14px',
tip:'add new model',
css:'clickable'
@ -484,7 +484,7 @@ bricks.LlmIO = class extends bricks.VBox {
var w = await bricks.widgetBuild(this.input_view, this.o_w, data);
w.set_css(this.msg_css||'user_msg');
w.set_css('filler');
var img = new bricks.Icon({rate:2,url:this.user_icon||bricks_resource('imgs/user.png')});
var img = new bricks.Svg({rate:2,url:this.user_icon||bricks_resource('imgs/user.svg')});
box.add_widget(new bricks.BlankIcon({rate:2, flexShrink:0}));
box.add_widget(w);
box.add_widget(img);

View File

@ -23,7 +23,7 @@ bricks.UserMsgBox = class extends bricks.HBox {
*/
constructor(opts){
super(opts);
var img = new bricks.Icon({rate:2,url:this.icon||bricks_resource('imgs/user.png')});
var img = new bricks.Svg({rate:2,url:this.icon||bricks_resource('imgs/user.svg')});
var w = new bricks.MdWidget({mdtext:this.prompt});
w.set_css('filler');
w.set_css(this.msg_css||'user_msg');
@ -51,7 +51,7 @@ bricks.LlmMsgBox = class extends bricks.HBox {
*/
constructor(opts){
super(opts);
var img = new bricks.Icon({rate:2,url:this.icon||bricks_resource('imgs/user.png')});
var img = new bricks.Svg({rate:2,url:this.icon||bricks_resource('imgs/user.png')});
this.w = new bricks.MdWidget({mdtext:' '});
this.w.set_css('filler');
this.run = new bricks.BaseRunning({target:this});
@ -168,7 +168,7 @@ bricks.LlmDialog = class extends bricks.VBox {
}
show_model_info(model){
var w = new bricks.HBox({margin:'5px'});
w.add_widget(new bricks.Icon({url:model.icon||bricks_resource('imgs/llm.png'), rate:2}));
w.add_widget(new bricks.Svg({url:model.icon||bricks_resource('imgs/llm.svg'), rate:2}));
w.add_widget(new bricks.Text({text:model.model}));
this.title_w.add_widget(w);
this.model_info_ws[model.model] = w;

View File

@ -123,7 +123,7 @@ bricks.Modal = class extends bricks.BaseModal {
this.title_box.set_css('title');
this.panel.add_widget(this.title_box);
this.title_w = new bricks.Filler({height:'100%'});
var icon = new bricks.Icon({url:bricks_resource('imgs/delete.png')});
var icon = new bricks.Svg({url:bricks_resource('imgs/delete.svg')});
icon.bind('click', this.dismiss.bind(this));
this.title_box.add_widget(this.title_w);
this.title_box.add_widget(icon);

View File

@ -116,7 +116,7 @@ bricks.Popup = class extends bricks.VBox {
this.set_style('left', x + 'px');
}
setup_resizable(){
this.resizable_w = new bricks.Icon({rate:1.5, url:bricks_resource('imgs/right-bottom-triangle.png')});
this.resizable_w = new bricks.Svg({rate:1.5, url:bricks_resource('imgs/right-bottom-triangle.svg')});
super.add_widget(this.resizable_w);
this.resizable_w.set_css('resizebox');
this.resizable_w.bind('mousedown', this.resize_start_pos.bind(this));
@ -400,9 +400,9 @@ bricks.PopupWindow = class extends bricks.Popup {
}
}
build_title_bar(){
var icon = new bricks.Icon({
var icon = new bricks.Svg({
rate:this.opts.rate,
url:this.opts.icon || bricks_resource('imgs/app.png')
url:this.opts.icon || bricks_resource('imgs/app.svg')
});
this.title_bar.add_widget(icon);
this.tb_w = new bricks.IconBar( {
@ -412,19 +412,19 @@ bricks.PopupWindow = class extends bricks.Popup {
tools:[
{
name:'delete',
icon:bricks_resource('imgs/app_delete.png'),
icon:bricks_resource('imgs/app_delete.svg'),
dynsize:true,
tip:'Destroy this window'
},
{
name:'minimax',
icon:bricks_resource('imgs/app_minimax.png'),
icon:bricks_resource('imgs/app_minimax.svg'),
dynsize:true,
tip:'minimax this window'
},
{
name:'fullscreen',
icon:bricks_resource('imgs/app_fullscreen.png'),
icon:bricks_resource('imgs/app_fullscreen.svg'),
dynsize:true,
tip:'fullscreen this window'
}

View File

@ -197,15 +197,15 @@ bricks.QAFrame = class extends bricks.VBox {
padding: '6px'
});
/*
var imagew = new bricks.Icon({
var imagew = new bricks.Svg({
rate:1.7,
padding: '6px',
url: bricks_resource('imgs/camera.png')
url: bricks_resource('imgs/camera.svg')
});
var videow = new bricks.Icon({
var videow = new bricks.Svg({
rate: 1.7,
padding: '6px',
url: bricks_resource('imgs/recorder.png')
url: bricks_resource('imgs/recorder.svg')
});
this.bottom_w.add_widget(imagew);
this.bottom_w.add_widget(videow);

View File

@ -106,8 +106,8 @@ bricks.Toolbar = class extends bricks.Layout {
}
add_removable(item){
if (! item.tool_opts.removable) return;
var img_src = bricks_resource('imgs/delete.png');
var image = new bricks.Icon({url:img_src});
var img_src = bricks_resource('imgs/delete.svg');
var image = new bricks.Svg({url:img_src});
if (image){
item.add_widget(image);
image.bind('click',this.remove_item.bind(this, item));

View File

@ -245,9 +245,9 @@ bricks.Tree = class extends bricks.VScrollPanel {
var toolbar = bricks.extend({}, this.toolbar);
var tools = [];
if (this.editable){
tools.push({icon:bricks_resource('imgs/add.png'), name:'add'});
tools.push({icon:bricks_resource('imgs/update.png'), name:'update'});
tools.push({icon:bricks_resource('imgs/delete.png'), name:'delete'});
tools.push({icon:bricks_resource('imgs/add.svg'), name:'add'});
tools.push({icon:bricks_resource('imgs/update.svg'), name:'update'});
tools.push({icon:bricks_resource('imgs/delete.svg'), name:'delete'});
}
if (toolbar.tools){
toolbar.tools.forEach(f => tools.push(f));

View File

@ -60,7 +60,7 @@ bricks.VadText = class extends bricks.VBox {
super(opts);
this.button = new bricks.Button({
label:'start',
icon:bricks_resource('imgs/speak.png')
icon:bricks_resource('imgs/speak.svg')
});
this.audio = new bricks.AudioPlayer({});
this.audio.set_css('filler');

View File

@ -20,11 +20,11 @@ bricks.RoleOutput = class extends bricks.VBox {
var hb = new bricks.HBox({width:'100%', cheight:2});
var default_icon;
if (this.role == 'llm'){
default_icon = bricks_resource('imgs/llm.png')
default_icon = bricks_resource('imgs/llm.svg')
} else {
defautl_icon = bricks_resource('imgs/user.png')
defautl_icon = bricks_resource('imgs/user.svg')
}
this.img = new bricks.Icon({
this.img = new bricks.Svg({
rate:2,
tip:this.opts.model,
url:this.icon || default_icon
@ -59,8 +59,8 @@ bricks.RoleOutput = class extends bricks.VBox {
otext:'结果满意吗?',
i18n:true,
});
var likew = new bricks.Icon({rate:2, url:bricks_resource('imgs/like.png')});
var unlikew = new bricks.Icon({rate:2, url:bricks_resource('imgs/unlike.png')});
var likew = new bricks.Svg({rate:2, url:bricks_resource('imgs/like.svg')});
var unlikew = new bricks.Svg({rate:2, url:bricks_resource('imgs/unlike.svg')});
likew.bind('click', this.estimate_llm.bind(this, 1));
unlikew.bind('click', this.estimate_llm.bind(this, -1))
this.estimate_w.add_widget(txtw);
@ -157,10 +157,10 @@ bricks.LlmModel = class extends bricks.JsWidget {
render_title(){
var w = new bricks.HBox({padding:'15px'});
w.bind('click', this.show_setup_panel.bind(this))
var img = new bricks.Icon({
var img = new bricks.Svg({
rate:2,
tip:this.opts.model,
url:this.opts.icon||bricks_resource('imgs/llm.png')
url:this.opts.icon||bricks_resource('imgs/llm.svg')
});
// var txt = new bricks.Text({text:this.opts.model});
w.add_widget(img);
@ -294,16 +294,16 @@ bricks.LlmIO = class extends bricks.VBox {
this.llmmodels = [];
this.title_w = new bricks.HBox({cheight:3});
var bottom_box = new bricks.HBox({cheight:3});
this.i_w = new bricks.Icon({
this.i_w = new bricks.Svg({
rate:2,
url:bricks_resource('imgs/input.png'),
url:bricks_resource('imgs/input.svg'),
margin:'14px',
tip:'input data',
css:'clickable'
});
this.nm_w = new bricks.Icon({
this.nm_w = new bricks.Svg({
rate:2,
url:bricks_resource('imgs/add.png'),
url:bricks_resource('imgs/add.svg'),
margin:'14px',
tip:'add new model',
css:'clickable'
@ -340,7 +340,7 @@ bricks.LlmIO = class extends bricks.VBox {
var rect = this.showRectage();
var opts = {
title:"select model",
icon:bricks_resource('imgs/search.png'),
icon:bricks_resource('imgs/search.svg'),
auto_destroy:true,
auto_open:true,
auto_dismiss:false,
@ -422,7 +422,7 @@ bricks.LlmIO = class extends bricks.VBox {
var rect = this.showRectage();
var opts = {
title:"input data",
icon:bricks_resource('imgs/input.png'),
icon:bricks_resource('imgs/input.svg'),
auto_destroy:true,
auto_open:true,
auto_dismiss:false,
@ -460,7 +460,7 @@ bricks.LlmIO = class extends bricks.VBox {
var w = await bricks.widgetBuild(this.input_view, this.o_w, data);
w.set_css(this.msg_css||'user_msg');
w.set_css('filler');
var img = new bricks.Icon({rate:2,url:this.user_icon||bricks_resource('imgs/user.png')});
var img = new bricks.Svg({rate:2,url:this.user_icon||bricks_resource('imgs/user.svg')});
box.add_widget(new bricks.BlankIcon({rate:2, flexShrink:0}));
box.add_widget(w);
box.add_widget(img);