Make (cache) search-results a `set` and avoid overlay duplicate entries

multichartz_backup
Tyler Goodlet 2023-01-05 21:05:23 -05:00
parent 6dc09a5709
commit 92060fa6d3
2 changed files with 7 additions and 21 deletions

View File

@ -127,7 +127,10 @@ class GodWidget(QWidget):
# self.init_strategy_ui() # self.init_strategy_ui()
# self.vbox.addLayout(self.hbox) # self.vbox.addLayout(self.hbox)
self._chart_cache: dict[str, LinkedSplits] = {} self._chart_cache: dict[
str,
tuple[LinkedSplits, LinkedSplits],
] = {}
self.hist_linked: Optional[LinkedSplits] = None self.hist_linked: Optional[LinkedSplits] = None
self.rt_linked: Optional[LinkedSplits] = None self.rt_linked: Optional[LinkedSplits] = None
@ -147,23 +150,6 @@ class GodWidget(QWidget):
def linkedsplits(self) -> LinkedSplits: def linkedsplits(self) -> LinkedSplits:
return self.rt_linked return self.rt_linked
# def init_timeframes_ui(self):
# self.tf_layout = QHBoxLayout()
# self.tf_layout.setSpacing(0)
# self.tf_layout.setContentsMargins(0, 12, 0, 0)
# time_frames = ('1M', '5M', '15M', '30M', '1H', '1D', '1W', 'MN')
# btn_prefix = 'TF'
# for tf in time_frames:
# btn_name = ''.join([btn_prefix, tf])
# btn = QtWidgets.QPushButton(tf)
# # TODO:
# btn.setEnabled(False)
# setattr(self, btn_name, btn)
# self.tf_layout.addWidget(btn)
# self.toolbar_layout.addLayout(self.tf_layout)
# XXX: strat loader/saver that we don't need yet. # XXX: strat loader/saver that we don't need yet.
# def init_strategy_ui(self): # def init_strategy_ui(self):
# self.strategy_box = StrategyBoxWidget(self) # self.strategy_box = StrategyBoxWidget(self)

View File

@ -624,10 +624,10 @@ class SearchWidget(QtWidgets.QWidget):
godw = self.godwidget godw = self.godwidget
# first entry in the cache is the current symbol(s) # first entry in the cache is the current symbol(s)
fqsns = [] fqsns = set()
for multi_fqsns in list(godw._chart_cache): for multi_fqsns in list(godw._chart_cache):
fqsns.extend(list(multi_fqsns)) for fqsn in set(multi_fqsns):
fqsns.add(fqsn)
self.view.set_section_entries( self.view.set_section_entries(
'cache', 'cache',