Skip to content

Commit

Permalink
* Fixed bug where sometimes the first operation performed in a sessio…
Browse files Browse the repository at this point in the history
…n would not display correctly in the automatic session report.
  • Loading branch information
GuyTeichman committed May 8, 2024
1 parent 8e802a9 commit bad763b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
1 change: 1 addition & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Fixed
* Fixed bug where disabling auto-report in the middle of the session would raise errors when trying to create new graphs.
* Fixed bug where generating multiple gene expression plots (split_plots=True) with auto-generated report would only add the last graph to the session report.
* Fixed bug where the function 'normalize_to_quantile' generated unclear table names.
* Fixed bug where sometimes the first operation performed in a session would not display correctly in the automatic session report.

New Contributors
*****************
Expand Down
21 changes: 10 additions & 11 deletions rnalysis/gui/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -1388,7 +1388,7 @@ class TabPage(QtWidgets.QWidget):
filterObjectCreated = QtCore.pyqtSignal(object, int)
featureSetCreated = QtCore.pyqtSignal(object, int)
startedJob = QtCore.pyqtSignal(object, object, object)
tabNameChange = QtCore.pyqtSignal(str, bool, int, int)
tabNameChange = QtCore.pyqtSignal(str, bool)
tabSaved = QtCore.pyqtSignal()
changeIcon = QtCore.pyqtSignal(str)
geneSetsRequested = QtCore.pyqtSignal(object)
Expand Down Expand Up @@ -1638,7 +1638,7 @@ def _rename(self, new_name: str = None, job_id: int = None):
prev_id = self.tab_id
self.tab_id = JOB_COUNTER.get_id() if job_id is not None else prev_id

self.tabNameChange.emit(new_name, True, self.tab_id, prev_id)
self.tabNameChange.emit(new_name, True)
self.overview_widgets['table_name_label'].setText(f"Table name: '<b>{new_name}</b>'")
self.overview_widgets['table_name'].setText('')
self.name = new_name.rstrip('*')
Expand Down Expand Up @@ -2223,7 +2223,7 @@ def update_tab(self, is_unsaved: bool = True):
self.update_filter_obj_shape()
self.update_table_preview()
self.name = str(self.obj_name())
self.tabNameChange.emit(self.name, is_unsaved, -1, -1)
self.tabNameChange.emit(self.name, is_unsaved)
self.update_table_name_label()

def _apply_function_from_params(self, func_name, args: list, kwargs: dict, finish_slot=None, job_id: int = None,
Expand Down Expand Up @@ -2298,15 +2298,15 @@ def start(self):
kwargs[name] = gui_widgets.get_val_from_widget(widget)
self.filter_obj = filter_obj_type(file_path, **kwargs)

print(self.filter_obj)

table_name_user_input = self.basic_widgets['table_name'].text()
if table_name_user_input != '':
new_name = table_name_user_input
self.filter_obj._update(fname=Path(new_name).with_suffix('.csv'))
else:
new_name = self.filter_obj.fname.stem
self.tabNameChange.emit(new_name, False, -1, -1)
self.tab_id = JOB_COUNTER.get_id()
print(self.filter_obj)
self.tabNameChange.emit(new_name, False)

self.init_overview_ui()
self.init_function_ui()
Expand Down Expand Up @@ -3306,7 +3306,6 @@ def add_new_tab_at(self, index: int, name: str = None, is_set: bool = False):
self.tabs.tabBar().moveTab(self.tabs.currentIndex(), index)

def add_new_tab(self, name: str = None, is_set: bool = False):
tab_id = JOB_COUNTER.get_id()
new_undo_stack = QtWidgets.QUndoStack()
self.undo_group.addStack(new_undo_stack)
if name is None:
Expand All @@ -3316,9 +3315,9 @@ def add_new_tab(self, name: str = None, is_set: bool = False):
print(name)

if is_set:
tab = SetTabPage(name, parent=self.tabs, undo_stack=new_undo_stack, tab_id=tab_id)
tab = SetTabPage(name, parent=self.tabs, undo_stack=new_undo_stack)
else:
tab = FilterTabPage(self.tabs, undo_stack=new_undo_stack, tab_id=tab_id)
tab = FilterTabPage(self.tabs, undo_stack=new_undo_stack)
tab.startedClustering.connect(self.start_clustering)

tab.startedJob.connect(self.start_generic_job)
Expand All @@ -3340,8 +3339,8 @@ def add_new_tab(self, name: str = None, is_set: bool = False):
def update_gene_sets_widget(self, widget: gui_widgets.GeneSetComboBox):
widget.update_gene_sets(self.get_available_objects())

@QtCore.pyqtSlot(str, bool, int, int)
def rename_tab(self, new_name: str, is_unsaved: bool, new_id: int = -1, prev_id: int = -1):
@QtCore.pyqtSlot(str, bool)
def rename_tab(self, new_name: str, is_unsaved: bool):
if is_unsaved:
new_name += '*'
else:
Expand Down
4 changes: 3 additions & 1 deletion rnalysis/gui/gui_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,13 +320,15 @@ def result(self):


class JobCounter(QtCore.QObject):
def __init__(self):
def __init__(self, parent=None):
super().__init__(parent)
self._count = 0
self.lock = threading.Lock()

def get_id(self):
with self.lock:
self._count += 1
print(self._count)
return self._count

def get_total(self):
Expand Down

0 comments on commit bad763b

Please sign in to comment.