public inbox for [email protected]
help / color / mirror / Atom feedFrom: Adam Scott <[email protected]>
To: Magnus Hagander <[email protected]>
Cc: Dave Page <[email protected]>
Cc: pgadmin-hackers <[email protected]>
Subject: Re: Patch: New field in frmMain statusbar
Date: Mon, 14 Sep 2015 13:22:18 -0600
Message-ID: <CA+s62-OPfiM_psx7e3Udo6pi3QWZAn42-5q0835V_=LP=tPYmg@mail.gmail.com> (raw)
In-Reply-To: <CA+s62-ObWZx102uFz4f1=sY+rWefTP9XnpEu_rOLHw6wt5vytA@mail.gmail.com>
References: <CA+s62-Ous9Dr7EFGfwEh-N7xZGh8f173uUU=VbzzgV9crVD4NQ@mail.gmail.com>
<CA+OCxoxnayiMBczvgwCSvd8vLdJ6zjjAU+Sb68bE+h5JbYH5CA@mail.gmail.com>
<CABUevEwiW5FJuOp2-eBBWvAURnRV5xDiR6N8ET4juWatLPWsdA@mail.gmail.com>
<CA+s62-PDmPApuCvzAziewCtZnDD1sAkOwnnwW6odhWaXE2hF+w@mail.gmail.com>
<CABUevEzVwKWKwOajTSWnC2+8CpcOtp-dYPyYOMEj31eaUXNkAg@mail.gmail.com>
<CA+s62-ObWZx102uFz4f1=sY+rWefTP9XnpEu_rOLHw6wt5vytA@mail.gmail.com>
List-Unsubscribe: <mailto:[email protected]?body=unsub%20pgadmin-hackers>
Apologies all. I have an updated patch that corrects the previous one.
Before, if you you selected Tablespaces, Group Roles, or Login Roles, it
wouldn't show the connection they are associated with. The attached patch
supersedes the previous one and corrects the flaw.
Thank you,
Adam
On Mon, Sep 14, 2015 at 1:04 PM, Adam Scott <[email protected]> wrote:
> The part that changed was just the database name since I clicked on an
> object in a different database on the same conneciton. If I had selected
> an object in a different connection, the connection name would change as
> well.
>
> For convenience, in green below, is the additional code to make this
> happen (there's other stuff in the patch to add the field in the statusbar
> not shown below).
>
> Thank you,
> Adam
>
> void frmMain::EndMsg(bool done)
> {
> msgLevel--;
>
> if (!msgLevel)
> {
> // Get the execution time & display it
> float timeval = stopwatch.Time();
> wxString time;
> time.Printf(_("%.2f secs"), (timeval / 1000));
> statusBar->SetStatusText(time, 3);
>
> wxString connection;
> if (currentObject)
> {
> pgDatabase *db = currentObject->GetDatabase();
>
> if (db)
> connection = db->GetServer()->GetDisplayName() + wxT(":")
> + db->GetDisplayName();
> }
>
> statusBar->SetStatusText(connection,2);
>
> // Display the 'Done' message
> if (done)
> statusBar->SetStatusText(timermsg + _(" Done."), 1);
> else
> statusBar->SetStatusText(timermsg + _(" Failed."), 1);
>
> On Mon, Sep 14, 2015 at 10:11 AM, Magnus Hagander <[email protected]>
> wrote:
>
>> The part that changed is just the one that added db1 and db2, right?
>>
>> If so I definitely don't think it's a problem with too much info,and
>> think this patch is good. (I haven't reviewed the code)
>>
>> //Magnus
>>
>>
>> On Mon, Sep 14, 2015 at 3:34 PM, Adam Scott <[email protected]>
>> wrote:
>>
>>> Hi,
>>>
>>> thank you for your time to consider this patch.
>>>
>>> Here's a few screenshots on my Windows 7 desktop. Let me know if you
>>> want to see anything else.
>>> A few observations:
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Mon, Sep 14, 2015 at 4:43 AM, Magnus Hagander <[email protected]>
>>> wrote:
>>>
>>>> I don't have a working pgadmin env at the moment - any chance someone
>>>> who has built it could show a screenshot?
>>>>
>>>> I've certainly had customers complain about pgadmin in the case of many
>>>> databases, though it's generally been on account of performance, and not
>>>> something like this.
>>>>
>>>> //Magnus
>>>>
>>>>
>>>> On Mon, Sep 14, 2015 at 10:57 AM, Dave Page <[email protected]> wrote:
>>>>
>>>>> Thanks Adam.
>>>>>
>>>>> What do others feel about this proposed patch? I can see how it might
>>>>> be useful, however I'm also concerned about overloading the UI with
>>>>> more info - and in over a decade I don't recall anyone ever asking for
>>>>> this feature or complaining of the issue Adam describes (though, it is
>>>>> clearly feasible).
>>>>>
>>>>> On Sun, Sep 13, 2015 at 4:19 PM, Adam Scott <[email protected]>
>>>>> wrote:
>>>>> > Hi,
>>>>> >
>>>>> > please consider this patch to frmMain.
>>>>> >
>>>>> > Situation: When a user has a large number of databases and
>>>>> connections,
>>>>> > when they select a table or other object in the Object browser tree,
>>>>> they
>>>>> > can lose track of which connection and database the object belongs
>>>>> too.
>>>>> > This makes it really easy for the user to make a mistake and drop an
>>>>> object
>>>>> > on the wrong connection (such as on a Production server instead of a
>>>>> > Development server). Also as a user is browsing multiple databases
>>>>> and
>>>>> > connections they can lose track of which object they are working on.
>>>>> >
>>>>> > Solution: This patch adds a new field in the status bar of the main
>>>>> window
>>>>> > (frmMain), between the two other fields, keeping them the same. If
>>>>> there's
>>>>> > a currently selected object the field will display it's connection
>>>>> and
>>>>> > database. If there's no currently selected object, it will be blank.
>>>>> >
>>>>> > Here's the danger, if we display the wrong connection and database,
>>>>> the user
>>>>> > could drop the wrong object. So it's imperative this never has a
>>>>> bug. This
>>>>> > code change is so small with so little dependencies, it relies on
>>>>> already
>>>>> > used code for such a long time that if it had a bug, then there are
>>>>> other
>>>>> > bigger bugs in the code that would have already shown up.
>>>>> >
>>>>> > Regards,
>>>>> > Adam C. Scott
>>>>> >
>>>>> > patch generated using Tortoise Git Create Patch Serial
>>>>> >
>>>>> >
>>>>> >
>>>>> > --
>>>>> > Sent via pgadmin-hackers mailing list (
>>>>> [email protected])
>>>>> > To make changes to your subscription:
>>>>> > http://www.postgresql.org/mailpref/pgadmin-hackers
>>>>> >
>>>>>
>>>>>
>>>>>
>> --
>> Magnus Hagander
>> Me: http://www.hagander.net/
>> Work: http://www.redpill-linpro.com/
>>
>
>
--
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers
Attachments:
[application/octet-stream] 0001-Display-Connection-and-Database-in-Statusbar-Add-ano.patch (1.9K, 3-0001-Display-Connection-and-Database-in-Statusbar-Add-ano.patch)
download | inline diff:
From 892a5a6afc0ad1f97e31c5302aa870e509c8bae0 Mon Sep 17 00:00:00 2001
From: Adam C Scott <[email protected]>
Date: Mon, 14 Sep 2015 13:16:46 -0600
Subject: [PATCH] Display Connection and Database in Statusbar: Add another
field in frmMain's statusbar to get the current object's connection and
database and display in the field in the status bar.
---
pgadmin/frm/frmMain.cpp | 27 ++++++++++++++++++++++-----
1 file changed, 22 insertions(+), 5 deletions(-)
diff --git a/pgadmin/frm/frmMain.cpp b/pgadmin/frm/frmMain.cpp
index 12a9e1e..d13a9a8 100644
--- a/pgadmin/frm/frmMain.cpp
+++ b/pgadmin/frm/frmMain.cpp
@@ -492,13 +492,13 @@ void frmMain::CreateMenus()
treeContextMenu = 0;
// Status bar
- statusBar = CreateStatusBar(3);
- int iWidths[3] = {0, -1, 100};
- SetStatusWidths(3, iWidths);
+ statusBar = CreateStatusBar(4);
+ int iWidths[4] = {0, -1, 400, 100};
+ SetStatusWidths(4, iWidths);
SetStatusBarPane(-1);
statusBar->SetStatusText(wxT(""), 0);
statusBar->SetStatusText(_("Ready."), 1);
- statusBar->SetStatusText(_("0 Secs"), 2);
+ statusBar->SetStatusText(_("0 Secs"), 3);
wxAcceleratorEntry entries[4];
entries[0].Set(wxACCEL_NORMAL, WXK_F5, refFact->GetId());
@@ -1307,7 +1307,24 @@ void frmMain::EndMsg(bool done)
float timeval = stopwatch.Time();
wxString time;
time.Printf(_("%.2f secs"), (timeval / 1000));
- statusBar->SetStatusText(time, 2);
+ statusBar->SetStatusText(time, 3);
+
+ wxString connection;
+ if (currentObject)
+ {
+ pgDatabase *db = currentObject->GetDatabase();
+
+ if (db)
+ connection = db->GetServer()->GetDisplayName() + wxT(":") + db->GetDisplayName();
+ else
+ {
+ pgServer *srv = currentObject->GetServer();
+ if (srv)
+ connection = srv->GetDisplayName();
+ }
+ }
+
+ statusBar->SetStatusText(connection,2);
// Display the 'Done' message
if (done)
--
2.5.2.windows.1
view thread (20+ 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], [email protected]
Subject: Re: Patch: New field in frmMain statusbar
In-Reply-To: <CA+s62-OPfiM_psx7e3Udo6pi3QWZAn42-5q0835V_=LP=tPYmg@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