Add the option of a default frequency unit in the Preferences. Addresses issue #12.

pull/61/head
Christian T. Jacobs 2017-05-07 14:01:28 +01:00
rodzic 40d6869ef9
commit bb4fa2a09c
3 zmienionych plików z 13 dodań i 7 usunięć

Wyświetl plik

@ -355,6 +355,17 @@ class RecordsPage:
else:
self.sources["DEFAULT_POWER"].set_text("")
# Frequency unit
self.sources["DEFAULT_FREQUENCY_UNIT"] = self.builder.get_object("default_values_frequency_unit_combo")
units = ["Hz", "kHz", "MHz", "GHz"]
for unit in units:
self.sources["DEFAULT_FREQUENCY_UNIT"].append_text(unit)
(section, option) = ("records", "default_frequency_unit")
if(have_config and config.has_option(section, option)):
self.sources["DEFAULT_FREQUENCY_UNIT"].set_active(units.index(config.get(section, option)))
else:
self.sources["DEFAULT_FREQUENCY_UNIT"].set_active(units.index("MHz"))
# Callsign lookup
self.sources["CALLSIGN_DATABASE"] = self.builder.get_object("callsign_lookup_database_combo")
callsign_database = ["", "qrz.com", "hamqth.com"]
@ -398,6 +409,7 @@ class RecordsPage:
data["DEFAULT_MODE"] = self.sources["DEFAULT_MODE"].get_active_text()
data["DEFAULT_SUBMODE"] = self.sources["DEFAULT_SUBMODE"].get_active_text()
data["DEFAULT_POWER"] = self.sources["DEFAULT_POWER"].get_text()
data["DEFAULT_FREQUENCY_UNIT"] = self.sources["DEFAULT_FREQUENCY_UNIT"].get_active_text()
data["CALLSIGN_DATABASE"] = self.sources["CALLSIGN_DATABASE"].get_active_text()
data["CALLSIGN_DATABASE_USERNAME"] = self.sources["CALLSIGN_DATABASE_USERNAME"].get_text()

Wyświetl plik

@ -90,7 +90,7 @@ class RecordDialog:
# FREQ
self.sources["FREQ"] = self.builder.get_object("qso_frequency_entry")
(section, option) = ("records", "frequency_unit")
(section, option) = ("records", "default_frequency_unit")
if(have_config and config.has_option(section, option)):
self.frequency_unit = config.get(section, option)
self.builder.get_object("qso_frequency_label").set_label("Frequency (%s)" % self.frequency_unit)

Wyświetl plik

@ -2275,12 +2275,6 @@ along with this program. If not, see &lt;http://www.gnu.org/licenses/&gt;.</pro
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">The unit of the frequency that will be entered into the Frequency entry box in the Add/Edit Record dialog (e.g. by selecting kHz, a value of 7140 can be entered instead of 7.140 MHz). However, the frequency will still be shown in MHz in the logbook.</property>
<property name="active">2</property>
<items>
<item translatable="yes">Hz</item>
<item translatable="yes">kHz</item>
<item translatable="yes">MHz</item>
<item translatable="yes">GHz</item>
</items>
</object>
<packing>
<property name="expand">False</property>