not1mm 24.10.27.2__py3-none-any.whl → 24.11.2__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.
not1mm/__main__.py CHANGED
@@ -164,6 +164,7 @@ class MainWindow(QtWidgets.QMainWindow):
164
164
  text_color = QColorConstants.Black
165
165
  current_palette = None
166
166
  use_esm = False
167
+ use_call_history = False
167
168
  esm_dict = {}
168
169
 
169
170
  radio_thread = QThread()
@@ -199,6 +200,7 @@ class MainWindow(QtWidgets.QMainWindow):
199
200
  self.setCorner(Qt.Corner.TopLeftCorner, Qt.DockWidgetArea.LeftDockWidgetArea)
200
201
  self.setCorner(Qt.Corner.BottomLeftCorner, Qt.DockWidgetArea.LeftDockWidgetArea)
201
202
  uic.loadUi(fsutils.APP_DATA_PATH / "main.ui", self)
203
+ self.history_info.hide()
202
204
  QApplication.instance().focusObjectChanged.connect(self.on_focus_changed)
203
205
  self.inputs_dict = {
204
206
  self.callsign: "callsign",
@@ -224,12 +226,15 @@ class MainWindow(QtWidgets.QMainWindow):
224
226
 
225
227
  self.actionCW_Macros.triggered.connect(self.cw_macros_state_changed)
226
228
  self.actionDark_Mode_2.triggered.connect(self.dark_mode_state_changed)
227
- self.actionCommand_Buttons.triggered.connect(self.command_buttons_state_change)
229
+ self.actionCommand_Buttons_2.triggered.connect(
230
+ self.command_buttons_state_change
231
+ )
228
232
  self.actionLog_Window.triggered.connect(self.launch_log_window)
229
233
  self.actionBandmap.triggered.connect(self.launch_bandmap_window)
230
234
  self.actionCheck_Window.triggered.connect(self.launch_check_window)
231
235
  self.actionVFO.triggered.connect(self.launch_vfo)
232
236
  self.actionRecalculate_Mults.triggered.connect(self.recalculate_mults)
237
+ self.actionLoad_Call_History_File.triggered.connect(self.load_call_history)
233
238
 
234
239
  self.actionGenerate_Cabrillo_ASCII.triggered.connect(
235
240
  lambda x: self.generate_cabrillo("ascii")
@@ -290,6 +295,12 @@ class MainWindow(QtWidgets.QMainWindow):
290
295
  self.radio_green = QtGui.QPixmap(str(icon_path / "radio_green.png"))
291
296
  self.radio_icon.setPixmap(self.radio_grey)
292
297
 
298
+ self.log_it.clicked.connect(self.save_contact)
299
+ self.wipe.clicked.connect(self.clearinputs)
300
+ self.esc_stop.clicked.connect(self.stop_cw)
301
+ self.mark.clicked.connect(self.mark_spot)
302
+ self.spot_it.clicked.connect(self.spot_dx)
303
+
293
304
  self.F1.setContextMenuPolicy(QtCore.Qt.ContextMenuPolicy.CustomContextMenu)
294
305
  self.F1.customContextMenuRequested.connect(lambda x: self.edit_macro(self.F1))
295
306
  self.F1.clicked.connect(lambda x: self.process_function_key(self.F1))
@@ -703,6 +714,45 @@ class MainWindow(QtWidgets.QMainWindow):
703
714
  "You can udate to the current version by using:\npip install -U not1mm"
704
715
  )
705
716
 
717
+ def load_call_history(self) -> None:
718
+ """"""
719
+ filename = self.filepicker("other")
720
+ if filename:
721
+ self.database.create_callhistory_table()
722
+ self.database.delete_callhistory()
723
+
724
+ try:
725
+ with open(filename, "rt", encoding="utf-8") as file_descriptor:
726
+ lines = file_descriptor.readlines()
727
+ if "!!Order!!" in lines[0]:
728
+ item_names = lines[0].strip().split(",")
729
+ # ['!!Order!!', 'Call', 'Sect', 'State', 'CK', 'UserText', '']
730
+ item_names = item_names[1:-1]
731
+ # ['Call', 'Sect', 'State', 'CK', 'UserText']
732
+ lines = lines[1:]
733
+ group_list = []
734
+ for line in lines:
735
+ if line.startswith("#"):
736
+ continue
737
+ group = {}
738
+ fields = line.strip().split(",")
739
+ # ['4U1WB','MDC','DC','89','']
740
+ count = 0
741
+ try:
742
+ for item in item_names:
743
+ if item == "":
744
+ continue
745
+ group[item] = fields[count]
746
+ count += 1
747
+ group_list.append(group)
748
+ # database.add_callhistory_item(group)
749
+ # print(f"{group=}")
750
+ except IndexError:
751
+ ...
752
+ self.database.add_callhistory_items(group_list)
753
+ except FileNotFoundError as err:
754
+ self.show_message_box(f"{err}")
755
+
706
756
  def on_focus_changed(self, new):
707
757
  """"""
708
758
  if self.use_esm:
@@ -1728,6 +1778,14 @@ class MainWindow(QtWidgets.QMainWindow):
1728
1778
  "Database (*.db)",
1729
1779
  options=options,
1730
1780
  )
