Skip to content

Commit

Permalink
[Table Widget] fixed additional crash issues
Browse files Browse the repository at this point in the history
  • Loading branch information
hoffstadt committed Aug 12, 2020
1 parent 9f5ae10 commit db236b4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
8 changes: 4 additions & 4 deletions DearPyGui/src/Core/AppItems/mvTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ namespace Marvel {
}
}

else
else
{
int index = 0;
for (auto& row : m_values)
Expand Down Expand Up @@ -242,7 +242,7 @@ namespace Marvel {

m_values.push_back(row);
}

else
{
std::vector<std::string> row;
Expand Down Expand Up @@ -301,7 +301,7 @@ namespace Marvel {
{

if (item.first.second >= column_index)
m_selections[{item.first.first, item.first.second+1}] = item.second;
m_selections[{item.first.first, item.first.second + 1}] = item.second;

else
m_selections[item.first] = item.second;
Expand All @@ -315,7 +315,7 @@ namespace Marvel {
if (!isIndexValid(row_index, 0))
return;

if (row_index == m_hashValues.size())
if (row_index >= m_values.size())
{
addRow(row);
return;
Expand Down
17 changes: 6 additions & 11 deletions DearPyGui/src/Core/mvMarvel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2754,8 +2754,8 @@ namespace Marvel {
&tip, &parent, &before))
return mvPythonTranslator::GetPyNone();




if (std::string(parent).empty())
{
Expand Down Expand Up @@ -3664,15 +3664,13 @@ namespace Marvel {

auto prow = mvPythonTranslator::ToStringVect(row);
mvTable* atable = static_cast<mvTable*>(item);

if (atable->getColumnCount() == 0)
{
std::vector<std::string> headers;
for (size_t i = 0; i < prow.size(); i++)
headers.emplace_back("Header" + std::to_string(i));
atable->addHeaders(headers);
}

atable->addRow(prow);

return mvPythonTranslator::GetPyNone();
Expand Down Expand Up @@ -3735,17 +3733,14 @@ namespace Marvel {
}

auto prow = mvPythonTranslator::ToStringVect(row);

mvTable* atable = static_cast<mvTable*>(item);

if (atable->getColumnCount() == 0)
{
std::vector<std::string> headers;
for (size_t i = 0; i < prow.size(); i++)
headers.emplace_back("Header" + std::to_string(i));
atable->addHeaders(headers);
}

atable->insertRow(row_index, prow);

return mvPythonTranslator::GetPyNone();
Expand Down Expand Up @@ -3941,7 +3936,7 @@ namespace Marvel {
{
const char* callback = "";

if (!(*mvApp::GetApp()->getParsers())["select_directory_dialog"].parse(args, kwargs, __FUNCTION__,&callback))
if (!(*mvApp::GetApp()->getParsers())["select_directory_dialog"].parse(args, kwargs, __FUNCTION__, &callback))
return mvPythonTranslator::GetPyNone();

igfd::ImGuiFileDialog::Instance()->OpenModal("ChooseFileDlgKey", "Choose Directory", 0, ".");
Expand All @@ -3958,7 +3953,7 @@ namespace Marvel {
const char* callback = "";
const char* extensions = "";

if (!(*mvApp::GetApp()->getParsers())["open_file_dialog"].parse(args, kwargs, __FUNCTION__,
if (!(*mvApp::GetApp()->getParsers())["open_file_dialog"].parse(args, kwargs, __FUNCTION__,
&callback, &extensions))
return mvPythonTranslator::GetPyNone();

Expand Down Expand Up @@ -4505,7 +4500,7 @@ namespace Marvel {
if (item == nullptr)
return mvPythonTranslator::GetPyNone();

if(item->getDataSource().empty())
if (item->getDataSource().empty())
item->setPyValue(value);
else
mvDataStorage::AddData(item->getDataSource(), value);
Expand Down Expand Up @@ -5270,6 +5265,7 @@ namespace Marvel {
static PyMethodDef dearpyguimethods[]
{
ADD_PYTHON_FUNCTION(setup_dearpygui)
ADD_PYTHON_FUNCTION(set_headers)
ADD_PYTHON_FUNCTION(render_dearpygui_frame)
ADD_PYTHON_FUNCTION(cleanup_dearpygui)
ADD_PYTHON_FUNCTION(start_dearpygui)
Expand Down Expand Up @@ -5372,7 +5368,6 @@ namespace Marvel {
ADD_PYTHON_FUNCTION(add_column)
ADD_PYTHON_FUNCTION(insert_column)
ADD_PYTHON_FUNCTION(delete_column)
ADD_PYTHON_FUNCTION(set_headers)
ADD_PYTHON_FUNCTION(add_row)
ADD_PYTHON_FUNCTION(insert_row)
ADD_PYTHON_FUNCTION(delete_row)
Expand Down

0 comments on commit db236b4

Please sign in to comment.