Skip to content

Commit

Permalink
Add openonly filter to Repeaterbook queries
Browse files Browse the repository at this point in the history
  • Loading branch information
alrs authored and kk7ds committed May 31, 2024
1 parent 9f5b97b commit 566078e
Show file tree
Hide file tree
Showing 18 changed files with 2,877 additions and 2,670 deletions.
392 changes: 202 additions & 190 deletions chirp/locale/de.po

Large diffs are not rendered by default.

393 changes: 203 additions & 190 deletions chirp/locale/el.po

Large diffs are not rendered by default.

392 changes: 202 additions & 190 deletions chirp/locale/en_US.po

Large diffs are not rendered by default.

393 changes: 203 additions & 190 deletions chirp/locale/es.po

Large diffs are not rendered by default.

305 changes: 159 additions & 146 deletions chirp/locale/fr.po

Large diffs are not rendered by default.

392 changes: 202 additions & 190 deletions chirp/locale/hu.po

Large diffs are not rendered by default.

121 changes: 67 additions & 54 deletions chirp/locale/it.po

Large diffs are not rendered by default.

392 changes: 202 additions & 190 deletions chirp/locale/ja_JP.po

Large diffs are not rendered by default.

392 changes: 202 additions & 190 deletions chirp/locale/nl.po

Large diffs are not rendered by default.

393 changes: 203 additions & 190 deletions chirp/locale/pl.po

Large diffs are not rendered by default.

392 changes: 202 additions & 190 deletions chirp/locale/pt_BR.po

Large diffs are not rendered by default.

393 changes: 203 additions & 190 deletions chirp/locale/ru.po

Large diffs are not rendered by default.

393 changes: 203 additions & 190 deletions chirp/locale/tr_TR.po

Large diffs are not rendered by default.

392 changes: 202 additions & 190 deletions chirp/locale/uk_UA.po

Large diffs are not rendered by default.

392 changes: 202 additions & 190 deletions chirp/locale/zh_CN.po

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions chirp/sources/repeaterbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ def do_fetch(self, status, params):
bands = params.pop('bands', [])
modes = params.pop('modes', [])
fmconv = params.pop('fmconv', False)
openonly = params.pop('openonly')

data_file = self.get_data(status,
params.get('country'),
params.pop('state'),
Expand Down Expand Up @@ -244,6 +246,9 @@ def match(item):
return (not search_filter or
search_filter.lower() in content.lower())

def open_repeater(item):
return item['Use'] == 'OPEN'

def included_band(item):
if not bands:
return True
Expand All @@ -257,6 +262,8 @@ def included_band(item):
key=sorter):
if not item:
continue
if openonly and not open_repeater(item):
continue
if item['Operational Status'] != 'On-air':
continue
if dist and lat and lon and (
Expand Down
7 changes: 7 additions & 0 deletions chirp/wxui/query_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,11 @@ def build(self):
self.Bind(wx.EVT_CHECKBOX, self._select_modes, self._modefilter)
self._add_grid(grid, _('Limit Modes'), self._modefilter)

self._openonly = wx.CheckBox(panel, label=_('Open repeaters only'))
self._openonly.SetValue(CONF.get_bool('openonly', 'repeaterbook'))
self._openonly.SetToolTip(_('Exclude private and closed repeaters'))
self._add_grid(grid, _('Limit use'), self._openonly)

self._fmconv = wx.CheckBox(panel, label=_('Convert to FM'))
self._fmconv.SetValue(CONF.get_bool('fmconv', 'repeaterbook'))
self._fmconv.SetToolTip(_('Dual-mode digital repeaters that support '
Expand Down Expand Up @@ -420,6 +425,7 @@ def do_query(self):
CONF.set('country', self._country.GetStringSelection(), 'repeaterbook')
CONF.set('service', self._service.GetStringSelection(), 'repeaterbook')
CONF.set_bool('fmconv', self._fmconv.IsChecked(), 'repeaterbook')
CONF.set_bool('openonly', self._openonly.IsChecked(), 'repeaterbook')
self.result_radio = repeaterbook.RepeaterBook()
super().do_query()

Expand All @@ -437,6 +443,7 @@ def get_params(self):
'service': 'gmrs' if service == _('GMRS') else '',
'service_display': self._service.GetStringSelection(),
'fmconv': self._fmconv.IsChecked(),
'openonly': self._openonly.IsChecked(),
}


Expand Down
6 changes: 6 additions & 0 deletions tests/unit/test_repeaterbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def test_get_oregon(self):
'lat': 45,
'lon': -122,
'dist': 100,
'openonly': False,
})
m = rb.get_memory(0)
self.assertIsInstance(m, chirp_common.Memory)
Expand Down Expand Up @@ -71,6 +72,7 @@ def test_get_wyoming(self):
'lat': 45,
'lon': -122,
'dist': 0,
'openonly': False,
})
m = rb.get_memory(0)
self.assertIsInstance(m, chirp_common.Memory)
Expand All @@ -88,6 +90,7 @@ def test_get_oregon_gmrs(self):
'lon': -122,
'dist': 100,
'service': 'gmrs',
'openonly': False,
})
m = rb.get_memory(0)
self.assertIsInstance(m, chirp_common.Memory)
Expand All @@ -104,6 +107,7 @@ def test_get_australia(self):
'lat': -26,
'lon': 133,
'dist': 20000,
'openonly': False,
})
m = rb.get_memory(0)
self.assertIsInstance(m, chirp_common.Memory)
Expand All @@ -123,6 +127,7 @@ def test_filter(self):
'lat': 45,
'lon': -122,
'dist': 0,
'openonly': False,
'filter': 'tower'}
rb = self._test_with_mocked(params)
self.assertGreater(sum(rb.get_features().memory_bounds), 5)
Expand All @@ -133,6 +138,7 @@ def test_distance(self):
'lat': 45,
'lon': -122,
'dist': 0,
'openonly': False,
'filter': 'tower'}
rb1 = self._test_with_mocked(dict(params))
self.assertGreater(sum(rb1.get_features().memory_bounds), 5)
Expand Down

0 comments on commit 566078e

Please sign in to comment.