Fleshing out rewrite
This commit is contained in:
parent
55515a0825
commit
c8a62f2781
@ -47,19 +47,19 @@ keys_json = {
|
||||
"keys": {
|
||||
"row1": {
|
||||
"pKeys": ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0'],
|
||||
"sKeys": ['~', '@', '#', '$', '%', '&', '-', '_', '(', ')'],
|
||||
"sKeys": ['~', '^', '#', '$', '%', '&', '-', '_', '(', ')'],
|
||||
},
|
||||
"row2": {
|
||||
"pKeys": ['q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p'],
|
||||
"sKeys": ['\\', '/', '|', ':', '{', '}', '[', ']', '<', '>'],
|
||||
"sKeys": ['\\', '/', '|', ':', '=', '+', '"', '*', '<', '>'],
|
||||
},
|
||||
"row3": {
|
||||
"pKeys": ['a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', "'"],
|
||||
"sKeys": ['=', '+', '"', '*', '^', '`', ';', '!', '', ''],
|
||||
"sKeys": ['`', '', '', '', '', '', '', '', '[', ']'],
|
||||
},
|
||||
"row4": {
|
||||
"pKeys": ['z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '?'],
|
||||
"sKeys": ['', '', '', '', '', '', '', '', '', '']
|
||||
"sKeys": ['', '', '', '', '', '', ';', '!', '{', '}']
|
||||
},
|
||||
}
|
||||
}
|
||||
|
48
1.0.2/core/columns/bottom_key_row.py
Normal file
48
1.0.2/core/columns/bottom_key_row.py
Normal file
@ -0,0 +1,48 @@
|
||||
# Python imports
|
||||
|
||||
# Lib imports
|
||||
import gi
|
||||
gi.require_version('Gtk', '3.0')
|
||||
from gi.repository import Gtk
|
||||
|
||||
# Application imports
|
||||
from ..widgets.key import Key
|
||||
|
||||
|
||||
|
||||
|
||||
class AT_Key(Key):
|
||||
def __init__(self):
|
||||
super(AT_Key, self).__init__("@", "@")
|
||||
|
||||
class Space_Key(Key):
|
||||
def __init__(self):
|
||||
super(Space_Key, self).__init__("Space", "Space")
|
||||
|
||||
|
||||
def setup_signals(self):
|
||||
self.connect("released", self._clicked)
|
||||
|
||||
def _clicked(self, widget = None):
|
||||
typwriter.press_special_keys(self.get_label())
|
||||
|
||||
class COM_Key(Key):
|
||||
def __init__(self):
|
||||
super(COM_Key, self).__init__(".com", ".com")
|
||||
|
||||
|
||||
def setup_signals(self):
|
||||
self.connect("released", self._clicked)
|
||||
|
||||
|
||||
class Bottom_Key_Row(Gtk.Box):
|
||||
def __init__(self):
|
||||
super(Bottom_Key_Row, self).__init__()
|
||||
|
||||
self.set_property("homogeneous", True)
|
||||
|
||||
for key in [AT_Key(), Space_Key(), COM_Key()]:
|
||||
self.add(key)
|
||||
|
||||
def tempMethod(self, widget, data=None):
|
||||
pass
|
@ -7,7 +7,7 @@ from gi.repository import Gtk
|
||||
|
||||
# Application imports
|
||||
from ..widgets.key import Key
|
||||
|
||||
from .bottom_key_row import Bottom_Key_Row
|
||||
|
||||
|
||||
class KeyboardRowMatchError(Exception):
|
||||
@ -45,16 +45,15 @@ class Keys_Column(Gtk.Box):
|
||||
|
||||
row_box = self.add_row()
|
||||
if len(pKeys) == len(sKeys):
|
||||
for i in range(9):
|
||||
for i in range(10):
|
||||
pkey = pKeys[i]
|
||||
sKey = sKeys[i]
|
||||
row_box.add(Key(pkey, sKey))
|
||||
else:
|
||||
raise KeyboardRowMatchError("A row in keys_json has missmatched pKeys and sKeys lengths.")
|
||||
|
||||
row_box = self.add_row()
|
||||
for key in ['Symbols', 'Space', 'Backspace']:
|
||||
row_box.add(Key(key, key))
|
||||
self.add(Bottom_Key_Row())
|
||||
|
||||
|
||||
def add_row(self):
|
||||
row_box = Gtk.Box()
|
||||
|
@ -6,32 +6,58 @@ gi.require_version('Gtk', '3.0')
|
||||
from gi.repository import Gtk
|
||||
|
||||
# Application imports
|
||||
from ..widgets.key import Key
|
||||
|
||||
import traceback
|
||||
|
||||
|
||||
|
||||
|
||||
class Left_Column(Gtk.Button):
|
||||
"""docstring for Left_Column."""
|
||||
|
||||
class Symbols_Key(Key):
|
||||
def __init__(self):
|
||||
super(Left_Column, self).__init__()
|
||||
super(Symbols_Key, self).__init__("Symbols", "Symbols")
|
||||
|
||||
self.setup_styling()
|
||||
self.setup_signals()
|
||||
self.show_all()
|
||||
|
||||
|
||||
def setup_styling(self):
|
||||
self.set_label("Caps")
|
||||
|
||||
def setup_signals(self):
|
||||
self.connect("released", self._clicked)
|
||||
|
||||
def _clicked(self, widget = None):
|
||||
key_columns = self.get_parent().get_children()[1]
|
||||
limit = len(key_columns.get_children()) - 1
|
||||
key_columns = self.get_parent().get_parent().get_children()[1]
|
||||
|
||||
for i, row in enumerate(key_columns.get_children()):
|
||||
if not i == limit:
|
||||
for key in row:
|
||||
key.emit("toggle-caps", ())
|
||||
for row in key_columns.get_children():
|
||||
for key in row:
|
||||
key.emit("toggle-symbol-keys", ())
|
||||
|
||||
class CAPS_Key(Gtk.ToggleButton):
|
||||
def __init__(self):
|
||||
super(CAPS_Key, self).__init__("Caps", "Caps")
|
||||
|
||||
self.set_vexpand(True)
|
||||
|
||||
self.setup_signals()
|
||||
self.show_all()
|
||||
|
||||
|
||||
def setup_signals(self):
|
||||
self.connect("clicked", self._clicked)
|
||||
|
||||
def _clicked(self, widget = None):
|
||||
key_columns = self.get_parent().get_parent().get_children()[1]
|
||||
|
||||
for row in key_columns.get_children():
|
||||
for key in row:
|
||||
key.emit("toggle-caps", ())
|
||||
|
||||
|
||||
class Left_Column(Gtk.Box):
|
||||
"""docstring for Left_Column."""
|
||||
|
||||
def __init__(self):
|
||||
super(Left_Column, self).__init__()
|
||||
|
||||
|
||||
self.set_orientation(1) # HORIZONTAL = 0, VERTICAL = 1
|
||||
|
||||
self.add(Symbols_Key())
|
||||
self.add(CAPS_Key())
|
||||
self.show_all()
|
||||
|
@ -6,26 +6,43 @@ gi.require_version('Gtk', '3.0')
|
||||
from gi.repository import Gtk
|
||||
|
||||
# Application imports
|
||||
from ..widgets.key import Key
|
||||
|
||||
|
||||
|
||||
|
||||
class Right_Column(Gtk.Button):
|
||||
"""docstring for Right_Column."""
|
||||
|
||||
class Backspace_Key(Key):
|
||||
def __init__(self):
|
||||
super(Right_Column, self).__init__()
|
||||
super(Backspace_Key, self).__init__("Backspace", "Backspace")
|
||||
|
||||
self.setup_styling()
|
||||
self.setup_signals()
|
||||
self.show_all()
|
||||
|
||||
|
||||
def setup_styling(self):
|
||||
self.set_label("Enter")
|
||||
|
||||
def setup_signals(self):
|
||||
self.connect("released", self._clicked)
|
||||
|
||||
def _clicked(self, widget = None):
|
||||
typwriter.enter()
|
||||
typwriter.press_special_keys(self.get_label())
|
||||
|
||||
class Enter_Key(Key):
|
||||
def __init__(self):
|
||||
super(Enter_Key, self).__init__("Enter", "Enter")
|
||||
self.set_vexpand(True)
|
||||
|
||||
|
||||
def setup_signals(self):
|
||||
self.connect("released", self._clicked)
|
||||
|
||||
def _clicked(self, widget = None):
|
||||
typwriter.press_special_keys(self.get_label())
|
||||
|
||||
|
||||
class Right_Column(Gtk.Box):
|
||||
"""docstring for Right_Column."""
|
||||
|
||||
def __init__(self):
|
||||
super(Right_Column, self).__init__()
|
||||
|
||||
self.set_orientation(1) # HORIZONTAL = 0, VERTICAL = 1
|
||||
|
||||
self.add(Backspace_Key())
|
||||
self.add(Enter_Key())
|
||||
self.show_all()
|
||||
|
@ -15,3 +15,4 @@ class SignalsMixin:
|
||||
|
||||
def setup_custom_event_signals(self):
|
||||
GObject.signal_new('toggle-caps', Key, GObject.SIGNAL_RUN_LAST, GObject.TYPE_PYOBJECT, (GObject.TYPE_PYOBJECT,))
|
||||
GObject.signal_new('toggle-symbol-keys', Key, GObject.SIGNAL_RUN_LAST, GObject.TYPE_PYOBJECT, (GObject.TYPE_PYOBJECT,))
|
||||
|
@ -15,20 +15,29 @@ class Key(Gtk.Button):
|
||||
self._primary_symbol = primary
|
||||
self._secondary_symbol = secondary
|
||||
self._is_upper = False
|
||||
self._is_symbol = False
|
||||
|
||||
self.set_label(self._primary_symbol)
|
||||
|
||||
self.setup_signals()
|
||||
|
||||
|
||||
def toggle_caps(self, widget = None, eve = None):
|
||||
self._is_upper = not self._is_upper
|
||||
self.set_label(self._primary_symbol.upper()) if self._is_upper else self.set_label(self._primary_symbol.lower())
|
||||
|
||||
def setup_signals(self):
|
||||
self.connect("released", self._clicked)
|
||||
self.connect("toggle-caps", self.toggle_caps)
|
||||
self.connect("toggle-symbol-keys", self.toggle_symbol_keys)
|
||||
|
||||
def _clicked(self, widget = None):
|
||||
key = self.get_label().strip()
|
||||
typwriter.type(key)
|
||||
|
||||
def toggle_symbol_keys(self, widget = None, eve = None):
|
||||
self._is_symbol = not self._is_symbol
|
||||
if self._is_symbol:
|
||||
self.set_label(self._secondary_symbol)
|
||||
else:
|
||||
self.set_label(self._primary_symbol.upper()) if self._is_upper else self.set_label(self._primary_symbol.lower())
|
||||
|
||||
def toggle_caps(self, widget = None, eve = None):
|
||||
self._is_upper = not self._is_upper
|
||||
if not self._is_symbol:
|
||||
self.set_label(self._primary_symbol.upper()) if self._is_upper else self.set_label(self._primary_symbol.lower())
|
||||
|
@ -1,4 +1,5 @@
|
||||
# Python imports
|
||||
import os
|
||||
|
||||
# Lib imports
|
||||
import gi
|
||||
@ -10,12 +11,15 @@ from .container import Container
|
||||
|
||||
|
||||
|
||||
|
||||
class Window(Gtk.ApplicationWindow):
|
||||
"""docstring for Window."""
|
||||
|
||||
def __init__(self, args, unknownargs):
|
||||
super(Window, self).__init__()
|
||||
|
||||
self._SCRIPT_PTH = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
self.setup_styling()
|
||||
self.setup_signals()
|
||||
self.add(Container())
|
||||
@ -24,9 +28,12 @@ class Window(Gtk.ApplicationWindow):
|
||||
|
||||
|
||||
def setup_styling(self):
|
||||
# self.set_icon_from_file("/usr/share/bulkr/bulkr.png")
|
||||
self.set_icon_from_file(f"{self._SCRIPT_PTH}/../resources/icon.png")
|
||||
self.set_title(app_name)
|
||||
self.set_default_size(800, 200)
|
||||
self.set_accept_focus(False)
|
||||
self.set_skip_taskbar_hint(True)
|
||||
self.set_skip_pager_hint(True)
|
||||
self.set_type_hint(3) # 3 = TOOLBAR
|
||||
self.set_gravity(8) # 5 = CENTER, 8 = SOUTH
|
||||
self.set_position(1) # 1 = CENTER, 4 = CENTER_ALWAYS
|
||||
|
18
1.0.2/debugger.sh
Executable file
18
1.0.2/debugger.sh
Executable file
@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
# . CONFIG.sh
|
||||
|
||||
# set -o xtrace ## To debug scripts
|
||||
# set -o errexit ## To exit on error
|
||||
# set -o errunset ## To exit if a variable is referenced but not set
|
||||
|
||||
|
||||
function main() {
|
||||
SCRIPTPATH="$( cd "$(dirname "")" >/dev/null 2>&1 ; pwd -P )"
|
||||
cd "${SCRIPTPATH}"
|
||||
echo "Working Dir: " $(pwd)
|
||||
|
||||
source '/home/abaddon/Portable_Apps/py-venvs/gtk-apps-venv/venv/bin/activate'
|
||||
python -m pudb $(pwd)/__main__.py; bash
|
||||
}
|
||||
main "$@";
|
1593
1.0.2/resources/Unicode Emoji List.txt
Normal file
1593
1.0.2/resources/Unicode Emoji List.txt
Normal file
File diff suppressed because it is too large
Load Diff
@ -17,10 +17,28 @@ class ControlMixin:
|
||||
def type(self, key):
|
||||
pyautogui.typewrite(key)
|
||||
|
||||
|
||||
def enter(self, widget = None, data = None):
|
||||
pyautogui.press("enter")
|
||||
|
||||
def backspace(self, widget = None, data=None):
|
||||
pyautogui.press("backspace")
|
||||
|
||||
def press_special_keys(self, key):
|
||||
if key in ["Backspace", "Enter", "Esc", "Tab", "Space", "Del", "Up", "Down", "Left", "Right", "PrtSc"]:
|
||||
pyautogui.press(key.lower())
|
||||
return True
|
||||
|
||||
for i in range(1, 13):
|
||||
fkey = 'F' + str(i)
|
||||
if key == fkey:
|
||||
pyautogui.press(key.lower())
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# def typeString(self, widget = None, data = None):
|
||||
# text = self.autoTypeField.get_text()
|
||||
|
Loading…
Reference in New Issue
Block a user