def test_find_window_finds_top_level_widget(self):
     top_level_widget = QMainWindow()
     interface_name = 'ISIS Reflectometry'
     top_level_widget.setObjectName(interface_name)
     window = find_window(interface_name, QMainWindow)
     self.assertIs(top_level_widget, window,
                   "Window found was not the widget supplied")
Exemple #2
0
 def launch_custom_cpp_gui(self, interface_name, submenu=None):
     """Create a new interface window if one does not already exist,
     else show existing window"""
     object_name = 'custom-cpp-interface-' + interface_name
     window = find_window(object_name, QMainWindow)
     if window is None:
         interface = self.interface_manager.createSubWindow(interface_name)
         interface.setObjectName(object_name)
         interface.setAttribute(Qt.WA_DeleteOnClose, True)
         # make indirect interfaces children of workbench
         if submenu == "Indirect":
             interface.setParent(self, interface.windowFlags())
         interface.show()
     else:
         if window.windowState() == Qt.WindowMinimized:
             window.setWindowState(Qt.WindowActive)
         else:
             window.raise_()
Exemple #3
0
 def launch_custom_cpp_gui(self, interface_name, submenu=None):
     """Create a new interface window if one does not already exist,
     else show existing window"""
     object_name = 'custom-cpp-interface-' + interface_name
     window = find_window(object_name, QMainWindow)
     if window is None:
         interface = self.interface_manager.createSubWindow(interface_name)
         interface.setObjectName(object_name)
         interface.setAttribute(Qt.WA_DeleteOnClose, True)
         parent, flags = get_window_config()
         if parent:
             interface.setParent(parent, flags)
         interface.show()
     else:
         if window.windowState() == Qt.WindowMinimized:
             window.setWindowState(Qt.WindowActive)
         else:
             window.raise_()
 def test_find_window_returns_none_if_no_widget_exists(self):
     interface_name = 'ISIS Reflectometry'
     window = find_window(interface_name, QMainWindow)
     self.assertIsNone(window, "Found a widget when none expected")