Added auto char typer
This commit is contained in:
parent
c8a62f2781
commit
0c19f61d88
|
@ -11,11 +11,51 @@ from .signals_mixin import SignalsMixin
|
|||
|
||||
|
||||
|
||||
class Container(SignalsMixin, Gtk.Box):
|
||||
"""docstring for Container."""
|
||||
|
||||
|
||||
|
||||
|
||||
class Auto_Type(Gtk.Box):
|
||||
"""docstring for Auto_Type."""
|
||||
|
||||
def __init__(self):
|
||||
super(Container, self).__init__()
|
||||
super(Auto_Type, self).__init__()
|
||||
|
||||
pad1 = Gtk.Label()
|
||||
pad2 = Gtk.Label()
|
||||
self._auto_typer = Gtk.SearchEntry()
|
||||
self._type_btn = Gtk.Button(label="Type")
|
||||
|
||||
self._auto_typer.set_placeholder_text("Autotype Field...")
|
||||
# self._auto_typer.set_icon_from_icon_name(0, "gtk-go-forward") # PRIMARY = 0, SECONDARY = 1
|
||||
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_signals()
|
||||
self.show_all()
|
||||
|
||||
|
||||
def setup_signals(self):
|
||||
self._type_btn.connect("released", self.type_out)
|
||||
|
||||
def type_out(self, widget = None, eve = None):
|
||||
text = self._auto_typer.get_text()
|
||||
typwriter.type_string(text)
|
||||
|
||||
class Main_Container(SignalsMixin, Gtk.Box):
|
||||
"""docstring for Main_Container."""
|
||||
|
||||
def __init__(self):
|
||||
super(Main_Container, self).__init__()
|
||||
|
||||
self.setup_custom_event_signals()
|
||||
self.setup_styling()
|
||||
|
@ -28,10 +68,27 @@ class Container(SignalsMixin, Gtk.Box):
|
|||
self.set_orientation(0) # HORIZONTAL = 0, VERTICAL = 1
|
||||
self.set_vexpand(True)
|
||||
|
||||
def setup_signals(self):
|
||||
pass
|
||||
|
||||
def add_columns(self):
|
||||
self.add(Left_Column())
|
||||
self.add(Keys_Column())
|
||||
self.add(Right_Column())
|
||||
|
||||
class Container(Gtk.Box):
|
||||
"""docstring for Container."""
|
||||
|
||||
def __init__(self):
|
||||
super(Container, self).__init__()
|
||||
|
||||
self.setup_styling()
|
||||
self.add_content()
|
||||
|
||||
self.show_all()
|
||||
|
||||
|
||||
def setup_styling(self):
|
||||
self.set_orientation(1) # HORIZONTAL = 0, VERTICAL = 1
|
||||
self.set_vexpand(True)
|
||||
|
||||
def add_content(self):
|
||||
self.add(Auto_Type())
|
||||
self.add(Main_Container())
|
||||
|
|
|
@ -36,6 +36,10 @@ class ControlMixin:
|
|||
|
||||
return False
|
||||
|
||||
def type_string(self, text):
|
||||
for char in text:
|
||||
pyautogui.typewrite(char)
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue