Fleshing out rewrite
This commit is contained in:
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()
|
||||
|
||||
Reference in New Issue
Block a user