public inbox for [email protected]  
help / color / mirror / Atom feed
From: Harshal Dhumal <[email protected]>
To: Dave Page <[email protected]>
Cc: pgadmin-hackers <[email protected]>
Subject: Re: Fix for issue RM1336 [pgadmin4]
Date: Fri, 1 Jul 2016 15:40:50 +0530
Message-ID: <CAFiP3vzaSHvdgC3y8DLeR8XHNHOA6_FXwJ4BA+WT0SJuFGFrvQ@mail.gmail.com> (raw)
In-Reply-To: <CA+OCxoy20eBO-z9jK9eNJQvoEYOCOQrB4hs-9rgLUc1V=hwN9w@mail.gmail.com>
References: <CAFiP3vxoqJ8Rd2fiXev2di1Se_WuyAZdMtUHcHG3HuHwk-vj0g@mail.gmail.com>
	<CA+OCxozZz4q4Cac8sS2wZ0OprfjOKQRqmSXQjHdd=-sBoVfsbA@mail.gmail.com>
	<CAFiP3vxfQ4=+zjLW9HR_dtYkbgfZLvKLnLZi-A3m4rbFH_A5xA@mail.gmail.com>
	<CAFiP3vznYPXdvmGj2J7i4S7e-BPUVWWUC5KFAK=Q7n6Nee5ThA@mail.gmail.com>
	<CA+OCxoza3djrtauF1VqSvqU1pXBr8gAzHD9xF1T37HbkbgEztA@mail.gmail.com>
	<CAFiP3vyTB+ceHGxwXn_w8RBmDQn9SVC3i+1kXhv=CD8UWr3=Xg@mail.gmail.com>
	<CA+OCxowGax9fd5YmTG3u82Ums0rwkETiXFQPuBokKBx_Br8BOA@mail.gmail.com>
	<CAG7mmozksaXEZv=Sz-f4vkHgDjn-_5LTBzP5=wP-+RNeCMVH3Q@mail.gmail.com>
	<CA+OCxoy=cO2feBinWxO8hMuUN3x9+DFeKkDZ-5hv=2NWfht-dw@mail.gmail.com>
	<CAFiP3vxq4-jHf0GALVH=eaQM5d+rrdu8Z49Q1ksL4ftKUzzVyQ@mail.gmail.com>
	<CA+OCxowSS8R1zh1jajhhN6ibtH4x1+w=xwY5i11_Ub7zCJ9JFQ@mail.gmail.com>
	<CAMjNa7e3vkEsiRGqt6kw3Z+z6v-z6Ox4-F0VmCDJEGW2pynWOg@mail.gmail.com>
	<CA+OCxoxbbVX6HZJVeXxRFhbkiG692RZx9WoWo=jmkv6gc79eRA@mail.gmail.com>
	<[email protected]>
	<CA+OCxowW1+ezv93fdbvKtmper+jWOfs+XbgdCSMUJiH23xHQAA@mail.gmail.com>
	<CAFiP3vywwsR96uwDd-KzwF1Vc3DEaBnKWT5v4Sc6y3f-FstCGQ@mail.gmail.com>
	<CA+OCxowF=XkYmrv4uggjW=rWDyS71+ZFhf-sdB-+5beU0_o=jQ@mail.gmail.com>
	<CAFiP3vxp-Y0OYuDMYR7Fbe9g3j5EKSxvSk=iz3MmXeSjsSs+hw@mail.gmail.com>
	<CA+OCxozxp4ssW6=0YcY2dOY_htUsP2dPwi5ZXyONg3+FomScww@mail.gmail.com>
	<CAFiP3vzLfX+8LYSgCvno3R=3kLkdnU7NR_hgwVC+OsT-i6FSCA@mail.gmail.com>
	<CA+OCxoy20eBO-z9jK9eNJQvoEYOCOQrB4hs-9rgLUc1V=hwN9w@mail.gmail.com>
List-Unsubscribe:  <mailto:[email protected]?body=unsub%20pgadmin-hackers>

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 <[email protected]> wrote:

> Hi Harshal,
>
> On Thu, Jun 30, 2016 at 7:59 AM, Harshal Dhumal
> <[email protected]> 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
>


-- 
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Attachments:

  [text/x-patch] keyboard_shortcuts_doc_and_their_labels.patch (5.4K, 3-keyboard_shortcuts_doc_and_their_labels.patch)
  download | inline diff:
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>


view thread (26+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Fix for issue RM1336 [pgadmin4]
  In-Reply-To: <CAFiP3vzaSHvdgC3y8DLeR8XHNHOA6_FXwJ4BA+WT0SJuFGFrvQ@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox