not1mm 23.10.28__py3-none-any.whl → 23.10.31__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
@@ -105,9 +105,7 @@ def check_process(name: str) -> bool:
105
105
  if len(proc.cmdline()) == 2:
106
106
  if name in proc.cmdline()[1]:
107
107
  return True
108
- except psutil.NoSuchProcess:
109
- continue
110
- except psutil.ZombieProcess:
108
+ except (psutil.NoSuchProcess, psutil.ZombieProcess):
111
109
  continue
112
110
  return False
113
111
 
@@ -262,6 +260,11 @@ class MainWindow(QtWidgets.QMainWindow):
262
260
  self.leftdot.setPixmap(self.greendot)
263
261
  self.rightdot.setPixmap(self.reddot)
264
262
 
263
+ self.radio_grey = QtGui.QPixmap(icon_path + "radio_grey.png")
264
+ self.radio_red = QtGui.QPixmap(icon_path + "radio_red.png")
265
+ self.radio_green = QtGui.QPixmap(icon_path + "radio_green.png")
266
+ self.radio_icon.setPixmap(self.radio_grey)
267
+
265
268
  self.F1.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
266
269
  self.F1.customContextMenuRequested.connect(self.edit_F1)
267
270
  self.F1.clicked.connect(self.sendf1)
@@ -378,6 +381,14 @@ class MainWindow(QtWidgets.QMainWindow):
378
381
  "You can udate to the current version by using:\npip install -U not1mm"
379
382
  )
380
383
 
384
+ def set_radio_icon(self, state: int) -> None:
385
+ """change CAT icon state"""
386
+ displaystate = [self.radio_grey, self.radio_red, self.radio_green]
387
+ try:
388
+ self.radio_icon.setPixmap(displaystate[state])
389
+ except (IndexError, TypeError) as err:
390
+ logger.debug(err)
391
+
381
392
  def toggle_cw_entry(self) -> None:
382
393
  """Toggle the CW entry field on and off."""
383
394
  self.cw_entry_visible = not self.cw_entry_visible
@@ -842,15 +853,7 @@ class MainWindow(QtWidgets.QMainWindow):
842
853
  try:
843
854
  cty = notctyparser.BigCty(WORKING_PATH + "/data/cty.json")
844
855
  update_available = cty.check_update()
845
- except AttributeError as the_error:
846
- logger.debug("cty parser returned an error: %s", the_error)
847
- return
848
- except ValueError as the_error:
849
- print("cty parser returned an error: %s", the_error)
850
- logger.debug("cty parser returned an error: %s", the_error)
851
- return
852
- except locale.Error as the_error:
853
- print("cty parser returned an error: %s", the_error)
856
+ except (AttributeError, ValueError, locale.Error) as the_error:
854
857
  logger.debug("cty parser returned an error: %s", the_error)
855
858
  return
856
859
  logger.debug("Newer cty file available %s", str(update_available))
@@ -1884,6 +1887,7 @@ class MainWindow(QtWidgets.QMainWindow):
1884
1887
  self.pref.get("CAT_ip", "127.0.0.1"),
1885
1888
  int(self.pref.get("CAT_port", 12345)),
1886
1889
  )
1890
+
1887
1891
  if self.pref.get("userigctld", False):
1888
1892
  logger.debug(
1889
1893
  "Using rigctld: %s",
@@ -2325,10 +2329,13 @@ class MainWindow(QtWidgets.QMainWindow):
2325
2329
 
2326
2330
  def poll_radio(self) -> None:
2327
2331
  """stub"""
2332
+ self.set_radio_icon(0)
2328
2333
  if self.rig_control:
2329
2334
  if self.rig_control.online is False:
2335
+ self.set_radio_icon(1)
2330
2336
  self.rig_control.reinit()
2331
2337
  if self.rig_control.online:
2338
+ self.set_radio_icon(2)
2332
2339
  info_dirty = False
2333
2340
  vfo = self.rig_control.get_vfo()
2334
2341
  mode = self.rig_control.get_mode()