not1mm 24.3.16__py3-none-any.whl → 24.3.21__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. not1mm/__main__.py +289 -125
  2. not1mm/bandmap.py +168 -163
  3. not1mm/checkwindow.py +55 -107
  4. not1mm/data/MASTER.SCP +1077 -749
  5. not1mm/data/bandmap.ui +4 -4
  6. not1mm/data/checkwindow.ui +9 -16
  7. not1mm/data/logwindow.ui +16 -11
  8. not1mm/data/main.ui +16 -6
  9. not1mm/data/vfo.ui +64 -52
  10. not1mm/data/vfo2.ui +84 -0
  11. not1mm/fsutils.py +38 -0
  12. not1mm/lib/about.py +4 -2
  13. not1mm/lib/cat_interface.py +1 -1
  14. not1mm/lib/cwinterface.py +1 -1
  15. not1mm/lib/database.py +4 -4
  16. not1mm/lib/edit_contact.py +2 -2
  17. not1mm/lib/edit_macro.py +2 -3
  18. not1mm/lib/edit_opon.py +2 -2
  19. not1mm/lib/edit_station.py +3 -3
  20. not1mm/lib/ham_utility.py +1 -1
  21. not1mm/lib/lookup.py +1 -1
  22. not1mm/lib/multicast.py +9 -4
  23. not1mm/lib/n1mm.py +1 -1
  24. not1mm/lib/new_contest.py +2 -2
  25. not1mm/lib/select_contest.py +2 -2
  26. not1mm/lib/settings.py +3 -4
  27. not1mm/lib/super_check_partial.py +6 -5
  28. not1mm/lib/version.py +1 -1
  29. not1mm/logwindow.py +60 -104
  30. not1mm/plugins/10_10_fall_cw.py +1 -1
  31. not1mm/plugins/10_10_spring_cw.py +1 -1
  32. not1mm/plugins/10_10_summer_phone.py +1 -1
  33. not1mm/plugins/10_10_winter_phone.py +1 -1
  34. not1mm/plugins/arrl_10m.py +1 -1
  35. not1mm/plugins/arrl_dx_cw.py +1 -1
  36. not1mm/plugins/arrl_dx_ssb.py +1 -1
  37. not1mm/plugins/arrl_field_day.py +1 -1
  38. not1mm/plugins/arrl_ss_cw.py +1 -1
  39. not1mm/plugins/arrl_ss_phone.py +1 -1
  40. not1mm/plugins/arrl_vhf_jan.py +1 -1
  41. not1mm/plugins/arrl_vhf_jun.py +1 -1
  42. not1mm/plugins/arrl_vhf_sep.py +1 -1
  43. not1mm/plugins/canada_day.py +1 -1
  44. not1mm/plugins/cq_160_cw.py +1 -1
  45. not1mm/plugins/cq_160_ssb.py +1 -1
  46. not1mm/plugins/cq_wpx_cw.py +1 -1
  47. not1mm/plugins/cq_wpx_ssb.py +1 -1
  48. not1mm/plugins/cq_ww_cw.py +1 -1
  49. not1mm/plugins/cq_ww_ssb.py +1 -1
  50. not1mm/plugins/cwt.py +1 -1
  51. not1mm/plugins/general_logging.py +1 -1
  52. not1mm/plugins/iaru_hf.py +1 -1
  53. not1mm/plugins/jidx_cw.py +1 -1
  54. not1mm/plugins/jidx_ph.py +1 -1
  55. not1mm/plugins/naqp_cw.py +1 -1
  56. not1mm/plugins/naqp_ssb.py +1 -1
  57. not1mm/plugins/phone_weekly_test.py +1 -1
  58. not1mm/plugins/stew_perry_topband.py +1 -1
  59. not1mm/plugins/winter_field_day.py +1 -1
  60. not1mm/vfo.py +77 -98
  61. {not1mm-24.3.16.dist-info → not1mm-24.3.21.dist-info}/METADATA +4 -1
  62. {not1mm-24.3.16.dist-info → not1mm-24.3.21.dist-info}/RECORD +68 -65
  63. testing/detectdark.py +35 -0
  64. testing/test.py +13 -11
  65. {not1mm-24.3.16.dist-info → not1mm-24.3.21.dist-info}/LICENSE +0 -0
  66. {not1mm-24.3.16.dist-info → not1mm-24.3.21.dist-info}/WHEEL +0 -0
  67. {not1mm-24.3.16.dist-info → not1mm-24.3.21.dist-info}/entry_points.txt +0 -0
  68. {not1mm-24.3.16.dist-info → not1mm-24.3.21.dist-info}/top_level.txt +0 -0
not1mm/checkwindow.py CHANGED
@@ -5,45 +5,25 @@ Check Window
5
5
  # pylint: disable=no-name-in-module, unused-import, no-member, invalid-name, c-extension-no-member
6
6
 
7
7
  import logging
8
-
8
+ import os
9
9
  import platform
10
10
  import queue
11
- import os
12
- import sys
13
-
14
11
  from json import loads
15
- from pathlib import Path
16
12
 
17
- from PyQt5 import uic
18
- from PyQt5.QtCore import QDir
19
- from PyQt5.QtWidgets import QApplication, QListWidgetItem, QMainWindow
13
+ from PyQt5 import QtGui, uic
14
+ from PyQt5.QtCore import QDir, Qt
20
15
  from PyQt5.QtGui import QFontDatabase
16
+ from PyQt5.QtWidgets import QApplication, QListWidgetItem
17
+ from PyQt5.QtWidgets import QWidget
21
18
 
19
+ import not1mm.fsutils as fsutils
22
20
  from not1mm.lib.database import DataBase
23
21
  from not1mm.lib.multicast import Multicast
24
22
  from not1mm.lib.super_check_partial import SCP
25
23
 
26
- os.environ["QT_QPA_PLATFORMTHEME"] = "gnome"
27
-
28
- WORKING_PATH = os.path.dirname(__loader__.get_filename())
29
-
30
- if "XDG_DATA_HOME" in os.environ:
31
- DATA_PATH = os.environ.get("XDG_DATA_HOME")
32
- else:
33
- DATA_PATH = str(Path.home() / ".local" / "share")
34
- DATA_PATH += "/not1mm"
24
+ logger = logging.getLogger(__name__)
35
25
 
36
- if "XDG_CONFIG_HOME" in os.environ:
37
- CONFIG_PATH = os.environ.get("XDG_CONFIG_HOME")
38
- else:
39
- CONFIG_PATH = str(Path.home() / ".config")
40
- CONFIG_PATH += "/not1mm"
41
-
42
-
43
- class MainWindow(QMainWindow):
44
- """
45
- The main window
46
- """
26
+ class CheckWindow(QWidget):
47
27
 
48
28
  multicast_interface = None
49
29
  dbname = None
@@ -52,41 +32,60 @@ class MainWindow(QMainWindow):
52
32
  def __init__(self, *args, **kwargs):
53
33
  super().__init__(*args, **kwargs)
54
34
  self.load_pref()
55
- self.dbname = DATA_PATH + "/" + self.pref.get("current_database", "ham.db")
56
- self.database = DataBase(self.dbname, WORKING_PATH)
35
+ self.dbname = fsutils.USER_DATA_PATH / self.pref.get("current_database", "ham.db")
36
+ self.database = DataBase(self.dbname, fsutils.APP_DATA_PATH)
57
37
  self.database.current_contest = self.pref.get("contest", 0)
58
- data_path = WORKING_PATH + "/data/checkwindow.ui"
59
- uic.loadUi(data_path, self)
60
- self.setWindowTitle("CheckWindow")
38
+
39
+ uic.loadUi(fsutils.APP_DATA_PATH / "checkwindow.ui", self)
40
+
61
41
  self.logList.clear()
62
42
  self.masterList.clear()
63
43
  self.telnetList.clear()
64
44
  self.callhistoryList.clear()
65
45
  self.callhistoryList.hide()
66
46
  self.callhistoryListLabel.hide()
67
- self.mscp = SCP(WORKING_PATH)
47
+ self.mscp = SCP(fsutils.APP_DATA_PATH)
68
48
  self._udpwatch = None
69
49
  self.udp_fifo = queue.Queue()
70
50
  self.multicast_interface = Multicast(
71
51
  self.pref.get("multicast_group", "239.1.1.1"),
72
52
  self.pref.get("multicast_port", 2239),
73
- self.pref.get("interface_ip", "0.0.0.0"),
53
+ self.pref.get("interface_ip", "127.0.0.1"),
74
54
  )
75
55
  self.multicast_interface.ready_read_connect(self.watch_udp)
76
56
 
77
- def quit_app(self):
78
- """
79
- Called when the user clicks the exit button.
80
-
81
- Parameters
82
- ----------
83
- None
84
-
85
- Returns
86
- -------
87
- None
88
- """
89
- app.quit()
57
+ def setDarkMode(self, dark: bool):
58
+ """testing"""
59
+
60
+ if dark:
61
+ darkPalette = QtGui.QPalette()
62
+ darkColor = QtGui.QColor(45, 45, 45)
63
+ disabledColor = QtGui.QColor(127, 127, 127)
64
+ darkPalette.setColor(QtGui.QPalette.Window, darkColor)
65
+ darkPalette.setColor(QtGui.QPalette.WindowText, Qt.white)
66
+ darkPalette.setColor(QtGui.QPalette.Base, QtGui.QColor(18, 18, 18))
67
+ darkPalette.setColor(QtGui.QPalette.AlternateBase, darkColor)
68
+ darkPalette.setColor(QtGui.QPalette.Text, Qt.white)
69
+ darkPalette.setColor(
70
+ QtGui.QPalette.Disabled, QtGui.QPalette.Text, disabledColor
71
+ )
72
+ darkPalette.setColor(QtGui.QPalette.Button, darkColor)
73
+ darkPalette.setColor(QtGui.QPalette.ButtonText, Qt.white)
74
+ darkPalette.setColor(
75
+ QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText, disabledColor
76
+ )
77
+ darkPalette.setColor(QtGui.QPalette.BrightText, Qt.red)
78
+ darkPalette.setColor(QtGui.QPalette.Link, QtGui.QColor(42, 130, 218))
79
+ darkPalette.setColor(QtGui.QPalette.Highlight, QtGui.QColor(42, 130, 218))
80
+ darkPalette.setColor(QtGui.QPalette.HighlightedText, Qt.black)
81
+ darkPalette.setColor(
82
+ QtGui.QPalette.Disabled, QtGui.QPalette.HighlightedText, disabledColor
83
+ )
84
+
85
+ self.setPalette(darkPalette)
86
+ else:
87
+ palette = self.style().standardPalette()
88
+ self.setPalette(palette)
90
89
 
