Skip to content

Commit

Permalink
Fix electron BrowserWindow and modify calculator view
Browse files Browse the repository at this point in the history
  • Loading branch information
nonodev96 committed Jun 28, 2022
1 parent a11d21a commit 3d3b639
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 66 deletions.
52 changes: 26 additions & 26 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@ function createWindow(): BrowserWindow {
// Create the browser window.
win = new BrowserWindow({
// titleBarStyle: 'hiddenInset',
x: 0,
y: 0,
width: size.width,
height: size.height,
minWidth: 400,
minHeight: 400,
x: 0,
y: 0,
width: size.width,
height: size.height,
minWidth: 400,
minHeight: 400,
webPreferences: {
nodeIntegration: true,
nativeWindowOpen: true,
allowRunningInsecureContent: (isServe),
contextIsolation: false, // false if you want to run 2e2 test with Spectron
// nativeWindowOpen: true,
// enableRemoteModule: true // true if you want to run 2e2 test with Spectron or use remote module in renderer context (ie. Angular)
nodeIntegration: true,
allowRunningInsecureContent: isServe,
contextIsolation: false, // false if you want to run 2e2 test with Spectron
},
});

Expand All @@ -48,7 +48,7 @@ function createWindow(): BrowserWindow {
win.loadURL(url.format({
pathname: path.join(__dirname, "dist/index.html"),
protocol: "file:",
slashes: true
slashes: true
}));
}

Expand All @@ -74,18 +74,18 @@ try {
let alwaysOnTop = false;
app.whenReady().then(() => {
const image = nativeImage.createFromPath(path.join(__dirname, "dist/assets/icons/faviconWhite.512x512.png"));
tray = new Tray(image.resize({width: 20, height: 20}));
tray = new Tray(image.resize({ width: 20, height: 20 }));
const contextMenu = Menu.buildFromTemplate([
{
label: "Always on top",
type: "checkbox",
label: "Always on top",
type: "checkbox",
checked: alwaysOnTop,
click: () => {
click: () => {
alwaysOnTop = !alwaysOnTop;
if (win != null) win.setAlwaysOnTop(alwaysOnTop);
}
},
{type: 'separator'},
{ type: 'separator' },
{
label: "Reload app",
click: async () => {
Expand All @@ -95,7 +95,7 @@ try {
await win.loadURL(url.format({
pathname: path.join(__dirname, "dist/index.html"),
protocol: "file:",
slashes: true
slashes: true
}));
}
// await shell.openExternal("https://electronjs.org");
Expand Down Expand Up @@ -125,21 +125,21 @@ try {

ipcMain.on("thumder-notification", (_$event, _args) => {
const options: NotificationConstructorOptions = {
title: "Custom Notification",
title: "Custom Notification",
subtitle: "Subtitle of the Notification",
body: "Body of Custom Notification",
silent: false,
body: "Body of Custom Notification",
silent: false,
// icon: path.join(__dirname, "./src/assets/image.png"),
// sound: path.join(__dirname, "./src/assets/sound.mp3"),
hasReply: true,
timeoutType: "never",
hasReply: true,
timeoutType: "never",
replyPlaceholder: "Reply Here",
urgency: "critical",
closeButtonText: "Close Button",
actions: [{
urgency: "critical",
closeButtonText: "Close Button",
actions: [ {
type: "button",
text: "Show Button"
}]
} ]
};
const customNotification = new Notification(options);
customNotification.show();
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "thumder",
"version": "1.6.0",
"version": "1.6.1",
"private": true,
"description": "TFG - THUMDER (THe UltiMate Dlx EmulatoR): emulador multiplataforma DLX con fines didácticos",
"keywords": [
Expand Down
122 changes: 83 additions & 39 deletions src/app/views/_auth/calculator/calculator.view.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="card" >
<div class="card-header" >
<div class="card">
<div class="card-header">
<h3 class="card-title">
<!-- Drag button -->
<ng-content></ng-content>
Expand Down Expand Up @@ -36,8 +36,7 @@ <h3 class="card-title">
<div class="input-group-prepend">
<span class="input-group-text">0x</span>
</div>
<input type="text" id="byte_hex"
class="form-control"
<input type="text" id="byte_hex" class="form-control"
[ngModelOptions]="{standalone: true}"
[ngModel]="binary08_Hexadecimal"
(ngModelChange)="binary08_Hexadecimal=$event">
Expand All @@ -51,10 +50,18 @@ <h3 class="card-title">
<div class="col-5">
<div class="form-group">
<label for="byte_binary">{{ 'TYPE_DATA.BYTE' | translate }}</label>
<input type="text" class="form-control" id="byte_binary"
[ngModelOptions]="{standalone: true}"
[(ngModel)]="binary08_Binary"
(ngModelChange)="binary08_Binary=$event">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">0b</span>
</div>
<input type="text" id="byte_binary" class="form-control"
[ngModelOptions]="{standalone: true}"
[(ngModel)]="binary08_Binary"
(ngModelChange)="binary08_Binary=$event">
<div class="input-group-append">
<span class="input-group-text">in binary</span>
</div>
</div>
</div>
</div>
</div>
Expand All @@ -76,8 +83,7 @@ <h3 class="card-title">
<div class="input-group-prepend">
<span class="input-group-text">0x</span>
</div>
<input type="text" id="halfword_hex"
class="form-control"
<input type="text" id="halfword_hex" class="form-control"
[ngModelOptions]="{standalone: true}"
[ngModel]="binary16_Hexadecimal"
(ngModelChange)="binary16_Hexadecimal=$event">
Expand All @@ -91,19 +97,26 @@ <h3 class="card-title">
<div class="col-5">
<div class="form-group">
<label for="halfword_binary">{{ 'TYPE_DATA.HALF_WORD' | translate }}</label>
<input type="text" class="form-control" id="halfword_binary"
[ngModelOptions]="{standalone: true}"
[(ngModel)]="binary16_Binary"
(ngModelChange)="binary16_Binary=$event">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">0b</span>
</div>
<input type="text" class="form-control" id="halfword_binary"
[ngModelOptions]="{standalone: true}"
[(ngModel)]="binary16_Binary"
(ngModelChange)="binary16_Binary=$event">
<div class="input-group-append">
<span class="input-group-text">in binary</span>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-3">
<div class="form-group">
<label for="word_value">{{ 'TYPE_DATA.WORD' | translate }} Uint</label>
<input type="number" class="form-control" id="word_value"
step="1"
<input type="number" class="form-control" id="word_value" step="1"
[ngModelOptions]="{standalone: true}"
[(ngModel)]="binary32_Value">
</div>
Expand All @@ -116,8 +129,7 @@ <h3 class="card-title">
<div class="input-group-prepend">
<span class="input-group-text">0x</span>
</div>
<input type="text" id="word_hex"
class="form-control"
<input type="text" id="word_hex" class="form-control"
[ngModelOptions]="{standalone: true}"
[ngModel]="binary32_Hexadecimal"
(ngModelChange)="binary32_Hexadecimal=$event">
Expand All @@ -131,18 +143,26 @@ <h3 class="card-title">
<div class="col-5">
<div class="form-group">
<label for="word_binary">{{ 'TYPE_DATA.WORD' | translate }}</label>
<input type="text" class="form-control" id="word_binary"
[ngModelOptions]="{standalone: true}"
[(ngModel)]="binary32_Binary"
(ngModelChange)="binary32_Binary=$event">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">0b</span>
</div>
<input type="text" id="word_binary" class="form-control"
[ngModelOptions]="{standalone: true}"
[(ngModel)]="binary32_Binary"
(ngModelChange)="binary32_Binary=$event">
<div class="input-group-append">
<span class="input-group-text">in binary</span>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-3">
<div class="form-group">
<label for="word_value_int">{{ 'TYPE_DATA.WORD' | translate }} Int</label>
<input type="number" class="form-control" id="word_value_int"
<input type="number" id="word_value_int" class="form-control"
step="1"
[ngModelOptions]="{standalone: true}"
[(ngModel)]="binary32Int_Value">
Expand All @@ -156,8 +176,7 @@ <h3 class="card-title">
<div class="input-group-prepend">
<span class="input-group-text">0x</span>
</div>
<input type="text" id="word_hex_int"
class="form-control"
<input type="text" id="word_hex_int" class="form-control"
[ngModelOptions]="{standalone: true}"
[ngModel]="binary32Int_Hexadecimal"
(ngModelChange)="binary32Int_Hexadecimal=$event">
Expand All @@ -171,10 +190,18 @@ <h3 class="card-title">
<div class="col-5">
<div class="form-group">
<label for="word_binary_int">{{ 'TYPE_DATA.WORD' | translate }}</label>
<input type="text" class="form-control" id="word_binary_int"
[ngModelOptions]="{standalone: true}"
[(ngModel)]="binary32Int_Binary"
(ngModelChange)="binary32Int_Binary=$event">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">0b</span>
</div>
<input type="text" id="word_binary_int" class="form-control"
[ngModelOptions]="{standalone: true}"
[(ngModel)]="binary32Int_Binary"
(ngModelChange)="binary32Int_Binary=$event">
<div class="input-group-append">
<span class="input-group-text">in binary</span>
</div>
</div>
</div>
</div>
</div>
Expand Down Expand Up @@ -213,10 +240,20 @@ <h3 class="card-title">
<div class="col-5">
<div class="form-group">
<label for="ieee754_binary">{{ 'TYPE_DATA.IEEE754' | translate }}</label>
<input type="text" class="form-control" id="ieee754_binary"
[ngModelOptions]="{standalone: true}"
[(ngModel)]="binary32_IEEE754_Binary"
(ngModelChange)="binary32_IEEE754_Binary=$event">
<div class="input-group mb-3">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">0b</span>
</div>
<input type="text" class="form-control" id="ieee754_binary"
[ngModelOptions]="{standalone: true}"
[(ngModel)]="binary32_IEEE754_Binary"
(ngModelChange)="binary32_IEEE754_Binary=$event">
<div class="input-group-append">
<span class="input-group-text">in binary</span>
</div>
</div>
</div>
</div>
</div>
</div>
Expand All @@ -225,8 +262,7 @@ <h3 class="card-title">
<div class="col-3">
<div class="form-group">
<label for="ieee754_number_64">{{ 'TYPE_DATA.IEEE754_64' | translate }}</label>
<input type="number" class="form-control" id="ieee754_number_64"
step="0.1"
<input type="number" id="ieee754_number_64" class="form-control" step="0.1"
[ngModelOptions]="{standalone: true}"
[(ngModel)]="binary64_IEEE754_Value">
</div>
Expand Down Expand Up @@ -254,10 +290,18 @@ <h3 class="card-title">
<div class="col-5">
<div class="form-group">
<label for="ieee754_binary_64">{{ 'TYPE_DATA.IEEE754_64' | translate }}</label>
<input type="text" class="form-control" id="ieee754_binary_64"
[ngModelOptions]="{standalone: true}"
[(ngModel)]="binary64_IEEE754_Binary"
(ngModelChange)="binary64_IEEE754_Binary=$event">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">0b</span>
</div>
<input type="text" class="form-control" id="ieee754_binary_64"
[ngModelOptions]="{standalone: true}"
[(ngModel)]="binary64_IEEE754_Binary"
(ngModelChange)="binary64_IEEE754_Binary=$event">
<div class="input-group-append">
<span class="input-group-text">in binary</span>
</div>
</div>
</div>
</div>
</div>
Expand Down

0 comments on commit 3d3b639

Please sign in to comment.