Skip to content

Commit

Permalink
#93 Fix disable_dialog_boxes (#96)
Browse files Browse the repository at this point in the history
* #93 Fix disable_dialog_boxes
* #93 Re-enable the info windows: EnableInfoWinFlashBPs and EnableInfoWinFlashD
  • Loading branch information
kettenbach-it committed Apr 12, 2021
1 parent 1e26587 commit c7a8b53
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
16 changes: 10 additions & 6 deletions pylink/jlink.py
Original file line number Diff line number Diff line change
Expand Up @@ -955,9 +955,6 @@ def exec_command(self, cmd):
def enable_dialog_boxes(self):
"""Enables showing dialog boxes on certain methods.
Note:
Dialog boxes only appear on Windows platforms.
Note:
This can be used for batch or automized test running.
Expand All @@ -968,14 +965,14 @@ def enable_dialog_boxes(self):
``None``
"""
self.exec_command('SetBatchMode = 0')
self.exec_command("HideDeviceSelection = 0")
self.exec_command("EnableInfoWinFlashDL")
self.exec_command("EnableInfoWinFlashBPs")

@minimum_required('5.02')
def disable_dialog_boxes(self):
"""Disables showing dialog boxes on certain methods.
Note:
Dialog boxes only appear on Windows platforms.
Warning:
This has the effect of also silencing dialog boxes that appear when
updating firmware / to confirm updating firmware.
Expand All @@ -994,6 +991,13 @@ def disable_dialog_boxes(self):
self.exec_command('SuppressInfoUpdateFW')
self.exec_command('SetBatchMode = 1')

# SuppressControlPanel
self.exec_command("HideDeviceSelection = 1")
self.exec_command("SuppressControlPanel")
# Hide Flash Windows
self.exec_command("DisableInfoWinFlashDL")
self.exec_command("DisableInfoWinFlashBPs")

@open_required
def jtag_configure(self, instr_regs=0, data_bits=0):
"""Configures the JTAG scan chain to determine which CPU to address.
Expand Down
9 changes: 8 additions & 1 deletion tests/unit/test_jlink.py
Original file line number Diff line number Diff line change
Expand Up @@ -1175,7 +1175,10 @@ def test_jlink_enable_dialog_boxes(self):
self.dll.JLINKARM_GetDLLVersion.return_value = 50200
self.jlink.exec_command = mock.Mock()
self.jlink.enable_dialog_boxes()
self.jlink.exec_command.assert_called_with('SetBatchMode = 0')
self.jlink.exec_command.assert_any_call('SetBatchMode = 0')
self.jlink.exec_command.assert_any_call('HideDeviceSelection = 0')
self.jlink.exec_command.assert_any_call("EnableInfoWinFlashDL")
self.jlink.exec_command.assert_any_call("EnableInfoWinFlashBPs")

def test_jlink_disable_dialog_boxes(self):
"""Tests disabling the dialog boxes shown by the DLL.
Expand All @@ -1192,6 +1195,10 @@ def test_jlink_disable_dialog_boxes(self):
self.jlink.exec_command.assert_any_call('SilentUpdateFW')
self.jlink.exec_command.assert_any_call('SuppressInfoUpdateFW')
self.jlink.exec_command.assert_any_call('SetBatchMode = 1')
self.jlink.exec_command.assert_any_call('HideDeviceSelection = 1')
self.jlink.exec_command.assert_any_call('SuppressControlPanel')
self.jlink.exec_command.assert_any_call('DisableInfoWinFlashDL')
self.jlink.exec_command.assert_any_call('DisableInfoWinFlashBPs')

def test_jlink_jtag_configure(self):
"""Tests the J-Link ``jtag_configure()`` method.
Expand Down

0 comments on commit c7a8b53

Please sign in to comment.