91
90
  def load_pref(self):
92
91
  """
@@ -101,17 +100,16 @@ class MainWindow(QMainWindow):
101
100
  None
102
101
  """
103
102
  try:
104
- if os.path.exists(CONFIG_PATH + "/not1mm.json"):
105
- with open(
106
- CONFIG_PATH + "/not1mm.json", "rt", encoding="utf-8"
107
- ) as file_descriptor:
103
+ if os.path.exists(fsutils.CONFIG_FILE):
104
+ with open(fsutils.CONFIG_FILE, "rt", encoding="utf-8") as file_descriptor:
108
105
  self.pref = loads(file_descriptor.read())
109
- logger.info("%s", self.pref)
106
+ logger.info(f"loaded config file from {fsutils.CONFIG_FILE}")
110
107
  else:
111
108
  self.pref["current_database"] = "ham.db"
112
109
 
113
110
  except IOError as exception:
114
111
  logger.critical("Error: %s", exception)
112
+ self.setDarkMode(self.pref.get("darkmode", False))
115
113
 
116
114
  def watch_udp(self):
117
115
  """
@@ -126,6 +124,7 @@ class MainWindow(QMainWindow):
126
124
  None
127
125
  """
128
126
  while self.multicast_interface.server_udp.hasPendingDatagrams():
127
+ logger.error("Got multicast ")
129
128
  json_data = self.multicast_interface.read_datagram_as_json()
130
129
 
131
130
  if json_data.get("station", "") != platform.node():
@@ -145,8 +144,9 @@ class MainWindow(QMainWindow):
145
144
  if json_data.get("cmd", "") == "NEWDB":
146
145
  ...
147
146
  # self.load_new_db()
148
- if json_data.get("cmd", "") == "HALT":
149
- self.quit_app()
147
+
148
+ if json_data.get("cmd", "") == "DARKMODE":
149
+ self.setDarkMode(json_data.get("state", False))
150
150
 
151
151
  def clear_lists(self) -> None:
152
152
  """
@@ -229,55 +229,3 @@ class MainWindow(QMainWindow):
229
229
  self.telnetList.addItem(listItem)
230
230
  self.telnetList.show()
231
231
 
232
-
233
- def load_fonts_from_dir(directory: str) -> set:
234
- """
235
- Load fonts from directory.
236
-
237
- Parameters
238
- ----------
239
- directory : str
240
- The directory to load fonts from.
241
-
242
- Returns
243
- -------
244
- set
245
- The set of font families loaded.
246
- """
247
- font_families = set()
248
- for _fi in QDir(directory).entryInfoList(["*.ttf", "*.woff", "*.woff2"]):
249
- _id = QFontDatabase.addApplicationFont(_fi.absoluteFilePath())
250
- font_families |= set(QFontDatabase.applicationFontFamilies(_id))
251
- return font_families
252
-
253
-
254
- def main():
255
- """main entry"""
256
- sys.exit(app.exec())
257
-
258
-
259
- logger = logging.getLogger("__main__")
260
- handler = logging.StreamHandler()
261
- formatter = logging.Formatter(
262
- datefmt="%H:%M:%S",
263
- fmt="[%(asctime)s] %(levelname)s %(module)s - %(funcName)s Line %(lineno)d:\n%(message)s",
264
- )
265
- handler.setFormatter(formatter)
266
- logger.addHandler(handler)
267
-
268
- if Path("./debug").exists():
269
- logger.setLevel(logging.DEBUG)
270
- logger.debug("debugging on")
271
- else:
272
- logger.setLevel(logging.WARNING)
273
- logger.warning("debugging off")
274
-
275
- app = QApplication(sys.argv)
276
- app.setStyle("Adwaita-Dark")
277
- font_path = WORKING_PATH + "/data"
278
- _families = load_fonts_from_dir(os.fspath(font_path))
279
- window = MainWindow()
280
- window.show()
281
-
282
- if __name__ == "__main__":
283
- main()