Skip to content

Commit

Permalink
fix pivot tool bug w/ no rows not updating columns; set debug log mes…
Browse files Browse the repository at this point in the history
…sages to debug level
  • Loading branch information
nickzoic committed Sep 26, 2024
1 parent 9b4a665 commit d52c32e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
3 changes: 1 addition & 2 deletions countess/core/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,7 @@ def process(self, data: pd.DataFrame, source: str) -> Iterable[pd.DataFrame]:

def finalize(self) -> Iterable[pd.DataFrame]:
yield from super().finalize()
for p in self.params.values():
p.set_column_choices(self.input_columns.keys())
self.set_column_choices(self.input_columns.keys())


class PandasConcatProcessPlugin(PandasProcessPlugin):
Expand Down
14 changes: 7 additions & 7 deletions countess/gui/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def notes_modified_callback(self, *_):

def config_change_callback(self, *_):
"""Called immediately if a change to config has occurred."""
logger.info("config_change_callback")
logger.debug("config_change_callback")

# Leave it a bit to see if the user is still typing, if so cancel.
if self.config_change_task:
Expand All @@ -242,33 +242,33 @@ def config_change_callback(self, *_):

def config_change_task_callback(self):
"""Called when the user makes a change then pauses for a bit"""
logger.info("config_change_task_callback")
logger.debug("config_change_task_callback")

# if there's already an update running, delay a bit longer
if self.node_update_thread and self.node_update_thread.is_alive():
# XXX need some way to tell the thread to stop
logger.info("config_change_task_callback: waiting for thread %s", self.node_update_thread)
logger.debug("config_change_task_callback: waiting for thread %s", self.node_update_thread)
self.config_change_task = self.frame.after(1000, self.config_change_task_callback)
return

self.config_change_task = None
self.node.mark_dirty()

self.node_update_thread = threading.Thread(target=self.node.prerun)
logger.info("config_change_task_callback: starting thread %s", self.node_update_thread)
logger.debug("config_change_task_callback: starting thread %s", self.node_update_thread)
self.node_update_thread.start()

self.config_change_task_callback_2()

def config_change_task_callback_2(self):
logger.info("config_change_task_callback_2")
logger.debug("config_change_task_callback_2")

if self.node_update_thread and self.node_update_thread.is_alive():
logger.info("config_change_task_callback_2: waiting for thread %s", self.node_update_thread)
logger.debug("config_change_task_callback_2: waiting for thread %s", self.node_update_thread)
self.frame.after(500, self.config_change_task_callback_2)
return

logger.info("config_change_task_callback_2: joining thread %s", self.node_update_thread)
logger.debug("config_change_task_callback_2: joining thread %s", self.node_update_thread)
self.node_update_thread.join()
self.node_update_thread = None

Expand Down
4 changes: 2 additions & 2 deletions countess/plugins/pivot.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ def _aggfunc():
return []

def finalize(self) -> Iterable[pd.DataFrame]:
yield from super().finalize()

if not self.dataframes:
return

Expand All @@ -123,5 +125,3 @@ def _aggfunc():
yield dataframe
except (KeyError, ValueError, TypeError) as exc:
logger.warning("Exception", exc_info=exc)

yield from super().finalize()
2 changes: 1 addition & 1 deletion tests/gui/test_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def test_open_new():
button.invoke()
root.update()

for _ in range(0,30):
for _ in range(0, 30):
time.sleep(0.1)
root.update()

Expand Down

0 comments on commit d52c32e

Please sign in to comment.