roundabout,
created on Sunday, 8 December 2024, 14:43:15 (1733668995),
received on Thursday, 12 December 2024, 14:59:12 (1734015552)
Author identity: vlad <vlad.muntoiu@gmail.com>
9d33278bc7e68845d4792b5eb060ff697453832a
.idea/izvor.iml
@@ -4,7 +4,7 @@
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.venv" />
</content>
<orderEntry type="jdk" jdkName="Python 3.10" jdkType="Python SDK" />
<orderEntry type="jdk" jdkName="Python 3.12 (izvor)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
.idea/misc.xml
@@ -3,5 +3,5 @@
<component name="Black">
<option name="sdkName" value="Python 3.10 (izvor)" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10" project-jdk-type="Python SDK" />
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.12 (izvor)" project-jdk-type="Python SDK" />
</project>
main.py
@@ -24,8 +24,6 @@ import gbulb
from pathlib import Path
from typing import AsyncIterable, AsyncIterator, Collection, TypeVar, Iterable, Callable, Any
from twisted.conch.insults.text import attributes
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, Pango, GLib
@@ -210,8 +208,45 @@ class Izvor(Gtk.Application):
self.quit()
def check_escape(self, widget, event):
if event.keyval == 65307:
results_list = self.builder.get_object("results-list")
search_entry = self.builder.get_object("search-query")
rows = results_list.get_children()
current_row = results_list.get_selected_row()
if event.keyval == Gdk.KEY_Escape:
self.kill()
return True
if event.keyval == Gdk.KEY_Down:
# Move to the next row
if current_row:
current_index = rows.index(current_row)
next_index = (current_index + 1) % len(rows) # Wrap to the beginning if at the end
else:
next_index = 0
results_list.select_row(rows[next_index])
search_entry.grab_focus() # Refocus the search entry
return True
if event.keyval == Gdk.KEY_Up:
# Move to the previous row
if current_row:
current_index = rows.index(current_row)
prev_index = (current_index - 1) % len(rows) # Wrap to the end if at the beginning
else:
prev_index = len(rows) - 1
results_list.select_row(rows[prev_index])
search_entry.grab_focus() # Refocus the search entry
return True
if event.keyval == Gdk.KEY_Return and current_row:
# Execute the selected row
current_row.activate()
return True
return False
def about(self, widget):
about_builder = Gtk.Builder()