kopia lustrzana https://github.com/ctjacobs/pyqso
Handle \n characters in the NOTES field more naturally.
rodzic
af57a915fd
commit
8dc9ed6aac
|
@ -249,10 +249,7 @@ class ADIF:
|
|||
# this and simply ignore it instead (if it exists).
|
||||
if(re.search("<eoh>", text, flags=re.IGNORECASE) is not None):
|
||||
# There is a header present, so let's ignore everything
|
||||
# up to and including the <eoh> marker. Note that
|
||||
# re.search has been used here to handle any case sensitivity.
|
||||
# Previously we were checking for <eoh>. <EOH> is also valid
|
||||
# but wasn't being detected before.
|
||||
# up to and including the <eoh> marker.
|
||||
while len(tokens) > 0:
|
||||
t = tokens.pop(0)
|
||||
if(re.match("<eoh>", t, flags=re.IGNORECASE) is not None):
|
||||
|
@ -281,6 +278,7 @@ class ADIF:
|
|||
# This will help us later when comparing the field names
|
||||
# against the available field names in the ADIF specification.
|
||||
field_name = fd[0].upper()
|
||||
# Only read in the number of characters specified by the data length.
|
||||
field_data = fd[2][:int(fd[1])]
|
||||
|
||||
# Combo boxes are used later on and these are case sensitive,
|
||||
|
@ -303,7 +301,7 @@ class ADIF:
|
|||
if(merge_comment):
|
||||
if("NOTES" in list(fields_and_data_dictionary.keys()) and comment):
|
||||
logging.debug("Merging COMMENT field with NOTES field...")
|
||||
fields_and_data_dictionary["NOTES"] += "\\n" + comment
|
||||
fields_and_data_dictionary["NOTES"] += "\n" + comment
|
||||
logging.debug("Merged fields.")
|
||||
elif(comment):
|
||||
# Create the NOTES entry, but only store the contents of the COMMENT field.
|
||||
|
|
|
@ -417,6 +417,10 @@ class Logbook:
|
|||
field_names = AVAILABLE_FIELD_NAMES_ORDERED
|
||||
for i in range(0, len(field_names)):
|
||||
renderer = Gtk.CellRendererText()
|
||||
|
||||
# Keep each row to a single line.
|
||||
renderer.set_property("single-paragraph-mode", True)
|
||||
|
||||
column = Gtk.TreeViewColumn(AVAILABLE_FIELD_NAMES_FRIENDLY[field_names[i]], renderer, text=i+1)
|
||||
column.set_resizable(True)
|
||||
column.set_min_width(50)
|
||||
|
@ -424,9 +428,11 @@ class Logbook:
|
|||
|
||||
# Special cases
|
||||
if(field_names[i] == "NOTES"):
|
||||
# Give the 'Notes' column some extra space, since this is likely to contain some long sentences...
|
||||
# Give the 'Notes' column some extra space, since this is likely to contain some long sentences ...
|
||||
column.set_min_width(300)
|
||||
# ... but don't let it automatically re-size itself.
|
||||
# ... but not too much extra space ...
|
||||
column.set_max_width(600)
|
||||
# ... and don't let the column automatically re-size itself.
|
||||
column.set_sizing(Gtk.TreeViewColumnSizing.FIXED)
|
||||
|
||||
column.connect("clicked", self.sort_log, i+1)
|
||||
|
|
|
@ -193,10 +193,6 @@ class RecordDialog:
|
|||
continue
|
||||
elif(field_names[i] == "QSL_SENT" or field_names[i] == "QSL_RCVD"):
|
||||
self.sources[field_names[i]].set_active(qsl_options.index(data))
|
||||
elif(field_names[i] == "NOTES"):
|
||||
# Remember to put the new line escape characters back in when displaying the data in a Gtk.TextView
|
||||
text = data.replace("\\n", "\n")
|
||||
self.sources[field_names[i]].set_text(text)
|
||||
else:
|
||||
self.sources[field_names[i]].set_text(data)
|
||||
else:
|
||||
|
@ -276,9 +272,6 @@ class RecordDialog:
|
|||
elif(field_name == "NOTES"):
|
||||
(start, end) = self.sources[field_name].get_bounds()
|
||||
text = self.sources[field_name].get_text(start, end, True)
|
||||
# Replace the escape characters with a slightly different new line marker.
|
||||
# If we don't do this, the rows in the Gtk.TreeView expand based on the number of new lines.
|
||||
text = text.replace("\n", "\\n")
|
||||
return text
|
||||
else:
|
||||
return self.sources[field_name].get_text()
|
||||
|
|
|
@ -3513,7 +3513,7 @@ Base64-encoded plain text in the configuration file.</property>
|
|||
<object class="GtkTextView" id="qso_notes_textview">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="wrap_mode">word</property>
|
||||
<property name="wrap_mode">word-char</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
|
Ładowanie…
Reference in New Issue