Skip to content

Commit

Permalink
Open directory with previous firmware when selecting another firmware
Browse files Browse the repository at this point in the history
  • Loading branch information
remibert committed Jul 16, 2022
1 parent 2f4847e commit 59cc352
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tools/camflasher/dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,13 @@ def accept(self):

def on_firmware_clicked(self, event):
""" Selection of firmware button clicked """
firmware = QFileDialog.getOpenFileName(self, caption='Select firmware file', directory=str(Path.home()),filter="Firmware files (*.bin)")
path = str(Path.home())
if self.dialog.firmware.maxCount() > 0:
firmware = self.dialog.firmware.currentText()
if os.path.exists(firmware):
path = os.path.split(firmware)[0]

firmware = QFileDialog.getOpenFileName(self, caption='Select firmware file', directory=path, filter="Firmware files (*.bin)")
if firmware != ('', ''):
for i in range(self.dialog.firmware.count()):
if self.dialog.firmware.itemText(i) == firmware[0]:
Expand Down

0 comments on commit 59cc352

Please sign in to comment.