1781
+ if action == "other":
1782
+ file, _ = QFileDialog.getOpenFileName(
1783
+ self,
1784
+ "Choose a File",
1785
+ "~/",
1786
+ "Any (*.*)",
1787
+ options=options,
1788
+ )
1731
1789
  return file
1732
1790
 
1733
1791
  def recalculate_mults(self) -> None:
@@ -1907,6 +1965,43 @@ class MainWindow(QtWidgets.QMainWindow):
1907
1965
  if self.rig_control.interface == "flrig":
1908
1966
  self.rig_control.cat.set_flrig_cw_speed(self.cw_speed.value())
1909
1967
 
1968
+ def stop_cw(self):
1969
+ """"""
1970
+ if self.cw is not None:
1971
+ if self.cw.servertype == 1:
1972
+ self.cw.sendcw("\x1b4")
1973
+ return
1974
+ if self.rig_control:
1975
+ if self.rig_control.online:
1976
+ if self.pref.get("cwtype") == 3 and self.rig_control is not None:
1977
+ if self.rig_control.interface == "flrig":
1978
+ self.rig_control.cat.set_flrig_cw_send(False)
1979
+ self.rig_control.cat.set_flrig_cw_send(True)
1980
+
1981
+ def mark_spot(self):
1982
+ """"""
1983
+ freq = self.radio_state.get("vfoa")
1984
+ dx = self.callsign.text()
1985
+ if freq and dx:
1986
+ cmd = {}
1987
+ cmd["cmd"] = "MARKDX"
1988
+ cmd["dx"] = dx
1989
+ cmd["freq"] = float(int(freq) / 1000)
1990
+ if self.bandmap_window:
1991
+ self.bandmap_window.msg_from_main(cmd)
1992
+
1993
+ def spot_dx(self):
1994
+ """"""
1995
+ freq = self.radio_state.get("vfoa")
1996
+ dx = self.callsign.text()
1997
+ if freq and dx:
1998
+ cmd = {}
1999
+ cmd["cmd"] = "SPOTDX"
2000
+ cmd["dx"] = dx
2001
+ cmd["freq"] = float(int(freq) / 1000)
2002
+ if self.bandmap_window:
2003
+ self.bandmap_window.msg_from_main(cmd)
2004
+
1910
2005
  def keyPressEvent(self, event) -> None: # pylint: disable=invalid-name
1911
2006
  """
1912
2007
  This overrides Qt key event.
@@ -1921,6 +2016,12 @@ class MainWindow(QtWidgets.QMainWindow):
1921
2016
  None
1922
2017
  """
1923
2018
  modifier = event.modifiers()
2019
+ if (
2020
+ event.key() == Qt.Key.Key_Equal
2021
+ and modifier == Qt.KeyboardModifier.ControlModifier
2022
+ ):
2023
+ self.save_contact()
2024
+ return
1924
2025
  if event.key() == Qt.Key.Key_K:
1925
2026
  self.toggle_cw_entry()
1926
2027
  return
@@ -2901,6 +3002,9 @@ class MainWindow(QtWidgets.QMainWindow):
2901
3002
  "DISABLED": None,
2902
3003
  }
2903
3004
 
3005
+ self.use_call_history = self.pref.get("use_call_history", False)
3006
+ if self.use_call_history:
3007
+ self.history_info.show()
2904
3008
  self.use_esm = self.pref.get("use_esm", False)
2905
3009
  self.esm_dict["CQ"] = fkey_dict.get(self.pref.get("esm_cq", "DISABLED"))
2906
3010
  self.esm_dict["EXCH"] = fkey_dict.get(self.pref.get("esm_exch", "DISABLED"))
@@ -2968,7 +3072,7 @@ class MainWindow(QtWidgets.QMainWindow):
2968
3072
  None
2969
3073
  """
2970
3074
 
2971
- self.pref["command_buttons"] = self.actionCommand_Buttons.isChecked()
3075
+ self.pref["command_buttons"] = self.actionCommand_Buttons_2.isChecked()
2972
3076
  self.write_preference()
2973
3077
  self.show_command_buttons()
2974
3078
 
@@ -3125,6 +3229,10 @@ class MainWindow(QtWidgets.QMainWindow):
3125
3229
  self.lookup_service.msg_from_main(cmd)
3126
3230
  self.next_field.setFocus()
3127
3231
  if self.contest:
3232
+ if self.use_call_history and hasattr(
3233
+ self.contest, "check_call_history"
3234
+ ):
3235
+ self.contest.check_call_history(self)
3128
3236
  if "CQ WW" in self.contest.name or "IARU HF" in self.contest.name:
3129
3237
  self.contest.prefill(self)
3130
3238
  return