Try to hide all axes even when removed
							parent
							
								
									7f91cda899
								
							
						
					
					
						commit
						73912ab9a8
					
				| 
						 | 
					@ -116,14 +116,6 @@ class GodWidget(QWidget):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.hbox.addLayout(self.vbox)
 | 
					        self.hbox.addLayout(self.vbox)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # self.toolbar_layout = QHBoxLayout()
 | 
					 | 
				
			||||||
        # self.toolbar_layout.setContentsMargins(0, 0, 0, 0)
 | 
					 | 
				
			||||||
        # self.vbox.addLayout(self.toolbar_layout)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        # self.init_timeframes_ui()
 | 
					 | 
				
			||||||
        # self.init_strategy_ui()
 | 
					 | 
				
			||||||
        # self.vbox.addLayout(self.hbox)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        self._chart_cache: dict[
 | 
					        self._chart_cache: dict[
 | 
				
			||||||
            str,
 | 
					            str,
 | 
				
			||||||
            tuple[LinkedSplits, LinkedSplits],
 | 
					            tuple[LinkedSplits, LinkedSplits],
 | 
				
			||||||
| 
						 | 
					@ -143,15 +135,18 @@ class GodWidget(QWidget):
 | 
				
			||||||
        # and the window does not? Never right?!
 | 
					        # and the window does not? Never right?!
 | 
				
			||||||
        # self.reg_for_resize(self)
 | 
					        # self.reg_for_resize(self)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # TODO: strat loader/saver that we don't need yet.
 | 
				
			||||||
 | 
					    # def init_strategy_ui(self):
 | 
				
			||||||
 | 
					    #     self.toolbar_layout = QHBoxLayout()
 | 
				
			||||||
 | 
					    #     self.toolbar_layout.setContentsMargins(0, 0, 0, 0)
 | 
				
			||||||
 | 
					    #     self.vbox.addLayout(self.toolbar_layout)
 | 
				
			||||||
 | 
					    #     self.strategy_box = StrategyBoxWidget(self)
 | 
				
			||||||
 | 
					    #     self.toolbar_layout.addWidget(self.strategy_box)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @property
 | 
					    @property
 | 
				
			||||||
    def linkedsplits(self) -> LinkedSplits:
 | 
					    def linkedsplits(self) -> LinkedSplits:
 | 
				
			||||||
        return self.rt_linked
 | 
					        return self.rt_linked
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # XXX: strat loader/saver that we don't need yet.
 | 
					 | 
				
			||||||
    # def init_strategy_ui(self):
 | 
					 | 
				
			||||||
    #     self.strategy_box = StrategyBoxWidget(self)
 | 
					 | 
				
			||||||
    #     self.toolbar_layout.addWidget(self.strategy_box)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def set_chart_symbols(
 | 
					    def set_chart_symbols(
 | 
				
			||||||
        self,
 | 
					        self,
 | 
				
			||||||
        group_key: tuple[str],  # of form <fqsn>.<providername>
 | 
					        group_key: tuple[str],  # of form <fqsn>.<providername>
 | 
				
			||||||
| 
						 | 
					@ -432,7 +427,7 @@ class LinkedSplits(QWidget):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.godwidget = godwidget
 | 
					        self.godwidget = godwidget
 | 
				
			||||||
        self.chart: ChartPlotWidget = None  # main (ohlc) chart
 | 
					        self.chart: ChartPlotWidget = None  # main (ohlc) chart
 | 
				
			||||||
        self.subplots: dict[tuple[str, ...], ChartPlotWidget] = {}
 | 
					        self.subplots: dict[str, ChartPlotWidget] = {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.godwidget = godwidget
 | 
					        self.godwidget = godwidget
 | 
				
			||||||
        # placeholder for last appended ``PlotItem``'s bottom axis.
 | 
					        # placeholder for last appended ``PlotItem``'s bottom axis.
 | 
				
			||||||
| 
						 | 
					@ -1058,6 +1053,7 @@ class ChartPlotWidget(pg.PlotWidget):
 | 
				
			||||||
            # breakpoint()
 | 
					            # breakpoint()
 | 
				
			||||||
            return
 | 
					            return
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        # should trigger broadcast on all overlays right?
 | 
				
			||||||
        view.setXRange(
 | 
					        view.setXRange(
 | 
				
			||||||
            min=l + x_shift,
 | 
					            min=l + x_shift,
 | 
				
			||||||
            max=r + x_shift,
 | 
					            max=r + x_shift,
 | 
				
			||||||
| 
						 | 
					@ -1107,12 +1103,6 @@ class ChartPlotWidget(pg.PlotWidget):
 | 
				
			||||||
        pi.chart_widget = self
 | 
					        pi.chart_widget = self
 | 
				
			||||||
        pi.hideButtons()
 | 
					        pi.hideButtons()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # hide all axes not named by ``axis_side``
 | 
					 | 
				
			||||||
        for axname in (
 | 
					 | 
				
			||||||
            ({'bottom'} | allowed_sides) - {axis_side}
 | 
					 | 
				
			||||||
        ):
 | 
					 | 
				
			||||||
            pi.hideAxis(axname)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        # compose this new plot's graphics with the current chart's
 | 
					        # compose this new plot's graphics with the current chart's
 | 
				
			||||||
        # existing one but with separate axes as neede and specified.
 | 
					        # existing one but with separate axes as neede and specified.
 | 
				
			||||||
        self.pi_overlay.add_plotitem(
 | 
					        self.pi_overlay.add_plotitem(
 | 
				
			||||||
| 
						 | 
					@ -1126,6 +1116,15 @@ class ChartPlotWidget(pg.PlotWidget):
 | 
				
			||||||
            link_axes=(0,),
 | 
					            link_axes=(0,),
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        # hide all axes not named by ``axis_side``
 | 
				
			||||||
 | 
					        for axname in (
 | 
				
			||||||
 | 
					            ({'bottom'} | allowed_sides) - {axis_side}
 | 
				
			||||||
 | 
					        ):
 | 
				
			||||||
 | 
					            try:
 | 
				
			||||||
 | 
					                pi.hideAxis(axname)
 | 
				
			||||||
 | 
					            except Exception:
 | 
				
			||||||
 | 
					                pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # add axis title
 | 
					        # add axis title
 | 
				
			||||||
        # TODO: do we want this API to still work?
 | 
					        # TODO: do we want this API to still work?
 | 
				
			||||||
        # raxis = pi.getAxis('right')
 | 
					        # raxis = pi.getAxis('right')
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue