Skip to content

Commit 5b6c128

Browse files
Add exclusions to newline formatter.
1 parent 0e4820c commit 5b6c128

File tree

7 files changed

+48
-12
lines changed

7 files changed

+48
-12
lines changed

Makefile.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -879,11 +879,13 @@ cd console_backend/tests && python ../../utils/bench_runner.py --frontend_mem --
879879
'''
880880

881881
[tasks.newline-terminator]
882+
env = { EXCLUSION_PATTERNS = [".png", "docs", "resources/images"] }
882883
private = true
883884
script_runner = "python"
884885
script_extension = "py"
885886
script = '''
886887
import os
888+
import re
887889
import sys
888890
import subprocess
889891
def raises_exc(func):
@@ -900,6 +902,9 @@ try_open_text = lambda fn: lambda: (open(fn, "ta"), open(fn, "tr").read(4096))
900902
valid_file = lambda fn: os.path.getsize(fn) > 0 and not raises_exc(try_open_text(fn))
901903
no_trailing_lf = lambda fn: valid_file(fn) and not has_newline(fn)
902904
all_files = subprocess.check_output(["git", "ls-files"]).decode('utf8').splitlines()
905+
exclusion_substrings = os.environ.get("EXCLUSION_PATTERNS")
906+
exclusion_substrings = exclusion_substrings.split(";")
907+
all_files = [x for x in all_files if not any([re.match(f".*{y}", x) for y in exclusion_substrings])]
903908
no_newline = list(map(append_newline, filter(no_trailing_lf, all_files)))
904909
footer = "*********************************************\n"
905910
err = "ERROR: " if dry_run else "Fixing "

docs/imgs/app-diagram.drawio

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<mxfile host="app.diagrams.net" modified="2021-10-25T18:02:02.297Z" agent="5.0 (X11)" etag="Pipex7-AcuOoGR8RTcAn" version="15.5.9" type="google"><diagram name="Page-1" id="5d7acffa-a066-3a61-03fe-96351882024d">5Vtbb6M6EP41PLYCG3N5bNK9SKtdVafnsvvoghNQCc4ap0321x8DNgFMGpIG0rRRpcIAE/i+b4YZ2zHgdLH+wvAy+k5DkhjADNcGvDUAsEwTin+5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ZdoT3V5wuQL4VjK08o6ZF+7rr/9uMfJEHq633FrPKjXeFkkuAj7yPAEeRY6YFcg1mlEep5FQ+VZWx/gHzMyr0SP1ghO4IOzdlnuiwSK24UIejplp4m89tAOcI/M+LbWmfXL91tH6kQ6m2VkkGC0uwYnLqA0gla/0mi4kNWz2FsEzn97wF3EnI+L3h5w+qSPSAo8TudZUbo8aDC+1yFeF3rtN3jH8Puog7y2cxGq1vNoz3mL4VR9Gb25nkfPDtxFzJN15NGzA6dPlFXF9ofKorZGTcdUmTtmFlWc16i5n9wZQ4/8qz5IbZdNkOeiczZBYEcTdPqGxwXayNSxLY+z39XAowtIb6WrqQJTzpOOqSJX8HjOVnq02QIEzRb16OjGWb0PdjkaWkOHtSjHSybEWVTsWAewfp5xbwi1ccLeI996DQDHHXJEeuv04Qm1rRMSalsjE9qj3cqe40WCi2qpmDaWq9p30PS6NUdme0jZcvRSCtodtRQcbPUz7Fo1vnNGvb5S7E3Ni7/A/xiBc+XrswVHL7C50nyNvcpCbxplaV0ghcN3tWj4IOmoeTfgNBk69xp50JXqtDBeMhoIIhutUq8w/ljsIldbYqHTO+pCcaiPRjxjHkTGoDN/r8u7fVYpvTyFZ15DS5UMA+Rs1M6z7RUyfRO21VoV55nXqtJ4Q5N4SM/qOCjwa77X303oH1yN2R1h3vmzhsPDXOxufx5YMrr9ESb89D8=</diagram></mxfile>
1+
<mxfile host="app.diagrams.net" modified="2021-10-25T18:02:02.297Z" agent="5.0 (X11)" etag="Pipex7-AcuOoGR8RTcAn" version="15.5.9" type="google"><diagram name="Page-1" id="5d7acffa-a066-3a61-03fe-96351882024d">5Vtbb6M6EP41PLYCG3N5bNK9SKtdVafnsvvoghNQCc4ap0321x8DNgFMGpIG0rRRpcIAE/i+b4YZ2zHgdLH+wvAy+k5DkhjADNcGvDUAsEwTin+5ZSMtluOUljmLQ2nbGu7jP0RdKq2rOCRZ40ROacLjZdMY0DQlAW/YMGP0uXnajCbNb13iOdEM9wFOdOt/ccgj9Rim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SP1ghO4IOzdlnuiwSK24UIejplp4m89tAOcI/M+LbWmfXL91tH6kQ6m2VkkGC0uwYnLqA0gla/0mi4kNWz2FsEzn97wF3EnI+L3h5w+qSPSAo8TudZUbo8aDC+1yFeF3rtN3jH8Puog7y2cxGq1vNoz3mL4VR9Gb25nkfPDtxFzJN15NGzA6dPlFXF9ofKorZGTcdUmTtmFlWc16i5n9wZQ4/8qz5IbZdNkOeiczZBYEcTdPqGxwXayNSxLY+z39XAowtIb6WrqQJTzpOOqSJX8HjOVnq02QIEzRb16OjGWb0PdjkaWkOHtSjHSybEWVTsWAewfp5xbwi1ccLeI996DQDHHXJEeuv04Qm1rRMSalsjE9qj3cqe40WCi2qpmDaWq9p30PS6NUdme0jZcvRSCtodtRQcbPUz7Fo1vnNGvb5S7E3Ni7/A/xiBc+XrswVHL7C50nyNvcpCbxplaV0ghcN3tWj4IOmoeTfgNBk69xp50JXqtDBeMhoIIhutUq8w/ljsIldbYqHTO+pCcaiPRjxjHkTGoDN/r8u7fVYpvTyFZ15DS5UMA+Rs1M6z7RUyfRO21VoV55nXqtJ4Q5N4SM/qOCjwa77X303oH1yN2R1h3vmzhsPDXOxufx5YMrr9ESb89D8=</diagram></mxfile>

