mirror of
https://github.com/levinsv/pgadmin3.git
synced 2026-05-15 14:15:49 -06:00
Add OnFatalException method
Добавил обработку аврийных завершений. Мелкие правки.
This commit is contained in:
parent
debed953cf
commit
627311178c
6 changed files with 78 additions and 8 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -12,6 +12,7 @@ x64/Release_(3.0)/*.res
|
|||
x64/Release_(3.0)/*.sbr
|
||||
x64/Release_(3.0)/*.ilk
|
||||
x64/Release_(3.0)/*.txt
|
||||
x64/Release_(3.0)/svg
|
||||
*.sbr
|
||||
*.obj
|
||||
*.cod
|
||||
|
|
|
|||
|
|
@ -52,6 +52,8 @@ void ctlSQLGrid::setresizedpi() {
|
|||
SetColLabelAlignment(wxALIGN_LEFT, wxALIGN_CENTRE);
|
||||
SetDefaultCellAlignment(wxALIGN_LEFT, wxALIGN_TOP);
|
||||
SetRowLabelSize(FromDIP(50));
|
||||
SetDefaultRowSize(fntCells.GetPointSize() * 2 + 2);
|
||||
SetColLabelSize(fntLabel.GetPointSize() * 4);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -66,8 +68,6 @@ ctlSQLGrid::ctlSQLGrid(wxWindow *parent, wxWindowID id, const wxPoint &pos, cons
|
|||
*/
|
||||
|
||||
setresizedpi();
|
||||
//SetDefaultRowSize(fntCells.GetPointSize() * 2 + 2);
|
||||
//SetColLabelSize(fntLabel.GetPointSize() * 4);
|
||||
SetDefaultCellOverflow(false);
|
||||
//SetDefaultRenderer(new wxGridCellAutoWrapStringRenderer);
|
||||
SetDefaultRenderer(new CursorCellRenderer);
|
||||
|
|
@ -962,8 +962,8 @@ void ctlSQLGrid::AutoSizeColumns(bool setAsMin)
|
|||
}
|
||||
SetColLabelSize(maxH+ FromDIP(EXTRAEXTENT_HEIGHT));
|
||||
availSize = GetClientSize().GetWidth() - GetRowLabelSize();
|
||||
int newDef = GetDefaultRowSize()+FromDIP(1);
|
||||
SetDefaultRowSize(newDef, true);
|
||||
//int newDef = GetDefaultRowSize()+FromDIP(1);
|
||||
//SetDefaultRowSize(newDef, true);
|
||||
// Second pass: shrink wide columns if exceeded available width
|
||||
if (totalSize > availSize)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1482,7 +1482,7 @@ faqFactory::faqFactory(menuFactoryList *list, wxMenu *mnu, ctlMenuToolbar *toolb
|
|||
|
||||
wxWindow *faqFactory::StartDialog(frmMain *form, pgObject *obj)
|
||||
{
|
||||
wxLaunchDefaultBrowser(wxT("http://www.pgadmin.org/support/faq.php"));
|
||||
wxLaunchDefaultBrowser(wxT("https://github.com/levinsv/pgadmin3/issues"));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -322,7 +322,7 @@ frmStatus::frmStatus(frmMain *form, const wxString &_title, pgConn *conn) : pgFr
|
|||
toolBar->AddSeparator();
|
||||
toolBar->AddTool(MNU_CANCEL, wxEmptyString, *GetBundleSVG(query_cancel_png_bmp, "query_cancel.svg", wxSize(16, 16)), _("Cancel query"), wxITEM_NORMAL);
|
||||
toolBar->AddTool(MNU_TERMINATE, wxEmptyString, *GetBundleSVG(terminate_backend_png_bmp, "terminate_backend.svg", wxSize(16, 16)), _("Terminate backend"), wxITEM_NORMAL);
|
||||
toolBar->AddTool(MNU_COMMIT, wxEmptyString, *GetBundleSVG(storedata_png_bmp, "file_save.svg", wxSize(16, 16)), _("Commit transaction"), wxITEM_NORMAL);
|
||||
toolBar->AddTool(MNU_COMMIT, wxEmptyString, *GetBundleSVG(storedata_png_bmp, "storedata.svg", wxSize(16, 16)), _("Commit transaction"), wxITEM_NORMAL);
|
||||
toolBar->AddTool(MNU_ROLLBACK, wxEmptyString, *GetBundleSVG(delete_png_bmp, "drop.svg", wxSize(16, 16)), _("Rollback transaction"), wxITEM_NORMAL);
|
||||
toolBar->AddSeparator();
|
||||
toolBar->AddTool(MNU_CLEAR_FILTER_SERVER_STATUS, wxEmptyString, *GetBundleSVG(sortfilterclear_png_bmp, "sortfilterclear.svg", wxSize(16, 16)), _("Clear filter"), wxITEM_NORMAL);
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ class pgAdmin3 : public wxApp
|
|||
public:
|
||||
virtual bool OnInit();
|
||||
virtual int OnExit();
|
||||
|
||||
virtual void OnFatalException() wxOVERRIDE;
|
||||
#ifdef __WXMAC__
|
||||
void MacOpenFile(const wxString &fileName);
|
||||
#endif
|
||||
|
|
@ -190,7 +190,7 @@ protected:
|
|||
void InitLogger();
|
||||
void InitNetwork();
|
||||
void InitXml();
|
||||
|
||||
|
||||
#ifdef __WXMSW__
|
||||
void InitLibpq();
|
||||
#endif
|
||||
|
|
|
|||
69
pgAdmin3.cpp
69
pgAdmin3.cpp
|
|
@ -26,6 +26,7 @@
|
|||
#include <wx/stdpaths.h>
|
||||
#include <wx/clipbrd.h>
|
||||
#include <wx/sysopt.h>
|
||||
#include "wx/stackwalk.h"
|
||||
|
||||
// wxOGL
|
||||
#include <ogl/ogl.h>
|
||||
|
|
@ -200,8 +201,75 @@ void frmDlgTest::OnSelect(wxCommandEvent &ev)
|
|||
}
|
||||
}
|
||||
|
||||
class MyStackWalker : public wxStackWalker
|
||||
{
|
||||
public:
|
||||
MyStackWalker(wxString &rez)
|
||||
{
|
||||
Rez = &rez;
|
||||
}
|
||||
|
||||
// bool IsOk() const { return m_isOk; }
|
||||
|
||||
protected:
|
||||
virtual void OnStackFrame(const wxStackFrame& frame) wxOVERRIDE;
|
||||
wxString* Rez;
|
||||
};
|
||||
void MyStackWalker::OnStackFrame(const wxStackFrame& frame)
|
||||
{
|
||||
|
||||
Rez->Append(wxString::Format("level: %lu\n", (unsigned long) frame.GetLevel()));
|
||||
wxString func = frame.GetName();
|
||||
if (!func.empty())
|
||||
Rez->Append(wxString::Format("function: %s\n", func));
|
||||
Rez->Append(wxString::Format(" offset: %08lx\n address: %08lx\n", (unsigned long) frame.GetOffset(), (unsigned long)wxPtrToUInt(frame.GetAddress())));
|
||||
|
||||
|
||||
wxString module = frame.GetModule();
|
||||
if (!module.empty())
|
||||
Rez->Append(wxString::Format("module: %s\n", module));
|
||||
|
||||
if (frame.HasSourceLocation())
|
||||
{
|
||||
Rez->Append(wxString::Format("file: %s\n", frame.GetFileName()));
|
||||
Rez->Append(wxString::Format("line: %lu\n", (unsigned long)frame.GetLine()));
|
||||
}
|
||||
|
||||
const size_t nParams = frame.GetParamCount();
|
||||
if (nParams)
|
||||
{
|
||||
for (size_t n = 0; n < nParams; n++)
|
||||
{
|
||||
Rez->Append(wxString::Format(" P%lu: %lu\n", (unsigned long)n));
|
||||
|
||||
wxString type, name, value;
|
||||
if (!frame.GetParam(n, &type, &name, &value))
|
||||
continue;
|
||||
|
||||
if (!type.empty())
|
||||
Rez->Append(wxString::Format(" type: %s\n", type));
|
||||
|
||||
if (!name.empty())
|
||||
Rez->Append(wxString::Format(" name: %s\n", name));
|
||||
|
||||
if (!value.empty())
|
||||
Rez->Append(wxString::Format(" value: %s\n", value));
|
||||
}
|
||||
|
||||
}
|
||||
Rez->Append(wxString::Format("----------------\n"));
|
||||
|
||||
}
|
||||
|
||||
// The Application!
|
||||
void pgAdmin3::OnFatalException() {
|
||||
wxString err = "fatal error";
|
||||
MyStackWalker sw(err);
|
||||
sw.WalkFromException();
|
||||
wxLogError(err);
|
||||
wxMessageBox(err,
|
||||
"wxExcept", wxOK | wxICON_ERROR);
|
||||
}
|
||||
bool pgAdmin3::OnInit()
|
||||
{
|
||||
// Force logging off until we're ready
|
||||
|
|
@ -463,6 +531,7 @@ bool pgAdmin3::OnInit()
|
|||
// Attempt to dynamically load PGgetOutResult from libpq. this
|
||||
// is only present in EDB versions.
|
||||
InitLibpq();
|
||||
|
||||
#endif
|
||||
|
||||
if (configMode)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue