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

GLOBAL variables changed to GLOBAL constants #1710

Merged
merged 7 commits into from
Mar 27, 2023

Conversation

rootxrishabh
Copy link
Contributor

fixes #1629

Copy link
Member

@ReimarBauer ReimarBauer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comment

@ReimarBauer
Copy link
Member

Do you see some airdata in the widget?

@rootxrishabh
Copy link
Contributor Author

Do you see some airdata in the widget?

Is this correct?
image

@ReimarBauer
Copy link
Member

ReimarBauer commented Mar 23, 2023

For some reason I don't get any airport shown.

They do download and have a big size

ls -rtlh downloads/aip/airports.csv 
-rw-rw-r-- 1 reimar reimar 11M Mar 23 12:34 downloads/aip/airports.csv

But I always get
ERROR: Tried to draw airports but none were found. Try redownloading.

Have a look on this line, this misses the new "download" folder.
https://github.com/rootxrishabh/MSS/blob/i1629/mslib/utils/airdata.py#L126

I assume you have in .config/msui an older airports.csv file and that's why you can see data. But the newer version from the download folder is not used

@ReimarBauer
Copy link
Member

is missing

diff --git a/mslib/utils/airdata.py b/mslib/utils/airdata.py
index 751d090f..f173f5a9 100644
--- a/mslib/utils/airdata.py
+++ b/mslib/utils/airdata.py
@@ -123,9 +123,9 @@ def get_airports(force_download=False, url=None):
             == QtWidgets.QMessageBox.Yes:
         download_progress(os.path.join(OSDIR, "downloads", "aip", "airports.csv"), url)
 
-    if os.path.exists(os.path.join(OSDIR, "airports.csv")):
-        with open(os.path.join(OSDIR, "airports.csv"), "r", encoding="utf8") as file:
-            _airports_mtime = os.path.getmtime(os.path.join(OSDIR, "airports.csv"))
+    if os.path.exists(os.path.join(OSDIR, "downloads", "aip", "airports.csv")):
+        with open(os.path.join(OSDIR, "downloads", "aip", "airports.csv"), "r", encoding="utf8") as file:
+            _airports_mtime = os.path.getmtime(os.path.join(OSDIR, "downloads", "aip", "airports.csv"))
             return list(csv.DictReader(file, delimiter=","))
 
     else:

@rootxrishabh
Copy link
Contributor Author

is missing

diff --git a/mslib/utils/airdata.py b/mslib/utils/airdata.py
index 751d090f..f173f5a9 100644
--- a/mslib/utils/airdata.py
+++ b/mslib/utils/airdata.py
@@ -123,9 +123,9 @@ def get_airports(force_download=False, url=None):
             == QtWidgets.QMessageBox.Yes:
         download_progress(os.path.join(OSDIR, "downloads", "aip", "airports.csv"), url)
 
-    if os.path.exists(os.path.join(OSDIR, "airports.csv")):
-        with open(os.path.join(OSDIR, "airports.csv"), "r", encoding="utf8") as file:
-            _airports_mtime = os.path.getmtime(os.path.join(OSDIR, "airports.csv"))
+    if os.path.exists(os.path.join(OSDIR, "downloads", "aip", "airports.csv")):
+        with open(os.path.join(OSDIR, "downloads", "aip", "airports.csv"), "r", encoding="utf8") as file:
+            _airports_mtime = os.path.getmtime(os.path.join(OSDIR, "downloads", "aip", "airports.csv"))
             return list(csv.DictReader(file, delimiter=","))
 
     else:

I have synced the current PR branch and I am still not able to reproduce the error, can you please check? Also which 2 branches are you comparing?

@ReimarBauer
Copy link
Member

ReimarBauer commented Mar 23, 2023

is missing

diff --git a/mslib/utils/airdata.py b/mslib/utils/airdata.py
index 751d090f..f173f5a9 100644
--- a/mslib/utils/airdata.py
+++ b/mslib/utils/airdata.py
@@ -123,9 +123,9 @@ def get_airports(force_download=False, url=None):
             == QtWidgets.QMessageBox.Yes:
         download_progress(os.path.join(OSDIR, "downloads", "aip", "airports.csv"), url)
 
-    if os.path.exists(os.path.join(OSDIR, "airports.csv")):
-        with open(os.path.join(OSDIR, "airports.csv"), "r", encoding="utf8") as file:
-            _airports_mtime = os.path.getmtime(os.path.join(OSDIR, "airports.csv"))
+    if os.path.exists(os.path.join(OSDIR, "downloads", "aip", "airports.csv")):
+        with open(os.path.join(OSDIR, "downloads", "aip", "airports.csv"), "r", encoding="utf8") as file:
+            _airports_mtime = os.path.getmtime(os.path.join(OSDIR, "downloads", "aip", "airports.csv"))
             return list(csv.DictReader(file, delimiter=","))
 
     else:

I have synced the current PR branch and I am still not able to reproduce the error, can you please check? Also which 2 branches are you comparing?

show me ls -l .config/msui

and look at the image, which shows your repository file

compare

line 125 has the correct path, but those below were not changed.

@ReimarBauer
Copy link
Member

We not only want to download to os.path.join(OSDIR, "downloads", "aip", "airports.csv") we want also to read from there.

@rootxrishabh
Copy link
Contributor Author

Moin @ReimarBauer, I have made some changes can you please review them?

Copy link
Member

@ReimarBauer ReimarBauer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

refactor airdata
2 participants