Explorar el Código

[ADD] initial commit

Gogs hace 7 años
commit
006677c8d1
Se han modificado 7 ficheros con 133 adiciones y 0 borrados
  1. 4 0
      .gitignore
  2. 17 0
      README.md
  3. 19 0
      index.html
  4. 13 0
      launch.json
  5. 53 0
      main.js
  6. 24 0
      package.json
  7. 3 0
      renderer.js

+ 4 - 0
.gitignore

@@ -0,0 +1,4 @@
+node_modules
+.vscode
+package-lock.json
+yarn.lock

+ 17 - 0
README.md

@@ -0,0 +1,17 @@
+# Odoo Electron
+
+Tentativa de versión de escritorio de Odoo
+
+## Instalación
+
+### Requisitos
+1. Node.js en su última versión
+2. Yarn en su última versión
+
+### Pasos
+1. Clonar el repositorio
+2. Situar el cliente del terminal en la raíz del proyecto
+3. Ejecutar yarn install
+4. Ejecutar yarn start
+
+# ;)

+ 19 - 0
index.html

@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <meta charset="UTF-8">
+    <title>Hello World!</title>
+  </head>
+  <body>
+    <h1>Hello World!</h1>
+    <!-- All of the Node.js APIs are available in this renderer process. -->
+    We are using Node.js <script>document.write(process.versions.node)</script>,
+    Chromium <script>document.write(process.versions.chrome)</script>,
+    and Electron <script>document.write(process.versions.electron)</script>.
+  </body>
+
+  <script>
+    // You can also require other files to run in this process
+    require('./renderer.js')
+  </script>
+</html>

+ 13 - 0
launch.json

@@ -0,0 +1,13 @@
+{
+  "version": "0.2.0",
+  "configurations": [
+    {
+      "name": "Debug Main Process",
+      "type": "node",
+      "request": "launch",
+      "cwd": "${workspaceRoot}",
+      "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron",
+      "program": "${workspaceRoot}/main.js"
+    }
+  ]
+}

+ 53 - 0
main.js

@@ -0,0 +1,53 @@
+const electron = require('electron')
+// require('electron-debug')({ showDevTools: true })
+const app = electron.app
+
+const BrowserWindow = electron.BrowserWindow
+
+const path = require('path')
+const url = require('url')
+
+let mainWindow
+
+function createWindow () {
+    mainWindow = new BrowserWindow({
+        toobar: true,
+        width: 800, 
+        height: 600,
+        webPreferences: {
+            nodeIntegration: false
+        }
+    })
+
+  // and load the index.html of the app.
+  // mainWindow.loadURL(url.format({
+  //   pathname: path.join(__dirname, 'index.html'),
+  //   protocol: 'file:',
+  //   slashes: true
+  // }))
+    mainWindow.loadURL('http://181.40.66.126:10500')
+    // mainWindow.setMenu(null)
+    mainWindow.setMenuBarVisibility(false)
+    mainWindow.maximize()
+    mainWindow.on('closed', function () {
+        mainWindow = null
+    })
+}
+
+app.on('ready', createWindow)
+app.on('window-all-closed', function () {
+    if (process.platform !== 'darwin') {
+        app.quit()
+    }
+})
+
+app.on('activate', function () {
+  // On OS X it's common to re-create a window in the app when the
+  // dock icon is clicked and there are no other windows open.
+    if (mainWindow === null) {
+        createWindow()
+    }
+})
+
+// In this file you can include the rest of your app's specific main process
+// code. You can also put them in separate files and require them here.

+ 24 - 0
package.json

@@ -0,0 +1,24 @@
+{
+  "name": "odoo-electron",
+  "version": "1.0.0",
+  "description": "Odoo Electron Application",
+  "main": "main.js",
+  "scripts": {
+    "start": "electron ."
+  },
+  "repository": "https://github.com/electron/electron-quick-start",
+  "keywords": [
+    "Electron",
+    "quick",
+    "start",
+    "tutorial",
+    "demo"
+  ],
+  "author": "GitHub",
+  "license": "CC0-1.0",
+  "devDependencies": {
+    "devtron": "^1.4.0",
+    "electron": "~1.6.2",
+    "electron-debug": "^1.3.0"
+  }
+}

+ 3 - 0
renderer.js

@@ -0,0 +1,3 @@
+// This file is required by the index.html file and will
+// be executed in the renderer process for that window.
+// All of the Node.js APIs are available in this process.