Skip to content

Commit

Permalink
1st release build
Browse files Browse the repository at this point in the history
  • Loading branch information
divamgupta committed Sep 10, 2022
1 parent d061e67 commit 384001c
Show file tree
Hide file tree
Showing 14 changed files with 491 additions and 227 deletions.
2 changes: 1 addition & 1 deletion electron_app/afterSignHook.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = async function (params) {

console.log('afterSign hook triggered', params);

let appId = 'com.linerai.stablediffusionui'
let appId = 'com.linerai.diffusionbee'

let appPath = path.join(params.appOutDir, `${params.packager.appInfo.productFilename}.app`);
if (!fs.existsSync(appPath)) {
Expand Down
245 changes: 134 additions & 111 deletions electron_app/package-lock.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions electron_app/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "StableDiffusionGUI",
"name": "DiffusionBee",
"version": "0.1.0",
"build_number": "0001",
"website": "https://divam.io",
"description": "StableDiffusionGUI",
"is_dev": true,
"website": "https://github.com/divamgupta/diffusionbee-stable-diffusion-ui",
"description": "Diffusion Bee - GUI for stable diffusion.",
"is_dev": false,
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
Expand Down Expand Up @@ -47,7 +47,7 @@
"@vue/cli-service": "~4.5.0",
"babel-eslint": "^10.1.0",
"electron": "^13.0.0",
"electron-builder": "^23.0.2",
"electron-builder": "^23.3.3",
"electron-devtools-installer": "^3.1.0",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^6.2.2",
Expand Down
51 changes: 26 additions & 25 deletions electron_app/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,15 @@
<SplashScreen v-if="app_state.show_splash_screen"></SplashScreen>
</transition>
</div>
<ApplicationFrame v-else title="DiffusionBee - Stable Diffusion GUI">
<ApplicationFrame v-else title="DiffusionBee - Stable Diffusion GUI"

@menu_item_click_about="show_about"
@menu_item_click_help="show_help"
@menu_item_click_close="close_window"

>


<template v-slot:txt2img>
<ImgGenerate :app_state="app_state"></ImgGenerate>

Expand Down Expand Up @@ -52,7 +60,7 @@ import SplashScreen from './components_bare/SplashScreen.vue'
import ApplicationFrame from './components_bare/ApplicationFrame.vue'
import ImgGenerate from './components/ImgGenerate.vue'
native_alert;
export default
Expand All @@ -78,7 +86,7 @@ export default
setTimeout( function(){
that.app_state.is_start_screen = false;
} , 1000)
} , 4000)
},
Expand Down Expand Up @@ -126,14 +134,7 @@ export default
},
show_about(){
window.ipcRenderer.sendSync('show_about', '');
},
show_help(){
window.ipcRenderer.sendSync('open_url', "__domain__/documentation");
} ,
change_startscreen_tab(tab_name){
let that = this;
setTimeout( function(){
Expand All @@ -142,24 +143,12 @@ export default
},
export_dataset(){
if(Object.keys(this.app_state.dataset).length == 0)
{
native_alert("Your dataset is empty. Nothing to export.")
return;
}
let output_path = window.ipcRenderer.sendSync('save_dialog', '');
if(output_path)
send_to_py("exds " + output_path );
},
check_for_updates(){
let xmlHttp = new XMLHttpRequest();
let user_id = window.ipcRenderer.sendSync('get_instance_id' , '');
let updates_url = "https://frq9ygdtq6.execute-api.us-east-1.amazonaws.com/liner_check_updates?user_id="+user_id;
let updates_url = "https://aeyfmzu2ac.execute-api.us-east-1.amazonaws.com/check_diffusionbee_updates?user_id="+user_id;
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
{
Expand Down Expand Up @@ -201,9 +190,21 @@ export default
this.should_show_dialog_on_quit = false;
window.ipcRenderer.sendSync('dont_show_dialog_on_quit', '');
}
} ,
show_about(){
window.ipcRenderer.sendSync('show_about', '');
},
show_help(){
window.ipcRenderer.sendSync('open_url', "https://github.com/divamgupta/diffusionbee-stable-diffusion-ui");
} ,
close_window(){
window.ipcRenderer.sendSync('close_window', '');
}
},
Expand Down
Binary file added electron_app/src/assets/logo_splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
148 changes: 82 additions & 66 deletions electron_app/src/assets/logo_splash.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion electron_app/src/bridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ function start_bridge() {
python.stdout.on('data', function(data) {
console.log("Python response: ", data.toString('utf8'));

win.webContents.send('to_renderer', 'adlg ' + data.toString('utf8'));

if(! data.toString().includes("___U_P_D_A_T_E___"))
win.webContents.send('to_renderer', 'adlg ' + data.toString('utf8'));


if (win) {
Expand Down
23 changes: 19 additions & 4 deletions electron_app/src/components/ImgGenerate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,10 @@
<div v-if="app_state.generated_image" style="margin-top:80px" >
<center>
<img v-if="app_state.generated_image" :src="'file://' + app_state.generated_image">
<br>
<div @click="save_image" class="l_button">Save Image</div>
</center>

<br><br><br>
</div>


Expand Down Expand Up @@ -117,7 +119,7 @@
</div>

<div class="bottom_float">
<p>Stable diffusion requires a lot of RAM. Close other applications for best speed.</p>
<p>Stable diffusion requires a lot of RAM. 16GB recommended. Close other applications for best speed.</p>
</div>

</div>
Expand All @@ -142,8 +144,8 @@ export default {
},
data() {
return {
img_w : 256,
img_h : 256 ,
img_w : 512,
img_h : 512 ,
dif_steps : 25,
guidence_scale : 7.5 ,
is_adv_options : false ,
Expand All @@ -163,6 +165,19 @@ export default {
}
send_to_py("t2im " + JSON.stringify(params))
} ,
save_image(){
if(!this.app_state.generated_image)
return;
let out_path = window.ipcRenderer.sendSync('save_dialog', '');
if(!out_path)
return
let org_path = this.app_state.generated_image.replaceAll("file://" , "")
window.ipcRenderer.sendSync('save_file', org_path+"||" +out_path);
}
},
}
Expand Down
2 changes: 1 addition & 1 deletion electron_app/src/components_bare/SplashScreen.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div class="splash_screen">
<Transition name="fade">
<img v-if=show width="60%" src="@/assets/logo_splash.svg">
<img v-if=show width="60%" src="@/assets/logo_splash.png">
</Transition>
</div>
</template>
Expand Down
38 changes: 37 additions & 1 deletion electron_app/src/native_functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,24 @@ function bind_window_native_functions(w) {
let is_windows = process.platform.startsWith('win');



console.log(require('os').freemem()/(1000000000) + " Is the free memory")
console.log(require('os').totalmem()/(1000000000) + " Is the total memory")


ipcMain.on('save_dialog', (event, arg) => {

let save_path = dialog.showSaveDialogSync()
let save_path = dialog.showSaveDialogSync({
filters: [{
name: 'Image',
extensions: ['png']
}]
})

event.returnValue = save_path;
} )

console.log(require('os').release() + " ohoho")



Expand Down Expand Up @@ -108,6 +119,15 @@ ipcMain.on('open_url', (event, url) => {



ipcMain.on('save_file', (event, arg) => {
let p1 = arg.split("||")[0];
let p2 = arg.split("||")[1];
require('fs').copyFileSync(p1, p2);
event.returnValue = '';
})





ipcMain.on('show_dialog_on_quit', (event, msg) => {
Expand Down Expand Up @@ -260,6 +280,22 @@ ipcMain.on('native_confirm', (event, arg) => {



ipcMain.on('close_window', (event, arg) => {

if (win) {

win.close()
event.returnValue = true ;
}
else{
event.returnValue = false ;
}

})




ipcMain.on('native_alert', (event, arg) => {

if (win) {
Expand Down
3 changes: 2 additions & 1 deletion electron_app/vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ module.exports = {
"hardenedRuntime": true,
"entitlements": "build/entitlements.mac.plist",
"entitlementsInherit": "build/entitlements.mac.plist",
"minimumSystemVersion": "12.5.1",
"extendInfo": {

"LSMinimumSystemVersion": "12.5.1"
} ,
"target": {
"target": "dmg",
Expand Down
Loading

0 comments on commit 384001c

Please sign in to comment.