aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorPaul Oliver <contact@pauloliver.dev>2024-02-29 02:29:14 +0100
committerPaul Oliver <contact@pauloliver.dev>2024-02-29 02:29:14 +0100
commit80c0e6579302a0df9cee4899c52742b1fde582f9 (patch)
tree6371ae266e921edd39805b54899f31dc0138c539 /bin
parentfde25e0959ceb35bdac2ea24e9d42c790f180171 (diff)
PIDs and gene scroll on PROCESS view now toggle between hex/decimal.
This fixes issue [#13].
Diffstat (limited to 'bin')
-rw-r--r--bin/printer.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/bin/printer.py b/bin/printer.py
index a733e25..58af55a 100644
--- a/bin/printer.py
+++ b/bin/printer.py
@@ -617,8 +617,8 @@ class Printer:
ypos += 1
proc_id = self.proc_list_scroll
- # Print all proc elements in decimal or hexadecimal format, depending
- # on hex-flag being set.
+ # Print all proc IDs and elements in decimal or hexadecimal format,
+ # depending on hex-flag being set.
if self.__print_hex:
data_format = lambda x: hex(x)
else:
@@ -644,7 +644,7 @@ class Printer:
)
# Lastly, assemble and print the next table row.
- row = " | ".join(["{:<10}".format(proc_id)] + [
+ row = " | ".join(["{:<10}".format(data_format(proc_id))] + [
"{:>10}".format(data_format(element))
for element in proc_data[self.__proc_element_scroll:]
])
@@ -732,12 +732,19 @@ class Printer:
between printing the genomes or the data elements by pressing the 'g'
key.
"""
+ # Print all proc IDs and gene scroll in decimal or hexadecimal format,
+ # depending on hex-flag being set.
+ if self.__print_hex:
+ data_format = lambda x: hex(x)
+ else:
+ data_format = lambda x: x
+
# First, print the table header. We print the current gene-scroll
# position for easy reference. Return back to zero scroll with the 'A'
# key.
ypos = len(self.__main) + len(self.__pages["PROCESS"]) + 5
header = "{:<10} | genes {} -->".format(
- "pidx", self.__proc_gene_scroll
+ "pidx", data_format(self.__proc_gene_scroll)
)
self.__clear_line(ypos)
self.__print_header(ypos, header)
@@ -757,7 +764,7 @@ class Printer:
attr = curses.A_NORMAL
# Assemble and print the next table row.
- row = "{:<10} |".format(proc_id)
+ row = "{:<10} |".format(data_format(proc_id))
self.__print_line(ypos, row, attr)
self.__print_proc_gene(ypos, proc_id)