def restoreSingleWindow(self, plotWindowInterface): ''' Restores size and position of a single, just-added plot window :param plotWindowInterface: an insance of PlotWindowInterface - can be fetchet from PlotFrameWidget using PlotFrameWidgetInstance.plotInterface :return: None ''' windows_layout_dict = Configuration.getSetting('WindowsLayout') # print 'windowsLayoutDict=', windowsLayoutDict if not windows_layout_dict: return if str(plotWindowInterface.title) in list(windows_layout_dict.keys()): window_data_dict = windows_layout_dict[str(plotWindowInterface.title)] gwd = GraphicsWindowData() gwd.fromDict(window_data_dict) if gwd.winType != 'plot': return plot_window = self.vm.lastActiveRealWindow plot_window.resize(gwd.winSize) plot_window.move(gwd.winPosition) plot_window.setWindowTitle(plotWindowInterface.title)
def restore_plots_layout(self): ''' This function restores plot layout - it is called from CompuCellSetup.py inside mainLoopNewPlayer function :return: None ''' windows_layout_dict = Configuration.getSetting('WindowsLayout') if not windows_layout_dict: return for winId, win in self.vm.win_inventory.getWindowsItems(PLOT_WINDOW_LABEL): plot_frame_widget = win.widget() plot_interface = plot_frame_widget.plotInterface() # plot_frame_widget.plotInterface is a weakref if not plot_interface: # if weakref to plot_interface is None we ignore such window continue if str(plot_interface.title) in list(windows_layout_dict.keys()): window_data_dict = windows_layout_dict[str(plot_interface.title)] gwd = GraphicsWindowData() gwd.fromDict(window_data_dict) if gwd.winType != 'plot': return win.resize(gwd.winSize) win.move(gwd.winPosition) win.setWindowTitle(plot_interface.title)
def get_plot_windows_layout_dict(self): windows_layout = {} for winId, win in self.vm.win_inventory.getWindowsItems(PLOT_WINDOW_LABEL): plot_frame_widget = win.widget() # getting weakref plot_interface = plot_frame_widget.plotInterface() if not plot_interface: continue gwd = GraphicsWindowData() gwd.sceneName = plot_interface.title gwd.winType = 'plot' plot_window = plot_interface.plotWindow mdi_plot_window = win gwd.winSize = mdi_plot_window.size() gwd.winPosition = mdi_plot_window.pos() windows_layout[gwd.sceneName] = gwd.toDict() return windows_layout
def getPlotWindowsLayoutDict(self): windowsLayout = {} for winId, win in self.vm.win_inventory.getWindowsItems(PLOT_WINDOW_LABEL): plotFrameWidget = win.widget() plotInterface = plotFrameWidget.plotInterface() # getting weakref if not plotInterface: continue gwd = GraphicsWindowData() gwd.sceneName = plotInterface.title gwd.winType = 'plot' plotWindow = plotInterface.plotWindow mdiPlotWindow = win # mdiPlotWindow = self.vm.findMDISubWindowForWidget(plotWindow) print('plotWindow=', plotWindow) print('mdiPlotWindow=', mdiPlotWindow) gwd.winSize = mdiPlotWindow.size() gwd.winPosition = mdiPlotWindow.pos() windowsLayout[gwd.sceneName] = gwd.toDict() return windowsLayout