Hi, PFA patch
This contains: 1] All shortcuts' list which we are using in pgAdmin4. 2] Fixed shortcut display tooltips. -- *Harshal Dhumal* *Software Engineer* EnterpriseDB India: http://www.enterprisedb.com The Enterprise PostgreSQL Company On Thu, Jun 30, 2016 at 2:34 PM, Dave Page <dp...@pgadmin.org> wrote: > Hi Harshal, > > On Thu, Jun 30, 2016 at 7:59 AM, Harshal Dhumal > <harshal.dhu...@enterprisedb.com> wrote: > > Hi Dave, > > > > Somehow control key is mapped to Command key in Mac. So on Mac shortcuts > are > > Shift+Command+E, Shift+Command+X, Shift+Command+A > > OK, those work, but I think we need to take a step back here (partly > because Cmd+Shift+A seems to be Select All in CodeMirror on Mac). I've > committed the patch now, but changed Ctrl+Shift+A to Ctrl+Shift+N. > > Can you please work on the following: > > 1) Create a table of shortcuts from our runtime, our web app, and > CodeMirror. This should list: > > Component (e.g. runtime, CodeMirror, Query Tool) > Standard shortcut (e.g. Ctrl+Shift+A) > Mac shortcut (e.g. Cmd+Shift+A) > Function (e.g. Explain Analyze or Select All) > > Let's make this as complete and accurate as possible, so it can be > included in the documentation, and used by us to select or > de-duplicate shortcuts. > Added shortcuts' list. > > 2) Confirm that the shortcuts we're using in our runtime and web > application don't conflict with any in CodeMirror (or web browsers, in > the case of the web app). > Tested. No other conflicting shortcuts found. > > 3) Update the web application so the shortcuts are correctly displayed > on Mac automatically - e.g. the tooltips and menus should show > Cmd+Shift not Ctrl+Shift > Fixed > > 4) Investigate #1360, and ensure that the CodeMirror shortcuts work > consistently between the runtime and browsers on all platforms. > Investigating now. > > 5) Investigate any remaining shortcuts that don't work as expected. > Investigating now.: Codemirror shortcut (Cmd/Ctrl+Shift+A) "Select all" only works on Mac (web/runtime) not on linux platform (haven't tested on windows) > > Thanks, Dave. > > -- > Dave Page > Blog: http://pgsnake.blogspot.com > Twitter: @pgsnake > > EnterpriseDB UK: http://www.enterprisedb.com > The Enterprise PostgreSQL Company >
diff --git a/web/keyboard_shortcuts.txt b/web/keyboard_shortcuts.txt new file mode 100644 index 0000000..1684dc0 --- /dev/null +++ b/web/keyboard_shortcuts.txt @@ -0,0 +1,28 @@ ++--------------------------------------------------------------------------------+ +| pgAdmin4 keyboard shortcuts | ++--------------------------------------------------------------------------------+ +================================================================================== + + + ++-----------------+-------------------+-------------------+----------------------+ +| Component | Function | Standard shortcut | Mac shortcut | ++-----------------+-------------------+-------------------+----------------------+ +| | Open Url | Alt+Shift+U | Alt+Shift+U | +| +-------------------+-------------------+----------------------+ +| pgAdmin4 runtime| Set python path | Alt+Shift+P | Alt+Shift+P | +| +-------------------+-------------------+----------------------+ +| | Open about dialog | Alt+Shift+A | Alt+Shift+A | ++-----------------+-------------------+-------------------+----------------------+ +| | Execute query | Ctrl+Shift+E | Cmd+Shift+E (runtime)| +| | | | Ctrl+Shift+E (web) | +| +-------------------+-------------------+----------------------+ +| Query tool | Explain | Ctrl+Shift+X | Cmd+Shift+X (runtime)| +| | | | Ctrl+Shift+X (web) | +| +-------------------+-------------------+----------------------+ +| | Explain analyze | Ctrl+Shift+N | Cmd+Shift+N (runtime)| +| | | | Ctrl+Shift+N (web) | ++-----------------+-------------------+-------------------+----------------------+ +| Codemirror | Select all text | | Cmd+Shift+A (runtime)| +| (query editor) | in editor | | Ctrl+Shift+A (web) | ++-----------------+-------------------+-------------------+----------------------+ diff --git a/web/pgadmin/tools/datagrid/__init__.py b/web/pgadmin/tools/datagrid/__init__.py index 3a7625f..3580638 100644 --- a/web/pgadmin/tools/datagrid/__init__.py +++ b/web/pgadmin/tools/datagrid/__init__.py @@ -23,7 +23,7 @@ from pgadmin.utils import PgAdminModule from pgadmin.utils.ajax import make_json_response, bad_request, \ internal_server_error -from config import PG_DEFAULT_DRIVER +from config import PG_DEFAULT_DRIVER, SERVER_MODE class DataGridModule(PgAdminModule): @@ -171,10 +171,23 @@ def panel(trans_id, is_query_tool, editor_title): if "linux" in _platform: is_linux_platform = True + if not SERVER_MODE and \ + 'mac' in request.headers.environ['HTTP_USER_AGENT'].lower(): + execute_shortcut = gettext("Execute/Refresh (Cmd+Shift+E)") + explain_shortcut = gettext("Explain (Cmd+Shift+X)") + explain_analyse_shortcut = gettext("Explain analyze (Cmd+Shift+N)") + else: + execute_shortcut = gettext("Execute/Refresh (Ctrl+Shift+E)") + explain_shortcut = gettext("Explain (Ctrl+Shift+X)") + explain_analyse_shortcut = gettext("Explain analyze (Ctrl+Shift+N)") + return render_template("datagrid/index.html", _=gettext, uniqueId=trans_id, is_query_tool=is_query_tool, editor_title=editor_title, script_type_url=sURL, is_desktop_mode=app.PGADMIN_RUNTIME, - is_linux=is_linux_platform) + is_linux=is_linux_platform, + execute_shortcut=execute_shortcut, + explain_shortcut=explain_shortcut, + explain_analyse_shortcut=explain_analyse_shortcut) @blueprint.route( diff --git a/web/pgadmin/tools/datagrid/templates/datagrid/index.html b/web/pgadmin/tools/datagrid/templates/datagrid/index.html index b138a46..f4433e8 100644 --- a/web/pgadmin/tools/datagrid/templates/datagrid/index.html +++ b/web/pgadmin/tools/datagrid/templates/datagrid/index.html @@ -69,7 +69,7 @@ </div> <div class="btn-group" role="group" aria-label=""> <button id="btn-flash" type="button" class="btn btn-default" style="width: 40px;" - title="{{ _('Execute/Refresh (Ctrl+Shift+E)') }}"> + title="{{ execute_shortcut }}"> <i class="fa fa-bolt" aria-hidden="true"></i> </button> <button id="btn-query-dropdown" type="button" class="btn btn-default dropdown-toggle" @@ -79,12 +79,12 @@ <ul class="dropdown-menu dropdown-menu"> <li> <a id="btn-explain" href="#"> - <span>{{ _('Explain (Ctrl+Shift+X)') }}</span> + <span>{{ explain_shortcut }}</span> </a> </li> <li> <a id="btn-explain-analyze" href="#"> - <span>{{ _('Explain analyze (Ctrl+Shift+N)') }}</span> + <span>{{ explain_analyse_shortcut }}</span> </a> </li> <li class="divider"></li>
-- Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers