Re: pgAdmin III: Muliple SQL tabs - Mailing list pgadmin-hackers

From Dave Page
Subject Re: pgAdmin III: Muliple SQL tabs
Date
Msg-id CA+OCxoz+iBODMehHb5MF=uTwVCe0axSOkngzzpSr4ectgzpXRg@mail.gmail.com
Whole thread Raw
In response to Re: pgAdmin III: Muliple SQL tabs  (Sergey Busel <sbusel@gmail.com>)
Responses Re: pgAdmin III: Muliple SQL tabs
List pgadmin-hackers


On Thu, Feb 11, 2016 at 2:22 PM, Sergey Busel <sbusel@gmail.com> wrote:
Added the query name to history entries. Please note that history entries are not modified if user saves [Query 1] to file [foo.sql]. I don't think that would be practical.

Thanks. So I was just about to commit this, when it crashed on me. It seems to happen only if there are at least 2 non-dirty tabs open (easy to reproduce - open the query tool, add a second tab, then close the window). I've fiddled around for a couple of hours, but not been able to get to the bottom of it despite trying a few tricks that sometimes help avoid weird issues with wxWidgets. There's a stack trace below.

Ashesh, Neel, Sanket, Akshay - can any of you take a quick look on an OSX system? I've attached a slightly cleaned up patch, removing some commented code and making it a git-diff against master.

Thanks.

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   org.postgresql.pgadmin3       0x0036ce4f wxWindowBase::GetParent() const + 15 (window.h:590)
1   libwx_macud_core-2.8.0.dylib   0x01ea6c0b wxControlContainer::SetLastFocus(wxWindow*) + 81
2   libwx_macud_core-2.8.0.dylib   0x01faf8c0 wxPanel::OnChildFocus(wxChildFocusEvent&) + 50
3   libwx_base_carbonud-2.8.0.dylib 0x0254b984 wxAppConsole::HandleEvent(wxEvtHandler*, void (wxEvtHandler::*)(wxEvent&), wxEvent&) const + 102
4   libwx_base_carbonud-2.8.0.dylib 0x02634023 wxEvtHandler::ProcessEventIfMatches(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) + 391
5   libwx_base_carbonud-2.8.0.dylib 0x026364ef wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*) + 221
6   libwx_base_carbonud-2.8.0.dylib 0x02635716 wxEvtHandler::ProcessEvent(wxEvent&) + 388
7   libwx_base_carbonud-2.8.0.dylib 0x02634bc8 wxEvtHandler::ProcessPendingEvents() + 302
8   libwx_base_carbonud-2.8.0.dylib 0x0254c6d8 wxAppConsole::ProcessPendingEvents() + 232
9   libwx_base_carbonud-2.8.0.dylib 0x02629ea3 wxMacProcessNotifierAndPendingEvents + 35
10  libwx_macud_core-2.8.0.dylib   0x01d6f2c1 wxApp::MacHandleOneEvent(void*) + 97
11  libwx_macud_core-2.8.0.dylib   0x01d6f3ce wxApp::MacDoOneEvent() + 246
12  libwx_macud_core-2.8.0.dylib   0x01da07fd wxEventLoop::Dispatch() + 57
13  libwx_macud_core-2.8.0.dylib   0x01ed46c1 wxEventLoopManual::Run() + 421
14  libwx_macud_core-2.8.0.dylib   0x01e885b4 wxAppBase::MainLoop() + 98
15  libwx_macud_core-2.8.0.dylib   0x01e87a6a wxAppBase::OnRun() + 52
16  libwx_base_carbonud-2.8.0.dylib 0x025ac782 wxEntry(int&, wchar_t**) + 258
17  libwx_base_carbonud-2.8.0.dylib 0x025ac96d wxEntry(int&, char**) + 77
18  org.postgresql.pgadmin3       0x00128354 main + 36 (pgAdmin3.cpp:126)
19  org.postgresql.pgadmin3       0x00106705 start + 53
 


On Wed, Feb 10, 2016 at 8:28 AM, Dave Page <dpage@pgadmin.org> wrote:
Hi

On Wed, Feb 10, 2016 at 12:14 AM, Sergey Busel <sbusel@gmail.com> wrote:
Dave,

Here is a patch that does display the query tab name in the title bar of the output pane. It seems to work with loading and saving the perspective, too. The trick is to restore the original text on the output pane before loading and saving the perspective, and put the query name back in there right after.

Attached is the full patch, not the diff from the previous patch I sent. Let me know if you have other suggestions.

That seems to solve the problem nicely :-) - Thanks!

It does lead to one other issue that I can see - the History tab on the results pane now shows the history for all query tabs, which seems a little odd given that the other 3 tabs on the results panel are query tab specific. Unless there are better ideas, I think the best way to fix this is to include the current tab name in the history, e.g.

-- Executing query [Query 1]:
SELECT version();
Total query runtime: 16 msec
1 row retrieved.

-- Executing query [Query 2]:
SELECT * FROM pg_class
Total query runtime: 53 msec
311 rows retrieved. 

-- Executing query [foo.sql]:
SELECT * from pg_attribute
Total query runtime: 245 msec
2399 rows retrieved.

What do you think?


Regards.

On Fri, Feb 5, 2016 at 7:46 AM, Dave Page <dpage@pgadmin.org> wrote:
On Wed, Feb 3, 2016 at 3:07 AM, Sergey Busel <sbusel@gmail.com> wrote:
> - Removed unused/commented code.
> - Tab names now reflect the file name, if such is associated with a tab.
> - Removed the "Close Tab" menu item. Added X button to the active tab.
> - To tell the user which tab results are related to and to avoid messing
> with perspective, the name of the related tab is now displayed as "Data
> Output [Query 1]" in the output pane. If the tab is named after a file, file
> name will display in the square brackets. If the file name is longer then 15
> chars, it will be truncated to 15 chars.
>
> Let me know any other suggestions you may have.

Thanks - this seems to be working nicely for me. It would be good if
the query name could be displayed in the title bar of the output pane
rather than on the results tab (because it really does apply to all
tabs), but I don't see any sensible way to do that given the weird way
that wxAUI stores it's perspectives.

Ashesh, any ideas?

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company




--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company




--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Attachment

pgadmin-hackers by date:

Previous
From: Sanket Mehta
Date:
Subject: Re: patch for cast module
Next
From: Dave Page
Date:
Subject: Re: patch for cast module