瀏覽代碼

Merge branch 'develop' into dependabot/npm_and_yarn/hosted-git-info-2.8.9

version-14
Suraj Shetty 4 年之前
committed by GitHub
父節點
當前提交
6c107a4236
沒有發現已知的金鑰在資料庫的簽署中 GPG Key ID: 4AEE18F83AFDEB23
共有 9 個文件被更改,包括 44 次插入17 次删除
  1. +9
    -4
      frappe/__init__.py
  2. +11
    -3
      frappe/build.py
  3. +0
    -3
      frappe/commands/utils.py
  4. +1
    -1
      frappe/public/js/frappe/desk.js
  5. +11
    -3
      frappe/public/js/frappe/form/form.js
  6. +6
    -0
      frappe/public/scss/desk/global.scss
  7. +3
    -1
      frappe/utils/bench_helper.py
  8. +1
    -1
      frappe/utils/safe_exec.py
  9. +2
    -1
      frappe/www/printview.py

+ 9
- 4
frappe/__init__.py 查看文件

@@ -10,9 +10,16 @@ be used to build database driven apps.


Read the documentation: https://frappeframework.com/docs Read the documentation: https://frappeframework.com/docs
""" """
import os, warnings

_dev_server = os.environ.get('DEV_SERVER', False)

if _dev_server:
warnings.simplefilter('always', DeprecationWarning)
warnings.simplefilter('always', PendingDeprecationWarning)


from werkzeug.local import Local, release_local from werkzeug.local import Local, release_local
import os, sys, importlib, inspect, json, warnings
import sys, importlib, inspect, json
import typing import typing
from past.builtins import cmp from past.builtins import cmp
import click import click
@@ -31,8 +38,6 @@ __title__ = "Frappe Framework"


local = Local() local = Local()
controllers = {} controllers = {}
warnings.simplefilter('always', DeprecationWarning)
warnings.simplefilter('always', PendingDeprecationWarning)


class _dict(dict): class _dict(dict):
"""dict like object that exposes keys as attributes""" """dict like object that exposes keys as attributes"""
@@ -197,7 +202,7 @@ def init(site, sites_path=None, new_site=False):
local.meta_cache = {} local.meta_cache = {}
local.form_dict = _dict() local.form_dict = _dict()
local.session = _dict() local.session = _dict()
local.dev_server = os.environ.get('DEV_SERVER', False)
local.dev_server = _dev_server


setup_module_map() setup_module_map()




+ 11
- 3
frappe/build.py 查看文件

@@ -317,13 +317,20 @@ def clear_broken_symlinks():






def unstrip(message):
def unstrip(message: str) -> str:
"""Pads input string on the right side until the last available column in the terminal
"""
_len = len(message)
try: try:
max_str = os.get_terminal_size().columns max_str = os.get_terminal_size().columns
except Exception: except Exception:
max_str = 80 max_str = 80
_len = len(message)
_rem = max_str - _len

if _len < max_str:
_rem = max_str - _len
else:
_rem = max_str % _len

return f"{message}{' ' * _rem}" return f"{message}{' ' * _rem}"




@@ -336,6 +343,7 @@ def make_asset_dirs(hard_link=False):
start_message = unstrip(f"{'Copying assets from' if hard_link else 'Linking'} {source} to {target}") start_message = unstrip(f"{'Copying assets from' if hard_link else 'Linking'} {source} to {target}")
fail_message = unstrip(f"Cannot {'copy' if hard_link else 'link'} {source} to {target}") fail_message = unstrip(f"Cannot {'copy' if hard_link else 'link'} {source} to {target}")


# Used '\r' instead of '\x1b[1K\r' to print entire lines in smaller terminal sizes
try: try:
print(start_message, end="\r") print(start_message, end="\r")
link_assets_dir(source, target, hard_link=hard_link) link_assets_dir(source, target, hard_link=hard_link)


+ 0
- 3
frappe/commands/utils.py 查看文件

@@ -507,8 +507,6 @@ frappe.db.connect()
@pass_context @pass_context
def console(context): def console(context):
"Start ipython console for a site" "Start ipython console for a site"
import warnings

site = get_site(context) site = get_site(context)
frappe.init(site=site) frappe.init(site=site)
frappe.connect() frappe.connect()
@@ -529,7 +527,6 @@ def console(context):
if failed_to_import: if failed_to_import:
print("\nFailed to import:\n{}".format(", ".join(failed_to_import))) print("\nFailed to import:\n{}".format(", ".join(failed_to_import)))


warnings.simplefilter('ignore')
IPython.embed(display_banner="", header="", colors="neutral") IPython.embed(display_banner="", header="", colors="neutral")






+ 1
- 1
frappe/public/js/frappe/desk.js 查看文件

@@ -289,7 +289,7 @@ frappe.Application = class Application {
} }
if (!frappe.workspaces['home']) { if (!frappe.workspaces['home']) {
// default workspace is settings for Frappe // default workspace is settings for Frappe
frappe.workspaces['home'] = frappe.workspaces['build'];
frappe.workspaces['home'] = frappe.workspaces[Object.keys(frappe.workspaces)[0]];
} }
} }




+ 11
- 3
frappe/public/js/frappe/form/form.js 查看文件

@@ -1125,9 +1125,17 @@ frappe.ui.form.Form = class FrappeForm {


add_custom_button(label, fn, group) { add_custom_button(label, fn, group) {
// temp! old parameter used to be icon // temp! old parameter used to be icon
if(group && group.indexOf("fa fa-")!==-1) group = null;
var btn = this.page.add_inner_button(label, fn, group);
if(btn) {
if (group && group.indexOf("fa fa-") !== -1)
group = null;

let btn = this.page.add_inner_button(label, fn, group);

if (btn) {
// Add actions as menu item in Mobile View
let menu_item_label = group ? `${group} > ${label}` : label;
let menu_item = this.page.add_menu_item(menu_item_label, fn, false);
menu_item.parent().addClass("hidden-lg");

this.custom_buttons[label] = btn; this.custom_buttons[label] = btn;
} }
return btn; return btn;


+ 6
- 0
frappe/public/scss/desk/global.scss 查看文件

@@ -120,6 +120,12 @@ pre {
} }
} }


.hidden-lg {
@include media-breakpoint-up(md) {
display: none !important;
}
}

.visible-xs { .visible-xs {
@include media-breakpoint-up(sm) { @include media-breakpoint-up(sm) {
display: none !important; display: none !important;


+ 3
- 1
frappe/utils/bench_helper.py 查看文件

@@ -6,6 +6,7 @@ import json
import importlib import importlib
import frappe.utils import frappe.utils
import traceback import traceback
import warnings


click.disable_unicode_literals_warning = True click.disable_unicode_literals_warning = True


@@ -98,5 +99,6 @@ def get_apps():
return frappe.get_all_apps(with_internal_apps=False, sites_path='.') return frappe.get_all_apps(with_internal_apps=False, sites_path='.')


if __name__ == "__main__": if __name__ == "__main__":
if not frappe._dev_server:
warnings.simplefilter('ignore')
main() main()


+ 1
- 1
frappe/utils/safe_exec.py 查看文件

@@ -119,7 +119,7 @@ def get_safe_globals():
scrub=scrub, scrub=scrub,
guess_mimetype=mimetypes.guess_type, guess_mimetype=mimetypes.guess_type,
html2text=html2text, html2text=html2text,
dev_server=1 if os.environ.get('DEV_SERVER', False) else 0,
dev_server=1 if frappe._dev_server else 0,
run_script=run_script run_script=run_script
) )




+ 2
- 1
frappe/www/printview.py 查看文件

@@ -505,8 +505,9 @@ window.print();


// close the window after print // close the window after print
// NOTE: doesn't close if print is cancelled in Chrome // NOTE: doesn't close if print is cancelled in Chrome
// Changed timeout to 5s from 1s because it blocked mobile view rendering
setTimeout(function() { setTimeout(function() {
window.close(); window.close();
}, 1000);
}, 5000);
</script> </script>
""" """

Loading…
取消
儲存