From 0c19f61d88f74d53fd555ea80dd060d3f7a19d52 Mon Sep 17 00:00:00 2001 From: itdominator <1itdominator@gmail.com> Date: Sun, 28 Aug 2022 00:27:02 -0500 Subject: [PATCH] Added auto char typer --- 1.0.2/core/container.py | 69 +++++++++++++++++++++++++++++--- 1.0.2/utils/pyautogui_control.py | 4 ++ 2 files changed, 67 insertions(+), 6 deletions(-) diff --git a/1.0.2/core/container.py b/1.0.2/core/container.py index d8aaac0..ce00c16 100644 --- a/1.0.2/core/container.py +++ b/1.0.2/core/container.py @@ -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()) diff --git a/1.0.2/utils/pyautogui_control.py b/1.0.2/utils/pyautogui_control.py index 68e60f8..ab9c89b 100644 --- a/1.0.2/utils/pyautogui_control.py +++ b/1.0.2/utils/pyautogui_control.py @@ -36,6 +36,10 @@ class ControlMixin: return False + def type_string(self, text): + for char in text: + pyautogui.typewrite(char) +