Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed regex bug in file dialog #638

Merged
merged 2 commits into from
Nov 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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