refactored auto fill option

This commit is contained in:
itdominator 2024-08-31 01:02:28 -05:00
parent e688416244
commit 305cae4210
1 changed files with 21 additions and 19 deletions

View File

@ -36,6 +36,26 @@ class Auto_Type(Gtk.Box):
self._auto_typer = Gtk.SearchEntry() self._auto_typer = Gtk.SearchEntry()
self._type_btn = Gtk.Button(label = "Type") self._type_btn = Gtk.Button(label = "Type")
self._auto_typer.set_placeholder_text("Autotype Field...")
self._auto_typer.set_icon_from_stock(0, "gtk-go-forward") # PRIMARY = 0, SECONDARY = 1
self._auto_typer.set_can_focus(True)
self._auto_typer.set_hexpand(True)
pad1.set_hexpand(True)
pad2.set_hexpand(True)
self.add(pad1)
self.add(self._auto_typer)
self.add(self._type_btn)
self.add(pad2)
self.setup_auto_completion()
self.setup_styling()
self.setup_signals()
self.show_all()
def setup_auto_completion(self):
if auto_completion:
self._word_list = Gtk.Box() self._word_list = Gtk.Box()
scrolled_win = Gtk.ScrolledWindow() scrolled_win = Gtk.ScrolledWindow()
viewport = Gtk.Viewport() viewport = Gtk.Viewport()
@ -50,28 +70,10 @@ class Auto_Type(Gtk.Box):
self._res_popover.add(scrolled_win) self._res_popover.add(scrolled_win)
self._res_popover.set_default_widget(scrolled_win) self._res_popover.set_default_widget(scrolled_win)
self._auto_typer.set_placeholder_text("Autotype Field...")
self._auto_typer.set_icon_from_stock(0, "gtk-go-forward") # PRIMARY = 0, SECONDARY = 1
self._auto_typer.set_can_focus(True)
self._auto_typer.set_hexpand(True)
self._word_list.set_orientation(Gtk.Orientation.VERTICAL) self._word_list.set_orientation(Gtk.Orientation.VERTICAL)
pad1.set_hexpand(True)
pad2.set_hexpand(True)
self.add(pad1)
self.add(self._auto_typer)
self.add(self._type_btn)
self.add(pad2)
if auto_completion:
self.setup_dictionary() self.setup_dictionary()
self.setup_styling()
self.setup_signals()
self.show_all()
@daemon_threaded @daemon_threaded
def setup_dictionary(self): def setup_dictionary(self):
self._processing_dictionary = True self._processing_dictionary = True