Cthulhu is no longer a fork. Now it is a screen reader written in Golang.
This commit is contained in:
1 parent
a998fe67de
commit
069fc674dc
708 files changed
+112482
-532
No files matched your search
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Small GTK table with a window description for native speech checks."""
|
||||
|
||||
import gi
|
||||
import os
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk
|
||||
|
||||
|
||||
window = Gtk.Window(title="Table presentation probe")
|
||||
window.connect("destroy", Gtk.main_quit)
|
||||
window.get_accessible().set_description("Select an item and press Enter to open it.")
|
||||
store = Gtk.ListStore(str, str)
|
||||
store.append(["Alpha", "Document"])
|
||||
store.append(["Beta", "Shortcut"])
|
||||
view = Gtk.TreeView(model=store)
|
||||
view.get_accessible().set_name("Probe items")
|
||||
name_column = Gtk.TreeViewColumn("Name")
|
||||
icon_renderer = Gtk.CellRendererPixbuf()
|
||||
icon_renderer.set_property("icon-name", "text-x-generic")
|
||||
name_column.pack_start(icon_renderer, False)
|
||||
name_renderer = Gtk.CellRendererText()
|
||||
name_column.pack_start(name_renderer, True)
|
||||
name_column.add_attribute(name_renderer, "text", 0)
|
||||
view.append_column(name_column)
|
||||
kind_renderer = Gtk.CellRendererText()
|
||||
view.append_column(Gtk.TreeViewColumn("Kind", kind_renderer, text=1))
|
||||
multi = os.environ.get("CTHULHU_GTK_TABLE_MULTI") == "1"
|
||||
if multi:
|
||||
view.get_selection().set_mode(Gtk.SelectionMode.MULTIPLE)
|
||||
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
||||
button = Gtk.Button(label="Before table")
|
||||
box.pack_start(button, False, False, 0)
|
||||
box.pack_start(view, True, True, 0)
|
||||
window.add(box)
|
||||
else:
|
||||
window.add(view)
|
||||
view.get_selection().select_path(0)
|
||||
if multi:
|
||||
view.get_selection().select_path(1)
|
||||
window.show_all()
|
||||
if multi:
|
||||
button.grab_focus()
|
||||
else:
|
||||
view.grab_focus()
|
||||
Gtk.main()
|
||||
Reference in new issue
Block a user