Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/frontEnd/Application.py
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,21 @@ def __init__(self, *args):
self.middleSplit.setSizes([self.width(), int(self.height() / 2)])
self.setLayout(self.mainLayout)

def collapse_console_area(self):
"""Collapse the console area to minimal height."""
current_sizes = self.middleSplit.sizes()
total_height = sum(current_sizes)
minimal_console_height = 0
dock_area_height = total_height - minimal_console_height
self.middleSplit.setSizes([dock_area_height, minimal_console_height])

def restore_console_area(self):
"""Restore the console area to normal height."""
total_height = sum(self.middleSplit.sizes())
dock_area_height = int(total_height * 0.7) # 70% for dock area
console_height = total_height - dock_area_height # 30% for console
self.middleSplit.setSizes([dock_area_height, console_height])


# It is main function of the module and starts the application
def main(args):
Expand Down
39 changes: 38 additions & 1 deletion src/frontEnd/DockArea.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from PyQt5 import QtCore, QtWidgets
from ngspiceSimulation.pythonPlotting import plotWindow
from ngspiceSimulation import plotWindow
from ngspiceSimulation.NgspiceWidget import NgspiceWidget
from configuration.Appconfig import Appconfig
from modelEditor.ModelEditor import ModelEditorclass
Expand Down Expand Up @@ -40,6 +40,8 @@ def __init__(self):
"""This act as constructor for class DockArea."""
QtWidgets.QMainWindow.__init__(self)
self.obj_appconfig = Appconfig()
# Track plotting docks
self.active_plotting_docks = set()

for dockName in dockList:
dock[dockName] = QtWidgets.QDockWidget(dockName)
Expand All @@ -60,6 +62,27 @@ def __init__(self):
# self.tabifyDockWidget(dock['Notes'],dock['Blank'])
self.show()

def get_main_view_reference(self):
"""Get reference to the MainView widget."""
parent = self.parent()
while parent:
if hasattr(parent, 'collapse_console_area'):
return parent
parent = parent.parent()
return None

def on_dock_activated(self, dock_widget):
"""Handle when any dock becomes active."""
main_view = self.get_main_view_reference()
if not main_view:
return

# Check if activated dock is a plotting dock
if dock_widget in self.active_plotting_docks:
main_view.collapse_console_area()
else:
main_view.restore_console_area()

def createTestEditor(self):
"""This function create widget for Library Editor"""
global count
Expand Down Expand Up @@ -115,11 +138,25 @@ def plottingEditor(self):
dock[dockName + str(count)])
self.tabifyDockWidget(dock['Welcome'],
dock[dockName + str(count)])

# Track this as a plotting dock
self.active_plotting_docks.add(dock[dockName + str(count)])

# Connect to tab change signal
try:
self.tabifiedDockWidgetActivated.connect(self.on_dock_activated)
except:
pass # In case signal is already connected

dock[dockName + str(count)].setVisible(True)
dock[dockName + str(count)].setFocus()
dock[dockName + str(count)].raise_()

# Collapse console immediately
main_view = self.get_main_view_reference()
if main_view:
QtCore.QTimer.singleShot(100, main_view.collapse_console_area)

temp = self.obj_appconfig.current_project['ProjectName']
if temp:
self.obj_appconfig.dock_dict[temp].append(
Expand Down
Loading