Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 54 additions & 2 deletions fonts/magrathea.sfd
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ OS2Version: 0
OS2_WeightWidthSlopeOnly: 0
OS2_UseTypoMetrics: 1
CreationTime: 1772828475
ModificationTime: 1775220549
ModificationTime: 1781277780
OS2TypoAscent: 0
OS2TypoAOffset: 1
OS2TypoDescent: 0
Expand All @@ -36,6 +36,7 @@ HheadAscent: 0
HheadAOffset: 1
HheadDescent: 0
HheadDOffset: 1
OS2Vendor: 'PfEd'
MarkAttachClasses: 1
DEI: 91125
Encoding: ISO8859-1
Expand All @@ -47,7 +48,7 @@ FitToEm: 0
WinInfo: 38 19 5
BeginPrivate: 0
EndPrivate
BeginChars: 256 21
BeginChars: 256 22

StartChar: A
Encoding: 65 65 0
Expand Down Expand Up @@ -824,6 +825,57 @@ SplineSet
573 -1 l 1
573 223 l 1
EndSplineSet
Validated: 1
EndChar

StartChar: a
Encoding: 97 97 21
Width: 1000
Flags: HO
LayerCount: 2
Fore
SplineSet
701 182 m 2
551 182 l 1
551 32 l 2
551 13 535 -3 516 -3 c 0
497 -3 481 13 481 32 c 2
481 182 l 1
331 182 l 2
312 182 296 198 296 217 c 0
296 236 312 252 331 252 c 2
481 252 l 1
481 402 l 2
481 421 497 437 516 437 c 0
535 437 551 421 551 402 c 2
551 252 l 1
701 252 l 2
720 252 736 236 736 217 c 0
736 198 720 182 701 182 c 2
637 672 m 1
202 672 l 1
204 -67 l 1
828 -67 l 1
828 470 l 1
672 470 l 2
653 470 637 486 637 505 c 2
637 672 l 1
169 -137 m 2
150 -137 134 -121 134 -102 c 2
132 707 l 0
132 726 148 742 167 742 c 2
672 742 l 2
687 742 695 736 700 731 c 2
886 532 l 2
890 527 898 518 898 505 c 2
898 -102 l 2
898 -121 882 -137 863 -137 c 2
169 -137 l 2
707 621 m 1
707 540 l 1
783 540 l 1
707 621 l 1
EndSplineSet
EndChar
EndChars
EndSplineFont
Binary file modified fonts/magrathea.ttf
Binary file not shown.
110 changes: 110 additions & 0 deletions fonts/magrathea_svgs/load_file.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 43 additions & 0 deletions fonts/magrathea_svgs/load_file.svg.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://detwpr10q5v4x"
path="res://.godot/imported/load_file.svg-558594d713f483f5bbda472ddc8739ac.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://fonts/magrathea_svgs/load_file.svg"
dest_files=["res://.godot/imported/load_file.svg-558594d713f483f5bbda472ddc8739ac.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false
6 changes: 6 additions & 0 deletions scenes/Main.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@ grow_horizontal = 2
grow_vertical = 2
theme_override_constants/separation = 8

[node name="OpenFileButton" type="Button" parent="Root/TopBar/ActionClipper/ActionStrip"]
layout_mode = 2
tooltip_text = "Open genome files"
theme_override_fonts/font = ExtResource("2_0bbpv")
text = "a"

[node name="ComparisonButton" type="Button" parent="Root/TopBar/ActionClipper/ActionStrip"]
layout_mode = 2
tooltip_text = "Switch to comparison view"
Expand Down
55 changes: 55 additions & 0 deletions scripts/main.gd
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ const READ_FILTER_FLAG_LABELS := [
@onready var _settings_header: HBoxContainer = $Root/ContentMargin/ViewportLayer/SettingsPanel/SettingsMargin/SettingsLayout/SettingsHeader
@onready var top_bar: HBoxContainer = $Root/TopBar
@onready var settings_toggle_button: Button = $Root/TopBar/SettingsToggleButton
@onready var open_file_button: Button = $Root/TopBar/ActionClipper/ActionStrip/OpenFileButton
@onready var screenshot_button: Button = $Root/TopBar/ActionClipper/ActionStrip/ScreenshotButton
@onready var search_button: Button = $Root/TopBar/ActionClipper/ActionStrip/SearchButton
@onready var go_button: Button = $Root/TopBar/ActionClipper/ActionStrip/GoButton
Expand Down Expand Up @@ -209,6 +210,8 @@ var _download_action_button: Button
var _download_status_label: RichTextLabel
var _download_thread: Thread
var _download_in_progress := false
var _open_file_dialog: FileDialog
var _open_file_last_dir := ""
var _screenshot_dialog: FileDialog
var _comparison_save_dialog: FileDialog
var _startup_zem_prepare_thread: Thread
Expand Down Expand Up @@ -412,13 +415,40 @@ func _ready() -> void:
call_deferred("_startup_connect_local_zem")
if get_window().has_signal("files_dropped"):
get_window().files_dropped.connect(_on_files_dropped)
_setup_open_file_dialog()
if screenshot_button != null:
screenshot_button.pressed.connect(_on_screenshot_pressed)
_setup_screenshot_dialog()
_setup_comparison_save_dialog()
_comparison_controller.configure(self, _zem, _themes_lib, comparison_view)
_comparison_controller.setup()

func _setup_open_file_dialog() -> void:
_open_file_dialog = FileDialog.new()
_open_file_dialog.file_mode = FileDialog.FILE_MODE_OPEN_FILES
_open_file_dialog.access = FileDialog.ACCESS_FILESYSTEM
_open_file_dialog.use_native_dialog = true
_open_file_dialog.title = "Open Genome Files"
_open_file_last_dir = _user_home_dir()
_open_file_dialog.current_dir = _open_file_last_dir
_open_file_dialog.files_selected.connect(_on_open_files_selected)
if _open_file_dialog.has_signal("canceled"):
_open_file_dialog.connect("canceled", Callable(self, "_remember_open_file_dialog_dir"))
add_child(_open_file_dialog)

func _user_home_dir() -> String:
var home := OS.get_environment("HOME")
if home.is_empty():
home = OS.get_environment("USERPROFILE")
if home.is_empty():
var home_drive := OS.get_environment("HOMEDRIVE")
var home_path := OS.get_environment("HOMEPATH")
if not home_drive.is_empty() and not home_path.is_empty():
home = home_drive + home_path
if home.is_empty():
home = OS.get_system_dir(OS.SYSTEM_DIR_DESKTOP).get_base_dir()
return home

func _setup_screenshot_dialog() -> void:
_screenshot_dialog = FileDialog.new()
_screenshot_dialog.file_mode = FileDialog.FILE_MODE_SAVE_FILE
Expand Down Expand Up @@ -571,6 +601,29 @@ func _on_comparison_save_file_selected(path: String) -> void:
if _top_bar_controller != null:
_top_bar_controller.on_comparison_save_file_selected(path)

func _on_open_file_pressed() -> void:
if _open_file_dialog == null:
return
if open_file_button != null:
open_file_button.set_pressed_no_signal(false)
open_file_button.release_focus()
_open_file_dialog.current_dir = _open_file_last_dir if not _open_file_last_dir.is_empty() else _user_home_dir()
_open_file_dialog.popup_centered_ratio(0.7)

func _on_open_files_selected(paths: PackedStringArray) -> void:
if paths.is_empty():
return
var first_path := str(paths[0])
if not first_path.is_empty():
_open_file_last_dir = first_path.get_base_dir()
_on_files_dropped(paths)

func _remember_open_file_dialog_dir() -> void:
if _open_file_dialog == null:
return
if not _open_file_dialog.current_dir.is_empty():
_open_file_last_dir = _open_file_dialog.current_dir

func _initialize_settings_panel() -> void:
_set_status("Disconnected")
genome_view.set_empty_state_status("")
Expand Down Expand Up @@ -719,6 +772,7 @@ func _setup_font_size_control() -> void:
func _connect_ui() -> void:
settings_toggle_button.pressed.connect(_toggle_settings)
close_settings_button.pressed.connect(_close_settings)
open_file_button.pressed.connect(_on_open_file_pressed)
pan_left_button.pressed.connect(func() -> void:
_play_ui_sound(SoundControllerScript.SOUND_PAN_LEFT)
if _app_mode == APP_MODE_COMPARISON:
Expand Down Expand Up @@ -862,6 +916,7 @@ func _pan_view_by_fraction(fraction: float, duration: float = 0.35, linear: bool
func _disable_button_focus() -> void:
var controls := [
settings_toggle_button,
open_file_button,
comparison_button,
comparison_save_button,
comparison_clear_button,
Expand Down
1 change: 1 addition & 0 deletions scripts/top_bar_controller.gd
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ func apply_topbar_button_font_size() -> void:
var topbar_button_size := Vector2(topbar_font_size + 14, topbar_font_size + 14)
var topbar_buttons := [
host.settings_toggle_button,
host.open_file_button,
host.comparison_button,
host.comparison_save_button,
host.comparison_clear_button,
Expand Down
Loading