Skip to content

Commit

Permalink
Fixes : MSCOLAB File Import Abort Error (#2635)
Browse files Browse the repository at this point in the history
  • Loading branch information
annapurna-gupta authored Feb 12, 2025
1 parent 7d597f2 commit f2549d8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
15 changes: 8 additions & 7 deletions mslib/msui/msui_mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -671,14 +671,15 @@ def handle_import_local(self, extension, function, pickertype):
self.last_save_directory,
f"Flight Track (*.{extension});;All files (*.*)",
pickertype=pickertype)
if filenames is None:
return
if self.local_active:
if filenames is not None:
activate = True
if len(filenames) > 1:
activate = False
for name in filenames:
self.create_new_flight_track(filename=name, function=function, activate=activate)
self.last_save_directory = fs.path.dirname(name)
activate = True
if len(filenames) > 1:
activate = False
for name in filenames:
self.create_new_flight_track(filename=name, function=function, activate=activate)
self.last_save_directory = fs.path.dirname(name)
else:
for name in filenames:
self.mscolab.handle_import_msc(name, extension, function, pickertype)
Expand Down
16 changes: 16 additions & 0 deletions tests/_test_msui/test_mscolab.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,22 @@ def test_import_file(self, name, qtbot):
imported_wp = self.window.mscolab.waypoints_model
assert len(imported_wp.waypoints) == name[2]

def test_none_import_file(self, qtbot):
with mock.patch("mslib.msui.msui_mainwindow.get_open_filenames", return_value=None) as mockopen:
self._connect_to_mscolab(qtbot)
modify_config_file({"MSS_auth": {self.url: self.userdata[0]}})
self._login(qtbot, emailid=self.userdata[0], password=self.userdata[2])
self._activate_operation_at_index(0)
wp = self.window.mscolab.waypoints_model
assert len(wp.waypoints) == 2
for action in self.window.menuImportFlightTrack.actions():
if action.objectName() == "actionImportFlightTrackFTML":
action.trigger()
break
assert mockopen.call_count == 1
imported_wp = self.window.mscolab.waypoints_model
assert len(imported_wp.waypoints) == 2

def test_work_locally_toggle(self, qtbot):
self._connect_to_mscolab(qtbot)
modify_config_file({"MSS_auth": {self.url: self.userdata[0]}})
Expand Down

0 comments on commit f2549d8

Please sign in to comment.