2
0
mirror of https://github.com/frappe/books.git synced 2024-12-23 11:29:03 +00:00

frappe.getPDF for electron

This commit is contained in:
Faris Ansari 2018-04-16 15:02:56 +05:30
parent f310fd671e
commit fbb283bf76
2 changed files with 36 additions and 6 deletions

View File

@ -1,8 +1,10 @@
const frappe = require('frappejs');
const path = require('path'); const path = require('path');
const electron = require('frappejs/client/electron'); const electron = require('frappejs/client/electron');
const { writeFile } = require('frappejs/server/utils'); const { writeFile } = require('frappejs/server/utils');
const appClient = require('../client'); const appClient = require('../client');
const SetupWizard = require('../setup'); const SetupWizard = require('../setup');
const { getPDFForElectron } = require('frappejs/server/pdf');
const fs = require('fs'); const fs = require('fs');
@ -20,6 +22,10 @@ require.extensions['.html'] = function (module, filename) {
settings = {} settings = {}
} }
frappe.electronConfig = settings;
frappe.getPDF = getPDFForElectron;
if (settings.dbPath) { if (settings.dbPath) {
dbPath = settings.dbPath; dbPath = settings.dbPath;
electron.start({ electron.start({
@ -50,10 +56,14 @@ require.extensions['.html'] = function (module, filename) {
dbPath, dbPath,
models: require('../models') models: require('../models')
}).then(async () => { }).then(async () => {
await writeFile(configFilePath, JSON.stringify({ const config = {
directory: path.dirname(dbPath), directory: path.dirname(dbPath),
dbPath: dbPath dbPath: dbPath
})); };
await writeFile(configFilePath, JSON.stringify(config));
frappe.electronConfig = config;
const doc = await frappe.getDoc('AccountingSettings'); const doc = await frappe.getDoc('AccountingSettings');

28
www/dist/js/bundle.js vendored
View File

@ -4575,7 +4575,7 @@ if (typeof undefined === 'function' && undefined.amd) {
} }
}).call(commonjsGlobal); }).call(commonjsGlobal);
//# sourceMappingURL=showdown.js.map
}); });
var moment = createCommonjsModule(function (module, exports) { var moment = createCommonjsModule(function (module, exports) {
@ -23075,7 +23075,7 @@ Popper.placements = placements;
Popper.Defaults = Defaults; Popper.Defaults = Defaults;
//# sourceMappingURL=popper.js.map
var popper = Object.freeze({ var popper = Object.freeze({
@ -26974,7 +26974,7 @@ exports.Tooltip = Tooltip;
Object.defineProperty(exports, '__esModule', { value: true }); Object.defineProperty(exports, '__esModule', { value: true });
}))); })));
//# sourceMappingURL=bootstrap.js.map
}); });
unwrapExports(bootstrap); unwrapExports(bootstrap);
@ -28192,6 +28192,7 @@ object-assign
@license MIT @license MIT
*/ */
/* eslint-disable no-unused-vars */
var getOwnPropertySymbols = Object.getOwnPropertySymbols; var getOwnPropertySymbols = Object.getOwnPropertySymbols;
var hasOwnProperty = Object.prototype.hasOwnProperty; var hasOwnProperty = Object.prototype.hasOwnProperty;
var propIsEnumerable = Object.prototype.propertyIsEnumerable; var propIsEnumerable = Object.prototype.propertyIsEnumerable;
@ -28456,6 +28457,8 @@ class Tree extends baseComponent {
window.customElements.define('f-tree', Tree); window.customElements.define('f-tree', Tree);
// const keyboard = require('frappejs/client/ui/keyboard');
var tree$3 = class BaseTree extends list { var tree$3 = class BaseTree extends list {
init() { init() {
@ -41300,6 +41303,11 @@ var htmlmixed = createCommonjsModule(function (module, exports) {
}); });
}); });
// const frappe = require('frappejs');
// eslint-disable-line
// eslint-disable-line
class CodeControl extends base { class CodeControl extends base {
makeInput() { makeInput() {
if (!this.options) { if (!this.options) {
@ -49195,6 +49203,9 @@ DataTable.__version__ = packageJson.version;
module.exports = DataTable; module.exports = DataTable;
}); });
// eslint-disable-line
var modal = class Modal extends observable { var modal = class Modal extends observable {
constructor({ title, body, primary, secondary }) { constructor({ title, body, primary, secondary }) {
super(); super();
@ -57861,7 +57872,7 @@ module.exports = installCompat;
/***/ }) /***/ })
/******/ ]); /******/ ]);
}); });
//# sourceMappingURL=nunjucks.js.map
}); });
unwrapExports(nunjucks); unwrapExports(nunjucks);
@ -58093,6 +58104,10 @@ var menu = class DeskMenu {
} }
}; };
// const Search = require('./search');
const views = {}; const views = {};
views.Form = formpage; views.Form = formpage;
views.List = listpage; views.List = listpage;
@ -58873,6 +58888,10 @@ var client = {
} }
}; };
// baseclass for report
// `url` url for report
// `getColumns` return columns
var reportpage = class ReportPage extends page { var reportpage = class ReportPage extends page {
constructor({title, filterFields}) { constructor({title, filterFields}) {
super({title: title, hasRoute: true}); super({title: title, hasRoute: true});
@ -60765,6 +60784,7 @@ var client$2 = {
const countryList$1 = Object.keys(require$$0$13).sort(); const countryList$1 = Object.keys(require$$0$13).sort();
// start server
client.start({ client.start({
server: 'localhost:8000', server: 'localhost:8000',
makeDesk: 0 makeDesk: 0