resources/Constants/Constants.qml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,7 @@ QtObject {
461461
readonly property int pauseButtonPadding: 0
462462
readonly property string pauseButtonTooltip: "Pause Log Panel"
463463
readonly property string playButtonTooltip: "Resume Log Panel"
464+
readonly property string clearButtonTooltip: "Clear Log Panel"
464465
readonly property int logLevelMenuHeight: 100
465466
readonly property int dropdownButtonPadding: 0
466467
readonly property int dropdownButtonWidth: 20
@@ -628,6 +629,7 @@ QtObject {
628629
readonly property string swiftLogoPath: "qrc:/images/icon.png"
629630
readonly property string swiftLogoWidePath: "qrc:/images/swiftLogoWide.svg"
630631
readonly property string folderPath: "qrc:/images/fontawesome/folder-regular.svg"
632+
readonly property string xPath: "qrc:/images/iconic/x.svg"
631633
}
632634

633635
insSettingsPopup: QtObject {

resources/LogPanel.qml

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import "./Constants"
1+
import "BaseComponents"
2+
import "Constants"
23
import Qt.labs.qmlmodels 1.0
34
import QtQuick 2.15
45
import QtQuick.Controls 2.15
@@ -48,13 +49,43 @@ Item {
4849
anchors.rightMargin: Constants.logPanel.pauseButtonRightMargin
4950
z: Constants.logPanel.zAboveTable
5051

51-
RoundButton {
52-
id: baselinePauseButton
52+
SwiftButton {
53+
width: Constants.logPanel.pauseButtonWidth
54+
height: Constants.logPanel.pauseButtonWidth
55+
padding: Constants.logPanel.pauseButtonPadding
56+
icon.width: Constants.logPanel.pauseButtonWidth / 3
57+
icon.height: Constants.logPanel.pauseButtonWidth / 3
58+
icon.source: Constants.icons.xPath
59+
icon.color: Constants.materialGrey
60+
anchors.right: parent.right
61+
anchors.top: parent.top
62+
ToolTip.visible: hovered
63+
ToolTip.text: Constants.logPanel.clearButtonTooltip
64+
onClicked: {
65+
tableView.model.clear();
66+
var new_row = {
67+
};
68+
new_row[Constants.logPanel.timestampHeader] = "";
69+
new_row[Constants.logPanel.levelHeader] = "";
70+
new_row[Constants.logPanel.msgHeader] = "";
71+
logEntries = [new_row];
72+
tableView.model.setRow(0, new_row);
73+
tableView.forceLayout();
74+
}
75+
}
5376

77+
}
78+
79+
Item {
80+
anchors.fill: parent
81+
anchors.topMargin: Constants.genericTable.cellHeight * 2
82+
anchors.rightMargin: Constants.logPanel.pauseButtonRightMargin
83+
z: Constants.logPanel.zAboveTable
84+
85+
SwiftButton {
5486
visible: !consolePaused
5587
width: Constants.logPanel.pauseButtonWidth
5688
height: Constants.logPanel.pauseButtonWidth
57-
radius: Constants.logPanel.pauseButtonWidth / 3
5889
padding: Constants.logPanel.pauseButtonPadding
5990
icon.width: Constants.logPanel.pauseButtonWidth / 3
6091
icon.height: Constants.logPanel.pauseButtonWidth / 3
@@ -69,13 +100,10 @@ Item {
69100
}
70101
}
71102

72-
RoundButton {
73-
id: baselinePlayButton
74-
103+
SwiftButton {
75104
visible: consolePaused
76105
width: Constants.logPanel.pauseButtonWidth
77106
height: Constants.logPanel.pauseButtonWidth
78-
radius: Constants.logPanel.pauseButtonWidth / 3
79107
padding: Constants.logPanel.pauseButtonPadding
80108
icon.width: Constants.logPanel.pauseButtonWidth / 3
81109
icon.height: Constants.logPanel.pauseButtonWidth / 3

resources/console_resources.qrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@
103103
<file>images/fontawesome/file-import.svg</file>
104104
<file>images/fontawesome/exclamation-triangle.svg</file>
105105
<file>images/fontawesome/folder-regular.svg</file>
106+
<file>images/iconic/x.svg</file>
106107
<file>images/icon.png</file>
107108
<file>images/icon.ico</file>
108109
<file>TableComponents/SortableColumnHeading.qml</file>

swiftnav_console/logging_bar.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
Keys.SBP_LOGGING_FORMAT: SbpLogging.SBP_JSON,
1515
Keys.SBP_LOGGING_LABELS: [SbpLogging.SBP_JSON, SbpLogging.SBP],
1616
Keys.RECORDING_DURATION_SEC: int,
17-
Keys.RECORDING_SIZE: str,
17+
Keys.RECORDING_SIZE: int,
1818
Keys.RECORDING_FILENAME: str,
1919
}
2020

@@ -27,7 +27,7 @@ class LoggingBarData(QObject): # pylint: disable=too-many-instance-attributes
2727
_sbp_logging_labels: List[str] = []
2828
_previous_folders: List[str] = []
2929
_recording_duration_sec: int = 0
30-
_recording_size: str
30+
_recording_size: int = 0
3131
_recording_filename: str = ""
3232

3333
def get_csv_logging(self) -> bool:

0 commit comments

Comments
 (0)