Skip to content

Commit

Permalink
Merge pull request bitcraze#638 from bitcraze/config-file-regex-fix
Browse files Browse the repository at this point in the history
Fixed regex bug in file dialog
  • Loading branch information
krichardsson authored Nov 29, 2022
2 parents 473fabd + 47ac6be commit 45ba7e6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/cfclient/ui/dialogs/anchor_position_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import logging

import cfclient
from cfclient.utils.logconfigreader import FILE_REGEX_YAML
from PyQt5 import QtWidgets
from PyQt5 import uic
from PyQt5.QtCore import QAbstractTableModel, QVariant, Qt
Expand Down Expand Up @@ -212,7 +213,7 @@ def anchor_postions_updated(self, anchor_positions):
self._data_model.anchor_postions_updated(anchor_positions)

def _load_button_clicked(self):
names = QFileDialog.getOpenFileName(self, 'Open file', self._helper.current_folder, "*.yaml;*.*")
names = QFileDialog.getOpenFileName(self, 'Open file', self._helper.current_folder, FILE_REGEX_YAML)

if names[0] == '':
return
Expand All @@ -234,7 +235,7 @@ def _save_button_clicked(self):
for id, pos in anchor_positions.items():
data[id] = {'x': pos[0], 'y': pos[1], 'z': pos[2]}

names = QFileDialog.getSaveFileName(self, 'Save file', self._helper.current_folder, "*.yaml;*.*")
names = QFileDialog.getSaveFileName(self, 'Save file', self._helper.current_folder, FILE_REGEX_YAML)

if names[0] == '':
return
Expand Down
5 changes: 3 additions & 2 deletions src/cfclient/ui/tabs/lighthouse_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
from cfclient.ui.dialogs.lighthouse_bs_geometry_dialog import LighthouseBsGeometryDialog
from cfclient.ui.dialogs.basestation_mode_dialog import LighthouseBsModeDialog
from cfclient.ui.dialogs.lighthouse_system_type_dialog import LighthouseSystemTypeDialog
from cfclient.utils.logconfigreader import FILE_REGEX_YAML

from vispy import scene
import numpy as np
Expand Down Expand Up @@ -676,7 +677,7 @@ def _update_basestation_status_indicators(self):
label.setToolTip('')

def _load_sys_config_button_clicked(self):
names = QFileDialog.getOpenFileName(self, 'Open file', self._helper.current_folder, "*.yaml;;*.*")
names = QFileDialog.getOpenFileName(self, 'Open file', self._helper.current_folder, FILE_REGEX_YAML)

if names[0] == '':
return
Expand All @@ -698,7 +699,7 @@ def _calibration_read_cb(self, calibs):
self._save_sys_config(self._lh_geos, calibs, system_type)

def _save_sys_config(self, geos, calibs, system_type):
names = QFileDialog.getSaveFileName(self, 'Save file', self._helper.current_folder, "*.yaml;;*.*")
names = QFileDialog.getSaveFileName(self, 'Save file', self._helper.current_folder, FILE_REGEX_YAML)

if names[0] == '':
return
Expand Down
2 changes: 2 additions & 0 deletions src/cfclient/utils/logconfigreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
DEFAULT_CONF_NAME = 'log_config'
DEFAULT_CATEGORY_NAME = 'category'

FILE_REGEX_YAML = "Config *.yaml;;All *.*"


class LogConfigReader():
"""Reads logging configurations from file"""
Expand Down
2 changes: 0 additions & 2 deletions src/cfloader/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
from cflib.bootloader import Bootloader, Target
from cflib.bootloader.boottypes import BootVersion

from typing import Optional, List


def main():
# Initialise the CRTP link driver
Expand Down

0 comments on commit 45ba7e6

Please sign in to comment.