From f819b98d9ef14f13e3a6c6c2399c9ac39953fba2 Mon Sep 17 00:00:00 2001 From: Cheng Date: Sat, 11 Nov 2023 02:10:36 +0000 Subject: [PATCH] window refreshed on add username but the overhead and screen flash of destroying and recreating every little window is annoying. I should use something like: SELECT COUNT(*) FROM UserZookoIDs WHERE LOWER("name")& p) : sql_insert_name(p.get()) {} void operator()(const char* psz, const ristretto255::point& pt) { - csql_begin.do_one(); - try { - csql_into_names.do_one(psz); - csql_namekey_into_keys.do_one(pt); - } - catch (const MyException& e) { - csql_rollback.do_one(); - if (e.what_num() == 19) { - throw MyException("Name already in database"); - } - else { - throw; - } - } - catch (const std::exception &) { - csql_rollback.do_one(); - throw; - } - csql_commit.do_one(); + csql_into_names.do_one(psz,pt); } }; @@ -234,7 +202,5 @@ public: } }; - - constexpr auto WALLET_FILE_IDENTIFIER (0x56d34bc5a655dd1fi64); constexpr auto WALLET_FILE_SCHEMA_VERSION_0_0(1); diff --git a/src/display_wallet.cpp b/src/display_wallet.cpp index 954c880..0a3ee71 100644 --- a/src/display_wallet.cpp +++ b/src/display_wallet.cpp @@ -94,12 +94,13 @@ void display_wallet::OnClose(wxCloseEvent& event) { void display_wallet::refresh_from_database() { auto sizer = this->GetSizer(); + auto dirty_area = sizer->ComputeFittingClientSize(singletonFrame); auto m_lsizer = sizer->GetItem((size_t)0)->GetSizer(); assert(m_lsizer); auto m_rsizer = sizer->GetItem(1)->GetSizer(); assert(m_rsizer); - m_lsizer->Clear(); - m_rsizer->Clear(); + m_lsizer->Clear(true); + m_rsizer->Clear(true); try { m_read_names_and_keys->reset(); while (m_read_names_and_keys->step() == Icompiled_sql::ROW) { @@ -111,7 +112,7 @@ void display_wallet::refresh_from_database() { this, wxID_ANY, name, - wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT | wxST_ELLIPSIZE_END + wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT | wxEXPAND| wxFIXED_MINSIZE| wxST_ELLIPSIZE_END ), 10, wxALL, // and make border all around @@ -121,7 +122,7 @@ void display_wallet::refresh_from_database() { this, wxID_ANY, "#" + base58(pubkey).operator std::string(), - wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT | wxST_ELLIPSIZE_END + wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT | wxEXPAND | wxFIXED_MINSIZE | wxST_ELLIPSIZE_END ), 10, wxALL, // and make border all around @@ -141,12 +142,11 @@ void display_wallet::refresh_from_database() { throw MyException(sz_unknown_error, __LINE__, __func__, SrcFilename); } auto desired_size = sizer->ComputeFittingClientSize(singletonFrame); - singletonFrame->SetMinClientSize(desired_size); + dirty_area.IncTo(desired_size); + //singletonFrame->SetMinClientSize(desired_size); auto clientSize = singletonFrame->GetClientSize(); desired_size.IncTo(clientSize); if (desired_size.GetHeight() > clientSize.GetHeight() || desired_size.GetWidth() > clientSize.GetWidth() )singletonFrame->SetClientSize(desired_size); - - } diff --git a/src/frame.cpp b/src/frame.cpp index ab63b07..4ae63cf 100644 --- a/src/frame.cpp +++ b/src/frame.cpp @@ -391,11 +391,11 @@ COMMIT; BEGIN IMMEDIATE TRANSACTION; CREATE TRIGGER InsertUserZookoID INSTEAD OF INSERT ON UserZookoIDs FOR EACH ROW BEGIN - INSERT OR FAIL INTO "Names" VALUES( + INSERT OR ROLLBACK INTO "Names" VALUES( NULL, NEW."name" ); - INSERT OR FAIL INTO "Keys" VALUES( + INSERT OR ROLLBACK INTO "Keys" VALUES( NULL, NEW."pubkey", last_insert_rowid(),