def setup(self): # start mscolab server self.app = APP self.app.config[ 'SQLALCHEMY_DATABASE_URI'] = mscolab_settings.SQLALCHEMY_DB_URI self.app.config['MSCOLAB_DATA_DIR'] = mscolab_settings.MSCOLAB_DATA_DIR self.app.config['UPLOAD_FOLDER'] = mscolab_settings.UPLOAD_FOLDER self.app, _, cm, fm = initialize_managers(self.app) self.fm = fm self.cm = cm db.init_app(self.app) logging.debug("starting") self.application = QtWidgets.QApplication(sys.argv) self.window = MSSMscolabWindow( data_dir=mscolab_settings.MSCOLAB_DATA_DIR, mscolab_server_url=MSCOLAB_URL_TEST) self._login() self._activate_project_at_index(0) # activate project window here by clicking button QtTest.QTest.mouseClick(self.window.chatWindowBtn, QtCore.Qt.LeftButton) QtWidgets.QApplication.processEvents() self.chat_window = self.window.chat_window QtTest.QTest.qWaitForWindowExposed(self.window) QtWidgets.QApplication.processEvents()
def setup(self): self.application = QtWidgets.QApplication(sys.argv) self.window = tv.MSS_TV_MapAppearanceDialog() self.window.show() QtWidgets.QApplication.processEvents() QtTest.QTest.qWaitForWindowExposed(self.window) QtWidgets.QApplication.processEvents()
def setup(self): self.application = QtWidgets.QApplication(sys.argv) self.tempdir = tempfile.mkdtemp() if not os.path.exists(self.tempdir): os.mkdir(self.tempdir) self.thread = multiprocessing.Process(target=application.run, args=("127.0.0.1", 8082)) self.thread.start() initial_waypoints = [ ft.Waypoint(40., 25., 0), ft.Waypoint(60., -10., 0), ft.Waypoint(40., 10, 0) ] waypoints_model = ft.WaypointsTableModel("") waypoints_model.insertRows(0, rows=len(initial_waypoints), waypoints=initial_waypoints) self.window = tv.MSSTopViewWindow(model=waypoints_model) self.window.show() QtWidgets.QApplication.processEvents() QtTest.QTest.qWait(2000) QtTest.QTest.qWaitForWindowExposed(self.window) QtWidgets.QApplication.processEvents() self.window.cbTools.currentIndexChanged.emit(1) QtWidgets.QApplication.processEvents() self.wms_control = self.window.docks[0].widget() self.wms_control.cbWMS_URL.setEditText("")
def setup(self): self.application = QtWidgets.QApplication(sys.argv) # Create an initital flight track. initial_waypoints = [ ft.Waypoint(flightlevel=0, location="EDMO", comments="take off OP"), ft.Waypoint(48.10, 10.27, 200), ft.Waypoint(52.32, 09.21, 200), ft.Waypoint(52.55, 09.99, 200), ft.Waypoint(flightlevel=0, location="Hamburg", comments="landing HH") ] waypoints_model = ft.WaypointsTableModel("") waypoints_model.insertRows(0, rows=len(initial_waypoints), waypoints=initial_waypoints) self.window = tv.MSSTableViewWindow(model=waypoints_model) self.window.show() QtWidgets.QApplication.processEvents() QtTest.QTest.qWaitForWindowExposed(self.window) QtWidgets.QApplication.processEvents()
def setup(self): self.application = QtWidgets.QApplication(sys.argv) self.view = mock.Mock() self.window = sd.SatelliteControlWidget(view=self.view) self.window.show() QtWidgets.QApplication.processEvents() QtTest.QTest.qWaitForWindowExposed(self.window) QtWidgets.QApplication.processEvents()
def setup(self): self.application = QtWidgets.QApplication(sys.argv) self.window = mss_pyui.MSSMainWindow() self.window.create_new_flight_track() self.window.show() QtWidgets.QApplication.processEvents() QtTest.QTest.qWaitForWindowExposed(self.window) QtWidgets.QApplication.processEvents()
def setup(self): self.application = QtWidgets.QApplication(sys.argv) self.capabilities = mock.Mock() self.capabilities.capabilities_document = u"Hölla die Waldfee".encode( "utf-8") self.capabilities.provider = mock.Mock() self.capabilities.identification = mock.Mock() self.capabilities.provider.contact = mock.Mock() self.capabilities.provider.contact.name = None self.capabilities.provider.contact.organization = None self.capabilities.provider.contact.email = None self.capabilities.provider.contact.address = None self.capabilities.provider.contact.postcode = None self.capabilities.provider.contact.city = None
def setup(self): self.application = QtWidgets.QApplication(sys.argv) self.view = mock.Mock() self.view.map = mock.Mock(side_effect=lambda x, y: (x, y)) self.view.map.plot = mock.Mock(return_value=[mock.Mock()]) self.window = kd.KMLOverlayControlWidget(view=self.view) self.window.show() QtWidgets.QApplication.processEvents() QtTest.QTest.qWaitForWindowExposed(self.window) # start load test self.window.select_all() self.window.remove_file() QtWidgets.QApplication.processEvents()
def setup(self): self.application = QtWidgets.QApplication(sys.argv) initial_waypoints = [ ft.Waypoint(40., 25., 0), ft.Waypoint(60., -10., 0), ft.Waypoint(40., 10, 0) ] waypoints_model = ft.WaypointsTableModel("") waypoints_model.insertRows(0, rows=len(initial_waypoints), waypoints=initial_waypoints) self.window = tv.MSSTopViewWindow(model=waypoints_model) self.window.show() QtWidgets.QApplication.processEvents() QtTest.QTest.qWaitForWindowExposed(self.window) QtWidgets.QApplication.processEvents()
def setup(self): self.application = QtWidgets.QApplication(sys.argv) self.window = MSSMscolabWindow( data_dir=mscolab_settings.MSCOLAB_DATA_DIR, mscolab_server_url=MSCOLAB_URL_TEST) self.window.show() QtWidgets.QApplication.processEvents() QtTest.QTest.qWaitForWindowExposed(self.window) QtWidgets.QApplication.processEvents() self.app = APP self.app.config[ 'SQLALCHEMY_DATABASE_URI'] = mscolab_settings.SQLALCHEMY_DB_URI self.app.config['MSCOLAB_DATA_DIR'] = mscolab_settings.MSCOLAB_DATA_DIR self.app.config['UPLOAD_FOLDER'] = mscolab_settings.UPLOAD_FOLDER self.app, _, cm, fm = initialize_managers(self.app) self.fm = fm self.cm = cm db.init_app(self.app)
def setup(self): """ User being used during test: id = 5, username = test1 """ self.app = APP self.app.config['SQLALCHEMY_DATABASE_URI'] = mscolab_settings.SQLALCHEMY_DB_URI self.app.config['MSCOLAB_DATA_DIR'] = mscolab_settings.MSCOLAB_DATA_DIR self.app, _, cm, fm = initialize_managers(self.app) self.fm = fm self.cm = cm db.init_app(self.app) self.application = QtWidgets.QApplication(sys.argv) self.window = MSSMscolabWindow(data_dir=mscolab_settings.MSCOLAB_DATA_DIR, mscolab_server_url=MSCOLAB_URL_TEST) self._login() self._activate_project_at_index(0) QtTest.QTest.mouseClick(self.window.adminWindowBtn, QtCore.Qt.LeftButton) QtWidgets.QApplication.processEvents() self.admin_window = self.window.admin_window QtTest.QTest.qWaitForWindowExposed(self.window) QtWidgets.QApplication.processEvents()
def _setup(self, widget_type): self.application = QtWidgets.QApplication(sys.argv) if widget_type == "hsec": self.view = HSecViewMockup() else: self.view = VSecViewMockup() self.tempdir = tempfile.mkdtemp() if not os.path.exists(self.tempdir): os.mkdir(self.tempdir) QtTest.QTest.qWait(3000) self.thread = multiprocessing.Process(target=application.run, args=("127.0.0.1", 8082)) self.thread.start() if widget_type == "hsec": self.window = wc.HSecWMSControlWidget(view=self.view, wms_cache=self.tempdir) else: initial_waypoints = [ ft.Waypoint(40., 25., 0), ft.Waypoint(60., -10., 0), ft.Waypoint(40., 10, 0) ] waypoints_model = ft.WaypointsTableModel("") waypoints_model.insertRows(0, rows=len(initial_waypoints), waypoints=initial_waypoints) self.window = wc.VSecWMSControlWidget( view=self.view, wms_cache=self.tempdir, waypoints_model=waypoints_model) self.window.show() QtWidgets.QApplication.processEvents() QtTest.QTest.qWait(2000) QtTest.QTest.qWaitForWindowExposed(self.window) QtTest.QTest.mouseClick(self.window.cbCacheEnabled, QtCore.Qt.LeftButton) QtWidgets.QApplication.processEvents()
def setup(self, mockmessage): self.application = QtWidgets.QApplication(sys.argv) self.window = editor.EditorMainWindow() self.save_file_name = self.save_file_name self.window.show()
def main(): try: prefix = os.environ["CONDA_DEFAULT_ENV"] except KeyError: prefix = "" app_prefix = prefix if prefix: app_prefix = "-{}".format(prefix) icon_hash = hashlib.md5('.'.join([__version__, app_prefix]).encode('utf-8')).hexdigest() parser = argparse.ArgumentParser() parser.add_argument("-v", "--version", help="show version", action="store_true", default=False) parser.add_argument("--debug", help="show debugging log messages on console", action="store_true", default=False) parser.add_argument("--logfile", help="Specify logfile location. Set to empty string to disable.", action="store", default=os.path.join(constants.MSS_CONFIG_PATH, "mss_pyui.log")) parser.add_argument("-m", "--menu", help="adds mss to menu", action="store_true", default=False) parser.add_argument("-d", "--deinstall", help="removes mss from menu", action="store_true", default=False) args = parser.parse_args() if args.version: print("***********************************************************************") print("\n Mission Support System (mss)\n") print("***********************************************************************") print("Documentation: http://mss.rtfd.io") print("Version:", __version__) sys.exit() setup_logging(args) if args.menu: # Experimental feature to get mss into application menu if platform.system() == "Linux": icon_size = '48x48' src_icon_path = icons(icon_size) icon_destination = constants.POSIX["icon_destination"].format(icon_size, icon_hash) dirname = os.path.dirname(icon_destination) if not os.path.exists(dirname): os.makedirs(dirname) shutil.copyfile(src_icon_path, icon_destination) desktop = constants.POSIX["desktop"] application_destination = constants.POSIX["application_destination"].format(app_prefix) dirname = os.path.dirname(application_destination) if not os.path.exists(dirname): os.makedirs(dirname) if prefix: prefix = "({})".format(prefix) desktop = desktop.format(prefix, os.path.join(sys.prefix, "bin", "mss"), icon_destination) with open(application_destination, 'w') as f: f.write(desktop) logging.info("menu entry created") sys.exit() if args.deinstall: application_destination = constants.POSIX["application_destination"].format(app_prefix) if os.path.exists(application_destination): os.remove(application_destination) icon_size = '48x48' icon_destination = constants.POSIX["icon_destination"].format(icon_size, icon_hash) if os.path.exists(icon_destination): os.remove(icon_destination) logging.info("menu entry removed") sys.exit() logging.info("MSS Version: %s", __version__) logging.info("Python Version: %s", sys.version) logging.info("Platform: %s (%s)", platform.platform(), platform.architecture()) logging.info("Launching user interface...") application = QtWidgets.QApplication(sys.argv) application.setWindowIcon(QtGui.QIcon(icons('128x128'))) application.setApplicationDisplayName("MSS") mainwindow = MSSMainWindow() mainwindow.create_new_flight_track() mainwindow.show() sys.exit(application.exec_())
def setup(self): self.application = QtWidgets.QApplication(sys.argv) self.view = HSecViewMockup() self.window = wc.HSecWMSControlWidget(view=self.view) self.window.show() QtWidgets.QApplication.processEvents()