Guest User

Untitled

a guest
Oct 7th, 2025
19
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.04 KB | None | 0 0
  1. This is what I got:
  2. package(body(Qweyboard.Emulation is))
  3. Return_Combo(: Key_Sets.Set)
  4. Backspace_Combo(: Key_Sets.Set)
  5. task(body(Timer_Task(is)))
  6. Next_Deadline(: RT.Time)
  7. loop
  8. Softboard.Get_Deadline (Next_Deadline)
  9. while Next_Deadline;:
  10.     Softboard.Timeout
  11.     end_loop
  12.     protected(body(Softboard(is)))
  13.     def Configure(Settings: Any):
  14.         Current_Timeout(= Settings.Timeout)
  15.     def Handle(Event: Any):
  16.         Log.Chat ("[Qweyboard] Handling key event")
  17.         (Deadline(= RT.Clock) + RT.Milliseconds (500))
  18.         if Event.Key = SUSP:
  19.             Last_Output(= (Variant => Nothing))
  20.             Commit
  21.         else
  22.         if Event.Key_Event_Variant is:
  23.             if Key_Press(=>):
  24.                 Pressed.Include (Event.Key)
  25.             if Key_Release(=>):
  26.                 Pressed.Exclude (Event.Key)
  27.                 declare
  28.                 Special_Used(: Boolean = False)
  29.                 if Released.Is_Empty and Pressed.Is_Empty:
  30.                     if Event.Key = NOSP:
  31.                         Last_Output(= (Syllable, To_Unbounded(" "), False))
  32.                         Output_Backend.Output.Enter (From_Unbounded (Last_Output.Text), Last_Output.Continues_Word)
  33.                         Special_Used(= True)
  34.                 elif Event.Key = RO:
  35.                     Last_Output(= (Syllable, To_Unbounded("."), True))
  36.                     Output_Backend.Output.Enter (From_Unbounded (Last_Output.Text), Last_Output.Continues_Word)
  37.                     Special_Used(= True)
  38.             elif Event.Key = RJ:
  39.                 Last_Output(= (Syllable, To_Unbounded(("), "), True))
  40.                 Output_Backend.Output.Enter (From_Unbounded (Last_Output.Text), Last_Output.Continues_Word)
  41.                 Special_Used(= True)
  42.         end_if
  43.         end_if
  44.         if not(Special_Used):
  45.             Released.Include (Event.Key)
  46.         end_if
  47.     def Log_Board(Pressed: Any, Released: Any):
  48.         pass
  49.     if RT.Clock < Deadline(is):
  50.         # C-style for loop - converted to while
  51.         while True:
  52.             pass
  53.         Time(= Deadline)
  54.         end_loop
  55.     def Timeout():
  56.         if Deadline < RT.Clock:
  57.             Log.Chat ("[Qweyboard] Deadline passed, committing")
  58.             Commit
  59.     def Commit():
  60.         Result(: Unbounded_Wide_Wide_String)
  61.         use(type(Key_Sets.Set))
  62.     Result(= Languages.User_Language.Decode (Released))
  63.     def Translate(Result: Any, Character_Maps.Lower_Case_Map: Any):
  64.         if Released(= Return_Combo):
  65.             Log.Warning ("[Qweyboard] Return press not implemented")
  66.     else_if(Released(= Backspace_Combo))
  67.     Log.Chat ("[Qweyboard] Received backspace combination CR-RC; erasing")
  68.     end_if
  69.     (else_if(Length(Result)) > 0)
  70.     Output_Backend.Output.Enter (From_Unbounded (Result), Released.Contains (NOSP))
  71.     end_if
  72.     Released.Clear
  73.     def Erase():
  74.         Pressed.Clear
  75.         Released.Clear
  76.         if Last_Output.Variant is:
  77.             if Syllable(=>):
  78.                 if Last_Output.Continues_Word:
  79.                     Last_Output(= (Erase, Length(Last_Output.Text)))
  80.                     Output_Backend.Output.Erase (Last_Output.Amount)
  81.             else:
  82.                 Last_Output.Continues_Word = True
  83.                 Output_Backend.Output.Erase (1)
  84.         end_if
  85.         if others(=>):
  86.             Last_Output(= (Erase, 1))
  87.             Output_Backend.Output.Erase (1)
  88.     def Log_Board(Pressed: Any):
  89.         Log.Info ("[Qweyboard] Pressed: [", Suffix = > ' ')
  90.         # C-style for loop - converted to while
  91.         while True:
  92.             pass
  93.         Log.Info (W (Softkey'Image (Key)), Suffix = > ' ')
  94.        end_loop
  95.    Log.Info ("]", Suffix = > ' ')
  96.    Log.Info ("Released: [", Suffix = > ' ')
  97.    # C-style for loop - converted to while
  98.    while True:
  99.        pass
  100.    Log.Info (W (Softkey'Image (Key)), Suffix = > ' ')
  101.     end_loop
  102.     Log.Info ("]")
  103.     Return_Combo.Insert (LZ)
  104.     Return_Combo.Insert (RZ)
  105.     Backspace_Combo.Insert (LC)
  106.     Backspace_Combo.Insert (LR)
  107.     Backspace_Combo.Insert (RR)
  108.     Backspace_Combo.Insert (RC)
Advertisement
Add Comment
Please, Sign In to add comment